diff --git a/CHANGELOG.md b/CHANGELOG.md index 6542dbf68..45a407edd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to Bambuddy will be documented in this file. ## [1.2.6b1] - Unreleased ### Added +- **Notify! notification provider with iOS Live Activities and Lock Screen widgets (#2919, requested and contributed by @simplytoast1 in #3265)** — Notify! used to need the separate notify-bambuddy companion container. Bambuddy now talks to it directly: add a provider of type Notify! with the device ID and token. + - **Alerts:** the usual events, printer filter, quiet hours and daily digest apply as for every provider, with the camera photo attached. Each printer gets its own notification thread. **Time Sensitive problem alerts** sends failures, stops, printer errors and failure detection as time-sensitive notifications. + - **Live Activities:** with **Live Activities (iOS)** on, each running print shows a tile on the Lock Screen with a countdown to the end. A fault, a pause, running out of filament or a lost connection replaces the countdown with the problem. Progress style, extra values (progress, ETA, layer, temperatures), print stage, a privacy mode that hides the file name, symbol, colour and a button that opens Bambuddy can be set under **Live Activity appearance**. A dismissed tile stays dismissed for that print, and tiles survive a Bambuddy restart. + - **Lock Screen widgets:** with **Lock Screen Widgets (iOS)** on, each active printer gets a widget showing its status and progress, added through iOS's Lock Screen customisation. iOS refreshes widgets on its own schedule, roughly every 15 minutes. Notify! allows ten widgets per device, so **All printers** creates at most ten. + - **Browser and group recipients** (IDs starting with `WB` or `GRP`) get text alerts only, without photos, Live Activities or widgets. Mac recipients (`MC`) get alerts with photos, but no Live Activities or widgets. + - **Nothing runs until it's used:** without a Notify! provider the background workers stay idle. Stop the companion container before turning on Live Activities here, or each print gets two tiles. - **Spoolman mode uses Spoolman 0.27's native tags (#3168, requested and contributed by @Niko11111 in #3252)** — Spoolman 0.27 links NFC tags to spools itself: a spool can hold several tags, and Spoolman makes sure no two spools share one. Bambuddy kept its single tag per spool in its own `extra.tag` field, so neither side saw the other's links, a Bambu spool could hold only one of its identifiers, and every SpoolBuddy scan loaded the whole inventory. - **Faster scans:** on Spoolman 0.27 or later, a scan asks Spoolman for the tag directly instead of loading every spool (17 ms instead of 88 ms on a 278-spool install). The old lookup is kept as a fallback for spools linked before. - **Tags collect themselves:** a spool found by a scan or an AMS read gets what was read added to its tags. A Bambu spool collects its tray UUID and the chip UID of each side over time. The AMS also finds a spool linked by its chip alone. diff --git a/static/assets/AdditionalSection-ZKpgGfxh.js b/static/assets/AdditionalSection-ZKpgGfxh.js new file mode 100644 index 000000000..dc610748b --- /dev/null +++ b/static/assets/AdditionalSection-ZKpgGfxh.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,w as r}from"./client-DnySrlFv.js";import{a as i,i as a}from"./info-ROUoQhJR.js";import{n as o}from"./ToastContext-BRX0SW3C.js";import{t as s}from"./cloud-off-DfYbNG2N.js";import{t as c}from"./loader-circle-BEmFtawu.js";import{t as l}from"./scale-CD6XdXUk.js";import{t as u}from"./search-0n0CBc74.js";import{t as d}from"./sparkles-DRqKNlhr.js";import{t as f}from"./x-DR-Trv6U.js";import{y as p}from"./date-G9KUauqz.js";import{n as m,t as h}from"./filamentSwatchHelpers-D3oXQSGk.js";import{Dn as g,N as _,On as v,lt as y,w as b}from"./index-CovRLYqQ.js";import{_ as x,h as S,u as C,y as w}from"./utils-dMg0ogiz.js";var T={material:``,subtype:``,brand:``,color_name:``,rgba:`808080FF`,extra_colors:``,effect_type:``,label_weight:1e3,core_weight:250,core_weight_catalog_id:null,weight_used:0,slicer_filament:``,note:``,cost_per_kg:null,category:``,low_stock_threshold_pct:null,material_number:``,location_id:null,last_dried_at:``,spoolman_filament_id:null},E=new Set([`material`,`subtype`,`brand`,`rgba`,`color_name`,`label_weight`]);function D(e,t=!1,n=!1,r=`create`){let i={};return t||n||r!==`create`?(!e.material&&!e.spoolman_filament_id&&(i.material=`Material is required`),{isValid:Object.keys(i).length===0,errors:i}):(e.slicer_filament||(i.slicer_filament=`Slicer preset is required`),e.material||(i.material=`Material is required`),e.brand||(i.brand=`Brand is required`),e.subtype||(i.subtype=`Subtype is required`),{isValid:Object.keys(i).length===0,errors:i})}var O=e(n(),1),k=t(),A={local:`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`,orca_cloud:`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`,cloud:`bg-bambu-blue/20 text-bambu-blue`,builtin:`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`};function j({source:e}){let{t}=r(),n={local:t(`profiles.localProfiles.badge`),orca_cloud:t(`configureAmsSlot.orcaCloud`),cloud:t(`configureAmsSlot.bambuCloud`),builtin:t(`configureAmsSlot.builtin`)}[e];return(0,k.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded whitespace-nowrap ${A[e]}`,children:n})}function M({value:e,options:t,inheritLabel:n,onChange:a,disabled:o=!1,ariaLabel:s}){let{t:c}=r(),[l,d]=(0,O.useState)(!1),[p,m]=(0,O.useState)(``),h=(0,O.useRef)(null),g=t.find(t=>t.code===e);(0,O.useEffect)(()=>{if(!l)return;let e=e=>{h.current&&!h.current.contains(e.target)&&d(!1)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),d(!1))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t,!0),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t,!0)}},[l]);let _=p.trim().toLowerCase(),v=_?t.filter(e=>e.displayName.toLowerCase().includes(_)):t,y=e=>{a(e),d(!1),m(``)};return(0,k.jsxs)(`div`,{className:`relative`,ref:h,children:[(0,k.jsxs)(`button`,{type:`button`,"aria-label":s,"aria-haspopup":`listbox`,"aria-expanded":l,disabled:o,onClick:()=>d(e=>!e),className:`w-full flex items-center gap-2 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-left focus:outline-none focus:border-bambu-green disabled:opacity-50`,children:[(0,k.jsx)(`span`,{className:`flex-1 min-w-0 truncate ${g?`text-white`:`text-bambu-gray italic`}`,children:g?g.displayName:n}),g&&(0,k.jsx)(j,{source:g.source}),(0,k.jsx)(i,{className:`w-3.5 h-3.5 text-bambu-gray shrink-0`})]}),l&&(0,k.jsxs)(`div`,{className:`absolute z-50 mt-1 w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl`,children:[(0,k.jsx)(`div`,{className:`p-2 border-b border-bambu-dark-tertiary`,children:(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(u,{className:`w-3.5 h-3.5 text-bambu-gray absolute left-2 top-1/2 -translate-y-1/2`}),(0,k.jsx)(`input`,{autoFocus:!0,type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:c(`inventory.searchPresets`),className:`w-full pl-7 pr-7 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded-md text-sm text-white placeholder:text-bambu-gray/60 focus:outline-none focus:border-bambu-green`}),p&&(0,k.jsx)(`button`,{type:`button`,"aria-label":c(`common.clear`),onClick:()=>m(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,k.jsx)(f,{className:`w-3.5 h-3.5`})})]})}),(0,k.jsxs)(`div`,{className:`max-h-56 overflow-y-auto p-1`,role:`listbox`,"aria-label":s,children:[(0,k.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":!g,onClick:()=>y(null),className:`w-full text-left px-2 py-1.5 rounded-md text-sm italic ${g?`text-bambu-gray hover:bg-bambu-dark`:`bg-bambu-green/15 text-bambu-green`}`,children:n}),v.length===0?(0,k.jsx)(`p`,{className:`px-2 py-2 text-sm text-bambu-gray`,children:c(`inventory.noResults`)}):v.map(t=>(0,k.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t.code===e,onClick:()=>y(t),className:`w-full flex items-center gap-2 text-left px-2 py-1.5 rounded-md text-sm ${t.code===e?`bg-bambu-green/15 text-bambu-green`:`text-white hover:bg-bambu-dark`}`,children:[(0,k.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,title:t.displayName,children:t.displayName}),(0,k.jsx)(j,{source:t.source})]},t.code))]})]})]})}function N(e,t){if(t.length===0)return{top:[],rest:e};let n=new Set(t.map(e=>e.toLowerCase()));return{top:e.filter(e=>n.has(e.toLowerCase())),rest:e.filter(e=>!n.has(e.toLowerCase()))}}function P({label:e}){return(0,k.jsx)(`div`,{className:`px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-bambu-gray/70 bg-bambu-dark-tertiary/40`,children:e})}function F({formData:e,updateField:t,cloudAuthenticated:n,loadingCloudPresets:a,presetInputValue:o,setPresetInputValue:l,selectedPresetOption:d,filamentOptions:f,availableBrands:p,availableMaterials:m,suggestedBrands:h,suggestedMaterials:v,quickAdd:y,detailsRequired:b,quantity:S,onQuantityChange:w,errors:T}){let{t:E}=r(),[D,A]=(0,O.useState)(!1),[M,F]=(0,O.useState)(!1),[I,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(``),[H,U]=(0,O.useState)(``),[W,G]=(0,O.useState)(``),[ee,K]=(0,O.useState)(String(e.label_weight)),[te,ne]=(0,O.useState)(!1),[re,ie]=(0,O.useState)(new Set),q=(0,O.useRef)(null),J=(0,O.useRef)(null),ae=(0,O.useRef)(null),oe=(0,O.useRef)(null);(0,O.useEffect)(()=>{let e=e=>{q.current&&!q.current.contains(e.target)&&A(!1),oe.current&&!oe.current.contains(e.target)&&z(!1),J.current&&!J.current.contains(e.target)&&F(!1),ae.current&&!ae.current.contains(e.target)&&L(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let se=(0,O.useMemo)(()=>{if(!o)return f;let e=o.toLowerCase();return f.filter(t=>t.displayName.toLowerCase().includes(e)||t.code.toLowerCase().includes(e))},[f,o]),Y=(0,O.useMemo)(()=>{if(!B)return p;let e=B.toLowerCase();return p.filter(t=>t.toLowerCase().includes(e)).sort((t,n)=>{let r=t.toLowerCase()===e,i=n.toLowerCase()===e;return r&&!i?-1:!r&&i?1:t.localeCompare(n)})},[p,B]),ce=(0,O.useMemo)(()=>{if(!H)return x;let e=H.toLowerCase();return x.filter(t=>t.toLowerCase().includes(e))},[H]),X=(0,O.useMemo)(()=>{if(!W)return m;let e=W.toLowerCase();return m.filter(t=>t.toLowerCase().includes(e)).sort((t,n)=>{let r=t.toLowerCase()===e,i=n.toLowerCase()===e;return r&&!i?-1:!r&&i?1:t.localeCompare(n)})},[W,m]),Z=(0,O.useMemo)(()=>N(Y,h),[Y,h]),Q=(0,O.useMemo)(()=>N(X,v),[X,v]);(0,O.useEffect)(()=>{te||K(String(e.label_weight))},[e.label_weight,te]);let le=n=>{t(`slicer_filament`,n.code),l(n.displayName),A(!1);let r=C(n.name),i=new Set,a=[[`material`,r.material],[`brand`,r.brand],[`subtype`,r.variant]];for(let[n,r]of a)r&&(e[n]&&!re.has(n)||(t(n,r),i.add(n)));ie(i)},$=(e,n)=>{re.has(e)&&ie(t=>{let n=new Set(t);return n.delete(e),n}),t(e,n)},ue=t=>(0,k.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e.brand===t?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{$(`brand`,t),F(!1),V(``)},children:t},t),de=t=>(0,k.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e.material===t?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{$(`material`,t),z(!1),G(``)},children:t},t);return(0,k.jsxs)(`div`,{className:`space-y-4`,children:[!y&&(0,k.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray`,children:a?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(c,{className:`w-3 h-3 animate-spin`}),` `,E(`inventory.loadingPresets`)]}):n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(g,{className:`w-3 h-3 text-bambu-green`}),` `,E(`inventory.cloudConnected`)]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(s,{className:`w-3 h-3`}),` `,E(`inventory.cloudNotConnected`)]})}),!y&&(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:[E(`inventory.slicerPreset`),b&&` *`]}),(0,k.jsxs)(`div`,{className:`relative`,ref:q,children:[(0,k.jsx)(u,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),(0,k.jsx)(`input`,{type:`text`,className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:E(`inventory.searchPresets`),value:o,onChange:e=>{l(e.target.value),A(!0)},onFocus:()=>{A(!0),l(``)}}),D&&(0,k.jsx)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-64 overflow-y-auto`,children:se.length===0?(0,k.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:E(`inventory.noPresetsFound`)}):se.map(e=>(0,k.jsxs)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2 ${d?.code===e.code?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>le(e),children:[(0,k.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,title:e.displayName,children:e.displayName}),(0,k.jsx)(j,{source:e.source})]},`${e.code}::${e.name}`))})]}),d&&(0,k.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray`,children:[E(`inventory.selectedPreset`),`: `,(0,k.jsx)(`span`,{className:`font-mono text-bambu-green`,children:d.code})]}),T?.slicer_filament&&(0,k.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:T.slicer_filament})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:[E(`inventory.material`),` *`]}),(0,k.jsxs)(`div`,{className:`relative`,ref:oe,children:[(0,k.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:E(`inventory.selectMaterial`),value:R?W:e.material,onChange:e=>{G(e.target.value),z(!0)},onFocus:()=>{z(!0),G(``)}}),(0,k.jsx)(i,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),R&&(0,k.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto`,children:[X.length===0?(0,k.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:E(`inventory.noResults`)}):(0,k.jsxs)(k.Fragment,{children:[Q.top.length>0&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(P,{label:E(`inventory.suggestedOptions`)}),Q.top.map(de)]}),Q.rest.length>0&&(0,k.jsxs)(k.Fragment,{children:[Q.top.length>0&&(0,k.jsx)(P,{label:E(`inventory.allOptions`)}),Q.rest.map(de)]})]}),W&&!X.includes(W)&&(0,k.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary`,onClick:()=>{$(`material`,W),z(!1),G(``)},children:E(`inventory.useCustomMaterial`,{material:W})})]})]}),T?.material&&(0,k.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:T.material})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:[E(`inventory.brand`),b&&` *`]}),(0,k.jsxs)(`div`,{className:`relative`,ref:J,children:[(0,k.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:E(`inventory.searchBrand`),value:M?B:e.brand,onChange:e=>{V(e.target.value),F(!0)},onFocus:()=>{F(!0),V(``)}}),(0,k.jsx)(i,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),M&&(0,k.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto`,children:[Y.length===0?(0,k.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:E(`inventory.noResults`)}):(0,k.jsxs)(k.Fragment,{children:[Z.top.length>0&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(P,{label:E(`inventory.suggestedOptions`)}),Z.top.map(ue)]}),Z.rest.length>0&&(0,k.jsxs)(k.Fragment,{children:[Z.top.length>0&&(0,k.jsx)(P,{label:E(`inventory.allOptions`)}),Z.rest.map(ue)]})]}),B&&!Y.includes(B)&&(0,k.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary`,onClick:()=>{$(`brand`,B),F(!1),V(``)},children:E(`inventory.useCustomBrand`,{brand:B})})]})]}),T?.brand&&(0,k.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:T.brand})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:[E(`inventory.subtype`),b&&` *`]}),(0,k.jsxs)(`div`,{className:`relative`,ref:ae,children:[(0,k.jsx)(`input`,{type:`text`,value:I?H:e.subtype,onChange:e=>{U(e.target.value),L(!0)},onFocus:()=>{L(!0),U(``)},placeholder:`Basic, Matte, Silk...`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`}),(0,k.jsx)(i,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),I&&(0,k.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto`,children:[ce.length===0?(0,k.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:E(`inventory.noResults`)}):ce.map(t=>(0,k.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e.subtype===t?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{$(`subtype`,t),L(!1),U(``)},children:t},t)),H&&!x.some(e=>e.toLowerCase()===H.toLowerCase().trim())&&(0,k.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary`,onClick:()=>{$(`subtype`,H),L(!1),U(``)},children:E(`inventory.useCustomBrand`,{brand:H})})]})]}),T?.subtype&&(0,k.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:T.subtype})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:E(`inventory.labelWeight`)}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(`input`,{type:`number`,className:`w-full px-3 py-2 pr-7 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,value:ee,min:0,onFocus:()=>ne(!0),onChange:e=>K(e.target.value),onBlur:()=>{ne(!1);let n=ee.trim(),r=Number(n);if(!n||!Number.isFinite(r)||r<0){K(String(e.label_weight));return}let i=Math.round(r);t(`label_weight`,i),K(String(i))}}),(0,k.jsx)(`span`,{className:`absolute right-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray`,children:`g`})]})]}),y&&(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:E(`inventory.quantity`)}),(0,k.jsx)(_,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,value:S,min:1,max:100,onChange:w,fallback:1})]})]})}function I(e){let t=e.split(/[\s,]+/).map(e=>e.trim().replace(/^#/,``)).filter(Boolean),n=[],r=[];for(let e of t)(e.length===6||e.length===8)&&/^[0-9a-fA-F]+$/.test(e)?n.push(e.toLowerCase()):r.push(e);return{value:n.join(`,`),invalid:r}}function L({formData:e,updateField:t,recentColors:n,onColorUsed:o,catalogColors:s}){let{t:c}=r(),[l,f]=(0,O.useState)(!1),[p,g]=(0,O.useState)(``),_=(e.rgba.replace(`#`,``)+`FF`).substring(0,8).toUpperCase(),x=_.substring(0,6),C=_.substring(6,8)===`00`,[T,E]=(0,O.useState)(C?_:x);(0,O.useEffect)(()=>{E(C?_:x)},[x,_,C]);let D=e=>_===(e.replace(`#`,``)+`FF`).substring(0,8).toUpperCase(),A=e=>y(e),j=(e,n,r,i)=>{let a=e.replace(`#`,``).toUpperCase();if(t(`rgba`,a.length===8?a:a+`FF`),t(`color_name`,n),r!==void 0){let e=r??``;R(e),B([]),V.current=e,t(`extra_colors`,e)}i!==void 0&&t(`effect_type`,i??``),o({name:n,hex:e})},M=(0,O.useMemo)(()=>{if(s.length===0)return[];let t=e.brand?.trim(),n=e.material?.toLowerCase().trim(),r=e.subtype?.toLowerCase().trim();if(!t&&!n)return[];let i=t?t.toLowerCase().split(/[\s\-_]+/).filter(e=>e.length>=2):[],a=e=>{if(i.length===0)return!0;let t=e.toLowerCase();return i.some(e=>t.includes(e))};if(t&&!n){let e=s.filter(e=>a(e.manufacturer));if(e.length>0)return e.map(e=>({name:e.color_name,hex:e.hex_color.replace(`#`,``).substring(0,6),manufacturer:e.manufacturer,material:typeof e.material==`string`?e.material:void 0,extra_colors:e.extra_colors??null,effect_type:e.effect_type??null}))}let o=n&&r?`${n} ${r}`:``;if(o){let e=s.filter(e=>a(e.manufacturer)&&e.material?.toLowerCase()===o);if(e.length>0)return e.map(e=>({name:e.color_name,hex:e.hex_color.replace(`#`,``).substring(0,6),manufacturer:e.manufacturer,material:typeof e.material==`string`?e.material:void 0,extra_colors:e.extra_colors??null,effect_type:e.effect_type??null}));let t=o.replace(/\+$/,``);if(t!==o){let e=s.filter(e=>a(e.manufacturer)&&e.material?.toLowerCase()===t);if(e.length>0)return e.map(e=>({name:e.color_name,hex:e.hex_color.replace(`#`,``).substring(0,6),manufacturer:e.manufacturer,material:typeof e.material==`string`?e.material:void 0}))}}if(n){let e=s.filter(e=>a(e.manufacturer)&&(!e.material||e.material.toLowerCase().startsWith(n)));if(e.length>0)return e.map(e=>({name:e.color_name,hex:e.hex_color.replace(`#`,``).substring(0,6),manufacturer:e.manufacturer,material:typeof e.material==`string`?e.material:void 0,extra_colors:e.extra_colors??null,effect_type:e.effect_type??null}))}return[]},[s,e.brand,e.material,e.subtype]),N=(0,O.useMemo)(()=>{if(!p)return M;if(M.length===0)return[];let e=p.toLowerCase();return M.filter(t=>t.name.toLowerCase().includes(e)||(t.manufacturer?.toLowerCase().includes(e)??!1)||(t.material?.toLowerCase().includes(e)??!1))},[p,M]),P=M.length>0,F=(0,O.useMemo)(()=>p?S.filter(e=>e.name.toLowerCase().includes(p.toLowerCase())):l?S:w,[p,l]),[L,R]=(0,O.useState)(e.extra_colors),[z,B]=(0,O.useState)([]),V=(0,O.useRef)(e.extra_colors);(0,O.useEffect)(()=>{e.extra_colors!==V.current&&(R(e.extra_colors),B([]),V.current=e.extra_colors)},[e.extra_colors]);let H=(0,O.useMemo)(()=>m({rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,subtype:e.subtype,effectSize:`bar`}),[e.rgba,e.extra_colors,e.effect_type,e.subtype]),U=e=>{if(R(e),!e.trim()){B([]),V.current=``,t(`extra_colors`,``);return}let{value:n,invalid:r}=I(e);B(r),V.current=n,t(`extra_colors`,n)};return(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsx)(`div`,{className:`h-10 rounded-lg border border-bambu-dark-tertiary`,style:H,"data-testid":`color-preview-banner`}),n.length>0&&(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-bambu-gray shrink-0`,children:[(0,k.jsx)(v,{className:`w-3 h-3`}),(0,k.jsx)(`span`,{children:c(`inventory.recentColors`)})]}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(e=>(0,k.jsx)(`button`,{type:`button`,onClick:()=>j(e.hex,e.name),className:`w-6 h-6 rounded border-2 transition-all hover:scale-110 ${D(e.hex)?`border-bambu-green ring-1 ring-bambu-green/30 scale-110`:`border-bambu-dark-tertiary`}`,style:A(e.hex),title:e.name},e.hex))})]}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(u,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),(0,k.jsx)(`input`,{type:`text`,className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:c(`inventory.searchColors`),value:p,onChange:e=>g(e.target.value)})]}),P?(0,k.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,k.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:p?c(`inventory.searchResults`):`${e.brand}${e.material?` ${e.material}`:``}`}),(0,k.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[N.map(e=>(0,k.jsx)(`button`,{type:`button`,onClick:()=>j(e.hex,e.name,e.extra_colors,e.effect_type),className:`w-6 h-6 rounded border-2 transition-all hover:scale-110 hover:z-20 relative group ${D(e.hex)?`border-bambu-green ring-1 ring-bambu-green/30 scale-110`:`border-bambu-dark-tertiary`}`,style:A(e.hex),title:e.manufacturer&&e.material?`${e.name} (${e.manufacturer} — ${e.material})`:e.manufacturer?`${e.name} (${e.manufacturer})`:e.name,children:(0,k.jsx)(`span`,{className:`absolute -bottom-7 left-1/2 -translate-x-1/2 px-2 py-0.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-20 shadow-lg text-white`,children:e.manufacturer&&e.material?`${e.name} (${e.manufacturer} — ${e.material})`:e.manufacturer?`${e.name} (${e.manufacturer})`:e.name})},`${e.hex}-${e.name}-${e.manufacturer??``}`)),N.length===0&&(0,k.jsx)(`p`,{className:`text-sm text-bambu-gray py-1`,children:c(`inventory.noColorsFound`)})]})]}):(0,k.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-bambu-gray`,children:[(0,k.jsx)(`span`,{children:c(p?`inventory.searchResults`:l?`inventory.allColors`:`inventory.commonColors`)}),!p&&(0,k.jsx)(`button`,{type:`button`,onClick:()=>f(!l),className:`flex items-center gap-1 hover:text-white transition-colors`,children:l?(0,k.jsxs)(k.Fragment,{children:[c(`inventory.showLess`),` `,(0,k.jsx)(a,{className:`w-3 h-3`})]}):(0,k.jsxs)(k.Fragment,{children:[c(`inventory.showAll`),` `,(0,k.jsx)(i,{className:`w-3 h-3`})]})})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[F.map(e=>(0,k.jsx)(`button`,{type:`button`,onClick:()=>j(e.hex,e.name),className:`w-6 h-6 rounded border-2 transition-all hover:scale-110 hover:z-20 relative group ${D(e.hex)?`border-bambu-green ring-1 ring-bambu-green/30 scale-110`:`border-bambu-dark-tertiary`}`,style:A(e.hex),title:e.name,children:(0,k.jsx)(`span`,{className:`absolute -bottom-7 left-1/2 -translate-x-1/2 px-2 py-0.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-20 shadow-lg text-white`,children:e.name})},e.hex)),F.length===0&&(0,k.jsx)(`p`,{className:`text-sm text-bambu-gray py-1`,children:c(`inventory.noColorsFound`)})]})]}),(0,k.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:c(`inventory.colorName`)}),(0,k.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:c(`inventory.colorNamePlaceholder`),value:e.color_name,onChange:e=>t(`color_name`,e.target.value)})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:c(`inventory.hexColor`)}),(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[(0,k.jsxs)(`div`,{className:`relative flex-1`,children:[(0,k.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray`,children:`#`}),(0,k.jsx)(`input`,{type:`text`,className:`w-full pl-7 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono uppercase focus:outline-none focus:border-bambu-green`,placeholder:`RRGGBB`,value:T.toUpperCase(),onChange:e=>{let n=e.target.value.replace(`#`,``).replace(/[^0-9A-Fa-f]/g,``).toUpperCase(),r=n.length>8?n.substring(0,8):n;E(r),r.length===6?t(`rgba`,r+`FF`):r.length===8&&t(`rgba`,r)},onBlur:()=>{if(T.length===7){let e=T+`0`;E(e),t(`rgba`,e)}else if(T.length>0&&T.length<6){let e=T.padEnd(6,`0`);E(e),t(`rgba`,e+`FF`)}}})]}),(0,k.jsx)(`input`,{type:`color`,className:`w-11 h-[38px] rounded-lg cursor-pointer border border-bambu-dark-tertiary shrink-0 bg-transparent`,value:`#${x}`,onChange:e=>{t(`rgba`,e.target.value.replace(`#`,``).toUpperCase()+`FF`)},title:c(`inventory.pickColor`)})]})]})]}),(0,k.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-2 border-t border-bambu-dark-tertiary/50`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:c(`inventory.extraColorsLabel`)}),(0,k.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:c(`inventory.extraColorsPlaceholder`),value:L,onChange:e=>U(e.target.value),"data-testid":`extra-colors-input`}),z.length>0&&(0,k.jsx)(`p`,{className:`text-xs text-red-700 dark:text-red-400 mt-1`,children:c(`inventory.extraColorsInvalid`,{tokens:z.join(`, `)})}),!z.length&&(0,k.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1`,children:c(`inventory.extraColorsHint`)})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1 flex items-center gap-1.5`,children:[(0,k.jsx)(d,{className:`w-3.5 h-3.5`}),c(`inventory.colorEffectLabel`)]}),(0,k.jsxs)(`div`,{className:`flex gap-2 items-stretch`,children:[(0,k.jsx)(`select`,{className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,value:e.effect_type,onChange:e=>t(`effect_type`,e.target.value),"data-testid":`effect-type-select`,children:h.map(e=>(0,k.jsx)(`option`,{value:e.value,children:c(e.labelKey)},e.value||`none`))}),(0,k.jsx)(b,{rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,subtype:e.subtype,effectSize:`preview`,className:`w-10 h-10`,shape:`square`})]})]})]})]})}function R({catalog:e,value:t,onChange:n,catalogId:i,onCatalogIdChange:a}){let{t:o}=r(),[s,c]=(0,O.useState)(!1),[u,d]=(0,O.useState)(``),f=(0,O.useRef)(null),p=(0,O.useRef)(null);(0,O.useEffect)(()=>{let e=e=>{f.current&&!f.current.contains(e.target)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,O.useEffect)(()=>{if(e.length===0)return;let n=e.filter(e=>e.weight===t);if(i){let n=e.find(e=>e.id===i);if(n&&n.weight===t)return}n.length===1?a(n[0].id):n.length===0&&i!==null&&a(null)},[t,e,i,a]);let m=(0,O.useMemo)(()=>{if(!u)return e;let t=u.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||e.weight.toString().includes(t))},[e,u]),h=(0,O.useMemo)(()=>e.filter(e=>e.weight===t),[e,t]),g=(0,O.useMemo)(()=>{if(s)return u;if(i){let t=e.find(e=>e.id===i);if(t)return t.name}return h.length>0?h[0].name:``},[s,u,i,e,h]);return(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(l,{className:`w-3.5 h-3.5 text-bambu-gray`}),o(`inventory.coreWeight`)]})}),(0,k.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,k.jsxs)(`div`,{className:`flex-1 min-w-0 relative`,ref:f,children:[(0,k.jsx)(`input`,{ref:p,type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:o(`inventory.searchSpoolWeight`),value:g,onFocus:()=>{c(!0),d(``)},onChange:e=>{d(e.target.value),c(!0)}}),s&&(0,k.jsx)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-64 overflow-y-auto`,children:m.length===0?(0,k.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:o(`inventory.noResults`)}):m.map(e=>(0,k.jsxs)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex justify-between items-center ${(i?e.id===i:e.weight===t)?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{a(e.id),n(e.weight),c(!1),d(``)},children:[(0,k.jsx)(`span`,{className:`truncate`,children:e.name}),(0,k.jsxs)(`span`,{className:`font-mono text-xs text-bambu-gray ml-2 shrink-0`,children:[e.weight,`g`]})]},e.id))})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,k.jsx)(`input`,{type:`number`,className:`w-16 px-2 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm text-center font-mono focus:outline-none focus:border-bambu-green`,value:t,min:0,max:2e3,onChange:e=>{let t=parseInt(e.target.value);!isNaN(t)&&t>=0&&n(t)}}),(0,k.jsx)(`span`,{className:`text-bambu-gray text-sm`,children:`g`})]})]})]})}function z({formData:e,updateField:t,spoolCatalog:n,currencySymbol:i,availableCategories:a,availableMaterialNumbers:s,availableLocations:c=[],onCreateLocation:l,globalLowStockThreshold:u,spoolmanMode:d=!1,showLastDried:f=!1}){let{t:m}=r(),{showToast:h}=o(),[g,_]=(0,O.useState)(``),[v,y]=(0,O.useState)(!1),[b,x]=(0,O.useState)(``),[S,C]=(0,O.useState)(!1),[w,T]=(0,O.useState)(``),[E,D]=(0,O.useState)(!1),A=Math.max(0,e.label_weight-e.weight_used),j=e.core_weight+A;return(0,O.useEffect)(()=>{v||_(String(j))},[v,j]),(0,O.useEffect)(()=>{S||x(String(A))},[S,A]),(0,k.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-4`,children:[(0,k.jsx)(`div`,{className:`sm:col-span-2`,children:(0,k.jsx)(R,{catalog:n,value:e.core_weight,onChange:e=>t(`core_weight`,e),catalogId:e.core_weight_catalog_id,onCatalogIdChange:e=>t(`core_weight_catalog_id`,e)})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:m(`inventory.currentWeight`)}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`div`,{className:`relative flex-1`,children:[(0,k.jsx)(`input`,{type:`number`,value:b,min:0,max:e.label_weight,onFocus:()=>C(!0),onChange:e=>{x(e.target.value)},onBlur:()=>{C(!1);let n=b.trim(),r=Number(n);if(!n||!Number.isFinite(r)||r<0||r>e.label_weight){x(String(A));return}let i=Math.round(r);t(`weight_used`,Math.max(0,e.label_weight-i)),x(String(i))},className:`w-full px-3 py-2 pr-7 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,k.jsx)(`span`,{className:`absolute right-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray`,children:`g`})]}),(0,k.jsxs)(`span`,{className:`text-xs text-bambu-gray shrink-0`,children:[`/ `,e.label_weight,`g`]})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:m(`inventory.measuredWeight`)}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`div`,{className:`relative flex-1`,children:[(0,k.jsx)(`input`,{type:`number`,value:g,min:0,onFocus:()=>y(!0),onChange:e=>{_(e.target.value)},onBlur:()=>{y(!1);let n=g.trim(),r=Number(n),i=e.core_weight,a=e.core_weight+e.label_weight;if(!n||!Number.isFinite(r)||ra){h(m(`inventory.measuredWeightError`,{min:i,max:a}),`error`),_(String(j));return}let o=Math.round(r),s=Math.max(0,Math.min(e.label_weight,o-e.core_weight));t(`weight_used`,Math.max(0,e.label_weight-s)),_(String(o))},className:`w-full px-3 py-2 pr-7 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,k.jsx)(`span`,{className:`absolute right-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray`,children:`g`})]}),(0,k.jsxs)(`span`,{className:`text-xs text-bambu-gray shrink-0`,children:[`/ `,e.core_weight+e.label_weight,`g`]})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:m(`inventory.costPerKg`,`Cost per kg`)}),(0,k.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,k.jsxs)(`div`,{className:`relative flex-1`,children:[(0,k.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none`,children:i}),(0,k.jsx)(`input`,{type:`number`,value:e.cost_per_kg??``,min:0,step:.01,placeholder:`0.00`,onChange:e=>{t(`cost_per_kg`,e.target.value===``?null:parseFloat(e.target.value))},style:{paddingLeft:`${Math.max(2,i.length*.6+1)}rem`},className:`w-full py-2 pr-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`})]})})]}),!d&&(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-material-number`,children:m(`inventory.materialNumber`)}),(0,k.jsx)(`input`,{id:`spool-material-number`,type:`text`,list:`spool-material-number-options`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:m(`inventory.materialNumberPlaceholder`),value:e.material_number,maxLength:64,onChange:e=>t(`material_number`,e.target.value)}),s.length>0&&(0,k.jsx)(`datalist`,{id:`spool-material-number-options`,children:s.map(e=>(0,k.jsx)(`option`,{value:e},e))}),(0,k.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`inventory.materialNumberHelp`)})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-category`,children:m(`inventory.category`)}),(0,k.jsx)(`input`,{id:`spool-category`,type:`text`,list:`spool-category-options`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:m(`inventory.categoryPlaceholder`),value:e.category,maxLength:50,onChange:e=>t(`category`,e.target.value)}),a.length>0&&(0,k.jsx)(`datalist`,{id:`spool-category-options`,children:a.map(e=>(0,k.jsx)(`option`,{value:e},e))})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-low-stock-threshold`,children:m(`inventory.lowStockThresholdOverride`)}),(0,k.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,k.jsxs)(`div`,{className:`relative flex-1`,children:[(0,k.jsx)(`input`,{id:`spool-low-stock-threshold`,type:`number`,className:`w-full px-3 py-2 pr-8 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:String(u),value:e.low_stock_threshold_pct??``,min:1,max:99,step:1,onChange:e=>{let n=e.target.value;if(n===``){t(`low_stock_threshold_pct`,null);return}let r=Number(n);Number.isFinite(r)&&t(`low_stock_threshold_pct`,Math.min(99,Math.max(1,Math.round(r))))}}),(0,k.jsx)(`span`,{className:`absolute right-3 top-1/2 -translate-y-1/2 text-xs text-bambu-gray pointer-events-none`,children:`%`})]})}),(0,k.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`inventory.lowStockThresholdOverrideHelp`,{global:u})})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-storage-location`,children:m(`inventory.storageLocation`)}),(0,k.jsxs)(`select`,{id:`spool-storage-location`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,value:e.location_id??``,onChange:e=>{let n=e.target.value;if(!n){t(`location_id`,null);return}t(`location_id`,Number(n))},children:[(0,k.jsx)(`option`,{value:``,children:m(`inventory.storageLocationNone`)}),c.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),l&&(0,k.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,k.jsx)(`input`,{type:`text`,maxLength:255,className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:m(`locations.createPlaceholder`),value:w,onChange:e=>T(e.target.value)}),(0,k.jsx)(`button`,{type:`button`,className:`px-3 py-2 text-sm rounded-lg bg-bambu-dark-tertiary text-white hover:bg-bambu-gray-dark disabled:opacity-50`,disabled:!w.trim()||E,onClick:async()=>{let e=w.trim();if(!(!e||!l)){D(!0);try{let n=await l(e);n&&(t(`location_id`,n.id),T(``))}finally{D(!1)}}},children:m(`locations.addShort`)})]})]}),f&&(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-last-dried`,children:m(`inventory.lastDried`)}),(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[(0,k.jsx)(`input`,{id:`spool-last-dried`,type:`datetime-local`,className:`flex-1 min-w-0 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,value:e.last_dried_at,onChange:e=>t(`last_dried_at`,e.target.value)}),(0,k.jsx)(`button`,{type:`button`,className:`px-3 py-2 text-sm rounded-lg bg-bambu-dark-tertiary text-white hover:bg-bambu-gray-dark`,onClick:()=>t(`last_dried_at`,p(new Date)),children:m(`inventory.lastDriedNow`)})]}),(0,k.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`inventory.lastDriedHelp`)})]}),(0,k.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,k.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:m(`inventory.note`)}),(0,k.jsx)(`textarea`,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green resize-none min-h-[80px]`,placeholder:m(`inventory.notePlaceholder`),value:e.note,onChange:e=>t(`note`,e.target.value)})]})]})}export{E as a,M as i,L as n,T as o,F as r,D as s,z as t}; \ No newline at end of file diff --git a/static/assets/AmsUnitCard-CRqkD3Lg.js b/static/assets/AmsUnitCard-CRqkD3Lg.js new file mode 100644 index 000000000..365669bab --- /dev/null +++ b/static/assets/AmsUnitCard-CRqkD3Lg.js @@ -0,0 +1 @@ +import{C as e,w as t}from"./client-DnySrlFv.js";import{K as n,W as r}from"./index-CovRLYqQ.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}; \ No newline at end of file diff --git a/static/assets/ArchivesPage-C-m2N5Wj.js b/static/assets/ArchivesPage-C-m2N5Wj.js new file mode 100644 index 000000000..2c79f4c1d --- /dev/null +++ b/static/assets/ArchivesPage-C-m2N5Wj.js @@ -0,0 +1,9 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,p as i,w as a,x as o}from"./client-DnySrlFv.js";import{n as s}from"./QueryClientProvider-Ce8_sN3w.js";import{t as c}from"./useQuery-BBCjCezC.js";import{t as l}from"./useMutation-B-Tr2hIP.js";import{t as u}from"./createLucideIcon-DvBYJlWL.js";import{t as d}from"./arrow-up-down-BdyOV_2F.js";import{t as f}from"./RichTextEditor-CuGcRbGW.js";import{t as p}from"./box-DAdKb9s5.js";import{t as m}from"./calendar-BLKPnWqV.js";import{t as h}from"./check-Ck0cMLU4.js";import{a as g,i as _,n as v,r as y}from"./info-ROUoQhJR.js";import{n as b,t as x}from"./chevrons-right-DTJgqnxZ.js";import{n as S,r as C}from"./ToastContext-BRX0SW3C.js";import{t as w}from"./coins-4u6IPkR-.js";import{t as T}from"./cog-Dol1I0kq.js";import{t as E}from"./columns-2-DVEObeDC.js";import{t as D}from"./copy-Cu_0GKCU.js";import{t as O}from"./ellipsis-vertical-t2D7cYyp.js";import{t as k}from"./file-box-04V4jZ9_.js";import{t as ee}from"./file-spreadsheet-WxOA9vYy.js";import{n as A,t as te}from"./ContextMenu-Bt5_A0ZU.js";import{n as j,t as ne}from"./scan-search-BDoNAXzz.js";import{t as M}from"./funnel-C3dyAMK9.js";import{t as N}from"./gauge-D21zgWMb.js";import{t as re}from"./git-compare-J4KX0xAJ.js";import{n as ie,t as ae}from"./SliceModal-2Iz_Qz3v.js";import{t as oe}from"./history-B4lOLL01.js";import{t as se}from"./layout-grid-DkD3u6wa.js";import{t as ce}from"./list-CLcpeoSz.js";import{t as P}from"./loader-circle-BEmFtawu.js";import{t as le}from"./package-BGUevlqS.js";import{t as F}from"./pause-DFb6GX_6.js";import{t as ue}from"./pen-line-BWR04BX-.js";import{t as de}from"./play-DIDYtk2S.js";import{t as fe}from"./qr-code-CCCo2-Br.js";import{t as pe}from"./search-0n0CBc74.js";import{t as me}from"./skip-forward-BsuMfFkw.js";import{t as he}from"./sticky-note-BH0LPqRx.js";import{t as I}from"./triangle-alert-Dt_1FcBy.js";import{t as L}from"./x-DR-Trv6U.js";import{i as R,n as z,t as B}from"./Card-Bzc64K35.js";import{t as ge}from"./file-DDkFXH-b.js";import{t as V}from"./Button-DDr6eAFy.js";import{a as _e,i as ve,l as H,o as ye,v as be}from"./date-G9KUauqz.js";import{$t as xe,An as Se,At as U,Cn as Ce,Et as we,F as Te,It as Ee,Jt as De,L as Oe,Ln as ke,Lt as Ae,M as je,Mn as Me,Mt as Ne,On as Pe,Ot as Fe,P as Ie,Pn as Le,Pt as Re,R as ze,Rn as W,Rt as Be,T as Ve,Ut as He,Vn as Ue,Vt as We,Zt as G,_t as K,at as Ge,b as Ke,bt as qe,cn as Je,hn as Ye,j as Xe,jn as Ze,jt as Qe,kt as $e,tn as et,un as tt,vn as nt,wn as q,xn as rt,xt as it,y as at,yn as ot,yt as st}from"./index-CovRLYqQ.js";import{n as ct,r as lt,t as ut}from"./PhotoGalleryModal-CHRwUNN5.js";import{a as dt,o as ft}from"./slicer-DgCA7cW6.js";import{t as pt}from"./filamentTypes-Dysa4k6j.js";import{t as mt}from"./ColumnConfigModal-gVVhKfHC.js";import{t as ht}from"./purify.es-F_7NWVtX.js";var gt=u(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),_t=u(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),vt=u(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),J=u(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),yt=u(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),bt=u(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),xt=u(`skip-back`,[[`path`,{d:`M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`15892j`}],[`path`,{d:`M3 20V4`,key:`1ptbpl`}]]),Y=u(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),St=u(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),X=e(n(),1),Z=t();function Ct({onClose:e,initialFiles:t}){let{t:n}=a(),i=s(),{showToast:o}=S(),c=(0,X.useRef)(null),[u,d]=(0,X.useState)(()=>t?.filter(e=>e.name.endsWith(`.3mf`)).map(e=>({file:e,status:`pending`}))||[]),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(null);(0,X.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let g=l({mutationFn:e=>r.uploadArchivesBulk(e),onSuccess:e=>{h(e),i.invalidateQueries({queryKey:[`archives`]}),i.invalidateQueries({queryKey:[`archiveStats`]}),d(t=>t.map(t=>{let n=e.results.find(e=>e.filename===t.file.name),r=e.errors.find(e=>e.filename===t.file.name);return n?{...t,status:`success`,archiveId:n.id}:r?{...t,status:`error`,error:r.error}:t})),e.failed===0?o(`${e.uploaded} file${e.uploaded===1?``:`s`} uploaded`):e.uploaded===0?o(`Failed to upload ${e.failed} file${e.failed===1?``:`s`}`,`error`):o(`${e.uploaded} uploaded, ${e.failed} failed`,`warning`)},onError:()=>{d(e=>e.map(e=>({...e,status:`error`,error:`Upload failed`}))),o(`Upload failed`,`error`)}}),_=(0,X.useCallback)(e=>{e.preventDefault(),p(!0)},[]),v=(0,X.useCallback)(e=>{e.preventDefault(),p(!1)},[]),b=(0,X.useCallback)(e=>{e.preventDefault(),p(!1);let t=Array.from(e.dataTransfer.files).filter(e=>e.name.endsWith(`.3mf`));t.length>0&&d(e=>[...e,...t.map(e=>({file:e,status:`pending`}))])},[]),x=(0,X.useCallback)(e=>{let t=Array.from(e.target.files||[]).filter(e=>e.name.endsWith(`.3mf`));t.length>0&&d(e=>[...e,...t.map(e=>({file:e,status:`pending`}))]),c.current&&(c.current.value=``)},[]),w=(0,X.useCallback)(e=>{d(t=>t.filter((t,n)=>n!==e))},[]),T=()=>{if(u.length===0)return;let e=u.filter(e=>e.status===`pending`);e.length!==0&&(d(e=>e.map(e=>e.status===`pending`?{...e,status:`uploading`}:e)),g.mutate(e.map(e=>e.file)))},E=u.filter(e=>e.status===`pending`).length,D=g.isPending;return(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,Z.jsx)(B,{className:`w-full max-w-2xl max-h-[90vh] flex flex-col`,children:(0,Z.jsxs)(z,{className:`p-0 flex flex-col h-full`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:n(`uploadModal.title`)}),(0,Z.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${f?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-gray`}`,onDragOver:_,onDragLeave:v,onDrop:b,children:[(0,Z.jsx)($e,{className:`w-12 h-12 mx-auto mb-4 text-bambu-gray`}),(0,Z.jsx)(`p`,{className:`text-white mb-2`,children:n(`uploadModal.dragDrop`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray text-sm mb-4`,children:n(`uploadModal.or`)}),(0,Z.jsx)(V,{variant:`secondary`,onClick:()=>c.current?.click(),disabled:D,children:n(`uploadModal.browseFiles`)}),(0,Z.jsx)(`input`,{ref:c,type:`file`,accept:`.3mf`,multiple:!0,className:`hidden`,onChange:x})]})}),(0,Z.jsx)(`div`,{className:`px-4 pb-4`,children:(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`uploadModal.extractionInfo`)})}),u.length>0&&(0,Z.jsx)(`div`,{className:`px-4 pb-4 max-h-60 overflow-y-auto`,children:(0,Z.jsx)(`div`,{className:`space-y-2`,children:u.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-bambu-dark rounded-lg`,children:[(0,Z.jsx)(A,{className:`w-5 h-5 text-bambu-gray flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`flex-1 text-white text-sm truncate`,children:e.file.name}),(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[(e.file.size/(1024*1024)).toFixed(1),` MB`]}),e.status===`pending`&&(0,Z.jsx)(`button`,{onClick:()=>w(t),className:`text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors`,disabled:D,children:(0,Z.jsx)(L,{className:`w-4 h-4`})}),e.status===`uploading`&&(0,Z.jsx)(P,{className:`w-4 h-4 text-bambu-green animate-spin`}),e.status===`success`&&(0,Z.jsx)(C,{className:`w-4 h-4 text-bambu-green`}),e.status===`error`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-400`,children:e.error}),(0,Z.jsx)(y,{className:`w-4 h-4 text-red-600 dark:text-red-400`})]})]},`${e.file.name}-${t}`))})}),m&&(0,Z.jsx)(`div`,{className:`px-4 pb-4`,children:(0,Z.jsx)(`div`,{className:`p-3 bg-bambu-dark rounded-lg`,children:(0,Z.jsxs)(`p`,{className:`text-sm text-white`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-green`,children:m.uploaded}),` `,n(`uploadModal.uploaded`),m.failed>0&&(0,Z.jsxs)(Z.Fragment,{children:[`, `,(0,Z.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:m.failed}),` `,n(`uploadModal.failed`)]})]})})}),(0,Z.jsxs)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary`,children:[(0,Z.jsx)(V,{variant:`secondary`,onClick:e,className:`flex-1`,children:n(m?`common.close`:`common.cancel`)}),!m&&(0,Z.jsx)(V,{onClick:T,disabled:E===0||D,className:`flex-1`,children:D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}),n(`uploadModal.uploading`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($e,{className:`w-4 h-4`}),n(`uploadModal.upload`),` `,E>0&&`(${E})`]})})]})]})})})}var wt=365;function Tt({onClose:e,initialDays:t}){let{t:n}=a(),i=s(),{showToast:o}=S(),[u,d]=(0,X.useState)(t??wt),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(u);(0,X.useEffect)(()=>{let e=window.setTimeout(()=>h(u),300);return()=>window.clearTimeout(e)},[u]);let g=c({queryKey:[`archive-purge-preview`,m,f],queryFn:()=>r.previewArchivePurge(m,f),enabled:m>=1}),_=l({mutationFn:()=>r.executeArchivePurge(u,f),onSuccess:t=>{o(n(`archivePurge.toast.success`,{count:t.deleted}),`success`),i.invalidateQueries({queryKey:[`archives`]}),i.invalidateQueries({queryKey:[`archive-stats`]}),e()},onError:e=>o(e.message||n(`archivePurge.toast.failed`),`error`)});(0,X.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!_.isPending&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,_.isPending]);let v=g.data,y=v?.count??0,b=v?.total_bytes??0,x=y>0&&!_.isPending;return(0,Z.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,children:(0,Z.jsxs)(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg shadow-xl max-w-lg w-full`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700`,children:[(0,Z.jsxs)(`h2`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2`,children:[(0,Z.jsx)(U,{className:`w-5 h-5`}),n(`archivePurge.title`)]}),(0,Z.jsx)(`button`,{onClick:e,className:`text-gray-400 hover:text-gray-600 dark:hover:text-gray-200`,"aria-label":n(`common.close`),disabled:_.isPending,children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:n(`archivePurge.description`)}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{htmlFor:`archive-purge-days`,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:n(`archivePurge.ageLabel`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`input`,{id:`archive-purge-days`,type:`number`,min:1,max:3650,value:u,onChange:e=>d(Math.max(1,Math.min(3650,parseInt(e.target.value||`0`,10)||0))),className:`w-24 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm px-2 py-1 text-gray-900 dark:text-gray-100`}),(0,Z.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:n(`archivePurge.days`)})]})]}),(0,Z.jsxs)(`div`,{className:`rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/30 p-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300 mb-2`,children:n(`archivePurge.effectsTitle`)}),(0,Z.jsxs)(`ul`,{className:`text-xs text-gray-700 dark:text-gray-300 space-y-1 list-disc pl-4`,children:[(0,Z.jsx)(`li`,{children:n(`archivePurge.effect1`)}),(0,Z.jsx)(`li`,{children:n(`archivePurge.effect2`)}),(0,Z.jsx)(`li`,{children:n(`archivePurge.effect3`)}),(0,Z.jsx)(`li`,{children:n(`archivePurge.effect4`)})]})]}),(0,Z.jsx)(`div`,{className:`rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 p-3`,children:g.isLoading||g.isFetching?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400`,children:[(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}),` `,n(`archivePurge.previewLoading`)]}):g.isError?(0,Z.jsx)(`div`,{className:`text-sm text-red-600 dark:text-red-400`,children:g.error?.message??n(`archivePurge.previewFailed`)}):(0,Z.jsxs)(`div`,{className:`text-sm text-gray-900 dark:text-gray-100`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:n(`archivePurge.previewSummary`,{count:y,size:ge(b)})}),v?.sample_filenames&&v.sample_filenames.length>0&&(0,Z.jsxs)(`ul`,{className:`mt-2 text-xs text-gray-600 dark:text-gray-400 space-y-0.5 list-disc pl-4`,children:[v.sample_filenames.map(e=>(0,Z.jsx)(`li`,{className:`truncate`,children:e},e)),y>v.sample_filenames.length&&(0,Z.jsx)(`li`,{className:`list-none italic text-gray-500`,children:n(`archivePurge.andMore`,{count:y-v.sample_filenames.length})})]})]})}),(0,Z.jsxs)(`label`,{className:`flex gap-2 items-start rounded border border-gray-200 dark:border-gray-700 px-3 py-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>p(e.target.checked),disabled:_.isPending,className:`mt-0.5 shrink-0`}),(0,Z.jsxs)(`span`,{className:`text-xs text-gray-700 dark:text-gray-300`,children:[(0,Z.jsx)(`span`,{className:`font-medium block mb-0.5`,children:n(`archivePurge.purgeStatsLabel`)}),(0,Z.jsx)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:n(`archivePurge.purgeStatsHint`)})]})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2 items-start text-xs text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 rounded px-3 py-2`,children:[(0,Z.jsx)(I,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,Z.jsx)(`span`,{children:n(`archivePurge.warning`)})]})]}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 p-4 border-t border-gray-200 dark:border-gray-700`,children:[(0,Z.jsx)(V,{variant:`secondary`,onClick:e,disabled:_.isPending,children:n(`common.cancel`)}),(0,Z.jsx)(V,{variant:`danger`,disabled:!x,onClick:()=>_.mutate(),children:_.isPending?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin mr-1`}),n(`archivePurge.purging`)]}):n(`archivePurge.confirmCta`,{count:y})})]})]})})}function Et({archiveId:e,archiveName:t,onClose:n}){let{t:r}=a();return(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:n,children:(0,Z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-2xl max-h-[85vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Z.jsx)(oe,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,Z.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,title:t||``,children:r(`archives.runLog.modalTitle`,{name:t||r(`archives.runLog.modalTitleFallback`)})})]}),(0,Z.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,title:r(`common.close`),children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsx)(`div`,{className:`p-6 overflow-y-auto flex-1`,children:(0,Z.jsx)(ze,{archiveId:e})})]})})}function Dt({selectedIds:e,existingTags:t,onClose:n}){let i=s(),{showToast:a}=S(),[o,c]=(0,X.useState)(``),[u,d]=(0,X.useState)(new Set),[f,p]=(0,X.useState)(`add`);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);let m=l({mutationFn:async()=>{let t=Array.from(u),n=0;for(let i of e)try{let e=await r.getArchive(i),a=e.tags?e.tags.split(`,`).map(e=>e.trim()).filter(Boolean):[],o;o=f===`add`?[...new Set([...a,...t])]:a.filter(e=>!u.has(e)),await r.updateArchive(i,{tags:o.join(`, `)}),n++}catch(e){throw console.error(`Failed to update archive ${i}:`,e),Error(`Failed on archive ${i}: ${e instanceof Error?e.message:`Unknown error`}`)}return{count:n,mode:f,tags:t}},onSuccess:({count:e,mode:t,tags:r})=>{i.invalidateQueries({queryKey:[`archives`]}),a(`${t===`add`?`Added`:`Removed`} ${r.length} tag${r.length===1?``:`s`} ${t===`add`?`to`:`from`} ${e} archive${e===1?``:`s`}`),n()},onError:e=>{a(e.message||`Failed to update tags`,`error`)}}),h=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},g=()=>{o.trim()&&!u.has(o.trim())&&(d(e=>new Set([...e,o.trim()])),c(``))};return(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,Z.jsx)(B,{className:`w-full max-w-md`,children:(0,Z.jsxs)(z,{className:`p-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Re,{className:`w-5 h-5 text-bambu-green`}),(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:f===`add`?`Add Tags`:`Remove Tags`})]}),(0,Z.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[f===`add`?`Add`:`Remove`,` tags for `,e.length,` selected archive`,e.length===1?``:`s`]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(V,{size:`sm`,variant:f===`add`?`primary`:`secondary`,onClick:()=>p(`add`),children:`Add Tags`}),(0,Z.jsx)(V,{size:`sm`,variant:f===`remove`?`primary`:`secondary`,onClick:()=>p(`remove`),children:`Remove Tags`})]}),f===`add`&&(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`input`,{type:`text`,placeholder:`Enter new tag...`,className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())}}),(0,Z.jsx)(V,{size:`sm`,variant:`secondary`,onClick:g,disabled:!o.trim(),children:(0,Z.jsx)(G,{className:`w-4 h-4`})})]}),t.length>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:`Existing tags:`}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>(0,Z.jsx)(`button`,{onClick:()=>h(e),className:`px-2 py-1 rounded text-sm transition-colors ${u.has(e)?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray-light hover:bg-bambu-dark`}`,children:e},e))})]}),u.size>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:[`Tags to `,f===`add`?`add`:`remove`,`:`]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Array.from(u).map(e=>(0,Z.jsxs)(`span`,{className:`px-2 py-1 rounded text-sm flex items-center gap-1 ${f===`add`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`}`,children:[e,(0,Z.jsx)(`button`,{onClick:()=>h(e),className:`hover:opacity-70`,children:(0,Z.jsx)(L,{className:`w-3 h-3`})})]},e))})]})]}),(0,Z.jsxs)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary`,children:[(0,Z.jsx)(V,{variant:`secondary`,onClick:n,className:`flex-1`,children:`Cancel`}),(0,Z.jsx)(V,{onClick:()=>m.mutate(),disabled:u.size===0||m.isPending,className:`flex-1`,children:m.isPending?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}),`Processing...`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Re,{className:`w-4 h-4`}),f===`add`?`Add Tags`:`Remove Tags`]})})]})]})})})}function Ot({selectedIds:e,onClose:t}){let{t:n}=a(),i=s(),{showToast:o}=S(),[u,d]=(0,X.useState)(``),{data:f,isLoading:p}=c({queryKey:[`projects`],queryFn:()=>r.getProjects()}),m=(0,X.useMemo)(()=>f?Te([...f].sort((e,t)=>e.name.localeCompare(t.name))):void 0,[f]),h=u.trim().toLowerCase(),g=h?m?.filter(e=>e.name.toLowerCase().includes(h)):m,_=(m?.length??0)>5;(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let y=()=>Oe(i),b=l({mutationFn:async t=>(await r.addArchivesToProject(t,e),t),onSuccess:n=>{let r=f?.find(e=>e.id===n);y(),o(`Added ${e.length} archive${e.length===1?``:`s`} to "${r?.name}"`),t()},onError:()=>{o(`Failed to assign project`,`error`)}}),x=l({mutationFn:async()=>{for(let t of e)await r.updateArchive(t,{project_id:null});return e.length},onSuccess:e=>{y(),o(`Removed ${e} archive${e===1?``:`s`} from project`),t()},onError:()=>{o(`Failed to remove from project`,`error`)}}),C=b.isPending||x.isPending;return(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,Z.jsx)(B,{className:`w-full max-w-md max-h-[80vh] flex flex-col`,children:(0,Z.jsxs)(z,{className:`p-0 flex flex-col min-h-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ot,{className:`w-5 h-5 text-bambu-green`}),(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:`Assign to Project`})]}),(0,Z.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white transition-colors`,disabled:C,children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsxs)(`div`,{className:`p-4 space-y-3 overflow-y-auto min-h-0`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`Assign `,e.length,` selected archive`,e.length===1?``:`s`,` to a project`]}),p?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Z.jsx)(P,{className:`w-6 h-6 animate-spin text-bambu-gray`})}):(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`button`,{onClick:()=>x.mutate(),disabled:C,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary transition-colors text-left disabled:opacity-50`,children:[(0,Z.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-red-500/20 flex items-center justify-center shrink-0`,children:(0,Z.jsx)(v,{className:`w-4 h-4 text-red-600 dark:text-red-400`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`text-white font-medium`,children:`Remove from project`}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray truncate`,children:`Clear project assignment`})]}),x.isPending&&(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin text-bambu-gray shrink-0`})]}),m&&m.length>0&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2`,children:[(0,Z.jsx)(`div`,{className:`flex-1 h-px bg-bambu-dark-tertiary`}),(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`or assign to`}),(0,Z.jsx)(`div`,{className:`flex-1 h-px bg-bambu-dark-tertiary`})]}),_&&(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(pe,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`}),(0,Z.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:n(`archives.menu.searchProjects`),className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray text-sm focus:border-bambu-green focus:outline-none`})]}),g?.map(e=>(0,Z.jsxs)(`button`,{onClick:()=>b.mutate(e.id),disabled:C,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary transition-colors text-left disabled:opacity-50`,children:[(0,Z.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0`,style:{backgroundColor:e.color?`${e.color}20`:`rgb(var(--bambu-green) / 0.2)`},children:(0,Z.jsx)(ot,{className:`w-4 h-4`,style:{color:e.color||`rgb(var(--bambu-green))`}})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.name}),(0,Z.jsxs)(`p`,{className:`text-sm text-bambu-gray truncate`,children:[e.archive_count,` archive`,e.archive_count===1?``:`s`,e.status&&` • ${e.status}`]})]}),b.isPending&&b.variables===e.id&&(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin text-bambu-gray shrink-0`})]},e.id)),(!m||m.length===0)&&(0,Z.jsx)(`p`,{className:`text-center text-bambu-gray py-4`,children:`No projects yet. Create one from the Projects page.`}),m&&m.length>0&&g?.length===0&&(0,Z.jsx)(`p`,{className:`text-center text-bambu-gray text-sm py-4`,children:`—`})]})]}),(0,Z.jsx)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary shrink-0`,children:(0,Z.jsx)(V,{variant:`secondary`,onClick:t,className:`flex-1`,disabled:C,children:`Cancel`})})]})})})}function kt(e,t){return new Date(e,t+1,0).getDate()}function At(e,t){return new Date(e,t,1).getDay()}var jt=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Mt=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Nt({archives:e,onArchiveClick:t,highlightedArchiveId:n}){let i=new Date,[a,o]=(0,X.useState)(i.getMonth()),[s,c]=(0,X.useState)(i.getFullYear()),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),p=(0,X.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let n=be(e.completed_at||e.created_at)||new Date,r=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,`0`)}-${String(n.getDate()).padStart(2,`0`)}`,i=t.get(r)||[];i.push(e),t.set(r,i)}),t},[e]),m=kt(s,a),h=At(s,a),g=()=>{a===0?(o(11),c(s-1)):o(a-1)},_=()=>{a===11?(o(0),c(s+1)):o(a+1)},v=()=>{o(i.getMonth()),c(i.getFullYear())},y=[];for(let e=0;e{e!==l&&f(null),u(e)};return(0,Z.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-6`,children:[(0,Z.jsxs)(`div`,{className:`flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Z.jsx)(`button`,{onClick:g,className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,Z.jsx)(Ze,{className:`w-5 h-5 text-bambu-gray`})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[jt[a],` `,s]}),(0,Z.jsx)(`button`,{onClick:v,className:`px-2 py-1 text-xs bg-bambu-dark-tertiary hover:bg-bambu-green/20 text-bambu-gray hover:text-white rounded transition-colors`,children:`Today`})]}),(0,Z.jsx)(`button`,{onClick:_,className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,Z.jsx)(Me,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-7 gap-1 mb-1`,children:Mt.map(e=>(0,Z.jsx)(`div`,{className:`text-center text-xs text-bambu-gray py-2`,children:e},e))}),(0,Z.jsx)(`div`,{className:`grid grid-cols-7 gap-1`,children:y.map((e,t)=>{if(e===null)return(0,Z.jsx)(`div`,{className:`aspect-square`},`empty-${t}`);let n=`${s}-${String(a+1).padStart(2,`0`)}-${String(e).padStart(2,`0`)}`,r=p.get(n)||[],o=r.length>0,c=e===i.getDate()&&a===i.getMonth()&&s===i.getFullYear(),u=n===l,d=r.filter(e=>e.status===`completed`).length,f=r.filter(e=>e.status===`failed`).length;return(0,Z.jsxs)(`button`,{onClick:()=>x(u?null:n),className:`aspect-square rounded-lg p-1 flex flex-col items-center justify-center transition-colors relative ${u?`bg-bambu-green text-white`:c?`bg-bambu-green/20 text-white ring-2 ring-bambu-green`:o?`bg-bambu-dark-tertiary hover:bg-bambu-dark-tertiary/70 text-white`:`hover:bg-bambu-dark-tertiary/50 text-bambu-gray`}`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium ${c&&!u?`text-bambu-green`:``}`,children:e}),o&&(0,Z.jsxs)(`div`,{className:`absolute bottom-1 left-1/2 -translate-x-1/2 flex items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`w-2 h-2 rounded-full ${f>0&&d===0?`bg-red-400`:f>0?`bg-yellow-400`:`bg-green-400`}`}),(0,Z.jsx)(`span`,{className:`text-xs font-medium`,children:r.length})]})]},e)})}),(0,Z.jsx)(`div`,{className:`mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 text-center`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-2xl font-bold text-white`,children:e.filter(e=>{let t=be(e.completed_at||e.created_at)||new Date;return t.getMonth()===a&&t.getFullYear()===s}).length}),(0,Z.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:`Prints this month`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-2xl font-bold text-green-700 dark:text-green-400`,children:e.filter(e=>{let t=be(e.completed_at||e.created_at)||new Date;return t.getMonth()===a&&t.getFullYear()===s&&e.status===`completed`}).length}),(0,Z.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:`Successful`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-2xl font-bold text-red-700 dark:text-red-400`,children:e.filter(e=>{let t=be(e.completed_at||e.created_at)||new Date;return t.getMonth()===a&&t.getFullYear()===s&&e.status===`failed`}).length}),(0,Z.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:`Failed`})]})]})})]}),(0,Z.jsx)(`div`,{className:`lg:w-80 bg-bambu-dark rounded-xl p-4`,children:l?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray mb-3`,children:new Date(l+`T12:00:00`).toLocaleDateString(`en-US`,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})}),b.length>0?(0,Z.jsx)(`div`,{className:`calendar-scroll space-y-2 max-h-96 overflow-y-auto`,children:b.map(e=>{let i=e.id===d||e.id===n;return(0,Z.jsxs)(`button`,{onClick:()=>{f(e.id),t?.(e)},className:`w-full flex items-center gap-3 p-2 rounded-lg transition-colors text-left ${i?``:`hover:bg-bambu-dark-tertiary`}`,style:i?{outline:`4px solid #facc15`,outlineOffset:`2px`}:void 0,children:[e.thumbnail_path?(0,Z.jsx)(`img`,{src:r.getArchiveThumbnail(e.id),alt:``,className:`w-12 h-12 rounded object-cover`}):(0,Z.jsx)(`div`,{className:`w-12 h-12 rounded bg-bambu-dark-tertiary flex items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`3MF`})}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-white truncate`,children:e.print_name||e.filename}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,Z.jsx)(`span`,{className:e.status===`failed`?`text-red-700 dark:text-red-400`:`text-green-700 dark:text-green-400`,children:e.status===`failed`?`Failed`:`Completed`}),e.filament_color&&(0,Z.jsx)(`div`,{className:`flex gap-0.5`,children:e.filament_color.split(`,`).map((e,t)=>(0,Z.jsx)(`div`,{className:`w-3 h-3 rounded-full border border-black/20`,style:{backgroundColor:e}},t))})]})]})]},e.id)})}):(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:`No prints on this day`})]}):(0,Z.jsx)(`div`,{className:`text-center py-8`,children:(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:`Select a day to see prints`})})})]})}function Pt({archiveId:e,archiveName:t,onClose:n}){let i=r.getArchiveQRCodeUrl(e,300);return(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:n,children:(0,Z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-sm`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`QR Code`}),(0,Z.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsxs)(`div`,{className:`p-6 flex flex-col items-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4 text-center truncate max-w-full`,children:t}),(0,Z.jsx)(`div`,{className:`bg-white p-4 rounded-lg mb-4`,children:(0,Z.jsx)(`img`,{src:i,alt:`QR Code`,className:`w-64 h-64`})}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mb-4 text-center`,children:`Scan to open this archive`}),(0,Z.jsxs)(V,{onClick:()=>{let e=document.createElement(`a`);e.href=i,e.download=`${t}_qrcode.png`,e.click()},className:`w-full`,children:[(0,Z.jsx)(q,{className:`w-4 h-4`}),`Download QR Code`]})]})]})})}function Q({archiveId:e,archiveName:t,onClose:n}){let i=s(),[a,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(null),[h,g]=(0,X.useState)({}),{data:_,isLoading:v,error:y}=c({queryKey:[`archive-project-page`,e],queryFn:()=>r.getArchiveProjectPage(e)}),b=l({mutationFn:t=>r.updateArchiveProjectPage(e,t),onSuccess:()=>{i.invalidateQueries({queryKey:[`archive-project-page`,e]}),u(!1),g({})}});(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(d===null?a?w():n():p(null))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d,a,n]);let x=[..._?.model_pictures||[],..._?.profile_pictures||[]],S=()=>{g({title:_?.title||``,description:_?.description||``,designer:_?.designer||``,license:_?.license||``,profile_title:_?.profile_title||``,profile_description:_?.profile_description||``}),u(!0)},C=()=>{b.mutate(h)},w=()=>{u(!1),g({})},T=e=>ht.sanitize(e,{ALLOWED_TAGS:[`p`,`br`,`b`,`strong`,`i`,`em`,`u`,`a`,`ul`,`ol`,`li`,`figure`,`img`],ALLOWED_ATTR:[`href`,`src`,`target`,`rel`,`style`],ADD_ATTR:[`target`]}),E=_&&(_.title||_.description||_.designer||_.profile_title||x.length>0);return(0,Z.jsxs)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:e=>{e.target===e.currentTarget&&n()},children:[(0,Z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl max-w-4xl w-full max-h-[90vh] overflow-hidden flex flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(rt,{className:`w-5 h-5 text-bambu-green`}),(0,Z.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[`Project Page`,t&&(0,Z.jsxs)(`span`,{className:`text-bambu-gray ml-2`,children:[`- `,t]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!a&&E&&(0,Z.jsxs)(V,{variant:`ghost`,size:`sm`,onClick:S,children:[(0,Z.jsx)(ue,{className:`w-4 h-4 mr-1`}),`Edit`]}),a&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:w,children:`Cancel`}),(0,Z.jsxs)(V,{variant:`primary`,size:`sm`,onClick:C,disabled:b.isPending,children:[(0,Z.jsx)(He,{className:`w-4 h-4 mr-1`}),`Save`]})]}),(0,Z.jsx)(`button`,{onClick:n,className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,Z.jsx)(L,{className:`w-5 h-5 text-bambu-gray`})})]})]}),(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:[v&&(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Z.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-2 border-bambu-green border-t-transparent`})}),y&&(0,Z.jsx)(`div`,{className:`text-red-700 dark:text-red-400 text-center py-12`,children:`Failed to load project page data`}),_&&!E&&(0,Z.jsxs)(`div`,{className:`text-bambu-gray text-center py-12`,children:[(0,Z.jsx)(rt,{className:`w-12 h-12 mx-auto mb-4 opacity-50`}),(0,Z.jsx)(`p`,{children:`No project page data found in this 3MF file.`}),(0,Z.jsx)(`p`,{className:`text-sm mt-2`,children:`Project pages are typically included in files downloaded from MakerWorld.`})]}),_&&E&&(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[a?(0,Z.jsx)(`input`,{type:`text`,value:h.title||``,onChange:e=>g({...h,title:e.target.value}),placeholder:`Title`,className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded-lg px-4 py-2 text-white text-xl font-semibold`}):_.title&&(0,Z.jsx)(`h3`,{className:`text-xl font-semibold text-white`,children:_.title}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-4 text-sm`,children:[a?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Fe,{className:`w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,value:h.designer||``,onChange:e=>g({...h,designer:e.target.value}),placeholder:`Designer`,className:`bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-white`})]}):_.designer&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,Z.jsx)(Fe,{className:`w-4 h-4`}),(0,Z.jsx)(`span`,{children:_.designer}),_.designer_user_id&&(0,Z.jsx)(`a`,{href:`https://makerworld.com/en/@${_.designer_user_id}`,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-green hover:underline`,children:(0,Z.jsx)(Ce,{className:`w-3 h-3`})})]}),_.creation_date&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,Z.jsx)(m,{className:`w-4 h-4`}),(0,Z.jsx)(`span`,{children:_.creation_date})]}),a?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(rt,{className:`w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,value:h.license||``,onChange:e=>g({...h,license:e.target.value}),placeholder:`License`,className:`bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-white`})]}):_.license&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,Z.jsx)(rt,{className:`w-4 h-4`}),(0,Z.jsx)(`span`,{children:_.license})]}),_.origin&&(0,Z.jsx)(`span`,{className:`px-2 py-0.5 bg-bambu-dark rounded text-bambu-gray`,children:_.origin})]})]}),(_.description||a)&&(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray uppercase tracking-wide`,children:`Description`}),a?(0,Z.jsx)(f,{content:h.description||``,onChange:e=>g({...h,description:e}),placeholder:`Enter description...`}):(0,Z.jsx)(`div`,{className:`prose prose-invert prose-sm max-w-none text-bambu-gray-light`,dangerouslySetInnerHTML:{__html:T(_.description||``)}})]}),(_.profile_title||_.profile_description||a)&&(0,Z.jsxs)(`div`,{className:`space-y-2 p-4 bg-bambu-dark rounded-lg`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray uppercase tracking-wide`,children:`Print Profile`}),a?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`input`,{type:`text`,value:h.profile_title||``,onChange:e=>g({...h,profile_title:e.target.value}),placeholder:`Profile Title`,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-white`}),(0,Z.jsx)(f,{content:h.profile_description||``,onChange:e=>g({...h,profile_description:e}),placeholder:`Profile description...`})]}):(0,Z.jsxs)(Z.Fragment,{children:[_.profile_title&&(0,Z.jsx)(`p`,{className:`text-white font-medium`,children:_.profile_title}),_.profile_description&&(0,Z.jsx)(`div`,{className:`prose prose-invert prose-sm max-w-none text-bambu-gray-light`,dangerouslySetInnerHTML:{__html:T(_.profile_description)}}),_.profile_user_name&&(0,Z.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`by `,_.profile_user_name]})]})]}),x.length>0&&(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`h4`,{className:`text-sm font-medium text-bambu-gray uppercase tracking-wide flex items-center gap-2`,children:[(0,Z.jsx)(tt,{className:`w-4 h-4`}),`Images (`,x.length,`)`]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-2`,children:x.map((e,t)=>(0,Z.jsx)(`button`,{onClick:()=>p(t),className:`aspect-square rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors`,children:(0,Z.jsx)(`img`,{src:o(e.url),alt:e.name,className:`w-full h-full object-cover`})},e.path))})]}),_.design_model_id&&(0,Z.jsx)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:(0,Z.jsxs)(`a`,{href:`https://makerworld.com/en/models/${_.design_model_id}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-2 text-bambu-green hover:underline`,children:[(0,Z.jsx)(Ce,{className:`w-4 h-4`}),`View on MakerWorld`]})})]})]})]}),d!==null&&x[d]&&(0,Z.jsxs)(`div`,{className:`fixed inset-0 bg-black/90 flex items-center justify-center z-60`,onClick:()=>p(null),children:[(0,Z.jsx)(`button`,{onClick:e=>{e.stopPropagation(),p(Math.max(0,d-1))},disabled:d===0,className:`absolute left-4 p-2 bg-bambu-dark-secondary rounded-full hover:bg-bambu-dark-tertiary disabled:opacity-30`,children:(0,Z.jsx)(Ze,{className:`w-6 h-6 text-white`})}),(0,Z.jsx)(`img`,{src:o(x[d].url),alt:x[d].name,className:`max-w-[90vw] max-h-[90vh] object-contain`,onClick:e=>e.stopPropagation()}),(0,Z.jsx)(`button`,{onClick:e=>{e.stopPropagation(),p(Math.min(x.length-1,d+1))},disabled:d===x.length-1,className:`absolute right-4 p-2 bg-bambu-dark-secondary rounded-full hover:bg-bambu-dark-tertiary disabled:opacity-30`,children:(0,Z.jsx)(Me,{className:`w-6 h-6 text-white`})}),(0,Z.jsx)(`button`,{onClick:()=>p(null),className:`absolute top-4 right-4 p-2 bg-bambu-dark-secondary rounded-full hover:bg-bambu-dark-tertiary`,children:(0,Z.jsx)(L,{className:`w-6 h-6 text-white`})}),(0,Z.jsxs)(`div`,{className:`absolute bottom-4 text-white text-sm`,children:[d+1,` / `,x.length]})]})]})}var Ft=[.25,.5,.75,1,1.5,2,3,4];function It({archiveId:e,timelapseSrc:t,onClose:n,onSave:i}){let{showToast:a}=S(),o=(0,X.useRef)(null),s=(0,X.useRef)(null),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(0),[m,h]=(0,X.useState)(0),[g,_]=(0,X.useState)(0),[v,y]=(0,X.useState)(0),[b,x]=(0,X.useState)(1),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),[D,O]=(0,X.useState)(.8),[k,ee]=(0,X.useState)(!1),{data:A,isLoading:te}=c({queryKey:[`timelapse-info`,e],queryFn:()=>r.getTimelapseInfo(e)}),{data:ne}=c({queryKey:[`timelapse-thumbnails`,e],queryFn:()=>r.getTimelapseThumbnails(e,15)}),M=l({mutationFn:()=>r.processTimelapse(e,{trimStart:g,trimEnd:v,speed:b,saveMode:`replace`},C||void 0),onSuccess:e=>{a(e.message,`success`),i?.(),n()},onError:e=>{a(e.message||`Processing failed`,`error`)}});(0,X.useEffect)(()=>{A?.duration&&v===0&&y(A.duration)},[A?.duration,v]),(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,X.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>{let t=e.currentTime;p(t),t>=v&&(e.currentTime=g)},n=()=>{h(e.duration),v===0&&y(e.duration)},r=()=>d(!0),i=()=>d(!1);return e.addEventListener(`timeupdate`,t),e.addEventListener(`durationchange`,n),e.addEventListener(`play`,r),e.addEventListener(`pause`,i),()=>{e.removeEventListener(`timeupdate`,t),e.removeEventListener(`durationchange`,n),e.removeEventListener(`play`,r),e.removeEventListener(`pause`,i)}},[g,v]),(0,X.useEffect)(()=>{let e=s.current,t=o.current;!e||!t||!T||(e.currentTime=t.currentTime,e.playbackRate=t.playbackRate,u&&!k?e.play().catch(()=>{}):e.pause())},[u,T,k]),(0,X.useEffect)(()=>{s.current&&(s.current.volume=k?0:D)},[D,k]),(0,X.useEffect)(()=>{o.current&&(o.current.playbackRate=b),s.current&&(s.current.playbackRate=b)},[b]);let re=(0,X.useCallback)(()=>{let e=o.current;e&&(u?e.pause():(e.currentTime{let t=o.current;t&&(t.currentTime=Math.max(g,Math.min(v,e)))},ae=e=>{let t=e.target.files?.[0];t&&(T&&URL.revokeObjectURL(T),w(t),E(URL.createObjectURL(t)))},oe=()=>{T&&URL.revokeObjectURL(T),w(null),E(null)};(0,X.useEffect)(()=>()=>{T&&URL.revokeObjectURL(T)},[T]);let se=v-g,ce=se/b;return te?(0,Z.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 text-white`,children:[(0,Z.jsx)(P,{className:`w-6 h-6 animate-spin`}),`Loading video info...`]})}):(0,Z.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80`,children:(0,Z.jsxs)(`div`,{className:`relative bg-bambu-dark-secondary rounded-xl max-w-5xl w-full mx-4 max-h-[90vh] overflow-hidden flex flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0`,children:[(0,Z.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Z.jsx)(j,{className:`w-5 h-5 text-bambu-green`}),`Edit Timelapse`]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(V,{variant:`primary`,size:`sm`,onClick:()=>M.mutate(),disabled:M.isPending,children:M.isPending?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}),`Processing...`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(He,{className:`w-4 h-4`}),`Save`]})}),(0,Z.jsx)(`button`,{onClick:n,className:`p-1 hover:bg-bambu-dark-tertiary rounded transition-colors`,children:(0,Z.jsx)(L,{className:`w-5 h-5 text-bambu-gray`})})]})]}),(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`video`,{ref:o,src:t,className:`w-full rounded-lg bg-black`,onClick:re,muted:!!T}),!u&&(0,Z.jsx)(`button`,{onClick:re,className:`absolute inset-0 flex items-center justify-center bg-black/30 hover:bg-black/40 transition-colors`,children:(0,Z.jsx)(`div`,{className:`p-4 bg-bambu-green rounded-full`,children:(0,Z.jsx)(de,{className:`w-8 h-8 text-white`})})}),T&&(0,Z.jsx)(`audio`,{ref:s,src:T,loop:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Z.jsx)(bt,{className:`w-4 h-4`}),(0,Z.jsx)(`span`,{children:`Trim`}),(0,Z.jsxs)(`span`,{className:`ml-auto`,children:[H(g),` - `,H(v),` (`,H(se),`)`]})]}),(0,Z.jsxs)(`div`,{className:`relative h-16 bg-bambu-dark rounded-lg overflow-hidden`,children:[(0,Z.jsx)(`div`,{className:`absolute inset-0 flex`,children:ne?.thumbnails.map((e,t)=>(0,Z.jsx)(`div`,{className:`flex-1 bg-cover bg-center`,style:{backgroundImage:`url(data:image/jpeg;base64,${e})`}},t))}),(0,Z.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-black/60`,style:{width:`${g/m*100}%`}}),(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-0 bg-black/60`,style:{width:`${(m-v)/m*100}%`}}),(0,Z.jsx)(`div`,{className:`absolute inset-y-0 border-2 border-bambu-green`,style:{left:`${g/m*100}%`,right:`${(m-v)/m*100}%`}}),(0,Z.jsx)(`div`,{className:`absolute top-0 bottom-0 w-0.5 bg-white shadow-lg`,style:{left:`${f/m*100}%`}}),(0,Z.jsx)(`input`,{type:`range`,min:0,max:m,step:.1,value:g,onChange:e=>{let t=parseFloat(e.target.value);t{let t=parseFloat(e.target.value);t>g+1&&y(t)},className:`absolute inset-0 w-full opacity-0 cursor-ew-resize`,style:{clipPath:`inset(0 0 0 50%)`}})]}),(0,Z.jsx)(`input`,{type:`range`,min:0,max:m,step:.1,value:f,onChange:e=>ie(parseFloat(e.target.value)),className:`w-full h-1 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 + [&::-webkit-slider-thumb]:bg-bambu-green [&::-webkit-slider-thumb]:rounded-full + [&::-webkit-slider-thumb]:cursor-pointer`}),(0,Z.jsx)(`div`,{className:`flex items-center justify-center gap-2`,children:(0,Z.jsx)(`button`,{onClick:re,className:`p-2 bg-bambu-green hover:bg-bambu-green-dark rounded-lg transition-colors`,children:u?(0,Z.jsx)(F,{className:`w-5 h-5 text-white`}):(0,Z.jsx)(de,{className:`w-5 h-5 text-white`})})})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Z.jsx)(N,{className:`w-4 h-4`}),(0,Z.jsx)(`span`,{children:`Speed`}),(0,Z.jsxs)(`span`,{className:`ml-auto`,children:[b,`x (output: `,H(ce),`)`]})]}),(0,Z.jsx)(`div`,{className:`flex gap-1`,children:Ft.map(e=>(0,Z.jsxs)(`button`,{onClick:()=>x(e),className:`flex-1 px-2 py-2 text-sm rounded transition-colors ${b===e?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[e,`x`]},e))})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Z.jsx)(et,{className:`w-4 h-4`}),(0,Z.jsx)(`span`,{children:`Music Overlay`})]}),C?(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-bambu-dark rounded-lg`,children:[(0,Z.jsx)(et,{className:`w-5 h-5 text-bambu-green`}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-white truncate`,children:C.name}),(0,Z.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[(C.size/1024/1024).toFixed(1),` MB`]})]}),(0,Z.jsx)(`button`,{onClick:()=>ee(!k),className:`p-2 hover:bg-bambu-dark-tertiary rounded transition-colors`,children:k?(0,Z.jsx)(St,{className:`w-4 h-4 text-bambu-gray`}):(0,Z.jsx)(Y,{className:`w-4 h-4 text-bambu-green`})}),(0,Z.jsx)(`input`,{type:`range`,min:0,max:1,step:.1,value:D,onChange:e=>O(parseFloat(e.target.value)),className:`w-20 h-1 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 + [&::-webkit-slider-thumb]:bg-bambu-green [&::-webkit-slider-thumb]:rounded-full`}),(0,Z.jsx)(`button`,{onClick:oe,className:`p-2 hover:bg-red-100 dark:hover:bg-red-500/20 rounded transition-colors`,children:(0,Z.jsx)(U,{className:`w-4 h-4 text-red-600 dark:text-red-400`})})]}):(0,Z.jsxs)(`label`,{className:`flex flex-col items-center justify-center gap-2 p-6 border-2 border-dashed border-bambu-dark-tertiary rounded-lg cursor-pointer hover:border-bambu-green/50 transition-colors`,children:[(0,Z.jsx)($e,{className:`w-8 h-8 text-bambu-gray`}),(0,Z.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`Drop audio file or click to upload`}),(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray/60`,children:`MP3, WAV, M4A, AAC, OGG`}),(0,Z.jsx)(`input`,{type:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,audio/*`,onChange:ae,className:`hidden`})]})]}),(0,Z.jsxs)(`div`,{className:`p-3 bg-bambu-dark rounded-lg text-sm space-y-1`,children:[(0,Z.jsxs)(`p`,{className:`text-bambu-gray`,children:[(0,Z.jsx)(`span`,{className:`text-white`,children:`Original:`}),` `,H(m),` @ `,A?.width,`x`,A?.height]}),(0,Z.jsxs)(`p`,{className:`text-bambu-gray`,children:[(0,Z.jsx)(`span`,{className:`text-white`,children:`Output:`}),` `,H(ce),` @ `,b,`x speed`,C&&` + music overlay`]})]})]}),M.isPending&&(0,Z.jsxs)(`div`,{className:`absolute inset-0 bg-black/80 flex flex-col items-center justify-center gap-4`,children:[(0,Z.jsx)(P,{className:`w-12 h-12 text-bambu-green animate-spin`}),(0,Z.jsx)(`p`,{className:`text-white text-lg`,children:`Processing timelapse...`}),(0,Z.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:`This may take a few moments`})]})]})})}var Lt=[.25,.5,.75,1,1.5,2,3,4];function Rt({src:e,title:t,downloadFilename:n,archiveId:r,onClose:i,onEdit:a}){let o=(0,X.useRef)(null),[s,c]=(0,X.useState)(!0),[l,u]=(0,X.useState)(1),[d,f]=(0,X.useState)(0),[p,m]=(0,X.useState)(0),[h,g]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=o.current;e&&(e.playbackRate=l)},[l]),(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,X.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>f(e.currentTime),n=()=>m(e.duration),r=()=>c(!0),i=()=>c(!1);return e.addEventListener(`timeupdate`,t),e.addEventListener(`durationchange`,n),e.addEventListener(`play`,r),e.addEventListener(`pause`,i),()=>{e.removeEventListener(`timeupdate`,t),e.removeEventListener(`durationchange`,n),e.removeEventListener(`play`,r),e.removeEventListener(`pause`,i)}},[]);let _=()=>{let e=o.current;e&&(s?e.pause():e.play())};return(0,Z.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80`,children:[(0,Z.jsxs)(`div`,{className:`relative bg-bambu-dark-secondary rounded-xl max-w-4xl w-full mx-4 overflow-hidden`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Z.jsx)(j,{className:`w-5 h-5 text-bambu-green`}),t]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,Z.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:()=>g(!0),children:[(0,Z.jsx)(xe,{className:`w-4 h-4`}),`Edit`]}),(0,Z.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:()=>{let t=document.createElement(`a`);t.href=e,t.download=n,t.click()},children:[(0,Z.jsx)(q,{className:`w-4 h-4`}),`Download`]}),(0,Z.jsx)(`button`,{onClick:i,className:`p-1 hover:bg-bambu-dark-tertiary rounded transition-colors`,children:(0,Z.jsx)(L,{className:`w-5 h-5 text-bambu-gray`})})]})]}),(0,Z.jsxs)(`div`,{className:`p-4`,children:[(0,Z.jsx)(`video`,{ref:o,src:e,autoPlay:!0,className:`w-full rounded-lg`,onClick:_}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray w-12 text-right`,children:H(d)}),(0,Z.jsx)(`input`,{type:`range`,min:0,max:p||100,value:d,onChange:e=>{let t=o.current;t&&(t.currentTime=parseFloat(e.target.value))},className:`flex-1 h-1 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer + [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 + [&::-webkit-slider-thumb]:bg-bambu-green [&::-webkit-slider-thumb]:rounded-full + [&::-webkit-slider-thumb]:cursor-pointer`}),(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray w-12`,children:H(p)})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`button`,{onClick:()=>{let e=o.current;e&&(e.currentTime=Math.max(0,e.currentTime-5))},className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,title:`Skip back 5s`,children:(0,Z.jsx)(xt,{className:`w-5 h-5 text-bambu-gray`})}),(0,Z.jsx)(`button`,{onClick:_,className:`p-2 bg-bambu-green hover:bg-bambu-green-dark rounded-lg transition-colors`,children:s?(0,Z.jsx)(F,{className:`w-5 h-5 text-white`}):(0,Z.jsx)(de,{className:`w-5 h-5 text-white`})}),(0,Z.jsx)(`button`,{onClick:()=>{let e=o.current;e&&(e.currentTime=Math.min(p,e.currentTime+5))},className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,title:`Skip forward 5s`,children:(0,Z.jsx)(me,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`Speed:`}),(0,Z.jsx)(`div`,{className:`flex gap-1`,children:Lt.map(e=>(0,Z.jsxs)(`button`,{onClick:()=>u(e),className:`px-2 py-1 text-xs rounded transition-colors ${l===e?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:bg-bambu-dark-tertiary/80`}`,children:[e,`x`]},e))})]})]})]})]})]}),h&&r&&(0,Z.jsx)(It,{archiveId:r,timelapseSrc:e,onClose:()=>g(!1),onSave:a})]})}function zt({archiveId:e,archiveName:t,printerName:n,onClose:i}){let{t:o}=a(),{showToast:s}=S(),[l,u]=(0,X.useState)(new Set),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),h=(0,X.useRef)(null),g=(0,X.useRef)(null),_=c({queryKey:[`archive-printer-media`,e],queryFn:()=>r.getArchivePrinterMedia(e),staleTime:6e4}),v=(0,X.useMemo)(()=>_.data?.remote_files??[],[_.data]);(0,X.useEffect)(()=>{!_.data||h.current===e||(h.current=e,v.length===1&&u(new Set([v[0].path])))},[e,_.data,v]),(0,X.useEffect)(()=>{let e=new Set(v.map(e=>e.path));u(t=>new Set([...t].filter(t=>e.has(t))))},[v]),(0,X.useEffect)(()=>()=>g.current?.abort(),[]),(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]);let y=e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},b=async()=>{let n=_.data?.local_timelapse?.name??``,i=n.includes(`.`)?`.${n.split(`.`).pop()}`:``;try{await r.downloadArchiveTimelapse(e,`${t}_timelapse${i}`)}catch(e){s(o(`printerFiles.downloadFailed`,{error:e instanceof Error?e.message:o(`printerFiles.unknownError`)}),`error`)}},x=async()=>{if(!_.data?.printer_id||l.size===0)return;let e=v.filter(e=>l.has(e.path));if(e.length===0)return;let n=new AbortController;g.current=n,f(!0);try{let i=await r.downloadPrinterFilesAsZip(_.data.printer_id,e.map(e=>e.path),Object.fromEntries(e.map(e=>[e.path,e.size])),`${t.replace(/[^a-zA-Z0-9]/g,`_`)}-printer-videos.zip`,!0,n.signal,(e,t)=>m({current:e,total:t}));i.failed>0?s(o(`printerFiles.zipPartial`,{successful:i.successful,total:i.requested}),`warning`):s(o(`printerFiles.zipStarted`,{count:i.successful}))}catch(e){s(o(`printerFiles.downloadFailed`,{error:e instanceof Error?e.message:o(`printerFiles.unknownError`)}),`error`)}finally{g.current===n&&(g.current=null),m(null),f(!1)}},C=!!_.data?.local_timelapse||v.length>0,w=e=>o(e===`printer_files_forbidden`?`printers.permission.noFiles`:e===`printer_missing`?`archives.media.printerMissing`:e===`timelapse_unavailable`?`archives.media.timelapseUnavailable`:`archives.media.ipcamUnavailable`),T=(_.data?.warnings??[]).map(e=>(0,Z.jsx)(`p`,{className:`text-xs text-amber-600 dark:text-amber-400`,children:w(e)},e));return(0,Z.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4`,onClick:i,children:(0,Z.jsxs)(`div`,{className:`flex max-h-[85vh] w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-bambu-dark-tertiary bg-bambu-dark-secondary`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-bambu-dark-tertiary p-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,Z.jsx)(we,{className:`h-5 w-5 text-bambu-green`}),o(`archives.media.title`)]}),(0,Z.jsxs)(`p`,{className:`truncate text-sm text-bambu-gray`,children:[t,` · `,n]})]}),(0,Z.jsx)(`button`,{onClick:i,className:`rounded p-1 text-bambu-gray hover:bg-bambu-dark-tertiary hover:text-white`,children:(0,Z.jsx)(L,{className:`h-5 w-5`})})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:_.isLoading?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-12 text-bambu-gray`,children:[(0,Z.jsx)(P,{className:`h-5 w-5 animate-spin`}),o(`archives.media.searching`)]}):_.isError?(0,Z.jsx)(`p`,{className:`py-8 text-center text-red-500`,children:o(`archives.media.searchFailed`)}):C?(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[_.data?.local_timelapse&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-3`,children:[(0,Z.jsx)(j,{className:`h-5 w-5 shrink-0 text-bambu-green`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm font-medium text-white`,children:_.data.local_timelapse.name}),(0,Z.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[o(`archives.media.attachedTimelapse`),` · `,ge(_.data.local_timelapse.size)]})]}),(0,Z.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:b,children:[(0,Z.jsx)(q,{className:`h-4 w-4`}),o(`common.download`)]})]}),v.length>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[o(`archives.media.printerFiles`),` (`,v.length,`)`]}),(0,Z.jsx)(`button`,{className:`text-xs text-bambu-green hover:text-bambu-green-light`,onClick:()=>u(l.size===v.length?new Set:new Set(v.map(e=>e.path))),children:l.size===v.length?o(`common.deselectAll`):o(`common.selectAll`)})]}),(0,Z.jsx)(`div`,{className:`space-y-1`,children:v.map(e=>{let t=l.has(e.path);return(0,Z.jsxs)(`button`,{className:`flex w-full items-center gap-3 rounded-lg border p-3 text-left transition-colors ${t?`border-bambu-green/60 bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray`}`,onClick:()=>y(e.path),children:[t?(0,Z.jsx)(Be,{className:`h-5 w-5 shrink-0 text-bambu-green`}):(0,Z.jsx)(Ae,{className:`h-5 w-5 shrink-0 text-bambu-gray`}),e.kind===`timelapse`?(0,Z.jsx)(j,{className:`h-5 w-5 shrink-0 text-bambu-green`}):(0,Z.jsx)(we,{className:`h-5 w-5 shrink-0 text-blue-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-white`,children:e.name}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-bambu-gray`,children:ge(e.size)})]},e.path)})})]}),T]}):(0,Z.jsxs)(`div`,{className:`space-y-3 py-8 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:o(`archives.media.none`)}),T]})}),v.length>0&&(0,Z.jsx)(`div`,{className:`flex items-center justify-end border-t border-bambu-dark-tertiary p-4`,children:(0,Z.jsxs)(V,{variant:`primary`,onClick:x,disabled:l.size===0||d,children:[d?(0,Z.jsx)(P,{className:`h-4 w-4 animate-spin`}):(0,Z.jsx)(q,{className:`h-4 w-4`}),p?`${p.current}/${p.total}`:`${o(`archives.media.downloadSelected`)} (${l.size})`]})})]})})}function Bt({archiveIds:e,onClose:t}){(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let{data:n,isLoading:i,error:a}=c({queryKey:[`archive-comparison`,e],queryFn:()=>r.compareArchives(e)});return(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,Z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[90vh] flex flex-col border border-bambu-dark-tertiary`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`h3`,{className:`text-lg font-semibold text-white`,children:[`Compare Archives (`,e.length,`)`]}),(0,Z.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white p-1`,children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-auto p-4 bg-bambu-dark-secondary`,children:i?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Z.jsx)(P,{className:`w-8 h-8 text-bambu-green animate-spin`})}):a?(0,Z.jsxs)(`div`,{className:`text-center py-12 text-red-700 dark:text-red-400`,children:[(0,Z.jsx)(I,{className:`w-12 h-12 mx-auto mb-4 opacity-50`}),(0,Z.jsx)(`p`,{children:`Failed to load comparison`}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray mt-2`,children:a instanceof Error?a.message:`Unknown error`})]}):n?(0,Z.jsx)(Vt,{comparison:n}):null}),(0,Z.jsx)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary`,children:(0,Z.jsx)(V,{variant:`secondary`,onClick:t,className:`w-full`,children:`Close`})})]})})}function Vt({comparison:e}){return(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Z.jsxs)(`table`,{className:`w-full`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`th`,{className:`text-left text-sm text-bambu-gray font-medium pb-2 pr-4 min-w-[150px]`,children:`Setting`}),e.archives.map(e=>(0,Z.jsxs)(`th`,{className:`text-left text-sm font-medium pb-2 px-2 min-w-[120px]`,children:[(0,Z.jsx)(`div`,{className:`text-white truncate max-w-[150px]`,title:e.print_name,children:e.print_name}),(0,Z.jsx)(`div`,{className:`text-xs ${e.status===`completed`?`text-status-ok`:e.status===`failed`?`text-status-error`:`text-bambu-gray`}`,children:e.status})]},e.id))]})}),(0,Z.jsx)(`tbody`,{className:`divide-y divide-bambu-gray/20`,children:e.comparison.map(e=>(0,Z.jsxs)(`tr`,{className:e.has_difference?`bg-yellow-500/5`:``,children:[(0,Z.jsx)(`td`,{className:`py-2 pr-4 text-sm`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.has_difference&&(0,Z.jsx)(I,{className:`w-3 h-3 text-yellow-600 dark:text-yellow-400 flex-shrink-0`}),(0,Z.jsx)(`span`,{className:e.has_difference?`text-yellow-700 dark:text-yellow-400`:`text-bambu-gray`,children:e.label})]})}),e.values.map((t,n)=>(0,Z.jsxs)(`td`,{className:`py-2 px-2 text-sm text-white`,children:[t??(0,Z.jsx)(`span`,{className:`text-bambu-gray/50`,children:`-`}),e.unit&&t!==null&&(0,Z.jsx)(`span`,{className:`text-bambu-gray ml-1`,children:e.unit})]},n))]},e.field))})]})}),e.differences.length>0&&(0,Z.jsxs)(`div`,{className:`p-4 bg-yellow-50 border border-yellow-300 dark:bg-yellow-500/10 dark:border-yellow-500/30 rounded-lg`,children:[(0,Z.jsxs)(`h4`,{className:`text-sm font-medium text-yellow-700 dark:text-yellow-400 mb-2 flex items-center gap-2`,children:[(0,Z.jsx)(I,{className:`w-4 h-4`}),e.differences.length,` Difference`,e.differences.length>1?`s`:``,` Found`]}),(0,Z.jsxs)(`ul`,{className:`text-sm text-white/80 space-y-1`,children:[e.differences.slice(0,5).map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`text-yellow-700 dark:text-yellow-400`,children:e.label}),`: `,e.values.join(` vs `),` `,e.unit||``]},e.field)),e.differences.length>5&&(0,Z.jsxs)(`li`,{className:`text-bambu-gray`,children:[`...and `,e.differences.length-5,` more`]})]})]}),e.success_correlation.has_both_outcomes?(0,Z.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg`,children:[(0,Z.jsxs)(`h4`,{className:`text-sm font-medium text-white mb-3 flex items-center gap-2`,children:[(0,Z.jsx)(h,{className:`w-4 h-4 text-bambu-green`}),`Success/Failure Analysis`]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 text-sm mb-3`,children:[(0,Z.jsxs)(`span`,{className:`text-bambu-green`,children:[e.success_correlation.successful_count,` successful`]}),(0,Z.jsxs)(`span`,{className:`text-red-700 dark:text-red-400`,children:[e.success_correlation.failed_count,` failed`]})]}),e.success_correlation.insights&&e.success_correlation.insights.length>0?(0,Z.jsx)(`div`,{className:`space-y-2`,children:e.success_correlation.insights.map(e=>(0,Z.jsxs)(`div`,{className:`text-sm p-2 bg-bambu-dark-secondary rounded`,children:[(0,Z.jsxs)(`span`,{className:`text-white font-medium`,children:[e.label,`:`]}),` `,(0,Z.jsx)(`span`,{className:`text-white/80`,children:e.insight})]},e.field))}):(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:`No clear correlations found between settings and outcomes.`})]}):(0,Z.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-lg text-sm text-bambu-gray`,children:(0,Z.jsx)(`p`,{children:e.success_correlation.message||`Need both successful and failed prints for correlation analysis.`})})]})}function Ht(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`Just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Ut({upload:e,projects:t,onArchive:n,onDiscard:r,isArchiving:i,isDiscarding:a}){let[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(e.tags||``),[u,d]=(0,X.useState)(e.notes||``),[f,p]=(0,X.useState)(e.project_id),[m,h]=(0,X.useState)(!1);return(0,Z.jsx)(B,{children:(0,Z.jsxs)(z,{className:`py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(k,{className:`w-8 h-8 text-bambu-green flex-shrink-0`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-white font-medium`,title:e.filename,children:e.display_name||e.filename}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray`,children:[(0,Z.jsx)(`span`,{children:ge(e.file_size)}),(0,Z.jsx)(`span`,{children:`·`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(Pe,{className:`w-3 h-3`}),Ht(e.uploaded_at)]}),e.source_ip&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{children:`·`}),(0,Z.jsxs)(`span`,{children:[`from `,e.source_ip]})]})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`button`,{onClick:()=>s(!o),className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:o?(0,Z.jsx)(_,{className:`w-5 h-5`}):(0,Z.jsx)(g,{className:`w-5 h-5`})}),(0,Z.jsx)(V,{variant:`primary`,size:`sm`,onClick:()=>n(e.id,{tags:c,notes:u,project_id:f||void 0}),disabled:i,children:i?(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ke,{className:`w-4 h-4`}),`Archive`]})}),(0,Z.jsx)(V,{variant:`secondary`,size:`sm`,onClick:()=>h(!0),disabled:a,children:a?(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(U,{className:`w-4 h-4 text-red-600 dark:text-red-400`})})]})]}),m&&(0,Z.jsx)(K,{title:`Discard Upload`,message:`Are you sure you want to discard "${e.filename}"? This cannot be undone.`,confirmText:`Discard`,variant:`danger`,onConfirm:()=>{r(e.id),h(!1)},onCancel:()=>h(!1)}),o&&(0,Z.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-bambu-dark-tertiary space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Tags`}),(0,Z.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g., functional, prototype, gift`,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white placeholder-bambu-gray text-sm`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Notes`}),(0,Z.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),placeholder:`Add notes about this print...`,rows:2,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white placeholder-bambu-gray text-sm resize-none`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Project`}),(0,Z.jsxs)(`select`,{value:f||``,onChange:e=>p(e.target.value?Number(e.target.value):null),className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white text-sm`,children:[(0,Z.jsx)(`option`,{value:``,children:`No project`}),t.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]})]})})}function Wt(){let e=s(),{showToast:t}=S(),[n,a]=(0,X.useState)(!1),[o,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(new Set),[p,m]=(0,X.useState)(new Set),{data:h,isLoading:g}=c({queryKey:[`pending-uploads`],queryFn:i.list,refetchInterval:1e4}),{data:_}=c({queryKey:[`projects`],queryFn:()=>r.getProjects(),select:e=>Te([...e].sort((e,t)=>e.name.localeCompare(t.name)))}),v=l({mutationFn:({id:e,data:t})=>i.archive(e,t),onMutate:({id:e})=>{f(t=>new Set(t).add(e))},onSettled:(e,t,{id:n})=>{f(e=>{let t=new Set(e);return t.delete(n),t})},onSuccess:n=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),e.invalidateQueries({queryKey:[`archives`]}),t(`Archived: ${n.print_name}`)},onError:e=>{t(e.message||`Failed to archive`,`error`)}}),y=l({mutationFn:e=>i.discard(e),onMutate:e=>{m(t=>new Set(t).add(e))},onSettled:(e,t,n)=>{m(e=>{let t=new Set(e);return t.delete(n),t})},onSuccess:()=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),t(`Upload discarded`)},onError:e=>{t(e.message||`Failed to discard`,`error`)}}),b=l({mutationFn:i.archiveAll,onSuccess:n=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),e.invalidateQueries({queryKey:[`archives`]}),t(`Archived ${n.archived} files${n.failed>0?`, ${n.failed} failed`:``}`)},onError:e=>{t(e.message||`Failed to archive all`,`error`)}}),x=l({mutationFn:i.discardAll,onSuccess:n=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),t(`Discarded ${n.discarded} files`)},onError:e=>{t(e.message||`Failed to discard all`,`error`)}});return g?(0,Z.jsx)(B,{children:(0,Z.jsx)(z,{className:`py-8 flex justify-center`,children:(0,Z.jsx)(P,{className:`w-6 h-6 animate-spin text-bambu-green`})})}):!h||h.length===0?null:(0,Z.jsxs)(`div`,{className:`mb-6`,children:[(0,Z.jsxs)(B,{className:`border-l-4 border-l-yellow-500`,children:[(0,Z.jsx)(R,{children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)($e,{className:`w-5 h-5 text-yellow-500`}),(0,Z.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[`Pending Uploads (`,h.length,`)`]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(V,{variant:`primary`,size:`sm`,onClick:()=>a(!0),disabled:b.isPending,children:b.isPending?(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ke,{className:`w-4 h-4`}),`Archive All`]})}),(0,Z.jsx)(V,{variant:`secondary`,size:`sm`,onClick:()=>u(!0),disabled:x.isPending,children:x.isPending?(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(U,{className:`w-4 h-4`}),`Discard All`]})})]})]})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:`These files were uploaded via the virtual printer. Review and archive them to add to your collection.`}),(0,Z.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,Z.jsx)(Ut,{upload:e,projects:_||[],onArchive:(e,t)=>v.mutate({id:e,data:t}),onDiscard:e=>y.mutate(e),isArchiving:d.has(e.id),isDiscarding:p.has(e.id)},e.id))})]})]}),n&&(0,Z.jsx)(K,{title:`Archive All Uploads`,message:`Are you sure you want to archive all ${h.length} pending uploads?`,confirmText:`Archive All`,onConfirm:()=>{b.mutate(),a(!1)},onCancel:()=>a(!1)}),o&&(0,Z.jsx)(K,{title:`Discard All Uploads`,message:`Are you sure you want to discard all ${h.length} pending uploads? This cannot be undone.`,confirmText:`Discard All`,variant:`danger`,onConfirm:()=>{x.mutate(),u(!1)},onCancel:()=>u(!1)})]})}function Gt({onClose:e}){let t=s(),{showToast:n}=S(),[i,a]=(0,X.useState)(``),[o,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(``),[p,m]=(0,X.useState)(null),[g,_]=(0,X.useState)(`count`);(0,X.useEffect)(()=>{let t=t=>{t.key===`Escape`&&(o?u(null):p?m(null):e())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,o,p]);let{data:v,isLoading:y}=c({queryKey:[`tags`],queryFn:r.getTags}),b=l({mutationFn:({oldName:e,newName:t})=>r.renameTag(e,t),onSuccess:(e,{oldName:r,newName:i})=>{t.invalidateQueries({queryKey:[`tags`]}),t.invalidateQueries({queryKey:[`archives`]}),n(`Renamed "${r}" to "${i}" in ${e.affected} archive${e.affected===1?``:`s`}`),u(null)},onError:e=>{n(e.message||`Failed to rename tag`,`error`)}}),x=l({mutationFn:e=>r.deleteTag(e),onSuccess:(e,r)=>{t.invalidateQueries({queryKey:[`tags`]}),t.invalidateQueries({queryKey:[`archives`]}),n(`Deleted "${r}" from ${e.affected} archive${e.affected===1?``:`s`}`),m(null)},onError:e=>{n(e.message||`Failed to delete tag`,`error`)}}),C=e=>{u(e.name),f(e.name),m(null)},w=()=>{u(null),f(``)},T=()=>{if(!o||!d.trim())return;let e=d.trim();if(e===o){w();return}b.mutate({oldName:o,newName:e})},E=e=>{e.key===`Enter`?(e.preventDefault(),T()):e.key===`Escape`&&(e.preventDefault(),w())},D=e=>{m(e),u(null)},O=()=>{p&&x.mutate(p)},k=v?.filter(e=>e.name.toLowerCase().includes(i.toLowerCase())).sort((e,t)=>g===`count`&&t.count-e.count||e.name.localeCompare(t.name)),ee=v?.reduce((e,t)=>e+t.count,0)||0;return(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,Z.jsx)(B,{className:`w-full max-w-lg max-h-[80vh] flex flex-col`,children:(0,Z.jsxs)(z,{className:`p-0 flex flex-col min-h-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Re,{className:`w-5 h-5 text-bambu-green`}),(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:`Manage Tags`})]}),(0,Z.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(pe,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,placeholder:`Search tags...`,className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:i,onChange:e=>a(e.target.value)})]}),(0,Z.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:g,onChange:e=>_(e.target.value),children:[(0,Z.jsx)(`option`,{value:`count`,children:`Sort by Count`}),(0,Z.jsx)(`option`,{value:`name`,children:`Sort by Name`})]})]}),v&&(0,Z.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:[v.length,` tag`,v.length===1?``:`s`,` across `,ee,` usage`,ee===1?``:`s`]})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 p-4`,children:y?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Z.jsx)(P,{className:`w-6 h-6 animate-spin text-bambu-gray`})}):k?.length?(0,Z.jsx)(`div`,{className:`space-y-2`,children:k.map(e=>(0,Z.jsx)(`div`,{className:`flex items-center gap-2 p-2 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary transition-colors group`,children:o===e.name?(0,Z.jsxs)(`div`,{className:`flex-1 flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{type:`text`,className:`flex-1 px-2 py-1 bg-bambu-dark-tertiary border border-bambu-green rounded text-white text-sm focus:outline-none`,value:d,onChange:e=>f(e.target.value),onKeyDown:E,autoFocus:!0}),(0,Z.jsx)(V,{size:`sm`,variant:`primary`,onClick:T,disabled:!d.trim()||b.isPending,className:`p-1.5`,children:b.isPending?(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(h,{className:`w-4 h-4`})}),(0,Z.jsx)(V,{size:`sm`,variant:`ghost`,onClick:w,className:`p-1.5`,children:(0,Z.jsx)(L,{className:`w-4 h-4`})})]}):p===e.name?(0,Z.jsxs)(`div`,{className:`flex-1 flex items-center gap-2`,children:[(0,Z.jsx)(I,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0`}),(0,Z.jsxs)(`span`,{className:`text-sm text-bambu-gray-light flex-1`,children:[`Delete "`,e.name,`" from `,e.count,` archive`,e.count===1?``:`s`,`?`]}),(0,Z.jsx)(V,{size:`sm`,variant:`danger`,onClick:O,disabled:x.isPending,className:`p-1.5`,children:x.isPending?(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(U,{className:`w-4 h-4`})}),(0,Z.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>m(null),className:`p-1.5`,children:(0,Z.jsx)(L,{className:`w-4 h-4`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Re,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`text-white flex-1 truncate`,children:e.name}),(0,Z.jsx)(`span`,{className:`px-2 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray text-xs`,children:e.count}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity`,children:[(0,Z.jsx)(`button`,{onClick:()=>C(e),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,title:`Rename tag`,children:(0,Z.jsx)(xe,{className:`w-4 h-4`})}),(0,Z.jsx)(`button`,{onClick:()=>D(e.name),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-red-700 dark:hover:text-red-400 transition-colors`,title:`Delete tag`,children:(0,Z.jsx)(U,{className:`w-4 h-4`})})]})]})},e.name))}):(0,Z.jsx)(`div`,{className:`text-center py-8 text-bambu-gray`,children:i?`No tags match your search`:`No tags found`})}),(0,Z.jsx)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary flex-shrink-0`,children:(0,Z.jsx)(V,{variant:`secondary`,onClick:e,className:`flex-1`,children:`Close`})})]})})})}var Kt=`bambuddy-printlog-columns`,qt={date:`archives.log.date`,print_name:`archives.log.printName`,printer:`archives.log.printer`,user:`archives.log.user`,status:`archives.log.status`,duration:`archives.log.duration`,completed_at:`archives.log.completedAt`,filament:`archives.log.filament`,filament_used:`archives.log.filamentUsed`,cost:`archives.log.cost`,energy:`archives.log.energy`,energy_cost:`archives.log.energyCost`,wear_cost:`archives.log.wearCost`},Jt=[{id:`date`,visible:!0},{id:`print_name`,visible:!0},{id:`printer`,visible:!0},{id:`user`,visible:!0},{id:`status`,visible:!0},{id:`duration`,visible:!0},{id:`filament`,visible:!0},{id:`filament_used`,visible:!0},{id:`completed_at`,visible:!1},{id:`cost`,visible:!1},{id:`energy`,visible:!1},{id:`energy_cost`,visible:!1},{id:`wear_cost`,visible:!1}];function Yt(){try{let e=localStorage.getItem(Kt);if(e){let t=JSON.parse(e),n=new Set(Object.keys(qt)),r=new Set(t.map(e=>e.id)),i=t.filter(e=>n.has(e.id)).map(e=>({id:e.id,visible:!!e.visible})),a=Jt.filter(e=>!r.has(e.id));if(i.length>0)return[...i,...a]}}catch{}return Jt.map(e=>({...e}))}var Xt=`bambuddy-printlog-sort`,Zt=new Set(Object.keys(qt)),$={column:`date`,direction:`desc`};function Qt(){try{let e=localStorage.getItem(Xt);if(e){let t=JSON.parse(e);if(Zt.has(t?.column)&&(t.direction===`asc`||t.direction===`desc`))return t}}catch{}return{...$}}function $t(e){try{localStorage.setItem(Xt,JSON.stringify(e))}catch{}}function en(e){try{localStorage.setItem(Kt,JSON.stringify(e.map(e=>({id:e.id,visible:e.visible}))))}catch{}}function tn(e){let t=e.filename;if(t){let e=t.toLowerCase();if(e.endsWith(`.gcode`)||e.includes(`.gcode.`))return!0}return!!(e.total_layers||e.print_time_seconds)}async function nn(e,t,n,i){try{if(n===`source`){let{token:n}=await r.createSourceSlicerToken(e),a=r.getSourceSlicerDownloadUrl(e,n,t);dt(`${window.location.origin}${a}`,i)}else{let{token:n}=await r.createArchiveSlicerToken(e),a=r.getArchiveSlicerDownloadUrl(e,n,t);dt(`${window.location.origin}${a}`,i)}}catch{let a=n===`source`?r.getSource3mfForSlicer(e,t):r.getArchiveForSlicer(e,t);dt(`${window.location.origin}${a}`,i)}}function rn({archive:e,printerName:t,printerMap:n,isSelected:i,onSelect:a,selectionMode:o,projects:u,isHighlighted:d,timeFormat:f=`system`,preferredSlicer:m=`bambu_studio`,useSlicerApi:h=!1,currency:g,t:_,onNavigateToArchive:v}){d&&console.log(`ArchiveCard isHighlighted=true for archive:`,e.id);let y=s(),{showToast:b}=S(),{hasPermission:x,canModify:C}=st(),E=Ue(),k=(0,X.useMemo)(()=>{let t=e.extra_data?.slicer_ams_mapping;if(!(!t||!Array.isArray(t.mapping)||t.printer_id==null))return n.get(t.printer_id)},[e.extra_data,n]),[ee,A]=(0,X.useState)(!1),[M,N]=(0,X.useState)(!1),[re,se]=(0,X.useState)(!1),[ce,F]=(0,X.useState)(!1),[ue,pe]=(0,X.useState)(!1),[me,I]=(0,X.useState)(!1),R=c({queryKey:[`archive`,e.id,`delete-impact`],queryFn:()=>r.getArchiveDeleteImpact(e.id),enabled:ue,staleTime:0}),[ve,H]=(0,X.useState)(!1),[be,we]=(0,X.useState)(!1),[ke,je]=(0,X.useState)(!1),[Re,ze]=(0,X.useState)(!1),[He,We]=(0,X.useState)(!1),[G,Ge]=(0,X.useState)([]),[et,ct]=(0,X.useState)(!1),[dt,ft]=(0,X.useState)(!1),[pt,mt]=(0,X.useState)(!1),[ht,gt]=(0,X.useState)(!1),[_t,bt]=(0,X.useState)(!1),[xt,Y]=(0,X.useState)(!1),[St,Ct]=(0,X.useState)(null),[wt,Tt]=(0,X.useState)(null),[Dt,Ot]=(0,X.useState)(!1),[kt,At]=(0,X.useState)(null),jt=(0,X.useRef)(null),Mt=(0,X.useRef)(null),Nt=(0,X.useRef)(null),{data:Ft}=c({queryKey:[`archive-plates`,e.id],queryFn:()=>r.getArchivePlates(e.id),enabled:Dt,staleTime:300*1e3}),It=e.duplicate_sequence??0,Lt=Ie(e.user_verdict_source),Bt=e.original_archive_id??null,Vt=Ft?.plates??[],Ht=Ft?.is_multi_plate??!1,Ut=wt??0,Wt=async()=>{try{let t=await r.getArchivePlates(e.id);if(t.has_gcode===!1){b(_(`archives.platePicker.noGcode`),`info`);return}if(t.is_multi_plate&&t.plates.length>1){At(t.plates);return}}catch{}E(`/gcode-viewer?archive=${e.id}`)},Gt=l({mutationFn:()=>r.deleteArchiveTimelapse(e.id),onSuccess:()=>{y.invalidateQueries({queryKey:[`archives`]}),b(_(`archives.toast.timelapseRemoved`))},onError:e=>{b(e.message||_(`archives.toast.failedRemoveTimelapse`),`error`)}}),Kt=l({mutationFn:t=>r.uploadArchiveTimelapse(e.id,t),onSuccess:e=>{y.invalidateQueries({queryKey:[`archives`]}),b(_(`archives.toast.timelapseUploaded`,{filename:e.filename}))},onError:e=>{b(e.message||_(`archives.toast.failedUploadTimelapse`),`error`)}}),qt=l({mutationFn:t=>r.uploadSource3mf(e.id,t),onSuccess:e=>{y.invalidateQueries({queryKey:[`archives`]}),b(_(`archives.toast.source3mfAttached`,{filename:e.filename}))},onError:e=>{b(e.message||_(`archives.toast.failedUploadSource3mf`),`error`)}}),Jt=l({mutationFn:()=>r.deleteSource3mf(e.id),onSuccess:()=>{y.invalidateQueries({queryKey:[`archives`]}),b(_(`archives.toast.source3mfRemoved`))},onError:e=>{b(e.message||_(`archives.toast.failedRemoveSource3mf`),`error`)}}),Yt=l({mutationFn:t=>r.uploadF3d(e.id,t),onSuccess:e=>{y.invalidateQueries({queryKey:[`archives`]}),b(_(`archives.toast.f3dAttached`,{filename:e.filename}))},onError:e=>{b(e.message||_(`archives.toast.failedUploadF3d`),`error`)}}),Xt=l({mutationFn:()=>r.deleteF3d(e.id),onSuccess:()=>{y.invalidateQueries({queryKey:[`archives`]}),b(_(`archives.toast.f3dRemoved`))},onError:e=>{b(e.message||_(`archives.toast.failedRemoveF3d`),`error`)}}),Zt=l({mutationFn:()=>r.scanArchiveTimelapse(e.id),onSuccess:e=>{e.status===`attached`?(y.invalidateQueries({queryKey:[`archives`]}),b(_(`archives.toast.timelapseAttached`,{filename:e.filename}))):e.status===`exists`?b(_(`archives.toast.timelapseAlreadyAttached`)):e.status===`not_found`&&e.available_files&&e.available_files.length>0?(Ge(e.available_files),We(!0)):b(e.message||_(`archives.toast.noMatchingTimelapse`),`warning`)},onError:e=>{b(e.message||_(`archives.toast.failedScanTimelapse`),`error`)}}),$=l({mutationFn:t=>r.selectArchiveTimelapse(e.id,t),onSuccess:e=>{y.invalidateQueries({queryKey:[`archives`]}),b(_(`archives.toast.timelapseAttached`,{filename:e.filename})),We(!1),Ge([])},onError:e=>{b(e.message||_(`archives.toast.failedAttachTimelapse`),`error`)}}),Qt=l({mutationFn:t=>r.deleteArchive(e.id,t),onSuccess:()=>{Oe(y),b(_(`archives.toast.archiveDeleted`))},onError:()=>{b(_(`archives.toast.failedDeleteArchive`),`error`)}}),$t=l({mutationFn:()=>r.toggleFavorite(e.id),onSuccess:e=>{y.invalidateQueries({queryKey:[`archives`]}),b(e.is_favorite?_(`archives.toast.addedToFavorites`):_(`archives.toast.removedFromFavorites`))}}),{data:en}=c({queryKey:[`archive-folders`,e.id],queryFn:()=>r.getLibraryFoldersByArchive(e.id)}),rn=l({mutationFn:t=>r.updateArchive(e.id,{project_id:t}),onSuccess:()=>{Oe(y),b(_(`archives.toast.projectUpdated`))},onError:()=>{b(_(`archives.toast.failedUpdateProject`),`error`)}}),an=e=>{e.preventDefault(),Ct({x:e.clientX,y:e.clientY})},on=[...tn(e)?[{label:_(`common.print`),icon:(0,Z.jsx)(De,{className:`w-4 h-4`}),onClick:()=>A(!0),disabled:!e.file_path||!x(`queue:create`)||!C(`archives`,`reprint`,e.created_by_id),title:e.file_path?x(`queue:create`)?C(`archives`,`reprint`,e.created_by_id)?void 0:_(`archives.permission.noReprint`):_(`archives.permission.noAddToQueue`):_(`archives.card.noFileForReprint`)},{label:_(`archives.menu.openInBambuStudio`),icon:(0,Z.jsx)(Ce,{className:`w-4 h-4`}),onClick:()=>{let t=e.print_name||e.filename||`model`;nn(e.id,t,`file`,m)},disabled:!e.file_path,title:e.file_path?void 0:_(`archives.card.noFileForReprint`)}]:[{label:_(`archives.menu.slice`),icon:h?(0,Z.jsx)(T,{className:`w-4 h-4`}):(0,Z.jsx)(Ce,{className:`w-4 h-4`}),onClick:()=>{if(h)se(!0);else{let t=e.print_name||e.filename||`model`;nn(e.id,t,`file`,m)}}},...h?[{label:_(`library.runWithPipeline.actionLabel`),icon:(0,Z.jsx)(de,{className:`w-4 h-4`}),onClick:()=>F(!0),disabled:!x(`pipelines:run`),title:x(`pipelines:run`)?void 0:_(`library.runWithPipeline.noPermission`)}]:[]],{label:e.external_url?_(`archives.menu.externalLink`):_(`archives.menu.viewOnMakerWorld`),icon:(0,Z.jsx)(Ye,{className:`w-4 h-4`}),onClick:()=>{let t=e.external_url||e.makerworld_url;t&&window.open(t,`_blank`)},disabled:!e.external_url&&!e.makerworld_url},...e.status===`completed`?[{label:_(`archives.menu.confirmOutcome`),icon:e.user_verdict===`reject`?(0,Z.jsx)(Ne,{className:`w-4 h-4`}):(0,Z.jsx)(Qe,{className:`w-4 h-4`}),onClick:()=>N(!0),disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:_(`archives.menu.preview3d`),icon:(0,Z.jsx)(p,{className:`w-4 h-4`}),onClick:()=>{Wt()}},{label:_(`archives.menu.viewTimelapse`),icon:(0,Z.jsx)(j,{className:`w-4 h-4`}),onClick:()=>je(!0),disabled:!e.timelapse_path},{label:_(`archives.media.download`),icon:(0,Z.jsx)(J,{className:`w-4 h-4`}),onClick:()=>ze(!0),disabled:!e.timelapse_path&&(!x(`printers:files`)||!e.printer_id||!e.started_at),title:!e.timelapse_path&&!x(`printers:files`)?_(`printers.permission.noFiles`):void 0},{label:_(`archives.menu.scanForTimelapse`),icon:(0,Z.jsx)(ne,{className:`w-4 h-4`}),onClick:()=>Zt.mutate(),disabled:!e.printer_id||!!e.timelapse_path||Zt.isPending||!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)},{label:_(`archives.menu.uploadTimelapse`),icon:(0,Z.jsx)($e,{className:`w-4 h-4`}),onClick:()=>Nt.current?.click(),disabled:!!e.timelapse_path||!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)},...e.timelapse_path?[{label:_(`archives.menu.removeTimelapse`),icon:(0,Z.jsx)(U,{className:`w-4 h-4`}),onClick:()=>Y(!0),danger:!0,disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:e.source_3mf_path?_(`archives.menu.downloadSource3mf`):_(`archives.menu.uploadSource3mf`),icon:(0,Z.jsx)(vt,{className:`w-4 h-4`}),onClick:()=>{e.source_3mf_path?r.downloadSource3mf(e.id).catch(e=>{console.error(`Source 3MF download failed:`,e)}):jt.current?.click()},disabled:!e.source_3mf_path&&!C(`archives`,`update`,e.created_by_id),title:!e.source_3mf_path&&!C(`archives`,`update`,e.created_by_id)?_(`archives.permission.noUploadFiles`):void 0},...e.source_3mf_path?[{label:_(`archives.menu.replaceSource3mf`),icon:(0,Z.jsx)($e,{className:`w-4 h-4`}),onClick:()=>jt.current?.click(),disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)},{label:_(`archives.menu.removeSource3mf`),icon:(0,Z.jsx)(U,{className:`w-4 h-4`}),onClick:()=>gt(!0),danger:!0,disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)}]:[],{label:e.f3d_path?_(`archives.menu.replaceF3d`):_(`archives.menu.uploadF3d`),icon:(0,Z.jsx)(p,{className:`w-4 h-4`}),onClick:()=>Mt.current?.click(),disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)},...e.f3d_path?[{label:_(`archives.menu.downloadF3d`),icon:(0,Z.jsx)(q,{className:`w-4 h-4`}),onClick:()=>{r.downloadF3d(e.id).catch(e=>{console.error(`F3D download failed:`,e)})}},{label:_(`archives.menu.removeF3d`),icon:(0,Z.jsx)(U,{className:`w-4 h-4`}),onClick:()=>bt(!0),danger:!0,disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:_(`archives.menu.download`),icon:(0,Z.jsx)(q,{className:`w-4 h-4`}),onClick:()=>{r.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},disabled:!x(`archives:read`),title:x(`archives:read`)?void 0:_(`archives.permission.noDownload`)},{label:_(`archives.menu.copyDownloadLink`),icon:(0,Z.jsx)(D,{className:`w-4 h-4`}),onClick:()=>{let t=`${window.location.origin}${r.getArchiveDownload(e.id)}`;navigator.clipboard.writeText(t).then(()=>{b(_(`archives.toast.linkCopied`))}).catch(()=>{b(_(`archives.toast.failedCopyLink`),`error`)})},disabled:!x(`archives:read`),title:x(`archives:read`)?void 0:_(`archives.permission.noCopyLink`)},{label:_(`archives.menu.qrCode`),icon:(0,Z.jsx)(fe,{className:`w-4 h-4`}),onClick:()=>ct(!0)},{label:e.photos?.length?_(`archives.menu.viewPhotosCount`,{count:e.photos.length}):_(`archives.menu.viewPhotos`),icon:(0,Z.jsx)(Le,{className:`w-4 h-4`}),onClick:()=>ft(!0),disabled:!e.photos?.length},{label:_(`archives.menu.projectPage`),icon:(0,Z.jsx)(rt,{className:`w-4 h-4`}),onClick:()=>mt(!0)},{label:``,divider:!0,onClick:()=>{}},{label:e.is_favorite?_(`archives.menu.removeFromFavorites`):_(`archives.menu.addToFavorites`),icon:(0,Z.jsx)(Ee,{className:`w-4 h-4 ${e.is_favorite?`fill-yellow-400 text-yellow-400`:C(`archives`,`update`,e.created_by_id)?`group-hover:text-yellow-400`:``}`}),onClick:()=>$t.mutate(),disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)},{label:_(`archives.menu.edit`),icon:(0,Z.jsx)(xe,{className:`w-4 h-4`}),onClick:()=>H(!0),disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`)},{label:_(`archives.menu.printLog`),icon:(0,Z.jsx)(oe,{className:`w-4 h-4`}),onClick:()=>we(!0)},...e.project_id&&e.project_name?[{label:_(`archives.menu.goToProject`,{name:e.project_name}),icon:(0,Z.jsx)(ot,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>window.location.href=`/projects`}]:[],{label:_(`archives.menu.addToProject`),icon:(0,Z.jsx)(ot,{className:`w-4 h-4`}),onClick:()=>{},disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?void 0:_(`archives.permission.noUpdateArchives`),submenuSearchPlaceholder:Te(u??[],e.project_id).length>5?_(`archives.menu.searchProjects`):void 0,submenu:(()=>{let t=[];if(e.project_id&&t.push({label:_(`archives.menu.removeFromProject`),icon:(0,Z.jsx)(L,{className:`w-4 h-4`}),onClick:()=>rn.mutate(null),disabled:!C(`archives`,`update`,e.created_by_id)}),!u)t.push({label:_(`archives.menu.loading`),icon:(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}),onClick:()=>{},disabled:!0});else{let n=Te(u,e.project_id).sort((e,t)=>e.name.localeCompare(t.name));n.length===0?t.push({label:_(`archives.menu.noProjectsAvailable`),icon:(0,Z.jsx)(ot,{className:`w-4 h-4 opacity-50`}),onClick:()=>{},disabled:!0}):n.forEach(n=>{t.push({label:n.name,icon:(0,Z.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:n.color||`#888`}}),onClick:()=>rn.mutate(n.id),disabled:e.project_id===n.id||!C(`archives`,`update`,e.created_by_id)})})}return t})()},{label:_(i?`archives.menu.deselect`:`archives.menu.select`),icon:i?(0,Z.jsx)(Be,{className:`w-4 h-4`}):(0,Z.jsx)(Ae,{className:`w-4 h-4`}),onClick:()=>a(e.id)},{label:``,divider:!0,onClick:()=>{}},{label:_(`archives.menu.delete`),icon:(0,Z.jsx)(U,{className:`w-4 h-4`}),onClick:()=>pe(!0),danger:!0,disabled:!C(`archives`,`delete`,e.created_by_id),title:C(`archives`,`delete`,e.created_by_id)?void 0:_(`archives.permission.noDelete`)}];return(0,Z.jsxs)(B,{"data-archive-id":e.id,className:`relative flex flex-col group ${i?`ring-2 ring-bambu-green`:``} ${o?`cursor-pointer`:``}`,style:d?{outline:`4px solid #facc15`,outlineOffset:`2px`}:void 0,onContextMenu:an,onClick:o?()=>a(e.id):void 0,children:[o&&(0,Z.jsx)(`button`,{className:`absolute top-2 left-2 z-10 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors`,onClick:t=>{t.stopPropagation(),a(e.id)},children:i?(0,Z.jsx)(Be,{className:`w-5 h-5 text-bambu-green`}):(0,Z.jsx)(Ae,{className:`w-5 h-5 text-white`})}),(0,Z.jsxs)(`div`,{className:`aspect-video bg-bambu-dark relative flex-shrink-0 overflow-hidden rounded-t-xl`,onMouseEnter:()=>Ot(!0),onMouseLeave:()=>Ot(!1),children:[e.thumbnail_path?(0,Z.jsx)(`img`,{src:wt!==null&&Vt.length>0?r.getArchivePlateThumbnail(e.id,Vt[Ut]?.index??0):r.getArchiveThumbnail(e.id),loading:`lazy`,alt:e.print_name||e.filename,className:`w-full h-full object-cover`}):(0,Z.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,Z.jsx)(tt,{className:`w-12 h-12 text-bambu-dark-tertiary`})}),Ht&&Vt.length>1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{className:`absolute left-1 top-1/2 -translate-y-1/2 p-1 rounded-full bg-black/60 hover:bg-black/80 transition-all can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,onClick:e=>{e.stopPropagation(),Tt(e=>{let t=e??0;return t>0?t-1:Vt.length-1})},title:_(`archives.card.previousPlate`),children:(0,Z.jsx)(Ze,{className:`w-4 h-4 text-white`})}),(0,Z.jsx)(`button`,{className:`absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-full bg-black/60 hover:bg-black/80 transition-all can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,onClick:e=>{e.stopPropagation(),Tt(e=>{let t=e??0;return t(0,Z.jsx)(`button`,{className:`w-2 h-2 rounded-full transition-colors ${t===Ut?`bg-bambu-green`:`bg-white/50 hover:bg-white/80`}`,onClick:e=>{e.stopPropagation(),Tt(t)},title:e.name||_(`archives.card.plateNumber`,{index:e.index})},e.index))})]}),(0,Z.jsx)(`button`,{className:`absolute top-2 left-2 p-1.5 rounded bg-black/50 hover:bg-black/70 transition-all can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 ${o?`left-10`:``}`,onClick:e=>{e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();Ct({x:t.left,y:t.bottom+4})},title:_(`archives.card.moreOptions`),children:(0,Z.jsx)(O,{className:`w-5 h-5 text-white`})}),(0,Z.jsx)(`button`,{className:`absolute top-2 right-2 p-1 rounded transition-colors ${C(`archives`,`update`,e.created_by_id)?`bg-black/50 hover:bg-black/70`:`bg-black/30 cursor-not-allowed`}`,onClick:t=>{t.stopPropagation(),C(`archives`,`update`,e.created_by_id)&&$t.mutate()},disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?e.is_favorite?_(`archives.card.removeFromFavorites`):_(`archives.card.addToFavorites`):_(`archives.permission.noUpdateArchives`),children:(0,Z.jsx)(Ee,{className:`w-5 h-5 ${e.is_favorite?`text-yellow-400 fill-yellow-400`:`text-white`} ${C(`archives`,`update`,e.created_by_id)?``:`opacity-50`}`})}),(e.status===`failed`||e.status===`aborted`)&&(0,Z.jsx)(`div`,{className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-status-error/80 text-white`,children:e.status===`aborted`?_(`archives.card.cancelled`):_(`archives.card.failed`)}),e.status===`completed`&&e.confirm_requested&&e.user_verdict==null&&(0,Z.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),N(!0)},disabled:!C(`archives`,`update`,e.created_by_id),className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-amber-500/90 enabled:hover:bg-amber-500 text-black flex items-center gap-1 transition-colors enabled:cursor-pointer`,title:C(`archives`,`update`,e.created_by_id)?_(`archives.card.confirmPendingTitle`):_(`archives.permission.noUpdateArchives`),children:[(0,Z.jsx)(Qe,{className:`w-3 h-3`}),_(`archives.card.confirmPending`)]}),e.status===`completed`&&e.user_verdict===`reject`&&(0,Z.jsxs)(`div`,{className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-status-error/80 text-white flex items-center gap-1`,title:`${_(`archives.card.rejectedTitle`)}${Lt?` — ${_(Lt)}`:``}`,children:[(0,Z.jsx)(Ne,{className:`w-3 h-3`}),_(`archives.card.rejected`)]}),e.status===`completed`&&e.user_verdict===`good`&&(0,Z.jsxs)(`div`,{className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-bambu-green/80 text-white flex items-center gap-1`,title:`${_(`archives.card.confirmedGoodTitle`)}${Lt?` — ${_(Lt)}`:``}`,children:[(0,Z.jsx)(Qe,{className:`w-3 h-3`}),_(`archives.card.confirmedGood`)]}),e.duplicate_count>0&&It>0&&Bt&&(0,Z.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),v?.(Bt)},className:`absolute top-2 right-12 px-2 py-1 rounded text-xs bg-purple-500/80 hover:bg-purple-600/90 text-white flex items-center gap-1 transition-colors cursor-pointer`,title:_(`archives.viewOriginalPrint`,{id:Bt}),children:[(0,Z.jsx)(D,{className:`w-3 h-3`}),`#`,It]}),e.duplicate_count>0&&It===0&&(0,Z.jsxs)(`span`,{className:`absolute top-2 right-12 px-2 py-1 rounded text-xs bg-purple-500/80 text-white flex items-center gap-1`,title:`${e.duplicate_count} reprint${e.duplicate_count===1?``:`s`}`,children:[(0,Z.jsx)(yt,{className:`w-3 h-3`}),`+`,e.duplicate_count]}),e.source_3mf_path&&(0,Z.jsx)(`button`,{className:`absolute bottom-2 left-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:t=>{t.stopPropagation();let n=(e.print_name||e.filename||`source`).replace(/\.gcode\.3mf$/i,``)+`_source`;nn(e.id,n,`source`,m)},title:_(`archives.card.openSource3mf`),children:(0,Z.jsx)(vt,{className:`w-4 h-4 text-orange-400`})}),e.f3d_path&&(0,Z.jsx)(`button`,{className:`absolute bottom-2 ${e.source_3mf_path?`left-12`:`left-2`} p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:t=>{t.stopPropagation(),r.downloadF3d(e.id).catch(e=>{console.error(`F3D download failed:`,e)})},title:_(`archives.card.downloadF3d`),children:(0,Z.jsx)(p,{className:`w-4 h-4 text-cyan-400`})}),(0,Z.jsx)(`button`,{className:`absolute bottom-2 right-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>{e.stopPropagation(),Wt()},title:_(`archives.card.preview3d`),children:(0,Z.jsx)(Je,{className:`w-4 h-4 text-white`})}),e.timelapse_path&&(0,Z.jsx)(`button`,{className:`absolute bottom-2 right-12 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>{e.stopPropagation(),je(!0)},title:_(`archives.card.viewTimelapse`),children:(0,Z.jsx)(j,{className:`w-4 h-4 text-bambu-green`})}),e.photos&&e.photos.length>0&&(0,Z.jsxs)(`button`,{className:`absolute bottom-2 ${e.timelapse_path?`right-[5.5rem]`:`right-12`} p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>{e.stopPropagation(),ft(!0)},title:e.photos.length===1?_(`archives.card.viewPhoto`):_(`archives.card.viewPhotos`,{count:e.photos.length}),children:[(0,Z.jsx)(Le,{className:`w-4 h-4 text-blue-400`}),e.photos.length>1&&(0,Z.jsx)(`span`,{className:`absolute -top-1 -right-1 w-4 h-4 bg-blue-500 rounded-full text-[10px] text-white flex items-center justify-center`,children:e.photos.length})]}),en&&en.length>0&&(0,Z.jsx)(W,{to:`/files?folder=${en[0].id}`,className:`absolute bottom-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>e.stopPropagation(),title:_(`archives.card.openFolder`,{name:en[0].name}),style:{left:e.source_3mf_path?e.f3d_path?`5.5rem`:`3rem`:e.f3d_path?`3rem`:`0.5rem`},children:(0,Z.jsx)(nt,{className:`w-4 h-4 text-yellow-400`})})]}),(0,Z.jsxs)(z,{className:`p-4 flex-1 flex flex-col`,children:[(0,Z.jsxs)(`p`,{className:`text-[10px] text-bambu-gray/70 mb-1`,children:[`#`,e.id]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,Z.jsxs)(`h3`,{className:`min-w-0 font-medium text-white truncate`,children:[e.print_name||e.filename,e.plate_id!=null&&e.plate_id>1&&` — ${_(`printers.plateNumber`,{number:e.plate_id})}`]}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,className:`p-1 sm:p-1.5 shrink-0`,onClick:()=>H(!0),disabled:!C(`archives`,`update`,e.created_by_id),title:C(`archives`,`update`,e.created_by_id)?_(`archives.card.edit`):_(`archives.card.noPermissionEdit`),children:(0,Z.jsx)(xe,{className:`w-3 h-3 sm:w-4 sm:h-4`})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 flex-wrap`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:t}),(()=>{let t=Ve(e.bed_type);return t?(0,Z.jsx)(`img`,{src:t.icon,alt:t.label,title:t.label,className:`w-4 h-4 flex-shrink-0`}):null})(),(0,Z.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${tn(e)?`bg-bambu-green/20 text-bambu-green`:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`}`,title:tn(e)?_(`archives.card.slicedFile`):_(`archives.card.sourceFile`),children:tn(e)?_(`archives.card.gcode`):_(`archives.card.source`)}),e.content_hash&&(0,Z.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded font-mono bg-bambu-dark-tertiary/50 text-bambu-gray-light opacity-0 transition-opacity duration-150 group-hover:opacity-100`,title:`SHA256: ${e.content_hash}`,children:e.content_hash.slice(0,8).toUpperCase()}),e.project_name&&(0,Z.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded-full truncate max-w-[120px]`,style:{backgroundColor:`${u?.find(t=>t.id===e.project_id)?.color||`#6b7280`}20`,color:u?.find(t=>t.id===e.project_id)?.color||`#6b7280`},title:_(`archives.card.project`,{name:e.project_name}),children:e.project_name}),e.run_count>1&&(0,Z.jsx)(`button`,{className:`text-[10px] px-1.5 py-0.5 rounded font-medium bg-bambu-orange/20 text-bambu-orange hover:bg-bambu-orange/30 transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),we(!0)},title:_(`archives.card.runsBadgeTitle`,{count:e.run_count,successful:e.successful_run_count,failed:e.failed_run_count}),children:_(`archives.card.runsBadge`,{count:e.run_count})})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs mb-4 min-h-[48px]`,children:[(e.print_time_seconds||e.actual_time_seconds)&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,title:e.time_accuracy?`Estimated: ${ye(e.print_time_seconds||0)}\nActual: ${ye(e.actual_time_seconds||0)}\nAccuracy: ${e.time_accuracy.toFixed(0)}%`:e.actual_time_seconds?`Actual: ${ye(e.actual_time_seconds)}`:`Estimated: ${ye(e.print_time_seconds||0)}`,children:[(0,Z.jsx)(Pe,{className:`w-3 h-3`}),ye(e.actual_time_seconds||e.print_time_seconds||0),e.time_accuracy&&(0,Z.jsxs)(`span`,{className:`text-[10px] px-1 rounded ${e.time_accuracy>=95&&e.time_accuracy<=105?`bg-bambu-green/20 text-bambu-green`:e.time_accuracy>105?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`}`,children:[e.time_accuracy>100?`+`:``,(e.time_accuracy-100).toFixed(0),`%`]})]}),e.filament_used_grams&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,children:[(0,Z.jsx)(le,{className:`w-3 h-3`}),e.filament_used_grams.toFixed(1),`g`]}),(e.cost!=null||e.energy_cost!=null||e.wear_cost!=null)&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 text-bambu-gray`,children:[e.cost!=null&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:e.status===`printing`?_(`archives.card.costEstimate`):void 0,"data-testid":`archive-cost`,children:[(0,Z.jsx)(w,{className:`w-3 h-3`}),e.status===`printing`&&`~`,g,e.cost.toFixed(2)]}),e.energy_cost!=null&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:`${_(`stats.energyUsed`)}: ${e.energy_kwh?.toFixed(3)||`N/A`} kWh`,children:[(0,Z.jsx)(qe,{className:`w-3 h-3`}),g,e.energy_cost.toFixed(2)]}),e.wear_cost!=null&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:_(`archives.card.wearCost`),children:[(0,Z.jsx)(it,{className:`w-3 h-3`}),g,e.wear_cost.toFixed(2)]})]}),(e.layer_height||e.total_layers)&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,children:[(0,Z.jsx)(Je,{className:`w-3 h-3`}),e.total_layers&&(0,Z.jsx)(`span`,{children:e.total_layers===1?_(`archives.card.layer`,{count:e.total_layers}):_(`archives.card.layers`,{count:e.total_layers})}),e.total_layers&&e.layer_height&&(0,Z.jsx)(`span`,{className:`text-bambu-gray/50`,children:`·`}),e.layer_height&&(0,Z.jsxs)(`span`,{children:[e.layer_height,`mm`]})]}),e.object_count!=null&&e.object_count>0&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,title:e.object_count===1?_(`archives.card.object`,{count:e.object_count}):_(`archives.card.objects`,{count:e.object_count}),children:[(0,Z.jsx)(p,{className:`w-3 h-3`}),e.object_count===1?_(`archives.card.object`,{count:e.object_count}):_(`archives.card.objects`,{count:e.object_count})]}),e.sliced_for_model&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,title:_(`archives.card.slicedFor`,{model:e.sliced_for_model}),children:[(0,Z.jsx)(De,{className:`w-3 h-3`}),e.sliced_for_model]}),e.filament_type&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 col-span-2`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:e.filament_type}),e.filament_color&&(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5 flex-wrap`,children:e.filament_color.split(`,`).map((e,t)=>(0,Z.jsx)(`div`,{className:`w-3 h-3 rounded-full border border-black/20`,style:{backgroundColor:e},title:e},t))})]})]}),k&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-green text-xs mb-3`,title:_(`archives.card.slicerAmsMappingTooltip`,{printer:k}),children:[(0,Z.jsx)(Se,{className:`w-3.5 h-3.5`}),_(`archives.card.slicerAmsMapping`,{printer:k})]}),(e.tags||e.notes)&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-3`,children:[e.notes&&(0,Z.jsx)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 rounded text-xs`,title:e.notes,children:(0,Z.jsx)(he,{className:`w-3 h-3`})}),e.tags?.split(`,`).map((e,t)=>(0,Z.jsx)(`span`,{className:`px-1.5 py-0.5 bg-bambu-dark-tertiary text-bambu-gray-light rounded text-xs`,children:e.trim()},t))]}),(0,Z.jsx)(`div`,{className:`flex-1`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-bambu-gray border-t border-bambu-dark-tertiary pt-3`,children:[(0,Z.jsx)(`span`,{children:_e(e.created_at,f)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.created_by_username&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,title:_(`archives.card.uploadedBy`,{name:e.created_by_username}),children:[(0,Z.jsx)(Fe,{className:`w-3 h-3`}),e.created_by_username]}),(0,Z.jsx)(`span`,{children:ge(e.file_size)})]})]}),(0,Z.jsxs)(`div`,{className:`flex gap-1 mt-3`,children:[tn(e)?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(V,{variant:`primary`,size:`sm`,className:`flex-1 min-w-0 overflow-hidden`,onClick:()=>A(!0),disabled:!e.file_path||!x(`queue:create`)||!C(`archives`,`reprint`,e.created_by_id),title:e.file_path?x(`queue:create`)?C(`archives`,`reprint`,e.created_by_id)?void 0:_(`archives.card.noPermissionReprint`):_(`archives.permission.noAddToQueue`):_(`archives.card.noFileForReprint`),children:[(0,Z.jsx)(De,{className:`w-3 h-3 flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`hidden xl:inline truncate`,children:_(`common.print`)})]}),(0,Z.jsx)(V,{variant:`secondary`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>{let t=e.print_name||e.filename||`model`;nn(e.id,t,`file`,m)},title:_(`archives.card.openInBambuStudio`),children:(0,Z.jsx)(Ce,{className:`w-3 h-3 sm:w-4 sm:h-4`})})]}):(0,Z.jsxs)(V,{variant:`primary`,size:`sm`,className:`flex-1 min-w-0 overflow-hidden`,onClick:()=>{if(h)se(!0);else{let t=e.print_name||e.filename||`model`;nn(e.id,t,`file`,m)}},title:_(h?`slice.title`:`archives.card.openInBambuStudioToSlice`),children:[h?(0,Z.jsx)(T,{className:`w-3 h-3 flex-shrink-0`}):(0,Z.jsx)(Ce,{className:`w-3 h-3 flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`hidden xl:inline truncate`,children:_(`archives.card.slice`)})]}),(0,Z.jsx)(V,{variant:`secondary`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>{let t=e.external_url||e.makerworld_url;t&&window.open(t,`_blank`)},disabled:!e.external_url&&!e.makerworld_url,title:e.external_url?_(`archives.card.externalLink`):e.makerworld_url?_(`archives.card.makerWorld`,{designer:e.designer||_(`archives.card.viewProject`)}):_(`archives.card.noExternalLink`),children:(0,Z.jsx)(Ye,{className:`w-3 h-3 sm:w-4 sm:h-4 ${!e.external_url&&!e.makerworld_url?`opacity-20`:``}`})}),(0,Z.jsx)(V,{variant:`secondary`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>{r.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},title:_(`archives.card.download`),children:(0,Z.jsx)(q,{className:`w-3 h-3 sm:w-4 sm:h-4`})}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>pe(!0),disabled:!C(`archives`,`delete`,e.created_by_id),title:C(`archives`,`delete`,e.created_by_id)?_(`archives.card.delete`):_(`archives.card.noPermissionDelete`),children:(0,Z.jsx)(U,{className:`w-3 h-3 sm:w-4 sm:h-4 text-red-600 dark:text-red-400`})})]})]}),ve&&(0,Z.jsx)(Xe,{archive:e,onClose:()=>H(!1)}),be&&(0,Z.jsx)(Et,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>we(!1)}),kt&&(0,Z.jsx)(ie,{plates:kt,onSelect:t=>{At(null),E(`/gcode-viewer?archive=${e.id}&plate=${t}`)},onClose:()=>At(null)}),ee&&(0,Z.jsx)(Ke,{mode:`create`,archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>A(!1)}),M&&(0,Z.jsx)(at,{archiveId:e.id,onClose:()=>N(!1)}),re&&(0,Z.jsx)(ae,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>se(!1)}),ce&&(0,Z.jsx)(lt,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>F(!1)}),ue&&(0,Z.jsxs)(K,{title:_(`archives.modal.deleteArchive`),message:_(`archives.modal.deleteConfirm`,{name:e.print_name||e.filename}),confirmText:_(`archives.modal.deleteButton`),variant:`danger`,confirmDisabled:(R.data?.currently_printing??0)>0,onConfirm:()=>{Qt.mutate(me),pe(!1),I(!1)},onCancel:()=>{pe(!1),I(!1)},children:[(R.data?.related_queue_items??0)>0&&(0,Z.jsx)(`div`,{className:(R.data?.currently_printing??0)>0?`text-sm text-red-600 dark:text-red-400 mb-2`:`text-sm text-amber-600 dark:text-amber-400 mb-2`,children:(R.data?.currently_printing??0)>0?_(`archives.modal.deleteBlockedByPrinting`,{count:R.data.currently_printing}):_(`archives.modal.deleteQueueItemsWarning`,{count:R.data.related_queue_items})}),(0,Z.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer text-sm text-bambu-gray`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 accent-red-500`,checked:me,onChange:e=>I(e.target.checked)}),(0,Z.jsx)(`span`,{children:_(`archives.modal.deletePurgeStats`)})]})]}),ht&&(0,Z.jsx)(K,{title:_(`archives.modal.removeSource3mf`),message:_(`archives.modal.removeSource3mfConfirm`,{name:e.print_name||e.filename}),confirmText:_(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Jt.mutate(),gt(!1)},onCancel:()=>gt(!1)}),_t&&(0,Z.jsx)(K,{title:_(`archives.modal.removeF3d`),message:_(`archives.modal.removeF3dConfirm`,{name:e.print_name||e.filename}),confirmText:_(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Xt.mutate(),bt(!1)},onCancel:()=>bt(!1)}),xt&&(0,Z.jsx)(K,{title:_(`archives.modal.removeTimelapse`),message:_(`archives.modal.removeTimelapseConfirm`,{name:e.print_name||e.filename}),confirmText:_(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Gt.mutate(),Y(!1)},onCancel:()=>Y(!1)}),St&&(0,Z.jsx)(te,{x:St.x,y:St.y,items:on,onClose:()=>Ct(null)}),Re&&(0,Z.jsx)(zt,{archiveId:e.id,archiveName:e.print_name||e.filename,printerName:t,onClose:()=>ze(!1)}),ke&&e.timelapse_path&&(0,Z.jsx)(Rt,{src:r.getArchiveTimelapse(e.id),title:_(`archives.modal.timelapse`,{name:e.print_name||e.filename}),downloadFilename:`${e.print_name||e.filename}_timelapse.mp4`,archiveId:e.id,onClose:()=>je(!1),onEdit:()=>{y.invalidateQueries({queryKey:[`archives`]}),je(!1)}}),He&&G.length>0&&(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,children:(0,Z.jsxs)(`div`,{className:`bg-card-dark rounded-lg max-w-lg w-full max-h-[80vh] flex flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-700`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:_(`archives.modal.selectTimelapse`)}),(0,Z.jsx)(`p`,{className:`text-sm text-gray-400 mt-1`,children:_(`archives.modal.selectTimelapseDesc`)})]}),(0,Z.jsx)(`button`,{onClick:()=>{We(!1),Ge([])},className:`text-gray-400 hover:text-white p-1`,children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsx)(`div`,{className:`overflow-y-auto flex-1 p-2`,children:G.map(e=>(0,Z.jsxs)(`button`,{onClick:()=>$.mutate(e.name),disabled:$.isPending,className:`w-full text-left p-3 rounded-lg hover:bg-gray-700 transition-colors flex items-center gap-3 disabled:opacity-50`,children:[(0,Z.jsx)(j,{className:`w-8 h-8 text-bambu-green flex-shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.name}),(0,Z.jsxs)(`p`,{className:`text-sm text-gray-400`,children:[ge(e.size),e.mtime&&` • ${_e(e.mtime,f)}`]})]})]},e.name))}),(0,Z.jsx)(`div`,{className:`p-4 border-t border-gray-700`,children:(0,Z.jsx)(V,{variant:`secondary`,onClick:()=>{We(!1),Ge([])},className:`w-full`,children:`Cancel`})})]})}),et&&(0,Z.jsx)(Pt,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>ct(!1)}),dt&&e.photos&&e.photos.length>0&&(0,Z.jsx)(ut,{archiveId:e.id,archiveName:e.print_name||e.filename,photos:e.photos,onClose:()=>ft(!1),onDelete:async t=>{try{await r.deleteArchivePhoto(e.id,t),y.invalidateQueries({queryKey:[`archives`]}),b(_(`archives.toast.photoDeleted`))}catch{b(_(`archives.toast.failedDeletePhoto`),`error`)}}}),pt&&(0,Z.jsx)(Q,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>mt(!1)}),(0,Z.jsx)(`input`,{ref:jt,type:`file`,accept:`.3mf`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&qt.mutate(t),e.target.value=``}}),(0,Z.jsx)(`input`,{ref:Mt,type:`file`,accept:`.f3d`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Yt.mutate(t),e.target.value=``}}),(0,Z.jsx)(`input`,{ref:Nt,type:`file`,accept:`.mp4,.avi,.mkv`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Kt.mutate(t),e.target.value=``}})]})}function an({archive:e,printerName:t,isSelected:n,onSelect:i,selectionMode:a,projects:o,isHighlighted:u,preferredSlicer:d=`bambu_studio`,useSlicerApi:f=!1,t:m,onNavigateToArchive:h}){let g=s(),{showToast:_}=S(),{hasPermission:v,canModify:y}=st(),[b,x]=(0,X.useState)(!1),[C,w]=(0,X.useState)(!1),[E,k]=(0,X.useState)(!1),[ee,A]=(0,X.useState)(!1),M=c({queryKey:[`archive`,e.id,`delete-impact`],queryFn:()=>r.getArchiveDeleteImpact(e.id),enabled:E,staleTime:0}),N=Ue(),[re,se]=(0,X.useState)(!1),[ce,le]=(0,X.useState)(!1),[F,ue]=(0,X.useState)(!1),[pe,me]=(0,X.useState)(!1),[he,I]=(0,X.useState)(!1),[R,z]=(0,X.useState)(!1),[B,_e]=(0,X.useState)(!1),[H,ye]=(0,X.useState)([]),[be,Se]=(0,X.useState)(!1),[we,ke]=(0,X.useState)(!1),[je,Me]=(0,X.useState)(!1),[Pe,Re]=(0,X.useState)(!1),[ze,He]=(0,X.useState)(!1),[We,G]=(0,X.useState)(!1),[Ge,qe]=(0,X.useState)(null),Je=(0,X.useRef)(null),Ze=(0,X.useRef)(null),et=(0,X.useRef)(null),[it,ct]=(0,X.useState)(null),dt=e.duplicate_sequence??0,ft=Ie(e.user_verdict_source),pt=e.original_archive_id??null,mt=async()=>{try{let t=await r.getArchivePlates(e.id);if(t.is_multi_plate&&t.plates.length>1){ct(t.plates);return}}catch{}N(`/gcode-viewer?archive=${e.id}`)},ht=l({mutationFn:()=>r.deleteArchiveTimelapse(e.id),onSuccess:()=>{g.invalidateQueries({queryKey:[`archives`]}),_(m(`archives.toast.timelapseRemoved`))},onError:e=>{_(e.message||m(`archives.toast.failedRemoveTimelapse`),`error`)}}),gt=l({mutationFn:t=>r.uploadArchiveTimelapse(e.id,t),onSuccess:e=>{g.invalidateQueries({queryKey:[`archives`]}),_(m(`archives.toast.timelapseUploaded`,{filename:e.filename}))},onError:e=>{_(e.message||m(`archives.toast.failedUploadTimelapse`),`error`)}}),_t=l({mutationFn:t=>r.uploadSource3mf(e.id,t),onSuccess:e=>{g.invalidateQueries({queryKey:[`archives`]}),_(m(`archives.toast.source3mfAttached`,{filename:e.filename}))},onError:e=>{_(e.message||m(`archives.toast.failedUploadSource3mf`),`error`)}}),J=l({mutationFn:()=>r.deleteSource3mf(e.id),onSuccess:()=>{g.invalidateQueries({queryKey:[`archives`]}),_(m(`archives.toast.source3mfRemoved`))},onError:e=>{_(e.message||m(`archives.toast.failedRemoveSource3mf`),`error`)}}),bt=l({mutationFn:t=>r.uploadF3d(e.id,t),onSuccess:e=>{g.invalidateQueries({queryKey:[`archives`]}),_(m(`archives.toast.f3dAttached`,{filename:e.filename}))},onError:e=>{_(e.message||m(`archives.toast.failedUploadF3d`),`error`)}}),xt=l({mutationFn:()=>r.deleteF3d(e.id),onSuccess:()=>{g.invalidateQueries({queryKey:[`archives`]}),_(m(`archives.toast.f3dRemoved`))},onError:e=>{_(e.message||m(`archives.toast.failedRemoveF3d`),`error`)}}),Y=l({mutationFn:()=>r.scanArchiveTimelapse(e.id),onSuccess:e=>{e.status===`attached`?(g.invalidateQueries({queryKey:[`archives`]}),_(m(`archives.toast.timelapseAttached`,{filename:e.filename}))):e.status===`exists`?_(m(`archives.toast.timelapseAlreadyAttached`)):e.status===`not_found`&&e.available_files&&e.available_files.length>0?(ye(e.available_files),_e(!0)):_(e.message||m(`archives.toast.noMatchingTimelapse`),`warning`)},onError:e=>{_(e.message||m(`archives.toast.failedScanTimelapse`),`error`)}}),St=l({mutationFn:t=>r.selectArchiveTimelapse(e.id,t),onSuccess:e=>{g.invalidateQueries({queryKey:[`archives`]}),_(m(`archives.toast.timelapseAttached`,{filename:e.filename})),_e(!1),ye([])},onError:e=>{_(e.message||m(`archives.toast.failedAttachTimelapse`),`error`)}}),Ct=l({mutationFn:t=>r.deleteArchive(e.id,t),onSuccess:()=>{Oe(g),_(m(`archives.toast.archiveDeleted`))},onError:()=>{_(m(`archives.toast.failedDeleteArchive`),`error`)}}),wt=l({mutationFn:()=>r.toggleFavorite(e.id),onSuccess:e=>{g.invalidateQueries({queryKey:[`archives`]}),_(e.is_favorite?m(`archives.toast.addedToFavorites`):m(`archives.toast.removedFromFavorites`))}}),{data:Tt}=c({queryKey:[`archive-folders`,e.id],queryFn:()=>r.getLibraryFoldersByArchive(e.id)}),Dt=l({mutationFn:t=>r.updateArchive(e.id,{project_id:t}),onSuccess:()=>{Oe(g),_(m(`archives.toast.projectUpdated`))},onError:()=>{_(m(`archives.toast.failedUpdateProject`),`error`)}}),Ot=e=>{e.preventDefault(),qe({x:e.clientX,y:e.clientY})},kt=[...tn(e)?[{label:m(`common.print`),icon:(0,Z.jsx)(De,{className:`w-4 h-4`}),onClick:()=>se(!0),disabled:!e.file_path||!v(`queue:create`)||!y(`archives`,`reprint`,e.created_by_id),title:e.file_path?v(`queue:create`)?y(`archives`,`reprint`,e.created_by_id)?void 0:m(`archives.permission.noReprint`):m(`archives.permission.noAddToQueue`):m(`archives.card.noFileForReprint`)},{label:m(`archives.menu.openInBambuStudio`),icon:(0,Z.jsx)(Ce,{className:`w-4 h-4`}),onClick:()=>{let t=e.print_name||e.filename||`model`;nn(e.id,t,`file`,d)},disabled:!e.file_path,title:e.file_path?void 0:m(`archives.card.noFileForReprint`)}]:[{label:m(`archives.menu.slice`),icon:f?(0,Z.jsx)(T,{className:`w-4 h-4`}):(0,Z.jsx)(Ce,{className:`w-4 h-4`}),onClick:()=>{if(f)ue(!0);else{let t=e.print_name||e.filename||`model`;nn(e.id,t,`file`,d)}}},...f?[{label:m(`library.runWithPipeline.actionLabel`),icon:(0,Z.jsx)(de,{className:`w-4 h-4`}),onClick:()=>me(!0),disabled:!v(`pipelines:run`),title:v(`pipelines:run`)?void 0:m(`library.runWithPipeline.noPermission`)}]:[]],{label:e.external_url?m(`archives.menu.externalLink`):m(`archives.menu.viewOnMakerWorld`),icon:(0,Z.jsx)(Ye,{className:`w-4 h-4`}),onClick:()=>{let t=e.external_url||e.makerworld_url;t&&window.open(t,`_blank`)},disabled:!e.external_url&&!e.makerworld_url},...e.status===`completed`?[{label:m(`archives.menu.confirmOutcome`),icon:e.user_verdict===`reject`?(0,Z.jsx)(Ne,{className:`w-4 h-4`}):(0,Z.jsx)(Qe,{className:`w-4 h-4`}),onClick:()=>le(!0),disabled:!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:m(`archives.menu.preview3d`),icon:(0,Z.jsx)(p,{className:`w-4 h-4`}),onClick:()=>{mt()}},{label:m(`archives.menu.viewTimelapse`),icon:(0,Z.jsx)(j,{className:`w-4 h-4`}),onClick:()=>I(!0),disabled:!e.timelapse_path},{label:m(`archives.menu.scanForTimelapse`),icon:(0,Z.jsx)(ne,{className:`w-4 h-4`}),onClick:()=>Y.mutate(),disabled:!e.printer_id||!!e.timelapse_path||Y.isPending||!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)},{label:m(`archives.menu.uploadTimelapse`),icon:(0,Z.jsx)($e,{className:`w-4 h-4`}),onClick:()=>et.current?.click(),disabled:!!e.timelapse_path||!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)},...e.timelapse_path?[{label:m(`archives.menu.removeTimelapse`),icon:(0,Z.jsx)(U,{className:`w-4 h-4`}),onClick:()=>G(!0),danger:!0,disabled:!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:e.source_3mf_path?m(`archives.menu.downloadSource3mf`):m(`archives.menu.uploadSource3mf`),icon:(0,Z.jsx)(vt,{className:`w-4 h-4`}),onClick:()=>{e.source_3mf_path?r.downloadSource3mf(e.id).catch(e=>{console.error(`Source 3MF download failed:`,e)}):Je.current?.click()},disabled:!e.source_3mf_path&&!y(`archives`,`update`,e.created_by_id),title:!e.source_3mf_path&&!y(`archives`,`update`,e.created_by_id)?m(`archives.permission.noUploadFiles`):void 0},...e.source_3mf_path?[{label:m(`archives.menu.replaceSource3mf`),icon:(0,Z.jsx)($e,{className:`w-4 h-4`}),onClick:()=>Je.current?.click(),disabled:!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)},{label:m(`archives.menu.removeSource3mf`),icon:(0,Z.jsx)(U,{className:`w-4 h-4`}),onClick:()=>Re(!0),danger:!0,disabled:!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)}]:[],{label:e.f3d_path?m(`archives.menu.replaceF3d`):m(`archives.menu.uploadF3d`),icon:(0,Z.jsx)(p,{className:`w-4 h-4`}),onClick:()=>Ze.current?.click(),disabled:!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)},...e.f3d_path?[{label:m(`archives.menu.downloadF3d`),icon:(0,Z.jsx)(q,{className:`w-4 h-4`}),onClick:()=>{r.downloadF3d(e.id).catch(e=>{console.error(`F3D download failed:`,e)})}},{label:m(`archives.menu.removeF3d`),icon:(0,Z.jsx)(U,{className:`w-4 h-4`}),onClick:()=>He(!0),danger:!0,disabled:!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:m(`archives.menu.download`),icon:(0,Z.jsx)(q,{className:`w-4 h-4`}),onClick:()=>{r.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},disabled:!v(`archives:read`),title:v(`archives:read`)?void 0:m(`archives.permission.noDownload`)},{label:m(`archives.menu.copyDownloadLink`),icon:(0,Z.jsx)(D,{className:`w-4 h-4`}),onClick:()=>{let t=`${window.location.origin}${r.getArchiveDownload(e.id)}`;navigator.clipboard.writeText(t).then(()=>{_(m(`archives.toast.linkCopied`))}).catch(()=>{_(m(`archives.toast.failedCopyLink`),`error`)})},disabled:!v(`archives:read`),title:v(`archives:read`)?void 0:m(`archives.permission.noCopyLink`)},{label:m(`archives.menu.qrCode`),icon:(0,Z.jsx)(fe,{className:`w-4 h-4`}),onClick:()=>Se(!0)},{label:e.photos?.length?m(`archives.menu.viewPhotosCount`,{count:e.photos.length}):m(`archives.menu.viewPhotos`),icon:(0,Z.jsx)(Le,{className:`w-4 h-4`}),onClick:()=>ke(!0),disabled:!e.photos?.length},{label:m(`archives.menu.projectPage`),icon:(0,Z.jsx)(rt,{className:`w-4 h-4`}),onClick:()=>Me(!0)},{label:``,divider:!0,onClick:()=>{}},{label:e.is_favorite?m(`archives.menu.removeFromFavorites`):m(`archives.menu.addToFavorites`),icon:(0,Z.jsx)(Ee,{className:`w-4 h-4 ${e.is_favorite?`fill-yellow-400 text-yellow-400`:y(`archives`,`update`,e.created_by_id)?`group-hover:text-yellow-400`:``}`}),onClick:()=>wt.mutate(),disabled:!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)},{label:m(`archives.menu.edit`),icon:(0,Z.jsx)(xe,{className:`w-4 h-4`}),onClick:()=>x(!0),disabled:!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?void 0:m(`archives.permission.noUpdateArchives`)},{label:m(`archives.menu.printLog`),icon:(0,Z.jsx)(oe,{className:`w-4 h-4`}),onClick:()=>w(!0)},...e.project_id&&e.project_name?[{label:m(`archives.menu.goToProject`,{name:e.project_name}),icon:(0,Z.jsx)(ot,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>window.location.href=`/projects`}]:[],{label:m(`archives.menu.addToProject`),icon:(0,Z.jsx)(ot,{className:`w-4 h-4`}),onClick:()=>{},submenuSearchPlaceholder:Te(o??[],e.project_id).length>5?m(`archives.menu.searchProjects`):void 0,submenu:(()=>{let t=[];if(e.project_id&&t.push({label:m(`archives.menu.removeFromProject`),icon:(0,Z.jsx)(L,{className:`w-4 h-4`}),onClick:()=>Dt.mutate(null)}),!o)t.push({label:m(`archives.menu.loading`),icon:(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}),onClick:()=>{},disabled:!0});else{let n=Te(o,e.project_id).sort((e,t)=>e.name.localeCompare(t.name));n.length===0?t.push({label:m(`archives.menu.noProjectsAvailable`),icon:(0,Z.jsx)(ot,{className:`w-4 h-4 opacity-50`}),onClick:()=>{},disabled:!0}):n.forEach(n=>{t.push({label:n.name,icon:(0,Z.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:n.color||`#888`}}),onClick:()=>Dt.mutate(n.id),disabled:e.project_id===n.id})})}return t})()},{label:m(n?`archives.menu.deselect`:`archives.menu.select`),icon:n?(0,Z.jsx)(Be,{className:`w-4 h-4`}):(0,Z.jsx)(Ae,{className:`w-4 h-4`}),onClick:()=>i(e.id)},{label:``,divider:!0,onClick:()=>{}},{label:m(`archives.menu.delete`),icon:(0,Z.jsx)(U,{className:`w-4 h-4`}),onClick:()=>k(!0),danger:!0,disabled:!y(`archives`,`delete`,e.created_by_id),title:y(`archives`,`delete`,e.created_by_id)?void 0:m(`archives.permission.noDelete`)}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{"data-archive-id":e.id,className:`grid grid-cols-12 gap-4 px-4 py-3 items-center hover:bg-bambu-dark-tertiary/30 ${n?`bg-bambu-green/10`:``}`,style:u?{outline:`4px solid #facc15`,outlineOffset:`-4px`}:void 0,onContextMenu:Ot,children:[(0,Z.jsxs)(`div`,{className:`col-span-1 flex items-center gap-2`,children:[a&&(0,Z.jsx)(`button`,{onClick:()=>i(e.id),children:n?(0,Z.jsx)(Be,{className:`w-4 h-4 text-bambu-green`}):(0,Z.jsx)(Ae,{className:`w-4 h-4 text-bambu-gray`})}),e.thumbnail_path?(0,Z.jsx)(`img`,{src:r.getArchiveThumbnail(e.id),loading:`lazy`,alt:``,className:`w-10 h-10 object-cover rounded`}):(0,Z.jsx)(`div`,{className:`w-10 h-10 bg-bambu-dark rounded flex items-center justify-center`,children:(0,Z.jsx)(tt,{className:`w-5 h-5 text-bambu-dark-tertiary`})})]}),(0,Z.jsxs)(`div`,{className:`col-span-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-white text-sm truncate`,children:e.print_name||e.filename}),(e.status===`failed`||e.status===`aborted`)&&(0,Z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-status-error/80 text-white flex-shrink-0`,children:e.status===`aborted`?m(`archives.card.cancelled`):m(`archives.card.failed`)}),e.status===`completed`&&e.confirm_requested&&e.user_verdict==null&&(0,Z.jsx)(`button`,{onClick:e=>{e.stopPropagation(),le(!0)},disabled:!y(`archives`,`update`,e.created_by_id),className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-amber-500/90 enabled:hover:bg-amber-500 text-black flex-shrink-0 transition-colors`,title:y(`archives`,`update`,e.created_by_id)?m(`archives.card.confirmPendingTitle`):m(`archives.permission.noUpdateArchives`),children:m(`archives.card.confirmPending`)}),e.status===`completed`&&e.user_verdict===`reject`&&(0,Z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-status-error/80 text-white flex-shrink-0`,title:`${m(`archives.card.rejectedTitle`)}${ft?` — ${m(ft)}`:``}`,children:m(`archives.card.rejected`)}),e.status===`completed`&&e.user_verdict===`good`&&(0,Z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-bambu-green/80 text-white flex-shrink-0`,title:`${m(`archives.card.confirmedGoodTitle`)}${ft?` — ${m(ft)}`:``}`,children:m(`archives.card.confirmedGood`)}),e.duplicate_count>0&&dt>0&&pt&&(0,Z.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),h?.(pt)},className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-purple-500/80 hover:bg-purple-600/90 text-white flex-shrink-0 transition-colors flex items-center gap-1`,title:m(`archives.viewOriginalPrint`,{id:pt}),children:[(0,Z.jsx)(D,{className:`w-3 h-3`}),`#`,dt]}),e.duplicate_count>0&&dt===0&&(0,Z.jsxs)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-purple-500/80 text-white flex-shrink-0 flex items-center gap-1`,title:`${e.duplicate_count} reprint${e.duplicate_count===1?``:`s`}`,children:[(0,Z.jsx)(yt,{className:`w-3 h-3`}),`+`,e.duplicate_count]}),e.timelapse_path&&(0,Z.jsx)(`span`,{title:m(`archives.list.hasTimelapse`),children:(0,Z.jsx)(j,{className:`w-3.5 h-3.5 text-bambu-green flex-shrink-0`})}),Tt&&Tt.length>0&&(0,Z.jsx)(W,{to:`/files?folder=${Tt[0].id}`,className:`flex-shrink-0`,title:m(`archives.card.openFolder`,{name:Tt[0].name}),onClick:e=>e.stopPropagation(),children:(0,Z.jsx)(nt,{className:`w-3.5 h-3.5 text-yellow-600 dark:text-yellow-400`})})]}),(e.filament_type||e.sliced_for_model)&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[e.sliced_for_model&&(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray flex items-center gap-1`,title:m(`archives.card.slicedFor`,{model:e.sliced_for_model}),children:[(0,Z.jsx)(De,{className:`w-2.5 h-2.5`}),e.sliced_for_model]}),(()=>{let t=Ve(e.bed_type);return t?(0,Z.jsx)(`img`,{src:t.icon,alt:t.label,title:t.label,className:`w-3.5 h-3.5 flex-shrink-0`}):null})(),e.sliced_for_model&&e.filament_type&&(0,Z.jsx)(`span`,{className:`text-bambu-gray/50`,children:`·`}),e.filament_type&&(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.filament_type}),e.filament_color&&(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5 flex-wrap`,children:e.filament_color.split(`,`).map((e,t)=>(0,Z.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full border border-black/20`,style:{backgroundColor:e},title:e},t))})]})]}),(0,Z.jsx)(`div`,{className:`col-span-2 text-sm text-bambu-gray truncate`,children:t}),(0,Z.jsxs)(`div`,{className:`col-span-2 text-sm text-bambu-gray`,children:[(0,Z.jsx)(`div`,{children:ve(e.created_at)}),e.created_by_username&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 text-xs opacity-75`,title:m(`archives.card.uploadedBy`,{name:e.created_by_username}),children:[(0,Z.jsx)(Fe,{className:`w-3 h-3`}),e.created_by_username]})]}),(0,Z.jsx)(`div`,{className:`col-span-1 text-sm text-bambu-gray`,children:ge(e.file_size)}),(0,Z.jsxs)(`div`,{className:`col-span-2 flex justify-end gap-1`,children:[tn(e)&&(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>se(!0),disabled:!e.file_path||!v(`queue:create`)||!y(`archives`,`reprint`,e.created_by_id),title:e.file_path?v(`queue:create`)?y(`archives`,`reprint`,e.created_by_id)?m(`common.print`):m(`archives.card.noPermissionReprint`):m(`archives.permission.noAddToQueue`):m(`archives.card.noFileForReprint`),className:`text-bambu-green hover:text-bambu-green-light hover:bg-bambu-green/10`,children:(0,Z.jsx)(de,{className:`w-4 h-4`})}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{let t=e.print_name||e.filename||`model`;nn(e.id,t,`file`,d)},title:m(`archives.card.openInBambuStudio`),children:(0,Z.jsx)(Ce,{className:`w-4 h-4`})}),(e.external_url||e.makerworld_url)&&(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>window.open(e.external_url||e.makerworld_url,`_blank`),title:e.external_url?m(`archives.card.externalLink`):`MakerWorld`,children:(0,Z.jsx)(Ye,{className:`w-4 h-4`})}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>z(!0),disabled:!e.timelapse_path&&(!v(`printers:files`)||!e.printer_id||!e.started_at),title:!e.timelapse_path&&!v(`printers:files`)?m(`printers.permission.noFiles`):m(`archives.media.download`),children:(0,Z.jsx)(j,{className:`w-4 h-4`})}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{r.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},title:m(`archives.card.download`),children:(0,Z.jsx)(q,{className:`w-4 h-4`})}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>x(!0),disabled:!y(`archives`,`update`,e.created_by_id),title:y(`archives`,`update`,e.created_by_id)?m(`archives.card.edit`):m(`archives.card.noPermissionEdit`),children:(0,Z.jsx)(xe,{className:`w-4 h-4`})}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>k(!0),disabled:!y(`archives`,`delete`,e.created_by_id),title:y(`archives`,`delete`,e.created_by_id)?m(`archives.card.delete`):m(`archives.card.noPermissionDelete`),children:(0,Z.jsx)(U,{className:`w-4 h-4 text-red-600 dark:text-red-400`})}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();qe({x:t.left,y:t.bottom+4})},title:m(`archives.card.moreOptions`),children:(0,Z.jsx)(O,{className:`w-4 h-4`})})]})]}),b&&(0,Z.jsx)(Xe,{archive:e,onClose:()=>x(!1)}),C&&(0,Z.jsx)(Et,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>w(!1)}),it&&(0,Z.jsx)(ie,{plates:it,onSelect:t=>{ct(null),N(`/gcode-viewer?archive=${e.id}&plate=${t}`)},onClose:()=>ct(null)}),re&&(0,Z.jsx)(Ke,{mode:`create`,archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>se(!1)}),ce&&(0,Z.jsx)(at,{archiveId:e.id,onClose:()=>le(!1)}),F&&(0,Z.jsx)(ae,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>ue(!1)}),pe&&(0,Z.jsx)(lt,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>me(!1)}),E&&(0,Z.jsxs)(K,{title:m(`archives.modal.deleteArchive`),message:m(`archives.modal.deleteConfirm`,{name:e.print_name||e.filename}),confirmText:m(`archives.modal.deleteButton`),variant:`danger`,confirmDisabled:(M.data?.currently_printing??0)>0,onConfirm:()=>{Ct.mutate(ee),k(!1),A(!1)},onCancel:()=>{k(!1),A(!1)},children:[(M.data?.related_queue_items??0)>0&&(0,Z.jsx)(`div`,{className:(M.data?.currently_printing??0)>0?`text-sm text-red-600 dark:text-red-400 mb-2`:`text-sm text-amber-600 dark:text-amber-400 mb-2`,children:(M.data?.currently_printing??0)>0?m(`archives.modal.deleteBlockedByPrinting`,{count:M.data.currently_printing}):m(`archives.modal.deleteQueueItemsWarning`,{count:M.data.related_queue_items})}),(0,Z.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer text-sm text-bambu-gray`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 accent-red-500`,checked:ee,onChange:e=>A(e.target.checked)}),(0,Z.jsx)(`span`,{children:m(`archives.modal.deletePurgeStats`)})]})]}),Pe&&(0,Z.jsx)(K,{title:m(`archives.modal.removeSource3mf`),message:m(`archives.modal.removeSource3mfConfirm`,{name:e.print_name||e.filename}),confirmText:m(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{J.mutate(),Re(!1)},onCancel:()=>Re(!1)}),ze&&(0,Z.jsx)(K,{title:m(`archives.modal.removeF3d`),message:m(`archives.modal.removeF3dConfirm`,{name:e.print_name||e.filename}),confirmText:m(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{xt.mutate(),He(!1)},onCancel:()=>He(!1)}),We&&(0,Z.jsx)(K,{title:m(`archives.modal.removeTimelapse`),message:m(`archives.modal.removeTimelapseConfirm`,{name:e.print_name||e.filename}),confirmText:m(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{ht.mutate(),G(!1)},onCancel:()=>G(!1)}),Ge&&(0,Z.jsx)(te,{x:Ge.x,y:Ge.y,items:kt,onClose:()=>qe(null)}),R&&(0,Z.jsx)(zt,{archiveId:e.id,archiveName:e.print_name||e.filename,printerName:t,onClose:()=>z(!1)}),he&&e.timelapse_path&&(0,Z.jsx)(Rt,{src:r.getArchiveTimelapse(e.id),title:m(`archives.modal.timelapse`,{name:e.print_name||e.filename}),downloadFilename:`${e.print_name||e.filename}_timelapse.mp4`,archiveId:e.id,onClose:()=>I(!1),onEdit:()=>{g.invalidateQueries({queryKey:[`archives`]}),I(!1)}}),B&&H.length>0&&(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,children:(0,Z.jsxs)(`div`,{className:`bg-card-dark rounded-lg max-w-lg w-full max-h-[80vh] flex flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-700`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:m(`archives.modal.selectTimelapse`)}),(0,Z.jsx)(`p`,{className:`text-sm text-gray-400 mt-1`,children:m(`archives.modal.selectTimelapseDesc`)})]}),(0,Z.jsx)(`button`,{onClick:()=>{_e(!1),ye([])},className:`text-gray-400 hover:text-white p-1`,children:(0,Z.jsx)(L,{className:`w-5 h-5`})})]}),(0,Z.jsx)(`div`,{className:`overflow-y-auto flex-1 p-2`,children:H.map(e=>(0,Z.jsxs)(`button`,{onClick:()=>St.mutate(e.name),disabled:St.isPending,className:`w-full text-left p-3 rounded-lg hover:bg-gray-700 transition-colors mb-1`,children:[(0,Z.jsx)(`div`,{className:`font-medium text-white`,children:e.name}),(0,Z.jsxs)(`div`,{className:`text-sm text-gray-400 flex gap-3`,children:[(0,Z.jsx)(`span`,{children:ge(e.size)}),e.mtime&&(0,Z.jsx)(`span`,{children:ve(e.mtime)})]})]},e.name))})]})}),be&&(0,Z.jsx)(Pt,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>Se(!1)}),we&&e.photos&&(0,Z.jsx)(ut,{archiveId:e.id,archiveName:e.print_name||e.filename,photos:e.photos,onClose:()=>ke(!1),onDelete:async t=>{try{await r.deleteArchivePhoto(e.id,t),g.invalidateQueries({queryKey:[`archives`]}),_(m(`archives.toast.photoDeleted`))}catch{_(m(`archives.toast.failedDeletePhoto`),`error`)}}}),je&&(0,Z.jsx)(Q,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>Me(!1)}),(0,Z.jsx)(`input`,{ref:Je,type:`file`,accept:`.3mf`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&_t.mutate(t),e.target.value=``}}),(0,Z.jsx)(`input`,{ref:Ze,type:`file`,accept:`.f3d`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&bt.mutate(t),e.target.value=``}}),(0,Z.jsx)(`input`,{ref:et,type:`file`,accept:`.mp4,.avi,.mkv`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&>.mutate(t),e.target.value=``}})]})}var on=[`completed`,`failed`,`aborted`,`cancelled`,`stopped`],sn=[{id:`all`,label:`All Archives`,icon:(0,Z.jsx)(nt,{className:`w-4 h-4`})},{id:`recent`,label:`Last 24 Hours`,icon:(0,Z.jsx)(Pe,{className:`w-4 h-4`})},{id:`this-week`,label:`This Week`,icon:(0,Z.jsx)(m,{className:`w-4 h-4`})},{id:`this-month`,label:`This Month`,icon:(0,Z.jsx)(m,{className:`w-4 h-4`})},{id:`favorites`,label:`Favorites`,icon:(0,Z.jsx)(Ee,{className:`w-4 h-4`})},{id:`not-printed`,label:`Not Printed`,icon:(0,Z.jsx)($e,{className:`w-4 h-4`})},{id:`printed`,label:`Printed`,icon:(0,Z.jsx)(De,{className:`w-4 h-4`})},{id:`failed`,label:`Failed Prints`,icon:(0,Z.jsx)(y,{className:`w-4 h-4`})},{id:`duplicates`,label:`Duplicates`,icon:(0,Z.jsx)(D,{className:`w-4 h-4`})}];function cn(){let{t:e}=a(),t=s(),{showToast:n}=S(),{hasPermission:i,hasAnyPermission:o}=st(),u=(0,X.useRef)(null),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(()=>{let e=localStorage.getItem(`archiveFilterPrinter`);return e?Number(e):null}),[v,b]=(0,X.useState)(()=>{let e=localStorage.getItem(`archiveFilterMaterial`);return e&&!e.includes(`,`)?e:null}),[x,C]=(0,X.useState)(()=>{let e=localStorage.getItem(`archiveFilterColors`);return e?new Set(JSON.parse(e)):new Set}),[w,T]=(0,X.useState)(()=>localStorage.getItem(`archiveColorFilterMode`)||`or`),[O,k]=(0,X.useState)(()=>localStorage.getItem(`archiveFilterFavorites`)===`true`),[A,te]=(0,X.useState)(()=>localStorage.getItem(`archiveHideFailed`)===`true`),[j,ne]=(0,X.useState)(()=>localStorage.getItem(`archiveFilterUnconfirmed`)===`true`),[N,ie]=(0,X.useState)(()=>localStorage.getItem(`archiveHideDuplicates`)===`true`),[ae,oe]=(0,X.useState)(()=>localStorage.getItem(`archiveFilterTag`)),[F,ue]=(0,X.useState)(()=>localStorage.getItem(`archiveFilterFileType`)||`all`),[de,fe]=(0,X.useState)(!1),[me,he]=(0,X.useState)([]),[I,R]=(0,X.useState)(new Set),[ge,ve]=(0,X.useState)(()=>localStorage.getItem(`archiveNo3MFWarningDismissed`)===`true`),{data:H}=c({queryKey:[`archives`,`no-3mf-warning`],queryFn:r.getNo3MFWarning,staleTime:300*1e3,enabled:!ge}),Se=()=>{localStorage.setItem(`archiveNo3MFWarningDismissed`,`true`),ve(!0)},we=H?.reason===`ftps_cooloff`?`FtpsCooloff`:H?.reason===`ftp_transfer_failed`?`FtpTransferFailed`:H?.reason===`internal_storage`?`InternalStorage`:H?.reason===`no_external_storage`?`NoExternalStorage`:H?.reason===`internal_history`?`InternalHistory`:``,Te=H?.reason===`ftps_cooloff`?`https://wiki.bambuddy.cool/reference/troubleshooting/#ftps-tls-failure`:H?.reason===`ftp_transfer_failed`?`https://wiki.bambuddy.cool/reference/troubleshooting/#ftp-transfer-timed-out`:H?.reason===`internal_storage`?`https://wiki.bambuddy.cool/reference/troubleshooting/#archive-card-has-only-a-name`:H?.reason===`no_external_storage`?null:H?.reason===`internal_history`?`https://wiki.bambuddy.cool/reference/troubleshooting/#print-started-on-the-printer-has-no-thumbnail`:`https://wiki.bambuddy.cool/getting-started/#step-4-enable-store-sent-files-on-external-storage`,[De,Ae]=(0,X.useState)(!1),[Ne,Pe]=(0,X.useState)(!1),[Fe,Ie]=(0,X.useState)(!1),[Le,ze]=(0,X.useState)(!1),[W,Ve]=(0,X.useState)(()=>localStorage.getItem(`archiveViewMode`)||`grid`),[He,Ue]=(0,X.useState)(()=>localStorage.getItem(`archiveSortBy`)||`date-desc`),[G,Ke]=(0,X.useState)(()=>localStorage.getItem(`archiveCollection`)||`all`),[qe,Je]=(0,X.useState)(0),[Ye,Xe]=(0,X.useState)(()=>{try{let e=localStorage.getItem(`archivePageSize`);return e?Number(e):50}catch{return 50}}),[et,tt]=(0,X.useState)(!1),[nt,q]=(0,X.useState)(!1),[it,at]=(0,X.useState)(!1),[lt,ut]=(0,X.useState)(!1),[dt,ht]=(0,X.useState)(!1),[J,yt]=(0,X.useState)(null),[bt,xt]=(0,X.useState)(null),[Y,St]=(0,X.useState)(()=>localStorage.getItem(`logFilterUser`)||null),[wt,Et]=(0,X.useState)(()=>localStorage.getItem(`logFilterStatus`)),[kt,At]=(0,X.useState)(()=>localStorage.getItem(`logFilterDateFrom`)||``),[jt,Mt]=(0,X.useState)(()=>localStorage.getItem(`logFilterDateTo`)||``),[Pt,Q]=(0,X.useState)(()=>{let e=localStorage.getItem(`logOffset`);return e?Number(e):0}),[Ft,It]=(0,X.useState)(!1),[Lt,Rt]=(0,X.useState)(null),[zt,Vt]=(0,X.useState)(null),[Ht,Ut]=(0,X.useState)(``),[Kt,Xt]=(0,X.useState)(``),[$,nn]=(0,X.useState)(()=>{let e=localStorage.getItem(`logPageSize`);return e?Number(e):25}),[cn,un]=(0,X.useState)(Yt),[dn,fn]=(0,X.useState)(!1),[pn,mn]=(0,X.useState)(Qt),hn=(0,X.useMemo)(()=>cn.filter(e=>e.visible).map(e=>e.id),[cn]),gn=(0,X.useCallback)(e=>{xt(e),yt(e)},[]);(0,X.useEffect)(()=>{if(J){let t=setTimeout(()=>{let t=document.querySelector(`[data-archive-id="${J}"]`);t?t.scrollIntoView({behavior:`smooth`,block:`center`}):bt===J&&n(e(`archives.originalPrintNotVisible`),`warning`),bt===J&&xt(null)},100),r=setTimeout(()=>yt(null),5e3);return()=>{clearTimeout(t),clearTimeout(r)}}},[J,bt,n,e]);let{data:_n,isLoading:vn}=c({queryKey:[`archives`,m],queryFn:()=>r.getArchives(m||void 0)}),{data:yn}=c({queryKey:[`printers`],queryFn:r.getPrinters}),{data:bn}=c({queryKey:[`projects`],queryFn:()=>r.getProjects()}),{data:xn}=c({queryKey:[`settings`],queryFn:r.getSettings}),{data:Sn}=c({queryKey:[`users`,`slim`],queryFn:r.getUsersSlim,enabled:W===`log`}),{data:Cn,isLoading:wn}=c({queryKey:[`print-log`,m,Y,wt,kt,jt,f,Pt,$,pn.column,pn.direction],queryFn:()=>r.getPrintLog({search:f||void 0,printerId:m||void 0,username:Y||void 0,status:wt||void 0,dateFrom:kt||void 0,dateTo:jt||void 0,limit:$,offset:Pt,sortBy:pn.column,sortDir:pn.direction}),enabled:W===`log`}),Tn=xn?.time_format||`system`,En=ft(xn?.open_in_slicer,xn?.preferred_slicer),Dn=xn?.use_slicer_api??!1,On=Ge(xn?.currency||`USD`),kn=(0,X.useMemo)(()=>cn.map(t=>({...t,label:e(qt[t.id]??t.id)})),[cn,e]),An=(0,X.useMemo)(()=>Jt.map(t=>({...t,label:e(qt[t.id]??t.id)})),[e]),jn=(0,X.useCallback)(e=>{Zt.has(e)&&(mn(t=>{let n=t.column===e?{column:e,direction:t.direction===`asc`?`desc`:`asc`}:{column:e,direction:[`date`,`completed_at`,`duration`,`filament_used`,`cost`,`energy`,`energy_cost`,`wear_cost`].includes(e)?`desc`:`asc`};return $t(n),n}),Q(0))},[]),Mn=(0,X.useCallback)(e=>{let t=e.map(e=>({id:e.id,visible:e.visible}));un(t),en(t)},[]),Nn=(0,X.useMemo)(()=>new Set([`duration`,`filament_used`,`cost`,`energy`,`energy_cost`,`wear_cost`]),[]),Pn=(0,X.useCallback)((t,n)=>{switch(t){case`date`:return(0,Z.jsx)(`span`,{className:`text-white whitespace-nowrap`,children:_e(n.started_at||n.created_at,Tn)});case`completed_at`:return(0,Z.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap`,children:n.completed_at?_e(n.completed_at,Tn):`—`});case`print_name`:return(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.thumbnail_path&&(0,Z.jsx)(`img`,{src:r.getPrintLogThumbnail(n.id),alt:``,className:`w-8 h-8 rounded object-cover flex-shrink-0`,onError:e=>{e.target.style.display=`none`}}),(0,Z.jsx)(`span`,{className:`text-white break-words`,title:n.print_name||``,children:n.print_name||`—`})]});case`printer`:return(0,Z.jsx)(`span`,{className:`text-bambu-gray-light`,children:n.printer_name||`—`});case`user`:return(0,Z.jsx)(`span`,{className:`text-bambu-gray-light`,children:n.created_by_username||`—`});case`status`:return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${n.status===`completed`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`:n.status===`failed`?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:n.status===`stopped`?`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`:n.status===`cancelled`?`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`:n.status===`skipped`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:`bg-gray-500/20 text-gray-400`}`,children:n.status}),n.failure_reason&&(0,Z.jsx)(`span`,{className:`block text-[10px] text-bambu-gray mt-0.5`,children:e(`editArchive.failureReasons.${n.failure_reason}`,{defaultValue:n.failure_reason})})]});case`duration`:return(0,Z.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap`,children:n.duration_seconds?ye(n.duration_seconds):`—`});case`filament`:return(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n.filament_color&&(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5 flex-wrap`,children:n.filament_color.split(`,`).map((e,t)=>{let n=e.trim();return(0,Z.jsx)(`span`,{className:`w-3 h-3 rounded-full border border-black/20 flex-shrink-0`,style:{backgroundColor:n.startsWith(`#`)?n:void 0},title:n},t)})}),(0,Z.jsx)(`span`,{className:`text-bambu-gray-light text-xs`,children:n.filament_type||`—`})]});case`filament_used`:return(0,Z.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.filament_used_grams==null?`—`:`${n.filament_used_grams.toFixed(1)} g`});case`cost`:return(0,Z.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.cost==null?`—`:`${On}${n.cost.toFixed(2)}`});case`energy`:return(0,Z.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.energy_kwh==null?`—`:`${n.energy_kwh.toFixed(2)} kWh`});case`energy_cost`:return(0,Z.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.energy_cost==null?`—`:`${On}${n.energy_cost.toFixed(2)}`});case`wear_cost`:return(0,Z.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.wear_cost==null?`—`:`${On}${n.wear_cost.toFixed(2)}`});default:return null}},[On,e,Tn]),Fn=l({mutationFn:async e=>(await Promise.all(e.map(e=>r.deleteArchive(e))),e.length),onSuccess:e=>{Oe(t),R(new Set),n(`${e} archive${e===1?``:`s`} deleted`)},onError:()=>{n(e(`archives.toast.failedDeleteArchives`),`error`)}}),In=l({mutationFn:()=>r.clearPrintLog(),onSuccess:r=>{t.invalidateQueries({queryKey:[`print-log`]}),Q(0),n(e(`archives.log.cleared`,{count:r.deleted}))},onError:()=>{n(e(`archives.log.clearFailed`),`error`)}}),Ln=l({mutationFn:e=>r.deletePrintLogEntry(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`print-log`]}),t.invalidateQueries({queryKey:[`archives-stats`]}),n(e(`archives.log.entryDeleted`))},onError:()=>{n(e(`archives.log.entryDeleteFailed`),`error`)}}),Rn=l({mutationFn:({id:e,body:t})=>r.updatePrintLogEntry(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`print-log`]}),t.invalidateQueries({queryKey:[`archives-stats`]}),Vt(null),n(e(`archives.log.entryUpdated`))},onError:()=>{n(e(`archives.log.entryUpdateFailed`),`error`)}});(0,X.useEffect)(()=>{m===null?localStorage.removeItem(`archiveFilterPrinter`):localStorage.setItem(`archiveFilterPrinter`,m.toString())},[m]),(0,X.useEffect)(()=>{v?localStorage.setItem(`archiveFilterMaterial`,v):localStorage.removeItem(`archiveFilterMaterial`)},[v]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveFilterColors`,JSON.stringify([...x]))},[x]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveColorFilterMode`,w)},[w]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveFilterFavorites`,O.toString())},[O]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveHideFailed`,A.toString())},[A]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveFilterUnconfirmed`,j.toString())},[j]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveHideDuplicates`,N.toString())},[N]),(0,X.useEffect)(()=>{ae?localStorage.setItem(`archiveFilterTag`,ae):localStorage.removeItem(`archiveFilterTag`)},[ae]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveFilterFileType`,F)},[F]),(0,X.useEffect)(()=>{Je(0)},[f,m,v,x,w,O,A,j,N,ae,F,He,G]),(0,X.useEffect)(()=>{try{localStorage.setItem(`archivePageSize`,String(Ye))}catch{}},[Ye]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveViewMode`,W)},[W]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveSortBy`,He)},[He]),(0,X.useEffect)(()=>{localStorage.setItem(`archiveCollection`,G)},[G]),(0,X.useEffect)(()=>{Y?localStorage.setItem(`logFilterUser`,Y):localStorage.removeItem(`logFilterUser`)},[Y]),(0,X.useEffect)(()=>{wt?localStorage.setItem(`logFilterStatus`,wt):localStorage.removeItem(`logFilterStatus`)},[wt]),(0,X.useEffect)(()=>{kt?localStorage.setItem(`logFilterDateFrom`,kt):localStorage.removeItem(`logFilterDateFrom`)},[kt]),(0,X.useEffect)(()=>{jt?localStorage.setItem(`logFilterDateTo`,jt):localStorage.removeItem(`logFilterDateTo`)},[jt]),(0,X.useEffect)(()=>{localStorage.setItem(`logOffset`,Pt.toString())},[Pt]),(0,X.useEffect)(()=>{localStorage.setItem(`logPageSize`,$.toString())},[$]);let zn=(0,X.useMemo)(()=>new Map(yn?.map(e=>[e.id,e.name])||[]),[yn]),Bn=[...new Set(_n?.flatMap(e=>pt(e.filament_type))||[])].sort(),Vn=[...new Set(_n?.flatMap(e=>e.filament_color?.split(`,`)||[]).filter(Boolean)||[])],Hn=[...new Set(_n?.flatMap(e=>e.tags?.split(`,`).map(e=>e.trim())||[]).filter(Boolean)||[])].sort(),Un=_n?.filter(e=>{let t=new Date,n=be(e.created_at)||new Date(0),r=!0;switch(G){case`recent`:r=t.getTime()-n.getTime()<1440*60*1e3;break;case`this-week`:r=t.getTime()-n.getTime()<10080*60*1e3;break;case`this-month`:r=n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear();break;case`favorites`:r=e.is_favorite===!0;break;case`not-printed`:r=e.status===`archived`;break;case`printed`:r=on.includes(e.status);break;case`failed`:r=e.status===`failed`||e.status===`aborted`;break;case`duplicates`:r=e.duplicate_count>0;break}let i=(e.print_name||e.filename).toLowerCase().includes(f.toLowerCase()),a=!v||pt(e.filament_type).includes(v),o=e.filament_color?.split(`,`)||[],s=x.size===0||(w===`or`?o.some(e=>x.has(e)):[...x].every(e=>o.includes(e))),c=G===`favorites`||!O||e.is_favorite,l=G===`failed`||!A||e.status!==`failed`&&e.status!==`aborted`,u=!j||e.status===`completed`&&e.confirm_requested&&e.user_verdict==null,d=G===`duplicates`||!N||e.duplicate_count===0||e.duplicate_sequence===0,p=e.tags?.split(`,`).map(e=>e.trim())||[],m=!ae||p.includes(ae),h=tn(e);return r&&i&&a&&s&&c&&l&&u&&d&&m&&(F===`all`||F===`gcode`&&h||F===`source`&&!h)}).sort((e,t)=>{switch(He){case`date-desc`:return(be(t.created_at)?.getTime()||0)-(be(e.created_at)?.getTime()||0);case`date-asc`:return(be(e.created_at)?.getTime()||0)-(be(t.created_at)?.getTime()||0);case`name-asc`:return(e.print_name||e.filename).localeCompare(t.print_name||t.filename);case`name-desc`:return(t.print_name||t.filename).localeCompare(e.print_name||e.filename);case`size-desc`:return t.file_size-e.file_size;case`size-asc`:return e.file_size-t.file_size;default:return 0}}),Wn=Un?.length||0,Gn=Ye===-1,Kn=Gn?Wn||1:Ye,qn=Math.max(1,Math.ceil(Wn/Kn)),Jn=Gn?Un:Un?.slice(qe*Kn,(qe+1)*Kn);(0,X.useEffect)(()=>{if(J&&Un&&!Gn){let e=Un.findIndex(e=>e.id===J);if(e>=0){let t=Math.floor(e/Kn);t!==qe&&Je(t)}}},[J]);let Yn=De||I.size>0,Xn=e=>{R(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Zn=()=>{Un&&R(new Set(Un.map(e=>e.id)))},Qn=()=>{R(new Set),Ae(!1)},$n=e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},er=()=>{C(new Set)},tr=()=>{p(``),h(null),b(null),k(!1),te(!1),ne(!1),ie(!1),oe(null),ue(`all`)},nr=f||m||v||O||A||j||N||ae||F!==`all`,{isDraggingOver:rr,dragHandlers:ir}=ct({disabled:de,extensions:[`.3mf`],onFiles:e=>{he(e),fe(!0)},onRejected:()=>n(e(`archives.page.only3mfSupported`),`warning`)}),ar=(0,X.useCallback)(e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable){e.key===`Escape`&&t.blur();return}switch(e.key){case`/`:e.preventDefault(),u.current?.focus();break;case`u`:case`U`:!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),fe(!0));break;case`Escape`:Yn&&Qn();break}},[Yn]);return(0,X.useEffect)(()=>(document.addEventListener(`keydown`,ar),()=>document.removeEventListener(`keydown`,ar)),[ar]),(0,Z.jsxs)(`div`,{className:`p-4 md:p-8 relative`,...ir,children:[rr&&(0,Z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-bambu-dark/90 flex items-center justify-center pointer-events-none`,children:(0,Z.jsxs)(`div`,{className:`border-4 border-dashed border-bambu-green rounded-xl p-12 text-center`,children:[(0,Z.jsx)($e,{className:`w-16 h-16 mx-auto mb-4 text-bambu-green`}),(0,Z.jsx)(`p`,{className:`text-2xl font-semibold text-white mb-2`,children:e(`archives.page.dropFilesHere`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:e(`archives.releaseToUpload`)})]})}),Yn&&(0,Z.jsxs)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl px-4 py-3 flex items-center gap-4`,children:[(0,Z.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:Qn,children:[(0,Z.jsx)(L,{className:`w-4 h-4`}),`Close`]}),(0,Z.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,Z.jsxs)(`span`,{className:`text-white font-medium`,children:[I.size,` selected`]}),(0,Z.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,Z.jsx)(V,{variant:`secondary`,size:`sm`,onClick:Zn,children:`Select All`}),(0,Z.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,Z.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:()=>Ie(!0),disabled:!o(`archives:update_own`,`archives:update_all`),title:o(`archives:update_own`,`archives:update_all`)?void 0:e(`archives.permission.noUpdateArchives`),children:[(0,Z.jsx)(Re,{className:`w-4 h-4`}),`Tags`]}),(0,Z.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:()=>ze(!0),disabled:!o(`archives:update_own`,`archives:update_all`),title:o(`archives:update_own`,`archives:update_all`)?void 0:e(`archives.permission.noUpdateArchives`),children:[(0,Z.jsx)(ot,{className:`w-4 h-4`}),`Project`]}),(0,Z.jsxs)(V,{variant:`secondary`,size:`sm`,disabled:!o(`archives:update_own`,`archives:update_all`),title:o(`archives:update_own`,`archives:update_all`)?void 0:e(`archives.permission.noUpdateArchives`),onClick:()=>{let i=Array.from(I);Promise.all(i.map(e=>r.toggleFavorite(e))).then(()=>{t.invalidateQueries({queryKey:[`archives`]}),n(`Toggled favorites for ${i.length} archive${i.length===1?``:`s`}`)}).catch(()=>{n(e(`archives.toast.failedUpdateFavorites`),`error`)})},children:[(0,Z.jsx)(Ee,{className:`w-4 h-4`}),`Favorite`]}),(0,Z.jsxs)(V,{size:`sm`,className:`bg-red-500 hover:bg-red-600`,onClick:()=>Pe(!0),disabled:!o(`archives:delete_own`,`archives:delete_all`),title:o(`archives:delete_own`,`archives:delete_all`)?void 0:e(`archives.permission.noDelete`),children:[(0,Z.jsx)(U,{className:`w-4 h-4`}),`Delete`]})]}),H?.has_fallback&&!ge&&(0,Z.jsxs)(`div`,{className:`mb-6 rounded-lg border border-amber-300 dark:border-amber-500/30 bg-amber-50 dark:bg-amber-500/10 px-4 py-3 flex items-start gap-3`,children:[(0,Z.jsx)(y,{className:`w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-amber-900 dark:text-amber-200`,children:e(`archives.no3mfBanner.title${we}`)}),(0,Z.jsxs)(`div`,{className:`text-xs text-amber-800/90 dark:text-amber-200/80 mt-1`,children:[e(`archives.no3mfBanner.body${we}`),Te&&(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`a`,{href:Te,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-amber-900 dark:hover:text-amber-100 inline-flex items-center gap-1`,children:[e(H?.reason===`internal_storage`||H?.reason===`internal_history`||H?.reason===`ftps_cooloff`||H?.reason===`ftp_transfer_failed`?`archives.no3mfBanner.docsLinkInternalStorage`:`archives.no3mfBanner.docsLink`),(0,Z.jsx)(Ce,{className:`w-3 h-3`})]})]})]})]}),(0,Z.jsx)(`button`,{onClick:Se,className:`text-amber-800/70 dark:text-amber-200/60 hover:text-amber-900 dark:hover:text-amber-200 flex-shrink-0 p-1 -m-1`,title:e(`archives.no3mfBanner.dismissLabel`),"aria-label":e(`archives.no3mfBanner.dismissLabel`),children:(0,Z.jsx)(L,{className:`w-4 h-4`})})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,Z.jsx)(ke,{className:`w-7 h-7 text-bambu-green`}),`Archives`]}),(0,Z.jsxs)(`p`,{className:`text-bambu-gray mt-1`,children:[Un?.length||0,` of `,_n?.length||0,` prints`]})]}),(0,Z.jsx)(`select`,{className:`mt-0.5 px-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray-light text-sm focus:border-bambu-green focus:outline-none`,value:G,onChange:e=>Ke(e.target.value),children:sn.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.label},e.id))})]})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3 flex-wrap`,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsxs)(V,{variant:`secondary`,onClick:()=>tt(!et),disabled:nt,children:[nt?(0,Z.jsx)(P,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(ee,{className:`w-4 h-4`}),`Export`]}),et&&(0,Z.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20`,children:[(0,Z.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-t-lg`,onClick:async()=>{tt(!1),q(!0);try{let{blob:t,filename:i}=await r.exportArchives({format:`csv`,printerId:m||void 0,status:G===`failed`?`failed`:void 0,search:f||void 0}),a=URL.createObjectURL(t),o=document.createElement(`a`);o.href=a,o.download=i,o.click(),URL.revokeObjectURL(a),n(e(`archives.toast.exportDownloaded`))}catch{n(e(`archives.toast.exportFailed`),`error`)}finally{q(!1)}},children:[(0,Z.jsx)(rt,{className:`w-4 h-4`}),`Export as CSV`]}),(0,Z.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-b-lg`,onClick:async()=>{tt(!1),q(!0);try{let{blob:t,filename:i}=await r.exportArchives({format:`xlsx`,printerId:m||void 0,status:G===`failed`?`failed`:void 0,search:f||void 0}),a=URL.createObjectURL(t),o=document.createElement(`a`);o.href=a,o.download=i,o.click(),URL.revokeObjectURL(a),n(e(`archives.toast.exportDownloaded`))}catch{n(e(`archives.toast.exportFailed`),`error`)}finally{q(!1)}},children:[(0,Z.jsx)(ee,{className:`w-4 h-4`}),`Export as Excel`]})]})]}),I.size>=2&&I.size<=5&&(0,Z.jsxs)(V,{variant:`secondary`,onClick:()=>at(!0),children:[(0,Z.jsx)(re,{className:`w-4 h-4`}),`Compare (`,I.size,`)`]}),!Yn&&(0,Z.jsxs)(V,{variant:`secondary`,onClick:()=>Ae(!0),children:[(0,Z.jsx)(Be,{className:`w-4 h-4`}),`Select`]}),(0,Z.jsxs)(V,{onClick:()=>fe(!0),disabled:!i(`archives:create`),title:i(`archives:create`)?void 0:e(`archives.permission.noCreate`),children:[(0,Z.jsx)($e,{className:`w-4 h-4`}),`Upload 3MF`]}),i(`archives:purge`)&&(0,Z.jsxs)(V,{variant:`secondary`,onClick:()=>ht(!0),title:e(`archivePurge.headerTooltip`),children:[(0,Z.jsx)(U,{className:`w-4 h-4 mr-2`}),e(`archivePurge.headerButton`)]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center border border-bambu-dark-tertiary rounded-lg overflow-hidden flex-shrink-0 w-fit mb-4`,children:[(0,Z.jsx)(`button`,{className:`p-2 ${W===`grid`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>Ve(`grid`),title:e(`archives.gridView`),children:(0,Z.jsx)(se,{className:`w-4 h-4`})}),(0,Z.jsx)(`button`,{className:`p-2 ${W===`list`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>Ve(`list`),title:e(`archives.listView`),children:(0,Z.jsx)(ce,{className:`w-4 h-4`})}),(0,Z.jsx)(`button`,{className:`p-2 ${W===`calendar`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>Ve(`calendar`),title:e(`archives.calendarView`),children:(0,Z.jsx)(gt,{className:`w-4 h-4`})}),(0,Z.jsx)(`button`,{className:`p-2 ${W===`log`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>Ve(`log`),title:e(`archives.logView`),children:(0,Z.jsx)(_t,{className:`w-4 h-4`})})]}),W!==`log`&&(0,Z.jsx)(B,{className:`mb-6`,children:(0,Z.jsxs)(z,{className:`py-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-3 md:gap-4 md:items-center md:flex-wrap`,children:[(0,Z.jsxs)(`div`,{className:`w-full md:flex-1 relative md:min-w-[200px]`,children:[(0,Z.jsx)(pe,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{ref:u,type:`text`,placeholder:e(`archives.searchPlaceholder`),className:`w-full pl-10 pr-4 py-3 md:py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:f,onChange:e=>p(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2 md:gap-4 overflow-x-auto pb-1 md:pb-0 -mx-4 px-4 md:mx-0 md:px-0 md:flex-wrap scrollbar-hide`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Z.jsx)(M,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,Z.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:m||``,onChange:e=>h(e.target.value?Number(e.target.value):null),children:[(0,Z.jsx)(`option`,{value:``,children:`All Printers`}),yn?.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Z.jsx)(le,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,Z.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:v||``,onChange:e=>b(e.target.value||null),children:[(0,Z.jsx)(`option`,{value:``,children:`All Materials`}),Bn.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Z.jsx)(vt,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,Z.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:F,onChange:e=>ue(e.target.value),children:[(0,Z.jsx)(`option`,{value:`all`,children:`All Files`}),(0,Z.jsx)(`option`,{value:`gcode`,children:`Sliced (GCODE)`}),(0,Z.jsx)(`option`,{value:`source`,children:`Source Only`})]})]}),(0,Z.jsxs)(`button`,{onClick:()=>k(!O),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${O?`bg-yellow-100 dark:bg-yellow-500/20 border-yellow-500 text-yellow-700 dark:text-yellow-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(O?`archives.showAll`:`archives.showFavoritesOnly`),children:[(0,Z.jsx)(Ee,{className:`w-4 h-4 ${O?`fill-yellow-400`:``}`}),(0,Z.jsx)(`span`,{className:`text-sm hidden md:inline`,children:`Favorites`})]}),(0,Z.jsxs)(`button`,{onClick:()=>te(!A),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${A?`bg-red-100 dark:bg-red-500/20 border-red-500 text-red-700 dark:text-red-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(A?`archives.showFailedPrints`:`archives.hideFailedPrints`),children:[(0,Z.jsx)(y,{className:`w-4 h-4 `}),(0,Z.jsx)(`span`,{className:`text-sm hidden md:inline`,children:`Hide Failed`})]}),(0,Z.jsxs)(`button`,{onClick:()=>ne(!j),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${j?`bg-amber-100 dark:bg-amber-500/20 border-amber-500 text-amber-700 dark:text-amber-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(`archives.filterUnconfirmedTitle`),children:[(0,Z.jsx)(Qe,{className:`w-4 h-4`}),(0,Z.jsx)(`span`,{className:`text-sm hidden md:inline`,children:e(`archives.filterUnconfirmed`)})]}),(0,Z.jsxs)(`button`,{onClick:()=>ie(!N),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${N?`bg-purple-100 dark:bg-purple-500/20 border-purple-500 text-purple-700 dark:text-purple-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(`archives.hideDuplicates`),children:[(0,Z.jsx)(D,{className:`w-4 h-4`}),(0,Z.jsx)(`span`,{className:`text-sm hidden md:inline`,children:e(`archives.hideDuplicates`)})]}),Hn.length>0&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Z.jsx)(Re,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,Z.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:ae||``,onChange:e=>oe(e.target.value||null),children:[(0,Z.jsx)(`option`,{value:``,children:`All Tags`}),Hn.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]}),(0,Z.jsx)(`button`,{onClick:()=>ut(!0),className:`p-2 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-green transition-colors`,title:e(`archives.manageTags`),children:(0,Z.jsx)(We,{className:`w-4 h-4`})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Z.jsx)(d,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,Z.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:He,onChange:e=>Ue(e.target.value),children:[(0,Z.jsx)(`option`,{value:`date-desc`,children:e(`archives.sortNewest`)}),(0,Z.jsx)(`option`,{value:`date-asc`,children:e(`archives.sortOldest`)}),(0,Z.jsxs)(`option`,{value:`name-asc`,children:[e(`archives.sortName`),` A-Z`]}),(0,Z.jsxs)(`option`,{value:`name-desc`,children:[e(`archives.sortName`),` Z-A`]}),(0,Z.jsx)(`option`,{value:`size-desc`,children:e(`archives.sortLargest`)}),(0,Z.jsx)(`option`,{value:`size-asc`,children:e(`archives.sortSmallest`)})]})]})]}),nr&&(0,Z.jsxs)(V,{variant:`ghost`,size:`sm`,onClick:tr,className:`text-bambu-gray hover:text-white`,children:[(0,Z.jsx)(L,{className:`w-4 h-4`}),`Reset`]})]}),Vn.length>0&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`Colors:`}),x.size>1&&(0,Z.jsx)(`button`,{onClick:()=>T(e=>e===`or`?`and`:`or`),className:`px-2 py-0.5 text-xs rounded transition-colors ${w===`and`?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:w===`or`?`Match ANY selected color`:`Match ALL selected colors`,children:w.toUpperCase()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:Vn.map(e=>(0,Z.jsx)(`button`,{onClick:()=>$n(e),className:`w-6 h-6 rounded-full border-2 transition-all ${x.has(e)?`border-bambu-green scale-110`:`border-white/20 hover:border-white/40`}`,style:{backgroundColor:e},title:e},e))}),x.size>0&&(0,Z.jsxs)(`button`,{onClick:er,className:`text-xs text-bambu-gray hover:text-white flex items-center gap-1`,children:[(0,Z.jsx)(L,{className:`w-3 h-3`}),`Clear`]})]})]})}),(0,Z.jsx)(Wt,{}),vn?(0,Z.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`archives.loadingArchives`)}):Un?.length===0&&W!==`log`?(0,Z.jsx)(B,{children:(0,Z.jsxs)(z,{className:`text-center py-12`,children:[(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:e(f?`archives.noArchivesSearch`:`archives.noArchivesYet`)}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray mt-2`,children:`Archives are created automatically when prints complete`})]})}):W===`calendar`?(0,Z.jsx)(B,{className:`p-6`,children:(0,Z.jsx)(Nt,{archives:Un||[],onArchiveClick:e=>{p(``),Ve(`grid`),yt(e.id)},highlightedArchiveId:J})}):W===`grid`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6`,children:Jn?.map(t=>(0,Z.jsx)(rn,{archive:t,printerName:t.printer_id?zn.get(t.printer_id)||`Unknown`:t.sliced_for_model||`No Printer`,printerMap:zn,isSelected:I.has(t.id),onSelect:Xn,selectionMode:Yn,projects:bn,isHighlighted:t.id===J,timeFormat:Tn,preferredSlicer:En,useSlicerApi:Dn,currency:On,t:e,onNavigateToArchive:gn},t.id))}),(0,Z.jsx)(ln,{pageIndex:qe,pageSize:Ye,totalRows:Wn,totalPages:qn,onPageChange:Je,onPageSizeChange:e=>{Xe(e),Je(0)},t:e})]}):W===`list`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{children:(0,Z.jsxs)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-12 gap-4 px-4 py-3 text-xs text-bambu-gray font-medium`,children:[(0,Z.jsx)(`div`,{className:`col-span-1`}),(0,Z.jsx)(`div`,{className:`col-span-4`,children:`Name`}),(0,Z.jsx)(`div`,{className:`col-span-2`,children:`Printer`}),(0,Z.jsx)(`div`,{className:`col-span-2`,children:`Date`}),(0,Z.jsx)(`div`,{className:`col-span-1`,children:`Size`}),(0,Z.jsx)(`div`,{className:`col-span-2 text-right`,children:`Actions`})]}),Jn?.map(t=>(0,Z.jsx)(an,{archive:t,printerName:t.printer_id?zn.get(t.printer_id)||`Unknown`:t.sliced_for_model||`No Printer`,isSelected:I.has(t.id),onSelect:Xn,selectionMode:Yn,projects:bn,isHighlighted:t.id===J,preferredSlicer:En,useSlicerApi:Dn,t:e,onNavigateToArchive:gn},t.id))]})}),(0,Z.jsx)(ln,{pageIndex:qe,pageSize:Ye,totalRows:Wn,totalPages:qn,onPageChange:Je,onPageSizeChange:e=>{Xe(e),Je(0)},t:e})]}):W===`log`?(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(B,{children:(0,Z.jsx)(z,{className:`py-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-3 md:items-center md:flex-wrap`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 relative md:min-w-[200px]`,children:[(0,Z.jsx)(pe,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,placeholder:e(`archives.searchPlaceholder`),className:`w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:f,onChange:e=>{p(e.target.value),Q(0)}})]}),(0,Z.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:m||``,onChange:e=>{h(e.target.value?Number(e.target.value):null),Q(0)},children:[(0,Z.jsx)(`option`,{value:``,children:e(`archives.log.allPrinters`)}),yn?.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,Z.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:Y||``,onChange:e=>{St(e.target.value||null),Q(0)},children:[(0,Z.jsx)(`option`,{value:``,children:e(`archives.log.allUsers`)}),Sn?.map(e=>(0,Z.jsx)(`option`,{value:e.username,children:e.username},e.id))]}),(0,Z.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:wt||``,onChange:e=>{Et(e.target.value||null),Q(0)},children:[(0,Z.jsx)(`option`,{value:``,children:e(`archives.log.allStatuses`)}),(0,Z.jsx)(`option`,{value:`completed`,children:e(`archives.status.completed`)}),(0,Z.jsx)(`option`,{value:`failed`,children:e(`archives.status.failed`)}),(0,Z.jsx)(`option`,{value:`stopped`,children:e(`archives.status.stopped`)}),(0,Z.jsx)(`option`,{value:`cancelled`,children:e(`archives.log.cancelled`)}),(0,Z.jsx)(`option`,{value:`skipped`,children:e(`archives.log.skipped`)})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm text-bambu-gray`,children:e(`archives.log.dateFrom`)}),(0,Z.jsx)(`input`,{type:`date`,className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:kt,onChange:e=>{At(e.target.value),Q(0)}})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm text-bambu-gray`,children:e(`archives.log.dateTo`)}),(0,Z.jsx)(`input`,{type:`date`,className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:jt,onChange:e=>{Mt(e.target.value),Q(0)}})]}),(0,Z.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>fn(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-bambu-gray border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark-tertiary transition-colors`,title:e(`inventory.configureColumns`),children:[(0,Z.jsx)(E,{className:`w-4 h-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`archives.log.columns`)})]}),(0,Z.jsxs)(V,{variant:`danger`,size:`sm`,onClick:()=>It(!0),disabled:!i(`archives:delete_all`)||In.isPending,children:[(0,Z.jsx)(U,{className:`w-4 h-4`}),e(`archives.log.clearLog`)]})]})]})})}),(0,Z.jsx)(B,{children:wn?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Z.jsx)(P,{className:`w-6 h-6 animate-spin text-bambu-green`})}):Cn?.items.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Z.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary text-bambu-gray text-left`,children:[hn.map(t=>{let n=Zt.has(t),r=pn.column===t,i=e(qt[t]??t);return(0,Z.jsx)(`th`,{scope:`col`,"aria-sort":r?pn.direction===`asc`?`ascending`:`descending`:`none`,className:`px-4 py-3 font-medium ${Nn.has(t)?`text-right`:``}`,children:n?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>jn(t),className:`inline-flex items-center gap-1 font-medium transition-colors hover:text-bambu-green ${r?`text-bambu-green`:``}`,title:e(`archives.log.sortBy`,{column:i}),children:[i,r?pn.direction===`asc`?(0,Z.jsx)(_,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(g,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(d,{className:`w-3.5 h-3.5 opacity-30`})]}):i},t)}),(0,Z.jsx)(`th`,{className:`px-4 py-3 font-medium w-10`,"aria-label":e(`common.actions`)})]})}),(0,Z.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:Cn.items.map(t=>(0,Z.jsxs)(`tr`,{className:`hover:bg-bambu-dark-secondary/50`,children:[hn.map(e=>(0,Z.jsx)(`td`,{className:`px-4 py-3 ${Nn.has(e)?`text-right`:``}`,children:Pn(e,t)},e)),(0,Z.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,Z.jsxs)(`div`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{Vt(t),Ut(t.failure_reason||``),Xt(t.status)},disabled:Rn.isPending||!(i(`archives:update_all`)||i(`archives:update_own`)),title:i(`archives:update_all`)||i(`archives:update_own`)?e(`archives.log.editEntryTitle`):e(`archives.permission.noEdit`),className:`text-bambu-gray hover:text-bambu-blue disabled:opacity-40 disabled:hover:text-bambu-gray transition-colors`,children:(0,Z.jsx)(xe,{className:`w-4 h-4`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>Rt(t.id),disabled:Ln.isPending||!(i(`archives:delete_all`)||i(`archives:delete_own`)),title:i(`archives:delete_all`)||i(`archives:delete_own`)?e(`archives.log.deleteEntryTitle`):e(`archives.permission.noDelete`),className:`text-bambu-gray hover:text-red-600 dark:hover:text-red-400 disabled:opacity-40 disabled:hover:text-bambu-gray transition-colors`,children:(0,Z.jsx)(U,{className:`w-4 h-4`})})]})})]},t.id))})]})}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-t border-bambu-dark-tertiary flex-wrap gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`archives.log.showing`,{count:Math.min(Pt+$,Cn.total),total:Cn.total})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:e(`archives.log.rowsPerPage`)}),(0,Z.jsxs)(`select`,{className:`px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-xs focus:border-bambu-green focus:outline-none`,value:$,onChange:e=>{nn(Number(e.target.value)),Q(0)},children:[(0,Z.jsx)(`option`,{value:10,children:`10`}),(0,Z.jsx)(`option`,{value:25,children:`25`}),(0,Z.jsx)(`option`,{value:50,children:`50`}),(0,Z.jsx)(`option`,{value:100,children:`100`})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[e(`archives.log.page`),` `,Math.floor(Pt/$)+1,` / `,Math.max(1,Math.ceil(Cn.total/$))]}),(0,Z.jsx)(V,{variant:`secondary`,size:`sm`,onClick:()=>Q(Math.max(0,Pt-$)),disabled:Pt===0,children:(0,Z.jsx)(Ze,{className:`w-4 h-4`})}),(0,Z.jsx)(V,{variant:`secondary`,size:`sm`,onClick:()=>Q(Pt+$),disabled:Pt+$>=Cn.total,children:(0,Z.jsx)(Me,{className:`w-4 h-4`})})]})]})]}):(0,Z.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`archives.log.noEntries`)})})]}):null,de&&(0,Z.jsx)(Ct,{onClose:()=>{fe(!1),he([])},initialFiles:me}),dt&&(0,Z.jsx)(Tt,{onClose:()=>ht(!1)}),Ne&&(0,Z.jsx)(K,{title:e(`archives.modal.deleteArchives`),message:e(`archives.modal.deleteArchivesConfirm`,{count:I.size}),confirmText:e(`archives.modal.deleteCount`,{count:I.size}),variant:`danger`,onConfirm:()=>{Fn.mutate(Array.from(I)),Pe(!1)},onCancel:()=>Pe(!1)}),Fe&&(0,Z.jsx)(Dt,{selectedIds:Array.from(I),existingTags:Hn,onClose:()=>Ie(!1)}),Le&&(0,Z.jsx)(Ot,{selectedIds:Array.from(I),onClose:()=>ze(!1)}),it&&I.size>=2&&I.size<=5&&(0,Z.jsx)(Bt,{archiveIds:Array.from(I),onClose:()=>{at(!1),R(new Set),Ae(!1)}}),lt&&(0,Z.jsx)(Gt,{onClose:()=>ut(!1)}),(0,Z.jsx)(mt,{isOpen:dn,onClose:()=>fn(!1),columns:kn,defaultColumns:An,onSave:Mn}),Ft&&(0,Z.jsx)(K,{title:e(`archives.log.clearLogTitle`),message:e(`archives.log.clearLogConfirm`),confirmText:e(`archives.log.clearLogButton`),variant:`danger`,onConfirm:()=>{In.mutate(),It(!1)},onCancel:()=>It(!1)}),Lt!==null&&(0,Z.jsx)(K,{title:e(`archives.log.deleteEntryTitle`),message:e(`archives.log.deleteEntryConfirm`),confirmText:e(`common.delete`),variant:`danger`,onConfirm:()=>{Ln.mutate(Lt),Rt(null)},onCancel:()=>Rt(null)}),zt!==null&&(0,Z.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:()=>Vt(null),children:(0,Z.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg w-full max-w-md mx-4 p-6`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-4`,children:e(`archives.log.editEntryTitle`)}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mb-4`,children:e(`archives.log.editEntryDescription`)}),(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`editArchive.status`)}),(0,Z.jsxs)(`select`,{value:Kt,onChange:e=>Xt(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:`completed`,children:e(`archives.log.statuses.completed`,{defaultValue:`completed`})}),(0,Z.jsx)(`option`,{value:`failed`,children:e(`archives.log.statuses.failed`,{defaultValue:`failed`})}),(0,Z.jsx)(`option`,{value:`stopped`,children:e(`archives.log.statuses.stopped`,{defaultValue:`stopped`})}),(0,Z.jsx)(`option`,{value:`cancelled`,children:e(`archives.log.statuses.cancelled`,{defaultValue:`cancelled`})}),(0,Z.jsx)(`option`,{value:`skipped`,children:e(`archives.log.statuses.skipped`,{defaultValue:`skipped`})})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`editArchive.failureReason`)}),(0,Z.jsxs)(`select`,{value:Ht,onChange:e=>Ut(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:``,children:e(`editArchive.selectReason`)}),je.map(t=>(0,Z.jsx)(`option`,{value:t,children:e(`editArchive.failureReasons.${t}`)},t))]})]})]}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 mt-6`,children:[(0,Z.jsx)(V,{variant:`secondary`,onClick:()=>Vt(null),children:e(`common.cancel`)}),(0,Z.jsx)(V,{variant:`primary`,onClick:()=>{let e={};if(Ht!==(zt.failure_reason||``)&&(e.failure_reason=Ht||null),Kt!==zt.status&&(e.status=Kt),Object.keys(e).length===0){Vt(null);return}Rn.mutate({id:zt.id,body:e})},disabled:Rn.isPending,children:Rn.isPending?e(`editArchive.saving`):e(`common.save`)})]})]})})]})}function ln({pageIndex:e,pageSize:t,totalRows:n,totalPages:r,onPageChange:i,onPageSizeChange:a,t:o}){let s=t===-1;if(r<=1&&!s)return null;let c=s?n||1:t;return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between pt-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:s?`${n} ${o(`archives.prints`)}`:(0,Z.jsxs)(Z.Fragment,{children:[o(`archives.pagination.showing`),` `,e*c+1,` `,o(`archives.pagination.to`),` `,Math.min((e+1)*c,n),` `,o(`archives.pagination.of`),` `,n,` `,o(`archives.prints`)]})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:o(`archives.pagination.show`)}),(0,Z.jsxs)(`select`,{value:t,onChange:e=>a(Number(e.target.value)),className:`px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:border-bambu-green`,children:[[25,50,100,200].map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e)),(0,Z.jsx)(`option`,{value:-1,children:o(`archives.pagination.all`)})]}),!s&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{onClick:()=>i(0),disabled:e===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Z.jsx)(b,{className:`w-4 h-4`})}),(0,Z.jsx)(`button`,{onClick:()=>i(Math.max(0,e-1)),disabled:e===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Z.jsx)(Ze,{className:`w-4 h-4`})}),(0,Z.jsxs)(`span`,{className:`text-bambu-gray px-2 whitespace-nowrap`,children:[o(`archives.pagination.page`),` `,e+1,` `,o(`archives.pagination.of`),` `,r]}),(0,Z.jsx)(`button`,{onClick:()=>i(Math.min(r-1,e+1)),disabled:e>=r-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Z.jsx)(Me,{className:`w-4 h-4`})}),(0,Z.jsx)(`button`,{onClick:()=>i(r-1),disabled:e>=r-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Z.jsx)(x,{className:`w-4 h-4`})})]})]})]})}export{cn as ArchivesPage}; \ No newline at end of file diff --git a/static/assets/AreaChart-DJpIJXxF.js b/static/assets/AreaChart-DJpIJXxF.js new file mode 100644 index 000000000..9756d8863 --- /dev/null +++ b/static/assets/AreaChart-DJpIJXxF.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{D as t}from"./client-DnySrlFv.js";import{At as n,B as r,Bt as i,Cn as a,D as o,En as s,Fn as c,It as l,Kt as u,Ln as d,Lt as f,M as p,Mn as m,On as h,Pn as g,R as _,Rt as v,S as y,Sn as b,St as x,T as S,Tt as C,Ut as w,Wt as T,Zt as E,an as D,at as O,b as k,cn as A,d as j,dn as M,f as ee,ft as N,gn as te,j as ne,k as re,l as ie,ln as ae,mn as P,mt as oe,nn as F,on as se,pt as I,sn as L,t as ce,u as le,vn as R,w as ue,wn as de,x as fe,y as z,yt as pe,z as me}from"./CartesianChart-BAcHzPFb.js";function B(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function V(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var H=(e,t,n)=>O(e,`xAxis`,B(e,t),n),U=(e,t,n)=>I(e,`xAxis`,B(e,t),n),W=(e,t,n)=>O(e,`yAxis`,V(e,t),n),G=(e,t,n)=>I(e,`yAxis`,V(e,t),n),he=P([w,H,W,U,G],(e,t,n,r,i)=>ae(e,`xAxis`)?F(t,r,!1):F(n,i,!1)),K=P([oe,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),q=e=>ae(w(e),`xAxis`)?`yAxis`:`xAxis`,ge=(e,t)=>q(e)===`yAxis`?V(e,t):B(e,t),_e=P([w,H,W,U,G,P([K,(e,t,n)=>N(e,q(e),ge(e,t),n)],(e,t)=>{if(!(e==null||t==null)){var{stackId:n}=e,r=pe(e);if(!(n==null||r==null)){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),n,he,K,C],(e,t,n,r,i,a,o,s,c,l)=>{var{chartData:u,dataStartIndex:d,dataEndIndex:f}=o;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var{data:p}=c,m=p&&p.length>0?p:u?.slice(d,f+1);if(m!=null)return Re({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:d,areaSettings:c,stackedData:a,displayedData:m,chartBaseValue:l,bandSize:s})}}),J=e(t()),ve=[`id`],ye=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:$(r,i),value:L(n,t),payload:e}]},Te=J.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:s,hide:c,unit:l,tooltipType:u,id:d}=e,f={dataDefinedOnItem:n,getPosition:h,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:L(s,t),hide:c,type:u,color:$(r,a),unit:l,graphicalItemId:d}};return J.createElement(o,{tooltipEntrySettings:f})});function Ee(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=c(r);return J.createElement(fe,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function De(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Q(Q({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return J.createElement(ne,{value:t?i:void 0},n)}function Oe(e){var{points:t,baseLine:n,needClip:r,clipPathId:a,props:o}=e,{layout:s,type:l,stroke:u,connectNulls:d,isRange:f}=o,{id:p}=o,h=X(o,ve),_=c(h),v=g(h);return J.createElement(J.Fragment,null,t?.length>1&&J.createElement(m,{clipPath:r?`url(#clipPath-${a})`:void 0},J.createElement(i,Y({},v,{id:p,points:t,connectNulls:d,type:l,baseLine:n,layout:s,stroke:`none`,className:`recharts-area-area`})),u!==`none`&&J.createElement(i,Y({},_,{className:`recharts-area-curve`,layout:s,type:l,connectNulls:d,fill:`none`,points:t})),u!==`none`&&f&&J.createElement(i,Y({},_,{className:`recharts-area-curve`,layout:s,type:l,connectNulls:d,fill:`none`,points:n}))),J.createElement(Ee,{points:t,props:h,clipPathId:a}))}function ke(e){var{alpha:t,baseLine:n,points:r,strokeWidth:i}=e,a=r[0]?.y,o=r[r.length-1]?.y;if(!M(a)||!M(o))return null;var c=t*Math.abs(a-o),l=Math.max(...r.map(e=>e.x||0));return s(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(e=>e.x||0),l)),s(l)?J.createElement(`rect`,{x:0,y:ae.y||0));return s(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(e=>e.y||0),l)),s(l)?J.createElement(`rect`,{x:a({points:c,baseLine:u}),[c,u]),`recharts-area-`),S=T(),[C,w]=(0,J.useState)(!1),E=!C,D=(0,J.useCallback)(()=>{typeof y==`function`&&y(),w(!1)},[y]),O=(0,J.useCallback)(()=>{typeof v==`function`&&v(),w(!0)},[v]);if(S==null)return null;var k=i.current,A=o.current;return J.createElement(De,{showLabels:E,points:c},r.children,J.createElement(f,{animationId:x,begin:h,duration:g,isActive:d,easing:_,onAnimationEnd:D,onAnimationStart:O,key:x},e=>{if(k){var l=k.length/c.length,f=e===1?c:c.map((t,n)=>{var r=Math.floor(n*l);if(k[r]){var i=k[r];return Q(Q({},t),{},{x:b(i.x,t.x,e),y:b(i.y,t.y,e)})}return t}),p=s(u)?b(A,u,e):de(u)||a(u)?b(A,0,e):u.map((t,n)=>{var r=Math.floor(n*l);if(Array.isArray(A)&&A[r]){var i=A[r];return Q(Q({},t),{},{x:b(i.x,t.x,e),y:b(i.y,t.y,e)})}return t});return e>0&&(i.current=f,o.current=p),J.createElement(Oe,{points:f,baseLine:p,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=c,o.current=u),J.createElement(m,null,d&&J.createElement(`defs`,null,J.createElement(`clipPath`,{id:`animationClipPath-${n}`},J.createElement(je,{alpha:e,points:c,baseLine:u,layout:S,strokeWidth:r.strokeWidth}))),J.createElement(m,{clipPath:`url(#animationClipPath-${n})`},J.createElement(Oe,{points:c,baseLine:u,needClip:t,clipPathId:n,props:r})))}),J.createElement(p,{label:r.label}))}function Ne(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,J.useRef)(null),a=(0,J.useRef)();return J.createElement(Me,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var Pe=class extends J.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:s,yAxisId:c,width:l,height:u,id:f,baseLine:p,zIndex:h}=this.props;if(e)return null;var g=d(`recharts-area`,r),_=f,{r:v,strokeWidth:y}=le(t),b=re(t),x=v*2+y,S=o?`url(#clipPath-${b?``:`dots-`}${_})`:void 0;return J.createElement(me,{zIndex:h},J.createElement(m,{className:g},o&&J.createElement(`defs`,null,J.createElement(j,{clipPathId:_,xAxisId:s,yAxisId:c}),!b&&J.createElement(`clipPath`,{id:`clipPath-dots-${_}`},J.createElement(`rect`,{x:a-x/2,y:i-x/2,width:l+x,height:u+x}))),J.createElement(Ne,{needClip:o,clipPathId:_,props:this.props})),J.createElement(z,{points:n,mainColor:$(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}),this.props.isRange&&Array.isArray(p)&&J.createElement(z,{points:p,mainColor:$(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}))}},Fe={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,xAxisId:0,yAxisId:0,zIndex:x.area};function Ie(e){var t=R(e,Fe),{activeDot:n,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:c,fill:l,fillOpacity:d,hide:f,isAnimationActive:p,legendType:m,stroke:h,xAxisId:g,yAxisId:_}=t,y=X(t,ye),b=u(),x=r(),{needClip:S}=ee(g,_),C=E(),{points:w,isRange:T,baseLine:D}=te(t=>_e(t,e.id,C))??{},O=k();if(b!==`horizontal`&&b!==`vertical`||O==null||x!==`AreaChart`&&x!==`ComposedChart`)return null;var{height:A,width:j,x:M,y:N}=O;return!w||!w.length?null:J.createElement(Pe,Y({},y,{activeDot:n,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:D,connectNulls:s,dot:c,fill:l,fillOpacity:d,height:A,hide:f,layout:b,isAnimationActive:p===`auto`?!v.isSsr:p,isRange:T,legendType:m,needClip:S,points:w,stroke:h,width:j,left:M,top:N,xAxisId:g,yAxisId:_}))}var Le=(e,t,n,r,i)=>{var a=n??t;if(s(a))return a;var o=e===`horizontal`?i:r,c=o.scale.domain();if(o.type===`number`){var l=Math.max(c[0],c[1]),u=Math.min(c[0],c[1]);return a===`dataMin`?u:a===`dataMax`||l<0?l:Math.max(Math.min(c[0],c[1]),0)}return a===`dataMin`?c[0]:a===`dataMax`?c[1]:c[0]};function Re(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:s,yAxis:c,displayedData:l,dataStartIndex:u,xAxisTicks:d,yAxisTicks:f,bandSize:p}=e,m=i&&i.length,h=Le(a,o,n,s,c),g=a===`horizontal`,_=!1,v=l.map((e,n)=>{var a;if(m)a=i[u+n];else{var o=A(e,r);Array.isArray(o)?(a=o,_=!0):a=[h,o]}var l=a?.[1]??null,v=l==null||m&&!t&&A(e,r)==null;return g?{x:D({axis:s,ticks:d,bandSize:p,entry:e,index:n}),y:v?null:c.scale.map(l)??null,value:a,payload:e}:{x:v?null:s.scale.map(l)??null,y:D({axis:c,ticks:f,bandSize:p,entry:e,index:n}),value:a,payload:e}});return{points:v,baseLine:(m||_?v.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:t!=null&&e.y!=null?c.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:s.scale.map(t)??null,y:e.y,payload:e.payload}}):g?c.scale.map(h):s.scale.map(h))??0,isRange:_}}function ze(e){var t=R(e,Fe),n=E();return J.createElement(ue,{id:t.id,type:`area`},e=>J.createElement(J.Fragment,null,J.createElement(S,{legendPayload:we(t)}),J.createElement(Te,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),J.createElement(y,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:se(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),J.createElement(Ie,Y({},t,{id:e}))))}var Be=J.memo(ze,ie);Be.displayName=`Area`;var Ve=[`axis`],He=(0,J.forwardRef)((e,t)=>J.createElement(ce,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Ve,tooltipPayloadSearcher:_,categoricalChartProps:e,ref:t}));export{V as i,Be as n,B as r,He as t}; \ No newline at end of file diff --git a/static/assets/AssignToAmsModal-DOax3BGf.js b/static/assets/AssignToAmsModal-DOax3BGf.js new file mode 100644 index 000000000..8d2543c03 --- /dev/null +++ b/static/assets/AssignToAmsModal-DOax3BGf.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{t as c}from"./check-Ck0cMLU4.js";import{n as l}from"./info-ROUoQhJR.js";import{r as ee}from"./ToastContext-BRX0SW3C.js";import{t as u}from"./loader-circle-BEmFtawu.js";import{t as te}from"./x-DR-Trv6U.js";import{K as ne,_t as re,cn as ie,ft as ae,lt as oe}from"./index-CovRLYqQ.js";import{r as se,t as ce}from"./AmsUnitCard-CRqkD3Lg.js";import{n as le}from"./spoolPaint-CrvpHqdD.js";var d=e(n(),1),f=t();function p(e){return e<=3?`AMS ${String.fromCharCode(65+e)}`:e>=128&&e<=135?`AMS HT ${String.fromCharCode(65+e-128)}`:`AMS ${e}`}function m(e){return!e.tray_type||e.tray_type===``}function ue(e){return e?`#${e.slice(0,6)}`:`#808080`}var h=[`a[href]`,`button:not([disabled])`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function de(e){return Array.from(e.querySelectorAll(h)).filter(e=>!e.hasAttribute(`hidden`)&&e.getAttribute(`aria-hidden`)!==`true`)}var g=e=>(e??``).trim().toUpperCase();function fe(e,t){let n=g(e),r=g(t);return!n||!r?`none`:n===r?`exact`:r.includes(n)||n.includes(r)?`partial`:`none`}function pe(e,t){let n=g(e),r=g(t);return!n||!r?!1:n===r}function _({isOpen:e,onClose:t,spool:n,printerId:h,variant:g=`dialog`,spoolmanMode:_=!1}){let{t:v}=i(),y=a(),b=(0,d.useRef)(null),[me,he]=(0,d.useState)(h),[x,S]=(0,d.useState)(null),[ge,C]=(0,d.useState)(null),[w,T]=(0,d.useState)(null),[E,D]=(0,d.useState)(!1),[O,k]=(0,d.useState)(null),[A,j]=(0,d.useState)(null);(0,d.useEffect)(()=>{e&&(he(h),S(null),C(null),T(null),D(!1),k(null),j(null))},[e,h,n.id]);let M=h===null,N=M,P=h??me,{data:_e=[],isLoading:ve}=o({queryKey:[`printers`],queryFn:()=>r.getPrinters(),enabled:e&&M}),ye=(0,d.useMemo)(()=>_e.filter(e=>e.is_active!==!1),[_e]);(0,d.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow,n=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow=`hidden`;let r=b.current;return((r?de(r)[0]:null)??r)?.focus(),()=>{document.body.style.overflow=t,n?.isConnected&&n.focus()}},[e]);let F=(0,d.useCallback)(e=>{if(E)return;if(e.key===`Escape`){e.preventDefault(),t();return}if(e.key!==`Tab`)return;let n=b.current;if(!n)return;let r=de(n);if(r.length===0){e.preventDefault(),n.focus();return}let i=r[0],a=r[r.length-1],o=document.activeElement;e.shiftKey&&(o===i||!n.contains(o))?(e.preventDefault(),a.focus()):!e.shiftKey&&(o===a||!n.contains(o))&&(e.preventDefault(),i.focus())},[t,E]);(0,d.useEffect)(()=>{if(e)return document.addEventListener(`keydown`,F),()=>document.removeEventListener(`keydown`,F)},[e,F]);let{data:I,isLoading:be}=o({queryKey:[`printerStatus`,P],queryFn:()=>r.getPrinterStatus(P),enabled:e&&P!==null,refetchInterval:5e3}),{data:xe}=o({queryKey:[`printer`,P],queryFn:()=>r.getPrinter(P),enabled:e&&P!==null}),{data:L}=o({queryKey:[`settings`],queryFn:()=>r.getSettings(),enabled:e,staleTime:300*1e3}),{data:R}=o({queryKey:[`spool-assignments`,P],queryFn:()=>r.getAssignments(P),enabled:e&&P!==null,staleTime:30*1e3}),{data:Se=[]}=o({queryKey:[`spoolman-slot-assignments`,P],queryFn:()=>r.getSpoolmanSlotAssignments(P??void 0),enabled:e&&!!_&&P!==null,staleTime:30*1e3}),z=_?Se.find(e=>e.spoolman_spool_id===n.id):void 0,B=(0,d.useMemo)(()=>{let e={};if(!R)return e;for(let t of R){let n=t.spool;if(n&&n.label_weight>0&&n.weight_used!=null){let r=Math.round(Math.max(0,n.label_weight-n.weight_used)/n.label_weight*100);e[`${t.ams_id}-${t.tray_id}`]=r}}return e},[R]),Ce=L?{humidityGood:Number(L.ams_humidity_good)||40,humidityFair:Number(L.ams_humidity_fair)||60,tempGood:Number(L.ams_temp_good)||28,tempFair:Number(L.ams_temp_fair)||35}:void 0,we=I?.connected??!1,V=(0,d.useMemo)(()=>I?.ams??[],[I?.ams]),Te=(0,d.useMemo)(()=>V.filter(e=>!e.is_ams_ht),[V]),H=(0,d.useMemo)(()=>V.filter(e=>e.is_ams_ht),[V]),U=(0,d.useMemo)(()=>[...I?.vt_tray??[]].sort((e,t)=>(e.id??254)-(t.id??254)),[I?.vt_tray]),W=xe?.nozzle_count===2||I?.temperatures?.nozzle_2!==void 0,G=(0,d.useRef)({});(0,d.useEffect)(()=>{G.current={}},[P]),(0,d.useEffect)(()=>{I?.ams_extruder_map&&Object.keys(I.ams_extruder_map).length>0&&(G.current=I.ams_extruder_map)},[I?.ams_extruder_map]);let Ee=I?.ams_extruder_map&&Object.keys(I.ams_extruder_map).length>0?I.ams_extruder_map:G.current,K=I?.fila_switch?.installed===!0,q=(0,d.useCallback)(e=>{if(!W)return null;let t=Ee[String(e)];return t===void 0?K?null:(e>=128?e-128:e)===1?`L`:`R`:t===1?`L`:`R`},[W,Ee,K]),J=s({mutationFn:async({amsId:e,trayId:t})=>{if(!P)throw Error(`No printer selected`);return _?await r.assignSpoolmanSlot({spoolman_spool_id:n.id,printer_id:P,ams_id:e,tray_id:t}):await r.assignSpool({spool_id:n.id,printer_id:P,ams_id:e,tray_id:t})},onSuccess:e=>{T(`success`);let n=e&&`pending_config`in e&&e.pending_config;C(n?v(`spoolbuddy.modal.assignPendingInsert`,`Assigned. Slot will configure when you insert the spool.`):v(`spoolbuddy.modal.assignSuccess`,`Assigned!`)),y.invalidateQueries({queryKey:[`slotPresets`]}),y.invalidateQueries({queryKey:[`spool-assignments`]}),y.invalidateQueries({queryKey:[`spoolman-slot-assignments`]}),y.invalidateQueries({queryKey:[`spoolman-slot-assignments-all`]}),y.invalidateQueries({queryKey:[`inventory-spools`]}),y.invalidateQueries({queryKey:[`spoolman-inventory-spools`]}),setTimeout(()=>t(),n?2500:1500)},onError:e=>{T(`error`),C(e instanceof Error?e.message:v(`spoolbuddy.modal.assignError`,`Failed to assign spool.`))}}),Y=J.isPending,De=(0,d.useCallback)((e,t)=>{if(e===254||e===255){let n=e===254?254:254+t;return U.find(e=>(e.id??254)===n)||null}return V.find(t=>t.id===e)?.tray?.find(e=>e.id===t)||null},[V,U]),X=(0,d.useCallback)((e,t)=>e<=3?`${p(e)} ${v(`ams.slot`,`Slot`)} ${t+1}`:e>=128&&e<=135?p(e):W?e===254||e===255&&t===0?v(`printers.extL`,`Ext-L`):v(`printers.extR`,`Ext-R`):v(`printers.ext`,`Ext`),[v,W]),Z=(0,d.useCallback)((e,t)=>{T(`info`),C(v(`spoolbuddy.modal.assigning`,`Configuring slot...`)),J.mutate({amsId:e,trayId:t})},[J,v]),Q=(0,d.useCallback)((e,t)=>{if(!Y){if(!L?.disable_filament_warnings){let r=De(e,t);if(r&&!m(r)){let i=r.tray_sub_brands||r.tray_type||``,a=fe(n.material,i),o=n.slicer_filament_name||n.slicer_filament,s=r.tray_type||``,c=pe(o,s);if(a!==`exact`){let r;r=a===`none`&&!c?`material_profile`:a===`partial`&&!c?`partial_profile`:a===`none`?`material`:`partial`;let l=X(e,t);j({amsId:e,trayId:t}),k({type:r,spoolMaterial:n.material||``,trayMaterial:i||``,spoolProfile:o||void 0,trayProfile:s||void 0,location:l}),D(!0);return}}}Z(e,t)}},[Y,L?.disable_filament_warnings,n,De,X,Z]),Oe=(0,d.useCallback)((e,t)=>{if(!Y){if(N){S({amsId:e,trayId:t}),C(null),T(null);return}Q(e,t)}},[N,Y,Q]),ke=(0,d.useCallback)(()=>{x&&Q(x.amsId,x.trayId)},[Q,x]),Ae=(0,d.useCallback)(()=>{A&&(D(!1),k(null),Z(A.amsId,A.trayId),j(null))},[A,Z]),je=(0,d.useMemo)(()=>{let e=[];for(let t of H){let n=t.tray?.[0]||{id:0,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},r=B[`${t.id}-0`]??null,i=n.remain!=null&&n.remain>=0?n.remain:null,a=r===0&&i!==null&&i>0?null:r;e.push({key:`ht-${t.id}`,label:p(t.id),amsId:t.id,trayId:0,tray:n,isEmpty:m(n),nozzleSide:q(t.id),effectiveFill:a??i})}for(let t of U){let n=t.id??254,r=n-254,i=B[`255-${r}`]??null,a=t.remain!=null&&t.remain>=0?t.remain:null,o=i===0&&a!==null&&a>0?null:i;e.push({key:`ext-${n}`,label:W?n===254?v(`printers.extL`,`Ext-L`):v(`printers.extR`,`Ext-R`):v(`printers.ext`,`Ext`),amsId:255,trayId:r,tray:t,isEmpty:m(t),nozzleSide:W?n===254?`L`:`R`:null,effectiveFill:o??a})}return e},[H,U,W,v,q,B]);if(!e)return null;let Me=le(n)??oe(n.rgba),Ne=x?X(x.amsId,x.trayId):null,$=g===`dialog`;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:$?`fixed inset-0 z-[60] flex items-center justify-center bg-black/45 dark:bg-black/70 p-2 sm:p-4 backdrop-blur-sm animate-fade-in`:`fixed inset-0 z-[60] bg-bambu-dark`,onClick:$&&!Y?t:void 0,children:(0,f.jsxs)(`div`,{ref:b,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`assign-to-ams-title`,tabIndex:-1,className:$?`bg-bambu-dark-secondary text-white font-sans w-full max-w-3xl h-[calc(100vh-1rem)] sm:h-[calc(100vh-2rem)] max-h-[820px] border border-[var(--border-color)] rounded-xl sm:rounded-2xl shadow-2xl flex flex-col overflow-hidden animate-slide-up`:`w-full h-full bg-bambu-dark flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between bg-bambu-dark-secondary px-5 py-3 border-b border-[var(--border-color)] shrink-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,f.jsx)(`div`,{className:`w-7 h-7 rounded-full shrink-0`,style:Me}),(0,f.jsx)(`div`,{className:`min-w-0`,children:(0,f.jsxs)(`h2`,{id:`assign-to-ams-title`,className:`text-sm font-semibold text-white truncate`,children:[v(`spoolbuddy.modal.assignToAmsTitle`,`Assign to AMS`),(0,f.jsxs)(`span`,{className:`font-normal text-bambu-gray-light ml-2`,children:[ae(n.color_name,n.rgba,n.color_name_is_synthesized)||v(`spoolbuddy.spool.unknownColor`),` • `,n.brand,` `,n.material,n.subtype&&` ${n.subtype}`]}),(0,f.jsxs)(`span`,{className:`text-[10px] font-mono text-bambu-gray ml-2 shrink-0`,children:[`#`,n.id]})]})})]}),(0,f.jsx)(`button`,{onClick:t,disabled:Y,"aria-label":v(`common.close`,`Close`),className:`p-2 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary transition-colors shrink-0 disabled:opacity-50`,children:(0,f.jsx)(te,{className:`w-5 h-5`})})]}),M&&(0,f.jsxs)(`div`,{className:`bg-bambu-dark-secondary px-5 py-3 border-b border-[var(--border-color)] shrink-0`,children:[(0,f.jsxs)(`label`,{htmlFor:`assign-spool-printer`,className:`flex items-center gap-2 text-sm font-medium text-white mb-2`,children:[(0,f.jsx)(`span`,{className:`inline-flex h-5 w-5 items-center justify-center rounded-full bg-bambu-green text-[11px] font-bold text-[#ffffff]`,children:`1`}),v(`printModal.selectPrinter`)]}),(0,f.jsxs)(`select`,{id:`assign-spool-printer`,"aria-label":v(`printModal.selectPrinter`),value:me??``,onChange:e=>{he(e.target.value?Number(e.target.value):null),S(null),C(null),T(null)},disabled:Y||ve,className:`w-full bg-bambu-dark border border-[var(--border-color)] rounded-lg px-3 py-2.5 text-sm text-white focus:outline-none focus:border-bambu-green disabled:opacity-50`,children:[(0,f.jsx)(`option`,{value:``,children:ve?v(`common.loading`):ye.length===0?v(`common.noPrinters`):v(`printModal.selectPrinter`)}),ye.map(e=>(0,f.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),ge&&(0,f.jsxs)(`div`,{className:`mx-5 mt-3 p-3 rounded-lg flex items-center gap-3 border shrink-0 ${w===`info`?`bg-blue-50 border-blue-300 dark:bg-blue-500/10 dark:border-blue-500/40`:w===`success`?`bg-green-50 border-green-300 dark:bg-green-500/10 dark:border-green-500/40`:`bg-red-50 border-red-300 dark:bg-red-500/10 dark:border-red-500/40`}`,children:[w===`info`&&(0,f.jsx)(u,{className:`w-4 h-4 text-blue-600 dark:text-blue-400 animate-spin shrink-0`}),w===`success`&&(0,f.jsx)(ee,{className:`w-4 h-4 text-green-600 dark:text-green-400 shrink-0`}),w===`error`&&(0,f.jsx)(l,{className:`w-4 h-4 text-red-600 dark:text-red-400 shrink-0`}),(0,f.jsx)(`span`,{className:`text-sm ${w===`info`?`text-blue-700 dark:text-blue-300`:w===`success`?`text-green-700 dark:text-green-300`:`text-red-700 dark:text-red-300`}`,children:ge})]}),(0,f.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,f.jsxs)(`section`,{className:`flex min-h-[18rem] flex-col gap-3 bg-bambu-dark p-4 lg:min-h-0 lg:overflow-y-auto`,children:[M&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-white shrink-0`,children:[(0,f.jsx)(`span`,{className:`inline-flex h-5 w-5 items-center justify-center rounded-full bg-bambu-green text-[11px] font-bold text-[#ffffff]`,children:`2`}),v(`printModal.selectSlot`)]}),P?be?(0,f.jsxs)(`div`,{className:`flex flex-1 items-center justify-center text-bambu-gray-light`,children:[(0,f.jsx)(u,{className:`mr-2 h-5 w-5 animate-spin text-bambu-green`}),v(`common.loading`)]}):we?V.length===0&&U.length===0?(0,f.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-xl border border-dashed border-[var(--border-color)] bg-bambu-dark-secondary p-8`,children:(0,f.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,f.jsx)(ie,{className:`w-12 h-12 mx-auto mb-3 opacity-60`}),(0,f.jsx)(`p`,{className:`text-base text-bambu-gray-light mb-1`,children:v(`spoolbuddy.ams.noData`,`No AMS detected`)}),(0,f.jsx)(`p`,{className:`text-sm`,children:v(`spoolbuddy.ams.connectAms`,`Connect an AMS to see filament slots`)})]})}):(0,f.jsxs)(f.Fragment,{children:[Te.length>0&&(0,f.jsx)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-3`,children:Te.map(e=>(0,f.jsx)(ce,{unit:e,activeSlot:x?.amsId===e.id?x.trayId:z?.ams_id===e.id?z.tray_id??null:null,onConfigureSlot:(t,n)=>Oe(e.id,n),isDualNozzle:W,nozzleSide:q(e.id),thresholds:Ce,fillOverrides:B},e.id))}),je.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2 shrink-0`,children:je.map(({key:e,label:t,amsId:n,trayId:r,tray:i,isEmpty:a,nozzleSide:o,effectiveFill:s})=>{let c=ue(i.tray_color),l=x?x.amsId===n&&x.trayId===r:!!z&&z.ams_id===n&&z.tray_id===r;return(0,f.jsxs)(`button`,{type:`button`,"aria-pressed":l,title:X(n,r),onClick:()=>Oe(n,r),className:`bg-bambu-dark-secondary border rounded-lg px-3 py-2 hover:bg-bambu-dark-tertiary transition-all flex items-center gap-2 ${l?`ring-2 ring-bambu-green border-bambu-green bg-bambu-green/10`:`border-[var(--border-color)]`} ${Y?`opacity-50 pointer-events-none`:``}`,children:[(0,f.jsx)(`div`,{className:`relative w-10 h-10 shrink-0`,children:a?(0,f.jsx)(`div`,{className:`w-full h-full rounded-full border-2 border-dashed border-gray-500 flex items-center justify-center`,children:(0,f.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-gray-600`})}):(0,f.jsxs)(`svg`,{viewBox:`0 0 56 56`,className:`w-full h-full`,children:[(0,f.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:c}),(0,f.jsx)(`circle`,{cx:`28`,cy:`28`,r:`20`,fill:c,style:{filter:`brightness(0.85)`}}),(0,f.jsx)(`ellipse`,{cx:`20`,cy:`20`,rx:`6`,ry:`4`,fill:`white`,opacity:`0.3`}),(0,f.jsx)(`circle`,{cx:`28`,cy:`28`,r:`8`,fill:`#2d2d2d`}),(0,f.jsx)(`circle`,{cx:`28`,cy:`28`,r:`5`,fill:`#1a1a1a`})]})}),(0,f.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium`,children:t}),o&&(0,f.jsx)(se,{side:o})]}),(0,f.jsx)(`div`,{className:`text-sm text-white truncate`,children:a?v(`ams.empty`):i.tray_type||`?`})]}),!a&&s!=null&&s>=0&&(0,f.jsx)(`div`,{className:`w-1.5 h-8 bg-bambu-dark-tertiary rounded-full overflow-hidden shrink-0 flex flex-col-reverse`,children:(0,f.jsx)(`div`,{className:`w-full rounded-full`,style:{height:`${s}%`,backgroundColor:ne(s)}})})]},e)})})]}):(0,f.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-xl border border-red-300 bg-red-50 p-8 dark:border-red-500/30 dark:bg-red-500/5`,children:(0,f.jsx)(`p`,{className:`text-base text-red-700 dark:text-red-300`,children:v(`spoolbuddy.ams.printerDisconnected`,`Printer disconnected`)})}):(0,f.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-xl border border-dashed border-[var(--border-color)] bg-bambu-dark-secondary p-8`,children:(0,f.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,f.jsx)(ie,{className:`w-12 h-12 mx-auto mb-3 opacity-60`}),(0,f.jsx)(`p`,{className:`text-base text-bambu-gray-light`,children:v(`printModal.selectPrinter`)})]})})]})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 bg-bambu-dark-secondary px-5 py-3 border-t border-[var(--border-color)] shrink-0`,children:[N&&(0,f.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm`,children:[(0,f.jsxs)(`span`,{className:`text-bambu-gray`,children:[v(`printModal.selectSlot`),`: `]}),(0,f.jsx)(`span`,{className:Ne?`font-medium text-white`:`text-bambu-gray`,children:Ne||`—`})]}),(0,f.jsx)(`button`,{onClick:t,disabled:Y,className:`px-5 py-2.5 rounded-lg border border-[var(--border-color)] text-sm font-medium bg-bambu-dark-tertiary text-white hover:bg-bambu-dark transition-colors min-h-[44px] disabled:opacity-50`,children:v(w===`success`?`common.close`:`common.cancel`)}),N&&(0,f.jsxs)(`button`,{type:`button`,onClick:ke,disabled:!P||!x||Y||w===`success`,className:`inline-flex min-h-[44px] items-center gap-2 rounded-lg bg-bambu-green px-5 py-2.5 text-sm font-semibold text-[#ffffff] transition-colors hover:bg-bambu-green-dark disabled:cursor-not-allowed disabled:opacity-40`,children:[Y?(0,f.jsx)(u,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(c,{className:`h-4 w-4`}),v(`inventory.assignSpool`)]})]})]})}),E&&O&&(()=>{let e=``;return O.type===`material`?e=v(`inventory.assignMismatchMessage`,{spoolMaterial:O.spoolMaterial,trayMaterial:O.trayMaterial,location:O.location}):O.type===`partial`?e=v(`inventory.assignPartialMismatchMessage`,{spoolMaterial:O.spoolMaterial,trayMaterial:O.trayMaterial,location:O.location}):O.type===`material_profile`?e=`${v(`inventory.assignMismatchMessage`,{spoolMaterial:O.spoolMaterial,trayMaterial:O.trayMaterial,location:O.location})}\n\n${v(`inventory.assignProfileMismatchMessage`,{spoolProfile:O.spoolProfile||v(`common.unknown`),trayProfile:O.trayProfile||v(`common.unknown`),location:O.location})}`:O.type===`partial_profile`&&(e=`${v(`inventory.assignPartialMismatchMessage`,{spoolMaterial:O.spoolMaterial,trayMaterial:O.trayMaterial,location:O.location})}\n\n${v(`inventory.assignProfileMismatchMessage`,{spoolProfile:O.spoolProfile||v(`common.unknown`),trayProfile:O.trayProfile||v(`common.unknown`),location:O.location})}`),e=`${e}\n\n${v(`inventory.assignReconfigureNote`)}`,(0,f.jsx)(re,{title:v(`inventory.assignMismatchTitle`),message:e,confirmText:v(`inventory.assignMismatchConfirm`),variant:`warning`,overlayZIndex:`z-[70]`,isLoading:J.isPending,onConfirm:Ae,onCancel:()=>{J.isPending||(D(!1),j(null),k(null))}})})()]})}export{_ as t}; \ No newline at end of file diff --git a/static/assets/Button-DDr6eAFy.js b/static/assets/Button-DDr6eAFy.js new file mode 100644 index 000000000..ea60f8bbf --- /dev/null +++ b/static/assets/Button-DDr6eAFy.js @@ -0,0 +1 @@ +import{C as e}from"./client-DnySrlFv.js";var t=e();function n({variant:e=`primary`,size:n=`md`,className:r=``,children:i,...a}){return(0,t.jsx)(`button`,{className:`inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-bambu-dark disabled:opacity-50 disabled:cursor-not-allowed ${{primary:`bg-bambu-green hover:bg-bambu-green-light text-white focus:ring-bambu-green`,secondary:`bg-bambu-dark-tertiary hover:bg-bambu-gray-dark text-white focus:ring-bambu-gray`,danger:`bg-red-600 hover:bg-red-700 text-white focus:ring-red-500`,ghost:`bg-transparent hover:bg-bambu-dark-tertiary text-bambu-gray-light hover:text-white`}[e]} ${{sm:`px-3 py-1.5 text-sm gap-1.5 min-h-[44px] md:min-h-0`,md:`px-4 py-2 text-sm gap-2 min-h-[44px] md:min-h-0`,lg:`px-6 py-3 text-base gap-2 min-h-[48px] md:min-h-0`}[n]} ${r}`,...a,children:i})}export{n as t}; \ No newline at end of file diff --git a/static/assets/CamWallPage-C6KBEffK.js b/static/assets/CamWallPage-C6KBEffK.js new file mode 100644 index 000000000..3a67a4637 --- /dev/null +++ b/static/assets/CamWallPage-C6KBEffK.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,g as i,w as a}from"./client-DnySrlFv.js";import{t as o}from"./useQuery-BBCjCezC.js";import{a as s,t as c}from"./CameraWall-lBUed8MZ.js";import{Bn as l,Wn as u,yt as d,zn as f}from"./index-CovRLYqQ.js";var p=e(n(),1),m=t(),h=5e3,g=4,_=8,v=1,y=16,b=2,x=60;function S(e,t,n,r){let i=parseInt(e??``,10);return Number.isFinite(i)?Math.min(r,Math.max(n,i)):t}function C(e,t,n,r,i,a){return e.has(t)?S(e.get(t),r,i,a):S(localStorage.getItem(n),r,i,a)}function w(e){let t=e.get(`size`)?.toLowerCase(),n=s.indexOf(t);if(n>=0)return n+1;let r=parseInt(localStorage.getItem(`camWallTileSize`)??``,10);return r>=1&&r<=4?r:2}function T(){let{t:e}=a(),t=l(),{authEnabled:n,loading:s,user:S}=d(),[T]=u(),E=T.get(`token`),D=E!=null&&E!==``,[O,k]=(0,p.useState)(()=>C(T,`maxLive`,`camWallMaxLive`,g,v,y)),[A,j]=(0,p.useState)(()=>C(T,`interval`,`camWallSnapshotSec`,_,b,x)),[M]=(0,p.useState)(()=>w(T)),[N,P]=(0,p.useState)(()=>{let e=T.get(`status`)??localStorage.getItem(`camWallStatusMode`);return(D?[`off`,`compact`]:[`off`,`compact`,`full`]).includes(e)?e:`compact`});(0,p.useEffect)(()=>{if(D)return i(E),()=>i(null)},[D,E]);let F=o({queryKey:[`camwall-printers`,E],queryFn:()=>r.getCamWallPrinters(E??void 0),enabled:D,refetchInterval:h}),I=o({queryKey:[`printers`],queryFn:()=>r.getPrinters(),enabled:!D&&!s&&(!n||S!==null),refetchInterval:h}),L=(0,p.useMemo)(()=>{let e=new Map;for(let t of F.data??[])e.set(t.id,{connected:t.connected,state:t.state,progress:t.progress,remaining_time:t.remaining_time,layer_num:t.layer_num,total_layers:t.total_layers,hms_errors:t.hms_errors});return e},[F.data]);if(!D&&s)return(0,m.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-bambu-dark text-bambu-gray`,children:e(`common.loading`)});if(!D&&n&&!S)return(0,m.jsx)(f,{to:`/login`,replace:!0,state:{from:t}});let R=D?F:I,z=D?F.data??[]:I.data??[];return R.isError?(0,m.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-bambu-dark p-6 text-center`,children:(0,m.jsx)(`p`,{className:`max-w-md text-sm text-red-400`,children:e(D?`printers.camWall.page.tokenRejected`:`printers.camWall.page.loadFailed`)})}):(0,m.jsx)(`div`,{className:`min-h-screen bg-bambu-dark p-4`,children:(0,m.jsx)(c,{printers:z,maxLive:O,snapshotIntervalSec:A,statusMode:N,tileSize:M,statuses:D?L:void 0,showSettings:!D,onTileClick:D?void 0:e=>window.open(`/camera/${e}`,`camera-${e}`),onChangeMaxLive:e=>{k(e),localStorage.setItem(`camWallMaxLive`,String(e))},onChangeSnapshotIntervalSec:e=>{j(e),localStorage.setItem(`camWallSnapshotSec`,String(e))},onChangeStatusMode:e=>{P(e),localStorage.setItem(`camWallStatusMode`,e)}})})}export{T as CamWallPage,T as default}; \ No newline at end of file diff --git a/static/assets/CameraDiagnoseModal-RgByyfP2.js b/static/assets/CameraDiagnoseModal-RgByyfP2.js new file mode 100644 index 000000000..10ef030eb --- /dev/null +++ b/static/assets/CameraDiagnoseModal-RgByyfP2.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i,x as a}from"./client-DnySrlFv.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{t as c}from"./createLucideIcon-DvBYJlWL.js";import{t as l}from"./box-DAdKb9s5.js";import{n as u,r as d}from"./info-ROUoQhJR.js";import{n as f}from"./ToastContext-BRX0SW3C.js";import{t as p}from"./loader-circle-BEmFtawu.js";import{t as m}from"./maximize-2-kPQ77q72.js";import{t as h}from"./x-DR-Trv6U.js";import{An as g,Ft as _,Lt as v,Rt as y,_t as b,kn as x,yt as S}from"./index-CovRLYqQ.js";var C=c(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),w=t();function T({on:e,className:t=`w-5 h-5`}){let n=e?`#facc15`:`none`,r=e?`#78350f`:`currentColor`;return(0,w.jsxs)(`svg`,{viewBox:`0 0 32 32`,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[(0,w.jsxs)(`g`,{stroke:r,opacity:+!!e,children:[(0,w.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,w.jsx)(`line`,{x1:`6.1`,y1:`6.1`,x2:`8.9`,y2:`8.9`}),(0,w.jsx)(`line`,{x1:`25.9`,y1:`6.1`,x2:`23.1`,y2:`8.9`}),(0,w.jsx)(`line`,{x1:`2`,y1:`16`,x2:`6`,y2:`16`}),(0,w.jsx)(`line`,{x1:`30`,y1:`16`,x2:`26`,y2:`16`})]}),(0,w.jsx)(`path`,{d:`M12 24v-2.3c0-.9-.4-1.7-1-2.3C9.2 17.6 8 15.4 8 13c0-4.4 3.6-8 8-8s8 3.6 8 8c0 2.4-1.2 4.6-3 6.4-.6.6-1 1.4-1 2.3V24`,fill:n,stroke:r}),(0,w.jsx)(`path`,{d:`M12 24h8`,stroke:r}),(0,w.jsx)(`path`,{d:`M12 27h8`,stroke:r}),(0,w.jsx)(`path`,{d:`M13 30h6`,stroke:r})]})}var E=e(n(),1);function D(e,t,n){let r=Math.max(0,Math.min(e.width-1,Math.floor(t))),i=(Math.max(0,Math.min(e.height-1,Math.floor(n)))*e.width+r)*4,a=e.data[i],o=e.data[i+1],s=e.data[i+2];return!e.data[i+3]||a===0&&o===0&&s===0?null:a+(o<<8)+(s<<16)}function O(e,t,n,r,i){let a=Math.min(e.width/t,e.height/n);if(!(a>0))return null;let o=(r-e.left-(e.width-t*a)/2)/a,s=(i-e.top-(e.height-n*a)/2)/a;return o<0||s<0||o>=t||s>=n?null:{x:o,y:s}}var k=({className:e})=>(0,w.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,children:[(0,w.jsx)(`rect`,{x:`2`,y:`15`,width:`5`,height:`5`,rx:`0.5`}),(0,w.jsx)(`rect`,{x:`9.5`,y:`15`,width:`5`,height:`5`,rx:`0.5`,fill:`currentColor`,opacity:`0.3`}),(0,w.jsx)(`rect`,{x:`17`,y:`15`,width:`5`,height:`5`,rx:`0.5`}),(0,w.jsx)(`path`,{d:`M4 12 C4 6, 14 6, 14 12`}),(0,w.jsx)(`polyline`,{points:`12,10 14,12 12,14`})]});function A({printerId:e,isOpen:t,onClose:n}){let{t:c}=i(),{showToast:u}=f(),{hasPermission:g}=S(),[_,x]=(0,E.useState)(new Set),[C,T]=(0,E.useState)(!1),[A,j]=(0,E.useState)(!1),[M,N]=(0,E.useState)(!1),P=(0,E.useRef)(null),F=(0,E.useRef)(null),I=(0,E.useRef)(null),{data:L}=o({queryKey:[`printerStatus`,e],queryFn:()=>r.getPrinterStatus(e),refetchInterval:3e4,enabled:t}),{data:R,refetch:z}=o({queryKey:[`printableObjects`,e],queryFn:()=>r.getPrintableObjects(e),enabled:t,refetchInterval:t?5e3:!1}),B=(R?.objects.length??0)>0,V=B&&L?.cover_url?a(`${L.cover_url}?view=top`):null,H=B&&L?.cover_url?a(`${L.cover_url}?view=pick`):null,U=(0,E.useMemo)(()=>(R?.objects??[]).filter(e=>!e.skipped),[R]),W=(0,E.useMemo)(()=>U.filter(e=>_.has(e.id)),[U,_]),G=U.length>0&&W.length===U.length,K=G&&_.size>0,q=_.size>0&&(L?.layer_num??0)>1&&g(`printers:control`),J=s({mutationFn:t=>r.skipObjects(e,t),onSuccess:async e=>{u(e.message||c(`printers.skipObjects.objectsSkipped`)),await z(),T(!1),x(new Set),n()},onError:e=>{T(!1),u(e.message||c(`printers.toast.failedToSkipObjects`),`error`)}});(0,E.useEffect)(()=>{t||(x(new Set),T(!1),j(!1))},[t]),(0,E.useEffect)(()=>{if(P.current=null,N(!1),!t||!H)return;let e=!1,n=new Image;return n.onload=()=>{if(e)return;let t=document.createElement(`canvas`);t.width=n.naturalWidth||512,t.height=n.naturalHeight||512;let r=t.getContext(`2d`,{willReadFrequently:!0});r&&(r.drawImage(n,0,0),P.current=r.getImageData(0,0,t.width,t.height),N(!0))},n.onerror=()=>{e||N(!1)},n.src=H,()=>{e=!0}},[t,H]),(0,E.useEffect)(()=>{let e=P.current;if(!e||!R)return;let t=new Set(R.objects.filter(e=>e.skipped).map(e=>e.id));for(let n of[F.current,I.current]){if(!n)continue;n.width=e.width,n.height=e.height;let r=n.getContext(`2d`);if(!r)continue;let i=r.createImageData(e.width,e.height);for(let n=0;n{e.skipped||x(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})},X=e=>{let t=P.current;if(!t)return;let n=O(e.currentTarget.getBoundingClientRect(),t.width,t.height,e.clientX,e.clientY);if(!n)return;let r=D(t,n.x,n.y),i=R?.objects.find(e=>e.id===r);i&&Y(i)},Z=(e=!1)=>(0,w.jsxs)(`div`,{className:`relative aspect-square overflow-hidden rounded-lg border border-gray-300 bg-gray-900 dark:border-gray-600 ${M?`cursor-crosshair`:``}`,children:[V?(0,w.jsx)(`img`,{src:V,alt:c(`printers.printPreview`),className:`absolute inset-0 h-full w-full object-contain`}):(0,w.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,w.jsx)(l,{className:`h-10 w-10 text-gray-500`})}),(0,w.jsx)(`canvas`,{ref:e?I:F,onClick:X,className:`absolute inset-0 h-full w-full object-contain`,"aria-label":c(`printers.skipObjects.selectObjectsToSkip`)}),!e&&V&&(0,w.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),j(!0)},className:`absolute right-2 top-2 rounded bg-black/65 p-1.5 text-white/80 hover:text-white`,title:c(`common.expand`),children:(0,w.jsx)(m,{className:`h-4 w-4`})}),!M&&V&&(0,w.jsx)(`div`,{className:`absolute bottom-2 left-2 rounded bg-black/70 px-2 py-1 text-[10px] text-white/80`,children:c(`common.unavailable`)})]});return t?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&(A?j(!1):n())},tabIndex:-1,ref:e=>e?.focus(),children:[(0,w.jsx)(`div`,{className:`absolute inset-0 bg-black/55`}),(0,w.jsxs)(`section`,{className:`relative z-10 flex max-h-[88vh] w-full max-w-[980px] flex-col overflow-hidden rounded-lg border border-gray-200 bg-white shadow-2xl dark:border-bambu-dark-tertiary dark:bg-bambu-dark`,onClick:e=>e.stopPropagation(),"aria-label":c(`printers.skipObjects.title`),children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between border-b border-gray-200 bg-gray-50 px-4 py-3 dark:border-bambu-dark-tertiary dark:bg-bambu-dark`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(k,{className:`h-5 w-5 text-bambu-green`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-gray-900 dark:text-white`,children:c(`printers.skipObjects.title`)}),(0,w.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-bambu-gray`,children:c(`printers.skipObjects.selectObjectsToSkip`)})]})]}),(0,w.jsx)(`button`,{type:`button`,onClick:n,className:`rounded p-1 text-gray-500 hover:text-gray-900 dark:text-bambu-gray dark:hover:text-white`,children:(0,w.jsx)(h,{className:`h-5 w-5`})})]}),R?R.objects.length===0?(0,w.jsxs)(`div`,{className:`px-4 py-12 text-center text-bambu-gray`,children:[(0,w.jsx)(`p`,{className:`text-sm`,children:c(`printers.noObjectsFound`)}),(0,w.jsx)(`p`,{className:`mt-1 text-xs opacity-70`,children:c(`printers.objectsLoadedOnPrintStart`)})]}):(0,w.jsxs)(w.Fragment,{children:[(L?.layer_num??0)<=1&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-amber-400/20 bg-amber-500/10 px-4 py-2 text-xs text-amber-400`,children:[(0,w.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}),c(`printers.skipObjects.waitForLayer`,{layer:L?.layer_num??0})]}),(0,w.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(320px,1fr)_minmax(340px,0.9fr)] overflow-hidden max-md:grid-cols-1 max-md:overflow-y-auto`,children:[(0,w.jsxs)(`div`,{className:`border-r border-gray-200 bg-gray-50 p-4 dark:border-bambu-dark-tertiary dark:bg-bambu-dark-secondary max-md:border-b-0 max-md:border-r-0`,children:[Z(),(0,w.jsxs)(`div`,{className:`mt-3 flex items-center justify-between text-xs text-gray-500 dark:text-bambu-gray`,children:[(0,w.jsxs)(`span`,{children:[_.size,`/`,U.length]}),(0,w.jsxs)(`span`,{children:[R.skipped_count,` `,c(`printers.skipObjects.skipped`)]})]})]}),(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>x(G?new Set:new Set(U.map(e=>e.id))),className:`flex items-center gap-3 border-b border-gray-200 px-4 py-3 text-left text-sm font-semibold text-gray-900 hover:bg-gray-50 dark:border-bambu-dark-tertiary dark:text-white dark:hover:bg-white/5`,children:[G?(0,w.jsx)(y,{className:`h-5 w-5 text-bambu-green`}):(0,w.jsx)(v,{className:`h-5 w-5 text-bambu-gray`}),(0,w.jsx)(`span`,{className:`flex-1`,children:c(G?`common.deselectAll`:`common.selectAll`)}),(0,w.jsx)(`span`,{className:`text-xs font-normal text-bambu-gray`,children:U.length})]}),(0,w.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:R.objects.map((e,t)=>{let n=_.has(e.id);return(0,w.jsxs)(`button`,{type:`button`,onClick:()=>Y(e),disabled:e.skipped,className:`flex w-full items-center gap-3 border-b border-gray-200 px-4 py-2.5 text-left transition-colors dark:border-bambu-dark-tertiary/60 ${e.skipped?`cursor-not-allowed bg-red-500/5 opacity-55`:n?`bg-bambu-green/15 hover:bg-bambu-green/20`:`hover:bg-gray-50 dark:hover:bg-white/5`}`,children:[e.skipped||n?(0,w.jsx)(y,{className:`h-5 w-5 flex-shrink-0 ${e.skipped?`text-red-400`:`text-bambu-green`}`}):(0,w.jsx)(v,{className:`h-5 w-5 flex-shrink-0 text-bambu-gray`}),(0,w.jsx)(`span`,{className:`w-8 flex-shrink-0 text-xs font-bold text-bambu-gray`,children:t+1}),(0,w.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm ${e.skipped?`text-red-400 line-through`:`text-gray-900 dark:text-white`}`,children:e.name}),(0,w.jsxs)(`span`,{className:`text-[10px] text-bambu-gray`,children:[`ID `,e.id]})]},e.id)})})]})]}),(0,w.jsxs)(`footer`,{className:`flex items-center gap-3 border-t border-gray-200 bg-gray-50 px-4 py-3 dark:border-bambu-dark-tertiary dark:bg-bambu-dark`,children:[(0,w.jsx)(`span`,{className:`mr-auto text-sm text-gray-600 dark:text-bambu-gray`,children:_.size===0?c(`printers.skipObjects.noObjectsSelected`):`${_.size}/${U.length}`}),(0,w.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md border border-gray-300 px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:border-bambu-dark-tertiary dark:text-white dark:hover:bg-white/5`,children:c(`common.cancel`)}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>T(!0),disabled:!q||J.isPending,className:`rounded-md bg-red-500 px-4 py-2 text-sm font-semibold text-white hover:bg-red-600 disabled:cursor-not-allowed disabled:opacity-35`,children:J.isPending?c(`printers.skipObjects.skipping`):c(`printers.skipObjects.skipSelected`)})]})]}):(0,w.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,w.jsx)(p,{className:`h-6 w-6 animate-spin text-bambu-gray`})})]})]}),C&&(0,w.jsx)(b,{variant:`warning`,title:c(`printers.skipObjects.confirmTitle`),message:K?c(`printers.skipObjects.confirmAllMessage`):W.length===1?c(`printers.skipObjects.confirmMessage`,{name:W[0].name}):c(`printers.skipObjects.confirmMultipleMessage`,{count:W.length}),confirmText:c(`printers.skipObjects.skipSelected`),isLoading:J.isPending,onConfirm:()=>J.mutate([..._]),onCancel:()=>T(!1)}),A&&(0,w.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/90 p-8`,onClick:()=>j(!1),children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>j(!1),className:`absolute right-4 top-4 rounded p-2 text-white/70 hover:text-white`,children:(0,w.jsx)(h,{className:`h-6 w-6`})}),(0,w.jsx)(`div`,{className:`aspect-square max-h-[86vh] w-full max-w-[86vh]`,onClick:e=>e.stopPropagation(),children:Z(!0)})]})]}):null}function j({status:e}){return e===`ok`?(0,w.jsx)(g,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}):e===`failed`?(0,w.jsx)(u,{className:`w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0`}):(0,w.jsx)(x,{className:`w-5 h-5 text-bambu-gray flex-shrink-0`})}function M({printerId:e,printerName:t,onClose:n}){let{t:a}=i(),o=s({mutationFn:()=>r.diagnoseCamera(e)});(0,E.useEffect)(()=>{o.mutate()},[]),(0,E.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);let c=o.data;return(0,w.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:n,children:(0,w.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,w.jsx)(_,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,children:a(`camera.diagnose.modalTitle`,{name:t||``})})]}),(0,w.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,title:a(`common.close`),children:(0,w.jsx)(h,{className:`w-5 h-5`})})]}),(0,w.jsxs)(`div`,{className:`p-6 space-y-4`,children:[o.isPending&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,w.jsx)(p,{className:`w-4 h-4 animate-spin`}),(0,w.jsx)(`span`,{children:a(`camera.diagnose.running`)})]}),o.isError&&(0,w.jsx)(`div`,{className:`rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:a(`camera.diagnose.runFailed`,{error:o.error.message})}),c&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`ol`,{className:`space-y-2`,children:c.stages.map(e=>(0,w.jsxs)(`li`,{className:`flex items-center gap-3 bg-bambu-dark rounded-lg px-4 py-2.5`,children:[(0,w.jsx)(j,{status:e.status}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`div`,{className:`text-sm text-white`,children:a(`camera.diagnose.stage.${e.name}`)}),e.code&&(0,w.jsx)(`div`,{className:`text-xs text-bambu-gray font-mono`,children:e.code})]}),(0,w.jsxs)(`div`,{className:`text-xs text-bambu-gray tabular-nums flex-shrink-0`,children:[e.duration_ms,` ms`]})]},e.name))}),(0,w.jsx)(`div`,{className:c.overall_status===`ok`?`rounded-lg bg-bambu-green/10 border border-bambu-green/30 px-4 py-3 text-sm text-bambu-green`:`rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:a(`camera.diagnose.summary.${c.summary_code}`,{defaultValue:a(`camera.diagnose.summary.unknown_failure`)})}),(0,w.jsx)(`div`,{className:`text-xs text-bambu-gray space-y-0.5`,children:(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[a(`camera.diagnose.meta.protocol`),`: `]}),(0,w.jsx)(`span`,{className:`font-mono`,children:c.protocol}),` • `,(0,w.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[a(`camera.diagnose.meta.port`),`: `]}),(0,w.jsx)(`span`,{className:`font-mono`,children:c.port}),` • `,(0,w.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[a(`camera.diagnose.meta.profile`),`: `]}),(0,w.jsx)(`span`,{className:`font-mono`,children:c.profile})]})})]})]}),(0,w.jsxs)(`div`,{className:`px-6 py-4 border-t border-bambu-dark-tertiary flex justify-end gap-2`,children:[(0,w.jsx)(`button`,{onClick:()=>o.mutate(),disabled:o.isPending,className:`px-4 py-2 bg-bambu-dark hover:bg-bambu-dark-tertiary disabled:opacity-50 text-white text-sm rounded-lg transition-colors`,children:a(`camera.diagnose.retry`)}),(0,w.jsx)(`button`,{onClick:n,className:`px-4 py-2 bg-bambu-green hover:bg-bambu-green/90 text-white text-sm rounded-lg transition-colors`,children:a(`common.close`)})]})]})})}export{C as a,T as i,k as n,A as r,M as t}; \ No newline at end of file diff --git a/static/assets/CameraPage-6_IS1759.js b/static/assets/CameraPage-6_IS1759.js new file mode 100644 index 000000000..afb41354f --- /dev/null +++ b/static/assets/CameraPage-6_IS1759.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,S as r,a as i,d as a,l as o,w as ee}from"./client-DnySrlFv.js";import{n as te}from"./QueryClientProvider-Ce8_sN3w.js";import{t as s}from"./useQuery-BBCjCezC.js";import{t as ne}from"./useMutation-B-Tr2hIP.js";import{t as c}from"./createLucideIcon-DvBYJlWL.js";import{n as re}from"./ToastContext-BRX0SW3C.js";import{a as ie,i as ae,n as oe,r as se,t as ce}from"./CameraDiagnoseModal-RgByyfP2.js";import{t as le}from"./triangle-alert-Dt_1FcBy.js";import{n as ue,t as de}from"./zoom-out-DNNe6DMN.js";import{Ct as fe,Ft as pe,Kt as me,Pn as he,Un as ge,Wn as _e,n as ve,yt as ye}from"./index-CovRLYqQ.js";var be=c(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),l=e(n(),1),u=t(),d=5,xe=2e3,Se=3e4,Ce=5e3;function f(){let{t:e}=ee(),t=te(),{showToast:n}=re(),{hasPermission:c,authEnabled:f,user:we}=ye(),{printerId:Te}=ge(),p=parseInt(Te||`0`,10),[Ee]=_e(),De=parseInt(Ee.get(`fps`)||`15`,10),Oe=Math.min(Math.max(isNaN(De)?15:De,1),30);ve();let{data:ke,isPending:Ae}=s({queryKey:[`camera-stream-token`,we?.id??null],queryFn:()=>i.getCameraStreamToken(),enabled:f?!!we:!0,staleTime:3e3*1e3}),m=ke?.token??a(),[h,je]=(0,l.useState)(`stream`),[Me,Ne]=(0,l.useState)(!1),[Pe,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!0),[x,S]=(0,l.useState)(Date.now()),[C,w]=(0,l.useState)(!1),[Fe,Ie]=(0,l.useState)(!1),[T,E]=(0,l.useState)(0),[D,O]=(0,l.useState)(!1),[Le,Re]=(0,l.useState)(0),[k,A]=(0,l.useState)(1),[j,M]=(0,l.useState)({x:0,y:0}),[N,P]=(0,l.useState)(!1),[F,ze]=(0,l.useState)({x:0,y:0}),[Be,I]=(0,l.useState)(null),[L,R]=(0,l.useState)(null),z=(0,l.useRef)(null),B=(0,l.useRef)(null),V=(0,l.useRef)(null),H=(0,l.useRef)(null),U=(0,l.useRef)(null),W=(0,l.useRef)(0),{data:G}=s({queryKey:[`printer`,p],queryFn:()=>i.getPrinter(p),enabled:p>0}),{data:K}=s({queryKey:[`printerStatus`,p],queryFn:()=>i.getPrinterStatus(p),refetchInterval:3e4,enabled:p>0}),Ve=ne({mutationFn:e=>i.setChamberLight(p,e),onMutate:async e=>{await t.cancelQueries({queryKey:[`printerStatus`,p]});let n=t.getQueryData([`printerStatus`,p]);return t.setQueryData([`printerStatus`,p],t=>({...t,chamber_light:e})),{previousStatus:n}},onSuccess:(e,t)=>{n(`Chamber light ${t?`on`:`off`}`)},onError:(r,i,a)=>{a?.previousStatus&&t.setQueryData([`printerStatus`,p],a.previousStatus),n(r.message||e(`printers.toast.failedToControlChamberLight`),`error`)}}),q=(K?.state===`RUNNING`||K?.state===`PAUSE`)&&(K?.printable_objects_count??0)>=2;(0,l.useEffect)(()=>(G&&(document.title=`${G.name} - Camera`),()=>{document.title=`Bambuddy`}),[G]);let J=(0,l.useRef)(!1);(0,l.useEffect)(()=>{let e=`/api/v1/printers/${p}/camera/stop`;J.current=!1;let t=()=>{if(p>0&&!J.current){J.current=!0;let t={},n=o();n&&(t.Authorization=`Bearer ${n}`),fetch(e,{method:`POST`,keepalive:!0,headers:t}).catch(()=>{})}},n=()=>{t()};window.addEventListener(`beforeunload`,n);let r=z.current;return()=>{window.removeEventListener(`beforeunload`,n),r&&(r.src=``),t()}},[p]),(0,l.useEffect)(()=>{if(y&&!C){let e=setTimeout(()=>{b(!1)},h===`stream`?3e3:2e4);return()=>clearTimeout(e)}},[h,y,x,C]),(0,l.useEffect)(()=>{let e=()=>{Ie(!!document.fullscreenElement),A(1),M({x:0,y:0}),h===`stream`&&!C&&(z.current&&(z.current.src=``),setTimeout(()=>{b(!0),S(Date.now())},200))};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[h,C]),(0,l.useEffect)(()=>{let e,t=()=>{clearTimeout(e),e=setTimeout(()=>{localStorage.setItem(`cameraWindowState`,JSON.stringify({width:window.outerWidth,height:window.outerHeight,left:window.screenX,top:window.screenY}))},500)};return window.addEventListener(`resize`,t),()=>{clearTimeout(e),window.removeEventListener(`resize`,t)}},[]),(0,l.useEffect)(()=>()=>{V.current&&clearTimeout(V.current),H.current&&clearInterval(H.current),U.current&&clearInterval(U.current)},[]);let Y=(0,l.useCallback)(()=>{if(T>=d){O(!1),v(!0);return}let e=Math.min(xe*2**T,Se);O(!0),Re(Math.ceil(e/1e3)),H.current=setInterval(()=>{Re(e=>e<=1?(H.current&&clearInterval(H.current),0):e-1)},1e3),V.current=setTimeout(()=>{E(e=>e+1),O(!1),b(!0),v(!1),z.current&&(z.current.src=``),S(Date.now())},e)},[T]);(0,l.useEffect)(()=>{if(h!==`stream`||y||D||C){U.current&&=(clearInterval(U.current),null);return}return W.current=0,U.current=setInterval(async()=>{try{let e=await i.getCameraStatus(p);if(!(e.stalled||!e.active&&!_)){W.current=0;return}if(W.current+=1,W.current<2)return;W.current=0,console.log(`Stream issue detected: stalled=${e.stalled}, active=${e.active}, reconnecting...`),U.current&&=(clearInterval(U.current),null),b(!1),Y()}catch{}},Ce),()=>{U.current&&=(clearInterval(U.current),null)}},[h,y,_,D,C,p,Y]);let He=()=>{b(!1),h===`stream`&&T{if(b(!1),v(!1),E(0),W.current=0,O(!1),V.current&&clearTimeout(V.current),H.current&&clearInterval(H.current),z.current&&!localStorage.getItem(`cameraWindowState`)){let e=z.current,t=e.naturalWidth,n=e.naturalHeight;if(t>0&&n>0){let e=window.outerWidth-window.innerWidth,r=window.outerHeight-window.innerHeight,i=t+16+e,a=n+45+16+r;try{window.resizeTo(i,a)}catch{}}}},We=()=>{if(p>0){let e={},t=o();t&&(e.Authorization=`Bearer ${t}`),fetch(`/api/v1/printers/${p}/camera/stop`,{method:`POST`,headers:e}).catch(()=>{})}},Ge=e=>{h===e||C||(w(!0),b(!0),v(!1),E(0),O(!1),A(1),M({x:0,y:0}),V.current&&clearTimeout(V.current),H.current&&clearInterval(H.current),z.current&&(z.current.src=``),h===`stream`&&We(),setTimeout(()=>{je(e),S(Date.now()),w(!1)},100))},X=()=>{C||(w(!0),b(!0),v(!1),E(0),O(!1),V.current&&clearTimeout(V.current),H.current&&clearInterval(H.current),z.current&&(z.current.src=``),h===`stream`&&We(),setTimeout(()=>{S(Date.now()),w(!1)},100))},Ke=()=>{B.current&&(document.fullscreenElement?document.exitFullscreen():B.current.requestFullscreen())},qe=()=>{A(e=>Math.min(e+.5,4))},Je=()=>{A(e=>{let t=Math.max(e-.5,1);return t===1&&M({x:0,y:0}),t})},Ye=e=>{e.preventDefault(),e.deltaY<0?qe():Je()},Xe=e=>{k>1&&(e.preventDefault(),P(!0),ze({x:e.clientX-j.x,y:e.clientY-j.y}))},Z=(0,l.useCallback)(()=>{if(!B.current)return{x:300,y:200};let e=B.current.getBoundingClientRect(),t=e.width*(k-1)/2,n=e.height*(k-1)/2;return{x:Math.max(50,t),y:Math.max(50,n)}},[k]),Ze=e=>{if(N&&k>1){let t=e.clientX-F.x,n=e.clientY-F.y,r=Z();M({x:Math.max(-r.x,Math.min(r.x,t)),y:Math.max(-r.y,Math.min(r.y,n))})}},Qe=()=>{P(!1)},$e=e=>{if(e.length<2)return 0;let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.sqrt(t*t+n*n)},et=e=>e.length<2?{x:e[0].clientX,y:e[0].clientY}:{x:(e[0].clientX+e[1].clientX)/2,y:(e[0].clientY+e[1].clientY)/2},tt=e=>{e.touches.length===2?(e.preventDefault(),I($e(e.touches)),R(et(e.touches))):e.touches.length===1&&k>1&&(e.preventDefault(),P(!0),ze({x:e.touches[0].clientX-j.x,y:e.touches[0].clientY-j.y}))},nt=e=>{if(e.touches.length===2&&Be!==null){e.preventDefault();let t=$e(e.touches),n=t/Be;A(e=>{let t=Math.max(1,Math.min(4,e*n));return t===1&&M({x:0,y:0}),t}),I(t);let r=et(e.touches);if(L){let e=Z();M(t=>({x:Math.max(-e.x,Math.min(e.x,t.x+(r.x-L.x))),y:Math.max(-e.y,Math.min(e.y,t.y+(r.y-L.y)))}))}R(r)}else if(e.touches.length===1&&N&&k>1){e.preventDefault();let t=e.touches[0].clientX-F.x,n=e.touches[0].clientY-F.y,r=Z();M({x:Math.max(-r.x,Math.min(r.x,t)),y:Math.max(-r.y,Math.min(r.y,n))})}},rt=e=>{e.touches.length<2&&(I(null),R(null)),e.touches.length===0&&P(!1)},it=()=>{A(1),M({x:0,y:0})},Q=C||!m&&(f||Ae)?``:(e=>m?`${e}&token=${encodeURIComponent(m)}`:r(e))(h===`stream`?`/api/v1/printers/${p}/camera/stream?fps=${Oe}&t=${x}`:`/api/v1/printers/${p}/camera/snapshot?t=${x}`),$=y||C||D;return p?(0,u.jsxs)(`div`,{ref:B,className:`min-h-screen bg-black flex flex-col`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary`,children:[(0,u.jsxs)(`h1`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[(0,u.jsx)(he,{className:`w-4 h-4`}),G?.name||`Printer ${p}`]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsxs)(`div`,{className:`flex bg-bambu-dark rounded p-0.5`,children:[(0,u.jsx)(`button`,{onClick:()=>Ge(`stream`),disabled:$,className:`px-3 py-1 text-xs rounded transition-colors ${h===`stream`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white disabled:opacity-50`}`,children:e(`camera.live`)}),(0,u.jsx)(`button`,{onClick:()=>Ge(`snapshot`),disabled:$,className:`px-3 py-1 text-xs rounded transition-colors ${h===`snapshot`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white disabled:opacity-50`}`,children:e(`camera.snapshot`)})]}),(0,u.jsx)(`button`,{onClick:()=>Ve.mutate(!K?.chamber_light),disabled:!K?.connected||Ve.isPending||!c(`printers:control`),className:`p-1.5 rounded disabled:opacity-50 ${K?.chamber_light?`bg-yellow-500/20 hover:bg-yellow-500/30`:`hover:bg-bambu-dark-tertiary`}`,title:c(`printers:control`)?e(`camera.chamberLight`):e(`printers.permission.noControl`),children:(0,u.jsx)(ae,{on:K?.chamber_light??!1,className:`w-4 h-4`})}),(0,u.jsx)(`button`,{onClick:()=>Ne(!0),disabled:!q||!c(`printers:control`),className:`p-1.5 rounded disabled:opacity-50 ${q&&c(`printers:control`)?`hover:bg-bambu-dark-tertiary`:``}`,title:c(`printers:control`)?e(q?`printers.skipObjects.tooltip`:`printers.skipObjects.onlyWhilePrinting`):e(`printers.permission.noControl`),children:(0,u.jsx)(oe,{className:`w-4 h-4 text-bambu-gray`})}),(0,u.jsx)(`button`,{onClick:X,disabled:$,className:`p-1.5 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50`,title:e(h===`stream`?`camera.restartStream`:`camera.refreshSnapshot`),children:(0,u.jsx)(me,{className:`w-4 h-4 text-bambu-gray ${$?`animate-spin`:``}`})}),(0,u.jsx)(`button`,{onClick:()=>g(!0),className:`p-1.5 hover:bg-bambu-dark-tertiary rounded`,title:e(`camera.diagnose.button`),children:(0,u.jsx)(pe,{className:`w-4 h-4 text-bambu-gray`})}),(0,u.jsx)(`button`,{onClick:Ke,className:`p-1.5 hover:bg-bambu-dark-tertiary rounded`,title:e(Fe?`camera.exitFullscreen`:`camera.fullscreen`),children:Fe?(0,u.jsx)(ie,{className:`w-4 h-4 text-bambu-gray`}):(0,u.jsx)(be,{className:`w-4 h-4 text-bambu-gray`})})]})]}),(0,u.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-2 overflow-hidden`,onWheel:Ye,onMouseMove:Ze,onMouseUp:Qe,onMouseLeave:Qe,onTouchStart:tt,onTouchMove:nt,onTouchEnd:rt,style:{touchAction:`none`},children:(0,u.jsxs)(`div`,{className:`relative w-full h-full flex items-center justify-center`,children:[(y||C)&&!D&&(0,u.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/50 z-10`,children:(0,u.jsxs)(`div`,{className:`text-center`,children:[(0,u.jsx)(me,{className:`w-8 h-8 text-bambu-gray animate-spin mx-auto mb-2`}),(0,u.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(h===`stream`?`camera.connectingToCamera`:`camera.capturingSnapshot`)})]})}),D&&(0,u.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/80 z-10`,children:(0,u.jsxs)(`div`,{className:`text-center p-4`,children:[(0,u.jsx)(fe,{className:`w-10 h-10 text-orange-400 mx-auto mb-3`}),(0,u.jsx)(`p`,{className:`text-white mb-2`,children:e(`camera.connectionLost`)}),(0,u.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:e(`camera.reconnecting`,{countdown:Le,attempt:Math.min(T+1,d),max:d})}),(0,u.jsx)(`button`,{onClick:X,className:`px-4 py-2 bg-bambu-green text-white text-sm rounded hover:bg-bambu-green/80 transition-colors`,children:e(`camera.reconnectNow`)})]})}),_&&!D&&(0,u.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black z-10`,children:(0,u.jsxs)(`div`,{className:`text-center p-4`,children:[(0,u.jsx)(le,{className:`w-12 h-12 text-orange-400 mx-auto mb-3`}),(0,u.jsx)(`p`,{className:`text-white mb-2`,children:e(`camera.cameraUnavailable`)}),(0,u.jsx)(`p`,{className:`text-xs text-bambu-gray mb-4 max-w-md`,children:e(`camera.cameraUnavailableDesc`)}),(0,u.jsxs)(`div`,{className:`flex gap-2 justify-center`,children:[(0,u.jsx)(`button`,{onClick:X,className:`px-4 py-2 bg-bambu-green text-white rounded hover:bg-bambu-green/80 transition-colors`,children:e(`camera.retry`)}),(0,u.jsx)(`button`,{onClick:()=>g(!0),className:`px-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray hover:text-white rounded transition-colors`,children:e(`camera.diagnose.button`)})]})]})}),(0,u.jsx)(`img`,{ref:z,src:Q,alt:e(`camera.cameraStream`),className:`max-w-full max-h-full object-contain select-none`,style:{transform:`scale(${k}) translate(${j.x/k}px, ${j.y/k}px) rotate(${G?.camera_rotation||0}deg)`,...G?.camera_rotation===90||G?.camera_rotation===270?{maxWidth:`100vh`,maxHeight:`100vw`}:{},cursor:k>1?N?`grabbing`:`grab`:`default`},onError:Q?He:void 0,onLoad:Q?Ue:void 0,onMouseDown:Xe,draggable:!1},x),(0,u.jsxs)(`div`,{className:`absolute bottom-4 left-4 flex items-center gap-1.5 bg-black/60 rounded-lg px-2 py-1.5`,children:[(0,u.jsx)(`button`,{onClick:Je,disabled:k<=1,className:`p-1.5 hover:bg-white/10 rounded disabled:opacity-30`,title:e(`camera.zoomOut`),children:(0,u.jsx)(de,{className:`w-4 h-4 text-white`})}),(0,u.jsxs)(`button`,{onClick:it,className:`px-2 py-1 text-sm text-white hover:bg-white/10 rounded min-w-[48px]`,title:e(`camera.resetZoom`),children:[Math.round(k*100),`%`]}),(0,u.jsx)(`button`,{onClick:qe,disabled:k>=4,className:`p-1.5 hover:bg-white/10 rounded disabled:opacity-30`,title:e(`camera.zoomIn`),children:(0,u.jsx)(ue,{className:`w-4 h-4 text-white`})})]})]})}),(0,u.jsx)(se,{printerId:p,isOpen:Me,onClose:()=>Ne(!1)}),Pe&&(0,u.jsx)(ce,{printerId:p,printerName:G?.name||null,onClose:()=>g(!1)})]}):(0,u.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center`,children:(0,u.jsx)(`p`,{className:`text-white`,children:e(`camera.invalidPrinterId`)})})}export{f as CameraPage}; \ No newline at end of file diff --git a/static/assets/CameraWall-lBUed8MZ.js b/static/assets/CameraWall-lBUed8MZ.js new file mode 100644 index 000000000..01fc3adef --- /dev/null +++ b/static/assets/CameraWall-lBUed8MZ.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,S as r,a as i,l as a,w as o}from"./client-DnySrlFv.js";import{n as s}from"./QueryClientProvider-Ce8_sN3w.js";import{t as c}from"./useMutation-B-Tr2hIP.js";import{t as l}from"./useQueries-Be6PMvSC.js";import{t as u}from"./createLucideIcon-DvBYJlWL.js";import{r as d,t as f}from"./info-ROUoQhJR.js";import{n as p}from"./ToastContext-BRX0SW3C.js";import{t as m}from"./loader-circle-BEmFtawu.js";import{t as h}from"./triangle-alert-Dt_1FcBy.js";import{t as g}from"./x-DR-Trv6U.js";import{o as _}from"./date-G9KUauqz.js";import{At as v,Cn as y,Ct as b,Vt as x}from"./index-CovRLYqQ.js";var S=u(`video-off`,[[`path`,{d:`M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196`,key:`w8jjjt`}],[`path`,{d:`M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2`,key:`1xawa7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),C=e(n(),1),w=[`s`,`m`,`l`,`xl`];function T(e){switch(e){case 1:return`grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5`;case 3:return`grid-cols-1 lg:grid-cols-2`;case 4:return`grid-cols-1`;default:return`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`}}var E=t(),D=8;function O(e,t){if(t>0)return`error`;switch(e){case`RUNNING`:return`printing`;case`PAUSE`:return`paused`;case`FINISH`:case`FAILED`:return`finished`;default:return`idle`}}var k={printing:`bg-bambu-green/85 text-black`,paused:`bg-amber-500/85 text-black`,finished:`bg-sky-500/80 text-white`,error:`bg-red-500/85 text-white`,idle:`bg-bambu-dark-tertiary/80 text-bambu-gray`};function A({printerId:e,printerName:t,cameraRotation:n=0,mode:i,snapshotIntervalMs:s,connected:c,onClick:l,statusMode:u=`off`,printerState:d=null,progress:f=null,remainingMin:p=null,layerNum:m=null,totalLayers:g=null,printName:v=null,hmsErrorCount:y=0}){let{t:x}=o(),[w,T]=(0,C.useState)(0),[A,j]=(0,C.useState)(!1),M=(0,C.useRef)(i);(0,C.useEffect)(()=>{let t=M.current===`live`,n=i===`live`;if(M.current=i,t&&!n){let t={},n=a();n&&(t.Authorization=`Bearer ${n}`),fetch(`/api/v1/printers/${e}/camera/stop`,{method:`POST`,keepalive:!0,headers:t}).catch(()=>{})}j(!1),T(e=>e+1)},[i,e]),(0,C.useEffect)(()=>()=>{if(M.current===`live`){let t={},n=a();n&&(t.Authorization=`Bearer ${n}`),fetch(`/api/v1/printers/${e}/camera/stop`,{method:`POST`,keepalive:!0,headers:t}).catch(()=>{})}},[e]),(0,C.useEffect)(()=>{if(i!==`snapshot`)return;let e=setInterval(()=>T(e=>e+1),s);return()=>clearInterval(e)},[i,s]);let N=r(`/api/v1/printers/${e}/camera/stream?fps=${D}&t=${w}`),P=r(`/api/v1/printers/${e}/camera/snapshot?t=${w}`),F=l!=null,I=n?`rotate(${n}deg)`:void 0,L=O(d,y),R=c&&u!==`off`&&L!==`idle`,z=c&&u===`full`&&(L===`printing`||L===`paused`),B=v??null,V=f==null?null:Math.round(f),H=m!=null&&g!=null&&g>0,U=p!=null&&p>0,W=`group relative aspect-video w-full overflow-hidden rounded-lg border border-bambu-dark-tertiary bg-black text-left ${F?`focus:outline-none focus:ring-2 focus:ring-bambu-green`:`cursor-default`}`,G=(0,E.jsxs)(E.Fragment,{children:[!c||i===`paused`?(0,E.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-bambu-dark/60`,children:c?(0,E.jsx)(S,{className:`h-8 w-8 text-bambu-gray/70`,"aria-hidden":`true`}):(0,E.jsx)(b,{className:`h-8 w-8 text-bambu-gray/70`,"aria-hidden":`true`})}):A?(0,E.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-1 bg-black/80 text-bambu-gray`,children:[(0,E.jsx)(S,{className:`h-7 w-7`,"aria-hidden":`true`}),(0,E.jsx)(`span`,{className:`text-xs`,children:x(`printers.camWall.noSignal`)})]}):(0,E.jsx)(`img`,{src:i===`live`?N:P,alt:t,draggable:!1,loading:`lazy`,className:`h-full w-full select-none object-contain`,style:{transform:I},onError:()=>j(!0)},`${i}-${w}`),R&&(0,E.jsxs)(`span`,{className:`absolute left-2 top-2 flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${k[L]}`,children:[y>0&&(0,E.jsx)(h,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,E.jsx)(`span`,{children:x(`printers.status.${L}`)})]}),(0,E.jsx)(`span`,{className:`absolute right-2 top-2 rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${i===`live`?`bg-red-500/80 text-white`:i===`snapshot`?`bg-amber-500/70 text-black`:`bg-bambu-dark-tertiary/70 text-bambu-gray`}`,children:x(i===`live`?`printers.camWall.live`:i===`snapshot`?`printers.camWall.snap`:`printers.camWall.off`)}),(0,E.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 via-black/55 to-transparent px-2 pb-1.5 pt-3 text-white`,children:[z&&(0,E.jsxs)(`div`,{className:`mb-0.5 space-y-0.5 text-[11px] leading-tight text-white/90`,children:[B&&(0,E.jsx)(`div`,{className:`truncate`,title:B,children:B}),(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-bambu-gray`,children:[V!=null&&(0,E.jsxs)(`span`,{className:`font-semibold text-white`,children:[V,`%`]}),H&&(0,E.jsx)(`span`,{children:x(`printers.camWall.layer`,{cur:m,total:g})}),U&&(0,E.jsx)(`span`,{children:x(`printers.camWall.timeLeft`,{time:_((p??0)*60)})})]})]}),(0,E.jsx)(`span`,{className:`block truncate text-xs font-medium`,children:t})]})]});return F?(0,E.jsx)(`button`,{type:`button`,onClick:l,className:W,title:t,children:G}):(0,E.jsx)(`div`,{className:W,title:t,children:G})}var j=new Set([`0700_8011`,`0701_8011`,`0702_8011`,`0703_8011`,`0704_8011`,`0705_8011`,`0706_8011`,`0707_8011`,`07FF_8011`]),M=`0500050000010007`;function N(e){switch(e){case 1:return{labelKey:`hmsErrors.severityError`,color:`text-red-600 dark:text-red-400`,bgColor:`bg-red-100 dark:bg-red-500/20`,Icon:h};case 2:return{labelKey:`hmsErrors.severityWarning`,color:`text-orange-700 dark:text-orange-400`,bgColor:`bg-orange-100 dark:bg-orange-500/20`,Icon:h};case 3:return{labelKey:`hmsErrors.severityNotice`,color:`text-blue-700 dark:text-blue-400`,bgColor:`bg-blue-100 dark:bg-blue-500/20`,Icon:f};default:return{labelKey:`hmsErrors.severityUnknown`,color:`text-bambu-gray`,bgColor:`bg-bambu-dark-tertiary`,Icon:d}}}function P(e){return e.severity===1||e.severity===2}function F(e,t){let n=e>>16&65535||(e>>8&255)<<8|e&255,r=t&65535;return`${n.toString(16).padStart(4,`0`).toUpperCase()}_${r.toString(16).padStart(4,`0`).toUpperCase()}`}function I(e){if(e.full_code&&e.full_code.length===16)return e.full_code.match(/.{4}/g).join(`-`);let t=parseInt(e.code.replace(`0x`,``),16)||0;return F(e.attr,t).replace(`_`,`-`)}function L(e){if(!(e.severity>=1))return!1;if((e.actions?.length??0)>0)return!0;let t=e.full_code?.length===16&&e.severity===3;return!!e.description&&!t}function R(e){return e.filter(L)}function z(e){return e.filter(e=>!L(e))}function B(){return`https://wiki.bambulab.com/en/hms/home`}function V({printerName:e,errors:t,onClose:n,printerId:r,hasPermission:a,runoutGuidance:l}){let{t:u}=o(),{showToast:f}=p(),_=s(),b=c({mutationFn:()=>i.clearHMSErrors(r),onSuccess:()=>{f(u(`hmsErrors.clearSuccess`),`success`),n()},onError:()=>{f(u(`hmsErrors.clearFailed`),`error`)}}),x=R(t),S=z(t);(0,C.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);let w=c({mutationFn:e=>i.executeHMSAction(r,{action:e.action,print_error:e.print_error,job_id:e.job_id}),onSuccess:()=>{_.invalidateQueries({queryKey:[`printerStatus`,r]}),f(u(`hmsErrors.actionSuccess`,`Action sent to printer`),`success`),n()},onError:e=>{f(`${u(`hmsErrors.actionFailed`,`Failed to send action`)}: ${e.message}`,`error`)}});return(0,E.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,E.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg shadow-xl max-w-lg w-full max-h-[80vh] flex flex-col`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(h,{className:`w-5 h-5 text-orange-600 dark:text-orange-400`}),(0,E.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:u(`hmsErrors.title`,{name:e})})]}),(0,E.jsx)(`button`,{onClick:n,className:`p-1 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,E.jsx)(g,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,E.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:x.length===0&&S.length===0?(0,E.jsxs)(`div`,{className:`text-center py-8 text-bambu-gray`,children:[(0,E.jsx)(d,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,E.jsx)(`p`,{children:u(`hmsErrors.noErrors`)})]}):(0,E.jsxs)(`div`,{className:`space-y-3`,children:[x.map((e,t)=>{let{labelKey:n,color:r,bgColor:i,Icon:o}=N(e.severity),s=parseInt(e.code.replace(`0x`,``),16)||0,c=F(e.attr,s),d=e.description||u(`hmsErrors.unknownCode`),f=e.full_code===M;f&&(d=u(`hmsErrors.mqttVerifyFailedDescription`));let p=f?u(`hmsErrors.mqttVerifyFailedRemedy`):null;l&&j.has(c)&&(d=l.expectedSlotLabel&&l.ranOutSlotLabel?u(`hmsErrors.runoutExpectedSlot`,{expected:l.expectedSlotLabel,ranOut:l.ranOutSlotLabel}):l.expectedSlotLabel?u(`hmsErrors.runoutExpectedSlotOnly`,{expected:l.expectedSlotLabel}):u(`hmsErrors.runoutSlotUnknown`));let h=B(),g=I(e);return(0,E.jsx)(`div`,{className:`p-4 rounded-lg ${i} border border-white/10`,children:(0,E.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,E.jsx)(o,{className:`w-5 h-5 ${r} flex-shrink-0 mt-0.5`}),(0,E.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,E.jsxs)(`span`,{className:`font-mono text-sm ${r}`,children:[`[`,g,`]`]}),(0,E.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${i} ${r}`,children:u(n)})]}),(0,E.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:d}),p&&(0,E.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:p}),e.actions&&e.actions.length>0&&(0,E.jsx)(`div`,{className:`flex flex-wrap gap-2 my-2`,children:e.actions.map(t=>{let n=w.variables,r=w.isPending&&n?.action===t&&n?.print_error===(e.full_code||c.replace(`_`,``));return(0,E.jsxs)(`button`,{onClick:()=>{w.mutate({action:t,print_error:e.full_code||c.replace(`_`,``),job_id:e.job_id??null})},disabled:!a(`printers:control`)||w.isPending,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg bg-white/10 hover:bg-white/20 active:bg-white/30 text-white border border-white/20 hover:border-white/30 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex-shrink-0`,children:[r&&(0,E.jsx)(m,{className:`w-4 h-4 animate-spin`}),u(`hmsErrors.actions.${t}`,t)]},t)})}),(0,E.jsxs)(`a`,{href:h,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-bambu-green hover:underline`,children:[(0,E.jsx)(y,{className:`w-3 h-3`}),u(`hmsErrors.viewOnWiki`)]})]})]})},`${e.code}-${t}`)}),S.length>0&&(0,E.jsxs)(`details`,{className:`rounded-lg border border-white/10 p-3`,"data-testid":`hms-uncounted`,children:[(0,E.jsx)(`summary`,{className:`cursor-pointer text-sm text-bambu-gray`,children:u(`hmsErrors.uncountedSummary`,{n:S.length})}),(0,E.jsx)(`p`,{className:`mt-2 text-xs text-bambu-gray`,children:u(`hmsErrors.uncountedHint`)}),(0,E.jsx)(`ul`,{className:`mt-2 space-y-2`,children:S.map((e,t)=>(0,E.jsxs)(`li`,{className:`text-xs`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(`span`,{className:`font-mono text-bambu-gray`,children:[`[`,I(e),`]`]}),(0,E.jsx)(`span`,{className:`text-bambu-gray`,children:u(N(e.severity).labelKey)})]}),e.description&&(0,E.jsx)(`p`,{className:`mt-0.5 text-bambu-gray`,children:e.description})]},`${e.full_code||e.code}-${t}`))})]})]})}),(0,E.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary flex items-center justify-between gap-3`,children:[(0,E.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:u(`hmsErrors.clearInstructions`)}),t.length>0&&(0,E.jsxs)(`button`,{onClick:()=>b.mutate(),disabled:!a(`printers:control`)||b.isPending,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-500/30 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex-shrink-0`,children:[b.isPending?(0,E.jsx)(m,{className:`w-4 h-4 animate-spin`}):(0,E.jsx)(v,{className:`w-4 h-4`}),u(`hmsErrors.clearErrors`)]})]})]})})}var H=1,U=16,W=2,G=60,K=[`off`,`compact`,`full`];function q({printers:e,maxLive:t,snapshotIntervalSec:n,statusMode:r,onTileClick:a,onChangeMaxLive:s,onChangeSnapshotIntervalSec:c,onChangeStatusMode:u,statuses:d,showSettings:f=!0,tileSize:p=2}){let{t:m}=o(),h=(0,C.useRef)(new Map),g=d?[]:e,_=l({queries:g.map(e=>({queryKey:[`printerStatus`,e.id],queryFn:()=>i.getPrinterStatus(e.id),staleTime:5e3}))}),v=(0,C.useMemo)(()=>{let e=new Map;return g.forEach((t,n)=>{e.set(t.id,_[n]?.data)}),e},[e,_,d]),y=d??v,[b,S]=(0,C.useState)(()=>new Set),[w,D]=(0,C.useState)(!1),O=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!w)return;let e=e=>{O.current&&!O.current.contains(e.target)&&D(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[w]),(0,C.useEffect)(()=>{let e=new IntersectionObserver(e=>{S(t=>{let n=new Set(t);for(let t of e){let e=Number(t.target.dataset.printerId);Number.isFinite(e)&&(t.isIntersecting?n.add(e):n.delete(e))}return n})},{threshold:.4});for(let[,t]of h.current)t&&e.observe(t);return()=>e.disconnect()},[e]);let k=(0,C.useMemo)(()=>{let n=new Map,r=Math.max(0,t);for(let t of e){let e=y.get(t.id)?.connected??!1;if(!b.has(t.id)||!e){n.set(t.id,`paused`);continue}r>0?(n.set(t.id,`live`),--r):n.set(t.id,`snapshot`)}return n},[e,b,t,y]);return e.length===0?(0,E.jsx)(`div`,{className:`rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-6 text-center text-bambu-gray`,children:m(`printers.camWall.noPrinters`)}):(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-bambu-gray`,children:[(0,E.jsx)(`span`,{children:m(`printers.camWall.summary`,{live:Array.from(k.values()).filter(e=>e===`live`).length,snap:Array.from(k.values()).filter(e=>e===`snapshot`).length,total:e.length})}),f&&(0,E.jsxs)(`div`,{className:`relative`,ref:O,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>D(e=>!e),className:`flex h-7 items-center gap-1 rounded-md border border-bambu-dark-tertiary bg-bambu-dark px-2 text-white hover:bg-bambu-dark-tertiary`,title:m(`printers.camWall.settings.title`),children:[(0,E.jsx)(x,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:m(`printers.camWall.settings.title`)})]}),w&&(0,E.jsxs)(`div`,{className:`absolute right-0 top-9 z-30 w-72 space-y-3 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark-secondary p-3 shadow-xl`,children:[(0,E.jsxs)(`label`,{className:`block space-y-1`,children:[(0,E.jsx)(`span`,{className:`text-xs font-medium text-white`,children:m(`printers.camWall.settings.maxLive`)}),(0,E.jsx)(`input`,{type:`number`,min:H,max:U,value:t,onChange:e=>{s(Math.min(U,Math.max(H,Number(e.target.value)||H)))},className:`w-full rounded-md border border-bambu-dark-tertiary bg-bambu-dark px-2 py-1 text-sm text-white`}),(0,E.jsx)(`span`,{className:`block text-[11px] text-bambu-gray`,children:m(`printers.camWall.settings.maxLiveHint`)})]}),(0,E.jsxs)(`label`,{className:`block space-y-1`,children:[(0,E.jsx)(`span`,{className:`text-xs font-medium text-white`,children:m(`printers.camWall.settings.snapshotInterval`)}),(0,E.jsx)(`input`,{type:`number`,min:W,max:G,value:n,onChange:e=>{c(Math.min(G,Math.max(W,Number(e.target.value)||W)))},className:`w-full rounded-md border border-bambu-dark-tertiary bg-bambu-dark px-2 py-1 text-sm text-white`}),(0,E.jsx)(`span`,{className:`block text-[11px] text-bambu-gray`,children:m(`printers.camWall.settings.snapshotIntervalHint`)})]}),(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`span`,{className:`block text-xs font-medium text-white`,children:m(`printers.camWall.settings.statusOverlay`)}),(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":m(`printers.camWall.settings.statusOverlay`),className:`flex overflow-hidden rounded-md border border-bambu-dark-tertiary`,children:K.map(e=>(0,E.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":r===e,onClick:()=>u(e),className:`flex-1 px-2 py-1 text-xs ${r===e?`bg-bambu-green text-black font-semibold`:`bg-bambu-dark text-white hover:bg-bambu-dark-tertiary`}`,children:m(`printers.camWall.statusMode.${e}`)},e))}),(0,E.jsx)(`span`,{className:`block text-[11px] text-bambu-gray`,children:m(`printers.camWall.settings.statusOverlayHint`)})]})]})]})]}),(0,E.jsx)(`div`,{className:`grid gap-3 ${T(p)}`,"data-testid":`camwall-grid`,children:e.map(e=>{let t=k.get(e.id)??`paused`;return(0,E.jsx)(`div`,{ref:t=>{h.current.set(e.id,t)},"data-printer-id":e.id,children:(0,E.jsx)(A,{printerId:e.id,printerName:e.name,cameraRotation:e.camera_rotation,mode:t,snapshotIntervalMs:n*1e3,connected:y.get(e.id)?.connected??!1,statusMode:r,printerState:y.get(e.id)?.state??null,progress:y.get(e.id)?.progress??null,remainingMin:y.get(e.id)?.remaining_time??null,layerNum:y.get(e.id)?.layer_num??null,totalLayers:y.get(e.id)?.total_layers??null,printName:y.get(e.id)?.subtask_name??y.get(e.id)?.gcode_file??null,hmsErrorCount:R(y.get(e.id)?.hms_errors??[]).length,onClick:a?()=>a(e.id,e.name):void 0})},e.id)})})]})}export{w as a,P as i,V as n,R as r,q as t}; \ No newline at end of file diff --git a/static/assets/Card-Bzc64K35.js b/static/assets/Card-Bzc64K35.js new file mode 100644 index 000000000..67fab9686 --- /dev/null +++ b/static/assets/Card-Bzc64K35.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n}from"./client-DnySrlFv.js";var r=e(n(),1),i=t(),a=(0,r.createContext)(`normal`);function o({density:e,children:t}){return(0,i.jsx)(a.Provider,{value:e,children:t})}function s({children:e,className:t=``,onClick:n,onContextMenu:r,...a}){return(0,i.jsx)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary card-shadow ${n?`cursor-pointer`:``} ${t}`,onClick:n,onContextMenu:r,...a,children:e})}function c({children:e,className:t=``,dense:n}){let o=(0,r.useContext)(a)===`dense`;return(0,i.jsx)(`div`,{className:`${n??o?`px-4 py-2.5`:`px-6 py-4`} border-b border-bambu-dark-tertiary ${t}`,children:e})}function l({children:e,className:t=``,dense:n}){let o=(0,r.useContext)(a)===`dense`;return(0,i.jsx)(`div`,{className:`${n??o?`p-4`:`p-6`} ${t}`,children:e})}export{c as i,l as n,o as r,s as t}; \ No newline at end of file diff --git a/static/assets/CartesianChart-BAcHzPFb.js b/static/assets/CartesianChart-BAcHzPFb.js new file mode 100644 index 000000000..d6f0a8da9 --- /dev/null +++ b/static/assets/CartesianChart-BAcHzPFb.js @@ -0,0 +1,33 @@ +import{i as e,n as t,t as n}from"./chunk-aKtaBQYM.js";import{D as r}from"./client-DnySrlFv.js";import{t as i}from"./react-dom-B8Dg6xzp.js";import{t as a}from"./createLucideIcon-DvBYJlWL.js";import{t as o}from"./with-selector-CsEuXInf.js";var s=a(`trending-down`,[[`path`,{d:`M16 17h6v-6`,key:`t6n2it`}],[`path`,{d:`m22 17-8.5-8.5-5 5L2 7`,key:`x473p`}]]),c=e(r());function l(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:d}=e,f=w(e,S),p=a||{width:r,height:i,x:0,y:0},m=u(`recharts-surface`,o);return c.createElement(`svg`,C({},v(f),{className:m,width:r,height:i,style:s,viewBox:`${p.x} ${p.y} ${p.width} ${p.height}`,ref:t}),c.createElement(`title`,null,l),c.createElement(`desc`,null,d),n)}),D=[`children`,`className`];function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=k(e,D),a=u(`recharts-layer`,r);return c.createElement(`g`,O({className:a},v(i),{ref:t}),n)}),A=(0,c.createContext)(null),j=()=>(0,c.useContext)(A);function M(e){return function(){return e}}var ne=Math.cos,re=Math.sin,ie=Math.sqrt,ae=Math.PI;ae/2;var oe=2*ae,se=Math.PI,ce=2*se,le=1e-6,ue=ce-le;function de(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return de;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tle)if(!(Math.abs(u*s-c*l)>le)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((se-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>le&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>le||Math.abs(this._y1-l)>le)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%ce+ce),d>ue?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>le&&this._append`A${n},${n},0,${+(d>=se)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function me(){return new pe}me.prototype=pe.prototype;function he(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new pe(t)}Array.prototype.slice;function ge(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function _e(e){this._context=e}_e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ve(e){return new _e(e)}function ye(e){return e[0]}function be(e){return e[1]}function xe(e,t){var n=M(!0),r=null,i=ve,a=null,o=he(s);e=typeof e==`function`?e:e===void 0?ye:M(e),t=typeof t==`function`?t:t===void 0?be:M(t);function s(s){var c,l=(s=ge(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return xe().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:M(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:M(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:M(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:M(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:M(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:M(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:M(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Ce=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function we(e){return new Ce(e,!0)}function Te(e){return new Ce(e,!1)}var Ee={draw(e,t){let n=ie(t/ae);e.moveTo(n,0),e.arc(0,0,n,0,oe)}},De={draw(e,t){let n=ie(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Oe=ie(1/3),ke=Oe*2,Ae={draw(e,t){let n=ie(t/ke),r=n*Oe;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},je={draw(e,t){let n=ie(t),r=-n/2;e.rect(r,r,n,n)}},Me=.8908130915292852,Ne=re(ae/10)/re(7*ae/10),Pe=re(oe/10)*Ne,Fe=-ne(oe/10)*Ne,Ie={draw(e,t){let n=ie(t*Me),r=Pe*n,i=Fe*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=oe*t/5,o=ne(a),s=re(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},Le=ie(3),Re={draw(e,t){let n=-ie(t/(Le*3));e.moveTo(0,n*2),e.lineTo(-Le*n,-n),e.lineTo(Le*n,-n),e.closePath()}},ze=-.5,Be=ie(3)/2,Ve=1/ie(12),He=(Ve/2+1)*3,Ue={draw(e,t){let n=ie(t/He),r=n/2,i=n*Ve,a=r,o=n*Ve+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(ze*r-Be*i,Be*r+ze*i),e.lineTo(ze*a-Be*o,Be*a+ze*o),e.lineTo(ze*s-Be*c,Be*s+ze*c),e.lineTo(ze*r+Be*i,ze*i-Be*r),e.lineTo(ze*a+Be*o,ze*o-Be*a),e.lineTo(ze*s+Be*c,ze*c-Be*s),e.closePath()}};function We(e,t){let n=null,r=he(i);e=typeof e==`function`?e:M(e||Ee),t=typeof t==`function`?t:M(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:M(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:M(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Ge(){}function Ke(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function qe(e){this._context=e}qe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ke(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ke(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Je(e){return new qe(e)}function Ye(e){this._context=e}Ye.prototype={areaStart:Ge,areaEnd:Ge,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ke(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Xe(e){return new Ye(e)}function Ze(e){this._context=e}Ze.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ke(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Qe(e){return new Ze(e)}function $e(e){this._context=e}$e.prototype={areaStart:Ge,areaEnd:Ge,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function et(e){return new $e(e)}function tt(e){return e<0?-1:1}function nt(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(tt(a)+tt(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function rt(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function it(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function at(e){this._context=e}at.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:it(this,this._t0,rt(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,it(this,rt(this,n=nt(this,e,t)),n);break;default:it(this,this._t0,n=nt(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function ot(e){this._context=new st(e)}(ot.prototype=Object.create(at.prototype)).point=function(e,t){at.prototype.point.call(this,t,e)};function st(e){this._context=e}st.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function ct(e){return new at(e)}function lt(e){return new ot(e)}function ut(e){this._context=e}ut.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=dt(e),i=dt(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function mt(e){return new pt(e,.5)}function ht(e){return new pt(e,0)}function gt(e){return new pt(e,1)}function _t(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function yt(e,t){return e[t]}function bt(e){let t=[];return t.key=e,t}function xt(){var e=M([]),t=vt,n=_t,r=yt;function i(i){var a=Array.from(e.apply(this,arguments),bt),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e===`__proto__`}e.isUnsafeProperty=t})),Et=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}e.isDeepKey=t})),Dt=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}e.toKey=t})),Ot=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(t).join(`,`);let n=String(e);return n===`0`&&Object.is(Number(e),-0)?`-0`:n}e.toString=t})),kt=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Ot(),n=Dt();function r(e){if(Array.isArray(e))return e.map(n.toKey);if(typeof e==`symbol`)return[e];e=t.toString(e);let r=[],i=e.length;if(i===0)return r;let a=0,o=``,s=``,c=!1;for(e.charCodeAt(0)===46&&(r.push(``),a++);a{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Tt(),n=Et(),r=Dt(),i=kt();function a(e,s,c){if(e==null)return c;switch(typeof s){case`string`:{if(t.isUnsafeProperty(s))return c;let r=e[s];return r===void 0?n.isDeepKey(s)?a(e,i.toPath(s),c):c:r}case`number`:case`symbol`:{typeof s==`number`&&(s=r.toKey(s));let t=e[s];return t===void 0?c:t}default:{if(Array.isArray(s))return o(e,s,c);if(s=Object.is(s?.valueOf(),-0)?`-0`:String(s),t.isUnsafeProperty(s))return c;let n=e[s];return n===void 0?c:n}}}function o(e,n,r){if(n.length===0)return r;let i=e;for(let e=0;e{t.exports=At().get})),Mt=e(jt()),Nt=4;function Pt(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nt),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function N(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+Pt(i)+n},``)}var Ft=e=>e===0?0:e>0?1:-1,It=e=>typeof e==`number`&&e!=+e,Lt=e=>typeof e==`string`&&e.indexOf(`%`)===e.length-1,P=e=>(typeof e==`number`||e instanceof Number)&&!It(e),Rt=e=>P(e)||typeof e==`string`,zt=0,Bt=e=>{var t=++zt;return`${e||``}${t}`},Vt=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!P(e)&&typeof e!=`string`)return n;var i;if(Lt(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return It(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},Ht=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):(0,Mt.default)(e,t))===n)}var F=e=>e==null,Gt=e=>F(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function Kt(e){return e!=null}function qt(){}var Jt=[`type`,`size`,`sizeType`];function Yt(){return Yt=Object.assign?Object.assign.bind():function(e){for(var t=1;trn[`symbol${Gt(e)}`]||Ee,sn=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*an;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},cn=(e,t)=>{rn[`symbol${Gt(e)}`]=t},ln=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=Zt(Zt({},tn(e,Jt)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=on(a),t=We().type(e).size(sn(n,r,a))();if(t!==null)return t},{className:s,cx:l,cy:d}=i,f=v(i);return P(l)&&P(d)&&P(n)?c.createElement(`path`,Yt({},f,{className:u(`recharts-symbols`,s),transform:`translate(${l}, ${d})`,d:o()})):null};ln.registerSymbol=cn;var un=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,dn=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,c.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{f(e)&&(r[e]=t||(t=>n[e](n,t)))}),r},fn=(e,t,n)=>r=>(e(t,n,r),null),pn=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];f(i)&&typeof a==`function`&&(r||={},r[i]=fn(a,t,n))}),r};function mn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hn(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}var bn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){let n=new Map;for(let r=0;r{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}e.ary=t})),Sn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e}e.identity=t})),Cn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return Number.isSafeInteger(e)&&e>=0}e.isLength=t})),wn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Cn();function n(e){return e!=null&&typeof e!=`function`&&t.isLength(e.length)}e.isArrayLike=n})),Tn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`object`&&!!e}e.isObjectLike=t})),En=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=wn(),n=Tn();function r(e){return n.isObjectLike(e)&&t.isArrayLike(e)}e.isArrayLikeObject=r})),Dn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=At();function n(e){return function(n){return t.get(n,e)}}e.property=n})),On=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}e.isObject=t})),kn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e==null||typeof e!=`object`&&typeof e!=`function`}e.isPrimitive=t})),An=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}e.isEqualsSameValueZero=t})),jn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=On(),n=kn(),r=An();function i(e,t,n){return typeof n==`function`?a(e,t,function e(t,r,i,o,s,c){let l=n(t,r,i,o,s,c);return l===void 0?a(t,r,e,c):!!l},new Map):i(e,t,()=>void 0)}function a(e,n,i,s){if(n===e)return!0;switch(typeof n){case`object`:return o(e,n,i,s);case`function`:return Object.keys(n).length>0?a(e,{...n},i,s):r.isEqualsSameValueZero(e,n);default:return t.isObject(e)?typeof n==`string`?n===``:!0:r.isEqualsSameValueZero(e,n)}}function o(e,t,r,i){if(t==null)return!0;if(Array.isArray(t))return c(e,t,r,i);if(t instanceof Map)return s(e,t,r,i);if(t instanceof Set)return l(e,t,r,i);let a=Object.keys(t);if(e==null||n.isPrimitive(e))return a.length===0;if(a.length===0)return!0;if(i?.has(t))return i.get(t)===e;i?.set(t,e);try{for(let o=0;o{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=jn();function n(e,n){return t.isMatchWith(e,n,()=>void 0)}e.isMatch=n})),Nn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}e.getSymbols=t})),Pn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}e.getTag=t})),Fn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),e.argumentsTag=`[object Arguments]`,e.arrayBufferTag=`[object ArrayBuffer]`,e.arrayTag=`[object Array]`,e.bigInt64ArrayTag=`[object BigInt64Array]`,e.bigUint64ArrayTag=`[object BigUint64Array]`,e.booleanTag=`[object Boolean]`,e.dataViewTag=`[object DataView]`,e.dateTag=`[object Date]`,e.errorTag=`[object Error]`,e.float32ArrayTag=`[object Float32Array]`,e.float64ArrayTag=`[object Float64Array]`,e.functionTag=`[object Function]`,e.int16ArrayTag=`[object Int16Array]`,e.int32ArrayTag=`[object Int32Array]`,e.int8ArrayTag=`[object Int8Array]`,e.mapTag=`[object Map]`,e.numberTag=`[object Number]`,e.objectTag=`[object Object]`,e.regexpTag=`[object RegExp]`,e.setTag=`[object Set]`,e.stringTag=`[object String]`,e.symbolTag=`[object Symbol]`,e.uint16ArrayTag=`[object Uint16Array]`,e.uint32ArrayTag=`[object Uint32Array]`,e.uint8ArrayTag=`[object Uint8Array]`,e.uint8ClampedArrayTag=`[object Uint8ClampedArray]`})),In=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}e.isTypedArray=t})),Ln=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Nn(),n=Pn(),r=Fn(),i=kn(),a=In();function o(e,t){return s(e,void 0,e,new Map,t)}function s(e,t,n,r=new Map,o=void 0){let u=o?.(e,t,n,r);if(u!==void 0)return u;if(i.isPrimitive(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let i=0;i{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Ln();function n(e){return t.cloneDeepWithImpl(e,void 0,e,new Map,void 0)}e.cloneDeep=n})),zn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Mn(),n=Rn();function r(e){return e=n.cloneDeep(e),n=>t.isMatch(n,e)}e.matches=r})),Bn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Ln(),n=Pn(),r=Fn();function i(e,i){return t.cloneDeepWith(e,(a,o,s,c)=>{let l=i?.(a,o,s,c);if(l!==void 0)return l;if(typeof e==`object`){if(n.getTag(e)===r.objectTag&&typeof e.constructor!=`function`){let n={};return c.set(e,n),t.copyProperties(n,e,s,c),n}switch(Object.prototype.toString.call(e)){case r.numberTag:case r.stringTag:case r.booleanTag:{let n=new e.constructor(e?.valueOf());return t.copyProperties(n,e),n}case r.argumentsTag:{let n={};return t.copyProperties(n,e),n.length=e.length,n[Symbol.iterator]=e[Symbol.iterator],n}default:return}}})}e.cloneDeepWith=i})),Vn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Bn();function n(e){return t.cloneDeepWith(e)}e.cloneDeep=n})),Hn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=/^(?:0|[1-9]\d*)$/;function n(e,n=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Pn();function n(e){return typeof e==`object`&&!!e&&t.getTag(e)===`[object Arguments]`}e.isArguments=n})),Wn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Et(),n=Hn(),r=Un(),i=kt();function a(e,a){let o;if(o=Array.isArray(a)?a:typeof a==`string`&&t.isDeepKey(a)&&e?.[a]==null?i.toPath(a):[a],o.length===0)return!1;let s=e;for(let e=0;e{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Mn(),n=Dt(),r=Vn(),i=At(),a=Wn();function o(e,o){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=n.toKey(e);break}return o=r.cloneDeep(o),function(n){let r=i.get(n,e);return r===void 0?a.has(n,e):o===void 0?r===void 0:t.isMatch(r,o)}}e.matchesProperty=o})),Kn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Sn(),n=Dn(),r=zn(),i=Gn();function a(e){if(e==null)return t.identity;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?i.matchesProperty(e[0],e[1]):r.matches(e);case`string`:case`symbol`:case`number`:return n.property(e)}}e.iteratee=a})),qn=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=bn(),n=xn(),r=Sn(),i=En(),a=Kn();function o(e,o=r.identity){return i.isArrayLikeObject(e)?t.uniqBy(Array.from(e),n.ary(a.iteratee(o),1)):[]}e.uniqBy=o})),Jn=e(n(((e,t)=>{t.exports=qn().uniqBy}))());function Yn(e,t,n){return t===!0?(0,Jn.default)(e,n):typeof t==`function`?(0,Jn.default)(e,t):e}var Xn=(0,c.createContext)(null),Zn=e=>e,I=()=>{var e=(0,c.useContext)(Xn);return e?e.store.dispatch:Zn},Qn=()=>{},$n=()=>Qn,er=(e,t)=>e===t;function L(e){var t=(0,c.useContext)(Xn),n=(0,c.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Qn,[t,e]);return(0,x.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:$n,t?t.store.getState:Qn,t?t.store.getState:Qn,n,er)}function tr(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function nr(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function rr(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var ir=e=>Array.isArray(e)?e:[e];function ar(e){let t=Array.isArray(e[0])?e[0]:e;return rr(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function or(e,t){let n=[],{length:r}=e;for(let i=0;i{n=dr(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function pr(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),tr(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=fr,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=ir(c),p=ir(u),m=ar(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=or(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var R=pr(fr),mr=Object.assign((e,t=R)=>{nr(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>mr}),hr=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}e.compareValues=(e,n,r)=>{if(e!==n){let i=t(e),a=t(n);if(i===a&&i===0){if(en)return r===`desc`?-1:1}return r===`desc`?a-i:i-a}return 0}})),gr=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`symbol`||e instanceof Symbol}e.isSymbol=t})),_r=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=gr(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(e,i){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||t.isSymbol(e)?!0:typeof e==`string`&&(r.test(e)||!n.test(e))||i!=null&&Object.hasOwn(i,e)}e.isKey=i})),vr=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=hr(),n=_r(),r=kt();function i(e,i,a,o){if(e==null)return[];a=o?void 0:a,Array.isArray(e)||(e=Object.values(e)),Array.isArray(i)||(i=i==null?[null]:[i]),i.length===0&&(i=[null]),Array.isArray(a)||(a=a==null?[]:[a]),a=a.map(e=>String(e));let s=(e,t)=>{let n=e;for(let e=0;et==null||e==null?t:typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:s(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?s(t,e):typeof t==`object`?t[e]:t,l=i.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||n.isKey(e)?e:{key:e,path:r.toPath(e)}));return e.map(e=>({original:e,criteria:l.map(t=>c(t,e))})).slice().sort((e,n)=>{for(let r=0;re.original)}e.orderBy=i})),yr=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Hn(),n=wn(),r=On(),i=An();function a(e,a,o){return r.isObject(o)&&(typeof a==`number`&&n.isArrayLike(o)&&t.isIndex(a)&&a{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=vr(),n=yr(),r=br();function i(e,...i){let a=i.length;return a>1&&r.isIterateeCall(e,i[0],i[1])?i=[]:a>2&&r.isIterateeCall(i[0],i[1],i[2])&&(i=[i[0]]),t.orderBy(e,n.flatten(i),[`asc`])}e.sortBy=i})),Sr=e(n(((e,t)=>{t.exports=xr().sortBy}))()),Cr=e=>e.legend.settings,wr=e=>e.legend.size,Tr=R([e=>e.legend.payload,Cr],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,Sr.default)(r,n):r}),Er=1;function Dr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=(0,c.useState)({height:0,left:0,top:0,width:0});return[t,(0,c.useCallback)(e=>{if(e!=null){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>Er||Math.abs(i.left-t.left)>Er||Math.abs(i.top-t.top)>Er||Math.abs(i.width-t.width)>Er)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e])]}function Or(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var kr=typeof Symbol==`function`&&Symbol.observable||`@@observable`,Ar=()=>Math.random().toString(36).substring(7).split(``).join(`.`),jr={INIT:`@@redux/INIT${Ar()}`,REPLACE:`@@redux/REPLACE${Ar()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ar()}`};function Mr(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Nr(e,t,n){if(typeof e!=`function`)throw Error(Or(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(Or(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(Or(1));return n(Nr)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(Or(3));return i}function d(e){if(typeof e!=`function`)throw Error(Or(4));if(c)throw Error(Or(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(Or(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!Mr(e))throw Error(Or(7));if(e.type===void 0)throw Error(Or(8));if(typeof e.type!=`string`)throw Error(Or(17));if(c)throw Error(Or(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(Or(10));r=e,f({type:jr.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(Or(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[kr](){return this}}}return f({type:jr.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[kr]:m}}function Pr(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:jr.INIT})===void 0)throw Error(Or(12));if(n(void 0,{type:jr.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(Or(13))})}function Fr(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function Lr(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(Or(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=Ir(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function Rr(e){return Mr(e)&&`type`in e&&typeof e.type==`string`}var zr=Symbol.for(`immer-nothing`),Br=Symbol.for(`immer-draftable`),Vr=Symbol.for(`immer-state`);function Hr(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ur=Object,Wr=Ur.getPrototypeOf,Gr=`constructor`,Kr=`prototype`,qr=`configurable`,Jr=`enumerable`,Yr=`writable`,Xr=`value`,Zr=e=>!!e&&!!e[Vr];function Qr(e){return e?ti(e)||ci(e)||!!e[Br]||!!e[Gr]?.[Br]||li(e)||ui(e):!1}var $r=Ur[Kr][Gr].toString(),ei=new WeakMap;function ti(e){if(!e||!di(e))return!1;let t=Wr(e);if(t===null||t===Ur[Kr])return!0;let n=Ur.hasOwnProperty.call(t,Gr)&&t[Gr];if(n===Object)return!0;if(!fi(n))return!1;let r=ei.get(n);return r===void 0&&(r=Function.toString.call(n),ei.set(n,r)),r===$r}function ni(e,t,n=!0){ri(e)===0?(n?Reflect.ownKeys(e):Ur.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ri(e){let t=e[Vr];return t?t.type_:ci(e)?1:li(e)?2:ui(e)?3:0}var ii=(e,t,n=ri(e))=>n===2?e.has(t):Ur[Kr].hasOwnProperty.call(e,t),ai=(e,t,n=ri(e))=>n===2?e.get(t):e[t],oi=(e,t,n,r=ri(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function si(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var ci=Array.isArray,li=e=>e instanceof Map,ui=e=>e instanceof Set,di=e=>typeof e==`object`,fi=e=>typeof e==`function`,pi=e=>typeof e==`boolean`;function mi(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var hi=e=>e.copy_||e.base_,gi=e=>e.modified_?e.copy_:e.base_;function _i(e,t){if(li(e))return new Map(e);if(ui(e))return new Set(e);if(ci(e))return Array[Kr].slice.call(e);let n=ti(e);if(t===!0||t===`class_only`&&!n){let t=Ur.getOwnPropertyDescriptors(e);delete t[Vr];let n=Reflect.ownKeys(t);for(let r=0;r1&&Ur.defineProperties(e,{set:bi,add:bi,clear:bi,delete:bi}),Ur.freeze(e),t&&ni(e,(e,t)=>{vi(t,!0)},!1),e)}function yi(){Hr(2)}var bi={[Xr]:yi};function xi(e){return e===null||!di(e)?!0:Ur.isFrozen(e)}var Si=`MapSet`,Ci=`Patches`,wi=`ArrayMethods`,Ti={};function Ei(e){let t=Ti[e];return t||Hr(0,e),t}var Di=e=>!!Ti[e],Oi,ki=()=>Oi,Ai=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Di(Si)?Ei(Si):void 0,arrayMethodsPlugin_:Di(wi)?Ei(wi):void 0});function ji(e,t){t&&(e.patchPlugin_=Ei(Ci),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Mi(e){Ni(e),e.drafts_.forEach(Fi),e.drafts_=null}function Ni(e){e===Oi&&(Oi=e.parent_)}var Pi=e=>Oi=Ai(Oi,e);function Fi(e){let t=e[Vr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ii(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[Vr].modified_&&(Mi(t),Hr(4)),Qr(e)&&(e=Li(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Vr].base_,e,t)}else e=Li(t,n);return Ri(t,e,!0),Mi(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===zr?void 0:e}function Li(e,t){if(xi(t))return t;let n=t[Vr];if(!n)return Ki(t,e.handledSet_,e);if(!Bi(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);Wi(n,e)}return n.copy_}function Ri(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&vi(t,n)}function zi(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Bi=(e,t)=>e.scope_===t,Vi=[];function Hi(e,t,n,r){let i=hi(e),a=e.type_;if(r!==void 0&&ai(i,r,a)===t){oi(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;ni(i,(e,n)=>{if(Zr(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Vi;for(let e of o)oi(i,e,n,a)}function Ui(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!Bi(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=gi(i);Hi(e,i.draft_??i,a,n),Wi(i,r)})}function Wi(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}zi(e)}}function Gi(e,t,n){let{scope_:r}=e;if(Zr(n)){let i=n[Vr];Bi(i,r)&&i.callbacks_.push(function(){ea(e),Hi(e,n,gi(i),t)})}else Qr(n)&&e.callbacks_.push(function(){let i=hi(e);e.type_===3?i.has(n)&&Ki(n,r.handledSet_,r):ai(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ki(ai(e.copy_,t,e.type_),r.handledSet_,r)})}function Ki(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Zr(e)||t.has(e)||!Qr(e)||xi(e)?e:(t.add(e),ni(e,(r,i)=>{if(Zr(i)){let t=i[Vr];Bi(t,n)&&(oi(e,r,gi(t),e.type_),zi(t))}else Qr(i)&&Ki(i,t,n)}),e)}function qi(e,t){let n=ci(e),r={type_:+!!n,scope_:t?t.scope_:ki(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=Ji;n&&(i=[r],a=Yi);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var Ji={get(e,t){if(t===Vr)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=hi(e);if(!ii(i,t,e.type_))return Zi(e,i,t);let a=i[t];if(e.finalized_||!Qr(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&mi(t))return a;if(a===Xi(e.base_,t)){ea(e);let n=e.type_===1?+t:t,r=na(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in hi(e)},ownKeys(e){return Reflect.ownKeys(hi(e))},set(e,t,n){let r=Qi(hi(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Xi(hi(e),t),i=r?.[Vr];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(si(n,r)&&(n!==void 0||ii(e.base_,t,e.type_)))return!0;ea(e),$i(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Gi(e,t,n),!0)},deleteProperty(e,t){return ea(e),Xi(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),$i(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=hi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Yr]:!0,[qr]:e.type_!==1||t!==`length`,[Jr]:r[Jr],[Xr]:n[t]}},defineProperty(){Hr(11)},getPrototypeOf(e){return Wr(e.base_)},setPrototypeOf(){Hr(12)}},Yi={};for(let e in Ji){let t=Ji[e];Yi[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}Yi.deleteProperty=function(e,t){return Yi.set.call(this,e,t,void 0)},Yi.set=function(e,t,n){return Ji.set.call(this,e[0],t,n,e[0])};function Xi(e,t){let n=e[Vr];return(n?hi(n):e)[t]}function Zi(e,t,n){let r=Qi(t,n);return r?Xr in r?r[Xr]:r.get?.call(e.draft_):void 0}function Qi(e,t){if(!(t in e))return;let n=Wr(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Wr(n)}}function $i(e){e.modified_||(e.modified_=!0,e.parent_&&$i(e.parent_))}function ea(e){e.copy_||=(e.assigned_=new Map,_i(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ta=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(fi(e)&&!fi(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}fi(t)||Hr(6),n!==void 0&&!fi(n)&&Hr(7);let r;if(Qr(e)){let i=Pi(this),a=na(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Mi(i):Ni(i)}return ji(i,n),Ii(r,i)}else if(!e||!di(e)){if(r=t(e),r===void 0&&(r=e),r===zr&&(r=void 0),this.autoFreeze_&&vi(r,!0),n){let t=[],i=[];Ei(Ci).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}else Hr(1,e)},this.produceWithPatches=(e,t)=>{if(fi(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},pi(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),pi(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),pi(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Qr(e)||Hr(8),Zr(e)&&(e=ra(e));let t=Pi(this),n=na(t,e,void 0);return n[Vr].isManual_=!0,Ni(t),n}finishDraft(e,t){let n=e&&e[Vr];(!n||!n.isManual_)&&Hr(9);let{scope_:r}=n;return ji(r,t),Ii(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Ei(Ci).applyPatches_;return Zr(e)?r(e,t):this.produce(e,e=>r(e,t))}};function na(e,t,n,r){let[i,a]=li(t)?Ei(Si).proxyMap_(t,n):ui(t)?Ei(Si).proxySet_(t,n):qi(t,n);return(n?.scope_??ki()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Ui(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function ra(e){return Zr(e)||Hr(10,e),ia(e)}function ia(e){if(!Qr(e)||xi(e))return e;let t=e[Vr],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=_i(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=_i(e,!0);return ni(n,(e,t)=>{oi(n,e,ia(t))},r),t&&(t.finalized_=!1),n}var aa=new ta().produce;function oa(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var sa=oa(),ca=oa,la=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?Ir:Ir.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function ua(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(vo(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Rr(t)&&t.type===e,n}var da=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function fa(e){return Qr(e)?aa(e,()=>{}):e}function pa(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function ma(e){return typeof e==`boolean`}var ha=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new da;return t&&(ma(t)?a.push(sa):a.push(ca(t.extraArgument))),a},ga=`RTK_autoBatch`,z=()=>e=>({payload:e,meta:{[ga]:!0}}),_a=e=>t=>{setTimeout(t,e)},va=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?window.requestAnimationFrame:_a(10):e.type===`callback`?e.queueNotification:_a(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[ga],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},ya=e=>function(t){let{autoBatch:n=!0}=t??{},r=new da(e);return n&&r.push(va(typeof n==`object`?n:void 0)),r};function ba(e){let t=ha(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(Mr(n))c=Fr(n);else throw Error(vo(1));let l;l=typeof r==`function`?r(t):t();let u=Ir;i&&(u=la({trace:!1,...typeof i==`object`&&i}));let d=ya(Lr(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return Nr(c,o,p)}function xa(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(vo(28));if(r in t)throw Error(vo(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function Sa(e){return typeof e==`function`}function Ca(e,t){let[n,r,i]=xa(t),a;if(Sa(e))a=()=>fa(e());else{let t=fa(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n)if(Zr(e)){let r=n(e,t);return r===void 0?e:r}else if(Qr(e))return aa(e,e=>n(e,t));else{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}return e},e)}return o.getInitialState=a,o}var wa=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Ta=(e=21)=>{let t=``,n=e;for(;n--;)t+=wa[Math.random()*64|0];return t},Ea=Symbol.for(`rtk-slice-createasyncthunk`);function Da(e,t){return`${e}/${t}`}function Oa({creators:e}={}){let t=e?.asyncThunk?.[Ea];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(vo(11));let i=(typeof e.reducers==`function`?e.reducers(ja()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(vo(12));if(n in o.sliceCaseReducersByType)throw Error(vo(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:Da(n,r),createNotation:typeof e.reducers==`function`};Na(a)?Fa(o,a,s,t):Ma(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?xa(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return Ca(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=pa(d,r,m)),i}function i(t=l){return pa(pa(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=ka(a,t,()=>pa(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function ka(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var Aa=Oa();function ja(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function Ma({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!Pa(r))throw Error(vo(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?ua(e,o):ua(e))}function Na(e){return e._reducerDefinitionType===`asyncThunk`}function Pa(e){return e._reducerDefinitionType===`reducerWithPrepare`}function Fa({type:e,reducerName:t},n,r,i){if(!i)throw Error(vo(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||Ia,pending:s||Ia,rejected:c||Ia,settled:l||Ia})}function Ia(){}var La=`task`,Ra=`listener`,za=`completed`,Ba=`cancelled`,Va=`task-${Ba}`,Ha=`task-${za}`,Ua=`${Ra}-${Ba}`,Wa=`${Ra}-${za}`,Ga=class{constructor(e){this.code=e,this.message=`${La} ${Ba} (reason: ${e})`}name=`TaskAbortError`;message},Ka=(e,t)=>{if(typeof e!=`function`)throw TypeError(vo(32))},qa=()=>{},Ja=(e,t=qa)=>(e.catch(t),e),Ya=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),Xa=e=>{if(e.aborted)throw new Ga(e.reason)};function Za(e,t){let n=qa;return new Promise((r,i)=>{let a=()=>i(new Ga(e.reason));if(e.aborted){a();return}n=Ya(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=qa})}var Qa=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof Ga?`cancelled`:`rejected`,error:e}}finally{t?.()}},$a=e=>t=>Ja(Za(e,t).then(t=>(Xa(e),t))),eo=e=>{let t=$a(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:to}=Object,no={},ro=`listenerMiddleware`,io=(e,t)=>{let n=t=>Ya(e,()=>t.abort(e.reason));return(r,i)=>{Ka(r,`taskExecutor`);let a=new AbortController;n(a);let o=Qa(async()=>{Xa(e),Xa(a.signal);let t=await r({pause:$a(a.signal),delay:eo(a.signal),signal:a.signal});return Xa(a.signal),t},()=>a.abort(Ha));return i?.autoJoin&&t.push(o.catch(qa)),{result:$a(e)(o),cancel(){a.abort(Va)}}}},ao=(e,t)=>{let n=async(n,r)=>{Xa(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await Za(t,Promise.race(a));return Xa(t),e}finally{i()}};return(e,t)=>Ja(n(e,t))},oo=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=ua(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(vo(21));return Ka(a,`options.listener`),{predicate:i,type:t,effect:a}},so=to(e=>{let{type:t,predicate:n,effect:r}=oo(e);return{id:Ta(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(vo(22))}}},{withTypes:()=>so}),co=(e,t)=>{let{type:n,effect:r,predicate:i}=oo(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},lo=e=>{e.pending.forEach(e=>{e.abort(Ua)})},uo=(e,t)=>()=>{for(let e of t.keys())lo(e);e.clear()},fo=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},po=to(ua(`${ro}/add`),{withTypes:()=>po}),mo=ua(`${ro}/removeAll`),ho=to(ua(`${ro}/remove`),{withTypes:()=>ho}),go=(...e)=>{console.error(`${ro}/error`,...e)},_o=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=go}=e;Ka(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&lo(e)}),c=e=>s(co(t,e)??so(e));to(c,{withTypes:()=>c});let l=e=>{let n=co(t,e);return n&&(n.unsubscribe(),e.cancelActive&&lo(n)),!!n};to(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=ao(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,to({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:eo(u.signal),pause:$a(u.signal),extra:a,signal:u.signal,fork:io(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(Ua),n.delete(e))})},cancel:()=>{u.abort(Ua),e.pending.delete(u)},throwIfCancelled:()=>{Xa(u.signal)}})))}catch(e){e instanceof Ga||fo(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(Wa),i(e),e.pending.delete(u)}},d=uo(t,n);return{middleware:e=>n=>r=>{if(!Rr(r))return n(r);if(po.match(r))return c(r.payload);if(mo.match(r)){d();return}if(ho.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===no)throw Error(vo(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,fo(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=no}return s},startListening:c,stopListening:l,clearListeners:d}};function vo(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var yo=Aa({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),{setMargin:bo,setLayout:xo,setChartSize:So,setScale:Co}=yo.actions,wo=yo.reducer;function To(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function B(e){return Number.isFinite(e)}function Eo(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function Do(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Oo(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&P(e[a]))return Oo(Oo({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&P(e[o]))return Oo(Oo({},e),{},{[o]:e[o]+(i||0)})}return e},Po=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,Fo=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},Io=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:d,niceTicks:f,axisType:p}=e;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?Ft(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return B(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(Kt):c&&l?l.map((e,t)=>{var n=o.map(e);return B(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Kt):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return B(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Kt):o.domain().map((e,t)=>{var n=o.map(e);return B(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(Kt)},Lo=(e,t)=>{if(!t||t.length!==2||!P(t[0])||!P(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!P(e[0])||e[0]r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:St,none:_t,silhouette:Ct,wiggle:wt,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},zo=(e,t,n)=>{var r=Ro[n]??_t,i=xt().keys(t).value((e,t)=>Number(Mo(e,t,0))).order(vt).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=Mo(e[i],t[r],0);Array.isArray(a)&&a.length===2&&P(a[0])&&P(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function Bo(e){return e==null?void 0:String(e)}function Vo(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!F(i[t.dataKey])){var s=Wt(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=Mo(i,F(o)?t.dataKey:o),l=t.scale.map(c);return P(l)?l:null}var Ho=e=>{var{axis:t,ticks:n,offset:r,bandSize:i,entry:a,index:o}=e;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=Mo(a,t.dataKey,t.scale.domain()[o]);if(F(s))return null;var c=t.scale.map(s);return P(c)?c-i/2+r:null},Uo=e=>{var{numericAxis:t}=e,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},Wo=e=>{var t=e.flat(2).filter(P);return[Math.min(...t),Math.max(...t)]},Go=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Ko=(e,t,n)=>{if(e!=null)return Go(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i=Wo(To(r,t,n));return!B(i[0])||!B(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},qo=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Jo=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Yo=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,Sr.default)(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o{if(t===`horizontal`)return e.chartX;if(t===`vertical`)return e.chartY},$o=(e,t)=>t===`centric`?e.angle:e.radius,es=e=>e.layout.width,ts=e=>e.layout.height,ns=e=>e.layout.scale,rs=e=>e.layout.margin,is=R(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),as=R(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),os=`data-recharts-item-index`,ss=`data-recharts-item-id`;function cs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ls(e){for(var t=1;te.brush.height;function ms(e){return as(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function hs(e){return as(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function gs(e){return is(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+t.height:e,0)}function _s(e){return is(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+t.height:e,0)}var vs=R([es,ts,rs,ps,ms,hs,gs,_s,Cr,wr],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=ls(ls({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=No(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return ls(ls({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),ys=R(vs,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),bs=R(es,ts,(e,t)=>({x:0,y:0,width:e,height:t})),xs=(0,c.createContext)(null),Ss=()=>(0,c.useContext)(xs)!=null,Cs=e=>e.brush,ws=R([Cs,vs,rs],(e,t,n)=>({height:e.height,x:P(e.x)?e.x:t.left,y:P(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:P(e.width)?e.width:t.width})),Ts=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}e.debounce=t})),Es=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Ts();function n(e,n=0,r={}){typeof r!=`object`&&(r={});let{leading:i=!1,trailing:a=!0,maxWait:o}=r,s=[,,];i&&(s[0]=`leading`),a&&(s[1]=`trailing`);let c,l=null,u=t.debounce(function(...t){c=e.apply(this,t),l=null},n,{edges:s}),d=function(...t){return o!=null&&(l===null&&(l=Date.now()),Date.now()-l>=o)?(c=e.apply(this,t),l=Date.now(),u.cancel(),u.schedule(),c):(u.apply(this,t),c)};return d.cancel=u.cancel,d.flush=()=>(u.flush(),c),d}e.debounce=n})),Ds=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Es();function n(e,n=0,r={}){let{leading:i=!0,trailing:a=!0}=r;return t.debounce(e,n,{leading:i,maxWait:n,trailing:a})}e.throttle=n})),Os=e(n(((e,t)=>{t.exports=Ds().throttle}))()),ks=!0,As=function(e,t){var n=[...arguments].slice(2);if(ks&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}},js={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Ms=(e,t,n)=>{var{width:r=js.width,height:i=js.height,aspect:a,maxHeight:o}=n,s=Lt(r)?e:Number(r),c=Lt(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},Ns={width:0,height:0,overflow:`visible`},Ps={width:0,overflowX:`visible`},Fs={height:0,overflowY:`visible`},Is={},Ls=e=>{var{width:t,height:n}=e,r=Lt(t),i=Lt(n);return r&&i?Ns:r?Ps:i?Fs:Is};function Rs(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=js.width,a=js.height):i===void 0?i=r&&r>0?void 0:js.width:a===void 0&&(a=r&&r>0?void 0:js.height),{width:i,height:a}}function zs(){return zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return Ks(i)?c.createElement(Gs.Provider,{value:i},t):null}var Js=()=>(0,c.useContext)(Gs),Ys=(0,c.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r=js.initialDimension,width:i,height:a,minWidth:o=js.minWidth,minHeight:s,maxHeight:l,children:d,debounce:f=js.debounce,id:p,className:m,onResize:h,style:g={}}=e,_=(0,c.useRef)(null),v=(0,c.useRef)();v.current=h,(0,c.useImperativeHandle)(t,()=>_.current);var[y,b]=(0,c.useState)({containerWidth:r.width,containerHeight:r.height}),x=(0,c.useCallback)((e,t)=>{b(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,c.useEffect)(()=>{if(_.current==null||typeof ResizeObserver>`u`)return qt;var e=e=>{var t,n=e[0];if(n!=null){var{width:r,height:i}=n.contentRect;x(r,i),(t=v.current)==null||t.call(v,r,i)}};f>0&&(e=(0,Os.default)(e,f,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=_.current.getBoundingClientRect();return x(n,r),t.observe(_.current),()=>{t.disconnect()}},[x,f]);var{containerWidth:S,containerHeight:C}=y;As(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var{calculatedWidth:w,calculatedHeight:T}=Ms(S,C,{width:i,height:a,aspect:n,maxHeight:l});return As(w!=null&&w>0||T!=null&&T>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,w,T,i,a,o,s,n),c.createElement(`div`,{id:p?`${p}`:void 0,className:u(`recharts-responsive-container`,m),style:Vs(Vs({},g),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:_},c.createElement(`div`,{style:Ls({width:i,height:a})},c.createElement(qs,{width:w,height:T},d)))}),Xs=(0,c.forwardRef)((e,t)=>{var n=Js();if(Eo(n.width)&&Eo(n.height))return e.children;var{width:r,height:i}=Rs({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=Ms(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return P(a)&&P(o)?c.createElement(qs,{width:a,height:o},e.children):c.createElement(Ys,zs({},e,{width:r,height:i,ref:t}))});function Zs(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Qs=()=>{var e=Ss(),t=L(ys),n=L(ws),r=L(Cs)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},$s={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},ec=()=>L(vs)??$s,tc=()=>L(es),nc=()=>L(ts),rc=()=>L(e=>e.layout.margin),V=e=>e.layout.layoutType,ic=()=>L(V),ac=()=>{var e=ic();if(e===`horizontal`||e===`vertical`)return e},oc=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},sc=()=>ic()!==void 0,cc=e=>{var t=I(),n=Ss(),{width:r,height:i}=e,a=Js(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,c.useEffect)(()=>{!n&&Eo(o)&&Eo(s)&&t(So({width:o,height:s}))},[t,n,o,s]),null},lc=Symbol.for(`immer-nothing`),uc=Symbol.for(`immer-draftable`),dc=Symbol.for(`immer-state`);function fc(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pc=Object.getPrototypeOf;function mc(e){return!!e&&!!e[dc]}function hc(e){return e?vc(e)||Array.isArray(e)||!!e[uc]||!!e.constructor?.[uc]||wc(e)||Tc(e):!1}var gc=Object.prototype.constructor.toString(),_c=new WeakMap;function vc(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;if(n===Object)return!0;if(typeof n!=`function`)return!1;let r=_c.get(n);return r===void 0&&(r=Function.toString.call(n),_c.set(n,r)),r===gc}function yc(e,t,n=!0){bc(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function bc(e){let t=e[dc];return t?t.type_:Array.isArray(e)?1:wc(e)?2:Tc(e)?3:0}function xc(e,t){return bc(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Sc(e,t,n){let r=bc(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Cc(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function wc(e){return e instanceof Map}function Tc(e){return e instanceof Set}function Ec(e){return e.copy_||e.base_}function Dc(e,t){if(wc(e))return new Map(e);if(Tc(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=vc(e);if(t===!0||t===`class_only`&&!n){let t=Object.getOwnPropertyDescriptors(e);delete t[dc];let n=Reflect.ownKeys(t);for(let r=0;r1&&Object.defineProperties(e,{set:Ac,add:Ac,clear:Ac,delete:Ac}),Object.freeze(e),t&&Object.values(e).forEach(e=>Oc(e,!0)),e)}function kc(){fc(2)}var Ac={value:kc};function jc(e){return typeof e!=`object`||!e?!0:Object.isFrozen(e)}var Mc={};function Nc(e){let t=Mc[e];return t||fc(0,e),t}var Pc;function Fc(){return Pc}function Ic(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Lc(e,t){t&&(Nc(`Patches`),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Rc(e){zc(e),e.drafts_.forEach(Vc),e.drafts_=null}function zc(e){e===Pc&&(Pc=e.parent_)}function Bc(e){return Pc=Ic(Pc,e)}function Vc(e){let t=e[dc];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Hc(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return e!==void 0&&e!==n?(n[dc].modified_&&(Rc(t),fc(4)),hc(e)&&(e=Uc(t,e),t.parent_||Gc(t,e)),t.patches_&&Nc(`Patches`).generateReplacementPatches_(n[dc].base_,e,t.patches_,t.inversePatches_)):e=Uc(t,n,[]),Rc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===lc?void 0:e}function Uc(e,t,n){if(jc(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[dc];if(!i)return yc(t,(r,a)=>Wc(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return Gc(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;i.type_===3&&(a=new Set(t),t.clear(),o=!0),yc(a,(r,a)=>Wc(e,i,t,r,a,n,o),r),Gc(e,t,!1),n&&e.patches_&&Nc(`Patches`).generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Wc(e,t,n,r,i,a,o){if(i==null||typeof i!=`object`&&!o)return;let s=jc(i);if(!(s&&!o)){if(mc(i)){let o=Uc(e,i,a&&t&&t.type_!==3&&!xc(t.assigned_,r)?a.concat(r):void 0);if(Sc(n,r,o),mc(o))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(hc(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;Uc(e,i),(!t||!t.scope_.parent_)&&typeof r!=`symbol`&&(wc(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Gc(e,i)}}}function Gc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Oc(t,n)}function Kc(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:Fc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=qc;n&&(i=[r],a=Jc);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var qc={get(e,t){if(t===dc)return e;let n=Ec(e);if(!xc(n,t))return Xc(e,n,t);let r=n[t];return e.finalized_||!hc(r)?r:r===Yc(e.base_,t)?($c(e),e.copy_[t]=tl(r,e)):r},has(e,t){return t in Ec(e)},ownKeys(e){return Reflect.ownKeys(Ec(e))},set(e,t,n){let r=Zc(Ec(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Yc(Ec(e),t),i=r?.[dc];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Cc(n,r)&&(n!==void 0||xc(e.base_,t)))return!0;$c(e),Qc(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty(e,t){return Yc(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,$c(e),Qc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Ec(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!==`length`,enumerable:r.enumerable,value:n[t]}},defineProperty(){fc(11)},getPrototypeOf(e){return pc(e.base_)},setPrototypeOf(){fc(12)}},Jc={};yc(qc,(e,t)=>{Jc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Jc.deleteProperty=function(e,t){return Jc.set.call(this,e,t,void 0)},Jc.set=function(e,t,n){return qc.set.call(this,e[0],t,n,e[0])};function Yc(e,t){let n=e[dc];return(n?Ec(n):e)[t]}function Xc(e,t,n){let r=Zc(t,n);return r?`value`in r?r.value:r.get?.call(e.draft_):void 0}function Zc(e,t){if(!(t in e))return;let n=pc(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=pc(n)}}function Qc(e){e.modified_||(e.modified_=!0,e.parent_&&Qc(e.parent_))}function $c(e){e.copy_||=Dc(e.base_,e.scope_.immer_.useStrictShallowCopy_)}var el=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if(typeof e==`function`&&typeof t!=`function`){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}typeof t!=`function`&&fc(6),n!==void 0&&typeof n!=`function`&&fc(7);let r;if(hc(e)){let i=Bc(this),a=tl(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Rc(i):zc(i)}return Lc(i,n),Hc(r,i)}else if(!e||typeof e!=`object`){if(r=t(e),r===void 0&&(r=e),r===lc&&(r=void 0),this.autoFreeze_&&Oc(r,!0),n){let t=[],i=[];Nc(`Patches`).generateReplacementPatches_(e,r,t,i),n(t,i)}return r}else fc(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e==`function`)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},typeof e?.autoFreeze==`boolean`&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy==`boolean`&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration==`boolean`&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){hc(e)||fc(8),mc(e)&&(e=nl(e));let t=Bc(this),n=tl(e,void 0);return n[dc].isManual_=!0,zc(t),n}finishDraft(e,t){let n=e&&e[dc];(!n||!n.isManual_)&&fc(9);let{scope_:r}=n;return Lc(r,t),Hc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Nc(`Patches`).applyPatches_;return mc(e)?r(e,t):this.produce(e,e=>r(e,t))}};function tl(e,t){let n=wc(e)?Nc(`MapSet`).proxyMap_(e,t):Tc(e)?Nc(`MapSet`).proxySet_(e,t):Kc(e,t);return(t?t.scope_:Fc()).drafts_.push(n),n}function nl(e){return mc(e)||fc(10,e),rl(e)}function rl(e){if(!hc(e)||jc(e))return e;let t=e[dc],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Dc(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Dc(e,!0);return yc(n,(e,t)=>{Sc(n,e,rl(t))},r),t&&(t.finalized_=!1),n}new el().produce;function H(e){return e}var il=Aa({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`middle`,itemSorter:`value`},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(H(t.payload))},prepare:z()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=ra(e).payload.indexOf(H(n));i>-1&&(e.payload[i]=H(r))},prepare:z()},removeLegendPayload:{reducer(e,t){var n=ra(e).payload.indexOf(H(t.payload));n>-1&&e.payload.splice(n,1)},prepare:z()}}}),{setLegendSize:al,setLegendSettings:ol,addLegendPayload:sl,replaceLegendPayload:cl,removeLegendPayload:ll}=il.actions,ul=il.reducer;function dl(){return dl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=vl.separator,contentStyle:n,itemStyle:r,labelStyle:i=vl.labelStyle,payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:d,label:f,labelFormatter:p,accessibilityLayer:m=vl.accessibilityLayer}=e,h=()=>{if(a&&a.length){var e={padding:0,margin:0},n=(s?(0,Sr.default)(a,s):a).map((e,n)=>{if(e.type===`none`)return null;var i=e.formatter||o||_l,{value:s,name:l}=e,u=s,d=l;if(i){var f=i(s,l,e,n,a);if(Array.isArray(f))[u,d]=f;else if(f!=null)u=f;else return null}var p=pl(pl({},vl.itemStyle),{},{color:e.color||vl.itemStyle.color},r);return c.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${n}`,style:p},Rt(d)?c.createElement(`span`,{className:`recharts-tooltip-item-name`},d):null,Rt(d)?c.createElement(`span`,{className:`recharts-tooltip-item-separator`},t):null,c.createElement(`span`,{className:`recharts-tooltip-item-value`},u),c.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return c.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},n)}return null},g=pl(pl({},vl.contentStyle),n),_=pl({margin:0},i),v=!F(f),y=v?f:``,b=u(`recharts-default-tooltip`,l),x=u(`recharts-tooltip-label`,d);v&&p&&a!=null&&(y=p(f,a));var S=m?{role:`status`,"aria-live":`assertive`}:{};return c.createElement(`div`,dl({className:b,style:g},S),c.createElement(`p`,{className:x,style:_},c.isValidElement(y)?y:`${y}`),h())},bl=`recharts-tooltip-wrapper`,xl={visibility:`hidden`};function Sl(e){var{coordinate:t,translateX:n,translateY:r}=e;return u(bl,{[`${bl}-right`]:P(n)&&t&&P(t.x)&&n>=t.x,[`${bl}-left`]:P(n)&&t&&P(t.x)&&n=t.y,[`${bl}-top`]:P(r)&&t&&P(t.y)&&r0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(uf+l?Math.max(u,f):Math.max(d,f)}function wl(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function Tl(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:s,useTranslate3d:c,viewBox:l}=e,u,d,f;return s.height>0&&s.width>0&&n?(d=Cl({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=Cl({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=wl({translateX:d,translateY:f,useTranslate3d:c})):u=xl,{cssProperties:u,cssClasses:Sl({translateX:d,translateY:f,coordinate:n})}}function El(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dl(e){for(var t=1;t{e.key===`Escape`&&this.setState({dismissed:!0,dismissedAtCoordinate:{x:this.props.coordinate?.x??0,y:this.props.coordinate?.y??0}})})}componentDidMount(){document.addEventListener(`keydown`,this.handleKeyDown)}componentWillUnmount(){document.removeEventListener(`keydown`,this.handleKeyDown)}componentDidUpdate(){this.state.dismissed&&(this.props.coordinate?.x!==this.state.dismissedAtCoordinate.x||this.props.coordinate?.y!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:t,animationDuration:n,animationEasing:r,children:i,coordinate:a,hasPayload:o,isAnimationActive:s,offset:l,position:u,reverseDirection:d,useTranslate3d:f,viewBox:p,wrapperStyle:m,lastBoundingBox:h,innerRef:g,hasPortalFromProps:_}=this.props,{cssClasses:v,cssProperties:y}=Tl({allowEscapeViewBox:t,coordinate:a,offsetLeft:typeof l==`number`?l:l.x,offsetTop:typeof l==`number`?l:l.y,position:u,reverseDirection:d,tooltipBox:{height:h.height,width:h.width},useTranslate3d:f,viewBox:p}),b=Dl(Dl({},_?{}:Dl(Dl({transition:s&&e?`transform ${n}ms ${r}`:void 0},y),{},{pointerEvents:`none`,visibility:!this.state.dismissed&&e&&o?`visible`:`hidden`,position:`absolute`,top:0,left:0})),{},{visibility:!this.state.dismissed&&e&&o?`visible`:`hidden`},m);return c.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:v,style:b,ref:g},i)}},Ml=()=>L(e=>e.rootProps.accessibilityLayer)??!0;function Nl(){return Nl=Object.assign?Object.assign.bind():function(e){for(var t=1;tB(e.x)&&B(e.y),Vl=e=>e.base!=null&&Bl(e.base)&&Bl(e),Hl=e=>e.x,Ul=e=>e.y,Wl=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${Gt(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=zl[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return zl[n]||ve},Gl={connectNulls:!1,type:`linear`},Kl=e=>{var{type:t=Gl.type,points:n=[],baseLine:r,layout:i,connectNulls:a=Gl.connectNulls}=e,o=Wl(t,i),s=a?n.filter(Bl):n;if(Array.isArray(r)){var c,l=n.map((e,t)=>Fl(Fl({},e),{},{base:r[t]}));return c=i===`vertical`?Se().y(Ul).x1(Hl).x0(e=>e.base.x):Se().x(Hl).y1(Ul).y0(e=>e.base.y),c.defined(Vl).curve(o)(a?l.filter(Vl):l)}return(i===`vertical`&&P(r)?Se().y(Ul).x1(Hl).x0(r):P(r)?Se().x(Hl).y1(Ul).y0(r):xe().x(Hl).y(Ul)).defined(Bl).curve(o)(s)},ql=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=ic();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?Kl(o):r;return c.createElement(`path`,Nl({},g(e),dn(e),{className:u(`recharts-curve`,t),d:s===null?void 0:s,ref:i}))},Jl=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function Yl(){return Yl=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,iu=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=tu(e,Jl),d=Zl({x:t,y:n,top:r,left:i,width:a,height:o},l);return!P(t)||!P(n)||!P(a)||!P(o)||!P(r)||!P(i)?null:c.createElement(`path`,Yl({},v(d),{className:u(`recharts-cross`,s),d:ru(t,n,a,o,r,i)}))};function au(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function ou(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function su(e){for(var t=1;te.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),fu=(e,t,n)=>e.map(e=>`${du(e)} ${t}ms ${n}`).join(`,`),pu=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e))),mu=(e,t)=>Object.keys(t).reduce((n,r)=>su(su({},n),{},{[r]:e(r,t[r])}),{});function hu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;te+(t-e)*n,bu=e=>{var{from:t,to:n}=e;return t!==n},xu=(e,t,n)=>{var r=mu((t,n)=>{if(bu(n)){var[r,i]=e(n.from,n.to,n.velocity);return U(U({},n),{},{from:r,velocity:i})}return n},t);return n<1?mu((e,t)=>bu(t)&&r[e]!=null?U(U({},t),{},{velocity:yu(t.velocity,r[e].velocity,n),from:yu(t.from,r[e].from,n)}):t,t):xu(e,r,n-1)};function Su(e,t,n,r,i,a){var o,s=r.reduce((n,r)=>U(U({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),c=()=>mu((e,t)=>t.from,s),l=()=>!Object.values(s).filter(bu).length,u=null,d=r=>{o||=r;var f=(r-o)/n.dt;s=xu(n,s,f),i(U(U(U({},e),t),c())),o=r,l()||(u=a.setTimeout(d))};return()=>(u=a.setTimeout(d),()=>{var e;(e=u)==null||e()})}function Cu(e,t,n,r,i,a,o){var s=null,c=i.reduce((n,r)=>{var i=e[r],a=t[r];return i==null||a==null?n:U(U({},n),{},{[r]:[i,a]})},{}),l,u=i=>{l||=i;var d=(i-l)/r,f=mu((e,t)=>yu(...t,n(d)),c);if(a(U(U(U({},e),t),f)),d<1)s=o.setTimeout(u);else{var p=mu((e,t)=>yu(...t,n(1)),c);a(U(U(U({},e),t),p))}};return()=>(s=o.setTimeout(u),()=>{var e;(e=s)==null||e()})}var wu=(e,t,n,r,i,a)=>{var o=pu(e,t);return n==null?()=>(i(U(U({},e),t)),()=>{}):n.isStepper===!0?Su(e,t,n,o,i,a):Cu(e,t,n,r,o,i,a)},Tu=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Eu=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),Du=(e,t)=>n=>Eu(Tu(e,t),n),Ou=(e,t)=>n=>Eu([...Tu(e,t).map((e,t)=>e*t).slice(1),0],n),ku=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},Au=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=ku(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},ju=(e,t,n,r)=>{var i=Du(e,n),a=Du(t,r),o=Ou(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},Mu=function(){return ju(...Au(...arguments))},Nu=function(){var{stiff:e=100,damping:t=8,dt:n=17}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=(r,i,a)=>{var o=a+(-(r-i)*e-a*t)*n/1e3,s=a*n/1e3+r;return Math.abs(s-i)<1e-4&&Math.abs(o)<1e-4?[i,0]:[s,o]};return r.isStepper=!0,r.dt=n,r},Pu=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return Mu(e);case`spring`:return Nu();default:if(e.split(`(`)[0]===`cubic-bezier`)return Mu(e)}return typeof e==`function`?e:null};function Fu(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var[s,...c]=o;if(typeof s==`number`){i=e.setTimeout(a.bind(null,c),s);return}a(s),i=e.setTimeout(a.bind(null,c));return}typeof o==`string`&&(t=o,n(t)),typeof o==`object`&&(t=o,n(t)),typeof o==`function`&&o()}};return{stop:()=>{r=!0},start:e=>{r=!1,i&&=(i(),null),a(e)},subscribe:e=>(n=e,()=>{n=()=>null}),getTimeoutController:()=>e}}var Iu=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function Lu(){return Fu(new Iu)}var Ru=(0,c.createContext)(Lu);function zu(e,t){var n=(0,c.useContext)(Ru);return(0,c.useMemo)(()=>t??n(e),[e,t,n])}var Bu={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)},Vu={begin:0,duration:1e3,easing:`ease`,isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Hu={t:0},Uu={t:1};function Wu(e){var t=yn(e,Vu),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:s,onAnimationStart:l,children:u}=t,d=n===`auto`?!Bu.isSsr:n,f=zu(t.animationId,t.animationManager),[p,m]=(0,c.useState)(d?Hu:Uu),h=(0,c.useRef)(null);return(0,c.useEffect)(()=>{d||m(Uu)},[d]),(0,c.useEffect)(()=>{if(!d||!r)return qt;var e=wu(Hu,Uu,Pu(a),i,m,f.getTimeoutController());return f.start([l,o,()=>{h.current=e()},i,s]),()=>{f.stop(),h.current&&h.current(),s()}},[d,r,i,a,o,l,s,f]),u(p.t)}function Gu(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,c.useRef)(Bt(t)),r=(0,c.useRef)(e);return r.current!==e&&(n.current=Bt(t),r.current=e),n.current}var Ku=[`radius`],qu=[`radius`],Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd;function id(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ad(e){for(var t=1;t{var a=Pt(n),o=Pt(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;ps?s:h}d=N(Ju||=fd([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=N(Yu||=fd([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=N(Xu||=fd([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=N(Zu||=fd([`A `,`,`,`,0,0,`,`, + `,`,`,``]),f[1],f[1],u,e+n,t+c*f[1])),d+=N(Qu||=fd([`L `,`,`,``]),e+n,t+r-c*f[2]),f[2]>0&&(d+=N($u||=fd([`A `,`,`,`,0,0,`,`, + `,`,`,``]),f[2],f[2],u,e+n-l*f[2],t+r)),d+=N(ed||=fd([`L `,`,`,``]),e+l*f[3],t+r),f[3]>0&&(d+=N(td||=fd([`A `,`,`,`,0,0,`,`, + `,`,`,``]),f[3],f[3],u,e,t+r-c*f[3])),d+=`Z`}else if(s>0&&i===+i&&i>0){var g=Math.min(s,i);d=N(nd||=fd(`M .,. + A .,.,0,0,.,.,. + L .,. + A .,.,0,0,.,.,. + L .,. + A .,.,0,0,.,.,. + L .,. + A .,.,0,0,.,.,. Z`.split(`.`)),e,t+c*g,g,g,u,e+l*g,t,e+n-l*g,t,g,g,u,e+n,t+c*g,e+n,t+r-c*g,g,g,u,e+n-l*g,t+r,e+l*g,t+r,g,g,u,e,t+r-c*g)}else d=N(rd||=fd([`M `,`,`,` h `,` v `,` h `,` Z`]),e,t,n,r,-n);return d},md={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},hd=e=>{var t=yn(e,md),n=(0,c.useRef)(null),[r,i]=(0,c.useState)(-1);(0,c.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&i(e)}catch{}},[]);var{x:a,y:o,width:s,height:l,radius:d,className:f}=t,{animationEasing:p,animationDuration:m,animationBegin:h,isAnimationActive:g,isUpdateAnimationActive:_}=t,y=(0,c.useRef)(s),b=(0,c.useRef)(l),x=(0,c.useRef)(a),S=(0,c.useRef)(o),C=Gu((0,c.useMemo)(()=>({x:a,y:o,width:s,height:l,radius:d}),[a,o,s,l,d]),`rectangle-`);if(a!==+a||o!==+o||s!==+s||l!==+l||s===0||l===0)return null;var w=u(`recharts-rectangle`,f);if(!_){var T=v(t),{radius:E}=T,D=ud(T,Ku);return c.createElement(`path`,ld({},D,{x:Pt(a),y:Pt(o),width:Pt(s),height:Pt(l),radius:typeof d==`number`?d:void 0,className:w,d:pd(a,o,s,l,d)}))}var O=y.current,k=b.current,ee=x.current,te=S.current,A=`0px ${r===-1?1:r}px`,j=`${r}px 0px`,M=fu([`strokeDasharray`],m,typeof p==`string`?p:md.animationEasing);return c.createElement(Wu,{animationId:C,key:C,canBegin:r>0,duration:m,easing:p,isActive:_,begin:h},e=>{var r=Ut(O,s,e),i=Ut(k,l,e),u=Ut(ee,a,e),f=Ut(te,o,e);n.current&&(y.current=r,b.current=i,x.current=u,S.current=f);var p=g?e>0?{transition:M,strokeDasharray:j}:{strokeDasharray:A}:{strokeDasharray:j},m=v(t),{radius:h}=m,_=ud(m,qu);return c.createElement(`path`,ld({},_,{radius:typeof d==`number`?d:void 0,className:w,d:pd(u,f,r,i,d),ref:n,style:ad(ad({},p),t.style)}))})};function gd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _d(e){for(var t=1;te*180/Math.PI,W=(e,t,n,r)=>({x:e+Math.cos(-xd*r)*n,y:t+Math.sin(-xd*r)*n}),Cd=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2},wd=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)},Td=(e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=wd({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=(n-i)/o,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:o,angle:Sd(c),angleInRadian:c}},Ed=e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},Dd=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},Od=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:a}=Td({x:n,y:r},t),{innerRadius:o,outerRadius:s}=t;if(is||i===0)return null;var{startAngle:c,endAngle:l}=Ed(t),u=a,d;if(c<=l){for(;u>l;)u-=360;for(;u=c&&u<=l}else{for(;u>c;)u-=360;for(;u=l&&u<=c}return d?_d(_d({},t),{},{radius:i,angle:Dd(u,t)}):null};function kd(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[W(t,n,r,i),W(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var Ad,jd,Md,Nd,Pd,Fd,Id;function Ld(){return Ld=Object.assign?Object.assign.bind():function(e){for(var t=1;tFt(t-e)*Math.min(Math.abs(t-e),359.999),Bd=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:c}=e,l=s*(o?1:-1)+r,u=Math.asin(s/l)/xd,d=c?i:i+a*u,f=W(t,n,l,d),p=W(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:W(t,n,l*Math.cos(u*xd),m),theta:u}},Vd=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=zd(a,o),c=a+s,l=W(t,n,i,a),u=W(t,n,i,c),d=N(Ad||=Rd([`M `,`,`,` + A `,`,`,`,0, + `,`,`,`, + `,`,`,` + `]),l.x,l.y,i,i,+(Math.abs(s)>180),+(a>c),u.x,u.y);if(r>0){var f=W(t,n,r,a),p=W(t,n,r,c);d+=N(jd||=Rd([`L `,`,`,` + A `,`,`,`,0, + `,`,`,`, + `,`,`,` Z`]),p.x,p.y,r,r,+(Math.abs(s)>180),+(a<=c),f.x,f.y)}else d+=N(Md||=Rd([`L `,`,`,` Z`]),t,n);return d},Hd=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:c,endAngle:l}=e,u=Ft(l-c),{circleTangency:d,lineTangency:f,theta:p}=Bd({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:m,lineTangency:h,theta:g}=Bd({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),_=s?Math.abs(c-l):Math.abs(c-l)-p-g;if(_<0)return o?N(Nd||=Rd([`M `,`,`,` + a`,`,`,`,0,0,1,`,`,0 + a`,`,`,`,0,0,1,`,`,0 + `]),f.x,f.y,a,a,a*2,a,a,-a*2):Vd({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var v=N(Pd||=Rd([`M `,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,` + A`,`,`,`,0,`,`,`,`,`,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,` + `]),f.x,f.y,a,a,+(u<0),d.x,d.y,i,i,+(_>180),+(u<0),m.x,m.y,a,a,+(u<0),h.x,h.y);if(r>0){var{circleTangency:y,lineTangency:b,theta:x}=Bd({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:S,lineTangency:C,theta:w}=Bd({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),T=s?Math.abs(c-l):Math.abs(c-l)-x-w;if(T<0&&a===0)return`${v}L${t},${n}Z`;v+=N(Fd||=Rd([`L`,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,` + A`,`,`,`,0,`,`,`,`,`,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,`Z`]),C.x,C.y,a,a,+(u<0),S.x,S.y,r,r,+(T>180),+(u>0),y.x,y.y,a,a,+(u<0),b.x,b.y)}else v+=N(Id||=Rd([`L`,`,`,`Z`]),t,n);return v},Ud={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Wd=e=>{var t=yn(e,Ud),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:s,cornerIsExternal:l,startAngle:d,endAngle:f,className:p}=t;if(a0&&Math.abs(d-f)<360?Hd({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(g,h/2),forceCornerRadius:s,cornerIsExternal:l,startAngle:d,endAngle:f}):Vd({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:d,endAngle:f});return c.createElement(`path`,Ld({},v(t),{className:m,d:_}))};function Gd(e,t,n){if(e===`horizontal`)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e===`vertical`)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(un(t)){if(e===`centric`){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,c=W(r,i,a,s),l=W(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return kd(t)}}var Kd=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=gr();function n(e){return t.isSymbol(e)?NaN:Number(e)}e.toNumber=n})),qd=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Kd();function n(e){return e?(e=t.toNumber(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}e.toFinite=n})),Jd=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=br(),n=qd();function r(e,r,i){i&&typeof i!=`number`&&t.isIterateeCall(e,r,i)&&(r=i=void 0),e=n.toFinite(e),r===void 0?(r=e,e=0):r=n.toFinite(r),i=i===void 0?e{t.exports=Jd().range}));function Xd(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Zd(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Qd(e){let t,n,r;e.length===2?(t=e===Xd||e===Zd?e:$d,n=e,r=e):(t=Xd,n=(t,n)=>Xd(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function $d(){return 0}function ef(e){return e===null?NaN:+e}function*tf(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var nf=Qd(Xd),rf=nf.right;nf.left,Qd(ef).center;var af=class extends Map{constructor(e,t=lf){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(of(this,e))}has(e){return super.has(of(this,e))}set(e,t){return super.set(sf(this,e),t)}delete(e){return super.delete(cf(this,e))}};function of({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function sf({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function cf({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function lf(e){return typeof e==`object`&&e?e.valueOf():e}function uf(e=Xd){if(e===Xd)return df;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function df(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var ff=Math.sqrt(50),pf=Math.sqrt(10),mf=Math.sqrt(2);function hf(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=ff?10:a>=pf?5:a>=mf?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function bf(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function xf(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?df:uf(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));xf(e,t,u,d,i)}let a=e[t],o=n,s=r;for(Sf(e,n,t),i(e[r],a)>0&&Sf(e,n,r);o0;)--s}i(e[n],a)===0?Sf(e,n,s):(++s,Sf(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function Sf(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Cf(e,t,n){if(e=Float64Array.from(tf(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return bf(e);if(t>=1)return yf(e);var r,i=(r-1)*t,a=Math.floor(i),o=yf(xf(e,a).subarray(0,a+1));return o+(bf(e.subarray(a+1))-o)*(i-a)}}function wf(e,t,n=ef){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function Tf(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?tp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?tp(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Hf.exec(e))?new ip(t[1],t[2],t[3],1):(t=Uf.exec(e))?new ip(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Wf.exec(e))?tp(t[1],t[2],t[3],t[4]):(t=Gf.exec(e))?tp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Kf.exec(e))?dp(t[1],t[2]/100,t[3]/100,1):(t=qf.exec(e))?dp(t[1],t[2]/100,t[3]/100,t[4]):Jf.hasOwnProperty(e)?ep(Jf[e]):e===`transparent`?new ip(NaN,NaN,NaN,0):null}function ep(e){return new ip(e>>16&255,e>>8&255,e&255,1)}function tp(e,t,n,r){return r<=0&&(e=t=n=NaN),new ip(e,t,n,r)}function np(e){return e instanceof Ff||(e=$f(e)),e?(e=e.rgb(),new ip(e.r,e.g,e.b,e.opacity)):new ip}function rp(e,t,n,r){return arguments.length===1?np(e):new ip(e,t,n,r??1)}function ip(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Nf(ip,rp,Pf(Ff,{brighter(e){return e=e==null?Lf:Lf**+e,new ip(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?If:If**+e,new ip(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ip(lp(this.r),lp(this.g),lp(this.b),cp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ap,formatHex:ap,formatHex8:op,formatRgb:sp,toString:sp}));function ap(){return`#${up(this.r)}${up(this.g)}${up(this.b)}`}function op(){return`#${up(this.r)}${up(this.g)}${up(this.b)}${up((isNaN(this.opacity)?1:this.opacity)*255)}`}function sp(){let e=cp(this.opacity);return`${e===1?`rgb(`:`rgba(`}${lp(this.r)}, ${lp(this.g)}, ${lp(this.b)}${e===1?`)`:`, ${e})`}`}function cp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function lp(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function up(e){return e=lp(e),(e<16?`0`:``)+e.toString(16)}function dp(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new mp(e,t,n,r)}function fp(e){if(e instanceof mp)return new mp(e.h,e.s,e.l,e.opacity);if(e instanceof Ff||(e=$f(e)),!e)return new mp;if(e instanceof mp)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new mp(o,s,c,e.opacity)}function pp(e,t,n,r){return arguments.length===1?fp(e):new mp(e,t,n,r??1)}function mp(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Nf(mp,pp,Pf(Ff,{brighter(e){return e=e==null?Lf:Lf**+e,new mp(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?If:If**+e,new mp(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new ip(_p(e>=240?e-240:e+120,i,r),_p(e,i,r),_p(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new mp(hp(this.h),gp(this.s),gp(this.l),cp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=cp(this.opacity);return`${e===1?`hsl(`:`hsla(`}${hp(this.h)}, ${gp(this.s)*100}%, ${gp(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function hp(e){return e=(e||0)%360,e<0?e+360:e}function gp(e){return Math.max(0,Math.min(1,e||0))}function _p(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var vp=e=>()=>e;function yp(e,t){return function(n){return e+n*t}}function bp(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function xp(e){return(e=+e)==1?Sp:function(t,n){return n-t?bp(t,n,e):vp(isNaN(t)?n:t)}}function Sp(e,t){var n=t-e;return n?yp(e,n):vp(isNaN(e)?t:e)}var Cp=(function e(t){var n=xp(t);function r(e,t){var r=n((e=rp(e)).r,(t=rp(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Sp(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function wp(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Op(r,i)})),n=jp.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Wp(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?Gp:Wp,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),Op))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,zp),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=Ip,u()},d.clamp=function(e){return arguments.length?(o=e?!0:Vp,u()):o!==Vp},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Jp(){return qp()(Vp,Vp)}function Yp(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Xp(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Zp(e){return e=Xp(Math.abs(e)),e?e[1]:NaN}function Qp(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function $p(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var em=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function tm(e){if(!(t=em.exec(e)))throw Error(`invalid format: `+e);var t;return new nm({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}tm.prototype=nm.prototype;function nm(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}nm.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function rm(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var im;function am(e,t){var n=Xp(e,t);if(!n)return im=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(im=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Xp(e,Math.max(0,t+a-1))[0]}function om(e,t){var n=Xp(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var sm={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Yp,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>om(e*100,t),r:om,s:am,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function cm(e){return e}var lm=Array.prototype.map,um=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function dm(e){var t=e.grouping===void 0||e.thousands===void 0?cm:Qp(lm.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?cm:$p(lm.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=tm(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):sm[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=sm[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=rm(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&im!==void 0?um[8+im/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Zp(t)/3)))*3,r=10**-n,i=l((e=tm(e),e.type=`f`,e),{suffix:um[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var fm,pm,mm;hm({thousands:`,`,grouping:[3],currency:[`$`,``]});function hm(e){return fm=dm(e),pm=fm.format,mm=fm.formatPrefix,fm}function gm(e){return Math.max(0,-Zp(Math.abs(e)))}function _m(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Zp(t)/3)))*3-Zp(Math.abs(e)))}function vm(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Zp(t)-Zp(e))+1}function ym(e,t,n,r){var i=vf(e,t,n),a;switch(r=tm(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=_m(i,o))&&(r.precision=a),mm(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=vm(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=gm(i))&&(r.precision=a-(r.type===`%`)*2);break}return pm(r)}function bm(e){var t=e.domain;return e.ticks=function(e){var n=t();return gf(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return ym(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=_f(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function xm(){var e=Jp();return e.copy=function(){return Kp(e,xm())},Ef.apply(e,arguments),bm(e)}function Sm(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,zp),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Sm(e).unknown(t)},e=arguments.length?Array.from(e,zp):[0,1],bm(n)}function Cm(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function Am(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function jm(e){return(t,n)=>-e(-t,n)}function Mm(e){let t=e(wm,Tm),n=t.domain,r=10,i,a;function o(){return i=Am(r),a=km(r),n()[0]<0?(i=jm(i),a=jm(a),e(Em,Dm)):e(wm,Tm),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=tm(n)).precision==null&&(n.trim=!0),n=pm(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(Cm(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function Nm(){let e=Mm(qp()).domain([1,10]);return e.copy=()=>Kp(e,Nm()).base(e.base()),Ef.apply(e,arguments),e}function Pm(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Fm(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Im(e){var t=1,n=e(Pm(t),Fm(t));return n.constant=function(n){return arguments.length?e(Pm(t=+n),Fm(t)):t},bm(n)}function Lm(){var e=Im(qp());return e.copy=function(){return Kp(e,Lm()).constant(e.constant())},Ef.apply(e,arguments)}function Rm(e){return function(t){return t<0?-((-t)**+e):t**+e}}function zm(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Bm(e){return e<0?-e*e:e*e}function Vm(e){var t=e(Vp,Vp),n=1;function r(){return n===1?e(Vp,Vp):n===.5?e(zm,Bm):e(Rm(n),Rm(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},bm(t)}function Hm(){var e=Vm(qp());return e.copy=function(){return Kp(e,Hm()).exponent(e.exponent())},Ef.apply(e,arguments),e}function Um(){return Hm.apply(null,arguments).exponent(.5)}function Wm(e){return Math.sign(e)*e*e}function Gm(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Km(){var e=Jp(),t=[0,1],n=!1,r;function i(t){var i=Gm(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(Wm(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,zp)).map(Wm)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Km(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Ef.apply(i,arguments),bm(i)}function qm(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Jm().domain([e,t]).range(i).unknown(a)},Ef.apply(bm(o),arguments)}function Ym(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[rf(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return Ym().domain(e).range(t).unknown(n)},Ef.apply(i,arguments)}var Xm=new Date,Zm=new Date;function G(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sG(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(Xm.setTime(+t),Zm.setTime(+r),e(Xm),e(Zm),Math.floor(n(Xm,Zm))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var Qm=G(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Qm.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?G(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Qm),Qm.range;var $m=1e3,eh=$m*60,th=eh*60,nh=th*24,rh=nh*7,ih=nh*30,ah=nh*365,oh=G(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*$m)},(e,t)=>(t-e)/$m,e=>e.getUTCSeconds());oh.range;var sh=G(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*$m)},(e,t)=>{e.setTime(+e+t*eh)},(e,t)=>(t-e)/eh,e=>e.getMinutes());sh.range;var ch=G(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*eh)},(e,t)=>(t-e)/eh,e=>e.getUTCMinutes());ch.range;var lh=G(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*$m-e.getMinutes()*eh)},(e,t)=>{e.setTime(+e+t*th)},(e,t)=>(t-e)/th,e=>e.getHours());lh.range;var uh=G(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*th)},(e,t)=>(t-e)/th,e=>e.getUTCHours());uh.range;var dh=G(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*eh)/nh,e=>e.getDate()-1);dh.range;var fh=G(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/nh,e=>e.getUTCDate()-1);fh.range;var ph=G(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/nh,e=>Math.floor(e/nh));ph.range;function mh(e){return G(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*eh)/rh)}var hh=mh(0),gh=mh(1),_h=mh(2),vh=mh(3),yh=mh(4),bh=mh(5),xh=mh(6);hh.range,gh.range,_h.range,vh.range,yh.range,bh.range,xh.range;function Sh(e){return G(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/rh)}var Ch=Sh(0),wh=Sh(1),Th=Sh(2),Eh=Sh(3),Dh=Sh(4),Oh=Sh(5),kh=Sh(6);Ch.range,wh.range,Th.range,Eh.range,Dh.range,Oh.range,kh.range;var Ah=G(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Ah.range;var jh=G(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());jh.range;var Mh=G(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Mh.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:G(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),Mh.range;var Nh=G(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Nh.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:G(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),Nh.range;function Ph(e,t,n,r,i,a){let o=[[oh,1,$m],[oh,5,5*$m],[oh,15,15*$m],[oh,30,30*$m],[a,1,eh],[a,5,5*eh],[a,15,15*eh],[a,30,30*eh],[i,1,th],[i,3,3*th],[i,6,6*th],[i,12,12*th],[r,1,nh],[r,2,2*nh],[n,1,rh],[t,1,ih],[t,3,3*ih],[e,1,ah]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(vf(t/ah,n/ah,r));if(a===0)return Qm.every(Math.max(vf(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=Bh(Vh(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?wh.ceil(a):wh(a),a=fh.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=zh(Vh(r.y,0,1)),o=a.getDay(),a=o>4||o===0?gh.ceil(a):gh(a),a=dh.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else (`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?Bh(Vh(r.y,0,1)).getUTCDay():zh(Vh(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,Bh(r)):zh(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in Uh?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function ee(e,n,r){return w(e,t,n,r)}function te(e,t,r){return w(e,n,t,r)}function A(e,t,n){return w(e,r,t,n)}function j(e){return o[e.getDay()]}function M(e){return a[e.getDay()]}function ne(e){return c[e.getMonth()]}function re(e){return s[e.getMonth()]}function ie(e){return i[+(e.getHours()>=12)]}function ae(e){return 1+~~(e.getMonth()/3)}function oe(e){return o[e.getUTCDay()]}function se(e){return a[e.getUTCDay()]}function ce(e){return c[e.getUTCMonth()]}function le(e){return s[e.getUTCMonth()]}function ue(e){return i[+(e.getUTCHours()>=12)]}function de(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var Uh={"-":``,_:` `,0:`0`},K=/^\s*\d+/,Wh=/^%/,Gh=/[\\^$*+?|[\]().{}]/g;function q(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function Yh(e,t,n){var r=K.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Xh(e,t,n){var r=K.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Zh(e,t,n){var r=K.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Qh(e,t,n){var r=K.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function $h(e,t,n){var r=K.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function eg(e,t,n){var r=K.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function tg(e,t,n){var r=K.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function ng(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function rg(e,t,n){var r=K.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function ig(e,t,n){var r=K.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function ag(e,t,n){var r=K.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function og(e,t,n){var r=K.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function sg(e,t,n){var r=K.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function cg(e,t,n){var r=K.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function lg(e,t,n){var r=K.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function ug(e,t,n){var r=K.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function dg(e,t,n){var r=K.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function fg(e,t,n){var r=Wh.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function pg(e,t,n){var r=K.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function mg(e,t,n){var r=K.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function hg(e,t){return q(e.getDate(),t,2)}function gg(e,t){return q(e.getHours(),t,2)}function _g(e,t){return q(e.getHours()%12||12,t,2)}function vg(e,t){return q(1+dh.count(Mh(e),e),t,3)}function yg(e,t){return q(e.getMilliseconds(),t,3)}function bg(e,t){return yg(e,t)+`000`}function xg(e,t){return q(e.getMonth()+1,t,2)}function Sg(e,t){return q(e.getMinutes(),t,2)}function Cg(e,t){return q(e.getSeconds(),t,2)}function wg(e){var t=e.getDay();return t===0?7:t}function Tg(e,t){return q(hh.count(Mh(e)-1,e),t,2)}function Eg(e){var t=e.getDay();return t>=4||t===0?yh(e):yh.ceil(e)}function Dg(e,t){return e=Eg(e),q(yh.count(Mh(e),e)+(Mh(e).getDay()===4),t,2)}function Og(e){return e.getDay()}function kg(e,t){return q(gh.count(Mh(e)-1,e),t,2)}function Ag(e,t){return q(e.getFullYear()%100,t,2)}function jg(e,t){return e=Eg(e),q(e.getFullYear()%100,t,2)}function Mg(e,t){return q(e.getFullYear()%1e4,t,4)}function Ng(e,t){var n=e.getDay();return e=n>=4||n===0?yh(e):yh.ceil(e),q(e.getFullYear()%1e4,t,4)}function Pg(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+q(t/60|0,`0`,2)+q(t%60,`0`,2)}function Fg(e,t){return q(e.getUTCDate(),t,2)}function Ig(e,t){return q(e.getUTCHours(),t,2)}function Lg(e,t){return q(e.getUTCHours()%12||12,t,2)}function Rg(e,t){return q(1+fh.count(Nh(e),e),t,3)}function zg(e,t){return q(e.getUTCMilliseconds(),t,3)}function Bg(e,t){return zg(e,t)+`000`}function Vg(e,t){return q(e.getUTCMonth()+1,t,2)}function Hg(e,t){return q(e.getUTCMinutes(),t,2)}function Ug(e,t){return q(e.getUTCSeconds(),t,2)}function Wg(e){var t=e.getUTCDay();return t===0?7:t}function Gg(e,t){return q(Ch.count(Nh(e)-1,e),t,2)}function Kg(e){var t=e.getUTCDay();return t>=4||t===0?Dh(e):Dh.ceil(e)}function qg(e,t){return e=Kg(e),q(Dh.count(Nh(e),e)+(Nh(e).getUTCDay()===4),t,2)}function Jg(e){return e.getUTCDay()}function Yg(e,t){return q(wh.count(Nh(e)-1,e),t,2)}function Xg(e,t){return q(e.getUTCFullYear()%100,t,2)}function Zg(e,t){return e=Kg(e),q(e.getUTCFullYear()%100,t,2)}function Qg(e,t){return q(e.getUTCFullYear()%1e4,t,4)}function $g(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Dh(e):Dh.ceil(e),q(e.getUTCFullYear()%1e4,t,4)}function e_(){return`+0000`}function t_(){return`%`}function n_(e){return+e}function r_(e){return Math.floor(e/1e3)}var i_,a_,o_;s_({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function s_(e){return i_=Hh(e),a_=i_.format,i_.parse,o_=i_.utcFormat,i_.utcParse,i_}function c_(e){return new Date(e)}function l_(e){return e instanceof Date?+e:+new Date(+e)}function u_(e,t,n,r,i,a,o,s,c,l){var u=Jp(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>Cf(e,r/t))},n.copy=function(){return b_(t).domain(e)},Df.apply(n,arguments)}function x_(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=Vp,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*eAf,scaleDiverging:()=>S_,scaleDivergingLog:()=>C_,scaleDivergingPow:()=>T_,scaleDivergingSqrt:()=>E_,scaleDivergingSymlog:()=>w_,scaleIdentity:()=>Sm,scaleImplicit:()=>Of,scaleLinear:()=>xm,scaleLog:()=>Nm,scaleOrdinal:()=>kf,scalePoint:()=>Mf,scalePow:()=>Hm,scaleQuantile:()=>qm,scaleQuantize:()=>Jm,scaleRadial:()=>Km,scaleSequential:()=>h_,scaleSequentialLog:()=>g_,scaleSequentialPow:()=>v_,scaleSequentialQuantile:()=>b_,scaleSequentialSqrt:()=>y_,scaleSequentialSymlog:()=>__,scaleSqrt:()=>Um,scaleSymlog:()=>Lm,scaleThreshold:()=>Ym,scaleTime:()=>d_,scaleUtc:()=>f_,tickFormat:()=>ym}),k_=e=>e.chartData,A_=R([k_],e=>{var t=e.chartData==null?0:e.chartData.length-1;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),j_=(e,t,n,r)=>r?A_(e):k_(e),M_=(e,t,n)=>n?A_(e):k_(e);function N_(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(B(t)&&B(n))return!0}return!1}function P_(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function F_(e,t){if(t&&typeof e!=`function`&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(B(n))i=n;else if(typeof n==`function`)return;if(B(r))a=r;else if(typeof r==`function`)return;var o=[i,a];if(N_(o))return o}}function I_(e,t,n){if(!(!n&&t==null)){if(typeof e==`function`&&t!=null)try{var r=e(t,n);if(N_(r))return P_(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,s;if(i===`auto`)t!=null&&(o=Math.min(...t));else if(P(i))o=i;else if(typeof i==`function`)try{t!=null&&(o=i(t?.[0]))}catch{}else if(typeof i==`string`&&qo.test(i)){var c=qo.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var l=+c[1];o=t[0]-l}}else o=t?.[0];if(a===`auto`)t!=null&&(s=Math.max(...t));else if(P(a))s=a;else if(typeof a==`function`)try{t!=null&&(s=a(t?.[1]))}catch{}else if(typeof a==`string`&&Jo.test(a)){var u=Jo.exec(a);if(u==null||u[1]==null||t==null)s=void 0;else{var d=+u[1];s=t[1]+d}}else s=t?.[1];var f=[o,s];if(N_(f))return t==null?f:P_(f,t,n)}}}var J=e(n(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),ee(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),ee(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,ee=r.constructor,te=r.s==i.s?1:-1,A=r.d,j=i.d;if(!r.s)return new ee(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=j.length,T=A.length,g=new ee(te),_=g.d=[],u=0;j[u]==(A[u]||0);)++u;if(j[u]>(A[u]||0)&&--l,x=o==null?o=ee.precision:s?o+(S(r)-S(i))+1:o,x<0)return new ee(0);if(x=x/p+2|0,u=0,O==1)for(d=0,j=j[0],x++;(u1&&(j=e(j,d),A=e(A,d),O=j.length,T=A.length),w=O,v=A.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(j,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(j,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function ee(e,t){if(e.length>t)return e.length=t,!0}function te(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}else if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=te,i.config=i.set=A,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i);if((i=e[r=`LN10`])!==void 0)if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i);return this}r=te(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}))());function L_(e){return e===0?1:Math.floor(new J.default(e).abs().log(10).toNumber())+1}function R_(e,t,n){for(var r=new J.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var z_=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},B_=(e,t,n)=>{if(e.lte(0))return new J.default(0);var r=L_(e.toNumber()),i=new J.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new J.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?new J.default(s.toNumber()):new J.default(Math.ceil(s.toNumber()))},V_=(e,t,n)=>{var r=new J.default(1),i=new J.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new J.default(10).pow(L_(e)-1),i=new J.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new J.default(Math.floor(e)))}else e===0?i=new J.default(Math.floor((t-1)/2)):n||(i=new J.default(Math.floor(e)));for(var o=Math.floor((t-1)/2),s=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new J.default(0),tickMin:new J.default(0),tickMax:new J.default(0)};var a=B_(new J.default(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new J.default(0):(o=new J.default(e).add(t).div(2),o=o.sub(new J.default(o).mod(a)));var s=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new J.default(t).sub(o).div(a).toNumber()),l=s+c+1;return l>n?H_(e,t,n,r,i+1):(l0?c+(n-l):c,s=t>0?s:s+(n-l)),{step:a,tickMin:o.sub(new J.default(s).mul(a)),tickMax:o.add(new J.default(c).mul(a))})},U_=function(e){var[t,n]=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Math.max(r,2),[o,s]=z_([t,n]);if(o===-1/0||s===1/0){var c=s===1/0?[o,...Array(r-1).fill(1/0)]:[...Array(r-1).fill(-1/0),s];return t>n?c.reverse():c}if(o===s)return V_(o,r,i);var{step:l,tickMin:u,tickMax:d}=H_(o,s,a,i,0),f=R_(u,d.add(new J.default(.1).mul(l)),l);return t>n?f.reverse():f},W_=function(e,t){var[n,r]=e,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[a,o]=z_([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(t,2),c=B_(new J.default(o).sub(a).div(s-1),i,0),l=[...R_(new J.default(a),new J.default(o),c),o];return i===!1&&(l=l.map(e=>Math.round(e))),n>r?l.reverse():l},G_=e=>e.rootProps.maxBarSize,K_=e=>e.rootProps.barGap,q_=e=>e.rootProps.barCategoryGap,J_=e=>e.rootProps.barSize,Y_=e=>e.rootProps.stackOffset,X_=e=>e.rootProps.reverseStackOrder,Z_=e=>e.options.chartName,Q_=e=>e.rootProps.syncId,$_=e=>e.rootProps.syncMethod,ev=e=>e.options.eventEmitter,tv=e=>e.rootProps.baseValue,nv={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},rv={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:`polygon`,cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,orientation:`outer`,reversed:!1,scale:`auto`,tick:!0,tickLine:!0,tickSize:8,type:`auto`,zIndex:nv.axis},iv={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,label:!1,orientation:`right`,radiusAxisId:0,reversed:!1,scale:`auto`,stroke:`#ccc`,tick:!0,tickCount:5,tickLine:!0,type:`auto`,zIndex:nv.axis},av=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function ov(e,t,n){if(n!==`auto`)return n;if(e!=null)return Po(e,t)?`category`:`number`}function sv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function cv(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},oc],(e,t)=>{if(e!=null)return e;var n=ov(t,`angleAxis`,fv.type)??`category`;return cv(cv({},fv),{},{type:n})}),hv=R([(e,t)=>e.polarAxis.radiusAxis[t],oc],(e,t)=>{if(e!=null)return e;var n=ov(t,`radiusAxis`,pv.type)??`category`;return cv(cv({},pv),{},{type:n})}),gv=e=>e.polarOptions,_v=R([es,ts,vs],Cd),vv=R([gv,_v],(e,t)=>{if(e!=null)return Vt(e.innerRadius,t,0)}),yv=R([gv,_v],(e,t)=>{if(e!=null)return Vt(e.outerRadius,t,t*.8)}),bv=R([gv],e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});R([mv,bv],av);var xv=R([_v,vv,yv],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});R([hv,xv],av);var Sv=R([V,gv,vv,yv,es,ts],(e,t,n,r,i,a)=>{if(!(e!==`centric`&&e!==`radial`||t==null||n==null||r==null)){var{cx:o,cy:s,startAngle:c,endAngle:l}=t;return{cx:Vt(o,i,i/2),cy:Vt(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),Y=(e,t)=>t,Cv=(e,t,n)=>n;function wv(e){return e?.id}function Tv(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t=e.data??r;if(!(t==null||t.length===0)){var n=wv(e);t.forEach((t,r)=>{var s=a==null||i?r:String(Mo(t,a,null)),c=Mo(t,e.dataKey,0),l=o.has(s)?o.get(s):{};Object.assign(l,{[n]:c}),o.set(s,l)})}}),Array.from(o.values())}function Ev(e){return`stackId`in e&&e.stackId!=null&&e.dataKey!=null}var Dv=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Ov(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function kv(e,t){if(e.length===t.length){for(var n=0;n{var t=V(e);return t===`horizontal`?`xAxis`:t===`vertical`?`yAxis`:t===`centric`?`angleAxis`:`radiusAxis`},Av=e=>e.tooltip.settings.axisId;function jv(e){if(e in O_)return O_[e]();var t=`scale${Gt(e)}`;if(t in O_)return O_[t]()}function Mv(e){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],n=i[1];return t<=n?e>=t&&e<=n:e>=n&&e<=t},bandwidth:n?()=>n.call(e):void 0,ticks:t?n=>t.call(e,n):void 0,map:(t,n)=>{var r=e(t);if(r!=null){if(e.bandwidth&&n!=null&&n.position){var i=e.bandwidth();switch(n.position){case`middle`:r+=i/2;break;case`end`:r+=i;break;default:break}}return r}}}}function Nv(e,t,n){if(typeof e==`function`)return Mv(e.copy().domain(t).range(n));if(e!=null){var r=jv(e);if(r!=null)return r.domain(t).range(n),Mv(r)}}var Pv=(e,t)=>{if(t!=null)switch(e){case`linear`:if(!N_(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t;default:return t}};function Fv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Iv(e){for(var t=1;te.cartesianAxis.xAxis[t],Uv=(e,t)=>Hv(e,t)??Vv,Z={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Bv,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`left`,padding:{top:0,bottom:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`number`,unit:void 0,width:60},Wv=(e,t)=>e.cartesianAxis.yAxis[t],Gv=(e,t)=>Wv(e,t)??Z,Kv={domain:[0,`auto`],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:``,range:[64,64],scale:`auto`,type:`number`,unit:``},qv=(e,t)=>e.cartesianAxis.zAxis[t]??Kv,Jv=(e,t,n)=>{switch(t){case`xAxis`:return Uv(e,n);case`yAxis`:return Gv(e,n);case`zAxis`:return qv(e,n);case`angleAxis`:return mv(e,n);case`radiusAxis`:return hv(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Yv=(e,t,n)=>{switch(t){case`xAxis`:return Uv(e,n);case`yAxis`:return Gv(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Xv=(e,t,n)=>{switch(t){case`xAxis`:return Uv(e,n);case`yAxis`:return Gv(e,n);case`angleAxis`:return mv(e,n);case`radiusAxis`:return hv(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Zv=e=>e.graphicalItems.cartesianItems.some(e=>e.type===`bar`)||e.graphicalItems.polarItems.some(e=>e.type===`radialBar`);function Qv(e,t){return n=>{switch(e){case`xAxis`:return`xAxisId`in n&&n.xAxisId===t;case`yAxis`:return`yAxisId`in n&&n.yAxisId===t;case`zAxis`:return`zAxisId`in n&&n.zAxisId===t;case`angleAxis`:return`angleAxisId`in n&&n.angleAxisId===t;case`radiusAxis`:return`radiusAxisId`in n&&n.radiusAxisId===t;default:return!1}}}var $v=e=>e.graphicalItems.cartesianItems,ey=R([Y,Cv],Qv),ty=(e,t,n)=>e.filter(n).filter(e=>t?.includeHidden===!0?!0:!e.hide),ny=R([$v,Jv,ey],ty,{memoizeOptions:{resultEqualityCheck:Ov}}),ry=R([ny],e=>e.filter(e=>e.type===`area`||e.type===`bar`).filter(Ev)),iy=e=>e.filter(e=>!(`stackId`in e)||e.stackId===void 0),ay=R([ny],iy),oy=e=>e.map(e=>e.data).filter(Boolean).flat(1),sy=R([ny],oy,{memoizeOptions:{resultEqualityCheck:Ov}}),cy=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},ly=R([sy,j_],cy),uy=(e,t,n)=>t?.dataKey==null?n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:Mo(e,t)}))):e.map(e=>({value:e})):e.map(e=>({value:Mo(e,t.dataKey)})),dy=R([ly,Jv,ny],uy);function fy(e,t){switch(e){case`xAxis`:return t.direction===`x`;case`yAxis`:return t.direction===`y`;default:return!1}}function py(e){if(Rt(e)||e instanceof Date){var t=Number(e);if(B(t))return t}}function my(e){if(Array.isArray(e)){var t=[py(e[0]),py(e[1])];return N_(t)?t:void 0}var n=py(e);if(n!=null)return[n,n]}function hy(e){return e.map(py).filter(Kt)}function gy(e,t,n){return!n||typeof t!=`number`||It(t)||!n.length?[]:hy(n.flatMap(n=>{var r=Mo(e,n.dataKey),i,a;if(Array.isArray(r)?[i,a]=r:i=a=r,!(!B(i)||!B(a)))return[t-i,t+a]}))}var Q=e=>Xv(e,X(e),Av(e)),_y=R([Q],e=>e?.dataKey),vy=R([ry,j_,Q],Tv),yy=(e,t,n,r)=>{var i=t.reduce((e,t)=>{if(t.stackId==null)return e;var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},{});return Object.fromEntries(Object.entries(i).map(t=>{var[i,a]=t,o=r?[...a].reverse():a;return[i,{stackedData:zo(e,o.map(wv),n),graphicalItems:o}]}))},by=R([vy,ry,Y_,X_],yy),xy=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!==`zAxis`){var o=Ko(e,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},Sy=R([Jv],e=>e.allowDataOverflow),Cy=e=>{if(e==null||!(`domain`in e))return Bv;if(e.domain!=null)return e.domain;if(`ticks`in e&&e.ticks!=null){if(e.type===`number`){var t=hy(e.ticks);return[Math.min(...t),Math.max(...t)]}if(e.type===`category`)return e.ticks.map(String)}return e?.domain??Bv},wy=R([Jv],Cy),Ty=R([wy,Sy],F_),Ey=R([by,k_,Y,Ty],xy,{memoizeOptions:{resultEqualityCheck:Dv}}),Dy=e=>e.errorBars,Oy=(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>fy(n,e)),ky=function(){var e=[...arguments].filter(Boolean);if(e.length!==0){var t=e.flat();return[Math.min(...t),Math.max(...t)]}},Ay=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s=r[n.id]?.filter(e=>fy(i,e)),c=Mo(e,t.dataKey??n.dataKey),l=gy(e,c,s);if(l.length>=2){var u=Math.min(...l),d=Math.max(...l);(a==null||uo)&&(o=d)}var f=my(c);f!=null&&(a=a==null?f[0]:Math.min(a,f[0]),o=o==null?f[1]:Math.max(o,f[1]))})}),t?.dataKey!=null&&e.forEach(e=>{var n=my(Mo(e,t.dataKey));n!=null&&(a=a==null?n[0]:Math.min(a,n[0]),o=o==null?n[1]:Math.max(o,n[1]))}),B(a)&&B(o))return[a,o]},jy=R([ly,Jv,ay,Dy,Y],Ay,{memoizeOptions:{resultEqualityCheck:Dv}});function My(e){var{value:t}=e;if(Rt(t)||t instanceof Date)return t}var Ny=(e,t,n)=>{var r=e.map(My).filter(e=>e!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&Ht(r))?(0,D_.default)(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},Py=e=>e.referenceElements.dots,Fy=(e,t,n)=>e.filter(e=>e.ifOverflow===`extendDomain`).filter(e=>t===`xAxis`?e.xAxisId===n:e.yAxisId===n),Iy=R([Py,Y,Cv],Fy),Ly=e=>e.referenceElements.areas,Ry=R([Ly,Y,Cv],Fy),zy=e=>e.referenceElements.lines,By=R([zy,Y,Cv],Fy),Vy=(e,t)=>{if(e!=null){var n=hy(e.map(e=>t===`xAxis`?e.x:e.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Hy=R(Iy,Y,Vy),Uy=(e,t)=>{if(e!=null){var n=hy(e.flatMap(e=>[t===`xAxis`?e.x1:e.y1,t===`xAxis`?e.x2:e.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Wy=R([Ry,Y],Uy);function Gy(e){if(e.x!=null)return hy([e.x]);var t=e.segment?.map(e=>e.x);return t==null||t.length===0?[]:hy(t)}function Ky(e){if(e.y!=null)return hy([e.y]);var t=e.segment?.map(e=>e.y);return t==null||t.length===0?[]:hy(t)}var qy=(e,t)=>{if(e!=null){var n=e.flatMap(e=>t===`xAxis`?Gy(e):Ky(e));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Jy=R(Hy,R([By,Y],qy),Wy,(e,t,n)=>ky(e,n,t)),Yy=(e,t,n,r,i,a,o,s)=>n??I_(t,o===`vertical`&&s===`xAxis`||o===`horizontal`&&s===`yAxis`?ky(r,a,i):ky(a,i),e.allowDataOverflow),Xy=R([Jv,wy,Ty,Ey,jy,Jy,V,Y],Yy,{memoizeOptions:{resultEqualityCheck:Dv}}),Zy=[0,1],Qy=(e,t,n,r,i,a,o)=>{if(!((e==null||n==null||n.length===0)&&o===void 0)){var{dataKey:s,type:c}=e,l=Po(t,a);return l&&s==null?(0,D_.default)(0,n?.length??0):c===`category`?Ny(r,e,l):i===`expand`?Zy:o}},$y=R([Jv,V,ly,dy,Y_,Y,Xy],Qy);function eb(e){return e in O_}var tb=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r===`auto`)return i===`category`&&n&&(n.indexOf(`LineChart`)>=0||n.indexOf(`AreaChart`)>=0||n.indexOf(`ComposedChart`)>=0&&!t)?`point`:i===`category`?`band`:`linear`;if(typeof r==`string`){var a=`scale${Gt(r)}`;return eb(a)?a:`point`}}},nb=R([Jv,Zv,Z_],tb);function rb(e,t,n,r){if(!(n==null||r==null))return typeof e.scale==`function`?Nv(e.scale,n,r):Nv(t,n,r)}var ib=(e,t,n)=>{var r=Cy(t);if(!(n!==`auto`&&n!==`linear`)){if(t!=null&&t.tickCount&&Array.isArray(r)&&(r[0]===`auto`||r[1]===`auto`)&&N_(e))return U_(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type===`number`&&N_(e))return W_(e,t.tickCount,t.allowDecimals)}},ab=R([$y,Xv,nb],ib),ob=(e,t,n,r)=>{if(r!==`angleAxis`&&e?.type===`number`&&N_(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0]??0,o=t[1],s=n[n.length-1]??0;return[Math.min(i,a),Math.max(o,s)]}return t},sb=R([Jv,$y,ab,Y],ob),cb=R(R(dy,Jv,(e,t)=>{if(!(!t||t.type!==`number`)){var n=1/0,r=Array.from(hy(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var s=0;si,(e,t,n,r,i)=>{if(!B(e))return 0;var a=t===`vertical`?r.height:r.width;if(i===`gap`)return e*a/2;if(i===`no-gap`){var o=Vt(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),lb=(e,t,n)=>{var r=Uv(e,t);return r==null||typeof r.padding!=`string`?0:cb(e,`xAxis`,t,n,r.padding)},ub=(e,t,n)=>{var r=Gv(e,t);return r==null||typeof r.padding!=`string`?0:cb(e,`yAxis`,t,n,r.padding)},db=R(Uv,lb,(e,t)=>{if(e==null)return{left:0,right:0};var{padding:n}=e;return typeof n==`string`?{left:t,right:t}:{left:(n.left??0)+t,right:(n.right??0)+t}}),fb=R(Gv,ub,(e,t)=>{if(e==null)return{top:0,bottom:0};var{padding:n}=e;return typeof n==`string`?{top:t,bottom:t}:{top:(n.top??0)+t,bottom:(n.bottom??0)+t}}),pb=R([vs,db,ws,Cs,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),mb=R([vs,V,fb,ws,Cs,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t===`horizontal`?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),hb=(e,t,n,r)=>{switch(t){case`xAxis`:return pb(e,n,r);case`yAxis`:return mb(e,n,r);case`zAxis`:return qv(e,n)?.range;case`angleAxis`:return bv(e);case`radiusAxis`:return xv(e,n);default:return}},gb=R([Jv,hb],av),_b=R([Jv,nb,R([nb,sb],Pv),gb],rb);R([ny,Dy,Y],Oy);function vb(e,t){return e.idt.id)}var yb=(e,t)=>t,bb=(e,t,n)=>n,xb=R(is,yb,bb,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(vb)),Sb=R(as,yb,bb,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(vb)),Cb=(e,t)=>({width:e.width,height:t.height}),wb=(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height}),Tb=R(vs,Uv,Cb),Eb=(e,t,n)=>{switch(t){case`top`:return e.top;case`bottom`:return n-e.bottom;default:return 0}},Db=(e,t,n)=>{switch(t){case`left`:return e.left;case`right`:return n-e.right;default:return 0}},Ob=R(ts,vs,xb,yb,bb,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=Cb(t,n);o??=Eb(t,r,e);var c=r===`top`&&!i||r===`bottom`&&i;a[n.id]=o-Number(c)*s.height,o+=(c?-1:1)*s.height}),a}),kb=R(es,vs,Sb,yb,bb,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=wb(t,n);o??=Db(t,r,e);var c=r===`left`&&!i||r===`right`&&i;a[n.id]=o-Number(c)*s.width,o+=(c?-1:1)*s.width}),a}),Ab=R([vs,Uv,(e,t)=>{var n=Uv(e,t);if(n!=null)return Ob(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),jb=R([vs,Gv,(e,t)=>{var n=Gv(e,t);if(n!=null)return kb(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),Mb=R(vs,Gv,(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height})),Nb=(e,t,n)=>{switch(t){case`xAxis`:return Tb(e,n).width;case`yAxis`:return Mb(e,n).height;default:return}},Pb=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=Po(e,r),c=t.map(e=>e.value);if(o&&s&&a===`category`&&i&&Ht(c))return c}},Fb=R([V,dy,Jv,Y],Pb),Ib=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:i,scale:a}=n;if(Po(e,r)&&(i===`number`||a!==`auto`))return t.map(e=>e.value)}},Lb=R([V,dy,Xv,Y],Ib),Rb=R([V,Yv,nb,_b,Fb,Lb,hb,ab,Y],(e,t,n,r,i,a,o,s,c)=>{if(t!=null){var l=Po(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}}),zb=R([V,Xv,nb,_b,ab,hb,Fb,Lb,Y],(e,t,n,r,i,a,o,s,c)=>{if(!(t==null||r==null)){var l=Po(e,c),{type:u,ticks:d,tickCount:f}=t,p=n===`scaleBand`&&typeof r.bandwidth==`function`?r.bandwidth()/2:2,m=u===`category`&&r.bandwidth?r.bandwidth()/p:0;m=c===`angleAxis`&&a!=null&&a.length>=2?Ft(a[0]-a[1])*2*m:m;var h=d||i;return h?h.map((e,t)=>{var n=o?o.indexOf(e):e,i=r.map(n);return B(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(Kt):l&&s?s.map((e,t)=>{var n=r.map(e);return B(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Kt):r.ticks?r.ticks(f).map((e,t)=>{var n=r.map(e);return B(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Kt):r.domain().map((e,t)=>{var n=r.map(e);return B(n)?{coordinate:n+m,value:o?o[e]:e,index:t,offset:m}:null}).filter(Kt)}}),Bb=R([V,Xv,_b,hb,Fb,Lb,Y],(e,t,n,r,i,a,o)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var s=Po(e,o),{tickCount:c}=t,l=0;return l=o===`angleAxis`&&r?.length>=2?Ft(r[0]-r[1])*2*l:l,s&&a?a.map((e,t)=>{var r=n.map(e);return B(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Kt):n.ticks?n.ticks(c).map((e,t)=>{var r=n.map(e);return B(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Kt):n.domain().map((e,t)=>{var r=n.map(e);return B(r)?{coordinate:r+l,value:i?i[e]:e,index:t,offset:l}:null}).filter(Kt)}}),Vb=R(Jv,_b,(e,t)=>{if(!(e==null||t==null))return Iv(Iv({},e),{},{scale:t})});R((e,t,n)=>qv(e,n),R([Jv,nb,$y,gb],rb),(e,t)=>{if(!(e==null||t==null))return Iv(Iv({},e),{},{scale:t})});var Hb=R([V,is,as],(e,t,n)=>{switch(e){case`horizontal`:return t.some(e=>e.reversed)?`right-to-left`:`left-to-right`;case`vertical`:return n.some(e=>e.reversed)?`bottom-to-top`:`top-to-bottom`;case`centric`:case`radial`:return`left-to-right`;default:return}}),Ub=e=>e.options.defaultTooltipEventType,Wb=e=>e.options.validateTooltipEventTypes;function Gb(e,t,n){if(e==null)return t;var r=e?`axis`:`item`;return n==null?t:n.includes(r)?r:t}function Kb(e,t){return Gb(t,Ub(e),Wb(e))}function qb(e){return L(t=>Kb(t,e))}var Jb=(e,t)=>{var n,r=Number(t);if(!(It(r)||t==null))return r>=0?e==null||(n=e[r])==null?void 0:n.value:void 0},Yb=e=>e.tooltip.settings,Xb={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Zb=Aa({name:`tooltip`,initialState:{itemInteraction:{click:Xb,hover:Xb},axisInteraction:{click:Xb,hover:Xb},keyboardInteraction:Xb,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:`hover`,axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(H(t.payload))},prepare:z()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=ra(e).tooltipItemPayloads.indexOf(H(n));i>-1&&(e.tooltipItemPayloads[i]=H(r))},prepare:z()},removeTooltipEntrySettings:{reducer(e,t){var n=ra(e).tooltipItemPayloads.indexOf(H(t.payload));n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:z()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:Qb,replaceTooltipEntrySettings:$b,removeTooltipEntrySettings:ex,setTooltipSettingsState:tx,setActiveMouseOverItemIndex:nx,mouseLeaveItem:rx,mouseLeaveChart:ix,setActiveClickItemIndex:ax,setMouseOverAxisIndex:ox,setMouseClickAxisIndex:sx,setSyncInteraction:cx,setKeyboardInteraction:lx}=Zb.actions,ux=Zb.reducer;function dx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fx(e){for(var t=1;t{if(t==null)return Xb;var i=gx(e,t,n);if(i==null)return Xb;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(_x(i)){if(a)return fx(fx({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return fx(fx({},Xb),{},{coordinate:i.coordinate})};function yx(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function bx(e,t){var n=yx(e),r=t[0],i=t[1];return n===void 0?!1:n>=Math.min(r,i)&&n<=Math.max(r,i)}function xx(e,t,n){if(n==null||t==null)return!0;var r=Mo(e,t);return r==null||!N_(n)?!0:bx(r,n)}var Sx=(e,t,n,r)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!B(a))return i;var o=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(o,Math.min(a,s)),l=t[c];return l==null||xx(l,n,r)?String(c):null},Cx=(e,t,n,r,i,a,o)=>{if(a!=null){var s=o[0]?.getPosition(a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(n){case`horizontal`:return{x:c.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:c.coordinate}}}},wx=(e,t,n,r)=>{if(t===`axis`)return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i=n===`hover`?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId;if(i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a==null?[]:[a]}return e.tooltipItemPayloads.filter(e=>e.settings?.graphicalItemId===i)},Tx=e=>e.options.tooltipPayloadSearcher,Ex=e=>e.tooltip;function Dx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ox(e){for(var t=1;t{if(!(t==null||a==null)){var{chartData:s,computedData:c,dataStartIndex:l,dataEndIndex:u}=n;return e.reduce((e,n)=>{var{dataDefinedOnItem:d,settings:f}=n,p=Mx(d,s),m=Array.isArray(p)?To(p,l,u):p,h=f?.dataKey??r,g=f?.nameKey,_=r&&Array.isArray(m)&&!Array.isArray(m[0])&&o===`axis`?Wt(m,r,i):a(m,t,c,g);return Array.isArray(_)?_.forEach(t=>{var n=Ox(Ox({},f),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(Xo({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:Mo(t.payload,t.dataKey),name:t.name}))}):e.push(Xo({tooltipEntrySettings:f,dataKey:h,payload:_,value:Mo(_,h),name:Mo(_,g)??f?.name})),e},[])}},Px=R([Q,Zv,Z_],tb),Fx=R([R([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Q,R([X,Av],Qv)],ty,{memoizeOptions:{resultEqualityCheck:Ov}}),Ix=R([Fx],e=>e.filter(Ev)),Lx=R([R([Fx],oy,{memoizeOptions:{resultEqualityCheck:Ov}}),k_],cy),Rx=R([Ix,k_,Q],Tv),zx=R([Lx,Q,Fx],uy),Bx=R([Q],Cy),Vx=R([Bx,R([Q],e=>e.allowDataOverflow)],F_),Hx=R([R([Rx,R([Fx],e=>e.filter(Ev)),Y_,X_],yy),k_,X,Vx],xy),Ux=R([Lx,Q,R([Fx],iy),Dy,X],Ay,{memoizeOptions:{resultEqualityCheck:Dv}}),Wx=R([R([Py,X,Av],Fy),X],Vy),Gx=R([R([Ly,X,Av],Fy),X],Uy),Kx=R([Q,V,Lx,zx,Y_,X,R([Q,Bx,Vx,Hx,Ux,R([Wx,R([R([zy,X,Av],Fy),X],qy),Gx],ky),V,X],Yy)],Qy),qx=R([Q,Kx,R([Kx,Q,Px],ib),X],ob),Jx=e=>hb(e,X(e),Av(e),!1),Yx=R([Q,Jx],av),Xx=R([Q,Px,qx,Yx],rb),Zx=R([V,Q,Px,Xx,Jx,R([V,zx,Q,X],Pb),R([V,zx,Q,X],Ib),X],(e,t,n,r,i,a,o,s)=>{if(t){var{type:c}=t,l=Po(e,s);if(r){var u=n===`scaleBand`&&r.bandwidth?r.bandwidth()/2:2,d=c===`category`&&r.bandwidth?r.bandwidth()/u:0;return d=s===`angleAxis`&&i!=null&&i?.length>=2?Ft(i[0]-i[1])*2*d:d,l&&o?o.map((e,t)=>{var n=r.map(e);return B(n)?{coordinate:n+d,value:e,index:t,offset:d}:null}).filter(Kt):r.domain().map((e,t)=>{var n=r.map(e);return B(n)?{coordinate:n+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(Kt)}}}),Qx=R([Ub,Wb,Yb],(e,t,n)=>Gb(n.shared,e,t)),$x=e=>e.tooltip.settings.trigger,eS=e=>e.tooltip.settings.defaultIndex,tS=R([Ex,Qx,$x,eS],vx),nS=R([tS,Lx,_y,Kx],Sx),rS=R([Zx,nS],Jb),iS=R([tS],e=>{if(e)return e.dataKey}),aS=R([tS],e=>{if(e)return e.graphicalItemId}),oS=R([Ex,Qx,$x,eS],wx),sS=R([tS,R([es,ts,V,vs,Zx,eS,oS],Cx)],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),cS=R([tS],e=>e?.active??!1),lS=R([R([oS,nS,k_,_y,rS,Tx,Qx],Nx)],e=>{if(e!=null){var t=e.map(e=>e.payload).filter(e=>e!=null);return Array.from(new Set(t))}});function uS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dS(e){for(var t=1;tL(Q),gS=()=>{var e=hS(),t=L(Zx),n=L(Xx);return Yo(!e||!n?void 0:dS(dS({},e),{},{scale:n}),t)};function _S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vS(e){for(var t=1;t{var i=t.find(e=>e&&e.index===n);if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.chartY};if(e===`vertical`)return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}},CS=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`centric`){var a=i.coordinate,{radius:o}=r;return vS(vS(vS({},r),W(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:c}=r;return vS(vS(vS({},r),W(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function wS(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var TS=(e,t,n,r,i)=>{var a=t?.length??0;if(a<=1||e==null)return 0;if(r===`angleAxis`&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=0;o0?n[o-1]?.coordinate:n[a-1]?.coordinate,c=n[o]?.coordinate,l=o>=a-1?n[0]?.coordinate:n[o+1]?.coordinate,u=void 0;if(!(s==null||c==null||l==null))if(Ft(c-s)!==Ft(l-c)){var d=[];if(Ft(l-c)===Ft(i[1]-i[0])){u=l;var f=c+i[1]-i[0];d[0]=Math.min(f,(f+s)/2),d[1]=Math.max(f,(f+s)/2)}else{u=s;var p=l+i[1]-i[0];d[0]=Math.min(c,(p+c)/2),d[1]=Math.max(c,(p+c)/2)}var m=[Math.min(c,(u+c)/2),Math.max(c,(u+c)/2)];if(e>m[0]&&e<=m[1]||e>=d[0]&&e<=d[1])return n[o]?.index}else{var h=Math.min(s,l),g=Math.max(s,l);if(e>(h+c)/2&&e<=(g+c)/2)return n[o]?.index}}else if(t)for(var _=0;_(v.coordinate+b.coordinate)/2||_>0&&_(v.coordinate+b.coordinate)/2&&e<=(v.coordinate+y.coordinate)/2)return v.index}}return-1},ES=()=>L(Z_),DS=(e,t)=>t,OS=(e,t,n)=>n,kS=(e,t,n,r)=>r,AS=R(Zx,e=>(0,Sr.default)(e,e=>e.coordinate)),jS=R([Ex,DS,OS,kS],vx),MS=R([jS,Lx,_y,Kx],Sx),NS=(e,t,n)=>{if(t!=null){var r=Ex(e);return t===`axis`?n===`hover`?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n===`hover`?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},PS=R([Ex,DS,OS,kS],wx),FS=R([es,ts,V,vs,Zx,kS,PS],Cx),IS=R([jS,FS],(e,t)=>e.coordinate??t),LS=R([Zx,MS],Jb),RS=R([PS,MS,k_,_y,LS,Tx,DS],Nx),zS=R([jS,MS],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),BS=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&wS(e,o)){var s=TS(Qo(e,t),a,i,n,r),c=SS(t,i,s,e);return{activeIndex:String(s),activeCoordinate:c}}},VS=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var s=Od(e,n);if(s){var c=TS($o(s,t),o,a,r,i),l=CS(t,a,c,s);return{activeIndex:String(c),activeCoordinate:l}}}},HS=(e,t,n,r,i,a,o,s)=>{if(!(!e||!t||!r||!i||!a))return t===`horizontal`||t===`vertical`?BS(e,t,r,i,a,o,s):VS(e,t,n,r,i,a,o)},US=R(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),WS=R(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(nv));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:kv}});function GS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function KS(e){for(var t=1;tKS(KS({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},ZS=new Set(Object.values(nv));function QS(e){return ZS.has(e)}var $S=Aa({name:`zIndex`,initialState:XS,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:z()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(--e.zIndexMap[n].consumers,e.zIndexMap[n].consumers<=0&&!QS(n)&&delete e.zIndexMap[n])},prepare:z()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=H(r):e.zIndexMap[n].element=H(r):e.zIndexMap[n]={consumers:0,element:i?void 0:H(r),panoramaElement:i?H(r):void 0}},prepare:z()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:z()}}}),{registerZIndexPortal:eC,unregisterZIndexPortal:tC,registerZIndexPortalElement:nC,unregisterZIndexPortalElement:rC}=$S.actions,iC=$S.reducer;function aC(e){var{zIndex:t,children:n}=e,r=sc()&&t!==void 0&&t!==0,i=Ss(),a=I();(0,c.useLayoutEffect)(()=>r?(a(eC({zIndex:t})),()=>{a(tC({zIndex:t}))}):qt,[a,t,r]);var o=L(e=>US(e,t,i));return r?o?(0,b.createPortal)(n,o):null:n}function oC(){return oC=Object.assign?Object.assign.bind():function(e){for(var t=1;t(0,c.useContext)(hC),_C=e(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!It(n))return e[n]}},SC=Aa({name:`options`,initialState:{chartName:``,tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:`axis`},reducers:{createEventEmitter:e=>{e.eventEmitter??=Symbol(`rechartsEventEmitter`)}}}),CC=SC.reducer,{createEventEmitter:wC}=SC.actions;function TC(e){return e.tooltip.syncInteraction}var EC=Aa({name:`chartData`,initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=H(t.payload),t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:DC,setDataStartEndIndexes:OC,setComputedData:kC}=EC.actions,AC=EC.reducer,jC=[`x`,`y`];function MC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function NC(e){for(var t=1;t{if(e==null)return qt;var s=(s,c,l)=>{if(t!==l&&e===s){if(r===`index`){var u;if(o&&c!=null&&(u=c.payload)!=null&&u.coordinate&&c.payload.sourceViewBox){var d=c.payload.coordinate,{x:f,y:p}=d,m=LC(d,jC),{x:h,y:g,width:_,height:v}=c.payload.sourceViewBox,y=NC(NC({},m),{},{x:o.x+(_?(f-h)/_:0)*o.width,y:o.y+(v?(p-g)/v:0)*o.height});n(NC(NC({},c),{},{payload:NC(NC({},c.payload),{},{coordinate:y})}))}else n(c);return}if(i!=null){var b;typeof r==`function`?b=i[r(i,{activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate})]:r===`value`&&(b=i.find(e=>String(e.value)===c.payload.label));var{coordinate:x}=c.payload;if(b==null||c.payload.active===!1||x==null||o==null){n(cx({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:S,y:C}=x,w=Math.min(S,o.x+o.width),T=Math.min(C,o.y+o.height),E={x:a===`horizontal`?b.coordinate:w,y:a===`horizontal`?T:b.coordinate};n(cx({active:c.payload.active,coordinate:E,dataKey:c.payload.dataKey,index:String(b.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId}))}}};return vC.on(yC,s),()=>{vC.off(yC,s)}},[L(e=>e.rootProps.className),n,t,e,r,i,a,o])}function BC(){var e=L(Q_),t=L(ev),n=I();(0,c.useEffect)(()=>{if(e==null)return qt;var r=(r,i,a)=>{t!==a&&e===r&&n(OC(i))};return vC.on(bC,r),()=>{vC.off(bC,r)}},[n,t,e])}function VC(){var e=I();(0,c.useEffect)(()=>{e(wC())},[e]),zC(),BC()}function HC(e,t,n,r,i,a){var o=L(n=>NS(n,e,t)),s=L(ev),l=L(Q_),u=L($_),d=L(TC)?.active,f=Qs();(0,c.useEffect)(()=>{if(!d&&l!=null&&s!=null){var e=cx({active:a,coordinate:n,dataKey:o,index:i,label:typeof r==`number`?String(r):r,sourceViewBox:f,graphicalItemId:void 0});vC.emit(yC,l,e,s)}},[d,n,o,i,r,s,l,u,a,f])}function UC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function WC(e){for(var t=1;t{C(tx({shared:_,trigger:v,axisId:S,active:n,defaultIndex:w}))},[C,_,v,S,n,w]);var T=Qs(),E=Ml(),D=qb(_),{activeIndex:O,isActive:k}=L(e=>zS(e,D,v,w))??{},ee=L(e=>RS(e,D,v,w)),te=L(e=>LS(e,D,v,w)),A=L(e=>IS(e,D,v,w)),j=ee,M=gC(),ne=n??k??!1,[re,ie]=Dr([j,ne]),ae=D===`axis`?te:void 0;HC(D,v,A,ae,O,ne);var oe=x??M;if(oe==null||T==null||D==null)return null;var se=j??XC;ne||(se=XC),s&&se.length&&(se=Yn(se.filter(e=>e.value!=null&&(e.hide!==!0||t.includeHidden)),d,JC));var ce=se.length>0,le=c.createElement(jl,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:l,active:ne,coordinate:A,hasPayload:ce,offset:u,position:f,reverseDirection:p,useTranslate3d:m,viewBox:T,wrapperStyle:h,lastBoundingBox:re,innerRef:ie,hasPortalFromProps:!!x},YC(o,WC(WC({},t),{},{payload:se,label:ae,active:ne,activeIndex:O,coordinate:A,accessibilityLayer:E})));return c.createElement(c.Fragment,null,(0,b.createPortal)(le,oe),ne&&c.createElement(mC,{cursor:g,tooltipEventType:D,coordinate:A,payload:se,index:O}))}function $C(e,t,n){return(t=ew(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ew(e){var t=tw(e,`string`);return typeof t==`symbol`?t:t+``}function tw(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var nw=class{constructor(e){$C(this,`cache`,new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};function rw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function iw(e){for(var t=1;t{try{var n=document.getElementById(dw);n||(n=document.createElement(`span`),n.setAttribute(`id`,dw),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n)),Object.assign(n.style,uw,t),n.textContent=`${e}`;var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},mw=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Bu.isSsr)return{width:0,height:0};if(!cw.enableCache)return pw(e,t);var n=fw(e,t),r=lw.get(n);if(r)return r;var i=pw(e,t);return lw.set(n,i),i},hw;function gw(e,t,n){return(t=_w(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _w(e){var t=vw(e,`string`);return typeof t==`symbol`?t:t+``}function vw(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var yw=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,bw=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,xw=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Sw=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Cw={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},ww=[`cm`,`mm`,`pt`,`pc`,`in`,`Q`,`px`];function Tw(e){return ww.includes(e)}var Ew=`NaN`;function Dw(e,t){return e*Cw[t]}var Ow=class e{static parse(t){var[,n,r]=Sw.exec(t)??[];return n==null?e.NaN:new e(parseFloat(n),r??``)}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,It(e)&&(this.unit=``),t!==``&&!xw.test(t)&&(this.num=NaN,this.unit=``),Tw(t)&&(this.num=Dw(e,t),this.unit=`px`)}add(t){return this.unit===t.unit?new e(this.num+t.num,this.unit):new e(NaN,``)}subtract(t){return this.unit===t.unit?new e(this.num-t.num,this.unit):new e(NaN,``)}multiply(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num/t.num,this.unit||t.unit)}toString(){return`${this.num}${this.unit}`}isNaN(){return It(this.num)}};hw=Ow,gw(Ow,`NaN`,new hw(NaN,``));function kw(e){if(e==null||e.includes(Ew))return Ew;for(var t=e;t.includes(`*`)||t.includes(`/`);){var[,n,r,i]=yw.exec(t)??[],a=Ow.parse(n??``),o=Ow.parse(i??``),s=r===`*`?a.multiply(o):a.divide(o);if(s.isNaN())return Ew;t=t.replace(yw,s.toString())}for(;t.includes(`+`)||/.-\d+(?:\.\d+)?/.test(t);){var[,c,l,u]=bw.exec(t)??[],d=Ow.parse(c??``),f=Ow.parse(u??``),p=l===`+`?d.add(f):d.subtract(f);if(p.isNaN())return Ew;t=t.replace(bw,p.toString())}return t}var Aw=/\(([^()]*)\)/;function jw(e){for(var t=e,n;(n=Aw.exec(t))!=null;){var[,r]=n;t=t.replace(Aw,kw(r))}return t}function Mw(e){var t=e.replace(/\s+/g,``);return t=jw(t),t=kw(t),t}function Nw(e){try{return Mw(e)}catch{return Ew}}function Pw(e){var t=Nw(e.slice(5,-1));return t===Ew?``:t}var Fw=[`x`,`y`,`lineHeight`,`capHeight`,`fill`,`scaleToFit`,`textAnchor`,`verticalAnchor`],Iw=[`dx`,`dy`,`angle`,`className`,`breakAll`];function Lw(){return Lw=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];return F(t)||(i=n?t.toString().split(``):t.toString().split(Bw)),{wordsWithComputedWidth:i.map(e=>({word:e,width:mw(e,r).width})),spaceWidth:n?0:mw(`\xA0`,r).width}}catch{return null}};function Hw(e){return e===`start`||e===`middle`||e===`end`||e===`inherit`}var Uw=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];if(s&&o!=null&&(t==null||r||s.width+o+ne.reduce((e,t)=>e.width>t.width?e:t),Gw=`…`,Kw=(e,t,n,r,i,a,o,s)=>{var c=Vw({breakAll:n,style:r,children:e.slice(0,t)+Gw});if(!c)return[!1,[]];var l=Uw(c.wordsWithComputedWidth,a,o,s);return[l.length>i||Ww(l).width>Number(a),l]},qw=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:s,breakAll:c}=e,l=P(a),u=String(o),d=Uw(t,r,n,i);if(!l||i||!(d.length>a||Ww(d).width>Number(r)))return d;for(var f=0,p=u.length-1,m=0,h;f<=p&&m<=u.length-1;){var g=Math.floor((f+p)/2),[_,v]=Kw(u,g-1,c,s,a,r,n,i),[y]=Kw(u,g,c,s,a,r,n,i);if(!_&&!y&&(f=g+1),_&&y&&(p=g-1),!_&&y){h=v;break}m++}return h||d},Jw=e=>[{words:F(e)?[]:e.toString().split(Bw),width:void 0}],Yw=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Bu.isSsr){var s,c,l=Vw({breakAll:a,children:r,style:i});if(l){var{wordsWithComputedWidth:u,spaceWidth:d}=l;s=u,c=d}else return Jw(r);return qw({breakAll:a,children:r,maxLines:o,style:i},s,c,t,!!n)}return Jw(r)},Xw=`#808080`,Zw={angle:0,breakAll:!1,capHeight:`0.71em`,fill:Xw,lineHeight:`1em`,scaleToFit:!1,textAnchor:`start`,verticalAnchor:`end`,x:0,y:0},Qw=(0,c.forwardRef)((e,t)=>{var n=yn(e,Zw),{x:r,y:i,lineHeight:a,capHeight:o,fill:s,scaleToFit:l,textAnchor:d,verticalAnchor:f}=n,p=Rw(n,Fw),m=(0,c.useMemo)(()=>Yw({breakAll:p.breakAll,children:p.children,maxLines:p.maxLines,scaleToFit:l,style:p.style,width:p.width}),[p.breakAll,p.children,p.maxLines,l,p.style,p.width]),{dx:h,dy:g,angle:_,className:y,breakAll:b}=p,x=Rw(p,Iw);if(!Rt(r)||!Rt(i)||m.length===0)return null;var S=Number(r)+(P(h)?h:0),C=Number(i)+(P(g)?g:0);if(!B(S)||!B(C))return null;var w;switch(f){case`start`:w=Pw(`calc(${o})`);break;case`middle`:w=Pw(`calc(${(m.length-1)/2} * -${a} + (${o} / 2))`);break;default:w=Pw(`calc(${m.length-1} * -${a})`);break}var T=[],E=m[0];if(l&&E!=null){var D=E.width,{width:O}=p;T.push(`scale(${P(O)&&P(D)?O/D:1})`)}return _&&T.push(`rotate(${_}, ${S}, ${C})`),T.length&&(x.transform=T.join(` `)),c.createElement(`text`,Lw({},v(x),{ref:t,x:S,y:C,className:u(`recharts-text`,y),textAnchor:d,fill:s.includes(`url`)?Xw:s}),m.map((e,t)=>{var n=e.words.join(b?``:` `);return c.createElement(`tspan`,{x:S,dy:t===0?w:a,key:`${n}-${t}`},n)}))});Qw.displayName=`Text`;function $w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eT(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i,clamp:a}=e,{x:o,y:s,height:c,upperWidth:l,lowerWidth:u}=Zs(t),d=o,f=o+(l-u)/2,p=(d+f)/2,m=(l+u)/2,h=d+l/2,g=c>=0?1:-1,_=g*r,v=g>0?`end`:`start`,y=g>0?`start`:`end`,b=l>=0?1:-1,x=b*r,S=b>0?`end`:`start`,C=b>0?`start`:`end`,w=i;if(n===`top`){var T={x:d+l/2,y:s-_,horizontalAnchor:`middle`,verticalAnchor:v};return a&&w&&(T.height=Math.max(s-w.y,0),T.width=l),T}if(n===`bottom`){var E={x:f+u/2,y:s+c+_,horizontalAnchor:`middle`,verticalAnchor:y};return a&&w&&(E.height=Math.max(w.y+w.height-(s+c),0),E.width=u),E}if(n===`left`){var D={x:p-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`};return a&&w&&(D.width=Math.max(D.x-w.x,0),D.height=c),D}if(n===`right`){var O={x:p+m+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`};return a&&w&&(O.width=Math.max(w.x+w.width-O.x,0),O.height=c),O}var k=a&&w?{width:m,height:c}:{};return n===`insideLeft`?eT({x:p+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`},k):n===`insideRight`?eT({x:p+m-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`},k):n===`insideTop`?eT({x:d+l/2,y:s+_,horizontalAnchor:`middle`,verticalAnchor:y},k):n===`insideBottom`?eT({x:f+u/2,y:s+c-_,horizontalAnchor:`middle`,verticalAnchor:v},k):n===`insideTopLeft`?eT({x:d+x,y:s+_,horizontalAnchor:C,verticalAnchor:y},k):n===`insideTopRight`?eT({x:d+l-x,y:s+_,horizontalAnchor:S,verticalAnchor:y},k):n===`insideBottomLeft`?eT({x:f+x,y:s+c-_,horizontalAnchor:C,verticalAnchor:v},k):n===`insideBottomRight`?eT({x:f+u-x,y:s+c-_,horizontalAnchor:S,verticalAnchor:v},k):n&&typeof n==`object`&&(P(n.x)||Lt(n.x))&&(P(n.y)||Lt(n.y))?eT({x:o+Vt(n.x,m),y:s+Vt(n.y,c),horizontalAnchor:`end`,verticalAnchor:`end`},k):eT({x:h,y:s+c/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},k)},aT=[`labelRef`],oT=[`content`];function sT(e,t){if(e==null)return{};var n,r,i=cT(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,l=(0,c.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return c.createElement(hT.Provider,{value:l},s)},_T=()=>{var e=(0,c.useContext)(hT),t=Qs();return e||(t?Zs(t):void 0)},vT=(0,c.createContext)(null),yT=()=>{var e=(0,c.useContext)(vT),t=L(Sv);return e||t},bT=e=>{var{value:t,formatter:n}=e,r=F(e.children)?t:e.children;return typeof n==`function`?n(r):r},xT=e=>e!=null&&typeof e==`function`,ST=(e,t)=>Ft(t-e)*Math.min(Math.abs(t-e),360),CT=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:s,cy:l,innerRadius:d,outerRadius:f,startAngle:p,endAngle:m,clockWise:h}=i,g=(d+f)/2,_=ST(p,m),v=_>=0?1:-1,y,b;switch(t){case`insideStart`:y=p+v*a,b=h;break;case`insideEnd`:y=m-v*a,b=!h;break;case`end`:y=m+v*a,b=h;break;default:throw Error(`Unsupported position ${t}`)}b=_<=0?b:!b;var x=W(s,l,g,y),S=W(s,l,g,y+(b?1:-1)*359),C=`M${x.x},${x.y} + A${g},${g},0,1,${+!b}, + ${S.x},${S.y}`,w=F(e.id)?Bt(`recharts-radial-line-`):e.id;return c.createElement(`text`,mT({},r,{dominantBaseline:`central`,className:u(`recharts-radial-bar-label`,o)}),c.createElement(`defs`,null,c.createElement(`path`,{id:w,d:C})),c.createElement(`textPath`,{xlinkHref:`#${w}`},n))},wT=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:c}=e,l=(s+c)/2;if(n===`outside`){var{x:u,y:d}=W(r,i,o+t,l);return{x:u,y:d,textAnchor:u>=r?`start`:`end`,verticalAnchor:`middle`}}if(n===`center`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`middle`};if(n===`centerTop`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`start`};if(n===`centerBottom`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`end`};var{x:f,y:p}=W(r,i,(a+o)/2,l);return{x:f,y:p,textAnchor:`middle`,verticalAnchor:`middle`}},TT=e=>e!=null&&`cx`in e&&P(e.cx),ET={angle:0,offset:5,zIndex:nv.label,position:`middle`,textBreakAll:!1};function DT(e){if(!TT(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function OT(e){var t=yn(e,ET),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:s,className:l=``,textBreakAll:d,labelRef:f}=t,p=yT(),m=_T(),h=n==null?i===`center`?m:p??m:TT(n)?n:Zs(n),g,_,y=DT(h);if(!h||F(a)&&F(o)&&!(0,c.isValidElement)(s)&&typeof s!=`function`)return null;var b=uT(uT({},t),{},{viewBox:h});if((0,c.isValidElement)(s)){var{labelRef:x}=b;return(0,c.cloneElement)(s,sT(b,aT))}if(typeof s==`function`){var{content:S}=b;if(g=(0,c.createElement)(s,sT(b,oT)),(0,c.isValidElement)(g))return g}else g=bT(t);var C=v(t);if(TT(h)){if(i===`insideStart`||i===`insideEnd`||i===`end`)return CT(t,i,g,C,h);_=wT(h,t.offset,t.position)}else{if(!y)return null;var w=iT({viewBox:y,position:i,offset:t.offset,parentViewBox:TT(r)?void 0:r,clamp:!0});_=uT(uT({x:w.x,y:w.y,textAnchor:w.horizontalAnchor,verticalAnchor:w.verticalAnchor},w.width===void 0?{}:{width:w.width}),w.height===void 0?{}:{height:w.height})}return c.createElement(aC,{zIndex:t.zIndex},c.createElement(Qw,mT({ref:f,className:u(`recharts-label`,l)},C,_,{textAnchor:Hw(C.textAnchor)?C.textAnchor:_.textAnchor,breakAll:d}),g))}OT.displayName=`Label`;var kT=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?c.createElement(OT,mT({key:`label-implicit`},r)):Rt(e)?c.createElement(OT,mT({key:`label-implicit`,value:e},r)):(0,c.isValidElement)(e)?e.type===OT?(0,c.cloneElement)(e,uT({key:`label-implicit`},r)):c.createElement(OT,mT({key:`label-implicit`,content:e},r)):xT(e)?c.createElement(OT,mT({key:`label-implicit`,content:e},r)):e&&typeof e==`object`?c.createElement(OT,mT({},e,{key:`label-implicit`},r)):null};function AT(e){var{label:t,labelRef:n}=e;return kT(t,_T(),n)||null}var jT=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e[e.length-1]}e.last=t})),MT=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return Array.isArray(e)?e:Array.from(e)}e.toArray=t})),NT=n((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=jT(),n=MT(),r=wn();function i(e){if(r.isArrayLike(e))return t.last(n.toArray(e))}e.last=i})),PT=e(n(((e,t)=>{t.exports=NT().last}))()),FT=[`valueAccessor`],IT=[`dataKey`,`clockWise`,`id`,`textBreakAll`,`zIndex`];function LT(){return LT=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?(0,PT.default)(e.value):e.value,VT=(0,c.createContext)(void 0),HT=VT.Provider,UT=(0,c.createContext)(void 0),WT=UT.Provider;function GT(){return(0,c.useContext)(VT)}function KT(){return(0,c.useContext)(UT)}function qT(e){var{valueAccessor:t=BT}=e,n=RT(e,FT),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,l=RT(n,IT),u=GT(),d=KT(),f=u||d;return!f||!f.length?null:c.createElement(aC,{zIndex:s??nv.label},c.createElement(te,{className:`recharts-label-list`},f.map((e,i)=>{var s=F(r)?t(e,i):Mo(e.payload,r),u=F(a)?{}:{id:`${a}-${i}`};return c.createElement(OT,LT({key:`label-${i}`},v(e),l,u,{fill:n.fill??e.fill,parentViewBox:e.parentViewBox,value:s,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))})))}qT.displayName=`LabelList`;function JT(e){var{label:t}=e;return t?t===!0?c.createElement(qT,{key:`labelList-implicit`}):c.isValidElement(t)||xT(t)?c.createElement(qT,{key:`labelList-implicit`,content:t}):typeof t==`object`?c.createElement(qT,LT({key:`labelList-implicit`},t,{type:String(t.type)})):null:null}function YT(){return YT=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,a=u(`recharts-dot`,i);return P(t)&&P(n)&&P(r)?c.createElement(`circle`,YT({},g(e),dn(e),{className:a,cx:t,cy:n,r})):null},ZT=Aa({name:`polarAxis`,initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=H(t.payload)},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=H(t.payload)},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:QT,removeRadiusAxis:$T,addAngleAxis:eE,removeAngleAxis:tE}=ZT.actions,nE=ZT.reducer;function rE(e){return e&&typeof e==`object`&&`className`in e&&typeof e.className==`string`?e.className:``}var iE=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.suspense_list`),d=Symbol.for(`react.memo`),f=Symbol.for(`react.lazy`),p=Symbol.for(`react.view_transition`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:case p:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:return e;case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),aE=n(((e,t)=>{t.exports=iE()}))(),oE=e=>typeof e==`string`?e:e?e.displayName||e.name||`Component`:``,sE=null,cE=null,lE=e=>{if(e===sE&&Array.isArray(cE))return cE;var t=[];return c.Children.forEach(e,e=>{F(e)||((0,aE.isFragment)(e)?t=t.concat(lE(e.props.children)):t.push(e))}),cE=t,sE=e,t};function uE(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(e=>oE(e)):[oE(t)],lE(e).forEach(e=>{var t=(0,Mt.default)(e,`type.displayName`)||(0,Mt.default)(e,`type.name`);t&&r.indexOf(t)!==-1&&n.push(e)}),n}var dE=e=>e&&typeof e==`object`&&`clipDot`in e?!!e.clipDot:!0;function fE(e){var{tooltipEntrySettings:t}=e,n=I(),r=Ss(),i=(0,c.useRef)(null);return(0,c.useLayoutEffect)(()=>{r||(i.current===null?n(Qb(t)):i.current!==t&&n($b({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,c.useLayoutEffect)(()=>()=>{i.current&&=(n(ex(i.current)),null)},[n]),null}function pE(e){var{legendPayload:t}=e,n=I(),r=Ss(),i=(0,c.useRef)(null);return(0,c.useLayoutEffect)(()=>{r||(i.current===null?n(sl(t)):i.current!==t&&n(cl({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,c.useLayoutEffect)(()=>()=>{i.current&&=(n(ll(i.current)),null)},[n]),null}function mE(e){var{legendPayload:t}=e,n=I(),r=L(V),i=(0,c.useRef)(null);return(0,c.useLayoutEffect)(()=>{r!==`centric`&&r!==`radial`||(i.current===null?n(sl(t)):i.current!==t&&n(cl({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,c.useLayoutEffect)(()=>()=>{i.current&&=(n(ll(i.current)),null)},[n]),null}var hE=c.useId??(()=>{var[e]=c.useState(()=>Bt(`uid-`));return e});function gE(e,t){var n=hE();return t||(e?`${e}-${n}`:n)}var _E=(0,c.createContext)(void 0),vE=e=>{var{id:t,type:n,children:r}=e,i=gE(`recharts-${n}`,t);return c.createElement(_E.Provider,{value:i},r(i))},yE=Aa({name:`graphicalItems`,initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(H(t.payload))},prepare:z()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=ra(e).cartesianItems.indexOf(H(n));i>-1&&(e.cartesianItems[i]=H(r))},prepare:z()},removeCartesianGraphicalItem:{reducer(e,t){var n=ra(e).cartesianItems.indexOf(H(t.payload));n>-1&&e.cartesianItems.splice(n,1)},prepare:z()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(H(t.payload))},prepare:z()},removePolarGraphicalItem:{reducer(e,t){var n=ra(e).polarItems.indexOf(H(t.payload));n>-1&&e.polarItems.splice(n,1)},prepare:z()}}}),{addCartesianGraphicalItem:bE,replaceCartesianGraphicalItem:xE,removeCartesianGraphicalItem:SE,addPolarGraphicalItem:CE,removePolarGraphicalItem:wE}=yE.actions,TE=yE.reducer,EE=(0,c.memo)(e=>{var t=I(),n=(0,c.useRef)(null);return(0,c.useLayoutEffect)(()=>{n.current===null?t(bE(e)):n.current!==e&&t(xE({prev:n.current,next:e})),n.current=e},[t,e]),(0,c.useLayoutEffect)(()=>()=>{n.current&&=(t(SE(n.current)),null)},[t]),null});function DE(e){var t=I();return(0,c.useLayoutEffect)(()=>(t(CE(e)),()=>{t(wE(e))}),[t,e]),null}var OE=[`points`];function kE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function AE(e){for(var t=1;t{var s=AE(AE(AE({r:3},o),f),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return c.createElement(LE,{key:`dot-${r}`,option:n,dotProps:s,className:i})}),m={};return s&&l!=null&&(m.clipPath=`url(#clipPath-${d?``:`dots-`}${l})`),c.createElement(aC,{zIndex:u},c.createElement(te,PE({className:r},m),p))}function BE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VE(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),es,ts],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),iD=()=>L(rD),aD=()=>L(lS);function oD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sD(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var s=sD(sD(sD({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),_(i)),dn(i)),l=(0,c.isValidElement)(i)?(0,c.cloneElement)(i,s):typeof i==`function`?i(s):c.createElement(XT,s);return c.createElement(te,{className:`recharts-active-dot`,clipPath:o},l)};function fD(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=nv.activeDot}=e,s=L(nS),l=aD();if(t==null||l==null)return null;var u=t.find(e=>l.includes(e.payload));return F(u)?null:c.createElement(aC,{zIndex:o},c.createElement(dD,{point:u,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var pD=e=>{var{chartData:t}=e,n=I(),r=Ss();return(0,c.useEffect)(()=>r?()=>{}:(n(DC(t)),()=>{n(DC(void 0))}),[t,n,r]),null},mD={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},hD=Aa({name:`brush`,initialState:mD,reducers:{setBrushSettings(e,t){return t.payload==null?mD:t.payload}}}),{setBrushSettings:gD}=hD.actions,_D=hD.reducer,vD=(e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}},yD=e=>{var{x1:t,y1:n,x2:r,y2:i}=e;return vD({x:t,y:n},{x:r,y:i})};function bD(e){return(e%180+180)%180}var xD=function(e){var{width:t,height:n}=e,r=bD(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=ra(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=ra(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(H(t.payload))},removeLine:(e,t)=>{var n=ra(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:CD,removeDot:wD,addArea:TD,removeArea:ED,addLine:DD,removeLine:OD}=SD.actions,kD=SD.reducer,AD=(0,c.createContext)(void 0),jD=e=>{var{children:t}=e,[n]=(0,c.useState)(`${Bt(`recharts`)}-clip`),r=iD();if(r==null)return null;var{x:i,y:a,width:o,height:s}=r;return c.createElement(AD.Provider,{value:n},c.createElement(`defs`,null,c.createElement(`clipPath`,{id:n},c.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)},MD=()=>(0,c.useContext)(AD);function ND(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;re*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function LD(e,t){return ND(e,t+1)}function RD(e,t,n,r,i){for(var a=(r||[]).slice(),{start:o,end:s}=t,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:ND(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||ID(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function zD(e,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var{start:o,end:s}=t,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||ID(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=VD(VD({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=VD(VD({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&ID(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=VD(VD({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function KD(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:c,end:l}=t;if(a){var u=r[s-1];if(u!=null){var d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=VD(VD({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&ID(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=VD(VD({},u),{},{isShow:!0}))}}for(var p=a?s-1:s,m=function(t){var r=o[t];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=VD(VD({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=VD(VD({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&ID(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=VD(VD({},a),{},{isShow:!0}))},h=0;h{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?PD(mw(i,{fontSize:t,letterSpacing:n}),m,d):mw(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?Ft(_.coordinate-g.coordinate):1,y=FD(a,v,p);return c===`equidistantPreserveStart`?RD(v,y,h,i,o):c===`equidistantPreserveEnd`?zD(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?KD(v,y,h,i,o,c===`preserveStartEnd`):GD(v,y,h,i,o),f.filter(e=>e.isShow))}var JD=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0,c=i+a,l=o+c+s+(n?r:0);return Math.round(l)}return 0},YD=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`];function XD(e,t){if(e==null)return{};var n,r,i=ZD(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:l,tickTextProps:d,orientation:f,mirror:p,x:m,y:h,width:v,height:y,tickSize:b,tickMargin:x,fontSize:S,letterSpacing:C,getTicksConfig:w,events:T,axisType:E}=e,D=qD($($({},w),{},{ticks:n}),S,C),O=oO(f,p),k=sO(f,p),ee=g(w),A=_(r),j={};typeof i==`object`&&(j=i);var M=$($({},ee),{},{fill:`none`},j),ne=D.map(e=>$({entry:e},aO(e,m,h,v,y,f,b,p,x))),re=ne.map(e=>{var{entry:t,line:n}=e;return c.createElement(te,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},i&&c.createElement(`line`,QD({},M,n,{className:u(`recharts-cartesian-axis-tick-line`,(0,Mt.default)(i,`className`))})))}),ie=ne.map((e,t)=>{var{entry:n,tick:i}=e,u=$($({},$($($($({verticalAnchor:k},ee),{},{textAnchor:O,stroke:`none`,fill:a},i),{},{index:t,payload:n,visibleTicksCount:D.length,tickFormatter:o,padding:l},d),{},{angle:d?.angle??ee.angle??0})),A);return c.createElement(te,QD({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},pn(T,n,t)),r&&c.createElement(cO,{option:r,tickProps:u,value:`${typeof o==`function`?o(n.value,t):n.value}${s||``}`}))});return c.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${E}-ticks`},ie.length>0&&c.createElement(aC,{zIndex:nv.label},c.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${E}-tick-labels`,ref:t},ie)),re.length>0&&c.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${E}-tick-lines`},re))}),uO=(0,c.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:l}=e,d=XD(e,YD),[f,p]=(0,c.useState)(``),[m,h]=(0,c.useState)(``),_=(0,c.useRef)(null);(0,c.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>JD({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var v=(0,c.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);_.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==f||a!==m)&&(p(i),h(a))}}},[f,m]);return o||r!=null&&r<=0||i!=null&&i<=0?null:c.createElement(aC,{zIndex:e.zIndex},c.createElement(te,{className:u(`recharts-cartesian-axis`,a)},c.createElement(iO,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:g(e)}),c.createElement(lO,{ref:v,axisType:l,events:d,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:m,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y}),c.createElement(gT,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},c.createElement(AT,{label:e.label,labelRef:e.labelRef}),e.children)))}),dO=c.forwardRef((e,t)=>{var n=yn(e,rO);return c.createElement(uO,QD({},n,{ref:t}))});dO.displayName=`CartesianAxis`;var fO=[`x1`,`y1`,`x2`,`y2`,`key`],pO=[`offset`],mO=[`xAxisId`,`yAxisId`],hO=[`xAxisId`,`yAxisId`];function gO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _O(e){for(var t=1;t{var{fill:t}=e;if(!t||t===`none`)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return c.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function TO(e){var{option:t,lineItemProps:n}=e,r;if(c.isValidElement(t))r=c.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var{x1:i,y1:a,x2:o,y2:s,key:l}=n,u=g(SO(n,fO))??{},{offset:d}=u,f=SO(u,pO);r=c.createElement(`line`,xO({},f,{x1:i,y1:a,x2:o,y2:s,fill:`none`,key:l}))}return r}function EO(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=SO(e,mO),l=i.map((e,i)=>{var a=_O(_O({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${i}`,index:i});return c.createElement(TO,{key:`line-${i}`,option:r,lineItemProps:a})});return c.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},l)}function DO(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=SO(e,hO),l=i.map((e,i)=>{var a=_O(_O({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${i}`,index:i});return c.createElement(TO,{option:r,lineItemProps:a,key:`line-${i}`})});return c.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},l)}function OO(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:l=!0}=e;if(!l||!t||!t.length||s==null)return null;var u=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==u[0]&&u.unshift(0);var d=u.map((e,s)=>{var l=u[s+1],d=l==null?i+o-e:l-e;if(d<=0)return null;var f=s%t.length;return c.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:d,width:a,stroke:`none`,fill:t[f],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return c.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},d)}function kO(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:l}=e;if(!t||!n||!n.length)return null;var u=l.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==u[0]&&u.unshift(0);var d=u.map((e,t)=>{var l=u[t+1],d=l==null?i+o-e:l-e;if(d<=0)return null;var f=t%n.length;return c.createElement(`rect`,{key:`react-${t}`,x:e,y:a,width:d,height:s,stroke:`none`,fill:n[f],fillOpacity:r,className:`recharts-cartesian-grid-bg`})});return c.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var AO=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return Fo(qD(_O(_O(_O({},rO),n),{},{ticks:Io(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},jO=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return Fo(qD(_O(_O(_O({},rO),n),{},{ticks:Io(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},MO={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:`#ccc`,fill:`none`,verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:nv.grid};function NO(e){var t=tc(),n=nc(),r=ec(),i=_O(_O({},yn(e,MO)),{},{x:P(e.x)?e.x:r.left,y:P(e.y)?e.y:r.top,width:P(e.width)?e.width:r.width,height:P(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:l,width:u,height:d,syncWithTicks:f,horizontalValues:p,verticalValues:m}=i,h=Ss(),g=L(e=>Rb(e,`xAxis`,a,h)),_=L(e=>Rb(e,`yAxis`,o,h));if(!Eo(u)||!Eo(d)||!P(s)||!P(l))return null;var v=i.verticalCoordinatesGenerator||AO,y=i.horizontalCoordinatesGenerator||jO,{horizontalPoints:b,verticalPoints:x}=i;if((!b||!b.length)&&typeof y==`function`){var S=p&&p.length,C=y({yAxis:_?_O(_O({},_),{},{ticks:S?p:_.ticks}):void 0,width:t??u,height:n??d,offset:r},S?!0:f);As(Array.isArray(C),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof C}]`),Array.isArray(C)&&(b=C)}if((!x||!x.length)&&typeof v==`function`){var w=m&&m.length,T=v({xAxis:g?_O(_O({},g),{},{ticks:w?m:g.ticks}):void 0,width:t??u,height:n??d,offset:r},w?!0:f);As(Array.isArray(T),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof T}]`),Array.isArray(T)&&(x=T)}return c.createElement(aC,{zIndex:i.zIndex},c.createElement(`g`,{className:`recharts-cartesian-grid`},c.createElement(wO,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),c.createElement(OO,xO({},i,{horizontalPoints:b})),c.createElement(kO,xO({},i,{verticalPoints:x})),c.createElement(EO,xO({},i,{offset:r,horizontalPoints:b,xAxis:g,yAxis:_})),c.createElement(DO,xO({},i,{offset:r,verticalPoints:x,xAxis:g,yAxis:_}))))}NO.displayName=`CartesianGrid`;var PO=Aa({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:FO,replaceErrorBar:IO,removeErrorBar:LO}=PO.actions,RO=PO.reducer;function zO(e,t){var n=L(t=>Uv(t,e)),r=L(e=>Gv(e,t)),i=n?.allowDataOverflow??Vv.allowDataOverflow,a=r?.allowDataOverflow??Z.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function BO(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=iD(),{needClipX:a,needClipY:o,needClip:s}=zO(t,n);if(!s||!i)return null;var{x:l,y:u,width:d,height:f}=i;return c.createElement(`clipPath`,{id:`clipPath-${r}`},c.createElement(`rect`,{x:a?l:l-d/2,y:o?u:u-f/2,width:a?d:d*2,height:o?f:f*2}))}function VO(e){var t=_(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var HO=n((e=>{var t=r();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));n(((e,t)=>{t.exports=HO()}))();function UO(e){e()}function WO(){let e=null,t=null;return{clear(){e=null,t=null},notify(){UO(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var GO={notify(){},get:()=>[]};function KO(e,t){let n,r=GO,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=WO())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=GO)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var qO=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,JO=typeof navigator<`u`&&navigator.product===`ReactNative`,YO=qO||JO?c.useLayoutEffect:c.useEffect;function XO(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function ZO(e,t){if(XO(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r({store:i,subscription:KO(i),getServerState:r?()=>r:void 0}),[i,r]),o=c.useMemo(()=>i.getState(),[i]);YO(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let s=n||tk;return c.createElement(s.Provider,{value:a},t)}var rk=nk,ik=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`]);function ak(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function ok(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(ik.has(n)){if(e[n]==null&&t[n]==null)continue;if(!ZO(e[n],t[n]))return!1}else if(!ak(e[n],t[n]))return!1;return!0}var sk=[`domain`,`range`],ck=[`domain`,`range`];function lk(e,t){if(e==null)return{};var n,r,i=uk(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(o!=null)return vk(vk({},a),{},{type:o})},[a,o]);return(0,c.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(KE(s)):n.current!==s&&t(qE({prev:n.current,next:s})),n.current=s)},[s,t]),(0,c.useLayoutEffect)(()=>()=>{n.current&&=(t(JE(n.current)),null)},[t]),null}var Tk=e=>{var{xAxisId:t,className:n}=e,r=L(bs),i=Ss(),a=`xAxis`,o=L(e=>zb(e,a,t,i)),s=L(e=>Tb(e,t)),l=L(e=>Ab(e,t)),d=L(e=>Hv(e,t));if(s==null||l==null||d==null)return null;var{dangerouslySetInnerHTML:f,ticks:p,scale:m}=e,h=Sk(e,mk),{id:g,scale:_}=d,v=Sk(d,hk);return c.createElement(dO,gk({},h,v,{x:l.x,y:l.y,width:s.width,height:s.height,className:u(`recharts-${a} ${a}`,n),viewBox:r,ticks:o,axisType:a}))},Ek={allowDataOverflow:Vv.allowDataOverflow,allowDecimals:Vv.allowDecimals,allowDuplicatedCategory:Vv.allowDuplicatedCategory,angle:Vv.angle,axisLine:rO.axisLine,height:Vv.height,hide:!1,includeHidden:Vv.includeHidden,interval:Vv.interval,label:!1,minTickGap:Vv.minTickGap,mirror:Vv.mirror,orientation:Vv.orientation,padding:Vv.padding,reversed:Vv.reversed,scale:Vv.scale,tick:Vv.tick,tickCount:Vv.tickCount,tickLine:rO.tickLine,tickSize:rO.tickSize,type:Vv.type,xAxisId:0},Dk=c.memo(e=>{var t=yn(e,Ek);return c.createElement(c.Fragment,null,c.createElement(wk,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),c.createElement(Tk,t))},fk);Dk.displayName=`XAxis`;var Ok=[`type`],kk=[`dangerouslySetInnerHTML`,`ticks`,`scale`],Ak=[`id`,`scale`];function jk(){return jk=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(o!=null)return Nk(Nk({},a),{},{type:o})},[o,a]);return(0,c.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(YE(s)):n.current!==s&&t(XE({prev:n.current,next:s})),n.current=s)},[s,t]),(0,c.useLayoutEffect)(()=>()=>{n.current&&=(t(ZE(n.current)),null)},[t]),null}function Bk(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,c.useRef)(null),o=(0,c.useRef)(null),s=L(bs),l=Ss(),d=I(),f=`yAxis`,p=L(e=>Mb(e,t)),m=L(e=>jb(e,t)),h=L(e=>zb(e,f,t,l)),g=L(e=>Wv(e,t));if((0,c.useLayoutEffect)(()=>{if(!(r!==`auto`||!p||xT(i)||(0,c.isValidElement)(i)||g==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(p.width)!==Math.round(n)&&d(tD({id:t,width:n}))}}},[h,p,d,i,t,r,g]),p==null||m==null||g==null)return null;var{dangerouslySetInnerHTML:_,ticks:v,scale:y}=e,b=Lk(e,kk),{id:x,scale:S}=g,C=Lk(g,Ak);return c.createElement(dO,jk({},b,C,{ref:a,labelRef:o,x:m.x,y:m.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:p.width,height:p.height,className:u(`recharts-${f} ${f}`,n),viewBox:s,ticks:h,axisType:f}))}var Vk={allowDataOverflow:Z.allowDataOverflow,allowDecimals:Z.allowDecimals,allowDuplicatedCategory:Z.allowDuplicatedCategory,angle:Z.angle,axisLine:rO.axisLine,hide:!1,includeHidden:Z.includeHidden,interval:Z.interval,label:!1,minTickGap:Z.minTickGap,mirror:Z.mirror,orientation:Z.orientation,padding:Z.padding,reversed:Z.reversed,scale:Z.scale,tick:Z.tick,tickCount:Z.tickCount,tickLine:rO.tickLine,tickSize:rO.tickSize,type:Z.type,width:Z.width,yAxisId:0},Hk=c.memo(e=>{var t=yn(e,Vk);return c.createElement(c.Fragment,null,c.createElement(zk,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),c.createElement(Bk,t))},fk);Hk.displayName=`YAxis`;var Uk=R([(e,t)=>t,V,Sv,X,Yx,Zx,AS,vs],HS),Wk=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Gk=ua(`mouseClick`),Kk=_o();Kk.startListening({actionCreator:Gk,effect:(e,t)=>{var n=e.payload,r=Uk(t.getState(),Wk(n));r?.activeIndex!=null&&t.dispatch(sx({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var qk=ua(`mouseMove`),Jk=_o(),Yk=null;Jk.startListening({actionCreator:qk,effect:(e,t)=>{var n=e.payload;Yk!==null&&cancelAnimationFrame(Yk);var r=Wk(n);Yk=requestAnimationFrame(()=>{var e=t.getState();if(Kb(e,e.tooltip.settings.shared)===`axis`){var n=Uk(e,r);n?.activeIndex==null?t.dispatch(ix()):t.dispatch(ox({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}Yk=null})}});function Xk(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<>`:t}var Zk={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},Qk=Aa({name:`rootProps`,initialState:Zk,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??Zk.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),$k=Qk.reducer,{updateOptions:eA}=Qk.actions,tA=Aa({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:nA}=tA.actions,rA=tA.reducer,iA=ua(`keyDown`),aA=ua(`focus`),oA=_o();oA.startListening({actionCreator:iA,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip,i=e.payload;if(!(i!==`ArrowRight`&&i!==`ArrowLeft`&&i!==`Enter`)){var a=Sx(r,Lx(n),_y(n),Kx(n)),o=a==null?-1:Number(a);if(!(!Number.isFinite(o)||o<0)){var s=Zx(n);if(i===`Enter`){var c=FS(n,`axis`,`hover`,String(r.index));t.dispatch(lx({active:!r.active,activeIndex:r.index,activeCoordinate:c}));return}var l=Hb(n)===`left-to-right`?1:-1,u=o+(i===`ArrowRight`?1:-1)*l;if(!(s==null||u>=s.length||u<0)){var d=FS(n,`axis`,`hover`,String(u));t.dispatch(lx({active:!0,activeIndex:u.toString(),activeCoordinate:d}))}}}}}}),oA.startListening({actionCreator:aA,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&r.index==null){var i=`0`,a=FS(n,`axis`,`hover`,String(i));t.dispatch(lx({active:!0,activeIndex:i,activeCoordinate:a}))}}}});var sA=ua(`externalEvent`),cA=_o(),lA=new Map;cA.startListening({actionCreator:sA,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){r.persist();var i=r.type,a=lA.get(i);a!==void 0&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState();n({activeCoordinate:sS(e),activeDataKey:iS(e),activeIndex:nS(e),activeLabel:rS(e),activeTooltipIndex:nS(e),isTooltipActive:cS(e)},r)}finally{lA.delete(i)}});lA.set(i,o)}}});var uA=R([R([Ex],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),dA=ua(`touchMove`),fA=_o();fA.startListening({actionCreator:dA,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){var r=t.getState(),i=Kb(r,r.tooltip.settings.shared);if(i===`axis`){var a=n.touches[0];if(a==null)return;var o=Uk(r,Wk({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));o?.activeIndex!=null&&t.dispatch(ox({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i===`item`){var s=n.touches[0];if(document.elementFromPoint==null||s==null)return;var c=document.elementFromPoint(s.clientX,s.clientY);if(!c||!c.getAttribute)return;var l=c.getAttribute(os),u=c.getAttribute(`data-recharts-item-id`)??void 0,d=Fx(r).find(e=>e.id===u);if(l==null||d==null||u==null)return;var{dataKey:f}=d,p=uA(r,l,u);t.dispatch(nx({activeDataKey:f,activeIndex:l,activeCoordinate:p,activeGraphicalItemId:u}))}}}});var pA=Fr({brush:_D,cartesianAxis:nD,chartData:AC,errorBars:RO,graphicalItems:TE,layout:wo,legend:ul,options:CC,polarAxis:nE,polarOptions:rA,referenceElements:kD,rootProps:$k,tooltip:ux,zIndex:iC}),mA=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return ba({reducer:pA,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([Kk.middleware,Jk.middleware,oA.middleware,cA.middleware,fA.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(va({type:`raf`}))},devTools:Bu.devToolsEnabled&&{serialize:{replacer:Xk},name:`recharts-${t}`}})};function hA(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=Ss(),a=(0,c.useRef)(null);if(i)return n;a.current??=mA(t,r);var o=Xn;return c.createElement(rk,{context:o,store:a.current},n)}function gA(e){var{layout:t,margin:n}=e,r=I(),i=Ss();return(0,c.useEffect)(()=>{i||(r(xo(t)),r(bo(n)))},[r,i,t,n]),null}var _A=(0,c.memo)(gA,ok);function vA(e){var t=I();return(0,c.useEffect)(()=>{t(eA(e))},[t,e]),null}function yA(e){var{zIndex:t,isPanorama:n}=e,r=(0,c.useRef)(null),i=I();return(0,c.useLayoutEffect)(()=>(r.current&&i(nC({zIndex:t,element:r.current,isPanorama:n})),()=>{i(rC({zIndex:t,isPanorama:n}))}),[i,t,n]),c.createElement(`g`,{tabIndex:-1,ref:r})}function bA(e){var{children:t,isPanorama:n}=e,r=L(WS);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return c.createElement(c.Fragment,null,i.map(e=>c.createElement(yA,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>c.createElement(yA,{key:e,zIndex:e,isPanorama:n})))}var xA=[`children`];function SA(e,t){if(e==null)return{};var n,r,i=CA(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=tc(),r=nc(),i=Ml();if(!Eo(n)||!Eo(r))return null;var{children:a,otherAttributes:o,title:s,desc:l}=e,u,d;return o!=null&&(u=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,d=typeof o.role==`string`?o.role:i?`application`:void 0),c.createElement(E,wA({},o,{title:s,desc:l,role:d,tabIndex:u,width:n,height:r,style:TA,ref:t}),a)}),DA=e=>{var{children:t}=e,n=L(ws);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return c.createElement(E,{width:r,height:i,x:o,y:a},t)},OA=(0,c.forwardRef)((e,t)=>{var{children:n}=e,r=SA(e,xA);return Ss()?c.createElement(DA,null,c.createElement(bA,{isPanorama:!0},n)):c.createElement(EA,wA({ref:t},r),c.createElement(bA,{isPanorama:!1},n))});function kA(){var e=I(),[t,n]=(0,c.useState)(null),r=L(ns);return(0,c.useEffect)(()=>{if(t!=null){var n=t.getBoundingClientRect().width/t.offsetWidth;B(n)&&n!==r&&e(Co(n))}},[t,e,r]),n}function AA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jA(e){for(var t=1;t(VC(),null);function LA(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var RA=(0,c.forwardRef)((e,t)=>{var n=(0,c.useRef)(null),[r,i]=(0,c.useState)({containerWidth:LA(e.style?.width),containerHeight:LA(e.style?.height)}),a=(0,c.useCallback)((e,t)=>{i(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),o=(0,c.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null&&typeof ResizeObserver<`u`){var{width:r,height:i}=e.getBoundingClientRect();a(r,i);var o=new ResizeObserver(e=>{var t=e[0];if(t!=null){var{width:n,height:r}=t.contentRect;a(n,r)}});o.observe(e),n.current=o}},[t,a]);return(0,c.useEffect)(()=>()=>{n.current?.disconnect()},[a]),c.createElement(c.Fragment,null,c.createElement(cc,{width:r.containerWidth,height:r.containerHeight}),c.createElement(`div`,FA({ref:o},e)))}),zA=(0,c.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,c.useState)({containerWidth:LA(n),containerHeight:LA(r)}),o=(0,c.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,c.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return c.createElement(c.Fragment,null,c.createElement(cc,{width:i.containerWidth,height:i.containerHeight}),c.createElement(`div`,FA({ref:s},e)))}),BA=(0,c.forwardRef)((e,t)=>{var{width:n,height:r}=e;return c.createElement(c.Fragment,null,c.createElement(cc,{width:n,height:r}),c.createElement(`div`,FA({ref:t},e)))}),VA=(0,c.forwardRef)((e,t)=>{var{width:n,height:r}=e;return typeof n==`string`||typeof r==`string`?c.createElement(zA,FA({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?c.createElement(BA,FA({},e,{width:n,height:r,ref:t})):c.createElement(c.Fragment,null,c.createElement(cc,{width:n,height:r}),c.createElement(`div`,FA({ref:t},e)))});function HA(e){return e?RA:VA}var UA=(0,c.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:l,onMouseEnter:d,onMouseLeave:f,onMouseMove:p,onMouseUp:m,onTouchEnd:h,onTouchMove:g,onTouchStart:_,style:v,width:y,responsive:b,dispatchTouchEvents:x=!0}=e,S=(0,c.useRef)(null),C=I(),[w,T]=(0,c.useState)(null),[E,D]=(0,c.useState)(null),O=kA(),k=Js(),ee=k?.width>0?k.width:y,te=k?.height>0?k.height:i,j=(0,c.useCallback)(e=>{O(e),typeof t==`function`&&t(e),T(e),D(e),e!=null&&(S.current=e)},[O,t,T,D]),M=(0,c.useCallback)(e=>{C(Gk(e)),C(sA({handler:a,reactEvent:e}))},[C,a]),ne=(0,c.useCallback)(e=>{C(qk(e)),C(sA({handler:d,reactEvent:e}))},[C,d]),re=(0,c.useCallback)(e=>{C(ix()),C(sA({handler:f,reactEvent:e}))},[C,f]),ie=(0,c.useCallback)(e=>{C(qk(e)),C(sA({handler:p,reactEvent:e}))},[C,p]),ae=(0,c.useCallback)(()=>{C(aA())},[C]),oe=(0,c.useCallback)(e=>{C(iA(e.key))},[C]),se=(0,c.useCallback)(e=>{C(sA({handler:o,reactEvent:e}))},[C,o]),ce=(0,c.useCallback)(e=>{C(sA({handler:s,reactEvent:e}))},[C,s]),le=(0,c.useCallback)(e=>{C(sA({handler:l,reactEvent:e}))},[C,l]),ue=(0,c.useCallback)(e=>{C(sA({handler:m,reactEvent:e}))},[C,m]),de=(0,c.useCallback)(e=>{C(sA({handler:_,reactEvent:e}))},[C,_]),fe=(0,c.useCallback)(e=>{x&&C(dA(e)),C(sA({handler:g,reactEvent:e}))},[C,x,g]),pe=(0,c.useCallback)(e=>{C(sA({handler:h,reactEvent:e}))},[C,h]),me=HA(b);return c.createElement(hC.Provider,{value:w},c.createElement(A.Provider,{value:E},c.createElement(me,{width:ee??v?.width,height:te??v?.height,className:u(`recharts-wrapper`,r),style:jA({position:`relative`,cursor:`default`,width:ee,height:te},v),onClick:M,onContextMenu:se,onDoubleClick:ce,onFocus:ae,onKeyDown:oe,onMouseDown:le,onMouseEnter:ne,onMouseLeave:re,onMouseMove:ie,onMouseUp:ue,onTouchEnd:pe,onTouchMove:fe,onTouchStart:de,ref:j},c.createElement(IA,null),n)))}),WA=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function GA(e,t){if(e==null)return{};var n,r,i=KA(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:l,title:u,desc:d}=e,f=g(GA(e,WA));return l?c.createElement(c.Fragment,null,c.createElement(cc,{width:n,height:r}),c.createElement(OA,{otherAttributes:f,title:u,desc:d},a)):c.createElement(UA,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},c.createElement(OA,{otherAttributes:f,title:u,desc:d,ref:t},c.createElement(jD,null,a)))});function JA(){return JA=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e&&y(n.map(e=>({...e})))},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let C=e=>{y(t=>t.map((t,n)=>n===e?{...t,visible:!t.visible}:t))},w=(e,t)=>{t<0||t>=v.length||y(n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r})},T=(e,t)=>{S.current=t,x(t),e.dataTransfer.effectAllowed=`move`},E=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=S.current;n!==null&&n!==t&&(w(n,t),S.current=t,x(t))},D=e=>{e.preventDefault()},O=()=>{S.current=null,x(null)},k=()=>{y(h.map(e=>({...e})))},A=()=>{g(v),t()},j=v.filter(e=>e.visible).length;return(0,m.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,m.jsx)(l,{className:`w-full max-w-md max-h-[80vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:(0,m.jsxs)(c,{className:`p-6 flex flex-col min-h-0`,children:[(0,m.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:_(`inventory.configureColumns`)}),(0,m.jsxs)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:[_(`inventory.configureColumnsDesc`),(0,m.jsxs)(`span`,{className:`ml-2 text-bambu-gray/60`,children:[`(`,j,` `,_(`inventory.of`),` `,v.length,` `,_(`inventory.visible`),`)`]})]}),(0,m.jsx)(`div`,{className:`space-y-1 overflow-y-auto flex-1 min-h-0 pr-1`,children:v.map((e,t)=>(0,m.jsxs)(`div`,{className:`flex items-center gap-2 p-2 rounded-lg border transition-colors ${b===t?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark-tertiary/50`} ${e.visible?``:`opacity-50`}`,draggable:!0,onDragStart:e=>T(e,t),onDragOver:e=>E(e,t),onDrop:D,onDragEnd:O,children:[(0,m.jsx)(`div`,{className:`cursor-grab text-bambu-gray/50 hover:text-bambu-gray`,children:(0,m.jsx)(s,{className:`w-4 h-4`})}),(0,m.jsx)(`span`,{className:`flex-1 font-medium text-sm text-white`,children:e.label}),(0,m.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,m.jsx)(`button`,{onClick:()=>w(t,t-1),disabled:t===0,className:`p-1 rounded text-bambu-gray hover:bg-bambu-dark-secondary disabled:opacity-30 disabled:cursor-not-allowed`,title:_(`inventory.moveUp`),children:(0,m.jsx)(a,{className:`w-4 h-4`})}),(0,m.jsx)(`button`,{onClick:()=>w(t,t+1),disabled:t===v.length-1,className:`p-1 rounded text-bambu-gray hover:bg-bambu-dark-secondary disabled:opacity-30 disabled:cursor-not-allowed`,title:_(`inventory.moveDown`),children:(0,m.jsx)(i,{className:`w-4 h-4`})})]}),(0,m.jsx)(`button`,{onClick:()=>C(t),className:`p-1.5 rounded transition-colors ${e.visible?`text-bambu-green hover:bg-bambu-green/10`:`text-bambu-gray/50 hover:bg-bambu-dark-secondary`}`,title:e.visible?_(`inventory.hideColumn`):_(`inventory.showColumn`),children:e.visible?(0,m.jsx)(f,{className:`w-4 h-4`}):(0,m.jsx)(o,{className:`w-4 h-4`})})]},e.id))}),(0,m.jsxs)(`div`,{className:`flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,m.jsxs)(u,{variant:`secondary`,onClick:k,className:`mr-auto`,children:[(0,m.jsx)(d,{className:`w-4 h-4`}),_(`inventory.reset`)]}),(0,m.jsx)(u,{variant:`secondary`,onClick:t,children:_(`inventory.cancel`)}),(0,m.jsx)(u,{onClick:A,children:_(`inventory.applyChanges`)})]})]})})})}export{h as t}; \ No newline at end of file diff --git a/static/assets/ConfigureAmsSlotModal-CpOmPM3O.js b/static/assets/ConfigureAmsSlotModal-CpOmPM3O.js new file mode 100644 index 000000000..da05852e1 --- /dev/null +++ b/static/assets/ConfigureAmsSlotModal-CpOmPM3O.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{a as c}from"./info-ROUoQhJR.js";import{n as l}from"./ToastContext-BRX0SW3C.js";import{t as u}from"./loader-circle-BEmFtawu.js";import{t as d}from"./package-BGUevlqS.js";import{t as f}from"./search-0n0CBc74.js";import{t as p}from"./settings-2-Cvn837lh.js";import{t as ee}from"./x-DR-Trv6U.js";import{t as m}from"./Button-DDr6eAFy.js";import{An as h,Gt as g,U as _,_t as v,ft as y,lt as b,sn as x}from"./index-CovRLYqQ.js";import{a as S,i as C,n as w,r as T}from"./slicerPrinterMatch-CUdoNag2.js";import{p as E}from"./utils-dMg0ogiz.js";import{t as te}from"./inventorySearch-CtBW7_f5.js";import{t as ne}from"./useCancellableTimeout-3XQzNJkJ.js";var D=e(n(),1),O=t();function k({isOpen:e,onClose:t,tagUid:n,trayUuid:c,printerId:d,amsId:p,trayId:h}){let{t:g}=i(),_=a(),{showToast:v}=l(),[y,S]=(0,D.useState)(``),C=c||n,{data:w,isLoading:T}=o({queryKey:[`unlinked-spools`],queryFn:r.getUnlinkedSpools,enabled:e}),E=(0,D.useMemo)(()=>w?w.filter(e=>{if(!y)return!0;let t=y.toLowerCase();return e.filament_name&&e.filament_name.toLowerCase().includes(t)||e.filament_vendor&&e.filament_vendor.toLowerCase().includes(t)||e.filament_material&&e.filament_material.toLowerCase().includes(t)||String(e.id).includes(t)}):[],[w,y]),te=s({mutationFn:e=>r.linkSpool(e,{spoolTag:C,printerId:d,amsId:p,trayId:h}),onSuccess:()=>{_.invalidateQueries({queryKey:[`unlinked-spools`]}),_.invalidateQueries({queryKey:[`linked-spools`]}),_.invalidateQueries({queryKey:[`spoolman-slot-assignments`]}),v(g(`spoolman.linkSuccess`),`success`),t()},onError:e=>{v(e.message||g(`spoolman.linkFailed`),`error`)}});return e?(0,O.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,O.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:t}),(0,O.jsxs)(`div`,{className:`relative bg-bambu-dark-secondary rounded-xl shadow-xl w-full max-w-md mx-4 max-h-[80vh] flex flex-col border border-bambu-dark-tertiary`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-white/10`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,O.jsx)(x,{className:`w-5 h-5 text-bambu-green`}),g(`spoolman.selectSpool`)]}),(0,O.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:[`AMS `,p,` T`,h,` · Printer #`,d]})]}),(0,O.jsx)(`button`,{onClick:t,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,O.jsx)(ee,{className:`w-5 h-5`})})]}),(0,O.jsxs)(`div`,{className:`p-4 border-b border-white/10`,children:[(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(f,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,O.jsx)(`input`,{type:`text`,value:y,onChange:e=>S(e.target.value),placeholder:g(`inventory.searchSpools`),className:`w-full pl-9 pr-3 py-2 bg-bambu-dark rounded-lg border border-white/10 text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green`})]}),(c||n)&&(0,O.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-2 font-mono truncate`,title:c||n,children:[`Tag: `,c||n]})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2 min-h-0`,children:T?(0,O.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,O.jsx)(u,{className:`w-6 h-6 animate-spin text-bambu-green`})}):E.length===0?(0,O.jsx)(`p`,{className:`text-center text-bambu-gray py-8 text-sm`,children:g(`inventory.noSpoolsMatch`)}):E.map(e=>(0,O.jsxs)(`button`,{onClick:()=>te.mutate(e.id),disabled:te.isPending||!C,className:`w-full flex items-center gap-3 p-3 rounded-lg hover:bg-white/5 transition-colors text-left`,children:[(0,O.jsx)(`span`,{className:`w-6 h-6 rounded-full border border-black/20 flex-shrink-0`,style:b(e.filament_color_hex)}),(0,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-sm text-white font-medium truncate`,children:e.filament_name||g(`spoolman.spoolId`)}),(0,O.jsxs)(`div`,{className:`text-xs text-bambu-gray truncate`,children:[e.filament_vendor?`${e.filament_vendor} · `:``,e.filament_material||`Unknown`,` · #`,e.id]})]}),(0,O.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.remaining_weight==null?`—`:`${Math.round(e.remaining_weight)}g`})]},e.id))}),(0,O.jsx)(`div`,{className:`p-4 border-t border-white/10 flex justify-end`,children:(0,O.jsx)(m,{variant:`ghost`,onClick:t,children:g(`inventory.cancel`)||`Cancel`})})]})]}):null}function A({isOpen:e,onClose:t,printerId:n,amsId:c,trayId:p,trayInfo:h,spoolmanEnabled:g}){let{t:_}=i(),x=a(),{showToast:S}=l(),[C,w]=(0,D.useState)(!1),[T,E]=(0,D.useState)(null),[ne,k]=(0,D.useState)(null);(0,D.useEffect)(()=>{E(null),k(null)},[C]);let[A,re]=(0,D.useState)(``),[j,ie]=(0,D.useState)(null),[M,ae]=(0,D.useState)(!1),[N,oe]=(0,D.useState)(null);(0,D.useEffect)(()=>{e&&w(!1)},[e]);let{data:se,isLoading:ce}=o({queryKey:[`inventory-spools`,`assign-modal`],queryFn:()=>r.getSpools(!0),enabled:e&&!g}),{data:le}=o({queryKey:[`spool-assignments`],queryFn:()=>r.getAssignments(),enabled:e}),{data:ue}=o({queryKey:[`settings`],queryFn:()=>r.getSettings(),enabled:e}),{data:de,isLoading:P}=o({queryKey:[`spoolman-inventory-spools`,`assign-modal`],queryFn:()=>r.getSpoolmanInventorySpools(!1),enabled:e&&!!g}),{data:F}=o({queryKey:[`spoolman-slot-assignments-all`],queryFn:()=>r.getSpoolmanSlotAssignments(),enabled:e&&!!g}),I=(0,D.useMemo)(()=>F?new Set(F.filter(e=>!(e.printer_id===n&&e.ams_id===c&&e.tray_id===p)).map(e=>e.spoolman_spool_id)):new Set,[F,n,c,p]),L=()=>{r.refreshPrinterStatus(n).catch(()=>{}),x.invalidateQueries({queryKey:[`printerStatus`,n]})},R=s({mutationFn:e=>r.assignSpool({spool_id:e,printer_id:n,ams_id:c,tray_id:p}),onSuccess:e=>{x.setQueryData([`spool-assignments`],t=>{let r=(t||[]).filter(e=>!(e.printer_id===n&&e.ams_id===c&&e.tray_id===p));return r.push(e),r}),x.invalidateQueries({queryKey:[`spool-assignments`]}),L(),S(_(e.pending_config?`inventory.assignPendingInsert`:`inventory.assignSuccess`),`success`),ae(!1),ie(null),oe(null),t()},onError:e=>{S(`${_(`inventory.assignFailed`)}: ${e.message}`,`error`)}}),z=s({mutationFn:e=>r.assignSpoolmanSlot({spoolman_spool_id:e,printer_id:n,ams_id:c,tray_id:p}),onSuccess:()=>{x.invalidateQueries({queryKey:[`spoolman-inventory-spools`]}),x.invalidateQueries({queryKey:[`spoolman-slot-assignments`]}),L(),S(_(`inventory.assignSuccess`),`success`),t()},onError:e=>{S(`${_(`inventory.assignFailed`)}: ${e.message}`,`error`)}}),B=e=>(e??``).trim().toUpperCase(),V=(e,t)=>{let n=B(e),r=B(t);return!n||!r?`none`:n===r?`exact`:r.includes(n)||n.includes(r)?`partial`:`none`},H=e=>e.split(`@`)[0].trim(),fe=(e,t)=>{let n=H(B(e)),r=H(B(t));return!n||!r?!1:n===r};if(!e)return null;let pe=new Set((le||[]).filter(e=>!(e.printer_id===n&&e.ams_id===c&&e.tray_id===p)).map(e=>e.spool_id)),U=se?.filter(e=>!e.archived_at&&(C||!pe.has(e.id))),W=U;if(!C){let e=H(B(h?.profile)),t=B(h?.material||h?.type);(e||t)&&(W=W?.filter(n=>{let r=H(B(n.slicer_filament_name||n.slicer_filament)),i=B(n.material);return e&&r&&r===e?!0:t&&i?i===t||t.includes(i)||i.includes(t):!r&&!i}))}A&&W&&(W=te(W,A));let me=()=>{if(ne!==null){z.mutate(ne);return}if(!T)return;let e=se?.find(e=>e.id===T);if(!e){S(_(`inventory.assignFailed`),`error`);return}if(!ue?.disable_filament_warnings&&h){let t=h.material||h.type,n=V(e.material,t),r=e.slicer_filament_name||e.slicer_filament,i=h.profile||h.type,a=fe(r,i);if(n!==`exact`){let o;o=n===`none`&&!a?`material_profile`:n===`partial`&&!a?`partial_profile`:n===`none`?`material`:`partial`,ie(T),oe({type:o,spoolMaterial:e.material||``,trayMaterial:t||``,spoolProfile:r||void 0,trayProfile:i||void 0}),ae(!0);return}}R.mutate(T)},he=()=>{j&&(R.mutate(j),ae(!1),ie(null))};return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-start sm:items-center justify-center p-4 overflow-y-auto`,children:[(0,O.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:t}),(0,O.jsxs)(`div`,{className:`relative w-full max-w-2xl bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] overflow-hidden flex flex-col my-auto`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(d,{className:`w-5 h-5 text-bambu-green`}),(0,O.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:_(`inventory.assignSpool`)})]}),(0,O.jsx)(`button`,{onClick:t,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,O.jsx)(ee,{className:`w-5 h-5`})})]}),(0,O.jsxs)(`div`,{className:`p-4 space-y-4 overflow-y-auto`,children:[h&&(0,O.jsxs)(`div`,{className:`p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,O.jsxs)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:[_(`inventory.selectSpool`),`:`]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h.color&&(0,O.jsx)(`span`,{className:`w-4 h-4 rounded-full border border-black/20`,style:b(h.color)}),(0,O.jsx)(`span`,{className:`text-white font-medium`,children:h.type||_(`ams.emptySlot`)}),(0,O.jsxs)(`span`,{className:`text-bambu-gray`,children:[`(`,h.location,`)`]})]})]}),(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(f,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,O.jsx)(`input`,{type:`text`,value:A,onChange:e=>re(e.target.value),placeholder:_(`inventory.searchSpools`),className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green`})]}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[!g&&(ce?(0,O.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,O.jsx)(u,{className:`w-6 h-6 text-bambu-green animate-spin`})}):W&&W.length>0?(0,O.jsx)(`div`,{className:`max-h-96 overflow-y-auto grid grid-cols-2 sm:grid-cols-3 gap-2`,children:W.map(e=>(0,O.jsxs)(`button`,{onClick:()=>{E(e.id),k(null)},title:e.note||void 0,className:`p-2.5 rounded-lg border text-left transition-colors ${T===e.id?`bg-bambu-green/20 border-bambu-green`:`bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,O.jsxs)(`p`,{className:`text-white text-sm font-medium truncate`,children:[e.brand?`${e.brand} `:``,e.material,e.subtype?` ${e.subtype}`:``]}),(0,O.jsxs)(`span`,{className:`text-[10px] font-mono text-bambu-gray shrink-0`,children:[`#`,e.id]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[e.rgba&&(0,O.jsx)(`span`,{className:`w-3 h-3 rounded-full border border-black/20 flex-shrink-0`,style:b(e.rgba)}),(0,O.jsx)(`span`,{className:`text-xs text-bambu-gray truncate`,children:y(e.color_name,e.rgba,e.color_name_is_synthesized)||``})]}),e.label_weight&&(0,O.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:[Math.max(0,Math.round(e.label_weight-e.weight_used)),` / `,e.label_weight,`g`]}),e.note&&(0,O.jsx)(`p`,{className:`text-[10px] text-bambu-gray/70 mt-1 truncate`,title:e.note,children:e.note})]},e.id))}):U&&U.length===0?(0,O.jsxs)(`div`,{className:`text-center py-8 text-bambu-gray`,children:[(0,O.jsx)(`p`,{children:_(`inventory.noAvailableSpools`)}),se&&(0,O.jsxs)(`p`,{className:`text-[10px] mt-2 opacity-60`,children:[se.length,` fetched · `,se.filter(e=>e.archived_at).length,` archived ·`,` `,se.filter(e=>pe.has(e.id)).length,` assigned to other slots`]})]}):(0,O.jsxs)(`div`,{className:`text-center py-8 text-bambu-gray`,children:[(0,O.jsx)(`p`,{children:_(`inventory.noSpoolsMatch`)}),U&&(0,O.jsxs)(`p`,{className:`text-[10px] mt-2 opacity-60`,children:[U.length,` unassigned spools — `,U.length-(W?.length??0),` filtered by tray match. Try "Show all spools".`]})]})),g&&(0,O.jsx)(O.Fragment,{children:P?(0,O.jsx)(`div`,{className:`flex justify-center py-4`,children:(0,O.jsx)(u,{className:`w-5 h-5 text-bambu-green animate-spin`})}):de&&de.filter(e=>!e.archived_at&&!I.has(e.id)).length>0?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wide pt-1`,children:_(`inventory.spoolmanSpools`)}),(0,O.jsx)(`div`,{className:`max-h-64 overflow-y-auto grid grid-cols-2 sm:grid-cols-3 gap-2`,children:te(de.filter(e=>!e.archived_at&&!I.has(e.id)),A).map(e=>(0,O.jsxs)(`button`,{onClick:()=>{k(e.id),E(null)},title:e.note||void 0,className:`p-2.5 rounded-lg border text-left transition-colors ${ne===e.id?`bg-bambu-green/20 border-bambu-green`:`bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,O.jsxs)(`p`,{className:`text-white text-sm font-medium truncate`,children:[e.brand?`${e.brand} `:``,e.material,e.subtype?` ${e.subtype}`:``]}),(0,O.jsxs)(`span`,{className:`text-[10px] font-mono text-bambu-gray shrink-0`,children:[`#`,e.id]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[e.rgba&&(0,O.jsx)(`span`,{className:`w-3 h-3 rounded-full border border-black/20 flex-shrink-0`,style:b(e.rgba)}),(0,O.jsx)(`span`,{className:`text-xs text-bambu-gray truncate`,children:y(e.color_name,e.rgba,e.color_name_is_synthesized)||``})]}),e.label_weight&&(0,O.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:[Math.max(0,Math.round(e.label_weight-e.weight_used)),` / `,e.label_weight,`g`]}),e.note&&(0,O.jsx)(`p`,{className:`text-[10px] text-bambu-gray/70 mt-1 truncate`,title:e.note,children:e.note})]},`spoolman-${e.id}`))})]}):null})]})]}),(0,O.jsxs)(`div`,{className:`flex justify-between items-center p-4 border-t border-bambu-dark-tertiary`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`input`,{id:`disable-filtering-toggle`,type:`checkbox`,checked:C,onChange:()=>w(e=>!e),className:`accent-bambu-green w-4 h-4 rounded focus:ring-0 border-bambu-dark-tertiary`}),(0,O.jsx)(`label`,{htmlFor:`disable-filtering-toggle`,className:`text-xs text-bambu-gray select-none cursor-pointer`,children:_(`inventory.showAllSpools`)})]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(m,{variant:`secondary`,onClick:t,children:_(`common.cancel`)}),(0,O.jsx)(m,{onClick:me,disabled:!T&&ne===null||R.isPending||z.isPending,children:R.isPending||z.isPending?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(u,{className:`w-4 h-4 animate-spin`}),_(`inventory.assigning`)]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(d,{className:`w-4 h-4`}),_(`inventory.assignSpool`)]})})]})]}),R.isError&&(0,O.jsx)(`div`,{className:`mx-4 mb-4 p-2 bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/50 rounded text-sm text-red-700 dark:text-red-400`,children:R.error.message})]})]}),M&&h&&T&&N&&(()=>{let e=``;return N.type===`material`?e=_(`inventory.assignMismatchMessage`,{spoolMaterial:N.spoolMaterial,trayMaterial:N.trayMaterial,location:h.location}):N.type===`partial`?e=_(`inventory.assignPartialMismatchMessage`,{spoolMaterial:N.spoolMaterial,trayMaterial:N.trayMaterial,location:h.location}):N.type===`material_profile`?e=`${_(`inventory.assignMismatchMessage`,{spoolMaterial:N.spoolMaterial,trayMaterial:N.trayMaterial,location:h.location})}\n\n${_(`inventory.assignProfileMismatchMessage`,{spoolProfile:N.spoolProfile||_(`common.unknown`),trayProfile:N.trayProfile||_(`common.unknown`),location:h.location})}`:N.type===`partial_profile`&&(e=`${_(`inventory.assignPartialMismatchMessage`,{spoolMaterial:N.spoolMaterial,trayMaterial:N.trayMaterial,location:h.location})}\n\n${_(`inventory.assignProfileMismatchMessage`,{spoolProfile:N.spoolProfile||_(`common.unknown`),trayProfile:N.trayProfile||_(`common.unknown`),location:h.location})}`),e=`${e}\n\n${_(`inventory.assignReconfigureNote`)}`,(0,O.jsx)(v,{title:_(`inventory.assignMismatchTitle`),message:e,confirmText:_(`inventory.assignMismatchConfirm`),variant:`warning`,overlayZIndex:`z-[110]`,isLoading:R.isPending,onConfirm:he,onCancel:()=>{R.isPending||(ae(!1),ie(null),oe(null))}})})()]})}function re(e){let t=e.includes(`_`)?e.split(`_`)[0]:e;return t.startsWith(`GFS`)?`GF`+t.slice(3):(t.startsWith(`PFUS`)||t.startsWith(`PFSP`),t)}var j=[`PLA`,`PETG`,`PCTG`,`ABS`,`ASA`,`TPU`,`PC`,`PA`,`NYLON`,`PVA`,`HIPS`,`PP`,`PET`];function ie(e){let t=e.replace(/@.+$/,``).trim(),n=t.toUpperCase(),r=n.match(/\bSUPPORT\s+FOR\s+/);if(r){let e=n.slice(r.index+r[0].length);for(let n of j)if(RegExp(`\\b${n}\\b`).test(e))return{material:n,brand:t.slice(0,r.index).trim(),variant:`Support`}}for(let e of j){let r=RegExp(`\\b${e}\\b`,`i`);if(r.test(n)){let n=t.split(r);return{material:e,brand:n[0]?.trim()||``,variant:n[1]?.trim()||``}}}let i=t.split(/\s+/);return i.length>=2?{material:i[1],brand:i[0],variant:i.slice(2).join(` `)}:{material:t,brand:``,variant:``}}function M(e){return`${e.extruder_id??0}|${e.name}|${e.k_value}`}function ae(e,t){return t===void 0?!1:e.some(e=>(e.extruder_id??0)===t)}function N(e,t,n){return ae(e,n)?e.find(e=>e.slot_id===t&&(e.extruder_id??0)===n):e.find(e=>e.slot_id===t)}function oe(e,t,n){return t?` \u00b7 ${e.extruder_id===1?n(`common.left`):n(`common.right`)}`:``}function se(e){return!e.startsWith(`GF`)&&!e.startsWith(`P1`)}var ce={white:`FFFFFF`,black:`000000`,red:`FF0000`,green:`00FF00`,blue:`0000FF`,yellow:`FFFF00`,cyan:`00FFFF`,magenta:`FF00FF`,orange:`FFA500`,purple:`800080`,pink:`FFC0CB`,brown:`8B4513`,gray:`808080`,grey:`808080`,"jade white":`FFFEF2`,ivory:`FFFFF0`,beige:`F5F5DC`,cream:`FFFDD0`,silver:`C0C0C0`,gold:`FFD700`,bronze:`CD7F32`,copper:`B87333`,navy:`000080`,teal:`008080`,olive:`808000`,maroon:`800000`,coral:`FF7F50`,salmon:`FA8072`,lime:`32CD32`,mint:`98FF98`,"forest green":`228B22`,"sky blue":`87CEEB`,"royal blue":`4169E1`,turquoise:`40E0D0`,lavender:`E6E6FA`,violet:`EE82EE`,plum:`DDA0DD`,tan:`D2B48C`,chocolate:`D2691E`,charcoal:`36454F`,slate:`708090`,transparent:`000000`,natural:`F5F5DC`,wood:`DEB887`},le=[{name:`White`,hex:`FFFFFF`},{name:`Black`,hex:`000000`},{name:`Red`,hex:`FF0000`},{name:`Blue`,hex:`0000FF`},{name:`Green`,hex:`00AA00`},{name:`Yellow`,hex:`FFFF00`},{name:`Orange`,hex:`FFA500`},{name:`Gray`,hex:`808080`}],ue=[{name:`Cyan`,hex:`00FFFF`},{name:`Magenta`,hex:`FF00FF`},{name:`Purple`,hex:`800080`},{name:`Pink`,hex:`FFC0CB`},{name:`Brown`,hex:`8B4513`},{name:`Beige`,hex:`F5F5DC`},{name:`Navy`,hex:`000080`},{name:`Teal`,hex:`008080`},{name:`Lime`,hex:`32CD32`},{name:`Gold`,hex:`FFD700`},{name:`Silver`,hex:`C0C0C0`},{name:`Maroon`,hex:`800000`},{name:`Olive`,hex:`808000`},{name:`Coral`,hex:`FF7F50`},{name:`Salmon`,hex:`FA8072`},{name:`Turquoise`,hex:`40E0D0`},{name:`Violet`,hex:`EE82EE`},{name:`Indigo`,hex:`4B0082`},{name:`Chocolate`,hex:`D2691E`},{name:`Tan`,hex:`D2B48C`},{name:`Slate`,hex:`708090`},{name:`Charcoal`,hex:`36454F`},{name:`Ivory`,hex:`FFFFF0`},{name:`Cream`,hex:`FFFDD0`}];function de(e){return ce[e.toLowerCase().trim()]||null}function P({isOpen:e,onClose:t,printerId:n,slotInfo:a,nozzleDiameter:d=`0.4`,printerModel:f,onSuccess:v,fullScreen:y}){let{t:x}=i(),{showToast:te}=l(),[k,A]=(0,D.useState)(``),[ce,P]=(0,D.useState)(``),[F,I]=(0,D.useState)(null),L=(0,D.useRef)(null);L.current=F;let[R,z]=(0,D.useState)(``),[B,V]=(0,D.useState)(``),[H,fe]=(0,D.useState)(``),[pe,U]=(0,D.useState)(!1),[W,me]=(0,D.useState)(!1),he=(0,D.useRef)(``),{schedule:ge}=ne(),{data:G,isLoading:_e,isError:ve}=o({queryKey:[`cloudSettings`],queryFn:()=>r.getCloudSettings(),enabled:e,retry:!1}),{data:ye}=o({queryKey:[`orcaCloudProfilesForAmsSlot`],queryFn:()=>r.orcaCloudListProfiles(),enabled:e,retry:!1}),{data:K,isLoading:be}=o({queryKey:[`localPresets`],queryFn:()=>r.getLocalPresets(),enabled:e}),{data:q,isLoading:xe}=o({queryKey:[`builtinFilaments`],queryFn:()=>r.getBuiltinFilaments(),enabled:e,staleTime:1/0}),{data:J,isLoading:Se}=o({queryKey:[`kprofiles`,n,d],queryFn:()=>r.getKProfiles(n,d),enabled:e&&!!n}),{data:Ce}=o({queryKey:[`colorCatalog`],queryFn:()=>r.getColorCatalog(),enabled:e,staleTime:1/0}),{data:Y}=o({queryKey:[`slicerPrinterModels`],queryFn:r.getSlicerPrinterModels,enabled:e,staleTime:1/0}),{data:X}=o({queryKey:[`slot-spool-defaults`,n,a.amsId,a.trayId],queryFn:()=>r.getSlotSpoolDefaults(n,a.amsId,a.trayId),enabled:e,staleTime:0}),we=(0,D.useMemo)(()=>w(Y??{}),[Y]),Te=(0,D.useMemo)(()=>{if(!f||!Y)return null;for(let[e,t]of Object.entries(Y))if(t===f)return`${e.startsWith(`Bambu Lab `)?e:`Bambu Lab ${e}`} ${d} nozzle`;return null},[f,Y,d]),Ee=s({mutationFn:async()=>{if(!k)throw Error(`No filament preset selected`);let e=k.startsWith(`local_`),t=k.startsWith(`builtin_`),i=k.startsWith(`orca_`)?k.replace(`orca_`,``):k,o=!e&&!t?ye?.filament.find(e=>e.setting_id===i):void 0,s=!!o,c=o??null,l=e?parseInt(k.replace(`local_`,``),10):null,u=t?k.replace(`builtin_`,``):null,f=e?K?.filament.find(e=>e.id===l):null,p=t?q?.find(e=>e.filament_id===u):null,ee=!e&&!t&&!s?G?.filament.find(e=>e.setting_id===k):null;if(!e&&!t&&!s&&!ee)throw Error(`Selected preset not found`);if(e&&!f)throw Error(`Selected local preset not found`);if(t&&!p)throw Error(`Selected builtin preset not found`);if(s&&!c)throw Error(`Selected Orca Cloud preset not found`);let m=e?f.name:t?p.name:s?c.name:ee.name,h=ie(m),g=L.current?.slot_id??-1,_=R||a.trayColor?.slice(0,6)||`FFFFFF`,v=m.replace(/@.+$/,``).trim(),y,b,S=h.material.toUpperCase(),C={PLA:`GFL99`,"PLA-CF":`GFL98`,"PLA SILK":`GFL96`,"PLA HIGH SPEED":`GFL95`,PETG:`GFG99`,"PETG HF":`GFG96`,"PETG-CF":`GFG98`,PCTG:`GFG97`,ABS:`GFB99`,ASA:`GFB98`,PC:`GFC99`,PA:`GFN99`,"PA-CF":`GFN98`,NYLON:`GFN99`,TPU:`GFU99`,PVA:`GFS99`,HIPS:`GFS98`,PE:`GFP99`,PP:`GFP97`};if(e){let e=(j.includes(S)?S:f?.filament_type||h.material||``).toUpperCase();y=C[e]||C[e.replace(/[-\s]?CF$/,``)]||C[e.replace(/\+$/,``)]||C[e.split(/[-\s]/)[0]]||``,b=``}else if(s)y=``,b=``;else if(t)y=u,b=``;else{if(y=re(k),b=k,!k.startsWith(`GFS`))try{let e=await r.getCloudSettingDetail(k),t=e.setting?.filament_id,n=e.filament_id||(typeof t==`string`?t:``);n&&(y=n)}catch(e){console.warn(`Failed to fetch preset detail for filament_id:`,e)}/^(PFUS|PFSP|PFCN)/.test(y)&&(console.warn(`Cloud preset ${k} carries no filament_id in either place; sending no tray_info_idx so the printer keeps a resolvable one.`),y=``)}let w=e&&f?.nozzle_temp_min?f.nozzle_temp_min:190,T=e&&f?.nozzle_temp_max?f.nozzle_temp_max:230;if(!e||t||s||!f?.nozzle_temp_min&&!f?.nozzle_temp_max){let t=(e?j.includes(S)?S:f?.filament_type||h.material||``:h.material).toUpperCase();t.includes(`PLA`)?(w=190,T=230):t.includes(`PETG`)?(w=220,T=260):t.includes(`ABS`)||t.includes(`ASA`)?(w=240,T=280):t.includes(`TPU`)?(w=200,T=240):t===`PCTG`?(w=220,T=260):t.includes(`PC`)?(w=260,T=300):(t.includes(`PA`)||t.includes(`NYLON`))&&(w=250,T=290)}let E=L.current?.k_value?parseFloat(L.current.k_value):0,ne=e?j.includes(S)?S:f?.filament_type||h.material||`PLA`:s&&j.includes(S)?S:h.material||`PLA`,D=await r.configureAmsSlot(n,a.amsId,a.trayId,{tray_info_idx:y,tray_type:ne,tray_sub_brands:v,tray_color:_+`FF`,nozzle_temp_min:w,nozzle_temp_max:T,cali_idx:g,nozzle_diameter:d,setting_id:b,kprofile_filament_id:L.current?.filament_id,kprofile_setting_id:L.current?.setting_id||void 0,k_value:E,orca_profile_id:s?i:void 0});s&&D.orca_fallback_reason&&te(x(`configureAmsSlot.orcaFallback.${D.orca_fallback_reason}`,{material:ne}),`warning`);let O=e?`local_${l}`:t?`builtin_${u}`:k,A=e?`local`:t?`builtin`:s?`orca_cloud`:`cloud`;try{await r.saveSlotPreset(n,a.amsId,a.trayId,O,v,A,D.tray_info_idx)}catch(e){console.warn(`Failed to save slot preset mapping:`,e)}return D},onSuccess:()=>{U(!0),v?.(),ge(()=>{U(!1),t()},1500)}}),De=s({mutationFn:async()=>r.resetAmsSlot(n,a.amsId,a.trayId),onSuccess:()=>{U(!0),v?.(),ge(()=>{U(!1),t()},1500)}}),Oe=(0,D.useMemo)(()=>{let e=H.toLowerCase(),t=[],n=new Set,r=a.savedPresetId,i=a.trayInfoIdx;if(ye?.filament)for(let r of ye.filament){let i=`orca_${r.setting_id}`;if(n.add(r.setting_id),n.add(i),!(e&&!r.name.toLowerCase().includes(e))){if(f){let e=T(r.name,Y??{});if(e&&!C(e,f))continue}t.push({id:i,name:r.name,source:`orca_cloud`,isUser:!0})}}if(G?.filament)for(let a of G.filament){if(n.has(a.setting_id))continue;n.add(a.setting_id);let o=r===a.setting_id||i&&(a.setting_id===i||re(a.setting_id)===i);if(!(e&&!a.name.toLowerCase().includes(e))){if(!o&&f){let e=T(a.name,Y??{});if(e&&!C(e,f))continue}t.push({id:a.setting_id,name:a.name,source:`cloud`,isUser:se(a.setting_id)})}}if(K?.filament){let n=a.savedPresetId;for(let r of K.filament){let i=`local_${r.id}`;if(!(e&&!r.name.toLowerCase().includes(e))){if(n!==i&&Te){let e=null;if(r.compatible_printers)try{let t=JSON.parse(r.compatible_printers);Array.isArray(t)&&(e=t.filter(e=>typeof e==`string`))}catch{e=null}if(S({name:r.name,compatible_printers:e},`filament`,Te,we)===`mismatch`)continue}t.push({id:i,name:r.name,source:`local`,isUser:!1})}}}if(q)for(let r of q){if(n.has(r.filament_id))continue;let i=r.filament_id.startsWith(`GF`)?`GFS`+r.filament_id.slice(2):r.filament_id;n.has(i)||(!e||r.name.toLowerCase().includes(e))&&t.push({id:`builtin_${r.filament_id}`,name:r.name,source:`builtin`,isUser:!1})}return t.sort((e,t)=>{let n={local:0,orca_cloud:1,cloud:2,builtin:3};return e.source===t.source?e.isUser&&!t.isUser?-1:!e.isUser&&t.isUser?1:e.name.localeCompare(t.name):n[e.source]-n[t.source]})},[ye?.filament,G?.filament,K?.filament,q,H,f,a.savedPresetId,a.trayInfoIdx,Te,we,Y]),Z=(0,D.useMemo)(()=>{if(!k)return null;let e=null,t=``;if(k.startsWith(`local_`)){let t=parseInt(k.replace(`local_`,``),10);e=K?.filament.find(e=>e.id===t)?.name||null}else if(k.startsWith(`builtin_`)){let n=k.replace(`builtin_`,``);e=q?.find(e=>e.filament_id===n)?.name||null,t=E(n)}else{let n=k.startsWith(`orca_`)?k.replace(`orca_`,``):k,r=ye?.filament.find(e=>e.setting_id===n);if(r)e=r.name;else if(G?.filament){let n=G.filament.find(e=>e.setting_id===k);e=n?.name||null,n&&(t=E(n.setting_id))}}if(!e)return null;let n=e.replace(/@.+$/,``).trim();n.startsWith(`# `)&&(n=n.slice(2).trim());let r=ie(n);return{fullName:n,material:r.material,brand:r.brand,filamentId:t}},[k,G?.filament,K?.filament,q,ye?.filament]),ke=Z?.fullName||``,Ae=(0,D.useMemo)(()=>{if(!Ce||!Z)return[];let{fullName:e,brand:t}=Z,n=e.replace(/^(Bambu\s*(Lab)?|eSUN|Polymaker|Overture|Sunlu|Hatchbox)\s*/i,``).trim();return Ce.filter(e=>{let r=(e.material||``).toUpperCase(),i=e.manufacturer.toUpperCase();if(!(r===n.toUpperCase()||r.includes(n.toUpperCase())||n.toUpperCase().includes(r)))return!1;if(t){let e=t.toUpperCase();if(!i.includes(e)&&!e.includes(i))return!1}return!0})},[Ce,Z]),je=(0,D.useMemo)(()=>new Set((J?.profiles??[]).map(e=>e.extruder_id??0)).size>1,[J?.profiles]),Q=(0,D.useMemo)(()=>{if(!J?.profiles)return[];if(!Z){let e=a.caliIdx;if(e!=null&&e>0){let t=N(J.profiles,e,a.extruderId);if(t)return[t]}return[]}let{fullName:e,material:t,brand:n,filamentId:r}=Z,i=e.toUpperCase(),o=t.toUpperCase(),s=n.toUpperCase()===`GENERIC`?``:n.toUpperCase(),c=r;if(!o||o.length<2)return[];let l=J.profiles.filter(e=>{if(c){let t=E(e.filament_id);if(t&&t===c)return!0}let t=e.name.toUpperCase();if(s)return!(!t.includes(s)||!t.includes(o));if(t.includes(i)||t.includes(o))return!0;let n={NYLON:[`PA`,`PA-CF`,`PA6`],PA:[`NYLON`]}[o]||[];for(let e of n)if(t.includes(e))return!0;return!1}),u=ae(J.profiles,a.extruderId)?l.filter(e=>(e.extruder_id??0)===a.extruderId):l,d=new Map;for(let e of u){let t=M(e);d.has(t)||d.set(t,e)}let f=Array.from(d.values()),p=a.caliIdx;if((ce&&k===ce||c&&c===E(a.trayInfoIdx))&&p!=null&&p>0&&!f.some(e=>e.slot_id===p)){let e=N(J.profiles,p,a.extruderId);e&&f.unshift(e)}return f},[J?.profiles,Z,a.extruderId,a.caliIdx,a.trayInfoIdx,k,ce]),$=(0,D.useMemo)(()=>{if(!J?.profiles)return[];let e=new Set(Q.map(e=>M(e))),t=new Map;for(let n of J.profiles){let r=M(n);e.has(r)||t.has(r)||t.set(r,n)}return Array.from(t.values()).sort((e,t)=>e.name.localeCompare(t.name))},[J?.profiles,Q]),Me=Q.length>0||$.length>0,Ne=(0,D.useCallback)(e=>{if(!e){I(null);return}I(Q.find(t=>M(t)===e)||$.find(t=>M(t)===e)||null)},[Q,$]);(0,D.useEffect)(()=>{if(e){if(X?.slicer_filament)A(X.slicer_filament),P(X.slicer_filament);else if(a.savedPresetId)A(a.savedPresetId),P(a.savedPresetId);else if(a.trayInfoIdx&&G?.filament){let e=G.filament.find(e=>e.setting_id===a.trayInfoIdx);e||=G.filament.find(e=>re(e.setting_id)===a.trayInfoIdx),e&&(A(e.setting_id),P(e.setting_id))}else if(a.trayInfoIdx&&q?.length){let e=a.trayInfoIdx,t=q.find(t=>t.filament_id===e);t&&(A(`builtin_${t.filament_id}`),P(`builtin_${t.filament_id}`))}if(a.trayColor){let e=a.trayColor.slice(0,6);e&&z(e)}}else A(``),P(``),I(null),z(``),V(``),fe(``),U(!1),he.current=``},[e,X?.slicer_filament,a.savedPresetId,a.trayInfoIdx,a.trayColor,G?.filament,q]),(0,D.useEffect)(()=>{if(Q.length>0){if(X?.cali_idx!=null){let e=N(Q,X.cali_idx,X.extruder??a.extruderId);if(e){I(e);return}}if(a.caliIdx!=null&&a.caliIdx>0){let e=N(Q,a.caliIdx,a.extruderId);if(e){I(e);return}}I(Q[0])}else I(null)},[k,Q,X?.cali_idx,X?.extruder,a.caliIdx,a.extruderId]);let Pe=(0,D.useCallback)(e=>{e.key===`Escape`&&t()},[t]);(0,D.useEffect)(()=>{if(e)return document.addEventListener(`keydown`,Pe),()=>document.removeEventListener(`keydown`,Pe)},[e,Pe]);let Fe=_e&&!ve||be||xe||Se;if((0,D.useEffect)(()=>{if(!Fe&&k&&k!==he.current){let e=requestAnimationFrame(()=>{let e=document.querySelector(`[class*="fixed inset-0 z-50"]`)?.querySelector(`[data-preset-id="${CSS.escape(k)}"]`);e&&(he.current=k,e.scrollIntoView({block:`nearest`}))});return()=>cancelAnimationFrame(e)}},[k,Fe]),!e)return null;let Ie=k&&!Ee.isPending,Le=R||a.trayColor||`FFFFFF`;return(0,O.jsxs)(`div`,{className:`fixed inset-0 z-50 flex ${y?``:`items-center justify-center`}`,children:[!y&&(0,O.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:t}),(0,O.jsxs)(`div`,{className:y?`relative w-full h-full bg-bambu-dark-secondary flex flex-col`:`relative w-full max-w-lg mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(p,{className:`w-5 h-5 text-bambu-blue`}),(0,O.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:x(`configureAmsSlot.title`)}),y&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 ml-4 text-sm text-bambu-gray`,children:[(0,O.jsx)(`span`,{className:`text-white/30`,children:`|`}),a.trayColor&&(0,O.jsx)(`span`,{className:`w-4 h-4 rounded-full border border-black/20`,style:b(a.trayColor)}),(0,O.jsx)(`span`,{className:`text-white/70`,children:x(`configureAmsSlot.slotLabel`,{ams:_(a.amsId,a.trayCount),slot:a.trayId+1})}),a.traySubBrands&&(0,O.jsxs)(`span`,{children:[`(`,a.traySubBrands,`)`]})]})]}),(0,O.jsx)(`button`,{onClick:t,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,O.jsx)(ee,{className:`w-5 h-5`})})]}),(0,O.jsxs)(`div`,{className:`p-4 overflow-y-auto ${y?`flex-1 min-h-0`:`space-y-4 max-h-[60vh]`}`,children:[pe&&(0,O.jsx)(`div`,{className:`absolute inset-0 bg-bambu-dark-secondary/95 z-10 flex items-center justify-center rounded-xl`,children:(0,O.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,O.jsx)(h,{className:`w-16 h-16 text-bambu-green mx-auto`}),(0,O.jsx)(`p`,{className:`text-lg font-semibold text-white`,children:x(`configureAmsSlot.slotConfigured`)}),(0,O.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:x(`configureAmsSlot.settingsSentToPrinter`)})]})}),!y&&(0,O.jsxs)(`div`,{className:`p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,O.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:x(`configureAmsSlot.configuringSlot`)}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.trayColor&&(0,O.jsx)(`span`,{className:`w-4 h-4 rounded-full border border-black/20`,style:b(a.trayColor)}),(0,O.jsx)(`span`,{className:`text-white font-medium`,children:x(`configureAmsSlot.slotLabel`,{ams:_(a.amsId,a.trayCount),slot:a.trayId+1})}),a.traySubBrands&&(0,O.jsxs)(`span`,{className:`text-bambu-gray`,children:[`(`,a.traySubBrands,`)`]})]})]}),Fe?(0,O.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,O.jsx)(u,{className:`w-6 h-6 text-bambu-green animate-spin`})}):y?(0,O.jsxs)(`div`,{className:`flex gap-4 h-full`,children:[(0,O.jsxs)(`div`,{className:`w-1/2 flex flex-col min-h-0`,children:[(0,O.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:[x(`configureAmsSlot.filamentProfile`),` `,(0,O.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:`*`})]}),(0,O.jsx)(`input`,{type:`text`,placeholder:x(`configureAmsSlot.searchPresets`),value:H,onChange:e=>fe(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder:text-bambu-gray focus:border-bambu-green focus:outline-none mb-2 shrink-0`}),(0,O.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto space-y-1`,children:Oe.length===0?(0,O.jsx)(`p`,{className:`text-center py-4 text-bambu-gray`,children:G?.filament?.length===0&&!K?.filament?.length?x(`configureAmsSlot.noPresetsAvailable`):x(`configureAmsSlot.noMatchingPresets`)}):Oe.map(e=>(0,O.jsx)(`button`,{"data-preset-id":e.id,onClick:()=>A(e.id),className:`group w-full p-2 rounded-lg border text-left transition-colors ${k===e.id?`bg-bambu-green/20 border-bambu-green`:`bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`span`,{className:`text-white text-sm truncate group-hover:whitespace-normal group-hover:break-all`,title:e.name,children:e.name}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[e.source===`local`&&(0,O.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`,children:x(`profiles.localProfiles.badge`)}),e.source===`orca_cloud`&&(0,O.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`,children:x(`configureAmsSlot.orcaCloud`)}),e.source===`cloud`&&(0,O.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bambu-blue/20 text-bambu-blue`,children:x(`configureAmsSlot.bambuCloud`)}),e.source===`builtin`&&(0,O.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`,children:x(`configureAmsSlot.builtin`)})]})]})},e.id))})]}),(0,O.jsxs)(`div`,{className:`w-1/2 flex flex-col gap-4 min-h-0 overflow-y-auto`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:[x(`configureAmsSlot.kProfileLabel`),ke&&(0,O.jsx)(`span`,{className:`ml-2 text-xs text-bambu-blue`,children:x(`configureAmsSlot.filteringFor`,{material:ke})})]}),Me?(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsxs)(`select`,{value:F?M(F):``,onChange:e=>Ne(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none pr-10`,children:[(0,O.jsx)(`option`,{value:``,children:x(`configureAmsSlot.noKProfile`)}),Q.map(e=>(0,O.jsxs)(`option`,{value:M(e),children:[e.name,` (K=`,e.k_value,`)`,oe(e,je,x)]},M(e))),$.length>0&&(0,O.jsx)(`optgroup`,{label:x(`configureAmsSlot.otherKProfiles`),children:$.map(e=>(0,O.jsxs)(`option`,{value:M(e),children:[e.name,` (K=`,e.k_value,`)`,oe(e,je,x)]},M(e)))})]}),(0,O.jsx)(c,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}):k?(0,O.jsx)(`p`,{className:`text-sm text-bambu-gray italic py-2`,children:x(`configureAmsSlot.noMatchingKProfiles`)}):(0,O.jsx)(`span`,{className:`inline-block text-xs px-2 py-1 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 border border-amber-300 dark:border-amber-500/30`,children:x(`configureAmsSlot.selectFilamentFirst`)}),F&&(0,O.jsx)(`p`,{className:`text-xs text-bambu-green mt-1`,children:x(`configureAmsSlot.kFromCalibration`,{value:F.k_value})})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:x(`configureAmsSlot.customColorLabel`)}),Ae.length>0&&(0,O.jsxs)(`div`,{className:`mb-3`,children:[(0,O.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1.5`,children:x(`configureAmsSlot.presetColors`,{name:Z?.fullName})}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Ae.map(e=>(0,O.jsxs)(`button`,{onClick:()=>{z(e.hex_color.replace(`#`,``).toUpperCase()),V(e.color_name)},className:`h-7 px-2 rounded-md border-2 transition-all flex items-center gap-1.5 ${R===e.hex_color.replace(`#`,``).toUpperCase()?`border-bambu-green scale-105`:`border-white/20 hover:border-white/40`}`,title:e.color_name,children:[(0,O.jsx)(`span`,{className:`w-4 h-4 rounded-full border border-black/20 flex-shrink-0`,style:{backgroundColor:e.hex_color}}),(0,O.jsx)(`span`,{className:`text-xs text-white/80 whitespace-nowrap`,children:e.color_name})]},e.id))})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mb-2`,children:[le.map(e=>(0,O.jsx)(`button`,{onClick:()=>{z(e.hex),V(e.name)},className:`w-7 h-7 rounded-md border-2 transition-all ${R===e.hex?`border-bambu-green scale-110`:`border-white/20 hover:border-white/40`}`,style:{backgroundColor:`#${e.hex}`},title:e.name},e.hex)),(0,O.jsx)(`button`,{onClick:()=>me(!W),className:`w-7 h-7 rounded-md border-2 border-white/20 hover:border-white/40 flex items-center justify-center text-white/60 hover:text-white/80 transition-all text-xs`,title:x(W?`configureAmsSlot.showLessColors`:`configureAmsSlot.showMoreColors`),children:W?`−`:`+`})]}),W&&(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mb-2`,children:ue.map(e=>(0,O.jsx)(`button`,{onClick:()=>{z(e.hex),V(e.name)},className:`w-7 h-7 rounded-md border-2 transition-all ${R===e.hex?`border-bambu-green scale-110`:`border-white/20 hover:border-white/40`}`,style:{backgroundColor:`#${e.hex}`},title:e.name},e.hex))}),(0,O.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,O.jsx)(`div`,{className:`w-10 h-10 rounded-lg border-2 border-white/20 flex-shrink-0`,style:b(Le)}),(0,O.jsx)(`input`,{type:`text`,placeholder:x(`configureAmsSlot.colorPlaceholder`),value:B,onChange:e=>{let t=e.target.value;V(t);let n=de(t);if(n)z(n);else{let e=t.replace(/[^0-9A-Fa-f]/g,``).toUpperCase();e.length===6?z(e):e.length===3&&z(e.split(``).map(e=>e+e).join(``))}},className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder:text-bambu-gray focus:border-bambu-green focus:outline-none text-sm`}),R&&(0,O.jsx)(`button`,{onClick:()=>{z(``),V(``)},className:`px-2 py-1 text-xs text-bambu-gray hover:text-white bg-bambu-dark-tertiary rounded`,title:x(`configureAmsSlot.clearCustomColor`),children:x(`configureAmsSlot.clear`)})]}),R&&(0,O.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1.5`,children:x(`configureAmsSlot.hexLabel`,{hex:R})})]})]})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:[x(`configureAmsSlot.filamentProfile`),` `,(0,O.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:`*`})]}),(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:x(`configureAmsSlot.searchPresets`),value:H,onChange:e=>fe(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder:text-bambu-gray focus:border-bambu-green focus:outline-none mb-2`}),(0,O.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-1`,children:Oe.length===0?(0,O.jsx)(`p`,{className:`text-center py-4 text-bambu-gray`,children:G?.filament?.length===0&&!K?.filament?.length?x(`configureAmsSlot.noPresetsAvailable`):x(`configureAmsSlot.noMatchingPresets`)}):Oe.map(e=>(0,O.jsx)(`button`,{"data-preset-id":e.id,onClick:()=>A(e.id),className:`group w-full p-2 rounded-lg border text-left transition-colors ${k===e.id?`bg-bambu-green/20 border-bambu-green`:`bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`span`,{className:`text-white text-sm truncate group-hover:whitespace-normal group-hover:break-all`,title:e.name,children:e.name}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[e.source===`local`&&(0,O.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`,children:x(`profiles.localProfiles.badge`)}),e.source===`orca_cloud`&&(0,O.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`,children:x(`configureAmsSlot.orcaCloud`)}),e.source===`cloud`&&(0,O.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bambu-blue/20 text-bambu-blue`,children:x(`configureAmsSlot.bambuCloud`)}),e.source===`builtin`&&(0,O.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`,children:x(`configureAmsSlot.builtin`)})]})]})},e.id))})]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:[x(`configureAmsSlot.kProfileLabel`),ke&&(0,O.jsx)(`span`,{className:`ml-2 text-xs text-bambu-blue`,children:x(`configureAmsSlot.filteringFor`,{material:ke})})]}),Me?(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsxs)(`select`,{value:F?M(F):``,onChange:e=>Ne(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none pr-10`,children:[(0,O.jsx)(`option`,{value:``,children:x(`configureAmsSlot.noKProfile`)}),Q.map(e=>(0,O.jsxs)(`option`,{value:M(e),children:[e.name,` (K=`,e.k_value,`)`,oe(e,je,x)]},M(e))),$.length>0&&(0,O.jsx)(`optgroup`,{label:x(`configureAmsSlot.otherKProfiles`),children:$.map(e=>(0,O.jsxs)(`option`,{value:M(e),children:[e.name,` (K=`,e.k_value,`)`,oe(e,je,x)]},M(e)))})]}),(0,O.jsx)(c,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}):k?(0,O.jsx)(`p`,{className:`text-sm text-bambu-gray italic py-2`,children:x(`configureAmsSlot.noMatchingKProfiles`)}):(0,O.jsx)(`span`,{className:`inline-block text-xs px-2 py-1 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 border border-amber-300 dark:border-amber-500/30`,children:x(`configureAmsSlot.selectFilamentFirst`)}),F&&(0,O.jsx)(`p`,{className:`text-xs text-bambu-green mt-1`,children:x(`configureAmsSlot.kFromCalibration`,{value:F.k_value})})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:x(`configureAmsSlot.customColorLabel`)}),Ae.length>0&&(0,O.jsxs)(`div`,{className:`mb-3`,children:[(0,O.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1.5`,children:x(`configureAmsSlot.presetColors`,{name:Z?.fullName})}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Ae.map(e=>(0,O.jsxs)(`button`,{onClick:()=>{z(e.hex_color.replace(`#`,``).toUpperCase()),V(e.color_name)},className:`h-7 px-2 rounded-md border-2 transition-all flex items-center gap-1.5 ${R===e.hex_color.replace(`#`,``).toUpperCase()?`border-bambu-green scale-105`:`border-white/20 hover:border-white/40`}`,title:e.color_name,children:[(0,O.jsx)(`span`,{className:`w-4 h-4 rounded-full border border-black/20 flex-shrink-0`,style:{backgroundColor:e.hex_color}}),(0,O.jsx)(`span`,{className:`text-xs text-white/80 whitespace-nowrap`,children:e.color_name})]},e.id))})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mb-2`,children:[le.map(e=>(0,O.jsx)(`button`,{onClick:()=>{z(e.hex),V(e.name)},className:`w-7 h-7 rounded-md border-2 transition-all ${R===e.hex?`border-bambu-green scale-110`:`border-white/20 hover:border-white/40`}`,style:{backgroundColor:`#${e.hex}`},title:e.name},e.hex)),(0,O.jsx)(`button`,{onClick:()=>me(!W),className:`w-7 h-7 rounded-md border-2 border-white/20 hover:border-white/40 flex items-center justify-center text-white/60 hover:text-white/80 transition-all text-xs`,title:x(W?`configureAmsSlot.showLessColors`:`configureAmsSlot.showMoreColors`),children:W?`−`:`+`})]}),W&&(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mb-2`,children:ue.map(e=>(0,O.jsx)(`button`,{onClick:()=>{z(e.hex),V(e.name)},className:`w-7 h-7 rounded-md border-2 transition-all ${R===e.hex?`border-bambu-green scale-110`:`border-white/20 hover:border-white/40`}`,style:{backgroundColor:`#${e.hex}`},title:e.name},e.hex))}),(0,O.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,O.jsx)(`div`,{className:`w-10 h-10 rounded-lg border-2 border-white/20 flex-shrink-0`,style:b(Le)}),(0,O.jsx)(`input`,{type:`text`,placeholder:x(`configureAmsSlot.colorPlaceholder`),value:B,onChange:e=>{let t=e.target.value;V(t);let n=de(t);if(n)z(n);else{let e=t.replace(/[^0-9A-Fa-f]/g,``).toUpperCase();e.length===6?z(e):e.length===3&&z(e.split(``).map(e=>e+e).join(``))}},className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder:text-bambu-gray focus:border-bambu-green focus:outline-none text-sm`}),R&&(0,O.jsx)(`button`,{onClick:()=>{z(``),V(``)},className:`px-2 py-1 text-xs text-bambu-gray hover:text-white bg-bambu-dark-tertiary rounded`,title:x(`configureAmsSlot.clearCustomColor`),children:x(`configureAmsSlot.clear`)})]}),R&&(0,O.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1.5`,children:x(`configureAmsSlot.hexLabel`,{hex:R})})]})]})]}),(0,O.jsxs)(`div`,{className:`flex justify-between p-4 border-t border-bambu-dark-tertiary shrink-0`,children:[(0,O.jsx)(m,{variant:`secondary`,onClick:()=>De.mutate(),disabled:De.isPending||Ee.isPending,className:`text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-500/10`,children:De.isPending?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(u,{className:`w-4 h-4 animate-spin`}),x(`configureAmsSlot.resetting`)]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(g,{className:`w-4 h-4`}),x(`configureAmsSlot.resetSlot`)]})}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(m,{variant:`secondary`,onClick:t,children:x(`configureAmsSlot.cancel`)}),(0,O.jsx)(m,{onClick:()=>Ee.mutate(),disabled:!Ie,children:Ee.isPending?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(u,{className:`w-4 h-4 animate-spin`}),x(`configureAmsSlot.configuring`)]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(p,{className:`w-4 h-4`}),x(`configureAmsSlot.configureSlot`)]})})]})]}),(Ee.isError||De.isError)&&(0,O.jsx)(`div`,{className:`mx-4 mb-4 p-2 bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/50 rounded text-sm text-red-700 dark:text-red-400`,children:Ee.error?.message||De.error?.message})]})]})}export{A as n,k as r,P as t}; \ No newline at end of file diff --git a/static/assets/ConnectAuthorizePage-kYDbSdif.js b/static/assets/ConnectAuthorizePage-kYDbSdif.js new file mode 100644 index 000000000..ca8caf43e --- /dev/null +++ b/static/assets/ConnectAuthorizePage-kYDbSdif.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,t as i,w as a}from"./client-DnySrlFv.js";import{t as o}from"./link-2-MI-QCMh8.js";import{t as s}from"./loader-circle-BEmFtawu.js";import{t as c}from"./triangle-alert-Dt_1FcBy.js";import{Wn as l,yt as u}from"./index-CovRLYqQ.js";var d=e(n(),1),f=t();function p(e,t){let n=new URL(e);for(let[e,r]of Object.entries(t))r&&n.searchParams.set(e,r);return n.toString()}function m(){let{t:e}=a(),{authEnabled:t,loading:n}=u(),[m]=l(),[h,g]=(0,d.useState)({kind:`loading`}),_=(0,d.useRef)(!1),v=m.get(`client_id`)??``,y=m.get(`redirect_uri`)??``,b=m.get(`state`)??``,x=m.get(`code_challenge`)??``,S=m.get(`code_challenge_method`)??``,C=async()=>{g({kind:`redirecting`});try{let e=await r.connectAuthorize({client_id:v,redirect_uri:y,code_challenge:x,code_challenge_method:`S256`});window.location.replace(p(e.redirect_uri,{code:e.code,state:b}))}catch(t){g({kind:`error`,message:t instanceof Error?t.message:e(`connectedApps.authorize.failed`)})}};return(0,d.useEffect)(()=>{if(!(n||_.current)){if(_.current=!0,!t){g({kind:`error`,message:e(`connectedApps.authorize.authDisabled`)});return}if(!v||!y||!x||S!==`S256`){g({kind:`error`,message:e(`connectedApps.authorize.invalidRequest`)});return}r.getConnectAuthorizeInfo(v,y).then(e=>{e.already_granted?C():g({kind:`consent`,info:e})}).catch(t=>{g({kind:`error`,message:t instanceof i&&t.status===409?e(`connectedApps.authorize.authDisabled`):e(`connectedApps.authorize.invalidRequest`)})})}},[n,t]),(0,f.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,f.jsxs)(`div`,{className:`max-w-md w-full space-y-6 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(h.kind===`loading`||h.kind===`redirecting`)&&(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-bambu-gray`,role:`status`,children:[(0,f.jsx)(s,{className:`w-8 h-8 animate-spin text-bambu-green`}),(0,f.jsx)(`p`,{children:h.kind===`loading`?e(`connectedApps.authorize.checking`):e(`connectedApps.authorize.redirecting`)})]}),h.kind===`error`&&(0,f.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,f.jsx)(c,{className:`w-10 h-10 mx-auto text-yellow-600 dark:text-yellow-400`}),(0,f.jsx)(`h1`,{className:`text-xl font-semibold text-white`,children:e(`connectedApps.authorize.errorTitle`)}),(0,f.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:h.message})]}),h.kind===`consent`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,f.jsx)(`div`,{className:`w-14 h-14 mx-auto rounded-full bg-bambu-green/20 flex items-center justify-center`,children:(0,f.jsx)(o,{className:`w-7 h-7 text-bambu-green`})}),(0,f.jsx)(`h1`,{className:`text-xl font-semibold text-white text-balance`,children:e(`connectedApps.authorize.title`,{app:h.info.app_name})}),(0,f.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`connectedApps.authorize.signedInAs`,{username:h.info.username})})]}),(0,f.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`connectedApps.authorize.sharedData`,{app:h.info.app_name})}),(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>{window.location.replace(p(y,{error:`access_denied`,state:b}))},className:`flex-1 px-4 py-2 bg-bambu-dark-tertiary text-white rounded-md hover:bg-bambu-dark-tertiary/80 focus:outline-none focus-visible:ring-2 focus-visible:ring-bambu-green`,children:e(`connectedApps.authorize.deny`)}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>void C(),className:`flex-1 px-4 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green/90 focus:outline-none focus-visible:ring-2 focus-visible:ring-white`,children:e(`connectedApps.authorize.allow`)})]})]})]})})}export{m as ConnectAuthorizePage}; \ No newline at end of file diff --git a/static/assets/ContextMenu-Bt5_A0ZU.js b/static/assets/ContextMenu-Bt5_A0ZU.js new file mode 100644 index 000000000..5c3c1ea5d --- /dev/null +++ b/static/assets/ContextMenu-Bt5_A0ZU.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n}from"./client-DnySrlFv.js";import{t as r}from"./createLucideIcon-DvBYJlWL.js";import{t as i}from"./search-0n0CBc74.js";import{Mn as a}from"./index-CovRLYqQ.js";var o=r(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),s=e(n(),1),c=t();function l({items:e,searchPlaceholder:t,onClose:n,className:r,onMouseEnter:a,onMouseLeave:o}){let[l,u]=(0,s.useState)(``),d=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(t){let e=window.setTimeout(()=>d.current?.focus(),0);return()=>window.clearTimeout(e)}},[t]);let f=l.trim().toLowerCase(),p=t&&f?e.filter(e=>e.label.toLowerCase().includes(f)):e;return(0,c.jsxs)(`div`,{className:r,onMouseEnter:a,onMouseLeave:o,children:[t&&(0,c.jsx)(`div`,{className:`sticky top-0 z-[1] px-2 py-1.5 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary`,children:(0,c.jsxs)(`div`,{className:`relative`,children:[(0,c.jsx)(i,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-bambu-gray pointer-events-none`}),(0,c.jsx)(`input`,{ref:d,type:`text`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{if(e.key===`Enter`){let e=p.find(e=>!e.disabled);e&&(e.onClick(),n())}},placeholder:t,className:`w-full pl-7 pr-2 py-1 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})}),p.map((e,t)=>(0,c.jsxs)(`button`,{onClick:()=>{e.disabled||(e.onClick(),n())},disabled:e.disabled,className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${e.disabled?`text-bambu-gray cursor-not-allowed`:e.danger?`text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-400/10`:`text-white hover:bg-bambu-dark-tertiary`}`,children:[e.icon&&(0,c.jsx)(`span`,{className:`w-4 h-4 flex-shrink-0 flex items-center justify-center`,children:e.icon}),(0,c.jsx)(`span`,{className:`flex-1 truncate`,children:e.label})]},t)),t&&p.length===0&&(0,c.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray text-center italic`,children:`—`})]})}function u({x:e,y:t,items:n,onClose:r,anchorRef:i}){let o=(0,s.useRef)(null),[u,d]=(0,s.useState)(null),f=(0,s.useRef)(null),[p,m]=(0,s.useState)({x:e,y:t,visible:!1}),[h,g]=(0,s.useState)(!1),[_,v]=(0,s.useState)({});(0,s.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||i?.current?.contains(t)||r()},t=e=>{e.key===`Escape`&&r()},n=e=>{o.current&&o.current.contains(e.target)||r()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),document.addEventListener(`scroll`,n,!0),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`scroll`,n,!0),f.current&&clearTimeout(f.current)}},[r,i]),(0,s.useLayoutEffect)(()=>{if(o.current){o.current.style.visibility=`hidden`,o.current.style.display=`block`;let n=o.current.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=e,s=t;e+n.width>r-8&&(a=Math.max(8,r-n.width-8)),a<8&&(a=8),t+n.height>i-8&&(s=Math.max(8,i-n.height-8)),s<8&&(s=8),g(r-a-n.width<180&&a>180),m({x:a,y:s,visible:!0})}},[e,t]);let y=(e,t)=>{f.current&&=(clearTimeout(f.current),null);let n=t.getBoundingClientRect(),r=window.innerHeight-n.top-8<300&&n.top>300;v(t=>({...t,[e]:r?`bottom`:`top`})),d(e)},b=()=>{f.current=window.setTimeout(()=>{d(null)},150)};return(0,c.jsx)(`div`,{ref:o,className:`fixed z-50 min-w-[180px] max-w-[280px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1`,style:{left:p.x,top:p.y,visibility:p.visible?`visible`:`hidden`},children:n.map((e,t)=>{if(e.divider)return(0,c.jsx)(`div`,{className:`my-1 border-t border-bambu-dark-tertiary`},t);let n=e.submenu&&e.submenu.length>0;return(0,c.jsxs)(`div`,{className:`relative`,onMouseEnter:e=>n&&y(t,e.currentTarget),onMouseLeave:()=>n&&b(),children:[(0,c.jsxs)(`button`,{onMouseEnter:e=>n&&y(t,e.currentTarget.parentElement),onClick:()=>{n?d(u===t?null:t):e.disabled||(e.onClick(),r())},disabled:e.disabled,title:e.title,className:`group w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${e.disabled?`text-bambu-gray cursor-not-allowed`:e.danger?`text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-400/10`:`text-white hover:bg-bambu-dark-tertiary`} ${n&&u===t?`bg-bambu-dark-tertiary`:``}`,children:[e.icon&&(0,c.jsx)(`span`,{className:`w-4 h-4 flex-shrink-0 flex items-center justify-center`,children:e.icon}),(0,c.jsx)(`span`,{className:`flex-1`,children:e.label}),n&&(0,c.jsx)(a,{className:`w-4 h-4 text-bambu-gray`})]}),n&&u===t&&(0,c.jsx)(l,{items:e.submenu,searchPlaceholder:e.submenuSearchPlaceholder,onClose:r,className:`absolute min-w-[200px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 overflow-hidden max-h-[300px] overflow-y-auto z-[60] ${h?`right-full mr-1`:`left-full ml-1`} ${_[t]===`bottom`?`bottom-0`:`top-0`}`,onMouseEnter:()=>{f.current&&=(clearTimeout(f.current),null)},onMouseLeave:()=>b()})]},t)})})}export{o as n,u as t}; \ No newline at end of file diff --git a/static/assets/CopyButton-C5In5weo.js b/static/assets/CopyButton-C5In5weo.js new file mode 100644 index 000000000..19c624646 --- /dev/null +++ b/static/assets/CopyButton-C5In5weo.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,w as r}from"./client-DnySrlFv.js";import{t as i}from"./createLucideIcon-DvBYJlWL.js";import{t as a}from"./check-Ck0cMLU4.js";import{t as o}from"./copy-Cu_0GKCU.js";var s=i(`monitor-play`,[[`path`,{d:`M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z`,key:`vbtd3f`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`,key:`x3v2xh`}]]),c=i(`scan-eye`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`path`,{d:`M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0`,key:`11ak4c`}]]),l=[120,220,260],u=[55,75,90],d=[35,45,60],f=[50,75,100],p=[{key:`nozzle_temp_presets`,defaults:l,lo:0,hi:320,unit:`C`},{key:`bed_temp_presets`,defaults:u,lo:0,hi:140,unit:`C`},{key:`chamber_temp_presets`,defaults:d,lo:0,hi:65,unit:`C`},{key:`fan_speed_presets`,defaults:f,lo:0,hi:100,unit:`%`}];function m(e,t,n,r){if(!e)return[...t];try{let t=JSON.parse(e);if(Array.isArray(t)&&t.length===3&&t.every(e=>Number.isInteger(e)&&e>=n&&e<=r))return t}catch{}return[...t]}function h(e,t){return[{label:`Off`,value:0},...e.map(e=>({label:`${e} ${t}`,value:e}))]}var g=e(n(),1),_=t();function v({value:e,titleKey:t=`printers.copyToClipboard`,copiedTitleKey:n=`printers.copied`,className:i=`ml-2 p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors`,iconClassName:s=`w-3.5 h-3.5`}){let{t:c}=r(),[l,u]=(0,g.useState)(!1);return(0,_.jsx)(`button`,{onClick:async()=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t);try{if(t.select(),!document.execCommand(`copy`))return}finally{document.body.removeChild(t)}}u(!0),setTimeout(()=>u(!1),2e3)}catch{}},className:i,title:c(l?n:t),children:l?(0,_.jsx)(a,{className:`${s} text-bambu-green`}):(0,_.jsx)(o,{className:s})})}export{l as a,m as c,f as i,c as l,u as n,p as o,d as r,h as s,v as t,s as u}; \ No newline at end of file diff --git a/static/assets/ErrorBarContext-CcijMMkA.js b/static/assets/ErrorBarContext-CcijMMkA.js new file mode 100644 index 000000000..4765daf33 --- /dev/null +++ b/static/assets/ErrorBarContext-CcijMMkA.js @@ -0,0 +1 @@ +import{i as e,t}from"./chunk-aKtaBQYM.js";import{D as n}from"./client-DnySrlFv.js";import{Bt as r,Ft as i,It as a,Ln as o,Lt as s,Mn as c,Mt as l,Pn as u,Sn as d,bn as f,kn as p,vn as m,zt as h}from"./CartesianChart-BAcHzPFb.js";var g=t((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){if(typeof e!=`object`||!e)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!==`[object Object]`){let t=e[Symbol.toStringTag];return t==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${t}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}e.isPlainObject=t})),_=e(t(((e,t)=>{t.exports=g().isPlainObject}))()),v=e(n()),y,b,x,S,C;function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t{var a=n-r,o=p(y||=A([`M `,`,`,``]),e,t);return o+=p(b||=A([`L `,`,`,``]),e+n,t),o+=p(x||=A([`L `,`,`,``]),e+n-a/2,t+i),o+=p(S||=A([`L `,`,`,``]),e+n-a/2-r,t+i),o+=p(C||=A([`L `,`,`,` Z`]),e,t),o},M={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},N=e=>{var t=m(e,M),{x:n,y:r,upperWidth:i,lowerWidth:c,height:l,className:f}=t,{animationEasing:p,animationDuration:g,animationBegin:_,isUpdateAnimationActive:y}=t,b=(0,v.useRef)(null),[x,S]=(0,v.useState)(-1),C=(0,v.useRef)(i),w=(0,v.useRef)(c),E=(0,v.useRef)(l),D=(0,v.useRef)(n),O=(0,v.useRef)(r),A=a(e,`trapezoid-`);if((0,v.useEffect)(()=>{if(b.current&&b.current.getTotalLength)try{var e=b.current.getTotalLength();e&&S(e)}catch{}},[]),n!==+n||r!==+r||i!==+i||c!==+c||l!==+l||i===0&&c===0||l===0)return null;var N=o(`recharts-trapezoid`,f);if(!y)return v.createElement(`g`,null,v.createElement(`path`,k({},u(t),{className:N,d:j(n,r,i,c,l)})));var P=C.current,F=w.current,I=E.current,L=D.current,R=O.current,z=`0px ${x===-1?1:x}px`,B=`${x}px 0px`,V=h([`strokeDasharray`],g,p);return v.createElement(s,{animationId:A,key:A,canBegin:x>0,duration:g,easing:p,isActive:y,begin:_},e=>{var a=d(P,i,e),o=d(F,c,e),s=d(I,l,e),f=d(L,n,e),p=d(R,r,e);b.current&&(C.current=a,w.current=o,E.current=s,D.current=f,O.current=p);var m=e>0?{transition:V,strokeDasharray:B}:{strokeDasharray:z};return v.createElement(`path`,k({},u(t),{className:N,d:j(f,p,a,o,s),ref:b,style:T(T({},m),t.style)}))})},P=[`option`,`shapeType`,`activeClassName`];function F(e,t){if(e==null)return{};var n,r,i=I(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Z(e){var{children:t}=e,n=J(e,q);return v.createElement(X.Provider,{value:n},t)}export{K as n,Z as t}; \ No newline at end of file diff --git a/static/assets/ExternalLinkPage-B6dDCCBN.js b/static/assets/ExternalLinkPage-B6dDCCBN.js new file mode 100644 index 000000000..8bed85be5 --- /dev/null +++ b/static/assets/ExternalLinkPage-B6dDCCBN.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{t as a}from"./useQuery-BBCjCezC.js";import{t as o}from"./loader-circle-BEmFtawu.js";import{t as s}from"./triangle-alert-Dt_1FcBy.js";import{Un as c,Vn as l,vt as u}from"./index-CovRLYqQ.js";var d=e(n(),1),f=t();function p(){let{t:e}=i(),{id:t}=c(),{mode:n}=u(),l=(0,d.useRef)(null),p=m(l);g(l);let{data:h,isLoading:_,error:v}=a({queryKey:[`external-link`,t],queryFn:()=>r.getExternalLink(Number(t)),enabled:!!t});return _?(0,f.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,f.jsx)(o,{className:`w-8 h-8 text-bambu-green animate-spin`})}):v||!h?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 text-bambu-gray`,children:[(0,f.jsx)(s,{className:`w-12 h-12`}),(0,f.jsx)(`p`,{children:e(`common.linkNotFound`)})]}):(0,f.jsx)(`iframe`,{ref:l,src:h.url,onLoad:p,className:`h-full w-full border-0`,style:{colorScheme:n},title:h.name,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`})}function m(e){let{resolvedMode:t,darkStyle:n,darkBackground:r,darkAccent:i,lightStyle:a,lightBackground:o,lightAccent:s}=u(),c=t===`dark`,l=c?n:a,f=c?r:o,p=c?i:s,m=(0,d.useCallback)(()=>{let n=e.current;if(!n?.contentWindow)return;let r;try{r=new URL(n.src).origin}catch{return}n.contentWindow.postMessage({type:`bambuddy:theme`,mode:t,style:l,background:f,accent:p,canNavigate:!0},r)},[e,t,l,f,p]);return(0,d.useEffect)(()=>m(),[m]),(0,d.useEffect)(()=>{let t=t=>{t.source===e.current?.contentWindow&&t.data?.type===`bambuddy:theme-request`&&m()};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[e,m]),m}var h=512;function g(e){let t=l();(0,d.useEffect)(()=>{let n=n=>{let r=e.current;if(!r?.contentWindow||n.source!==r.contentWindow||n.data?.type!==`bambuddy:navigate`)return;let i;try{i=new URL(r.src).origin}catch{return}if(n.origin!==i)return;let a=_(n.data.path);a!==null&&t(a)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)},[e,t])}function _(e){if(typeof e!=`string`||e.length>h||!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`))return null;let t;try{t=new URL(e,window.location.origin)}catch{return null}return t.origin===window.location.origin?t.pathname+t.search+t.hash:null}export{p as ExternalLinkPage}; \ No newline at end of file diff --git a/static/assets/FileManagerPage-CSExcpmf.js b/static/assets/FileManagerPage-CSExcpmf.js new file mode 100644 index 000000000..77fa36e7d --- /dev/null +++ b/static/assets/FileManagerPage-CSExcpmf.js @@ -0,0 +1,15 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreviewModal-4n0YPMFt.js","assets/chunk-aKtaBQYM.js","assets/index-CovRLYqQ.js","assets/QueryClientProvider-Ce8_sN3w.js","assets/client-DnySrlFv.js","assets/useMutation-B-Tr2hIP.js","assets/useQueries-Be6PMvSC.js","assets/useQuery-BBCjCezC.js","assets/createLucideIcon-DvBYJlWL.js","assets/arrow-down-Cj0DZhNf.js","assets/arrow-up-D-pfJ3WZ.js","assets/calendar-BLKPnWqV.js","assets/check-Ck0cMLU4.js","assets/info-ROUoQhJR.js","assets/ToastContext-BRX0SW3C.js","assets/loader-circle-BEmFtawu.js","assets/x-DR-Trv6U.js","assets/file-DDkFXH-b.js","assets/triangle-alert-Dt_1FcBy.js","assets/react-dom-B8Dg6xzp.js","assets/Button-DDr6eAFy.js","assets/Card-Bzc64K35.js","assets/filamentSwatchHelpers-D3oXQSGk.js","assets/date-G9KUauqz.js","assets/index-LBjsy7mY.css","assets/zoom-out-DNNe6DMN.js","assets/usePreviewFullscreen-ButueZqN.js","assets/maximize-2-kPQ77q72.js","assets/minimize-2-dqT-k7oI.js","assets/SpreadsheetPreviewModal-CqoREJBx.js","assets/file-spreadsheet-WxOA9vYy.js","assets/ImagePreviewModal-CV42BcLH.js"])))=>i.map(i=>d[i]); +import{i as e,n as t,t as n}from"./chunk-aKtaBQYM.js";import{C as r,D as i,a,w as o,x as s}from"./client-DnySrlFv.js";import{n as c}from"./QueryClientProvider-Ce8_sN3w.js";import{t as l}from"./useQuery-BBCjCezC.js";import{t as u}from"./useMutation-B-Tr2hIP.js";import{t as d}from"./useQueries-Be6PMvSC.js";import{t as f}from"./createLucideIcon-DvBYJlWL.js";import{t as p}from"./box-DAdKb9s5.js";import{t as m}from"./briefcase-Dau7xqMY.js";import{t as h}from"./check-Ck0cMLU4.js";import{a as g,t as _}from"./info-ROUoQhJR.js";import{n as v}from"./ToastContext-BRX0SW3C.js";import{t as y}from"./cog-Dol1I0kq.js";import{t as b}from"./columns-2-DVEObeDC.js";import{t as x}from"./ellipsis-vertical-t2D7cYyp.js";import{t as S}from"./file-box-04V4jZ9_.js";import{t as C}from"./file-spreadsheet-WxOA9vYy.js";import{n as w,t as T}from"./ContextMenu-Bt5_A0ZU.js";import{t as E}from"./funnel-C3dyAMK9.js";import{t as D}from"./SliceModal-2Iz_Qz3v.js";import{t as O}from"./hard-drive-CgXAHN37.js";import{t as k}from"./layout-grid-DkD3u6wa.js";import{t as A}from"./link-2-MI-QCMh8.js";import{t as ee}from"./list-CLcpeoSz.js";import{t as j}from"./loader-circle-BEmFtawu.js";import{t as M}from"./lock-MLqgWH4Q.js";import{t as te}from"./play-DIDYtk2S.js";import{t as N}from"./search-0n0CBc74.js";import{t as ne}from"./sticky-note-BH0LPqRx.js";import{t as re}from"./triangle-alert-Dt_1FcBy.js";import{t as ie}from"./unlink-C098nwOf.js";import{t as ae}from"./x-DR-Trv6U.js";import{t as oe}from"./file-DDkFXH-b.js";import{t as P}from"./Button-DDr6eAFy.js";import{n as se,o as ce,v as le}from"./date-G9KUauqz.js";import{$t as ue,At as de,Cn as fe,Dt as pe,F,Jt as me,Kn as I,Kt as L,Ln as he,Lt as ge,Mn as _e,On as ve,Ot as ye,Pn as be,Pt as xe,Rn as Se,Rt as Ce,Sn as we,Ut as Te,Vn as Ee,Wn as De,Zt as Oe,_t as ke,b as Ae,cn as je,hn as Me,kt as Ne,sn as Pe,un as Fe,vn as Ie,wn as Le,xn as Re,yt as ze}from"./index-CovRLYqQ.js";import{n as Be,t as Ve}from"./usePreviewFullscreen-ButueZqN.js";import{n as He,r as Ue,t as We}from"./PhotoGalleryModal-CHRwUNN5.js";import{a as Ge,o as Ke,r as qe,t as Je}from"./slicer-DgCA7cW6.js";import{n as Ye,t as Xe}from"./FileUploadModal-AIFgu8X7.js";import{n as Ze,t as Qe}from"./libraryFiles-B0B1SFfn.js";var $e=f(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),et=f(`arrow-up-narrow-wide`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}],[`path`,{d:`M11 16h7`,key:`uosisv`}],[`path`,{d:`M11 20h10`,key:`jvxblo`}]]),tt=f(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),nt=f(`combine`,[[`path`,{d:`M14 3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`1l7d7l`}],[`path`,{d:`M19 3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`9955pe`}],[`path`,{d:`m7 15 3 3`,key:`4hkfgk`}],[`path`,{d:`m7 21 3-3H5a2 2 0 0 1-2-2v-2`,key:`1xljwe`}],[`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1cdgtw`}],[`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`,key:`zi3rio`}]]),rt=f(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),it=f(`folder-symlink`,[[`path`,{d:`M2 9.35V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7`,key:`y8kt7d`}],[`path`,{d:`m8 16 3-3-3-3`,key:`rlqrt1`}]]),at=f(`move-right`,[[`path`,{d:`M18 8L22 12L18 16`,key:`1r0oui`}],[`path`,{d:`M2 12H22`,key:`1m8cig`}]]),ot=f(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),st=f(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),R=e(i(),1),z=r();function ct({icon:e,label:t,dropdownLabel:n,onPrimary:r,items:i}){let[a,o]=(0,R.useState)(!1),s=(0,R.useRef)(null);return(0,R.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),o(!1))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[a]),i.length===0?(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:r,children:[e,t]}):(0,z.jsxs)(`div`,{className:`relative inline-flex`,ref:s,children:[(0,z.jsxs)(`div`,{className:`flex relative z-50`,children:[(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:()=>{o(!1),r()},className:`rounded-r-none`,children:[e,t]}),(0,z.jsx)(P,{variant:`secondary`,size:`sm`,onClick:()=>o(e=>!e),"aria-label":n,"aria-haspopup":`menu`,"aria-expanded":a,className:`rounded-l-none border-l border-bambu-dark px-2`,children:(0,z.jsx)(g,{className:`w-4 h-4 transition-transform ${a?`rotate-180`:``}`})})]}),a&&(0,z.jsx)(`div`,{role:`menu`,className:`absolute right-0 top-full mt-1 w-56 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg z-50 py-1`,children:i.map(e=>(0,z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{o(!1),e.onClick()},className:`w-full text-left px-3 py-2 text-sm text-bambu-gray-light hover:bg-bambu-dark-tertiary hover:text-white transition-colors flex items-center gap-2`,children:[(0,z.jsx)(fe,{className:`w-4 h-4 flex-shrink-0`}),e.label]},e.key))})]})}function lt({archiveId:e,libraryFileId:t,title:n,fileType:r,onClose:i,onSliceWithBambuddy:c,onSnapshot:u}){let{t:d}=o(),{showToast:f}=v(),{data:m}=l({queryKey:[`settings`],queryFn:a.getSettings}),g=Ke(m?.open_in_slicer,m?.preferred_slicer),_=t!=null,[b,x]=(0,R.useState)(null),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(!0),[E,D]=(0,R.useState)(null),[O,k]=(0,R.useState)(!1),[A,ee]=(0,R.useState)(null),[M,te]=(0,R.useState)(0),[N,ne]=(0,R.useState)(null),[re,ie]=(0,R.useState)(!1),[ae,oe]=(0,R.useState)(!1),se=(0,R.useRef)(null),ce=(0,R.useRef)(null),le=Ve(),{isFullscreen:ue,toggleFullscreen:de}=le,pe=.35;(0,R.useEffect)(()=>{if(T(!0),_){let e=(r||``).toLowerCase(),t=e===`3mf`||e===`gcode.3mf`||e===`stl`||e===`step`||e===`stp`;C({has_model:t,has_source:!1,build_volume:{x:256,y:256,z:256},filament_colors:[]}),x(t?`3d`:null),T(!1);return}if(!e){C(null),x(null),T(!1);return}a.getArchiveCapabilities(e).then(e=>{C(e),e.has_model&&x(`3d`),T(!1)}).catch(()=>{C({has_model:!0,has_source:!1,build_volume:{x:256,y:256,z:256},filament_colors:[]}),x(`3d`),T(!1)})},[e,r,_]),(0,R.useEffect)(()=>{if(k(!0),ee(null),te(0),_){let e=(r||``).toLowerCase();if(!t||!(e===`3mf`||e===`gcode.3mf`)){D(null),k(!1);return}a.getLibraryFilePlates(t).then(e=>D(e)).catch(()=>D(null)).finally(()=>k(!1));return}if(!e){D(null),k(!1);return}a.getArchivePlates(e).then(e=>D(e)).catch(()=>D(null)).finally(()=>k(!1))},[e,r,_,t]);let F=(0,R.useMemo)(()=>E?.plates??[],[E]),me=(E?.is_multi_plate??!1)&&F.length>1,I=ue&&me,L=A==null?null:F.find(e=>e.index===A)??null,he=e=>e.object_count??e.objects?.length??0,ge=F.reduce((e,t)=>e+he(t),0),_e=L?he(L):ge,ve=L?d(`modelViewer.plateNumber`,{number:L.index}):d(`modelViewer.allPlates`),ye=F.length>0,be=(0,R.useRef)(null),xe=(0,R.useRef)(null),[Se,Ce]=(0,R.useState)(10),[we,Te]=(0,R.useState)(3),Ee=F.length>Se,De=Math.max(1,Math.ceil(F.length/Se)),Oe=Ee?F.slice(M*Se,(M+1)*Se):F;(0,R.useEffect)(()=>{if(!I){Ce(10),Te(3);return}let e=be.current,t=xe.current;if(!e||!t)return;let n=0,r=()=>{let n=t.clientWidth,r=Math.floor(n/210),i=Math.max(3,Math.min(5,r||3));Te(e=>e===i?e:i);let a=window.getComputedStyle(e),o=Number.parseFloat(a.rowGap||`0`),s=e.querySelector(`button`)?.getBoundingClientRect().height??44,c=t.clientHeight,l=Math.max(1,Math.floor((c+o)/(s+o)))*i,u=Math.max(1,l-1);Ce(e=>e===u?e:u)},i=()=>{n&&cancelAnimationFrame(n),n=requestAnimationFrame(r)};i();let a=new ResizeObserver(i);return a.observe(t),a.observe(e),()=>{n&&cancelAnimationFrame(n),a.disconnect()}},[I,F.length]),(0,R.useEffect)(()=>{if(!Ee){te(0);return}te(e=>Math.min(e,De-1))},[F.length,Ee,De]),(0,R.useEffect)(()=>{if(!Ee||A==null)return;let e=F.findIndex(e=>e.index===A);if(e<0)return;let t=Math.floor(e/Se);te(e=>e===t?e:t)},[F,Se,A,Ee]),(0,R.useEffect)(()=>{if(!I){ne(null),oe(!1);return}if(ae)return;let e=se.current,t=ce.current;if(!e||!t)return;let n=e.clientHeight;if(!n)return;let r=Math.max(240,n*pe),i=Math.max(160,n-10-r),a=Math.min(t.scrollHeight,i);ne(Math.max(160,a))},[I,ae,F.length,M,10,160,240,pe]),(0,R.useEffect)(()=>{if(!re)return;let e=e=>{let t=se.current;if(!t)return;let n=t.getBoundingClientRect(),r=n.height;if(!r)return;let i=Math.max(240,r*pe),a=Math.max(160,r-10-i);ne(Math.min(a,Math.max(160,e.clientY-n.top)))},t=()=>{ie(!1),oe(!0)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`,()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t),document.body.style.cursor=``,document.body.style.userSelect=``}},[re,10,160,240,pe]);let ke=g===`orcaslicer`?[`orcaslicer`,`bambu_studio`]:[`bambu_studio`,`orcaslicer`],Ae=_?ke.filter(e=>qe(r,e)):ke,Me=Ae.length>0,Ne=Je(r),Pe=!!(_&&m?.use_slicer_api&&c&&Ne),Fe=async r=>{if(!Me)return;let i=n||`model`;try{if(_){let{token:e}=await a.createLibrarySlicerToken(t),n=a.getLibrarySlicerDownloadUrl(t,e,i);Ge(`${window.location.origin}${n}`,r)}else{let{token:t}=await a.createArchiveSlicerToken(e),n=a.getArchiveSlicerDownloadUrl(e,t,i);Ge(`${window.location.origin}${n}`,r)}}catch{f(d(`modelViewer.openInSlicerFailed`),`error`),Ge(_?`${window.location.origin}${a.getLibraryFileDownloadUrl(t)}`:`${window.location.origin}${a.getArchiveForSlicer(e,i)}`,r)}},Ie=Pe?Ae:Ae.slice(1),Le=e=>d(e===`orcaslicer`?`settings.slicerOrcaSlicer`:`settings.slicerBambuStudio`),Re=Ie.map(e=>({key:e,label:d(`modelViewer.openInSlicerWith`,{slicer:Le(e)}),onClick:()=>Fe(e)}));return(0,z.jsxs)(Be,{title:n,fullscreen:le,onClose:i,closeOnBackdropClick:!0,titleExtra:ye?(0,z.jsxs)(`span`,{className:`text-xs text-bambu-gray bg-bambu-dark-tertiary/70 px-2 py-1 rounded whitespace-nowrap`,children:[ve,`: `,d(`modelViewer.objectCount`,{count:_e})]}):void 0,actions:(0,z.jsx)(z.Fragment,{children:Pe?(0,z.jsx)(ct,{icon:(0,z.jsx)(y,{className:`w-4 h-4`}),label:d(`slice.action`),dropdownLabel:d(`modelViewer.moreSlicerOptions`),onPrimary:()=>c?.(),items:Re}):Me?(0,z.jsx)(ct,{icon:(0,z.jsx)(fe,{className:`w-4 h-4`}),label:Ae[0]===g?d(`modelViewer.openInSlicer`):d(`modelViewer.openInSlicerWith`,{slicer:Le(Ae[0])}),dropdownLabel:d(`modelViewer.moreSlicerOptions`),onPrimary:()=>Fe(Ae[0]),items:Re}):(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,disabled:!0,children:[(0,z.jsx)(fe,{className:`w-4 h-4`}),d(`modelViewer.openInSlicer`)]})}),children:[S&&(0,z.jsx)(`div`,{className:`flex border-b border-bambu-dark-tertiary`,children:(0,z.jsxs)(`button`,{onClick:()=>S.has_model&&x(`3d`),disabled:!S.has_model,className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors ${b===`3d`?`text-bambu-green border-b-2 border-bambu-green`:S.has_model?`text-bambu-gray hover:text-white`:`text-bambu-gray/30 cursor-not-allowed`}`,children:[(0,z.jsx)(p,{className:`w-4 h-4`}),d(`modelViewer.tabs.model`),!S.has_model&&(0,z.jsxs)(`span`,{className:`text-xs`,children:[`(`,d(`modelViewer.notAvailable`),`)`]})]})}),(0,z.jsx)(`div`,{className:`flex-1 overflow-hidden p-4`,children:w?(0,z.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,z.jsx)(j,{className:`w-8 h-8 animate-spin text-bambu-green`})}):b===`3d`&&S?(0,z.jsxs)(`div`,{ref:se,className:`w-full h-full flex flex-col ${I?`gap-0 min-h-0`:`gap-3`}`,children:[me&&(0,z.jsxs)(`div`,{ref:ce,style:I&&N!=null?{height:N}:void 0,className:`rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-3 ${I?`flex flex-col shrink-0`:``}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray mb-2`,children:[(0,z.jsx)(je,{className:`w-4 h-4`}),d(`modelViewer.plates`),O&&(0,z.jsx)(j,{className:`w-3 h-3 animate-spin`})]}),(0,z.jsxs)(`div`,{className:I?`flex flex-col min-h-0 flex-1`:void 0,children:[(0,z.jsx)(`div`,{ref:xe,className:I?`min-h-0 overflow-hidden pr-1 flex-1`:void 0,children:(0,z.jsxs)(`div`,{ref:be,className:I?`grid gap-2`:`grid grid-cols-2 md:grid-cols-3 gap-2`,style:I?{gridTemplateColumns:`repeat(${we}, minmax(0, 1fr))`}:void 0,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>ee(null),className:`flex items-center rounded-lg border text-left transition-colors ${I?`gap-1.5 p-1.5 w-full`:`gap-2 p-2`} ${A==null?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark-secondary hover:border-bambu-gray`}`,children:[(0,z.jsx)(`div`,{className:`rounded bg-bambu-dark-tertiary flex items-center justify-center ${I?`w-8 h-8`:`w-10 h-10`}`,children:(0,z.jsx)(je,{className:`${I?`w-4 h-4`:`w-5 h-5`} text-bambu-gray`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`p`,{className:`${I?`text-xs`:`text-sm`} text-white font-medium truncate`,children:d(`modelViewer.allPlates`)}),(0,z.jsx)(`p`,{className:`${I?`text-[10px]`:`text-xs`} text-bambu-gray truncate`,children:d(`modelViewer.plateCount`,{count:F.length})})]}),A==null&&(0,z.jsx)(h,{className:`${I?`w-3.5 h-3.5`:`w-4 h-4`} text-bambu-green flex-shrink-0`})]}),Oe.map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>ee(e.index),className:`flex items-center rounded-lg border text-left transition-colors ${I?`gap-1.5 p-1.5 w-full`:`gap-2 p-2`} ${A===e.index?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark-secondary hover:border-bambu-gray`}`,children:[e.has_thumbnail&&e.thumbnail_url?(0,z.jsx)(`img`,{src:s(e.thumbnail_url),alt:`Plate ${e.index}`,className:`${I?`w-8 h-8`:`w-10 h-10`} rounded object-cover bg-bambu-dark-tertiary`}):(0,z.jsx)(`div`,{className:`rounded bg-bambu-dark-tertiary flex items-center justify-center ${I?`w-8 h-8`:`w-10 h-10`}`,children:(0,z.jsx)(je,{className:`${I?`w-4 h-4`:`w-5 h-5`} text-bambu-gray`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`p`,{className:`${I?`text-xs`:`text-sm`} text-white font-medium truncate`,children:e.name||d(`modelViewer.plateNumber`,{number:e.index})}),(0,z.jsx)(`p`,{className:`${I?`text-[10px]`:`text-xs`} text-bambu-gray truncate`,children:d(`modelViewer.objectCount`,{count:e.object_count??e.objects?.length??0})})]}),A===e.index&&(0,z.jsx)(h,{className:`${I?`w-3.5 h-3.5`:`w-4 h-4`} text-bambu-green flex-shrink-0`})]},e.index))]})}),(L||Ee)&&(0,z.jsxs)(`div`,{className:`mt-auto pt-3 flex items-center gap-4 text-xs text-bambu-gray overflow-x-auto`,children:[L&&(0,z.jsxs)(`div`,{className:`flex items-center gap-3 whitespace-nowrap`,children:[(0,z.jsx)(`span`,{children:d(`modelViewer.plateNumber`,{number:L.index})}),L.print_time_seconds!=null&&(0,z.jsx)(`span`,{children:d(`modelViewer.eta`,{minutes:Math.round(L.print_time_seconds/60)})}),L.filament_used_grams!=null&&(0,z.jsxs)(`span`,{children:[L.filament_used_grams.toFixed(1),` g`]}),L.filaments.length>0&&(0,z.jsx)(`span`,{children:d(`modelViewer.filamentCount`,{count:L.filaments.length})})]}),Ee&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 whitespace-nowrap ${L?`ml-auto`:``}`,children:[(0,z.jsx)(`span`,{children:d(`modelViewer.pagination.pageOf`,{current:M+1,total:De})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>te(e=>Math.max(e-1,0)),disabled:M===0,className:`px-2 py-1 rounded border text-xs ${M===0?`border-bambu-dark-tertiary text-bambu-gray/40 cursor-not-allowed`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray`}`,children:d(`modelViewer.pagination.prev`)}),(()=>{let e=Math.max(0,M-2),t=Math.min(De,e+5);t-e<5&&(e=Math.max(0,t-5));let n=Array.from({length:t-e},(t,n)=>e+n);return(0,z.jsxs)(z.Fragment,{children:[e>0&&(0,z.jsx)(`button`,{type:`button`,onClick:()=>te(0),className:`px-2 py-1 rounded border text-xs ${M===0?`border-bambu-green text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray`}`,children:`1`}),e>1&&(0,z.jsx)(`span`,{className:`px-1`,children:`…`}),n.map(e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>te(e),className:`px-2 py-1 rounded border text-xs ${M===e?`border-bambu-green text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray`}`,children:e+1},e)),tte(De-1),className:`px-2 py-1 rounded border text-xs ${M===De-1?`border-bambu-green text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray`}`,children:De})]})})(),(0,z.jsx)(`button`,{type:`button`,onClick:()=>te(e=>Math.min(e+1,De-1)),disabled:M>=De-1,className:`px-2 py-1 rounded border text-xs ${M>=De-1?`border-bambu-dark-tertiary text-bambu-gray/40 cursor-not-allowed`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray`}`,children:d(`modelViewer.pagination.next`)})]})]})]})]})]}),I&&(0,z.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,onMouseDown:e=>{e.preventDefault(),ie(!0),oe(!0)},className:`h-2 cursor-row-resize flex items-center justify-center ${re?`bg-bambu-dark-tertiary`:`bg-bambu-dark-secondary/60 hover:bg-bambu-dark-tertiary`}`,children:(0,z.jsx)(`div`,{className:`w-12 h-1 rounded-full bg-bambu-gray/50`})}),(0,z.jsx)(`div`,{className:`flex-1 ${I?`min-h-0`:``}`,"data-testid":`model-viewer-area`,onDoubleClick:de,children:(0,z.jsx)(Ye,{url:_?a.getLibraryFileDownloadUrl(t):S.has_source?a.getSource3mfDownloadUrl(e):a.getArchiveDownload(e),fileType:r,buildVolume:S.build_volume,filamentColors:S.filament_colors,selectedPlateId:A,className:`w-full h-full`,onSnapshot:u})})]}):(0,z.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-bambu-gray`,children:d(`modelViewer.noPreview`)})})]})}var ut=100;function dt(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(0,t):e}function ft({files:e,folderId:t,canSlice:n,onClose:r,onCombined:i}){let{t:s}=o(),l=c(),{showToast:d}=v(),[f,p]=(0,R.useState)(()=>Object.fromEntries(e.map(e=>[e.id,1]))),[m,h]=(0,R.useState)(null),[g,_]=(0,R.useState)(n),y=e.reduce((e,t)=>e+(f[t.id]||0),0),b=(0,R.useMemo)(()=>e.length===1?`${dt(e[0].filename)} x${f[e[0].id]||1}`:s(`fileManager.combine.defaultName`,{name:dt(e[0]?.filename??``),count:e.length-1}),[e,f,s]),x=(m??b).trim(),S=u({mutationFn:()=>a.combineLibraryFiles(e.map(e=>({file_id:e.id,copies:f[e.id]||1})),x,t),onSuccess:e=>{l.invalidateQueries({queryKey:[`library-files`]}),l.invalidateQueries({queryKey:[`library-stats`]}),d(s(`fileManager.combine.done`,{filename:e.filename,count:y}),`success`),i(e,g&&n)},onError:e=>d(e.message,`error`)});(0,R.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!S.isPending&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r,S.isPending]);let C=y>ut,w=e.some(e=>!f[e.id]||f[e.id]<1),T=`combine-files-title`;return(0,z.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center`,children:[(0,z.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:()=>!S.isPending&&r()}),(0,z.jsxs)(`div`,{className:`relative w-full max-w-md mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":T,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-5 py-4 border-b border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`h3`,{id:T,className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,z.jsx)(nt,{className:`w-4 h-4 text-bambu-green`}),s(`fileManager.combine.title`)]}),(0,z.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-white rounded`,onClick:r,"aria-label":s(`common.close`),children:(0,z.jsx)(ae,{className:`w-5 h-5`})})]}),(0,z.jsx)(`p`,{className:`px-5 pt-3 text-sm text-bambu-gray`,children:s(`fileManager.combine.description`)}),(0,z.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,z.jsx)(`label`,{htmlFor:`combine-name`,className:`block text-xs text-bambu-gray mb-1`,children:s(`fileManager.combine.nameLabel`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`input`,{id:`combine-name`,type:`text`,value:m??b,onChange:e=>h(e.target.value),maxLength:200,className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`}),(0,z.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`.3mf`})]})]}),(0,z.jsxs)(`div`,{className:`overflow-y-auto flex-1 max-h-[20rem] border-y border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`div`,{className:`flex justify-between px-5 py-2 text-xs text-bambu-gray`,children:[(0,z.jsx)(`span`,{children:s(`fileManager.combine.model`)}),(0,z.jsx)(`span`,{children:s(`fileManager.combine.copies`)})]}),(0,z.jsx)(`ul`,{className:`divide-y divide-bambu-dark-tertiary/40`,children:e.map(e=>(0,z.jsxs)(`li`,{className:`flex items-center gap-3 px-5 py-2`,children:[(0,z.jsx)(`span`,{className:`text-sm text-white truncate flex-1`,title:e.filename,children:e.filename}),(0,z.jsx)(`input`,{type:`number`,min:1,max:ut,value:f[e.id]||``,onChange:t=>{let n=parseInt(t.target.value,10);p(t=>({...t,[e.id]:Number.isNaN(n)?0:n}))},"aria-label":s(`fileManager.combine.copiesFor`,{filename:e.filename}),className:`w-20 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white text-right focus:outline-none focus:border-bambu-green`})]},e.id))})]}),(0,z.jsxs)(`div`,{className:`px-5 py-3 space-y-2 text-sm`,children:[(0,z.jsx)(`div`,{className:C?`text-red-400`:`text-bambu-gray`,children:C?s(`fileManager.combine.tooMany`,{max:ut}):s(`fileManager.combine.total`,{count:y})}),n&&(0,z.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`accent-bambu-green`}),(0,z.jsx)(`span`,{className:`text-white`,children:s(`fileManager.combine.sliceNext`)})]})]}),(0,z.jsxs)(`div`,{className:`px-5 py-4 border-t border-bambu-dark-tertiary flex justify-end gap-2`,children:[(0,z.jsx)(P,{type:`button`,variant:`secondary`,onClick:r,disabled:S.isPending,children:s(`common.cancel`)}),(0,z.jsxs)(P,{type:`button`,onClick:()=>S.mutate(),disabled:S.isPending||C||w||!x,children:[S.isPending&&(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}),s(`fileManager.combine.submit`)]})]})]})]})}var pt=[`library-tags`];function mt({open:e,fileIds:t,onClose:n}){let{t:r}=o(),i=c(),{showToast:s}=v(),[d,f]=(0,R.useState)(`add`),[p,m]=(0,R.useState)(new Set),[h,g]=(0,R.useState)(``),[_,y]=(0,R.useState)(``);(0,R.useEffect)(()=>{e||(f(`add`),m(new Set),g(``),y(``))},[e]);let{data:b=[],isLoading:x}=l({queryKey:pt,queryFn:a.getLibraryTags,enabled:e}),S=(0,R.useMemo)(()=>{let e=h.trim().toLowerCase();return e?b.filter(t=>t.name.toLowerCase().includes(e)):b},[b,h]),C=e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},w=u({mutationFn:e=>a.createLibraryTag(e),onSuccess:e=>{m(t=>new Set(t).add(e.id)),y(``),i.invalidateQueries({queryKey:pt})},onError:e=>{s(e.message||r(`fileManager.tags.saveFailed`),`error`)}}),T=u({mutationFn:()=>a.bulkAssignLibraryTags(t,Array.from(p),d),onSuccess:e=>{s(d===`add`?r(`fileManager.tags.applyAddSuccess`,{count:e.associations_added,files:e.files_updated}):r(`fileManager.tags.applyRemoveSuccess`,{count:e.associations_removed,files:e.files_updated}),`success`),i.invalidateQueries({queryKey:[`library-files`]}),i.invalidateQueries({queryKey:pt}),n()},onError:e=>{s(e.message||r(`fileManager.tags.applyFailed`),`error`)}});if((0,R.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!T.isPending&&!w.isPending&&n()};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,n,T.isPending,w.isPending]),!e)return null;let E=!_.trim()||w.isPending||b.some(e=>e.name.toLowerCase()===_.trim().toLowerCase()),D=`bulk-tags-picker-title`;return(0,z.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center`,children:[(0,z.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:()=>!T.isPending&&n()}),(0,z.jsxs)(`div`,{className:`relative w-full max-w-md mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":D,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-5 py-4 border-b border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`h3`,{id:D,className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,z.jsx)(xe,{className:`w-4 h-4 text-bambu-green`}),r(`fileManager.tags.bulkTitle`,{count:t.length})]}),(0,z.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-white rounded`,onClick:n,"aria-label":r(`common.close`),children:(0,z.jsx)(ae,{className:`w-5 h-5`})})]}),(0,z.jsxs)(`div`,{className:`px-5 py-3 border-b border-bambu-dark-tertiary flex gap-4 text-sm`,children:[(0,z.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,z.jsx)(`input`,{type:`radio`,name:`bulk-action`,checked:d===`add`,onChange:()=>f(`add`),className:`accent-bambu-green`}),(0,z.jsx)(`span`,{className:`text-white`,children:r(`fileManager.tags.actionAdd`)})]}),(0,z.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,z.jsx)(`input`,{type:`radio`,name:`bulk-action`,checked:d===`remove`,onChange:()=>f(`remove`),className:`accent-bambu-green`}),(0,z.jsx)(`span`,{className:`text-white`,children:r(`fileManager.tags.actionRemove`)})]})]}),(0,z.jsx)(`div`,{className:`px-5 py-3 border-b border-bambu-dark-tertiary`,children:(0,z.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:r(`fileManager.tags.searchPlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`})}),(0,z.jsx)(`div`,{className:`overflow-y-auto flex-1 min-h-[8rem] max-h-[24rem]`,children:x?(0,z.jsxs)(`div`,{className:`flex items-center justify-center py-12 text-bambu-gray`,children:[(0,z.jsx)(j,{className:`w-5 h-5 animate-spin mr-2`}),r(`common.loading`)]}):S.length===0?(0,z.jsx)(`div`,{className:`py-12 text-center text-bambu-gray text-sm`,children:b.length===0?r(`fileManager.tags.empty`):r(`fileManager.tags.noMatches`)}):(0,z.jsx)(`ul`,{className:`divide-y divide-bambu-dark-tertiary/40`,children:S.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`label`,{className:`flex items-center gap-3 px-5 py-2 hover:bg-bambu-dark-tertiary/30 cursor-pointer`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:p.has(e.id),onChange:()=>C(e.id),className:`accent-bambu-green`}),(0,z.jsx)(`span`,{className:`text-sm text-white truncate flex-1`,children:e.name}),(0,z.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.file_count})]})},e.id))})}),d===`add`&&(0,z.jsxs)(`div`,{className:`px-5 py-3 border-t border-bambu-dark-tertiary flex gap-2`,children:[(0,z.jsx)(`input`,{type:`text`,value:_,onChange:e=>y(e.target.value),placeholder:r(`fileManager.tags.createPlaceholder`),maxLength:64,className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,onKeyDown:e=>{e.key===`Enter`&&!E&&(e.preventDefault(),w.mutate(_.trim()))}}),(0,z.jsxs)(P,{type:`button`,variant:`secondary`,onClick:()=>w.mutate(_.trim()),disabled:E,children:[w.isPending?(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}):(0,z.jsx)(Oe,{className:`w-4 h-4`}),r(`fileManager.tags.createButton`)]})]}),(0,z.jsxs)(`div`,{className:`px-5 py-4 border-t border-bambu-dark-tertiary flex justify-end gap-2`,children:[(0,z.jsx)(P,{type:`button`,variant:`secondary`,onClick:n,disabled:T.isPending,children:r(`common.cancel`)}),(0,z.jsxs)(P,{type:`button`,onClick:()=>T.mutate(),disabled:p.size===0||T.isPending||t.length===0,children:[T.isPending&&(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}),r(d===`add`?`fileManager.tags.applyAdd`:`fileManager.tags.applyRemove`)]})]})]})]})}function ht(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var gt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_t=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vt={};function yt(e,t){return((t||vt).jsx?_t:gt).test(e)}var bt=/[ \t\n\f\r]/g;function xt(e){return typeof e==`object`?e.type===`text`?St(e.value):!1:St(e)}function St(e){return e.replace(bt,``)===``}var Ct=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Ct.prototype.normal={},Ct.prototype.property={},Ct.prototype.space=void 0;function wt(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Ct(n,r,t)}function Tt(e){return e.toLowerCase()}var B=class{constructor(e,t){this.attribute=t,this.property=e}};B.prototype.attribute=``,B.prototype.booleanish=!1,B.prototype.boolean=!1,B.prototype.commaOrSpaceSeparated=!1,B.prototype.commaSeparated=!1,B.prototype.defined=!1,B.prototype.mustUseProperty=!1,B.prototype.number=!1,B.prototype.overloadedBoolean=!1,B.prototype.property=``,B.prototype.spaceSeparated=!1,B.prototype.space=void 0;var Et=t({boolean:()=>V,booleanish:()=>H,commaOrSpaceSeparated:()=>G,commaSeparated:()=>kt,number:()=>U,overloadedBoolean:()=>Ot,spaceSeparated:()=>W}),Dt=0,V=At(),H=At(),Ot=At(),U=At(),W=At(),kt=At(),G=At();function At(){return 2**++Dt}var jt=Object.keys(Et),K=class extends B{constructor(e,t,n,r){let i=-1;if(super(e,t),Mt(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&Gt.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Wt,Jt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Wt.test(e)){let n=e.replace(Ut,qt);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=K}return new i(r,t)}function qt(e){return`-`+e.toLowerCase()}function Jt(e){return e.charAt(1).toUpperCase()}var Yt=wt([Pt,Lt,zt,Bt,Vt],`html`),Xt=wt([Pt,Rt,zt,Bt,Vt],`svg`);function Zt(e){return e.join(` `).trim()}var Qt=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=` +`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),$t=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Qt());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),en=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),tn=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})($t()),r=en();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),nn=an(`end`),rn=an(`start`);function an(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function on(e){let t=rn(e),n=nn(e);if(t&&n)return{start:t,end:n}}function sn(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?ln(e.position):`start`in e||`end`in e?ln(e):`line`in e||`column`in e?cn(e):``}function cn(e){return un(e&&e.line)+`:`+un(e&&e.column)}function ln(e){return cn(e&&e.start)+`-`+cn(e&&e.end)}function un(e){return e&&typeof e==`number`?e:1}var q=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=sn(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};q.prototype.file=``,q.prototype.name=``,q.prototype.reason=``,q.prototype.message=``,q.prototype.stack=``,q.prototype.column=void 0,q.prototype.line=void 0,q.prototype.ancestors=void 0,q.prototype.cause=void 0,q.prototype.fatal=void 0,q.prototype.place=void 0,q.prototype.ruleId=void 0,q.prototype.source=void 0;var dn=e(tn(),1),fn={}.hasOwnProperty,pn=new Map,mn=/[A-Z]/g,hn=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),gn=new Set([`td`,`th`]);function _n(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Dn(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=En(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Xt:Yt,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=vn(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function vn(e,t,n){if(t.type===`element`)return yn(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return bn(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Sn(e,t,n);if(t.type===`mdxjsEsm`)return xn(e,t);if(t.type===`root`)return Cn(e,t,n);if(t.type===`text`)return J(e,t)}function yn(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Xt,e.schema=i),e.ancestors.push(t);let a=Nn(e,t.tagName,!1),o=On(e,t),s=An(e,t);return hn.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!xt(e):!0})),wn(e,o,a,t),Tn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function bn(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Pn(e,t.position)}function xn(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Pn(e,t.position)}function Sn(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Xt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Nn(e,t.name,!0),o=kn(e,t),s=An(e,t);return wn(e,o,a,t),Tn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Cn(e,t,n){let r={};return Tn(r,An(e,t)),e.create(t,e.Fragment,r,n)}function J(e,t){return t.value}function wn(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Tn(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function En(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Dn(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=rn(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function On(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&fn.call(t.properties,i)){let a=jn(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&gn.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function kn(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Pn(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Pn(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function An(e,t){let n=[],r=-1,i=e.passKeys?new Map:pn;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(Y(e,e.length,0,t),e):t}var qn={}.hasOwnProperty;function Jn(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Qn(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var $n=cr(/[A-Za-z]/),er=cr(/[\dA-Za-z]/),tr=cr(/[#-'*+\--9=?A-Z^-~]/);function nr(e){return e!==null&&(e<32||e===127)}var rr=cr(/\d/),ir=cr(/[\dA-Fa-f]/),ar=cr(/[!-/:-@[-`{-~]/);function X(e){return e!==null&&e<-2}function Z(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}var or=cr(/\p{P}|\p{S}/u),sr=cr(/\s/);function cr(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function lr(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function $(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Q(r)?(e.enter(n),s(r)):t(r)}function s(r){return Q(r)&&a++o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function hr(e,t,n){return $(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function gr(e){if(e===null||Z(e)||sr(e))return 1;if(or(e))return 2}function _r(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};xr(d,-c),xr(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Kn(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Kn(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Kn(l,_r(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Kn(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Kn(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Y(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n0&&Q(t)?$(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||X(t)?e.check(Pr,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||X(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Q(t)?$(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Q(t)?$(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||X(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Lr(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Rr={name:`codeIndented`,tokenize:Br},zr={partial:!0,tokenize:Vr};function Br(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):X(t)?e.attempt(zr,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||X(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Vr(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):$(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):X(e)?i(e):n(e)}}var Hr={name:`codeText`,previous:Wr,resolve:Ur,tokenize:Gr};function Ur(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&qr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),qr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function ti(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||nr(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||X(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Z(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):X(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||X(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Q(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function ri(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||X(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function ii(e,t){let n;return r;function r(i){return X(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Q(i)?$(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var ai={name:`definition`,tokenize:si},oi={partial:!0,tokenize:ci};function si(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return ni.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Z(t)?ii(e,l)(t):l(t)}function l(t){return ti(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(oi,d,d)(t)}function d(t){return Q(t)?$(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||X(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function ci(e,t,n){return r;function r(t){return Z(t)?ii(e,i)(t):n(t)}function i(t){return ri(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Q(t)?$(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||X(e)?t(e):n(e)}}var li={name:`hardBreakEscape`,tokenize:ui};function ui(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return X(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var di={name:`headingAtx`,resolve:fi,tokenize:pi};function fi(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Y(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function pi(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Z(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||X(n)?(e.exit(`atxHeading`),t(n)):Q(n)?$(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Z(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var mi=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),hi=[`pre`,`script`,`style`,`textarea`],gi={concrete:!0,name:`htmlFlow`,resolveTo:yi,tokenize:bi},_i={partial:!0,tokenize:Si},vi={partial:!0,tokenize:xi};function yi(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function bi(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ne):$n(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):$n(a)?(e.consume(a),i=4,r.interrupt?t:ne):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ne):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return $n(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Z(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&hi.includes(l)?(i=1,r.interrupt?t(s):O(s)):mi.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||er(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Q(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||$n(t)?(e.consume(t),b):Q(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||er(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Q(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Q(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||X(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Z(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Q(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||X(t)?O(t):Q(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),ne):t===93&&i===5?(e.consume(t),N):X(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(_i,ie,k)(t)):t===null||X(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(vi,A,ie)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return t===null||X(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),ne):O(t)}function M(t){return t===47?(e.consume(t),o=``,te):O(t)}function te(t){if(t===62){let n=o.toLowerCase();return hi.includes(n)?(e.consume(t),re):O(t)}return $n(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),te):O(t)}function N(t){return t===93?(e.consume(t),ne):O(t)}function ne(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),ne):O(t)}function re(t){return t===null||X(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function xi(e,t,n){let r=this;return i;function i(t){return X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Si(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(wr,t,n)}}var Ci={name:`htmlText`,tokenize:wi};function wi(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):$n(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):$n(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):X(t)?(o=d,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):X(t)?(o=h,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):X(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):X(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return $n(t)?(e.consume(t),S):n(t)}function S(t){return t===45||er(t)?(e.consume(t),S):C(t)}function C(t){return X(t)?(o=C,M(t)):Q(t)?(e.consume(t),C):j(t)}function w(t){return t===45||er(t)?(e.consume(t),w):t===47||t===62||Z(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||$n(t)?(e.consume(t),E):X(t)?(o=T,M(t)):Q(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||er(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):X(t)?(o=D,M(t)):Q(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):X(t)?(o=O,M(t)):Q(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,ee):t===null?n(t):X(t)?(o=k,M(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Z(t)?T(t):(e.consume(t),A)}function ee(e){return e===47||e===62||Z(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return Q(t)?$(e,N,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):N(t)}function N(t){return e.enter(`htmlTextData`),o(t)}}var Ti={name:`labelEnd`,resolveAll:ki,resolveTo:Ai,tokenize:ji},Ei={tokenize:Mi},Di={tokenize:Ni},Oi={tokenize:Pi};function ki(e){let t=-1,n=[];for(;++t=3&&(a===null||X(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Q(t)?$(e,s,`whitespace`)(t):s(t))}}var Ui={continuation:{tokenize:qi},exit:Yi,name:`list`,tokenize:Ki},Wi={partial:!0,tokenize:Xi},Gi={partial:!0,tokenize:Ji};function Ki(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:rr(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Vi,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return rr(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(wr,r.interrupt?n:u,e.attempt(Wi,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Q(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function qi(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(wr,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Q(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Gi,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$(e,e.attempt(Ui,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ji(e,t,n){let r=this;return $(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Yi(e){e.exit(this.containerState.type)}function Xi(e,t,n){let r=this;return $(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Q(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Zi={name:`setextUnderline`,resolveTo:Qi,tokenize:$i};function Qi(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function $i(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Q(t)?$(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||X(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var ea={tokenize:ta};function ta(e){let t=this,n=e.attempt(wr,r,e.attempt(this.parser.constructs.flowInitial,i,$(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Xr,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var na={resolveAll:oa()},ra=aa(`string`),ia=aa(`text`);function aa(e){return{resolveAll:oa(e===`text`?sa:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iga,contentInitial:()=>ua,disable:()=>_a,document:()=>la,flow:()=>fa,flowInitial:()=>da,insideSpan:()=>ha,string:()=>pa,text:()=>ma}),la={42:Ui,43:Ui,45:Ui,48:Ui,49:Ui,50:Ui,51:Ui,52:Ui,53:Ui,54:Ui,55:Ui,56:Ui,57:Ui,62:Er},ua={91:ai},da={[-2]:Rr,[-1]:Rr,32:Rr},fa={35:di,42:Vi,45:[Zi,Vi],60:gi,61:Zi,95:Vi,96:Fr,126:Fr},pa={38:Mr,92:Ar},ma={[-5]:zi,[-4]:zi,[-3]:zi,33:Fi,38:Mr,42:vr,60:[Sr,Ci],91:Li,92:[li,Ar],93:Ti,95:vr,96:Hr},ha={null:[vr,na]},ga={null:[42,95]},_a={null:[]};function va(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Kn(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=_r(a,l.events,l),l.events):[]}function f(e,t){return ba(p(e),t)}function p(e){return ya(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function ba(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Pa).call(a,void 0,e[0])}for(r.position={start:ja(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ja(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function za(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ba(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Va(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=lr(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Ha(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ua(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Wa(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Ga(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Wa(e,t);let i={src:lr(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Ka(e,t){let n={src:lr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function qa(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Ja(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Wa(e,t);let i={href:lr(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Ya(e,t){let n={href:lr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Xa(e,t,n){let r=e.all(t),i=n?Za(n):Qa(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s1}function $a(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=rn(t.children[1]),o=nn(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function io(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(lo(t.slice(i),i>0,!1)),a.join(``)}function lo(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===oo||t===so;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===oo||t===so;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function uo(e,t){let n={type:`text`,value:co(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function fo(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var po={blockquote:Ia,break:La,code:Ra,delete:za,emphasis:Ba,footnoteReference:Va,heading:Ha,html:Ua,imageReference:Ga,image:Ka,inlineCode:qa,linkReference:Ja,link:Ya,listItem:Xa,list:$a,paragraph:eo,root:to,strong:no,table:ro,tableCell:ao,tableRow:io,text:uo,thematicBreak:fo,toml:mo,yaml:mo,definition:mo,footnoteDefinition:mo};function mo(){}var ho=typeof self==`object`?self:globalThis,go=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new ho[e](t)},_o=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(go(e,t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(go(a,o),i)};return r},vo=e=>_o(new Map,e)(0),yo=``,{toString:bo}={},{keys:xo}=Object,So=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=bo.call(e).slice(8,-1);switch(n){case`Array`:return[1,yo];case`Object`:return[2,yo];case`Date`:return[3,yo];case`RegExp`:return[4,yo];case`Map`:return[5,yo];case`Set`:return[6,yo];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},Co=([e,t])=>e===0&&(t===`function`||t===`symbol`),wo=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=So(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of xo(r))(e||!Co(So(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(Co(So(n))||Co(So(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Co(So(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},To=(e,{json:t,lossy:n}={})=>{let r=[];return wo(!(t||n),!!t,new Map,r)(e),r},Eo=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?vo(To(e,t)):structuredClone(e):(e,t)=>vo(To(e,t));function Do(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Oo(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function ko(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Do,r=e.options.footnoteBackLabel||Oo,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...Eo(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:` +`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:` +`}]}}var Ao=(function(e){if(e==null)return Fo;if(typeof e==`function`)return Po(e);if(typeof e==`object`)return Array.isArray(e)?jo(e):Mo(e);if(typeof e==`string`)return No(e);throw Error(`Expected function, string, or object as test`)});function jo(e){let t=[],n=-1;for(;++n`:``))+`)`})}return u;function u(){let l=Ro,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Bo(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d0&&n.push({type:`text`,value:` +`}),n}function Yo(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Xo(e,t){let n=Wo(e,t),r=n.one(e,void 0),i=ko(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:` +`},i)),a}function Zo(e,t){return e&&`run`in e?async function(n,r){let i=Xo(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Xo(n,{file:r,...e||t})}}function Qo(e){if(e)throw e}var $o=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var rs={basename:is,dirname:as,extname:os,join:ss,sep:`/`};function is(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);us(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function as(e){if(us(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function os(e){us(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function ss(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function ls(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function us(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var ds={cwd:fs};function fs(){return`/`}function ps(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function ms(e){if(typeof e==`string`)e=new URL(e);else if(!ps(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return hs(e)}function hs(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];es(o)&&es(r)&&(r=(0,Cs.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Es(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Ds(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Os(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ks(e){if(!es(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function As(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function js(e){return Ms(e)?e:new _s(e)}function Ms(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Ns(e){return typeof e==`string`||Ps(e)}function Ps(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Fs=[],Is={allowDangerousHtml:!0},Ls=/^(https?|ircs?|mailto|xmpp)$/i,Rs=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function zs(e){let t=Bs(e),n=Vs(e);return Hs(t.runSync(t.parse(n),n),e)}function Bs(e){let t=e.rehypePlugins||Fs,n=e.remarkPlugins||Fs,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Is}:Is;return Ts().use(Fa).use(n).use(Zo,r).use(t)}function Vs(e){let t=e.children||``,n=new _s;return typeof t==`string`?n.value=t:``+t,n}function Hs(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Us;for(let e of Rs)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return t.className&&(e={type:`element`,tagName:`div`,properties:{className:t.className},children:e.type===`root`?e.children:[e]}),Vo(e,l),_n(e,{Fragment:z.Fragment,components:i,ignoreInvalidStyle:!0,jsx:z.jsx,jsxs:z.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Rn)if(Object.hasOwn(Rn,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Rn[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Us(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Ls.test(e.slice(0,t))?e:``}$s.peek=Qs;function Ws(){this.buffer()}function Gs(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Ks(){this.buffer()}function qs(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Js(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ys(e){this.exit(e)}function Xs(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Zs(e){this.exit(e)}function Qs(){return`[`}function $s(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function ec(){return{enter:{gfmFootnoteCallString:Ws,gfmFootnoteCall:Gs,gfmFootnoteDefinitionLabelString:Ks,gfmFootnoteDefinition:qs},exit:{gfmFootnoteCallString:Js,gfmFootnoteCall:Ys,gfmFootnoteDefinitionLabelString:Xs,gfmFootnoteDefinition:Zs}}}ic.peek=ac;function tc(){return{canContainEols:[`delete`],enter:{strikethrough:nc},exit:{strikethrough:rc}}}function nc(e){this.enter({type:`delete`,children:[]},e)}function rc(e){this.exit(e)}function ic(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function ac(){return`~`}function oc(){return{enter:{table:sc,tableData:dc,tableHeader:dc,tableRow:lc},exit:{codeText:fc,table:cc,tableData:uc,tableHeader:uc,tableRow:uc}}}function sc(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function cc(e){this.exit(e),this.data.inTable=void 0}function lc(e){this.enter({type:`tableRow`,children:[]},e)}function uc(e){this.exit(e)}function dc(e){this.enter({type:`tableCell`,children:[]},e)}function fc(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,pc));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function pc(e,t){return t===`|`?t:e}function mc(){return{exit:{taskListCheckValueChecked:hc,taskListCheckValueUnchecked:hc,paragraph:gc}}}function hc(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function gc(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i999||s===93&&!o||s===null||s===91||Z(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Qn(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Z(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Sc(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Z(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Qn(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Z(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),$(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Cc(e,t,n){return e.check(wr,t,e.attempt(_c,t,n))}function wc(e){e.exit(`gfmFootnoteDefinition`)}function Tc(e,t,n){let r=this;return $(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Ec(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=gr(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Dc=class{constructor(){this.map=[]}add(e,t,n){Oc(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function Oc(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):X(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Q(t)?$(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Z(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Q(t)?$(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Q(t)?$(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||X(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Q(t)?$(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||X(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||X(n)?(e.exit(`tableRow`),t(n)):Q(n)?$(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Z(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function Mc(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Dc;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},Fc(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Pc(e,t,n,r,i){let a=[],o=Fc(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function Fc(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Ic={name:`tasklistCheck`,tokenize:Rc};function Lc(){return{text:{91:Ic}}}function Rc(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Z(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return X(r)?t(r):Q(r)?e.check({tokenize:zc},t,n)(r):n(r)}}function zc(e,t,n){return $(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Bc(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[];t.push(vc(),Ec(),Ac(),Lc()),n.push(ec(),tc(),oc(),mc())}var Vc=`fileManager.readmeCollapsed`;function Hc({folderId:e}){let{t}=o(),[n,r]=(0,R.useState)(()=>localStorage.getItem(Vc)===`1`);(0,R.useEffect)(()=>{localStorage.setItem(Vc,n?`1`:`0`)},[n]);let{data:i,isLoading:s,error:c}=l({queryKey:[`folder-readme`,e],queryFn:()=>a.getLibraryFolderReadme(e),retry:!1,staleTime:3e4});return s||c||!i?null:n?(0,z.jsxs)(`div`,{className:`mb-2 lg:mb-0 order-first lg:order-none lg:w-10 lg:flex-shrink-0 lg:h-full`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>r(!1),title:t(`fileManager.readme.show`),"aria-label":t(`fileManager.readme.show`),className:`flex lg:hidden w-full items-center gap-2 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark/40 transition-colors`,children:[(0,z.jsx)(Re,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,z.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:i.filename}),(0,z.jsx)(st,{className:`w-4 h-4 text-bambu-gray flex-shrink-0 ml-auto`})]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>r(!1),title:t(`fileManager.readme.show`),"aria-label":t(`fileManager.readme.show`),className:`hidden lg:flex h-full w-10 flex-col items-center gap-2 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark/40 transition-colors`,children:[(0,z.jsx)(st,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,z.jsx)(`span`,{className:`text-xs font-medium text-bambu-gray [writing-mode:vertical-rl] rotate-180 select-none`,children:t(`fileManager.readme.label`)})]})]}):(0,z.jsxs)(`div`,{className:`mb-4 lg:mb-0 order-first lg:order-none lg:w-80 xl:w-96 lg:flex-shrink-0 lg:h-full flex flex-col bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,z.jsx)(Re,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,z.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,title:i.filename,children:i.filename}),i.truncated&&(0,z.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 flex-shrink-0`,children:t(`fileManager.readme.truncated`)})]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>r(!0),title:t(`fileManager.readme.hide`),"aria-label":t(`fileManager.readme.hide`),className:`p-1 rounded text-bambu-gray hover:text-white hover:bg-bambu-dark/40 transition-colors flex-shrink-0`,children:(0,z.jsx)(ot,{className:`w-4 h-4`})})]}),(0,z.jsx)(`div`,{className:`px-4 py-3 border-t border-bambu-dark-tertiary flex-1 overflow-y-auto max-h-96 lg:max-h-none text-sm text-bambu-gray-light leading-relaxed space-y-2`,children:(0,z.jsx)(zs,{remarkPlugins:[Bc],components:{h1:({children:e})=>(0,z.jsx)(`h1`,{className:`text-lg font-semibold text-white mt-2 mb-1`,children:e}),h2:({children:e})=>(0,z.jsx)(`h2`,{className:`text-base font-semibold text-white mt-2 mb-1`,children:e}),h3:({children:e})=>(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-white mt-2 mb-1`,children:e}),p:({children:e})=>(0,z.jsx)(`p`,{className:`my-1`,children:e}),ul:({children:e})=>(0,z.jsx)(`ul`,{className:`list-disc list-inside space-y-0.5 ml-2`,children:e}),ol:({children:e})=>(0,z.jsx)(`ol`,{className:`list-decimal list-inside space-y-0.5 ml-2`,children:e}),li:({children:e})=>(0,z.jsx)(`li`,{children:e}),code:({children:e,...t})=>t.className?(0,z.jsx)(`code`,{className:`block p-2 bg-bambu-dark rounded text-xs font-mono text-bambu-gray-light overflow-x-auto`,children:e}):(0,z.jsx)(`code`,{className:`px-1 py-0.5 bg-bambu-dark rounded text-xs font-mono text-bambu-green`,children:e}),pre:({children:e})=>(0,z.jsx)(`pre`,{className:`my-2`,children:e}),blockquote:({children:e})=>(0,z.jsx)(`blockquote`,{className:`border-l-2 border-bambu-dark-tertiary pl-3 text-bambu-gray italic`,children:e}),a:({children:e,href:t})=>(0,z.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-green hover:underline`,children:e}),table:({children:e})=>(0,z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,z.jsx)(`table`,{className:`min-w-full text-xs border-collapse`,children:e})}),th:({children:e})=>(0,z.jsx)(`th`,{className:`border border-bambu-dark-tertiary px-2 py-1 text-left font-semibold text-white`,children:e}),td:({children:e})=>(0,z.jsx)(`td`,{className:`border border-bambu-dark-tertiary px-2 py-1`,children:e}),hr:()=>(0,z.jsx)(`hr`,{className:`border-bambu-dark-tertiary my-2`})},children:i.content})})]})}function Uc({open:e,onClose:t,onPickTag:n}){let{t:r}=o(),i=c(),{showToast:s}=v(),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(``),[_,y]=(0,R.useState)(null),{data:b=[],isLoading:x}=l({queryKey:pt,queryFn:a.getLibraryTags,enabled:e}),S=()=>{i.invalidateQueries({queryKey:pt}),i.invalidateQueries({queryKey:[`library-files`]})},C=u({mutationFn:async()=>{let e=h.trim();if(!e)throw Error(r(`fileManager.tags.nameRequired`));return p?a.updateLibraryTag(p.id,e):a.createLibraryTag(e)},onSuccess:()=>{s(r(p?`fileManager.tags.updated`:`fileManager.tags.created`),`success`),f(!1),m(null),g(``),S()},onError:e=>{s(e.message||r(`fileManager.tags.saveFailed`),`error`)}}),w=u({mutationFn:e=>a.deleteLibraryTag(e),onSuccess:()=>{s(r(`fileManager.tags.deleted`),`success`),y(null),S()},onError:e=>{s(e.message||r(`fileManager.tags.deleteFailed`),`error`)}}),T=()=>{m(null),g(``),f(!0)},E=e=>{m(e),g(e.name),f(!0)},D=(0,R.useCallback)(()=>{C.isPending||(f(!1),m(null),g(``))},[C.isPending]);(0,R.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(C.isPending||w.isPending||(d?D():_||t()))};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,d,_,C.isPending,w.isPending,D,t]);let O=e=>{e.preventDefault(),C.mutate()};if(!e)return null;let k=`library-tags-modal-title`,A=`library-tag-editor-title`;return(0,z.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,z.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:()=>{C.isPending||w.isPending||t()}}),(0,z.jsxs)(`div`,{className:`relative w-full max-w-4xl mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":k,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`h2`,{id:k,className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,z.jsx)(xe,{className:`w-5 h-5 text-bambu-green`}),r(`fileManager.tags.title`)]}),(0,z.jsx)(`p`,{className:`text-bambu-gray text-sm mt-0.5`,children:r(`fileManager.tags.subtitle`)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(P,{onClick:T,children:[(0,z.jsx)(Oe,{className:`w-4 h-4`}),r(`fileManager.tags.add`)]}),(0,z.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-white rounded`,onClick:t,"aria-label":r(`common.close`),children:(0,z.jsx)(ae,{className:`w-5 h-5`})})]})]}),(0,z.jsx)(`div`,{className:`overflow-y-auto`,children:x?(0,z.jsxs)(`div`,{className:`flex items-center justify-center py-16 text-bambu-gray`,children:[(0,z.jsx)(j,{className:`w-6 h-6 animate-spin mr-2`}),r(`common.loading`)]}):b.length===0?(0,z.jsx)(`div`,{className:`py-16 text-center text-bambu-gray`,children:r(`fileManager.tags.empty`)}):(0,z.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary text-left text-bambu-gray`,children:[(0,z.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:r(`fileManager.tags.name`)}),(0,z.jsx)(`th`,{className:`px-4 py-3 font-medium text-right`,children:r(`fileManager.tags.fileCount`)}),(0,z.jsx)(`th`,{className:`px-4 py-3 font-medium text-right w-32`,children:r(`common.actions`)})]})}),(0,z.jsx)(`tbody`,{children:b.map(e=>(0,z.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 hover:bg-bambu-dark-tertiary/30 ${n?`cursor-pointer`:``}`,onClick:()=>{n&&(n(e.id),t())},children:[(0,z.jsx)(`td`,{className:`px-4 py-3 text-white font-medium`,children:e.name}),(0,z.jsx)(`td`,{className:`px-4 py-3 text-right text-bambu-gray`,children:e.file_count}),(0,z.jsx)(`td`,{className:`px-4 py-3 text-right`,onClick:e=>e.stopPropagation(),children:(0,z.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,z.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded`,onClick:()=>E(e),title:r(`common.edit`),"aria-label":r(`fileManager.tags.editAria`,{name:e.name}),children:(0,z.jsx)(ue,{className:`w-4 h-4`})}),(0,z.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 rounded`,onClick:()=>y(e),title:r(`common.delete`),"aria-label":r(`fileManager.tags.deleteAria`,{name:e.name}),children:(0,z.jsx)(de,{className:`w-4 h-4`})})]})})]},e.id))})]})})]}),d&&(0,z.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center`,children:[(0,z.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:D}),(0,z.jsxs)(`div`,{className:`relative w-full max-w-md mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl p-6 shadow-2xl`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":A,children:[(0,z.jsx)(`h3`,{id:A,className:`text-lg font-semibold text-white mb-4`,children:r(p?`fileManager.tags.edit`:`fileManager.tags.add`)}),(0,z.jsxs)(`form`,{onSubmit:O,children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`library-tag-name`,children:r(`fileManager.tags.name`)}),(0,z.jsx)(`input`,{id:`library-tag-name`,type:`text`,maxLength:64,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green mb-4`,placeholder:r(`fileManager.tags.createPlaceholder`),value:h,onChange:e=>g(e.target.value),autoFocus:!0}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,z.jsx)(P,{type:`button`,variant:`secondary`,onClick:D,children:r(`common.cancel`)}),(0,z.jsxs)(P,{type:`submit`,disabled:C.isPending||!h.trim(),children:[C.isPending&&(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}),r(`common.save`)]})]})]})]})]}),_&&(0,z.jsx)(ke,{title:r(`fileManager.tags.confirmDelete`,{name:_.name}),message:_.file_count>0?r(`fileManager.tags.confirmDeleteInUseMessage`,{count:_.file_count}):r(`fileManager.tags.confirmDeleteMessage`),confirmText:r(`common.delete`),variant:`danger`,isLoading:w.isPending,onConfirm:()=>w.mutate(_.id),onCancel:()=>y(null)})]})}function Wc({file:e,canEdit:t,onClose:n}){let{t:r}=o(),{showToast:i}=v(),s=c(),{data:d}=l({queryKey:[`library-file`,e.id],queryFn:()=>a.getLibraryFile(e.id)}),[f,p]=(0,R.useState)(``),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)([]),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(null),C=(0,R.useRef)(null),w=(0,R.useRef)(null);(0,R.useEffect)(()=>{!d||w.current===d.id||(w.current=d.id,p(d.notes??``),h(d.external_url??``),_(d.photos??[]))},[d]),(0,R.useEffect)(()=>{if(x!==null)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[x,n]);let T=()=>{s.invalidateQueries({queryKey:[`library-files`]}),s.invalidateQueries({queryKey:[`library-file`,e.id]})},E=u({mutationFn:()=>a.updateLibraryFile(e.id,{notes:f,external_url:m.trim()}),onSuccess:()=>{T(),i(r(`fileManager.details.saved`),`success`),n()},onError:()=>{i(r(`fileManager.details.saveFailed`),`error`)}}),D=!!d&&(f!==(d.notes??``)||m.trim()!==(d.external_url??``)),O=async t=>{let n=t.target.files?.[0];if(n){b(!0);try{_((await a.uploadLibraryFilePhoto(e.id,n)).photos),T()}catch{i(r(`fileManager.details.uploadFailed`),`error`)}finally{b(!1),C.current&&(C.current.value=``)}}},k=async t=>{try{let n=(await a.deleteLibraryFilePhoto(e.id,t)).photos??[];_(n),n.length===0&&S(null),T()}catch{i(r(`fileManager.details.deleteFailed`),`error`)}},A=e=>{e.preventDefault(),!(!t||!D)&&E.mutate()},ee=m.trim(),M=[{label:r(`fileManager.details.size`),value:oe(e.file_size)},{label:r(`fileManager.details.type`),value:e.file_type.toUpperCase()}];if(d?.print_name&&M.push({label:r(`fileManager.details.printName`),value:d.print_name}),d?.print_time_seconds&&M.push({label:r(`fileManager.details.printTime`),value:ce(d.print_time_seconds)}),d?.filament_used_grams&&M.push({label:r(`fileManager.details.filament`),value:`${d.filament_used_grams.toFixed(1)} g`}),d?.sliced_for_model&&M.push({label:r(`fileManager.details.slicedFor`),value:d.sliced_for_model}),d?.source_url){let e=/^https?:\/\//i.test(d.source_url);M.push({label:r(`fileManager.details.source`),value:e?(0,z.jsxs)(`a`,{href:d.source_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-green hover:underline inline-flex items-center gap-1 min-w-0`,children:[(0,z.jsx)(`span`,{className:`truncate`,children:d.source_url}),(0,z.jsx)(fe,{className:`w-3 h-3 flex-shrink-0`})]}):(0,z.jsx)(`span`,{className:`truncate`,children:d.source_url})})}return M.push({label:r(`fileManager.details.created`),value:se(e.created_at)}),M.push({label:r(`fileManager.details.modified`),value:se(e.fs_modified_at??d?.updated_at??e.created_at)}),(0,z.jsxs)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:n,children:[(0,z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg max-h-[90vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:r(`fileManager.details.title`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,z.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,title:e.filename,children:e.filename}),(0,z.jsx)(`span`,{className:`flex-shrink-0 text-xs px-1.5 py-0.5 rounded font-medium bg-bambu-dark-tertiary text-bambu-gray`,children:e.file_type.toUpperCase()})]})]}),(0,z.jsx)(`button`,{type:`button`,onClick:n,className:`text-bambu-gray hover:text-white transition-colors flex-shrink-0`,"aria-label":r(`common.close`),children:(0,z.jsx)(ae,{className:`w-5 h-5`})})]}),(0,z.jsxs)(`form`,{onSubmit:A,className:`p-6 space-y-4 overflow-y-auto flex-1`,children:[(0,z.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm`,children:M.map(e=>(0,z.jsxs)(`div`,{className:`contents`,children:[(0,z.jsx)(`dt`,{className:`text-bambu-gray whitespace-nowrap`,children:e.label}),(0,z.jsx)(`dd`,{className:`text-white min-w-0 truncate`,children:e.value})]},e.label))}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,z.jsx)(ne,{className:`w-4 h-4 inline mr-1`}),r(`fileManager.details.notes`)]}),(0,z.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),rows:3,disabled:!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none resize-none disabled:opacity-60`,placeholder:r(`fileManager.details.notesPlaceholder`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,z.jsx)(Pe,{className:`w-4 h-4 inline mr-1`}),r(`fileManager.details.externalLink`)]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`input`,{type:`url`,value:m,onChange:e=>h(e.target.value),disabled:!t,className:`flex-1 min-w-0 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-60`,placeholder:r(`fileManager.details.externalLinkPlaceholder`)}),ee&&(0,z.jsx)(`a`,{href:ee,target:`_blank`,rel:`noopener noreferrer`,className:`p-2 rounded-lg text-bambu-gray hover:text-bambu-green hover:bg-bambu-dark transition-colors`,title:r(`fileManager.details.openLink`),"aria-label":r(`fileManager.details.openLink`),children:(0,z.jsx)(fe,{className:`w-4 h-4`})})]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,z.jsx)(be,{className:`w-4 h-4 inline mr-1`}),r(`fileManager.details.photos`)]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[g.map((n,i)=>(0,z.jsxs)(`div`,{className:`relative group`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>S(i),className:`block w-20 h-20 rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors`,children:(0,z.jsx)(`img`,{src:a.getLibraryFilePhotoUrl(e.id,n),alt:r(`fileManager.details.photos`),className:`w-full h-full object-cover`})}),t&&(0,z.jsx)(`button`,{type:`button`,onClick:()=>k(n),className:`absolute -top-1 -right-1 p-1 bg-red-500 rounded-full can-hover:opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity`,title:r(`fileManager.details.deletePhoto`),"aria-label":r(`fileManager.details.deletePhoto`),children:(0,z.jsx)(de,{className:`w-3 h-3 text-white`})})]},n)),t&&(0,z.jsxs)(`label`,{className:`w-20 h-20 flex items-center justify-center border-2 border-dashed border-bambu-dark-tertiary rounded-lg cursor-pointer hover:border-bambu-green transition-colors`,title:r(`fileManager.details.addPhoto`),children:[(0,z.jsx)(`input`,{ref:C,type:`file`,accept:`image/jpeg,image/png,image/webp`,onChange:O,className:`hidden`,disabled:y,"aria-label":r(`fileManager.details.addPhoto`)}),y?(0,z.jsx)(j,{className:`w-6 h-6 text-bambu-gray animate-spin`}):(0,z.jsx)(Oe,{className:`w-6 h-6 text-bambu-gray`})]}),g.length===0&&!t&&(0,z.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:r(`fileManager.details.noPhotos`)})]})]}),(0,z.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,z.jsx)(P,{type:`button`,variant:`secondary`,onClick:n,className:`flex-1`,children:r(`common.close`)}),t&&(0,z.jsxs)(P,{type:`submit`,variant:`primary`,className:`flex-1`,disabled:!D||E.isPending,children:[E.isPending?(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}):(0,z.jsx)(Te,{className:`w-4 h-4`}),r(`fileManager.details.save`)]})]})]})]}),x!==null&&g.length>0&&(0,z.jsx)(We,{archiveName:e.filename,photos:g,initialIndex:x,getPhotoUrl:t=>a.getLibraryFilePhotoUrl(e.id,t),onClose:()=>S(null),onDelete:t?k:void 0})]})}var Gc=90;function Kc({onClose:e}){let{t}=o(),n=c(),{showToast:r}=v(),[i,s]=(0,R.useState)(Gc),[d,f]=(0,R.useState)(!0),[p,m]=(0,R.useState)(i);(0,R.useEffect)(()=>{let e=window.setTimeout(()=>m(i),300);return()=>window.clearTimeout(e)},[i]);let h=l({queryKey:[`library-purge-preview`,p,d],queryFn:()=>a.previewLibraryPurge(p,d),enabled:p>=1}),g=u({mutationFn:()=>a.executeLibraryPurge(i,d),onSuccess:i=>{r(t(`libraryPurge.toast.success`,{count:i.moved_to_trash}),`success`),n.invalidateQueries({queryKey:[`library-files`]}),n.invalidateQueries({queryKey:[`library-folders`]}),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]}),e()},onError:e=>r(e.message||t(`libraryPurge.toast.failed`),`error`)});(0,R.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!g.isPending&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,g.isPending]);let _=h.data,y=_?.count??0,b=_?.total_bytes??0,x=y>0&&!g.isPending;return(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,children:(0,z.jsxs)(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg shadow-xl max-w-lg w-full`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700`,children:[(0,z.jsxs)(`h2`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2`,children:[(0,z.jsx)(de,{className:`w-5 h-5`}),t(`libraryPurge.title`)]}),(0,z.jsx)(`button`,{onClick:e,className:`text-gray-400 hover:text-gray-600 dark:hover:text-gray-200`,"aria-label":t(`common.close`),disabled:g.isPending,children:(0,z.jsx)(ae,{className:`w-5 h-5`})})]}),(0,z.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,z.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:t(`libraryPurge.description`)}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{htmlFor:`purge-days`,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:t(`libraryPurge.ageLabel`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`input`,{id:`purge-days`,type:`number`,min:1,max:3650,value:i,onChange:e=>s(Math.max(1,Math.min(3650,parseInt(e.target.value||`0`,10)||0))),className:`w-24 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm px-2 py-1 text-gray-900 dark:text-gray-100`}),(0,z.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:t(`libraryPurge.days`)})]})]}),(0,z.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked),className:`rounded border-gray-300`}),t(`libraryPurge.includeNeverPrinted`)]}),(0,z.jsxs)(`div`,{className:`rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/30 p-3`,children:[(0,z.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300 mb-2`,children:t(`libraryPurge.effectsTitle`)}),(0,z.jsxs)(`ul`,{className:`text-xs text-gray-700 dark:text-gray-300 space-y-1 list-disc pl-4`,children:[(0,z.jsx)(`li`,{children:t(`libraryPurge.effect1`)}),(0,z.jsx)(`li`,{children:t(`libraryPurge.effect2`)}),(0,z.jsx)(`li`,{children:t(`libraryPurge.effect3`)}),(0,z.jsx)(`li`,{children:t(`libraryPurge.effect4`)})]})]}),(0,z.jsx)(`div`,{className:`rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 p-3`,children:h.isLoading||h.isFetching?(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400`,children:[(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}),` `,t(`libraryPurge.previewLoading`)]}):h.isError?(0,z.jsx)(`div`,{className:`text-sm text-red-600 dark:text-red-400`,children:h.error?.message??t(`libraryPurge.previewFailed`)}):(0,z.jsxs)(`div`,{className:`text-sm text-gray-900 dark:text-gray-100`,children:[(0,z.jsx)(`div`,{className:`font-medium`,children:t(`libraryPurge.previewSummary`,{count:y,size:oe(b)})}),_?.sample_filenames&&_.sample_filenames.length>0&&(0,z.jsxs)(`ul`,{className:`mt-2 text-xs text-gray-600 dark:text-gray-400 space-y-0.5 list-disc pl-4`,children:[_.sample_filenames.map(e=>(0,z.jsx)(`li`,{className:`truncate`,children:e},e)),y>_.sample_filenames.length&&(0,z.jsx)(`li`,{className:`list-none italic text-gray-500`,children:t(`libraryPurge.andMore`,{count:y-_.sample_filenames.length})})]})]})}),(0,z.jsxs)(`div`,{className:`flex gap-2 items-start text-xs text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 rounded px-3 py-2`,children:[(0,z.jsx)(re,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,z.jsx)(`span`,{children:t(`libraryPurge.warning`)})]})]}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2 p-4 border-t border-gray-200 dark:border-gray-700`,children:[(0,z.jsx)(P,{variant:`secondary`,onClick:e,disabled:g.isPending,children:t(`common.cancel`)}),(0,z.jsx)(P,{variant:`danger`,disabled:!x,onClick:()=>g.mutate(),children:g.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(j,{className:`w-4 h-4 animate-spin mr-1`}),t(`libraryPurge.purging`)]}):t(`libraryPurge.confirmCta`,{count:y})})]})]})})}var qc=(0,R.lazy)(()=>I(()=>import(`./PdfPreviewModal-4n0YPMFt.js`).then(e=>({default:e.PdfPreviewModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28]))),Jc=(0,R.lazy)(()=>I(()=>import(`./SpreadsheetPreviewModal-CqoREJBx.js`).then(e=>({default:e.SpreadsheetPreviewModal})),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,30,26,27,28]))),Yc=(0,R.lazy)(()=>I(()=>import(`./ImagePreviewModal-CV42BcLH.js`).then(e=>({default:e.ImagePreviewModal})),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28])));function Xc(e){return e===`csv`||e===`xlsx`||e===`ods`}function Zc(e){return e===`step`||e===`stp`}var Qc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`tiff`,`tif`]),$c=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`]);function el(e){return Qc.has(e.toLowerCase())}function tl(e){return $c.has(e.toLowerCase())}function nl({fileType:e,className:t}){return(0,z.jsx)(e===`pdf`?Re:Xc(e)?C:el(e)?Fe:S,{className:t})}function rl(e){return{results:e,files:e.flatMap(e=>e.data??[])}}function il(e){let t=e.file_type;return Ze(e)||t===`3mf`||t===`stl`||Zc(t)||t===`pdf`||Xc(t)||tl(t)}var al={onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation()};function ol(e){return Ze(e)||e.file_type===`3mf`||e.file_type===`stl`||Zc(e.file_type)}function sl(e){return e===`pdf`?(0,z.jsx)(Re,{className:`w-4 h-4`}):Xc(e)?(0,z.jsx)(C,{className:`w-4 h-4`}):(0,z.jsx)(Fe,{className:`w-4 h-4`})}function cl(e){return e===`stl`||e===`pdf`}function ll(e){return e===`3mf`?`bg-bambu-green/20 text-bambu-green`:e===`gcode`||e===`gcode.3mf`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:e===`stl`?`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`:Zc(e)?`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`:e===`pdf`?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:Xc(e)?`bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400`:`bg-bambu-gray/20 text-bambu-gray`}function ul(e,t){let n=[...e],r=t.query?.trim().toLowerCase();r&&(n=n.filter(e=>e.filename.toLowerCase().includes(r)||e.print_name&&e.print_name.toLowerCase().includes(r))),t.filterType!==`all`&&(n=n.filter(e=>e.file_type===t.filterType));let i=t.filterUsername.trim().toLowerCase();return i&&(n=n.filter(e=>e.created_by_username&&e.created_by_username.toLowerCase().includes(i))),n.sort((e,n)=>{let r=0;switch(t.sortField){case`name`:r=(e.print_name||e.filename).localeCompare(n.print_name||n.filename);break;case`date`:r=(le(e.fs_modified_at??e.created_at)?.getTime()??0)-(le(n.fs_modified_at??n.created_at)?.getTime()??0);break;case`size`:r=e.file_size-n.file_size;break;case`type`:r=e.file_type.localeCompare(n.file_type);break;case`prints`:r=e.print_count-n.print_count;break}return t.sortDirection===`asc`?r:-r}),n}var dl=e=>e?`grid-cols-[24px_minmax(240px,1fr)_120px_100px_100px_100px_minmax(96px,200px)_220px]`:`grid-cols-[24px_minmax(240px,1fr)_100px_100px_100px_minmax(96px,200px)_220px]`,fl=`min-w-min`;function pl({parentId:e,onClose:t,onSave:n,isLoading:r,t:i}){let[a,o]=(0,R.useState)(``);return(0,z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary`,children:[(0,z.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:(0,z.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`fileManager.newFolder`)})}),(0,z.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),n({name:a.trim(),parent_id:e})},className:`p-4 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:i(`fileManager.folderName`)}),(0,z.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:i(`fileManager.folderNamePlaceholder`),autoFocus:!0,required:!0})]}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,z.jsx)(P,{type:`button`,variant:`secondary`,onClick:t,children:i(`common.cancel`)}),(0,z.jsx)(P,{type:`submit`,disabled:!a.trim()||r,children:r?(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}):i(`common.create`)})]})]})]})})}function ml({onClose:e,onSave:t,isLoading:n,t:r}){let[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(``),[c,l]=(0,R.useState)(!0),[u,d]=(0,R.useState)(!1);return(0,z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-md border border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,z.jsx)(it,{className:`w-5 h-5 text-bambu-green`}),r(`fileManager.linkExternalFolder`)]}),(0,z.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:r(`fileManager.linkExternalFolderDescription`)})]}),(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),t({name:i.trim(),external_path:o.trim(),readonly:c,show_hidden:u})},className:`p-4 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:r(`fileManager.folderName`)}),(0,z.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:r(`fileManager.externalFolderNamePlaceholder`),autoFocus:!0,required:!0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:r(`fileManager.externalPath`)}),(0,z.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green font-mono text-sm`,placeholder:`/mnt/nas/3d-prints`,required:!0}),(0,z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:r(`fileManager.externalPathHelp`)})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,z.jsx)(`span`,{className:`text-sm text-white`,children:r(`fileManager.readOnly`)}),(0,z.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,r(`fileManager.readOnlyHelp`),`)`]})]}),(0,z.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,z.jsx)(`span`,{className:`text-sm text-white`,children:r(`fileManager.showHiddenFiles`)})]})]}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,z.jsx)(P,{type:`button`,variant:`secondary`,onClick:e,children:r(`common.cancel`)}),(0,z.jsx)(P,{type:`submit`,disabled:!i.trim()||!o.trim()||n,children:n?(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}):r(`fileManager.linkFolder`)})]})]})]})})}var hl=`<>:"/\\|?*`;function gl(e){for(let t of e)if(hl.includes(t)||t.charCodeAt(0)<32)return t;return null}function _l({type:e,currentName:t,onClose:n,onSave:r,isLoading:i,t:a}){let o=e===`file`?t.match(/(\.gcode\.3mf|\.3mf|\.gcode)$/i)?.[1]??``:``,s=e===`file`&&o?t.slice(0,-o.length):t,[c,l]=(0,R.useState)(s),u=e===`file`?gl(c):null,d=u?a(`fileManager.invalidFilenameChar`,{char:u}):null;return(0,z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary`,children:[(0,z.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:(0,z.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:a(e===`file`?`fileManager.renameFile`:`fileManager.renameFolder`)})}),(0,z.jsxs)(`form`,{onSubmit:n=>{if(n.preventDefault(),d)return;let i=e===`file`?c.trim()+o:c.trim();c.trim()&&i!==t&&r(i)},className:`p-4 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:a(`common.name`)}),(0,z.jsxs)(`div`,{className:`flex items-center bg-bambu-dark border rounded focus-within:border-bambu-green ${d?`border-red-500`:`border-bambu-dark-tertiary`}`,children:[(0,z.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),className:`flex-1 bg-transparent px-3 py-2 text-white placeholder-bambu-gray focus:outline-none min-w-0`,autoFocus:!0,required:!0}),o&&(0,z.jsx)(`span`,{className:`pr-3 text-bambu-gray text-sm select-none whitespace-nowrap`,children:o})]}),d&&(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:d})]}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,z.jsx)(P,{type:`button`,variant:`secondary`,onClick:n,children:a(`common.cancel`)}),(0,z.jsx)(P,{type:`submit`,disabled:!c.trim()||c.trim()===s||!!d||i,children:i?(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}):a(`common.rename`)})]})]})]})})}function vl({folders:e,selectedFiles:t,currentFolderId:n,onClose:r,onMove:i,isLoading:a,t:o}){let[s,c]=(0,R.useState)(null),l=(e,t=0)=>{let n=[];for(let r of e)n.push({id:r.id,name:r.name,depth:t,canWrite:r.can_write!==!1}),r.children.length>0&&n.push(...l(r.children,t+1));return n},u=[{id:null,name:o(`fileManager.rootNoFolder`),depth:0,canWrite:!0},...l(e)];return(0,z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary`,children:[(0,z.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:(0,z.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:o(`fileManager.moveFiles`,{count:t.length})})}),(0,z.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,z.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-1`,children:u.map(e=>(0,z.jsxs)(`button`,{onClick:()=>c(e.id),disabled:e.id===n||!e.canWrite,title:e.canWrite?void 0:o(`fileManager.folderNotWritable`),className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${s===e.id?`bg-bambu-green/20 text-bambu-green`:e.id===n||!e.canWrite?`opacity-50 cursor-not-allowed text-bambu-gray`:`hover:bg-bambu-dark text-white`}`,style:{paddingLeft:`${12+e.depth*16}px`},children:[(0,z.jsx)(Ie,{className:`w-4 h-4`}),e.name,e.id===n&&(0,z.jsxs)(`span`,{className:`text-xs text-bambu-gray ml-auto`,children:[`(`,o(`fileManager.current`),`)`]})]},e.id??`root`))}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,z.jsx)(P,{type:`button`,variant:`secondary`,onClick:r,children:o(`common.cancel`)}),(0,z.jsx)(P,{onClick:()=>i(s),disabled:a,children:a?(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}):o(`common.move`)})]})]})]})})}function yl({folder:e,onClose:t,onLink:n,isLoading:r,t:i}){let[o,s]=(0,R.useState)(`project`),[c,u]=(0,R.useState)(e.project_id||e.archive_id||null);(0,R.useState)(()=>{e.archive_id&&s(`archive`)});let{data:d}=l({queryKey:[`projects`],queryFn:()=>a.getProjects(),select:t=>F([...t].sort((e,t)=>e.name.localeCompare(t.name)),e.project_id)}),{data:f}=l({queryKey:[`archives-for-link`],queryFn:()=>a.getArchives(void 0,void 0,100)}),p=()=>{n(o===`project`?{project_id:c,archive_id:0}:{project_id:0,archive_id:c})},h=()=>{n({project_id:0,archive_id:0})},g=e.project_id||e.archive_id;return(0,z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-md border border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,z.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,z.jsx)(A,{className:`w-5 h-5 text-bambu-green`}),i(`fileManager.linkFolder`)]}),(0,z.jsx)(`button`,{onClick:t,className:`p-1 hover:bg-bambu-dark rounded`,children:(0,z.jsx)(ae,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,z.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,z.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`fileManager.linkFolderDescription`,{name:e.name})}),(0,z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,z.jsxs)(`button`,{onClick:()=>{s(`project`),u(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${o===`project`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:[(0,z.jsx)(m,{className:`w-4 h-4`}),i(`fileManager.project`)]}),(0,z.jsxs)(`button`,{onClick:()=>{s(`archive`),u(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${o===`archive`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:[(0,z.jsx)(he,{className:`w-4 h-4`}),i(`fileManager.archive`)]})]}),(0,z.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-1 bg-bambu-dark rounded-lg p-2`,children:o===`project`?d&&d.length>0?d.map(e=>(0,z.jsxs)(`button`,{onClick:()=>u(e.id),className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${c===e.id?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark-tertiary text-white`}`,children:[(0,z.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:e.color||`#00ae42`}}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)):(0,z.jsx)(`p`,{className:`text-sm text-bambu-gray text-center py-4`,children:i(`fileManager.noProjectsFound`)}):f&&f.length>0?f.map(e=>(0,z.jsxs)(`button`,{onClick:()=>u(e.id),className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${c===e.id?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark-tertiary text-white`}`,children:[(0,z.jsx)(S,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.print_name||e.filename})]},e.id)):(0,z.jsx)(`p`,{className:`text-sm text-bambu-gray text-center py-4`,children:i(`fileManager.noArchivesFound`)})})]}),(0,z.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary flex justify-between`,children:[g&&(0,z.jsxs)(P,{variant:`danger`,onClick:h,disabled:r,children:[(0,z.jsx)(ie,{className:`w-4 h-4 mr-2`}),i(`fileManager.unlink`)]}),(0,z.jsxs)(`div`,{className:`flex gap-2 ${g?``:`ml-auto`}`,children:[(0,z.jsx)(P,{variant:`secondary`,onClick:t,children:i(`common.cancel`)}),(0,z.jsx)(P,{onClick:p,disabled:!c||r,children:r?(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}):i(`fileManager.link`)})]})]})]})})}function bl({folder:e,onDelete:t,onLink:n,onRename:r,onToggleShared:i,hasPermission:a,revealOnHover:o=!1,tabIndex:s,t:c}){let[l,u]=(0,R.useState)(null),d=(0,R.useRef)(null),f=(0,R.useRef)(null),p=()=>{u(null),d.current?.contains(document.activeElement)&&f.current?.focus()},m=e.children.length>0,h=e.project_id||e.archive_id,g=e.is_external,_=e.can_delete??(a(`library:delete_all`)||a(`library:delete_own`)&&e.file_count===0&&!m&&!g&&!h),v=_?void 0:a(`library:delete_own`)&&!g&&!h?c(`fileManager.onlyOwnFoldersDeletable`):c(`fileManager.noPermissionDeleteFolder`),y=e.can_rename??a(`library:update_all`),b=a(`library:update_all`),S=[{label:c(`common.rename`),icon:(0,z.jsx)(ue,{className:`w-3.5 h-3.5`}),onClick:()=>r(e),disabled:!y,title:y?void 0:c(`fileManager.noPermissionRenameFolder`)},{label:c(h?`fileManager.changeLink`:`fileManager.linkTo`),icon:(0,z.jsx)(A,{className:`w-3.5 h-3.5`}),onClick:()=>n(e),disabled:!b,title:b?void 0:c(`fileManager.noPermissionLinkFolder`)},...i&&b?[{label:e.shared?c(`fileManager.unshareFolder`):c(`fileManager.shareFolder`),icon:(0,z.jsx)(pe,{className:`w-3.5 h-3.5`}),onClick:()=>i(e),title:c(`fileManager.shareFolderHint`)}]:[],{label:c(`common.delete`),icon:(0,z.jsx)(de,{className:`w-3.5 h-3.5`}),onClick:()=>t(e.id),danger:!0,disabled:!_,title:v}];return(0,z.jsxs)(`div`,{ref:d,className:`relative flex-shrink-0 flex items-center transition-opacity ${o&&!l?`can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`:``}`,"data-folder-actions":!0,onClick:e=>e.stopPropagation(),onKeyDown:e=>{l&&(e.key===`ArrowUp`||e.key===`ArrowDown`)&&p()},children:[(0,z.jsx)(`button`,{ref:f,type:`button`,tabIndex:s,onClick:e=>{if(l){p();return}let t=e.currentTarget.getBoundingClientRect();u({x:t.left,y:t.bottom+4})},className:`p-1 rounded hover:bg-bambu-dark-tertiary`,title:c(`common.actions`),children:(0,z.jsx)(x,{className:`w-3.5 h-3.5 text-bambu-gray`})}),l&&(0,z.jsx)(T,{x:l.x,y:l.y,items:S,onClose:p,anchorRef:f})]})}function xl({folder:e,selectedFolderId:t,onSelect:n,onDelete:r,onLink:i,onRename:a,onToggleShared:o,depth:s=0,wrapNames:c=!1,defaultExpanded:l=!0,showModified:u=!1,hasPermission:d,t:f}){let[p,h]=(0,R.useState)(l),g=e.children.length>0,_=e.project_id||e.archive_id,v=e.is_external;return(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`group flex items-center gap-1 px-2 py-1.5 rounded cursor-pointer transition-colors ${t===e.id?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark text-white`}`,style:{paddingLeft:`${8+s*12}px`},onClick:()=>n(e.id),children:[g?(0,z.jsx)(`button`,{onClick:e=>{e.stopPropagation(),h(!p)},className:`p-0.5 hover:bg-bambu-dark-tertiary rounded`,children:(0,z.jsx)(_e,{className:`w-3.5 h-3.5 transition-transform ${p?`rotate-90`:``}`})}):(0,z.jsx)(`div`,{className:`w-4.5`}),v?(0,z.jsx)(it,{className:`w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0`}):(0,z.jsx)(Ie,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,z.jsx)(`span`,{className:`block text-sm ${c?`break-all`:`truncate`}`,title:e.name,children:e.name}),u&&e.latest_activity_at&&(0,z.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-xs text-bambu-gray`,title:f(`fileManager.lastActivity`),children:[(0,z.jsx)(tt,{className:`w-3 h-3 flex-shrink-0`}),(0,z.jsx)(`span`,{className:`truncate`,children:se(e.latest_activity_at)})]})]}),_&&(0,z.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),i(e)},className:`flex-shrink-0 flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-500/30 transition-colors`,title:`${e.project_name?`Project: ${e.project_name}`:`Archive: ${e.archive_name}`} (click to change)`,children:[(0,z.jsx)(A,{className:`w-3 h-3`}),e.project_name?(0,z.jsx)(m,{className:`w-3 h-3`}):(0,z.jsx)(he,{className:`w-3 h-3`})]}),e.shared&&(0,z.jsx)(`span`,{title:f(`fileManager.sharedFolder`),children:(0,z.jsx)(pe,{className:`w-3 h-3 text-bambu-gray flex-shrink-0`})}),v&&e.external_readonly&&(0,z.jsx)(`span`,{title:f(`fileManager.readOnly`),children:(0,z.jsx)(M,{className:`w-3 h-3 text-amber-600 dark:text-amber-400 flex-shrink-0`})}),e.file_count>0&&(0,z.jsx)(`span`,{className:`flex-shrink-0 text-xs text-bambu-gray`,children:e.file_count}),!_&&!v&&(0,z.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e)},className:`flex-shrink-0 p-1 rounded hover:bg-bambu-dark-tertiary`,title:f(`fileManager.linkToProjectOrArchive`),children:(0,z.jsx)(A,{className:`w-3.5 h-3.5 text-bambu-gray hover:text-bambu-green`})}),(0,z.jsx)(bl,{folder:e,onDelete:r,onLink:i,onRename:a,onToggleShared:o,hasPermission:d,revealOnHover:!c,t:f})]}),g&&p&&(0,z.jsx)(`div`,{children:e.children.map(e=>(0,z.jsx)(xl,{folder:e,selectedFolderId:t,onSelect:n,onDelete:r,onLink:i,onRename:a,onToggleShared:o,depth:s+1,wrapNames:c,defaultExpanded:l,showModified:u,hasPermission:d,t:f},e.id))})]})}function Sl({file:e,isSelected:t,onSelect:n,onDelete:r,onDownload:i,onPrint:o,onSlice:s,onOpenInSlicer:c,onRunPipeline:l,useSlicerApi:u,desktopSlicer:d,canSlice:f,onPreview:m,onRename:h,onDetails:g,onGenerateThumbnail:v,onTagClick:b,thumbnailVersion:S,hasPermission:C,canModify:w,authEnabled:E,showModified:D,t:O}){let[k,A]=(0,R.useState)(null),ee=C(`library:read`),j=w(`library`,`update`,e.created_by_id),M=w(`library`,`delete`,e.created_by_id),N=[];if(o&&Ze(e)&&N.push({label:O(`common.print`),icon:(0,z.jsx)(me,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>o(e),disabled:!C(`queue:create`),title:C(`queue:create`)?void 0:O(`fileManager.noPermissionAddToQueue`)}),Qe(e,!!u,d)&&(u?s:c)&&N.push({label:O(`slice.action`),icon:u?(0,z.jsx)(y,{className:`w-4 h-4`}):(0,z.jsx)(fe,{className:`w-4 h-4`}),onClick:()=>{u?s?.(e):c?.(e)},disabled:!f,title:f?void 0:O(u?`fileManager.noPermissionSlice`:`fileManager.noPermissionDownload`)}),l&&u&&Qe(e,!0,d)&&N.push({label:O(`library.runWithPipeline.actionLabel`),icon:(0,z.jsx)(te,{className:`w-4 h-4`}),onClick:()=>l(e),disabled:!C(`pipelines:run`),title:C(`pipelines:run`)?void 0:O(`library.runWithPipeline.noPermission`)}),m&&il(e)){let t=ol(e);N.push({label:O(t?`fileManager.preview3d`:`fileManager.preview.open`),icon:t?(0,z.jsx)(p,{className:`w-4 h-4`}):sl(e.file_type),onClick:()=>m(e),disabled:!ee,title:ee?void 0:O(`fileManager.noPermissionPreview`)})}return N.push({label:O(`common.download`),icon:(0,z.jsx)(Le,{className:`w-4 h-4`}),onClick:()=>i(e.id),disabled:!C(`library:read`),title:C(`library:read`)?void 0:O(`fileManager.noPermissionDownload`)}),h&&N.push({label:O(`common.rename`),icon:(0,z.jsx)(ue,{className:`w-4 h-4`}),onClick:()=>h(e),disabled:!j,title:j?void 0:O(`fileManager.noPermissionRenameFile`)}),g&&N.push({label:O(`fileManager.details.title`),icon:(0,z.jsx)(_,{className:`w-4 h-4`}),onClick:()=>g(e),disabled:!ee,title:ee?void 0:O(`fileManager.noPermissionPreview`)}),e.external_url&&N.push({label:O(`fileManager.details.openLink`),icon:(0,z.jsx)(Me,{className:`w-4 h-4`}),onClick:()=>window.open(e.external_url,`_blank`,`noopener,noreferrer`)}),v&&cl(e.file_type)&&N.push({label:O(`fileManager.generateThumbnail`),icon:(0,z.jsx)(Fe,{className:`w-4 h-4`}),onClick:()=>v(e),disabled:!j,title:j?void 0:O(`fileManager.noPermissionGenerateThumbnail`)}),N.push({label:O(`common.delete`),icon:(0,z.jsx)(de,{className:`w-4 h-4`}),onClick:()=>r(e.id),danger:!0,disabled:!M,title:M?void 0:O(`fileManager.noPermissionDeleteFile`)}),(0,z.jsxs)(`div`,{className:`group relative bg-bambu-dark-secondary rounded-lg border transition-all cursor-pointer ${t?`border-bambu-green ring-1 ring-bambu-green`:`border-bambu-dark-tertiary hover:border-bambu-green/50`}`,onClick:()=>n(e.id),onDoubleClick:()=>m?.(e),children:[(0,z.jsxs)(`div`,{className:`aspect-square bg-bambu-dark flex items-center justify-center overflow-hidden rounded-t-lg`,children:[e.thumbnail_path?(0,z.jsx)(`img`,{src:`${a.getLibraryFileThumbnailUrl(e.id)}${S?(a.getLibraryFileThumbnailUrl(e.id).includes(`?`)?`&`:`?`)+`v=${S}`:``}`,loading:`lazy`,alt:e.filename,className:`w-full h-full object-cover`}):(0,z.jsx)(nl,{fileType:e.file_type,className:`w-12 h-12 text-bambu-gray/30`}),(0,z.jsx)(`div`,{className:`absolute top-2 right-2 text-xs px-1.5 py-0.5 rounded font-medium ${e.file_type===`3mf`?`bg-bambu-green/90 text-white`:e.file_type===`gcode`||e.file_type===`gcode.3mf`?`bg-blue-500/90 text-white`:e.file_type===`stl`?`bg-purple-500/90 text-white`:Zc(e.file_type)?`bg-amber-500/90 text-white`:e.file_type===`pdf`?`bg-red-500/90 text-white`:Xc(e.file_type)?`bg-teal-500/90 text-white`:`bg-bambu-gray/90 text-white`}`,children:e.file_type.toUpperCase()})]}),(0,z.jsxs)(`div`,{className:`p-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-white truncate`,title:e.print_name||e.filename,children:e.print_name||e.filename}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-bambu-gray`,children:[(0,z.jsx)(`span`,{children:oe(e.file_size)}),e.print_time_seconds&&(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(ve,{className:`w-3 h-3`}),ce(e.print_time_seconds)]})]}),e.sliced_for_model&&(0,z.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,z.jsx)(me,{className:`w-3 h-3`}),e.sliced_for_model]}),(e.variant_count??0)>1&&(0,z.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-green flex items-center gap-1`,children:[(0,z.jsx)(je,{className:`w-3 h-3`}),O(`fileManager.variants.badge`,{count:e.variant_count})]}),e.print_count>0&&(0,z.jsx)(`div`,{className:`mt-1 text-xs text-bambu-green`,children:O(`fileManager.printedCount`,{count:e.print_count})}),(e.external_url||e.has_notes||(e.photo_count??0)>0)&&(0,z.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-bambu-gray`,...al,children:[e.external_url&&(0,z.jsx)(`a`,{href:e.external_url,target:`_blank`,rel:`noopener noreferrer`,className:`p-0.5 rounded hover:text-bambu-green`,title:O(`fileManager.details.openLink`),"aria-label":O(`fileManager.details.openLink`),children:(0,z.jsx)(Me,{className:`w-3.5 h-3.5`})}),e.has_notes&&(0,z.jsx)(`button`,{type:`button`,onClick:()=>g?.(e),className:`p-0.5 rounded hover:text-bambu-green`,title:O(`fileManager.details.hasNotes`),"aria-label":O(`fileManager.details.hasNotes`),children:(0,z.jsx)(ne,{className:`w-3.5 h-3.5`})}),(e.photo_count??0)>0&&(0,z.jsxs)(`button`,{type:`button`,onClick:()=>g?.(e),className:`flex items-center gap-0.5 p-0.5 rounded hover:text-bambu-green`,title:O(`fileManager.details.photoCount`,{count:e.photo_count}),"aria-label":O(`fileManager.details.photoCount`,{count:e.photo_count}),children:[(0,z.jsx)(be,{className:`w-3.5 h-3.5`}),(0,z.jsx)(`span`,{children:e.photo_count})]})]}),E&&e.created_by_username&&(0,z.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,z.jsx)(ye,{className:`w-3 h-3`}),e.created_by_username]}),D&&(0,z.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,title:O(`fileManager.lastModified`),children:[(0,z.jsx)(tt,{className:`w-3 h-3`}),se(e.fs_modified_at??e.created_at)]}),(e.tags?.length??0)>0&&(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,...al,children:e.tags.map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>b?.(e.id),className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] bg-bambu-green/10 text-bambu-green hover:bg-bambu-green/20 transition-colors max-w-full`,title:e.name,children:[(0,z.jsx)(xe,{className:`w-2.5 h-2.5 flex-shrink-0`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})]}),(0,z.jsxs)(`div`,{className:`absolute bottom-2 right-2 transition-opacity can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,...al,children:[(0,z.jsx)(`button`,{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();A({x:t.left,y:t.bottom+4})},className:`p-1.5 rounded bg-bambu-dark-secondary/90 hover:bg-bambu-dark-tertiary`,children:(0,z.jsx)(x,{className:`w-4 h-4 text-bambu-gray`})}),k&&(0,z.jsx)(T,{x:k.x,y:k.y,items:N,onClose:()=>A(null)})]}),(0,z.jsx)(`div`,{className:`absolute top-2 left-2 w-5 h-5 rounded border-2 flex items-center justify-center transition-all ${t?`bg-bambu-green border-bambu-green`:`border-white/30 bg-black/30 can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,children:t&&(0,z.jsx)(`div`,{className:`w-2 h-2 bg-white rounded-sm`})})]})}function Cl({file:e,onPrint:t,onSlice:n,onOpenInSlicer:r,onRunPipeline:i,useSlicerApi:a,desktopSlicer:o,canSlice:s,onPreview:c,onDetails:l,onDownload:u,onRename:d,onGenerateThumbnail:f,thumbnailPending:m,onDelete:h,hasPermission:g,canModify:v,tabIndex:b,t:x}){let S=v(`library`,`update`,e.created_by_id),C=v(`library`,`delete`,e.created_by_id);return(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,"data-file-actions":!0,...al,children:[Ze(e)&&(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>g(`queue:create`)&&t(e),className:`p-1.5 rounded transition-colors ${g(`queue:create`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:g(`queue:create`)?x(`common.print`):x(`fileManager.noPermissionAddToQueue`),disabled:!g(`queue:create`),children:(0,z.jsx)(me,{className:`w-4 h-4`})}),Qe(e,a,o)&&(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>{s&&(a?n:r)(e)},className:`p-1.5 rounded transition-colors ${s?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:x(s?`slice.action`:a?`fileManager.noPermissionSlice`:`fileManager.noPermissionDownload`),disabled:!s,children:a?(0,z.jsx)(y,{className:`w-4 h-4`}):(0,z.jsx)(fe,{className:`w-4 h-4`})}),a&&Qe(e,!0,o)&&(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>g(`pipelines:run`)&&i(e),className:`p-1.5 rounded transition-colors ${g(`pipelines:run`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:g(`pipelines:run`)?x(`library.runWithPipeline.actionLabel`):x(`library.runWithPipeline.noPermission`),disabled:!g(`pipelines:run`),children:(0,z.jsx)(te,{className:`w-4 h-4`})}),ol(e)&&(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>g(`library:read`)&&c(e),className:`p-1.5 rounded transition-colors ${g(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:g(`library:read`)?x(`fileManager.preview3d`):x(`fileManager.noPermissionPreview`),disabled:!g(`library:read`),children:(0,z.jsx)(p,{className:`w-4 h-4`})}),!ol(e)&&il(e)&&(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>g(`library:read`)&&c(e),className:`p-1.5 rounded transition-colors ${g(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:g(`library:read`)?x(`fileManager.preview.open`):x(`fileManager.noPermissionPreview`),disabled:!g(`library:read`),children:sl(e.file_type)}),(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>g(`library:read`)&&u(e.id),className:`p-1.5 rounded transition-colors ${g(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:g(`library:read`)?x(`common.download`):x(`fileManager.noPermissionDownload`),disabled:!g(`library:read`),children:(0,z.jsx)(Le,{className:`w-4 h-4`})}),(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>g(`library:read`)&&l(e),className:`p-1.5 rounded transition-colors ${g(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:g(`library:read`)?x(`fileManager.details.title`):x(`fileManager.noPermissionPreview`),disabled:!g(`library:read`),children:(0,z.jsx)(_,{className:`w-4 h-4`})}),(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>S&&d(e),className:`p-1.5 rounded transition-colors ${S?`hover:bg-bambu-dark text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:x(S?`common.rename`:`fileManager.noPermissionRenameFile`),disabled:!S,children:(0,z.jsx)(ue,{className:`w-4 h-4`})}),cl(e.file_type)&&(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>S&&f(e),className:`p-1.5 rounded transition-colors ${S?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:x(S?`fileManager.generateThumbnail`:`fileManager.noPermissionGenerateThumbnail`),disabled:m||!S,children:(0,z.jsx)(Fe,{className:`w-4 h-4`})}),(0,z.jsx)(`button`,{tabIndex:b,onClick:()=>C&&h(e.id),className:`p-1.5 rounded transition-colors ${C?`hover:bg-bambu-dark text-bambu-gray hover:text-red-700 dark:hover:text-red-400`:`text-bambu-gray/50 cursor-not-allowed`}`,title:x(C?`common.delete`:`fileManager.noPermissionDeleteFile`),disabled:!C,children:(0,z.jsx)(de,{className:`w-4 h-4`})})]})}function wl({file:e,isSelected:t,isFocused:n,showModified:r,thumbnailVersion:i,onSelect:o,onOpen:s,actionProps:c,t:l}){let u=a.getLibraryFileThumbnailUrl(e.id);return(0,z.jsxs)(`div`,{"data-file-id":e.id,onClick:()=>o(e),onDoubleClick:()=>s(e),className:`group flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors ${t?`bg-bambu-green/10`:`hover:bg-bambu-dark`} ${n?`ring-1 ring-inset ring-bambu-green/60`:``}`,title:e.print_name||e.filename,children:[(0,z.jsx)(`div`,{className:`w-4 h-4 rounded border-2 flex-shrink-0 flex items-center justify-center ${t?`bg-bambu-green border-bambu-green`:`border-bambu-gray/50`}`,children:t&&(0,z.jsx)(`div`,{className:`w-1.5 h-1.5 bg-white rounded-sm`})}),(0,z.jsx)(`div`,{className:`w-10 h-10 rounded bg-bambu-dark flex-shrink-0 overflow-hidden flex items-center justify-center`,children:e.thumbnail_path?(0,z.jsx)(`img`,{src:`${u}${i?(u.includes(`?`)?`&`:`?`)+`v=${i}`:``}`,loading:`lazy`,alt:``,className:`w-full h-full object-cover`}):(0,z.jsx)(nl,{fileType:e.file_type,className:`w-5 h-5 text-bambu-gray/50`})}),(0,z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,z.jsx)(`div`,{className:`text-sm text-white truncate`,children:e.print_name||e.filename}),(0,z.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-xs text-bambu-gray`,children:[(0,z.jsx)(`span`,{className:`px-1.5 py-px rounded font-medium ${ll(e.file_type)}`,children:e.file_type.toUpperCase()}),(0,z.jsx)(`span`,{children:oe(e.file_size)}),e.print_count>0&&(0,z.jsxs)(`span`,{children:[e.print_count,`x`]}),r&&(0,z.jsxs)(`span`,{className:`flex items-center gap-1 truncate`,title:l(`fileManager.lastModified`),children:[(0,z.jsx)(tt,{className:`w-3 h-3 flex-shrink-0`}),se(e.fs_modified_at??e.created_at)]})]})]}),(0,z.jsx)(`div`,{className:`flex-shrink-0 transition-opacity ${n||t?``:`can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,children:(0,z.jsx)(Cl,{file:e,...c,tabIndex:n?0:-1})})]})}function Tl(){let{t:e}=o(),t=c(),{showToast:n}=v(),{hasPermission:r,hasAnyPermission:i,canModify:s,authEnabled:f}=ze(),[p]=De(),m=Ee(),h=p.get(`folder`),[g,_]=(0,R.useState)(h?parseInt(h,10):null),[y,x]=(0,R.useState)(`internal`),[C,T]=(0,R.useState)([]),[te,ie]=(0,R.useState)(!1),[ce,le]=(0,R.useState)(!1),[ue,fe]=(0,R.useState)(!1),[F,I]=(0,R.useState)(!1),[he,ve]=(0,R.useState)([]),[Te,Pe]=(0,R.useState)(!1),[Le,Re]=(0,R.useState)(!1),[Be,Ve]=(0,R.useState)(!1),[We,qe]=(0,R.useState)([]),[Je,Ye]=(0,R.useState)(null),[ot,st]=(0,R.useState)(null),[ct,ut]=(0,R.useState)(null),[dt,pt]=(0,R.useState)(null),[ht,gt]=(0,R.useState)(!1),[_t,vt]=(0,R.useState)(null),[yt,bt]=(0,R.useState)(null),[xt,St]=(0,R.useState)(null),[Ct,wt]=(0,R.useState)({}),[Tt,B]=(0,R.useState)(null),[Et,Dt]=(0,R.useState)(null),[V,H]=(0,R.useState)(null),[Ot,U]=(0,R.useState)(null),[W,kt]=(0,R.useState)(null),[G,At]=(0,R.useState)(()=>localStorage.getItem(`library-view-mode`)||`grid`),jt=(0,R.useRef)(null),[K,Mt]=(0,R.useState)(null),[Nt,Pt]=(0,R.useState)(()=>localStorage.getItem(`library-wrap-folders`)===`true`),[Ft,It]=(0,R.useState)(()=>localStorage.getItem(`library-collapse-folders`)===`true`),[Lt,Rt]=(0,R.useState)(()=>localStorage.getItem(`library-folder-sort-field`)===`activity`?`activity`:`name`),[zt,Bt]=(0,R.useState)(()=>localStorage.getItem(`library-folder-sort-direction`)===`desc`?`desc`:`asc`),[Vt,Ht]=(0,R.useState)(()=>{let e=localStorage.getItem(`library-sidebar-width`);return e?parseInt(e,10):256}),[Ut,Wt]=(0,R.useState)(!1),Gt=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(!Ut)return;document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`;let e=e=>{if(!Gt.current)return;let t=Gt.current.parentElement?.getBoundingClientRect();if(!t)return;let n=e.clientX-t.left;Ht(Math.min(500,Math.max(200,n)))},t=()=>{Wt(!1),document.body.style.userSelect=``,document.body.style.cursor=``,localStorage.setItem(`library-sidebar-width`,String(Vt))};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t),document.body.style.userSelect=``,document.body.style.cursor=``}},[Ut,Vt]);let[Kt,qt]=(0,R.useState)(``),[Jt,Yt]=(0,R.useState)(`all`),[Xt,Zt]=(0,R.useState)(``),[Qt,$t]=(0,R.useState)(()=>localStorage.getItem(`library-sort-field`)||`name`),[en,tn]=(0,R.useState)(()=>localStorage.getItem(`library-sort-direction`)||`asc`),[nn,rn]=(0,R.useState)(()=>localStorage.getItem(`library-show-modified`)===`true`);(0,R.useEffect)(()=>{let e=p.get(`folder`);e&&_(parseInt(e,10))},[p]);let{data:an}=l({queryKey:[`settings`],queryFn:()=>a.getSettings()}),on=Ke(an?.open_in_slicer,an?.preferred_slicer),sn=(0,R.useCallback)(async t=>{try{let{token:e}=await a.createLibrarySlicerToken(t.id),n=a.getLibrarySlicerDownloadUrl(t.id,e,t.filename);Ge(`${window.location.origin}${n}`,on)}catch{n(e(`fileManager.toast.openInSlicerFailed`),`error`);let r=a.getLibraryFileDownloadUrl(t.id);Ge(`${window.location.origin}${r}`,on)}},[on,n,e]),cn=(0,R.useCallback)(()=>an?.use_slicer_api?r(`library:upload`):i(`library:read_all`,`library:read_own`),[an?.use_slicer_api,r,i]),{data:ln,isLoading:un}=l({queryKey:[`library-folders`],queryFn:()=>a.getLibraryFolders()}),q=(0,R.useMemo)(()=>{if(!ln)return ln;let e=t=>[...t].sort((e,t)=>{let n=0;if(Lt===`name`)n=e.name.localeCompare(t.name);else{let r=e.latest_activity_at?new Date(e.latest_activity_at).getTime():null,i=t.latest_activity_at?new Date(t.latest_activity_at).getTime():null;if(r===null&&i===null)n=e.name.localeCompare(t.name);else if(r===null)return 1;else if(i===null)return-1;else n=r-i}return zt===`asc`?n:-n}).map(t=>({...t,children:e(t.children)}));return e(ln)},[ln,Lt,zt]),{data:dn}=l({queryKey:[`library-trash-count`],queryFn:async()=>{try{return(await a.listLibraryTrash(1,0)).total}catch{return 0}},staleTime:3e4}),fn=g!==null&&Kt.trim().length>0,pn=(0,R.useMemo)(()=>[...We].sort((e,t)=>e-t),[We]),{data:mn=[]}=l({queryKey:[`library-tags`],queryFn:a.getLibraryTags}),hn=(0,R.useMemo)(()=>{let e=new Map;for(let t of mn)e.set(t.id,t.name);return e},[mn]);(0,R.useEffect)(()=>{mn.length!==0&&qe(e=>{let t=e.filter(e=>hn.has(e));return t.length===e.length?e:t})},[mn.length,hn]);let gn=(0,R.useCallback)(e=>{qe(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),_n=Kt.trim().length>0||We.length>0,vn=G===`columns`&&g===null&&!_n,{data:yn,isLoading:bn}=l({queryKey:[`library-files`,g,y,fn,pn,vn],queryFn:()=>a.getLibraryFiles(g,vn,void 0,g===null?y:void 0,fn,pn)}),{data:xn}=l({queryKey:[`library-stats`],queryFn:()=>a.getLibraryStats()}),{data:Sn}=l({queryKey:[`users`,`slim`],queryFn:()=>a.getUsersSlim()}),Cn=(0,R.useMemo)(()=>{if(!yn)return[];let e=new Set(yn.map(e=>e.file_type));return Array.from(e).sort()},[yn]),J=(0,R.useMemo)(()=>ul(yn??[],{query:Kt,filterType:Jt,filterUsername:Xt,sortField:Qt,sortDirection:en}),[yn,Kt,Jt,Xt,Qt,en]),wn=(0,R.useMemo)(()=>{if(!xn||!an)return!1;let e=(an.library_disk_warning_gb||5)*1024*1024*1024;return xn.disk_free_bytesa.createLibraryFolder(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-folders`]}),ie(!1),n(e(`fileManager.toast.folderCreated`),`success`)},onError:e=>n(e.message,`error`)}),En=u({mutationFn:async e=>{let t=await a.createExternalFolder(e);return await a.scanExternalFolder(t.id),t},onSuccess:r=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-stats`]}),le(!1),_(r.id),n(e(`fileManager.toast.externalFolderLinked`),`success`)},onError:e=>n(e.message,`error`)}),Dn=u({mutationFn:e=>a.scanExternalFolder(e),onSuccess:r=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]}),n(e(`fileManager.toast.folderScanned`,{added:r.added,removed:r.removed}),`success`)},onError:e=>n(e.message,`error`)}),On=u({mutationFn:e=>a.deleteLibraryFolder(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-stats`]}),g===ot?.id&&_(null),st(null),n(e(`fileManager.toast.folderDeleted`),`success`)},onError:e=>{st(null),n(e.message,`error`)}}),kn=u({mutationFn:e=>a.deleteLibraryFile(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]}),t.invalidateQueries({queryKey:[`library-trash-count`]}),T(e=>e.filter(e=>e!==ot?.id)),st(null),n(e(`fileManager.toast.fileDeleted`),`success`)},onError:e=>{st(null),n(e.message,`error`)}}),An=u({mutationFn:e=>a.createVariantGroup(e.map(e=>({library_file_id:e}))),onSuccess:r=>{t.invalidateQueries({queryKey:[`library-files`]}),n(e(`fileManager.variants.grouped`,{count:r.members.length}),`success`),T([])},onError:e=>n(e.message,`error`)}),jn=u({mutationFn:e=>a.bulkDeleteLibrary(e,[]),onSuccess:(r,i)=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]}),t.invalidateQueries({queryKey:[`library-trash-count`]}),n(e(`fileManager.toast.filesDeleted`,{count:i.length}),`success`),T([]),st(null)},onError:e=>{st(null),n(e.message,`error`)}}),Mn=u({mutationFn:({fileIds:e,folderId:t})=>a.moveLibraryFiles(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),T([]),fe(!1),n(e(`fileManager.toast.filesMoved`),`success`)},onError:e=>n(e.message,`error`)}),Nn=u({mutationFn:({id:e,data:t})=>a.updateLibraryFolder(e,t),onSuccess:(r,i)=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`project-folders`]}),t.invalidateQueries({queryKey:[`archive-folders`]}),Ye(null),n(i.data.project_id===0&&i.data.archive_id===0?e(`fileManager.toast.folderUnlinked`):e(`fileManager.toast.folderLinked`),`success`)},onError:e=>n(e.message,`error`)}),Pn=u({mutationFn:({id:e,filename:t})=>a.updateLibraryFile(e,{filename:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-files`]}),St(null),n(e(`fileManager.toast.fileRenamed`),`success`)},onError:e=>{St(null),n(e.message,`error`)}}),Fn=u({mutationFn:({id:e,name:t})=>a.updateLibraryFolder(e,{name:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-files`]}),St(null),n(e(`fileManager.toast.folderRenamed`),`success`)},onError:e=>{St(null),n(e.message,`error`)}}),In=u({mutationFn:({id:e,shared:t})=>a.updateLibraryFolder(e,{shared:t}),onSuccess:(r,i)=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`project-folders`]}),t.invalidateQueries({queryKey:[`archive-folders`]}),n(i.shared?e(`fileManager.toast.folderShared`):e(`fileManager.toast.folderUnshared`),`success`)},onError:e=>n(e.message,`error`)}),Ln=e=>In.mutate({id:e.id,shared:!e.shared}),Rn=u({mutationFn:()=>a.batchGenerateStlThumbnails({all_missing:!0}),onSuccess:r=>{if(t.invalidateQueries({queryKey:[`library-files`]}),r.succeeded>0){let e=Date.now(),t={};r.results.forEach(n=>{n.success&&(t[n.file_id]=e)}),wt(e=>({...e,...t}))}r.succeeded>0&&r.failed===0?n(e(`fileManager.toast.thumbnailsGenerated`,{count:r.succeeded}),`success`):r.succeeded>0&&r.failed>0?n(e(`fileManager.toast.thumbnailsGeneratedPartial`,{succeeded:r.succeeded,failed:r.failed}),`success`):r.processed===0?n(e(`fileManager.toast.noStlMissingThumbnails`),`info`):n(e(`fileManager.toast.failedToGenerateThumbnails`,{error:r.results[0]?.error||`Unknown error`}),`error`)},onError:e=>n(e.message,`error`)}),zn=u({mutationFn:e=>a.batchGenerateStlThumbnails({file_ids:[e]}),onSuccess:r=>{if(t.invalidateQueries({queryKey:[`library-files`]}),r.succeeded>0){let t=r.results[0]?.file_id;t&&wt(e=>({...e,[t]:Date.now()})),n(e(`fileManager.toast.thumbnailGenerated`),`success`)}else n(e(`fileManager.toast.failedToGenerateThumbnail`,{error:r.results[0]?.error||`Unknown error`}),`error`)},onError:e=>n(e.message,`error`)}),Bn=(0,R.useCallback)(e=>{r(`library:read`)&&(Ze(e)?m(`/gcode-viewer?library_file=${e.id}`):e.file_type===`3mf`||e.file_type===`stl`||Zc(e.file_type)?B(e):e.file_type===`pdf`?Dt(e):Xc(e.file_type)?H(e):tl(e.file_type)&&kt(e))},[r,m]),Vn=(0,R.useCallback)(e=>{T(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),Hn=(0,R.useCallback)(()=>{if(J.length>0){let e=J.map(e=>e.id);T(t=>G===`columns`?[...new Set([...t,...e])]:e)}},[J,G]),Un=J.length>0&&J.every(e=>C.includes(e.id)),Wn=(0,R.useCallback)(()=>{T([])},[]),Gn=()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]})},Y=(0,R.useMemo)(()=>{if(!g||!ln)return null;let e=t=>{for(let n of t){if(n.id===g)return n;let t=e(n.children);if(t)return t}return null};return e(ln)},[g,ln]),Kn=Y?.can_write!==!1,qn=r(`library:upload`)&&Kn,Jn=r(`library:upload`)?Kn?void 0:e(`fileManager.folderNotWritable`):void 0,{isDraggingOver:Yn,dragHandlers:Xn}=He({disabled:!qn||F,onFiles:e=>{ve(e),I(!0)}}),Zn=(0,R.useCallback)(e=>{if(!e.thumbnail_path&&s(`library`,`update`,e.created_by_id))return n=>{a.uploadLibraryPreviewThumbnail(e.id,n).then(n=>{n.updated&&(wt(t=>({...t,[e.id]:(t[e.id]||0)+1})),t.invalidateQueries({queryKey:[`library-files`]}))}).catch(()=>{})}},[s,t]),Qn=e=>{a.downloadLibraryFile(e).catch(e=>{console.error(`Library file download failed:`,e)})},$n=()=>{ot&&(ot.type===`file`?kn.mutate(ot.id):ot.type===`folder`?On.mutate(ot.id):ot.type===`bulk`&&jn.mutate(C))},er=On.isPending||kn.isPending||jn.isPending,tr=e=>{At(e),localStorage.setItem(`library-view-mode`,e)},nr={onPrint:ut,onSlice:pt,onOpenInSlicer:sn,onRunPipeline:bt,useSlicerApi:an?.use_slicer_api??!1,desktopSlicer:on,canSlice:cn(),onPreview:Bn,onDetails:U,onDownload:Qn,onRename:e=>St({type:`file`,id:e.id,name:e.filename}),onGenerateThumbnail:e=>zn.mutate(e.id),thumbnailPending:zn.isPending,onDelete:e=>st({type:`file`,id:e}),hasPermission:r,canModify:s,t:e},rr=un||bn,ir=(0,R.useMemo)(()=>{if(!q||g===null)return[];let e=[],t=n=>{for(let r of n){if(e.push(r),r.id===g||t(r.children))return!0;e.pop()}return!1};return t(q),e},[q,g]),ar=ir.length>0?!!ir[0].is_external:y===`external`,X=(0,R.useMemo)(()=>{let e=[{key:`root`,folderId:null,items:(q??[]).filter(e=>!!e.is_external===ar),activeId:ir[0]?.id??null}];return ir.forEach((t,n)=>{t.children.length>0&&e.push({key:`folder-${t.id}`,folderId:t.id,items:t.children,activeId:ir[n+1]?.id??null})}),e},[q,ir,ar]),Z=(0,R.useMemo)(()=>G!==`columns`||_n?[]:X.filter(e=>e.folderId!==g).map(e=>({key:e.key,folderId:e.folderId,scope:e.folderId===null?ar?`external`:`internal`:void 0})),[G,_n,X,g,ar]),Q=d({combine:rl,queries:Z.map(e=>({queryKey:[`library-files`,`column`,e.folderId,e.scope??null],queryFn:()=>a.getLibraryFiles(e.folderId,e.folderId===null,void 0,e.scope,!1,[])}))}),or=new Map;Z.forEach((e,t)=>{let n=Q.results[t];or.set(e.key,{files:ul(n?.data??[],{filterType:Jt,filterUsername:Xt,sortField:Qt,sortDirection:en}),loading:!!n?.isPending})});let sr=(0,R.useMemo)(()=>{let e=new Map;for(let t of[...yn??[],...Q.files])e.set(t.id,t);return e},[yn,Q.files]),cr=(0,R.useMemo)(()=>{if(C.length!==1)return null;let e=sr.get(C[0]);return e&&il(e)?e:null},[sr,C]),lr=(0,R.useMemo)(()=>C.map(e=>sr.get(e)).filter(e=>!!e&&Ze(e)),[sr,C]),$=(0,R.useMemo)(()=>{let e=C.map(e=>sr.get(e)).filter(e=>!!e&&e.filename.toLowerCase().endsWith(`.stl`));return e.length===C.length?e:[]},[sr,C]),{data:ur}=l({queryKey:[`variant-group`,ct?.variant_group_id],queryFn:()=>a.getVariantGroup(ct.variant_group_id),enabled:!!ct?.variant_group_id}),dr=(0,R.useMemo)(()=>{if(ct){if(lr.length>1)return lr.map(e=>({id:e.id,filename:e.filename,sliced_for_model:e.sliced_for_model}));if(ur&&ur.members.length>1)return ur.members.map(e=>({id:e.library_file_id,filename:e.filename,sliced_for_model:e.target_model}))}},[ct,lr,ur]),fr=K===null?void 0:Z.map(e=>or.get(e.key)?.files).find(e=>e?.some(e=>e.id===K)),pr=fr??J;(0,R.useEffect)(()=>{G===`columns`&&jt.current?.focus({preventScroll:!0})},[G]),(0,R.useEffect)(()=>{Mt(null)},[g,G]),(0,R.useEffect)(()=>{T([])},[g]),(0,R.useEffect)(()=>{G!==`columns`||g===null||jt.current?.querySelector(`[data-folder-id="${g}"]`)?.scrollIntoView?.({block:`nearest`})},[g,G]),(0,R.useEffect)(()=>{G!==`columns`||K===null||jt.current?.querySelector(`[data-file-id="${K}"]`)?.scrollIntoView?.({block:`nearest`})},[K,G]);let mr=()=>{let e=jt.current;if(e){if(K!==null)e.querySelector(`[data-file-id="${K}"] [data-file-actions] button:not([disabled])`)?.focus();else if(g!==null){let t=e.querySelector(`[data-folder-id="${g}"] [data-folder-actions] button`);t?.focus(),t?.click()}}},hr=e=>{if(e.ctrlKey||e.metaKey||e.altKey)return;let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)return;if(t.closest(`[data-folder-actions]`)){if(e.key===`Escape`){e.preventDefault(),jt.current?.focus({preventScroll:!0});return}if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;jt.current?.focus({preventScroll:!0})}let n=t.closest(`[data-file-actions]`);if(n){if(e.key===`Enter`||e.key===` `)return;if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let r=Array.from(n.querySelectorAll(`button:not([disabled])`));r[r.indexOf(t)+(e.key===`ArrowRight`?1:-1)]?.focus();return}if(e.key===`Escape`){e.preventDefault(),jt.current?.focus({preventScroll:!0});return}(e.key===`ArrowUp`||e.key===`ArrowDown`)&&jt.current?.focus({preventScroll:!0})}if(e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey){e.preventDefault(),mr();return}let r=K!==null,i=ir[ir.length-1];switch(e.key){case`ArrowDown`:case`ArrowUp`:{e.preventDefault();let t=e.key===`ArrowDown`?1:-1;if(r||_n){let e=pr.findIndex(e=>e.id===K),n=pr[e+t];n?Mt(n.id):t===-1&&e===0&&fr&&Mt(null)}else if(g===null)t===1&&X[0].items.length>0&&_(X[0].items[0].id);else{let e=X[ir.length-1],n=e?e.items.findIndex(e=>e.id===g):-1,r=n===-1?void 0:e.items[n+t];if(r)_(r.id);else if(t===1&&n!==-1){let t=e?or.get(e.key)?.files:void 0;t?.length&&Mt(t[0].id)}}break}case`ArrowRight`:if(e.preventDefault(),r)break;!_n&&i&&i.children.length>0?_(i.children[0].id):J.length>0&&Mt(J[0].id);break;case`ArrowLeft`:if(e.preventDefault(),r){Mt(null);break}if(_n)break;ir.length>1?_(ir[ir.length-2].id):ir.length===1?(x(ir[0].is_external?`external`:`internal`),_(null)):g!==null&&_(null);break;case`Enter`:{if(e.preventDefault(),!r){!_n&&i&&i.children.length>0?_(i.children[0].id):J.length>0&&Mt(J[0].id);break}let t=pr.find(e=>e.id===K);t&&Bn(t);break}case` `:if(e.preventDefault(),!r)break;K!==null&&Vn(K);break}};return(0,z.jsxs)(`div`,{className:`p-4 md:p-8 min-h-[calc(100vh-64px)] lg:h-screen flex flex-col relative`,...Xn,children:[Yn&&(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-bambu-dark/90 flex items-center justify-center pointer-events-none`,children:(0,z.jsxs)(`div`,{className:`border-4 border-dashed border-bambu-green rounded-xl p-12 text-center`,children:[(0,z.jsx)(Ne,{className:`w-16 h-16 mx-auto mb-4 text-bambu-green`}),(0,z.jsx)(`p`,{className:`text-2xl font-semibold text-white mb-2`,children:e(`fileManager.dropFilesHere`)}),(0,z.jsx)(`p`,{className:`text-bambu-gray`,children:e(`fileManager.releaseToUpload`)})]})}),(0,z.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,z.jsx)(Ie,{className:`w-7 h-7 text-bambu-green`}),e(`fileManager.title`)]}),(0,z.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`fileManager.subtitle`)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center bg-bambu-dark rounded-lg p-1`,children:[(0,z.jsx)(`button`,{onClick:()=>tr(`grid`),className:`p-1.5 rounded transition-colors ${G===`grid`?`bg-bambu-dark-secondary text-white`:`text-bambu-gray hover:text-white`}`,title:e(`fileManager.gridView`),children:(0,z.jsx)(k,{className:`w-4 h-4`})}),(0,z.jsx)(`button`,{onClick:()=>tr(`list`),className:`p-1.5 rounded transition-colors ${G===`list`?`bg-bambu-dark-secondary text-white`:`text-bambu-gray hover:text-white`}`,title:e(`fileManager.listView`),children:(0,z.jsx)(ee,{className:`w-4 h-4`})}),(0,z.jsx)(`button`,{onClick:()=>tr(`columns`),className:`p-1.5 rounded transition-colors ${G===`columns`?`bg-bambu-dark-secondary text-white`:`text-bambu-gray hover:text-white`}`,title:e(`fileManager.columnsView`),children:(0,z.jsx)(b,{className:`w-4 h-4`})})]}),(0,z.jsxs)(P,{variant:`secondary`,onClick:()=>Rn.mutate(),disabled:Rn.isPending||!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?e(`fileManager.generateThumbnailsForMissing`):e(`fileManager.noPermissionGenerateThumbnail`),children:[Rn.isPending?(0,z.jsx)(j,{className:`w-4 h-4 mr-2 animate-spin`}):(0,z.jsx)(Fe,{className:`w-4 h-4 mr-2`}),e(`fileManager.generateThumbnails`)]}),(0,z.jsxs)(P,{variant:`secondary`,onClick:()=>le(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?e(`fileManager.linkExternalFolder`):e(`fileManager.noPermissionCreateFolder`),children:[(0,z.jsx)(it,{className:`w-4 h-4 mr-2`}),e(`fileManager.linkExternal`)]}),(0,z.jsxs)(P,{variant:`secondary`,onClick:()=>ie(!0),disabled:!qn,title:r(`library:upload`)?Jn:e(`fileManager.noPermissionCreateFolder`),children:[(0,z.jsx)(rt,{className:`w-4 h-4 mr-2`}),e(`fileManager.newFolder`)]}),(0,z.jsxs)(P,{variant:`secondary`,onClick:()=>Re(!0),title:e(`fileManager.tags.manageTitle`),children:[(0,z.jsx)(xe,{className:`w-4 h-4 mr-2`}),e(`fileManager.tags.manage`)]}),r(`library:purge`)&&(0,z.jsxs)(P,{variant:`secondary`,onClick:()=>Pe(!0),title:e(`libraryPurge.headerTooltip`),children:[(0,z.jsx)(de,{className:`w-4 h-4 mr-2`}),e(`libraryPurge.headerButton`)]}),i(`library:delete_own`,`library:delete_all`)&&(0,z.jsxs)(Se,{to:`/files/trash`,className:`inline-flex items-center px-3 py-1.5 text-sm rounded bg-bambu-dark-secondary text-bambu-gray hover:text-white hover:bg-bambu-dark transition-colors`,title:e(`libraryTrash.headerTooltip`),children:[(0,z.jsx)(de,{className:`w-4 h-4 mr-2`}),e(`libraryTrash.headerButton`),typeof dn==`number`&&dn>0&&(0,z.jsx)(`span`,{className:`ml-1.5 px-1.5 py-0.5 text-xs rounded-full bg-bambu-green/20 text-bambu-green`,children:dn})]}),(0,z.jsxs)(P,{onClick:()=>I(!0),disabled:!qn,title:r(`library:upload`)?Jn:e(`fileManager.noPermissionUpload`),children:[(0,z.jsx)(Ne,{className:`w-4 h-4 mr-2`}),e(`common.upload`)]})]})]}),wn&&xn&&an&&(0,z.jsxs)(`div`,{className:`flex items-center gap-3 mb-4 p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg`,children:[(0,z.jsx)(re,{className:`w-5 h-5 text-amber-500 flex-shrink-0`}),(0,z.jsxs)(`div`,{className:`flex-1`,children:[(0,z.jsx)(`p`,{className:`text-sm text-amber-500 font-medium`,children:e(`fileManager.lowDiskSpaceWarning`)}),(0,z.jsx)(`p`,{className:`text-xs text-amber-500/80`,children:e(`fileManager.lowDiskSpaceDetails`,{free:oe(xn.disk_free_bytes),total:oe(xn.disk_total_bytes),threshold:an.library_disk_warning_gb})})]})]}),xn&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 sm:gap-6 mb-6 p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,z.jsx)(w,{className:`w-4 h-4 text-bambu-green`}),(0,z.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.files`),`:`]}),(0,z.jsx)(`span`,{className:`text-white font-medium`,children:xn.total_files})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,z.jsx)(Ie,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,z.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.folders`),`:`]}),(0,z.jsx)(`span`,{className:`text-white font-medium`,children:xn.total_folders})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,z.jsx)(O,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),(0,z.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.size`),`:`]}),(0,z.jsx)(`span`,{className:`text-white font-medium`,children:oe(xn.total_size_bytes)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm sm:ml-auto`,children:[(0,z.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.free`),`:`]}),(0,z.jsx)(`span`,{className:`font-medium ${wn?`text-amber-500`:`text-white`}`,children:oe(xn.disk_free_bytes)})]})]}),(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row gap-4 lg:gap-6 min-h-0`,children:[(0,z.jsx)(`div`,{className:`lg:hidden`,children:(0,z.jsxs)(`select`,{value:g===null?`__top:${y}`:String(g),onChange:e=>{let t=e.target.value;t.startsWith(`__top:`)?(_(null),x(t.slice(6))):_(parseInt(t,10))},className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg px-3 py-2.5 text-white focus:outline-none focus:border-bambu-green`,children:[(0,z.jsxs)(`option`,{value:`__top:internal`,children:[`📁 `,e(`fileManager.allFiles`)]}),ln?.some(e=>e.is_external)&&(0,z.jsxs)(`option`,{value:`__top:external`,children:[`🔗 `,e(`fileManager.allExternal`)]}),q&&(()=>{let e=(t,n=0)=>{let r=[];for(let i of t)r.push({id:i.id,name:i.name,fileCount:i.file_count,depth:n}),i.children.length>0&&r.push(...e(i.children,n+1));return r};return e(q).map(e=>(0,z.jsxs)(`option`,{value:e.id,children:[`│ `.repeat(e.depth),`📂 `,e.name,` `,e.fileCount>0?`(${e.fileCount})`:``]},e.id))})()]})}),(0,z.jsxs)(`div`,{ref:Gt,"data-testid":`folder-sidebar`,className:`hidden lg:flex flex-shrink-0 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary overflow-hidden flex-col relative`,style:{width:`${Vt}px`},children:[(0,z.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-1.5 cursor-col-resize z-10 group/resize flex items-center justify-center transition-colors ${Ut?`bg-bambu-green`:`hover:bg-bambu-green/50`}`,onMouseDown:e=>{e.preventDefault(),Wt(!0)},onDoubleClick:()=>{Ht(256),localStorage.setItem(`library-sidebar-width`,`256`)},title:e(`fileManager.dragToResizeTooltip`),children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-1 opacity-0 group-hover/resize:opacity-100 transition-opacity ${Ut?`opacity-100`:``}`,children:[(0,z.jsx)(`div`,{className:`w-0.5 h-0.5 rounded-full bg-white/70`}),(0,z.jsx)(`div`,{className:`w-0.5 h-0.5 rounded-full bg-white/70`}),(0,z.jsx)(`div`,{className:`w-0.5 h-0.5 rounded-full bg-white/70`})]})}),(0,z.jsxs)(`div`,{className:`p-3 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,z.jsx)(`h2`,{className:`text-sm font-medium text-white`,children:e(`fileManager.folders`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsxs)(`select`,{value:Lt,onChange:e=>{let t=e.target.value===`activity`?`activity`:`name`;Rt(t),localStorage.setItem(`library-folder-sort-field`,t)},className:`text-xs px-1 py-0.5 rounded bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray focus:outline-none focus:border-bambu-green`,title:e(`fileManager.folderSort`),"aria-label":e(`fileManager.folderSort`),children:[(0,z.jsx)(`option`,{value:`name`,children:e(`fileManager.folderSortByName`)}),(0,z.jsx)(`option`,{value:`activity`,children:e(`fileManager.folderSortByActivity`)})]}),(0,z.jsx)(`button`,{onClick:()=>{let e=zt===`asc`?`desc`:`asc`;Bt(e),localStorage.setItem(`library-folder-sort-direction`,e)},className:`text-bambu-gray hover:text-white hover:bg-bambu-dark p-1 rounded transition-colors`,title:e(zt===`asc`?`fileManager.ascending`:`fileManager.descending`),"aria-label":e(zt===`asc`?`fileManager.ascending`:`fileManager.descending`),children:zt===`asc`?(0,z.jsx)(et,{className:`w-3.5 h-3.5`}):(0,z.jsx)($e,{className:`w-3.5 h-3.5`})}),(0,z.jsx)(`button`,{onClick:()=>{let e=!Ft;It(e),localStorage.setItem(`library-collapse-folders`,String(e))},className:`text-xs px-1.5 py-0.5 rounded transition-colors ${Ft?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark`}`,title:e(Ft?`fileManager.expandFoldersByDefault`:`fileManager.collapseFoldersByDefault`),children:e(`fileManager.collapse`)}),(0,z.jsx)(`button`,{onClick:()=>{let e=!Nt;Pt(e),localStorage.setItem(`library-wrap-folders`,String(e))},className:`text-xs px-1.5 py-0.5 rounded transition-colors ${Nt?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark`}`,title:e(Nt?`fileManager.disableTextWrapping`:`fileManager.enableTextWrapping`),children:e(`fileManager.wrap`)})]})]}),(0,z.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors ${g===null&&y===`internal`?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark text-white`}`,onClick:()=>{_(null),x(`internal`)},children:[(0,z.jsx)(S,{className:`w-4 h-4`}),(0,z.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allFiles`)})]}),ln?.some(e=>e.is_external)&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors ${g===null&&y===`external`?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark text-white`}`,onClick:()=>{_(null),x(`external`)},children:[(0,z.jsx)(it,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,z.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allExternal`)})]}),q?.map(t=>(0,z.jsx)(xl,{folder:t,selectedFolderId:g,onSelect:_,onDelete:e=>st({type:`folder`,id:e}),onLink:Ye,onRename:e=>St({type:`folder`,id:e.id,name:e.name}),onToggleShared:Ln,wrapNames:Nt,defaultExpanded:!Ft,showModified:nn,hasPermission:r,t:e},`${t.id}-${Ft?`c`:`e`}`))]})]}),(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row min-w-0 min-h-0 gap-4 lg:gap-6`,children:[(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 min-h-0`,children:[mn.length>0&&(0,z.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 p-2 sm:p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary`,children:[(0,z.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium shrink-0`,children:e(`fileManager.tags.filterLabel`)}),mn.map(e=>{let t=We.includes(e.id);return(0,z.jsxs)(`button`,{type:`button`,onClick:()=>gn(e.id),className:t?`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bambu-green/20 text-bambu-green border border-bambu-green/40 hover:bg-bambu-green/30 transition-colors`:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bambu-dark text-bambu-gray border border-bambu-dark-tertiary hover:text-white hover:border-bambu-green/40 transition-colors`,title:e.name,children:[(0,z.jsx)(xe,{className:`w-3 h-3`}),(0,z.jsx)(`span`,{children:e.name}),t&&(0,z.jsx)(ae,{className:`w-3 h-3`})]},e.id)}),We.length>0&&(0,z.jsx)(`button`,{type:`button`,onClick:()=>qe([]),className:`ml-auto text-xs text-bambu-gray hover:text-white shrink-0`,children:e(`fileManager.tags.clearAll`)})]}),Y?.is_external&&(0,z.jsxs)(`div`,{className:`flex items-center gap-3 mb-4 p-3 bg-purple-50 dark:bg-purple-500/10 border border-purple-300 dark:border-purple-500/30 rounded-lg`,children:[(0,z.jsx)(it,{className:`w-5 h-5 text-purple-600 dark:text-purple-400 flex-shrink-0`}),(0,z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium text-purple-700 dark:text-purple-300`,children:e(`fileManager.externalFolder`)}),Y.external_readonly&&(0,z.jsxs)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 flex items-center gap-1`,children:[(0,z.jsx)(M,{className:`w-3 h-3`}),e(`fileManager.readOnly`)]})]}),(0,z.jsx)(`p`,{className:`text-xs text-bambu-gray truncate font-mono`,title:Y.external_path||``,children:Y.external_path})]}),(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:()=>g&&Dn.mutate(g),disabled:Dn.isPending,title:e(`fileManager.scanFolder`),children:[Dn.isPending?(0,z.jsx)(j,{className:`w-4 h-4 animate-spin`}):(0,z.jsx)(L,{className:`w-4 h-4`}),(0,z.jsx)(`span`,{className:`ml-1.5`,children:e(`fileManager.scanFolder`)})]})]}),yn&&yn.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:gap-3 mb-4 p-2 sm:p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary sticky top-0 z-10 lg:static`,children:[(0,z.jsxs)(`div`,{className:`relative w-full sm:w-auto sm:flex-1 sm:max-w-xs`,children:[(0,z.jsx)(N,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,z.jsx)(`input`,{type:`text`,placeholder:e(`fileManager.searchFiles`),value:Kt,onChange:e=>qt(e.target.value),className:`w-full pl-9 pr-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`}),fn&&(0,z.jsx)(`span`,{className:`absolute -bottom-4 left-0 text-[10px] text-bambu-gray whitespace-nowrap`,title:e(`fileManager.searchSubfoldersHint`),children:e(`fileManager.searchSubfoldersHint`)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(E,{className:`w-4 h-4 text-bambu-gray hidden sm:block`}),(0,z.jsxs)(`select`,{value:Jt,onChange:e=>Yt(e.target.value),className:`bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1.5 text-sm text-white focus:outline-none focus:border-bambu-green`,children:[(0,z.jsx)(`option`,{value:`all`,children:e(`fileManager.allTypes`)}),Cn.map(e=>(0,z.jsx)(`option`,{value:e,children:e.toUpperCase()},e))]})]}),f&&(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(`input`,{type:`text`,placeholder:e(`fileManager.filterByUser`,{defaultValue:`Filter by user`}),value:Xt,onChange:e=>Zt(e.target.value),list:`usernames-list`,className:`w-32 sm:w-40 px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green ${Xt?`pr-7`:``}`,style:Xt?{WebkitAppearance:`none`,MozAppearance:`textfield`}:void 0}),Xt&&(0,z.jsx)(`button`,{onClick:()=>Zt(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white z-10`,children:(0,z.jsx)(ae,{className:`w-3 h-3`})}),(0,z.jsx)(`datalist`,{id:`usernames-list`,children:Sn?.map(e=>(0,z.jsx)(`option`,{value:e.username},e.id))})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(`select`,{value:Qt,onChange:e=>{let t=e.target.value;$t(t),localStorage.setItem(`library-sort-field`,t)},className:`bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1.5 text-sm text-white focus:outline-none focus:border-bambu-green`,children:[(0,z.jsx)(`option`,{value:`name`,children:e(`common.name`)}),(0,z.jsx)(`option`,{value:`date`,children:e(`common.date`)}),(0,z.jsx)(`option`,{value:`size`,children:e(`fileManager.size`)}),(0,z.jsx)(`option`,{value:`type`,children:e(`common.type`)}),(0,z.jsx)(`option`,{value:`prints`,children:e(`fileManager.prints`)})]}),(0,z.jsx)(`button`,{onClick:()=>tn(e=>{let t=e===`asc`?`desc`:`asc`;return localStorage.setItem(`library-sort-direction`,t),t}),className:`p-1.5 rounded bg-bambu-dark border border-bambu-dark-tertiary hover:border-bambu-green transition-colors`,title:e(en===`asc`?`fileManager.ascending`:`fileManager.descending`),children:en===`asc`?(0,z.jsx)(et,{className:`w-4 h-4 text-white`}):(0,z.jsx)($e,{className:`w-4 h-4 text-white`})}),(0,z.jsx)(`button`,{onClick:()=>rn(e=>{let t=!e;return localStorage.setItem(`library-show-modified`,String(t)),t}),className:`p-1.5 rounded bg-bambu-dark border transition-colors ${nn?`border-bambu-green text-bambu-green`:`border-bambu-dark-tertiary text-white hover:border-bambu-green`}`,title:e(nn?`fileManager.hideModified`:`fileManager.showModified`),"aria-pressed":nn,children:(0,z.jsx)(tt,{className:`w-4 h-4`})})]}),(Kt||Jt!==`all`||Xt)&&(0,z.jsx)(`span`,{className:`text-sm text-bambu-gray hidden sm:inline`,children:e(`fileManager.resultsCount`,{showing:J.length,total:yn.length})})]}),(J.length>0||C.length>0)&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-4 p-2 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary sticky top-[52px] z-10 lg:static`,children:[Un?(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:Wn,children:[(0,z.jsx)(ge,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.deselectAll`)})]}):(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:Hn,children:[(0,z.jsx)(Ce,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.selectAll`)})]}),C.length>0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-sm text-bambu-gray ml-2`,children:e(`fileManager.selected`,{count:C.length})}),(0,z.jsx)(`div`,{className:`hidden sm:block flex-1`}),(0,z.jsxs)(`div`,{className:`w-full sm:w-auto flex flex-wrap items-center gap-2 mt-2 sm:mt-0`,children:[cr&&(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:()=>Bn(cr),disabled:!r(`library:read`),title:r(`library:read`)?void 0:e(`fileManager.noPermissionPreview`),children:[(0,z.jsx)(we,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.preview.open`)})]}),lr.length>=1&&(0,z.jsxs)(P,{variant:`primary`,size:`sm`,onClick:()=>ut(lr[0]),disabled:!r(`queue:create`),title:r(`queue:create`)?void 0:e(`fileManager.noPermissionAddToQueue`),children:[(0,z.jsx)(me,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:lr.length>1?e(`fileManager.variants.printAlternatives`,{count:lr.length}):e(`common.print`)})]}),lr.length>=2&&!lr.some(e=>e.variant_group_id)&&(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:()=>An.mutate(lr.map(e=>e.id)),disabled:An.isPending||!i(`library:update_own`,`library:update_all`),title:e(`fileManager.variants.groupTooltip`),children:[(0,z.jsx)(je,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.variants.groupAction`)})]}),$.length>=1&&(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:()=>gt(!0),disabled:!r(`library:upload`),title:e(`fileManager.combine.tooltip`),children:[(0,z.jsx)(nt,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.combine.action`)})]}),(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:()=>fe(!0),disabled:!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?void 0:e(`fileManager.noPermissionMoveFiles`),children:[(0,z.jsx)(at,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.move`)})]}),(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:()=>Ve(!0),disabled:!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?e(`fileManager.tags.bulkTooltip`):e(`fileManager.tags.noPermission`),children:[(0,z.jsx)(xe,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.tags.tagAction`)})]}),(0,z.jsxs)(P,{variant:`danger`,size:`sm`,onClick:()=>{C.length===1?st({type:`file`,id:C[0]}):st({type:`bulk`,id:0,count:C.length})},disabled:!i(`library:delete_own`,`library:delete_all`),title:i(`library:delete_own`,`library:delete_all`)?void 0:e(`fileManager.noPermissionDeleteFiles`),children:[(0,z.jsx)(de,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.delete`)})]}),(0,z.jsxs)(P,{variant:`secondary`,size:`sm`,onClick:Wn,children:[(0,z.jsx)(ae,{className:`w-4 h-4 sm:mr-1`}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.clear`)})]})]})]})]}),rr&&G!==`columns`?(0,z.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,z.jsx)(j,{className:`w-8 h-8 animate-spin text-bambu-green`}),(0,z.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`fileManager.loadingFiles`)})]})}):G===`columns`?(0,z.jsx)(`div`,{ref:jt,tabIndex:0,"aria-label":e(`fileManager.columnsView`),onKeyDown:hr,className:`flex-1 min-h-0 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary overflow-x-auto outline-none focus-visible:ring-1 focus-visible:ring-bambu-green/50`,"data-testid":`columns-view`,children:(0,z.jsxs)(`div`,{className:`h-full min-h-[16rem] flex divide-x divide-bambu-dark-tertiary`,children:[!_n&&X.map(t=>{let n=or.get(t.key),i=!!(n&&(n.loading||n.files.length>0));return(0,z.jsxs)(`div`,{"data-testid":`columns-level-${t.key}`,className:`${i?`w-[26rem]`:`w-64`} flex-shrink-0 overflow-y-auto py-1`,children:[t.items.map(n=>{let i=g===n.id;return(0,z.jsxs)(`div`,{"data-folder-id":n.id,className:`group flex items-center pr-1.5 transition-colors ${t.activeId===n.id?`bg-bambu-green/20 text-bambu-green`:i?`bg-bambu-green/10 text-white`:`text-white hover:bg-bambu-dark`}`,children:[(0,z.jsxs)(`button`,{type:`button`,tabIndex:-1,onClick:()=>{Mt(null),_(n.id)},className:`flex-1 min-w-0 flex items-center gap-2 pl-3 pr-1 py-2.5 text-left text-sm`,title:n.name,children:[n.is_external?(0,z.jsx)(it,{className:`w-5 h-5 flex-shrink-0 text-purple-600 dark:text-purple-400`}):(0,z.jsx)(Ie,{className:`w-5 h-5 flex-shrink-0 text-bambu-green`}),(0,z.jsx)(`span`,{className:`flex-1 truncate`,children:n.name}),(n.project_id||n.archive_id)&&(0,z.jsx)(A,{className:`w-3.5 h-3.5 flex-shrink-0 text-blue-700 dark:text-blue-400`}),n.shared&&(0,z.jsx)(`span`,{title:e(`fileManager.sharedFolder`),children:(0,z.jsx)(pe,{className:`w-3.5 h-3.5 flex-shrink-0 text-bambu-gray`})}),n.is_external&&n.external_readonly&&(0,z.jsx)(M,{className:`w-3.5 h-3.5 flex-shrink-0 text-amber-600 dark:text-amber-400`}),n.file_count>0&&(0,z.jsx)(`span`,{className:`text-xs text-bambu-gray flex-shrink-0`,children:n.file_count}),n.children.length>0&&(0,z.jsx)(_e,{className:`w-4 h-4 flex-shrink-0 text-bambu-gray`})]}),(0,z.jsx)(bl,{folder:n,onDelete:e=>st({type:`folder`,id:e}),onLink:Ye,onRename:e=>St({type:`folder`,id:e.id,name:e.name}),onToggleShared:Ln,hasPermission:r,revealOnHover:!i,tabIndex:i?0:-1,t:e})]},n.id)}),n?.loading&&(0,z.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,"aria-hidden":`true`,children:`…`}),n&&!n.loading&&n.files.map(t=>(0,z.jsx)(wl,{file:t,isSelected:C.includes(t.id),isFocused:K===t.id,showModified:nn,thumbnailVersion:Ct[t.id],onSelect:e=>{Mt(e.id),Vn(e.id)},onOpen:Bn,actionProps:nr,t:e},t.id))]},t.key)}),(0,z.jsx)(`div`,{className:`flex-1 min-w-[28rem] overflow-y-auto py-1`,"data-testid":`columns-files-pane`,children:bn?(0,z.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,z.jsx)(j,{className:`w-5 h-5 animate-spin text-bambu-green`})}):J.length===0?(0,z.jsx)(`div`,{className:`h-full flex items-center justify-center px-4 text-sm text-bambu-gray text-center`,children:(yn?.length??0)>0?e(`fileManager.noMatchingFiles`):g===null?vn&&X[0].items.length>0?e(`fileManager.noFilesOutsideFolders`):e(y===`external`?`fileManager.externalIsEmpty`:`fileManager.noFilesYet`):e(`fileManager.folderIsEmpty`)}):J.map(t=>(0,z.jsx)(wl,{file:t,isSelected:C.includes(t.id),isFocused:K===t.id,showModified:nn,thumbnailVersion:Ct[t.id],onSelect:e=>{Mt(e.id),Vn(e.id)},onOpen:Bn,actionProps:nr,t:e},t.id))})]})}):yn?.length===0?(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center`,children:[(0,z.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-2xl mb-4`,children:(0,z.jsx)(S,{className:`w-12 h-12 text-bambu-gray/50`})}),(0,z.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:e(g===null?y===`external`?`fileManager.externalIsEmpty`:`fileManager.noFilesYet`:`fileManager.folderIsEmpty`)}),(0,z.jsx)(`p`,{className:`text-bambu-gray text-center max-w-md mb-6`,children:e(g===null?y===`external`?`fileManager.externalEmptyDescription`:`fileManager.noFilesDescription`:`fileManager.folderEmptyDescription`)}),(0,z.jsxs)(P,{onClick:()=>I(!0),disabled:!qn,title:r(`library:upload`)?Jn:e(`fileManager.noPermissionUpload`),children:[(0,z.jsx)(Oe,{className:`w-4 h-4 mr-2`}),e(`fileManager.uploadFiles`)]})]}):J.length===0?(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center`,children:[(0,z.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-2xl mb-4`,children:(0,z.jsx)(N,{className:`w-12 h-12 text-bambu-gray/50`})}),(0,z.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:e(`fileManager.noMatchingFiles`)}),(0,z.jsx)(`p`,{className:`text-bambu-gray text-center max-w-md mb-6`,children:e(`fileManager.noMatchingFilesDescription`)}),(0,z.jsx)(P,{variant:`secondary`,onClick:()=>{qt(``),Yt(`all`)},children:e(`fileManager.clearFilters`)})]}):G===`grid`?(0,z.jsx)(`div`,{className:`flex-1 lg:overflow-y-auto`,children:(0,z.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-4`,children:J.map(t=>(0,z.jsx)(Sl,{file:t,isSelected:C.includes(t.id),t:e,onSelect:Vn,onDelete:e=>st({type:`file`,id:e}),onDownload:Qn,onPrint:ut,onSlice:pt,onOpenInSlicer:sn,desktopSlicer:on,onRunPipeline:bt,useSlicerApi:an?.use_slicer_api??!1,canSlice:cn(),onPreview:Bn,onRename:e=>St({type:`file`,id:e.id,name:e.filename}),onDetails:U,onGenerateThumbnail:e=>zn.mutate(e.id),onTagClick:gn,thumbnailVersion:Ct[t.id],hasPermission:r,canModify:s,authEnabled:f,showModified:nn},t.id))})}):(0,z.jsx)(`div`,{className:`flex-1 lg:overflow-y-auto`,children:(0,z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary overflow-x-auto`,children:[(0,z.jsxs)(`div`,{"data-testid":`file-list-grid-header`,className:`hidden sm:grid ${dl(f)} ${fl} gap-4 px-4 py-2 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary text-xs text-bambu-gray font-medium`,children:[(0,z.jsx)(`div`,{className:`w-6`}),(0,z.jsx)(`div`,{children:e(`common.name`)}),f&&(0,z.jsx)(`div`,{children:e(`fileManager.uploadedBy`,{defaultValue:`Uploaded By`})}),(0,z.jsx)(`div`,{children:e(`common.type`)}),(0,z.jsx)(`div`,{children:e(`fileManager.size`)}),(0,z.jsx)(`div`,{children:e(`fileManager.prints`)}),(0,z.jsx)(`div`,{children:e(`fileManager.tags.title`)}),(0,z.jsx)(`div`,{})]}),J.map(t=>(0,z.jsxs)(`div`,{"data-testid":`file-list-grid-row`,className:`grid ${dl(f)} ${fl} gap-4 px-4 py-3 items-center border-b border-bambu-dark-tertiary last:border-b-0 cursor-pointer hover:bg-bambu-dark/50 transition-colors ${C.includes(t.id)?`bg-bambu-green/10`:``}`,onClick:()=>Vn(t.id),onDoubleClick:()=>Bn(t),children:[(0,z.jsx)(`div`,{className:`w-5 h-5 rounded border-2 flex items-center justify-center ${C.includes(t.id)?`bg-bambu-green border-bambu-green`:`border-bambu-gray/50`}`,children:C.includes(t.id)&&(0,z.jsx)(`div`,{className:`w-2 h-2 bg-white rounded-sm`})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,z.jsxs)(`div`,{className:`relative group/thumb`,children:[(0,z.jsx)(`div`,{className:`w-10 h-10 rounded bg-bambu-dark flex-shrink-0 overflow-hidden`,children:t.thumbnail_path?(0,z.jsx)(`img`,{src:`${a.getLibraryFileThumbnailUrl(t.id)}${Ct[t.id]?(a.getLibraryFileThumbnailUrl(t.id).includes(`?`)?`&`:`?`)+`v=${Ct[t.id]}`:``}`,loading:`lazy`,alt:``,className:`w-full h-full object-cover`}):(0,z.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,z.jsx)(nl,{fileType:t.file_type,className:`w-5 h-5 text-bambu-gray/50`})})}),t.thumbnail_path&&(0,z.jsx)(`div`,{className:`absolute left-0 top-full mt-2 z-50 hidden group-hover/thumb:block`,children:(0,z.jsx)(`div`,{className:`w-48 h-48 rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary shadow-xl overflow-hidden`,children:(0,z.jsx)(`img`,{src:`${a.getLibraryFileThumbnailUrl(t.id)}${Ct[t.id]?(a.getLibraryFileThumbnailUrl(t.id).includes(`?`)?`&`:`?`)+`v=${Ct[t.id]}`:``}`,loading:`lazy`,alt:t.filename,className:`w-full h-full object-contain`})})})]}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,z.jsx)(`span`,{className:`text-sm text-white truncate`,children:t.print_name||t.filename}),t.external_url&&(0,z.jsx)(`a`,{href:t.external_url,target:`_blank`,rel:`noopener noreferrer`,...al,className:`flex-shrink-0 text-bambu-gray hover:text-bambu-green`,title:e(`fileManager.details.openLink`),"aria-label":e(`fileManager.details.openLink`),children:(0,z.jsx)(Me,{className:`w-3.5 h-3.5`})}),t.has_notes&&(0,z.jsx)(`span`,{className:`flex-shrink-0 text-bambu-gray`,title:e(`fileManager.details.hasNotes`),"aria-label":e(`fileManager.details.hasNotes`),children:(0,z.jsx)(ne,{className:`w-3.5 h-3.5`})}),(t.photo_count??0)>0&&(0,z.jsxs)(`span`,{className:`flex-shrink-0 flex items-center gap-0.5 text-xs text-bambu-gray`,title:e(`fileManager.details.photoCount`,{count:t.photo_count}),children:[(0,z.jsx)(be,{className:`w-3.5 h-3.5`}),t.photo_count]})]}),nn&&(0,z.jsxs)(`div`,{className:`text-xs text-bambu-gray flex items-center gap-1 mt-0.5`,title:e(`fileManager.lastModified`),children:[(0,z.jsx)(tt,{className:`w-3 h-3 flex-shrink-0`}),(0,z.jsx)(`span`,{className:`truncate`,children:se(t.fs_modified_at??t.created_at)})]})]})]}),f&&(0,z.jsx)(`div`,{className:`text-sm text-bambu-gray flex items-center gap-1`,children:t.created_by_username?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(ye,{className:`w-3 h-3`}),(0,z.jsx)(`span`,{className:`truncate`,children:t.created_by_username})]}):`-`}),(0,z.jsx)(`div`,{children:(0,z.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded font-medium ${ll(t.file_type)}`,children:t.file_type.toUpperCase()})}),(0,z.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:oe(t.file_size)}),(0,z.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:t.print_count>0?`${t.print_count}x`:`-`}),(0,z.jsx)(`div`,{className:`min-w-0`,...al,children:!t.tags||t.tags.length===0?(0,z.jsx)(`span`,{className:`text-xs text-bambu-gray/50`,children:`-`}):(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.tags.map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>gn(e.id),className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] bg-bambu-green/10 text-bambu-green hover:bg-bambu-green/20 transition-colors max-w-full`,title:e.name,children:[(0,z.jsx)(xe,{className:`w-2.5 h-2.5 flex-shrink-0`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})}),(0,z.jsx)(Cl,{file:t,...nr})]},t.id))]})})]}),g!==null&&(0,z.jsx)(Hc,{folderId:g})]})]}),te&&(0,z.jsx)(pl,{parentId:g,onClose:()=>ie(!1),onSave:e=>Tn.mutate(e),isLoading:Tn.isPending,t:e}),ce&&(0,z.jsx)(ml,{onClose:()=>le(!1),onSave:e=>En.mutate(e),isLoading:En.isPending,t:e}),ue&&ln&&(0,z.jsx)(vl,{folders:ln,selectedFiles:C,currentFolderId:g,onClose:()=>fe(!1),onMove:e=>Mn.mutate({fileIds:C,folderId:e}),isLoading:Mn.isPending,t:e}),F&&(0,z.jsx)(Xe,{folderId:g,onClose:()=>{I(!1),ve([])},onUploadComplete:Gn,initialFiles:he.length>0?he:void 0}),Te&&(0,z.jsx)(Kc,{onClose:()=>Pe(!1)}),(0,z.jsx)(Uc,{open:Le,onClose:()=>Re(!1),onPickTag:e=>{We.includes(e)||qe(t=>[...t,e])}}),(0,z.jsx)(mt,{open:Be,fileIds:C,onClose:()=>Ve(!1)}),Je&&(0,z.jsx)(yl,{folder:Je,onClose:()=>Ye(null),onLink:e=>Nn.mutate({id:Je.id,data:e}),isLoading:Nn.isPending,t:e}),ot&&(0,z.jsx)(ke,{title:ot.type===`folder`?e(`fileManager.deleteFolder`):ot.type===`bulk`?e(`fileManager.deleteFilesCount`,{count:ot.count}):e(`fileManager.deleteFile`),message:ot.type===`folder`?e(`fileManager.deleteFolderConfirm`):ot.type===`bulk`?e(`fileManager.deleteFilesConfirm`,{count:ot.count}):e(`fileManager.deleteFileConfirm`),confirmText:e(`common.delete`),variant:`danger`,isLoading:er,loadingText:e(`fileManager.deleting`),onConfirm:$n,onCancel:()=>st(null)}),ct&&(!ct.variant_group_id||ur!==void 0)&&(0,z.jsx)(Ae,{mode:`create`,libraryFileId:dr?.[0]?.id??ct.id,variantFiles:dr,archiveName:dr&&dr.length>1?`${dr[0].filename} ${e(`common.plusNMore`,{count:dr.length-1})}`:ct.print_name||ct.filename,onClose:()=>ut(null),onSuccess:()=>{ut(null),T([]),t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`queue`]}),t.invalidateQueries({queryKey:[`archives`]})}}),dt&&(0,z.jsx)(D,{source:{kind:`libraryFile`,id:dt.id,filename:dt.filename},onClose:()=>pt(null)}),ht&&$.length>0&&(0,z.jsx)(ft,{files:$,folderId:g,canSlice:!!an?.use_slicer_api&&cn(),onClose:()=>gt(!1),onCombined:(e,t)=>{gt(!1),T([]),t&&vt({id:e.id,filename:e.filename})}}),_t&&(0,z.jsx)(D,{source:{kind:`libraryFile`,id:_t.id,filename:_t.filename},onClose:()=>vt(null),defaultAutoArrange:!0}),yt&&(0,z.jsx)(Ue,{source:{kind:`libraryFile`,id:yt.id,filename:yt.filename},onClose:()=>bt(null)}),Tt&&(0,z.jsx)(lt,{libraryFileId:Tt.id,title:Tt.print_name||Tt.filename,fileType:Tt.file_type,onClose:()=>B(null),onSnapshot:Zc(Tt.file_type)?Zn(Tt):void 0,onSliceWithBambuddy:Qe(Tt,!0,on)&&r(`library:upload`)?()=>{let e=Tt;B(null),pt(e)}:void 0}),(Et||V||W)&&(0,z.jsxs)(R.Suspense,{fallback:null,children:[Et&&(0,z.jsx)(qc,{libraryFileId:Et.id,filename:Et.print_name||Et.filename,fileSize:Et.file_size,onClose:()=>Dt(null),onSnapshot:Zn(Et)}),V&&(0,z.jsx)(Jc,{libraryFileId:V.id,filename:V.print_name||V.filename,fileType:V.file_type,fileSize:V.file_size,onClose:()=>H(null),onSnapshot:Zn(V)}),W&&(0,z.jsx)(Yc,{libraryFileId:W.id,filename:W.print_name||W.filename,fileSize:W.file_size,onClose:()=>kt(null)})]}),Ot&&(0,z.jsx)(Wc,{file:Ot,canEdit:s(`library`,`update`,Ot.created_by_id),onClose:()=>U(null)}),xt&&(0,z.jsx)(_l,{type:xt.type,currentName:xt.name,onClose:()=>St(null),onSave:e=>{xt.type===`file`?Pn.mutate({id:xt.id,filename:e}):Fn.mutate({id:xt.id,name:e})},isLoading:Pn.isPending||Fn.isPending,t:e})]})}export{Tl as FileManagerPage}; \ No newline at end of file diff --git a/static/assets/FileUploadModal-AIFgu8X7.js b/static/assets/FileUploadModal-AIFgu8X7.js new file mode 100644 index 000000000..6ed6cc875 --- /dev/null +++ b/static/assets/FileUploadModal-AIFgu8X7.js @@ -0,0 +1,2 @@ +import{i as e,r as t,t as n}from"./chunk-aKtaBQYM.js";import{C as r,D as i,a,l as o,w as s}from"./client-DnySrlFv.js";import{n as c}from"./info-ROUoQhJR.js";import{r as l}from"./ToastContext-BRX0SW3C.js";import{n as u}from"./ContextMenu-Bt5_A0ZU.js";import{t as d}from"./loader-circle-BEmFtawu.js";import{t as f}from"./x-DR-Trv6U.js";import{n as p,t as m}from"./zoom-out-DNNe6DMN.js";import{t as h}from"./Button-DDr6eAFy.js";import{Gt as g,Jt as _,Ln as v,kt as y,un as b}from"./index-CovRLYqQ.js";import{A as x,C as S,D as C,E as w,O as T,S as E,T as D,_ as O,a as k,b as A,c as j,d as M,f as N,g as P,h as F,k as I,l as L,m as R,n as z,o as B,p as V,r as H,s as U,t as ee,u as W,v as G,w as K,x as q,y as J}from"./OrbitControls-Bbqf07B-.js";var Y=e(i(),1);function X(e,t=!1){let n=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),i=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=e[0].morphTargetsRelative,c=new j,l=0;for(let u=0;u>5&31)/31,a=(e>>10&31)/31)}for(let c=1;c<=3;c++){let l=n+c*12,u=e*3*3+(c-1)*3;p[u]=t.getFloat32(l,!0),p[u+1]=t.getFloat32(l+4,!0),p[u+2]=t.getFloat32(l+8,!0),m[u]=d,m[u+1]=f,m[u+2]=g,o&&(h.setRGB(r,i,a,C),s[u]=h.r,s[u+1]=h.g,s[u+2]=h.b)}}return f.setAttribute(`position`,new U(p,3)),f.setAttribute(`normal`,new U(m,3)),o&&(f.setAttribute(`color`,new U(s,3)),f.hasColors=!0,f.alpha=d),f}function i(e){let t=new j,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g,i=/solid\s(.+)/,a=0,o=RegExp(`vertex[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),s=RegExp(`normal[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),c=[],l=[],u=[],d=new x,f,p=0,m=0,h=0;for(;(f=n.exec(e))!==null;){m=h;let e=f[0],n=(f=i.exec(e))===null?``:f[1];for(u.push(n);(f=r.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=s.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=o.exec(n))!==null;)c.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),l.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let g=m,_=h-m;t.userData.groupNames=u,t.addGroup(g,_,p),p++}return t.setAttribute(`position`,new N(c,3)),t.setAttribute(`normal`,new N(l,3)),t}function a(e){return typeof e==`string`?e:new TextDecoder().decode(e)}function o(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(let t of e)t.dispose()}};function Z(e){return new q({color:0,emissive:16777215,emissiveIntensity:e})}var ie=e(n(((e,n)=>{(function(t){typeof e==`object`&&n!==void 0?n.exports=t():typeof define==`function`&&define.amd?define([],t):(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this).JSZip=t()})(function(){return function e(n,r,i){function a(s,c){if(!r[s]){if(!n[s]){var l=typeof t==`function`&&t;if(!c&&l)return l(s,!0);if(o)return o(s,!0);var u=Error(`Cannot find module '`+s+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=r[s]={exports:{}};n[s][0].call(d.exports,function(e){var t=n[s][1][e];return a(t||e)},d,d.exports,e,n,r,i)}return r[s].exports}for(var o=typeof t==`function`&&t,s=0;s>2,s=(3&t)<<4|n>>4,c=1>6:64,l=2>4,n=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),f[u++]=t,s!==64&&(f[u++]=n),c!==64&&(f[u++]=r);return f}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e(`./external`),i=e(`./stream/DataWorker`),a=e(`./stream/Crc32Probe`),o=e(`./stream/DataLengthProbe`);function s(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}s.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o(`data_length`)),t=this;return e.on(`end`,function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw Error(`Bug : uncompressed data size mismatch`)}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo(`compressedSize`,this.compressedSize).withStreamInfo(`uncompressedSize`,this.uncompressedSize).withStreamInfo(`crc32`,this.crc32).withStreamInfo(`compression`,this.compression)}},s.createWorkerFrom=function(e,t,n){return e.pipe(new a).pipe(new o(`uncompressedSize`)).pipe(t.compressWorker(n)).pipe(new o(`compressedSize`)).withStreamInfo(`compression`,t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e(`./stream/GenericWorker`);n.STORE={magic:`\0\0`,compressWorker:function(){return new r(`STORE compression`)},uncompressWorker:function(){return new r(`STORE decompression`)}},n.DEFLATE=e(`./flate`)},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e(`./utils`),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return e!==void 0&&e.length?r.getTypeOf(e)===`string`?function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r=null;r=typeof Promise<`u`?Promise:e(`lie`),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Uint32Array<`u`,i=e(`pako`),a=e(`./utils`),o=e(`./stream/GenericWorker`),s=r?`uint8array`:`array`;function c(e,t){o.call(this,`FlateWorker/`+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic=`\b\0`,a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new c(`Deflate`,e)},n.uncompressWorker=function(){return new c(`Inflate`,{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r=``;for(n=0;n>>=8;return r}function i(e,t,n,i,o,u){var d,f,p=e.file,m=e.compression,h=u!==s.utf8encode,g=a.transformTo(`string`,u(p.name)),_=a.transformTo(`string`,s.utf8encode(p.name)),v=p.comment,y=a.transformTo(`string`,u(v)),b=a.transformTo(`string`,s.utf8encode(v)),x=_.length!==p.name.length,S=b.length!==v.length,C=``,w=``,T=``,E=p.dir,D=p.date,O={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(O.crc32=e.crc32,O.compressedSize=e.compressedSize,O.uncompressedSize=e.uncompressedSize);var k=0;t&&(k|=8),h||!x&&!S||(k|=2048);var A=0,j=0;E&&(A|=16),o===`UNIX`?(j=798,A|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,E)):(j=20,A|=function(e){return 63&(e||0)}(p.dosPermissions)),d=D.getUTCHours(),d<<=6,d|=D.getUTCMinutes(),d<<=5,d|=D.getUTCSeconds()/2,f=D.getUTCFullYear()-1980,f<<=4,f|=D.getUTCMonth()+1,f<<=5,f|=D.getUTCDate(),x&&(w=r(1,1)+r(c(g),4)+_,C+=`up`+r(w.length,2)+w),S&&(T=r(1,1)+r(c(y),4)+b,C+=`uc`+r(T.length,2)+T);var M=``;return M+=` +\0`,M+=r(k,2),M+=m.magic,M+=r(d,2),M+=r(f,2),M+=r(O.crc32,4),M+=r(O.compressedSize,4),M+=r(O.uncompressedSize,4),M+=r(g.length,2),M+=r(C.length,2),{fileRecord:l.LOCAL_FILE_HEADER+M+g+C,dirRecord:l.CENTRAL_FILE_HEADER+r(j,2)+M+r(y.length,2)+`\0\0\0\0`+r(A,4)+r(i,4)+g+C+y}}var a=e(`../utils`),o=e(`../stream/GenericWorker`),s=e(`../utf8`),c=e(`../crc32`),l=e(`../signature`);function u(e,t,n,r){o.call(this,`ZipFileWorker`),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo(`string`,this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e(`./Uint8ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e(`./DataReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e(`./ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array;var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e(`../utils`),i=e(`../support`),a=e(`./ArrayReader`),o=e(`./StringReader`),s=e(`./NodeBufferReader`),c=e(`./Uint8ArrayReader`);t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),t!==`string`||i.uint8array?t===`nodebuffer`?new s(e):i.uint8array?new c(r.transformTo(`uint8array`,e)):new a(r.transformTo(`array`,e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER=`PK`,n.CENTRAL_FILE_HEADER=`PK`,n.CENTRAL_DIRECTORY_END=`PK`,n.ZIP64_CENTRAL_DIRECTORY_LOCATOR=`PK\x07`,n.ZIP64_CENTRAL_DIRECTORY_END=`PK`,n.DATA_DESCRIPTOR=`PK\x07\b`},{}],24:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../utils`);function a(e){r.call(this,`ConvertWorker to `+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../crc32`);function a(){r.call(this,`Crc32Probe`),this.withStreamInfo(`crc32`,0)}e(`../utils`).inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataLengthProbe for `+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataWorker`);var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=``,this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case`string`:e=this.data.substring(this.index,t);break;case`uint8array`:e=this.data.subarray(this.index,t);break;case`array`:case`nodebuffer`:e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||`default`,this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit(`data`,e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(`end`),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(`error`,e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(`error`,e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n `+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e(`../utils`),i=e(`./ConvertWorker`),a=e(`./GenericWorker`),o=e(`../base64`),s=e(`../support`),c=e(`../external`),l=null;if(s.nodestream)try{l=e(`../nodejs/NodejsStreamOutputAdapter`)}catch{}function u(e,t){return new c.Promise(function(n,i){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on(`data`,function(e,n){a.push(e),t&&t(n)}).on(`error`,function(e){a=[],i(e)}).on(`end`,function(){try{n(function(e,t,n){switch(e){case`blob`:return r.newBlob(r.transformTo(`arraybuffer`,t),n);case`base64`:return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var n,r=0,i=null,a=0;for(n=0;n`u`)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:`application/zip`}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=i.getBlob(`application/zip`).size===0}catch{n.blob=!1}}}try{n.nodestream=!!e(`readable-stream`).Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e(`./utils`),i=e(`./support`),a=e(`./nodejsUtils`),o=e(`./stream/GenericWorker`),s=Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;s[254]=s[254]=1;function l(){o.call(this,`utf-8 decode`),this.leftOver=null}function u(){o.call(this,`utf-8 encode`)}n.utf8encode=function(e){return i.nodebuffer?a.newBufferFrom(e,`utf-8`):function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo(`nodebuffer`,e).toString(`utf-8`):function(e){var t,n,i,a,o=e.length,c=Array(2*o);for(t=n=0;t>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?`uint8array`:`array`,e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?`uint8array`:`array`,e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+s[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e(`./support`),i=e(`./base64`),a=e(`./nodejsUtils`),o=e(`./external`);function s(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),e==0&&(this.dosPermissions=63&this.externalFileAttributes),e==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!==`/`||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||={};e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;n!==0;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e(`../utils/common`),a=e(`./trees`),o=e(`./adler32`),s=e(`./crc32`),c=e(`./messages`),l=0,u=4,d=0,f=-2,p=-1,m=4,h=2,g=8,_=9,v=286,y=30,b=19,x=2*v+1,S=15,C=3,w=258,T=w+C+1,E=42,D=113,O=1,k=2,A=3,j=4;function M(e,t){return e.msg=c[t],t}function N(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),n!==0&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function I(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function R(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function z(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+w,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+o]===m&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ac&&--i!=0);return o<=e.lookahead?o:e.lookahead}function B(e){var t,n,r,a,c,l,u,d,f,p,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-T)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);a+=m}if(e.strm.avail_in===0)break;if(l=e.strm,u=e.window,d=e.strstart+e.lookahead,f=a,p=void 0,p=l.avail_in,f=C)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-C,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(B(e),e.lookahead===0&&t===l)return O;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,I(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-T&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):(e.strstart>e.block_start&&(I(e,!1),e.strm.avail_out),O)}),new U(4,4,8,4,V),new U(4,5,16,8,V),new U(4,6,32,32,V),new U(4,4,16,16,H),new U(8,16,32,32,H),new U(8,16,128,128,H),new U(8,32,128,256,H),new U(32,128,258,1024,H),new U(32,258,258,4096,H)],n.deflateInit=function(e,t){return K(e,t,g,15,8,0)},n.deflateInit2=K,n.deflateReset=G,n.deflateResetKeep=W,n.deflateSetHeader=function(e,t){return e&&e.state&&e.state.wrap===2?(e.state.gzhead=t,d):f},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5>8&255),L(i,i.gzhead.time>>16&255),L(i,i.gzhead.time>>24&255),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(L(i,255&i.gzhead.extra.length),L(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(L(i,0),L(i,0),L(i,0),L(i,0),L(i,0),L(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),L(i,3),i.status=D);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:i.level===6?2:3)<<6,i.strstart!==0&&(p|=32),p+=31-p%31,i.status=D,R(i,p),i.strstart!==0&&(R(i,e.adler>>>16),R(i,65535&e.adler)),e.adler=1}if(i.status===69)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending!==i.pending_buf_size));)L(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(i.status===73)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.gzindex=0,i.status=91)}else i.status=91;if(i.status===91)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),F(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.status=103)}else i.status=103;if(i.status===103&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(e),i.pending+2<=i.pending_buf_size&&(L(i,255&e.adler),L(i,e.adler>>8&255),e.adler=0,i.status=D)):i.status=D),i.pending!==0){if(F(e),e.avail_out===0)return i.last_flush=-1,d}else if(e.avail_in===0&&N(t)<=N(n)&&t!==u)return M(e,-5);if(i.status===666&&e.avail_in!==0)return M(e,-5);if(e.avail_in!==0||i.lookahead!==0||t!==l&&i.status!==666){var m=i.strategy===2?function(e,t){for(var n;;){if(e.lookahead===0&&(B(e),e.lookahead===0)){if(t===l)return O;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):i.strategy===3?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===l)return O;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=C&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(n=a._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(I(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(I(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(I(e,!1),e.strm.avail_out===0)?O:k}(i,t):r[i.level].func(i,t);if(m!==A&&m!==j||(i.status=666),m===O||m===A)return e.avail_out===0&&(i.last_flush=-1),d;if(m===k&&(t===1?a._tr_align(i):t!==5&&(a._tr_stored_block(i,0,0,!1),t===3&&(P(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),F(e),e.avail_out===0))return i.last_flush=-1,d}return t===u?i.wrap<=0?1:(i.wrap===2?(L(i,255&e.adler),L(i,e.adler>>8&255),L(i,e.adler>>16&255),L(i,e.adler>>24&255),L(i,255&e.total_in),L(i,e.total_in>>8&255),L(i,e.total_in>>16&255),L(i,e.total_in>>24&255)):(R(i,e.adler>>>16),R(i,65535&e.adler)),F(e),0=n.w_size&&(s===0&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,B(n);n.lookahead>=C;){for(r=n.strstart,a=n.lookahead-(C-1);n.ins_h=(n.ins_h<>>=b=y>>>24,m-=b,(b=y>>>16&255)==0)E[a++]=65535&y;else{if(!(16&b)){if(!(64&b)){y=h[(65535&y)+(p&(1<>>=b,m-=b),m<15&&(p+=T[r++]<>>=b=y>>>24,m-=b,!(16&(b=y>>>16&255))){if(!(64&b)){y=g[(65535&y)+(p&(1<>>=b,m-=b,(b=a-o)>3,p&=(1<<(m-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=1&t.wrap),t.mode=f,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):d}function y(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,B,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg=`incorrect header check`,n.mode=30;break}if((15&b)!=8){e.msg=`unknown compression method`,n.mode=30;break}if(x-=4,F=8+(15&(b>>>=4)),n.wbits===0)n.wbits=F;else if(F>n.wbits){e.msg=`invalid window size`,n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>8&255,B[2]=b>>>16&255,B[3]=b>>>24&255,n.check=a(n.check,B,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>8),512&n.flags&&(B[0]=255&b,B[1]=b>>>8&255,n.check=a(n.check,B,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>>8&255,n.check=a(n.check,B,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),E&&(n.head&&(F=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,E,F)),512&n.flags&&(n.check=a(n.check,p,E,g)),v-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(v===0)break e;for(E=0;F=p[g+ E++],n.head&&F&&n.length<65536&&(n.head.name+=String.fromCharCode(F)),F&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(v===0)break e;v--,b+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,t!==6)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg=`invalid block type`,n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(v===0)break e;v--,b+=p[g++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},I=s(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid code lengths set`,n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=k,x-=k,n.lens[n.have++]=j;else{if(j===16){for(R=k+2;x>>=k,x-=k,n.have===0){e.msg=`invalid bit length repeat`,n.mode=30;break}F=n.lens[n.have-1],E=3+(3&b),b>>>=2,x-=2}else if(j===17){for(R=k+3;x>>=k)),b>>>=3,x-=3}else{for(R=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+E>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=30;break}for(;E--;)n.lens[n.have++]=F}}if(n.mode===30)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=30;break}if(n.lenbits=9,L={bits:n.lenbits},I=s(c,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,I){e.msg=`invalid literal/lengths set`,n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},I=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,I){e.msg=`invalid distances set`,n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=v&&258<=y){e.next_out=_,e.avail_out=y,e.next_in=g,e.avail_in=v,n.hold=b,n.bits=x,o(e,C),_=e.next_out,m=e.output,y=e.avail_out,g=e.next_in,p=e.input,v=e.avail_in,b=n.hold,x=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;A=(z=n.lencode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,n.length=j,A===0){n.mode=26;break}if(32&A){n.back=-1,n.mode=12;break}if(64&A){e.msg=`invalid literal/length code`,n.mode=30;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(z=n.distcode[b&(1<>>16&255,j=65535&z,!((k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&z,!(M+(k=z>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,64&A){e.msg=`invalid distance code`,n.mode=30;break}n.offset=j,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(R=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=30;break}n.mode=25;case 25:if(y===0)break e;if(E=C-y,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break}D=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),O=n.window}else O=m,D=_-n.offset,E=n.length;for(yv?(b=L[R+d[w]],N[P+d[w]]):(b=96,0),p=1<>k)+(m-=p)]=y<<24|b<<16|x|0,m!==0;);for(p=1<>=1;if(p===0?M=0:(M&=p-1,M+=p),w++,--F[C]==0){if(C===E)break;C=t[n+d[w]]}if(D>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>h-n?(e.bi_buf|=t<>h-e.bi_valid,e.bi_valid+=n-h):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function V(e,t,n){var r,i,a=Array(m+1),o=0;for(r=1;r<=m;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];s!==0&&(e[2*i]=B(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)W(e,a,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],W(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,W(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,_=0;for(a=0;a<=m;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&e.dyn_ltree[2*t]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&t!==-1?X(e,t,n,r):e.strategy===4||s===o?(R(e,2+ +!!r,3),G(e,T,E)):(R(e,4+ +!!r,3),function(e,t,n,r){var i;for(R(e,t-257,5),R(e,n-1,5),R(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,t===0?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(O[n]+l+1)]++,e.dyn_dtree[2*I(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){R(e,2,3),z(e,_,T),function(e){e.bi_valid===16?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){(function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},c=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n={}.toString.call(e.process)===`[object process]`?function(e){process.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}()?(a=`setImmediate$`+Math.random()+`$`,e.addEventListener?e.addEventListener(`message`,p,!1):e.attachEvent(`onmessage`,p),function(t){e.postMessage(a+t,`*`)}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){i.port2.postMessage(e)}):l&&`onreadystatechange`in l.createElement(`script`)?(r=l.documentElement,function(e){var t=l.createElement(`script`);t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(f,0,e)},u.setImmediate=function(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),r=0;r`u`?e===void 0?this:e:self)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{}]},{},[10])(10)})}))(),1),Q=r(),ae=null,oe=0,$=new Map;function se(e){for(let t of $.values())t.reject(Error(e));$.clear()}function ce(){if(!ae){let e=new Worker(new URL(`/assets/stepPreview.worker-QYcQPnWg.js`,``+import.meta.url),{type:`module`});e.onmessage=e=>{let t=$.get(e.data.id);t&&($.delete(e.data.id),e.data.ok?t.resolve(e.data.meshes):t.reject(Error(e.data.reason)))},e.onerror=()=>{se(`error`),e.terminate(),ae===e&&(ae=null)},ae=e}return ae}function le(e){return new Promise((t,n)=>{let r=++oe;$.set(r,{resolve:t,reject:n}),ce().postMessage({id:r,buffer:e},[e])})}var ue=8;function de(e,t,n,r,i=1.15){let a=n.getSize(new x),o=n.getCenter(new x),s=Math.max(a.length()/2,.001),c=O.degToRad(e.fov),l=2*Math.atan(Math.tan(c/2)*e.aspect),u=i*Math.max(s/Math.sin(c/2),s/Math.sin(l/2)),d=new x(.7,.5,.7).normalize();e.position.copy(o).addScaledVector(d,u),t.minDistance=Math.max(s*.05,.05),t.maxDistance=u*ue,e.near=Math.max(u/1e3,.01),e.far=t.maxDistance+s*4+r,e.updateProjectionMatrix(),t.target.copy(o),t.update()}var fe={x:256,y:256,z:256};function pe(){return new Promise(e=>setTimeout(e,0))}var me=2e4,he=2e4;function ge(e){let t=new G;if(!e)return t;let n=e.trim().split(/\s+/).map(parseFloat);return n.length>=12&&t.set(n[0],n[1],n[2],n[9],n[3],n[4],n[5],n[10],n[6],n[7],n[8],n[11],0,0,0,1),t}var _e=ge;async function ve(e,t=0){let n=[],r=e.getElementsByTagName(`mesh`);for(let e=0;e0&&e%me===0&&await pe()}let c=i.getElementsByTagName(`triangle`);for(let e=0;e0&&e%he===0&&await pe()}a.length>0&&o.length>0&&n.push({vertices:a,triangles:o,extruder:t})}return n}function ye(e){let t=Array.from(e.attributes).find(e=>{let t=e.name.toLowerCase();return t===`plate_id`||t===`plater_id`||t===`plateid`||t===`platerid`||t.endsWith(`:plate_id`)||t.endsWith(`:plater_id`)});if(!t?.value)return null;let n=Number.parseInt(t.value,10);return Number.isFinite(n)?n:null}async function be(e){let t;try{t=await ie.default.loadAsync(e)}catch{throw Error(`Unsupported file format`)}let n=new Map,r=[],i=new Map,a=new Map,o=new DOMParser;async function s(e){let n=e.startsWith(`/`)?e.slice(1):e,r=t.files[n];if(!r)return null;let i=await r.async(`string`);return o.parseFromString(i,`application/xml`)}let c=new Map,l=new Map,u=new Map,d=new Map,f=t.files[`Metadata/model_settings.config`];if(f)try{let e=await f.async(`string`),t=o.parseFromString(e,`application/xml`),n=t.getElementsByTagName(`object`);for(let e=0;ee.tagName===`metadata`&&e.getAttribute(`key`)===`extruder`);if(i.length>0){let e=i[0].getAttribute(`value`);e&&c.set(r,Math.max(0,parseInt(e,10)-1))}let a=Array.from(t.children).find(e=>e.tagName===`metadata`&&e.getAttribute(`key`)===`name`)?.getAttribute(`value`);a&&u.set(r,a);let o=t.getElementsByTagName(`part`);for(let e=0;ee.tagName===`metadata`&&e.getAttribute(`key`)===`extruder`);if(i.length>0){let e=i[0].getAttribute(`value`);e&&l.set(`${r}:${n}`,Math.max(0,parseInt(e,10)-1))}}}let r=t.getElementsByTagName(`plate`);for(let e=0;ee.startsWith(`Metadata/plate_`)&&e.endsWith(`.json`));for(let e of m){let n=e.match(/^Metadata\/plate_(\d+)\.json$/);if(!n)continue;let r=Number.parseInt(n[1],10);if(Number.isFinite(r))try{let n=await t.files[e].async(`string`),a=JSON.parse(n),o=a.bbox_objects??[];for(let e of o)e?.name&&p.set(e.name,r);if(Array.isArray(a.bbox_all)&&a.bbox_all.length>=4){let[e,t,n,o]=a.bbox_all;[e,t,n,o].every(e=>Number.isFinite(e))&&i.set(r,{minX:e,minY:t,maxX:n,maxY:o})}}catch{}}let h=Object.keys(t.files).find(e=>e===`3D/3dmodel.model`||e.endsWith(`/3dmodel.model`));if(!h){let e=Object.keys(t.files).find(e=>e.endsWith(`.model`));if(e){let t=await s(e);if(t){let e=await ve(t,0);e.length>0&&n.set(`1`,{id:`1`,meshes:e,defaultExtruder:0})}}return{objects:n,buildItems:r,plateBounds:i,plateOffsets:a}}let g=await s(h);if(!g)return{objects:n,buildItems:r,plateBounds:i,plateOffsets:a};let _=g.getElementsByTagName(`object`);for(let e=0;e<_.length;e++){e>0&&await pe();let t=_[e],r=t.getAttribute(`id`);if(!r)continue;let i=ye(t)??d.get(r)??null,a=c.get(r)??-1;if(a<0){let e=t.getAttribute(`p:extruder`)||t.getAttributeNS(`http://schemas.microsoft.com/3dmanufacturing/production/2015/06`,`extruder`)||`1`;a=Math.max(0,parseInt(e,10)-1)}let o=[],u=t.getElementsByTagName(`mesh`);for(let e=0;e0&&e%me===0&&await pe()}let s=t.getElementsByTagName(`triangle`);for(let e=0;e0&&e%he===0&&await pe()}n.length>0&&r.length>0&&o.push({vertices:n,triangles:r,extruder:a})}let f=t.getElementsByTagName(`component`);for(let e=0;e0&&n.set(r,{id:r,meshes:o,defaultExtruder:a,plateId:i})}let v=g.getElementsByTagName(`build`);if(v.length>0){let e=v[0].getElementsByTagName(`item`);for(let t=0;t{if(e instanceof J)if(e.geometry.dispose(),Array.isArray(e.material))for(let t of e.material)t.dispose();else e.material.dispose()})}function Ce(e,t,n){let{objects:r,buildItems:i}=e,a=new R,o=e=>new E({color:new L(n?.[e]||`#00ae42`),roughness:.62,metalness:0,envMapIntensity:.55,flatShading:!1}),s=new Map,c=i.some(e=>e.plateId!=null),l=t==null||!c?i:i.filter(e=>e.plateId===t),u=l.length>0?l:i;if(u.length>0)for(let e of u){let t=r.get(e.objectId);if(t)for(let n of t.meshes){let t=e.extruder??n.extruder,r=[];for(let t=0;t1)for(let e of t)e.dispose()}return a}function we(e,t){let n=new R,r=t?.[0]||`#00ae42`;for(let t of e){let e=new j;e.setAttribute(`position`,new U(t.positions,3)),t.normals&&e.setAttribute(`normal`,new U(t.normals,3)),t.indices&&e.setIndex(new U(t.indices,1)),t.normals||e.computeVertexNormals(),e.rotateX(-Math.PI/2);let i=new J(e,new E({color:t.color?new L(t.color[0],t.color[1],t.color[2]):new L(r),roughness:.62,metalness:0,envMapIntensity:.55}));i.castShadow=!0,n.add(i)}return n}function Te({url:e,fileType:t,buildVolume:n=fe,filamentColors:r,selectedPlateId:i=null,className:a=``,onSnapshot:c}){let{t:l}=s(),u=(0,Y.useRef)(null),f=(0,Y.useRef)(null),_=(0,Y.useRef)(null),v=(0,Y.useRef)(null),y=(0,Y.useRef)(null),b=(0,Y.useRef)(null),S=(0,Y.useRef)(null),C=(0,Y.useRef)(null),w=(0,Y.useRef)(null),O=(0,Y.useRef)(null),j=(0,Y.useRef)(null),M=(0,Y.useRef)(null),N=(0,Y.useRef)(null),[P,F]=(0,Y.useState)(!0),[B,U]=(0,Y.useState)(null),[G,q]=(0,Y.useState)(null),[X,te]=(0,Y.useState)(null),[Z,ie]=(0,Y.useState)(null),[ae,oe]=(0,Y.useState)(0),$=(t||e.split(`?`)[0].split(`.`).pop()||``).toLowerCase(),se=$===`step`||$===`stp`;(0,Y.useEffect)(()=>{if(!P||!se)return;oe(0);let e=Date.now(),t=window.setInterval(()=>{oe(Math.floor((Date.now()-e)/1e3))},1e3);return()=>window.clearInterval(t)},[P,se]);let ce=(0,Y.useRef)(!1),ue=(0,Y.useRef)(c);(0,Y.useEffect)(()=>{ue.current=c}),(0,Y.useEffect)(()=>{if(!u.current)return;let r=u.current,i=r.clientWidth,a=r.clientHeight,s=new T;s.background=new L(1710618),_.current=s;let c=new K(45,i/a,.1,1e4);c.position.set(150,150,150),v.current=c;let d=new H({antialias:!0});d.setSize(i,a),d.setPixelRatio(Math.min(window.devicePixelRatio,2)),d.toneMapping=4,d.toneMappingExposure=.85,d.shadowMap.enabled=!0,d.shadowMap.type=2,r.appendChild(d.domElement),f.current=d;let p=new ee(c,d.domElement);p.enableDamping=!0,p.dampingFactor=.05,w.current=p;let m=new z(d),h=m.fromScene(new re,.04);s.environment=h.texture,y.current=m,b.current=h.texture;let g=new W(16777215,.75);g.position.set(60,260,90),g.castShadow=!0,g.shadow.mapSize.set(2048,2048),g.shadow.bias=-5e-4,g.shadow.normalBias=.02;let x=Math.max(n.x,n.y)*.75;g.shadow.camera.left=-x,g.shadow.camera.right=x,g.shadow.camera.top=x,g.shadow.camera.bottom=-x,g.shadow.camera.near=1,g.shadow.camera.far=x*6,g.shadow.camera.updateProjectionMatrix(),s.add(g),S.current=g;let E=Math.max(n.x,n.y),k=new V(E,Math.ceil(E/16),4473924,3355443);s.add(k),M.current=k;let N=new J(new D(n.x,n.y),new A({color:44610,transparent:!0,opacity:.15,side:2}));N.rotation.x=-Math.PI/2,N.position.y=-.5,s.add(N),j.current=N;let P=new J(new D(n.x,n.y),new I({opacity:.22}));P.rotation.x=-Math.PI/2,P.position.y=-.49,P.receiveShadow=!0,s.add(P),C.current=P;let R,B=()=>{R=requestAnimationFrame(B),p.update(),d.render(s,c)};B(),F(!0),U(null),q(null),te(null),ie(null),ce.current=!1;let G=(t||e.split(`?`)[0].split(`.`).pop()||``).toLowerCase(),Y={},X=o();X&&(Y.Authorization=`Bearer ${X}`),G===`stl`?fetch(e,{headers:Y}).then(e=>{if(!e.ok)throw Error(l(`modelViewer.errors.failedToLoad`));return e.arrayBuffer()}).then(e=>{let t=new ne().parse(e);t.computeVertexNormals(),t.rotateX(-Math.PI/2),te(t)}).catch(e=>{U(e.message),F(!1)}):G===`3mf`?fetch(e,{headers:Y}).then(e=>{if(!e.ok)throw Error(l(`modelViewer.errors.failedToLoad`));return e.arrayBuffer()}).then(be).then(e=>{if(e.objects.size===0)throw Error(l(`modelViewer.errors.noMeshes`));q(e)}).catch(e=>{U(e.message),F(!1)}):G===`step`||G===`stp`?fetch(e,{headers:Y}).then(e=>{if(!e.ok)throw Error(l(`modelViewer.errors.failedToLoad`));return e.arrayBuffer()}).then(le).then(ie).catch(e=>{U(e.message===`no-meshes`?l(`modelViewer.errors.noMeshes`):e.message===`error`?l(`modelViewer.errors.failedToLoad`):e.message),F(!1)}):(U(l(`modelViewer.errors.unsupportedFormat`)),F(!1));let Z=()=>{if(!r)return;let e=r.clientWidth,t=r.clientHeight;e===0||t===0||(c.aspect=e/t,c.updateProjectionMatrix(),d.setSize(e,t))};window.addEventListener(`resize`,Z),document.addEventListener(`fullscreenchange`,Z);let Q=new ResizeObserver(()=>{Z()});return Q.observe(r),()=>{window.removeEventListener(`resize`,Z),document.removeEventListener(`fullscreenchange`,Z),Q.disconnect(),cancelAnimationFrame(R),p.dispose(),b.current?.dispose(),b.current=null,y.current?.dispose(),y.current=null,s.environment=null,d.dispose(),r.removeChild(d.domElement),O.current=null,j.current=null,M.current=null,S.current=null,C.current=null}},[e,n,t,l]),(0,Y.useEffect)(()=>{if(!_.current||!v.current||!w.current||!G&&!X&&!Z)return;O.current&&(_.current.remove(O.current),Se(O.current));let e=!!X||!!Z,t=X?(()=>{let e=new J(X,new E({color:new L(r?.[0]||`#00ae42`),roughness:.62,metalness:0,envMapIntensity:.55}));e.castShadow=!0;let t=new R;return t.add(e),t})():Z?we(Z,r):Ce(G,i??null,r);O.current=t,_.current.add(t);let a=new k().setFromObject(t),o=a.getCenter(new x);t.position.y=-a.min.y;let s=!e&&i!=null&&G.buildItems.length>0?G.plateBounds.get(i):void 0,c=!e&&i!=null?G.plateOffsets.get(i):void 0,l=e||G.buildItems.length===0||i!=null&&!s&&!c,u=l?-o.x:0,d=l?-o.z:0,p=0,m=0;if(!e&&i!=null&&G.buildItems.length>0&&s){let e=new k().setFromObject(t);p=e.min.x-s.minX,m=e.min.z-s.minY}let h=n.x/2,g=n.y/2;!e&&i!=null&&G.buildItems.length>0&&s?(t.position.x=u-p,t.position.z=d-m):!e&&i!=null&&c?(t.position.x=u+(h-c.offsetX),t.position.z=d+(g-c.offsetY)):l?(t.position.x=u+h,t.position.z=d+g):(t.position.x=u,t.position.z=d),j.current&&(j.current.position.x=h,j.current.position.z=g),M.current&&(M.current.position.x=h,M.current.position.z=g),C.current&&(C.current.position.x=h,C.current.position.z=g);let y=new k().setFromObject(t);N.current=y,de(v.current,w.current,y,Math.hypot(n.x,n.y)),F(!1),ue.current&&!ce.current&&(ce.current=!0,requestAnimationFrame(()=>{let e=f.current,t=_.current,n=v.current;if(!(!e||!t||!n))try{e.render(t,n);let r=e.domElement,i=Math.min(r.width,r.height),a=document.createElement(`canvas`);a.width=256,a.height=256;let o=a.getContext(`2d`);if(!o)return;o.drawImage(r,(r.width-i)/2,(r.height-i)/2,i,i,0,0,256,256),a.toBlob(e=>{e&&ue.current?.(e)},`image/png`)}catch{}}))},[G,X,Z,i,r,n]);let pe=()=>{let e=v.current,t=w.current;!e||!t||(N.current?de(e,t,N.current,Math.hypot(n.x,n.y)):(e.position.set(150,150,150),t.target.set(0,50,0),t.update()))},me=e=>{let t=v.current,n=w.current;if(!t||!n)return;let r=t.position.clone().sub(n.target),i=Math.min(n.maxDistance,Math.max(n.minDistance,r.length()*e));t.position.copy(n.target).addScaledVector(r.normalize(),i),n.update()};return(0,Q.jsxs)(`div`,{className:`relative ${a}`,children:[(0,Q.jsx)(`div`,{ref:u,className:`w-full h-full min-h-[400px]`}),P&&(0,Q.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-bambu-dark/80 px-6 text-center`,children:[(0,Q.jsx)(d,{className:`w-8 h-8 text-bambu-green animate-spin`}),se&&(0,Q.jsxs)(`div`,{role:`status`,className:`space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-white tabular-nums`,children:l(`modelViewer.stepConverting`,{seconds:ae})}),(0,Q.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:l(`modelViewer.stepSlowHint`)})]})]}),B&&(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-bambu-dark/80`,children:(0,Q.jsx)(`p`,{className:`text-red-400`,children:B})}),!P&&!B&&(0,Q.jsxs)(`div`,{className:`absolute bottom-4 right-4 flex gap-2`,children:[(0,Q.jsx)(h,{variant:`secondary`,size:`sm`,onClick:()=>me(.8),children:(0,Q.jsx)(p,{className:`w-4 h-4`})}),(0,Q.jsx)(h,{variant:`secondary`,size:`sm`,onClick:()=>me(1.25),children:(0,Q.jsx)(m,{className:`w-4 h-4`})}),(0,Q.jsx)(h,{variant:`secondary`,size:`sm`,onClick:pe,children:(0,Q.jsx)(g,{className:`w-4 h-4`})})]})]})}function Ee({folderId:e,onClose:t,onUploadComplete:n,onFileUploaded:r,autoUpload:i,validateFile:o,accept:p,initialFiles:m}){let{t:g}=s(),[x,S]=(0,Y.useState)([]),[C,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(!1),[D,O]=(0,Y.useState)(!0),[k,A]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(!0),[N,P]=(0,Y.useState)(null),F=(0,Y.useRef)(null),I=e=>{e.preventDefault(),w(!0)},L=e=>{e.preventDefault(),w(!1)},R=e=>{e.preventDefault(),w(!1),H(Array.from(e.dataTransfer.files))},z=e=>{e.target.files&&H(Array.from(e.target.files))},B=(e,t)=>{S(n=>n.map(n=>n.file===e?{...n,...t}:n))},V=async i=>{E(!0);for(let t of i)if(t.status===`pending`){B(t.file,{status:`uploading`});try{if(t.isZip){let n=await a.extractZipFile(t.file,e,D,k,j);B(t.file,{status:n.errors.length>0&&n.extracted===0?`error`:`success`,extractedCount:n.extracted,error:n.errors.length>0?g(`fileManager.zipFilesFailed`,`{{count}} files failed`,{count:n.errors.length}):void 0})}else{let n=await a.uploadLibraryFile(t.file,e,j);B(t.file,{status:`success`});let i=r?.(n);if(i){P(i),S([]),E(!1);return}}}catch(e){B(t.file,{status:`error`,error:e instanceof Error?e.message:g(`fileManager.uploadFailed`,`Upload failed`)})}}E(!1),n(),S(e=>(e.some(e=>e.status===`error`)||t(),e))},H=e=>{if(P(null),o)for(let t of e){let e=o(t);if(e){P(e);return}}let t=e.map(e=>({file:e,status:`pending`,isZip:e.name.toLowerCase().endsWith(`.zip`),is3mf:e.name.toLowerCase().endsWith(`.3mf`)}));S(e=>[...e,...t]),i&&e.length>0&&V(t)},U=e=>{S(t=>t.filter((t,n)=>n!==e))},ee=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{ee.current||!m||m.length===0||(ee.current=!0,H(m))},[]);let W=x.some(e=>e.isZip&&e.status===`pending`),G=x.some(e=>e.file.name.toLowerCase().endsWith(`.stl`)&&e.status===`pending`),K=x.some(e=>e.is3mf&&e.status===`pending`),q=x.filter(e=>e.status===`pending`).length,J=x.length>0&&q===0&&!T;return(0,Q.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,Q.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-lg border border-bambu-dark-tertiary`,children:[(0,Q.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:g(`fileManager.uploadFiles`)}),(0,Q.jsx)(`button`,{onClick:t,className:`p-1 hover:bg-bambu-dark rounded`,children:(0,Q.jsx)(f,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,Q.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{onDragOver:I,onDragLeave:L,onDrop:R,onClick:()=>F.current?.click(),className:`border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${C?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-green/50`}`,children:[(0,Q.jsx)(y,{className:`w-10 h-10 mx-auto mb-3 ${C?`text-bambu-green`:`text-bambu-gray`}`}),(0,Q.jsx)(`p`,{className:`text-white font-medium`,children:g(C?`fileManager.dropFilesHere`:`fileManager.dragDropFiles`)}),(0,Q.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:g(`fileManager.orClickToBrowse`)}),(0,Q.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-2`,children:g(`fileManager.allFileTypesSupported`)})]}),(0,Q.jsx)(`input`,{ref:F,type:`file`,multiple:!0,accept:p,className:`hidden`,onChange:z}),W&&(0,Q.jsx)(`div`,{className:`p-3 bg-blue-50 dark:bg-blue-500/10 border border-blue-300 dark:border-blue-500/30 rounded-lg`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(v,{className:`w-5 h-5 text-blue-600 dark:text-blue-400 mt-0.5 flex-shrink-0`}),(0,Q.jsxs)(`div`,{className:`flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-blue-700 dark:text-blue-300 font-medium`,children:g(`fileManager.zipFilesDetected`)}),(0,Q.jsx)(`p`,{className:`text-xs text-blue-700/80 dark:text-blue-300/70 mt-1`,children:g(`fileManager.zipExtractOptions`)}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 mt-2 cursor-pointer`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked),className:`w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,Q.jsx)(`span`,{className:`text-sm text-white`,children:g(`fileManager.preserveZipStructure`)})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 mt-2 cursor-pointer`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>A(e.target.checked),className:`w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,Q.jsx)(`span`,{className:`text-sm text-white`,children:g(`fileManager.createFolderFromZip`)})]})]})]})}),K&&(0,Q.jsx)(`div`,{className:`p-3 bg-purple-50 dark:bg-purple-500/10 border border-purple-300 dark:border-purple-500/30 rounded-lg`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(_,{className:`w-5 h-5 text-purple-600 dark:text-purple-400 mt-0.5 flex-shrink-0`}),(0,Q.jsxs)(`div`,{className:`flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-purple-700 dark:text-purple-300 font-medium`,children:g(`fileManager.threemfDetected`)}),(0,Q.jsx)(`p`,{className:`text-xs text-purple-700/80 dark:text-purple-300/70 mt-1`,children:g(`fileManager.threemfExtractionInfo`)})]})]})}),(G||W)&&(0,Q.jsx)(`div`,{className:`p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(b,{className:`w-5 h-5 text-bambu-green mt-0.5 flex-shrink-0`}),(0,Q.jsxs)(`div`,{className:`flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-bambu-green font-medium`,children:g(`fileManager.stlThumbnailGeneration`)}),(0,Q.jsx)(`p`,{className:`text-xs text-bambu-green/70 mt-1`,children:g(W&&!G?`fileManager.zipMayContainStl`:`fileManager.thumbnailsCanBeGenerated`)}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 mt-2 cursor-pointer`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:j,onChange:e=>M(e.target.checked),className:`w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,Q.jsx)(`span`,{className:`text-sm text-white`,children:g(`fileManager.generateThumbnailsForStl`)})]})]})]})}),x.length>0&&(0,Q.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-2`,children:x.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 p-2 bg-bambu-dark rounded-lg`,children:[e.isZip?(0,Q.jsx)(v,{className:`w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0`}):(0,Q.jsx)(u,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-white truncate`,children:e.file.name}),(0,Q.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[(e.file.size/1024/1024).toFixed(2),` MB`,e.isZip&&e.status===`pending`&&(0,Q.jsxs)(`span`,{className:`text-blue-700 dark:text-blue-400 ml-2`,children:[`• `,g(`fileManager.willBeExtracted`)]}),e.extractedCount!==void 0&&(0,Q.jsxs)(`span`,{className:`text-green-700 dark:text-green-400 ml-2`,children:[`• `,g(`fileManager.filesExtracted`,{count:e.extractedCount})]})]}),e.status===`error`&&e.error&&(0,Q.jsx)(`p`,{className:`text-xs text-red-700 dark:text-red-400 mt-1 break-words`,children:e.error})]}),e.status===`pending`&&(0,Q.jsx)(`button`,{onClick:()=>U(t),className:`p-1 hover:bg-bambu-dark-tertiary rounded`,children:(0,Q.jsx)(f,{className:`w-4 h-4 text-bambu-gray`})}),e.status===`uploading`&&(0,Q.jsx)(d,{className:`w-4 h-4 text-bambu-green animate-spin`}),e.status===`success`&&(0,Q.jsx)(l,{className:`w-4 h-4 text-green-500`}),e.status===`error`&&(0,Q.jsx)(`span`,{title:e.error,children:(0,Q.jsx)(c,{className:`w-4 h-4 text-red-500`})})]},t))}),N&&(0,Q.jsx)(`div`,{className:`p-3 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(c,{className:`w-5 h-5 text-red-600 dark:text-red-400 mt-0.5 flex-shrink-0`}),(0,Q.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-300`,children:N})]})})]}),(0,Q.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary flex justify-end gap-2`,children:[(0,Q.jsx)(h,{variant:`secondary`,onClick:t,children:g(`common.cancel`)}),!J&&(0,Q.jsx)(h,{onClick:()=>V(x),disabled:q===0||T,children:T?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{className:`w-4 h-4 mr-2 animate-spin`}),g(`fileManager.uploading`)]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{className:`w-4 h-4 mr-2`}),g(`common.upload`),` `,q>0?`(${q})`:``]})})]})]})})}export{Te as n,Ee as t}; \ No newline at end of file diff --git a/static/assets/FinancePage-90vCG868.js b/static/assets/FinancePage-90vCG868.js new file mode 100644 index 000000000..3448ebdcb --- /dev/null +++ b/static/assets/FinancePage-90vCG868.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as ee}from"./client-DnySrlFv.js";import{n as te}from"./QueryClientProvider-Ce8_sN3w.js";import{t as i}from"./useQuery-BBCjCezC.js";import{t as a}from"./useMutation-B-Tr2hIP.js";import{t as o}from"./createLucideIcon-DvBYJlWL.js";import{n as ne,t as re}from"./chevrons-right-DTJgqnxZ.js";import{n as ie}from"./ToastContext-BRX0SW3C.js";import{i as s,n as c,t as l}from"./Card-Bzc64K35.js";import{t as u}from"./Button-DDr6eAFy.js";import{v as d}from"./date-G9KUauqz.js";import{$t as ae,At as oe,Mn as se,_t as ce,at as le,jn as ue,yt as de}from"./index-CovRLYqQ.js";var fe=o(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),pe=o(`clock-3`,[[`path`,{d:`M12 6v6h4`,key:`135r8i`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),me=o(`wallet`,[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]),f=e(n(),1),p=t(),m=/\[(aborted|failed|cancelled):\s*([^\]]*)\]/i;function he(e){if(!e)return{isPartial:!1,partialType:null,cleanedDescription:null};let t=e.match(m);if(!t)return{isPartial:!1,partialType:null,cleanedDescription:e};let n=e.replace(t[0],``).trim();return{isPartial:!0,partialType:t[1].toLowerCase(),cleanedDescription:n||null}}function ge(e,t){if(!e)return`-`;let n=d(e);return n?n.toLocaleString(t):e}function h(e){let t=e.trim();if(!t)return null;let n=Number.parseFloat(t);return Number.isFinite(n)?n:null}function _e(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}T${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`}var g=`w-full px-3 py-2 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:outline-none focus:ring-1 focus:ring-bambu-green`,_=`block text-sm font-medium text-white mb-1`,v=`px-4 py-3 text-left text-bambu-gray font-medium`,y=`px-4 py-3 align-top text-white`;function b({title:e,onClose:t,children:n,size:r=`md`}){let{t:te}=ee();return(0,p.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,p.jsxs)(`div`,{className:`w-full ${r===`sm`?`max-w-xl`:r===`lg`?`max-w-6xl`:`max-w-4xl`} overflow-hidden rounded-lg border border-bambu-dark-tertiary bg-bambu-dark-secondary`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between border-b border-bambu-dark-tertiary px-4 py-3`,children:[(0,p.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:e}),(0,p.jsx)(u,{size:`sm`,variant:`secondary`,onClick:t,children:te(`common.close`,`Close`)})]}),(0,p.jsx)(`div`,{className:`max-h-[75vh] overflow-auto p-4`,children:n})]})})}function x(){let{t:e,i18n:t}=ee(),{hasPermission:n,user:o}=de(),{showToast:d}=ie(),m=te(),x=n(`cost_centers:read_own`),S=n(`cost_centers:read_all`),C=n(`cost_centers:create`),w=n(`cost_centers:modify`),T=n(`cost_centers:modify`),E=n(`cost_centers:modify`),D=n(`cost_centers:modify`),O=n(`users:read_slim`)||n(`users:read`),ve=S||C||w||T||E||D,ye=x||ve,be=ye,[xe,Se]=(0,f.useState)(``),[k,Ce]=(0,f.useState)(`monthly`),[we,Te]=(0,f.useState)(``),[A,Ee]=(0,f.useState)(null),[De,Oe]=(0,f.useState)(`deposit`),[ke,Ae]=(0,f.useState)(``),[je,Me]=(0,f.useState)(``),[Ne,Pe]=(0,f.useState)(null),[j,M]=(0,f.useState)(null),[Fe,Ie]=(0,f.useState)(null),[Le,Re]=(0,f.useState)(!0),[N,P]=(0,f.useState)(0),[F,ze]=(0,f.useState)(`all`),[I,Be]=(0,f.useState)(`all`),[Ve,He]=(0,f.useState)(!1),[Ue,We]=(0,f.useState)(!1),[Ge,Ke]=(0,f.useState)(!1),[L,qe]=(0,f.useState)(!1),[R,Je]=(0,f.useState)(`personal`),[z,Ye]=(0,f.useState)(null),[Xe,Ze]=(0,f.useState)(``),[Qe,B]=(0,f.useState)(`monthly`),[$e,V]=(0,f.useState)(``),[et,tt]=(0,f.useState)(!1),[nt,rt]=(0,f.useState)(null),[it,at]=(0,f.useState)(null),[ot,st]=(0,f.useState)(null),[ct,lt]=(0,f.useState)(``),[ut,dt]=(0,f.useState)(``),[ft,H]=(0,f.useState)(!1),[pt,mt]=(0,f.useState)(null),[ht,gt]=(0,f.useState)(null),[_t,vt]=(0,f.useState)(``),[yt,bt]=(0,f.useState)(``),[xt,St]=(0,f.useState)(_e(new Date)),[U,Ct]=(0,f.useState)(null),[wt,Tt]=(0,f.useState)(null),W=S||C||w||T||D&&O||E&&O;(0,f.useEffect)(()=>{W||Je(`personal`)},[W]);let{data:Et,isLoading:Dt}=i({queryKey:[`finance`,`me`,`balance`],queryFn:r.getMyBalance,enabled:x}),{data:Ot}=i({queryKey:[`ui-flags`],queryFn:r.getUiFlags}),{data:kt,isLoading:At}=i({queryKey:[`finance`,`me`,`transactions`,50,N],queryFn:()=>r.getMyTransactions(50,N),enabled:x}),{data:jt,isLoading:Mt}=i({queryKey:[`finance`,`transactions`,50,N],queryFn:()=>r.getAllTransactions(50,N),enabled:R===`admin`&&S}),{data:G,isLoading:K}=i({queryKey:[`finance`,`cost-centers`,R],queryFn:()=>R===`admin`&&ve?r.listCostCenters(!0):r.getMyCostCenters(),enabled:be}),{data:q}=i({queryKey:[`users`,`slim`],queryFn:r.getUsersSlim,enabled:O&&(be||D||E)}),{data:J}=i({queryKey:[`finance`,`cost-center`,j],queryFn:()=>r.getCostCenter(j),enabled:E&&j!=null});(0,f.useEffect)(()=>{!q||q.length===0||A!=null&&q.some(e=>e.id===A)||Ee(q[0].id)},[q,A]),(0,f.useEffect)(()=>{if(!E)return;let e=(G||[]).filter(e=>!e.is_private);if(e.length===0){M(null);return}j!=null&&e.some(e=>e.id===j)||M(e[0].id)},[E,G,j]),(0,f.useEffect)(()=>{if(!E||!q||q.length===0)return;let e=new Set((J?.members||[]).map(e=>e.user_id)),t=q.find(t=>!e.has(t.id));Ie(t?t.id:null)},[E,q,J]),(0,f.useEffect)(()=>{if(!L)return;let e=G||[];if(e.length===0){Ye(null);return}z!=null&&e.some(e=>e.id===z)||Ye(e[0].id)},[L,z,G]),(0,f.useEffect)(()=>{if(!L||z==null)return;let e=(G||[]).find(e=>e.id===z);if(e){if(Ze(e.name),e.budget_mode===`total`){B(`total`),V(e.total_budget==null?``:String(e.total_budget));return}B(`monthly`),V(e.monthly_budget==null?``:String(e.monthly_budget))}},[L,z,G]);let Nt=a({mutationFn:()=>r.createCostCenter({name:xe.trim(),total_budget:k===`total`?h(we):null,monthly_budget:k===`monthly`?h(we):null,is_active:!0}),onSuccess:()=>{m.invalidateQueries({queryKey:[`finance`]}),Se(``),Te(``),d(e(`finance.createdCostCenter`,`Cost center created`))},onError:t=>{d(t.message||e(`finance.createCostCenterFailed`,`Failed to create cost center`),`error`)}}),Pt=a({mutationFn:({costCenterId:e,value:t,mode:n})=>r.updateCostCenterBudgets(e,{total_budget:n===`total`?h(t):null,monthly_budget:n===`monthly`?h(t):null})}),Ft=a({mutationFn:({costCenterId:e,name:t})=>r.updateCostCenter(e,{name:t})}),It=a({mutationFn:e=>r.deleteCostCenter(e)}),Lt=a({mutationFn:e=>r.deleteTransaction(e),onSuccess:()=>{m.invalidateQueries({queryKey:[`finance`]}),d(e(`finance.transactionDeleted`,`Transaction deleted`))},onError:t=>{d(t.message||e(`finance.deleteTransactionFailed`,`Failed to delete transaction`),`error`)}}),Rt=a({mutationFn:e=>r.editTransaction(e.transactionId,e.data),onSuccess:()=>{m.invalidateQueries({queryKey:[`finance`]}),d(e(`finance.transactionEdited`,`Transaction updated and ledger recalculated`)),tt(!1)},onError:t=>{d(t.message||e(`finance.editTransactionFailed`,`Failed to edit transaction`),`error`)}}),zt=a({mutationFn:e=>r.createManualPrint(e),onSuccess:()=>{m.invalidateQueries({queryKey:[`finance`]}),d(e(`finance.manualPrintCreated`,`Manual print charge added and ledger recalculated`)),H(!1),mt(null),gt(null),vt(``),bt(``),St(_e(new Date))},onError:t=>{d(t.message||e(`finance.manualPrintFailed`,`Failed to create manual print`),`error`)}}),Bt=a({mutationFn:e=>r.depositUserBalance(e.userId,{amount:e.amount,description:e.description,cost_center_id:e.costCenterId??null})}),Vt=a({mutationFn:e=>r.withdrawUserBalance(e.userId,{amount:e.amount,description:e.description,cost_center_id:e.costCenterId??null})}),Ht=a({mutationFn:e=>r.upsertCostCenterMember(e.costCenterId,{user_id:e.userId,can_print:e.canPrint}),onSuccess:()=>{m.invalidateQueries({queryKey:[`finance`]}),d(e(`finance.memberSaved`,`Member saved`))},onError:t=>{d(t.message||e(`finance.memberSaveFailed`,`Failed to save member`),`error`)}}),Ut=a({mutationFn:e=>r.removeCostCenterMember(e.costCenterId,e.userId),onSuccess:()=>{m.invalidateQueries({queryKey:[`finance`]}),d(e(`finance.memberRemoved`,`Member removed`))},onError:t=>{d(t.message||e(`finance.memberRemoveFailed`,`Failed to remove member`),`error`)}}),Wt=Bt.isPending||Vt.isPending,Gt=()=>{if(!xe.trim()){d(e(`finance.costCenterNameRequired`,`Cost center name is required`),`error`);return}Nt.mutate()},Kt=async()=>{if(z==null){d(e(`finance.selectCostCenter`,`Please select a cost center`),`error`);return}let t=Xe.trim();if(!t){d(e(`finance.costCenterNameRequired`,`Cost center name is required`),`error`);return}try{w&&await Ft.mutateAsync({costCenterId:z,name:t}),T&&await Pt.mutateAsync({costCenterId:z,mode:Qe,value:$e}),m.invalidateQueries({queryKey:[`finance`]}),d(e(`finance.costCenterUpdated`,`Cost center updated`)),qe(!1)}catch(t){d(t.message||e(`finance.costCenterUpdateFailed`,`Failed to update cost center`),`error`)}},qt=e=>{let t=(G||[]).find(t=>t.id===e);t&&(Ye(t.id),Ze(t.name),t.budget_mode===`total`?(B(`total`),V(t.total_budget==null?``:String(t.total_budget))):(B(`monthly`),V(t.monthly_budget==null?``:String(t.monthly_budget))),qe(!0))},Jt=async()=>{if(U)try{await It.mutateAsync(U.id),m.invalidateQueries({queryKey:[`finance`]}),j===U.id&&M(null),d(e(`finance.costCenterDeleted`,`Cost center deleted`))}catch(t){d(t.message||e(`finance.costCenterDeleteFailed`,`Failed to delete cost center`),`error`)}finally{Ct(null)}},Yt=()=>{wt!=null&&Lt.mutate(wt,{onSettled:()=>Tt(null)})},Xt=e=>{rt(e.id),at(e.user_id),st(e.cost_center_id),lt(String(e.amount)),dt(e.description||``),tt(!0)},Zt=async()=>{if(nt==null)return;let t=ct?Number.parseFloat(ct):null;if(t!==null&&!Number.isFinite(t)){d(e(`finance.amountInvalid`,`Amount must be a valid number`),`error`);return}Rt.mutate({transactionId:nt,data:{user_id:it||void 0,cost_center_id:ot||void 0,amount:t??void 0,description:ut||void 0}})},Qt=async()=>{if(pt==null){d(e(`finance.userRequired`,`Please select a user`),`error`);return}if(ht==null){d(e(`finance.costCenterRequired`,`Please select a cost center`),`error`);return}let t=_t?Number.parseFloat(_t):null;if(t===null||!Number.isFinite(t)){d(e(`finance.amountInvalid`,`Amount must be a valid number`),`error`);return}t=Math.abs(t),zt.mutate({user_id:pt,cost_center_id:ht,amount:t,description:yt||void 0,created_at:xt?new Date(xt).toISOString():void 0})},$t=async()=>{if(A==null){d(e(`finance.userRequired`,`Please select a user`),`error`);return}let t=Number.parseFloat(ke);if(!Number.isFinite(t)||t<=0){d(e(`finance.amountMustBePositive`,`Amount must be greater than zero`),`error`);return}let n={userId:A,amount:t,description:je.trim()||void 0,costCenterId:Ne};try{De===`deposit`?await Bt.mutateAsync(n):await Vt.mutateAsync(n),m.invalidateQueries({queryKey:[`finance`]}),Ae(``),Me(``),d(De===`deposit`?e(`finance.depositSuccess`,`Deposit successful`):e(`finance.withdrawSuccess`,`Withdrawal successful`))}catch(t){d(t.message||e(`finance.adjustmentFailed`,`Wallet adjustment failed`),`error`)}},en=()=>{if(j==null){d(e(`finance.selectCostCenter`,`Please select a cost center`),`error`);return}if(Fe==null){d(e(`finance.noEligibleUsers`,`No eligible users available`),`error`);return}Ht.mutate({costCenterId:j,userId:Fe,canPrint:Le})},tn=e=>{j!=null&&Ut.mutate({costCenterId:j,userId:e})},Y=le(Ot?.currency||`USD`),X=(0,f.useMemo)(()=>[...q||[]].sort((e,t)=>e.username.localeCompare(t.username)),[q]),nn=(0,f.useMemo)(()=>{let e=new Map;for(let t of X)e.set(t.id,t.username);return e},[X]),rn=(0,f.useMemo)(()=>{let e=new Set((J?.members||[]).map(e=>e.user_id));return X.filter(t=>!e.has(t.id))},[X,J]),an=R===`admin`&&S?jt:kt,Z=R===`admin`&&S?Mt:At,Q=(0,f.useMemo)(()=>an?.items??[],[an?.items]),on=an?.total??0,sn=Math.max(1,Math.ceil(on/50)),cn=(0,f.useMemo)(()=>Q.filter(e=>!(F!==`all`&&e.transaction_type!==F||I!==`all`&&e.cost_center_id!==I)),[Q,F,I]),ln=Math.floor(N/50)+1,$=R===`admin`,un=t=>t===`deposit`?e(`finance.deposit`):t===`withdraw`?e(`finance.withdraw`):t===`print_charge`?e(`finance.printCharge`):t,dn=t=>t==null?e(`finance.personal`,`Personal`):nn.get(t)||(o?.id===t&&o.username?o.username:e(`finance.userWithId`,`User #{{id}}`,{id:t})),fn=t=>t.budget_limit==null||t.budget_available==null?e(`finance.unlimited`,`Unlimited`):`${Y}${t.budget_available.toFixed(2)}/${Y}${t.budget_limit.toFixed(2)}`;return ye?(0,p.jsxs)(`div`,{className:`p-4 md:p-8 space-y-8`,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(me,{className:`h-6 w-6 text-bambu-green`}),(0,p.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`finance.title`,`Finance`)})]}),(0,p.jsx)(`p`,{className:`text-bambu-gray mt-2 max-w-2xl`,children:e(`finance.subtitle`,`Wallet, personal transactions, and cost centers`)}),(0,p.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1 max-w-2xl`,children:e(`finance.budgetPolicyHint`,`Account balances track costs. Printing is limited only by the selected cost center budget; without a budget, printing is unlimited.`)})]}),(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 lg:items-end`,children:[W&&(0,p.jsxs)(`div`,{className:`inline-flex overflow-hidden rounded border border-bambu-dark-tertiary`,children:[(0,p.jsx)(`button`,{type:`button`,onClick:()=>Je(`personal`),className:`px-3 py-1.5 text-sm ${R===`personal`?`bg-bambu-green text-black font-medium`:`bg-bambu-dark text-bambu-gray`}`,children:e(`finance.personalView`,`Personal view`)}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>Je(`admin`),className:`px-3 py-1.5 text-sm ${R===`admin`?`bg-bambu-green text-black font-medium`:`bg-bambu-dark text-bambu-gray`}`,children:e(`finance.adminView`,`Admin view`)})]}),R===`admin`&&W&&(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-2 lg:justify-end`,children:[C&&(0,p.jsx)(u,{size:`sm`,variant:`secondary`,onClick:()=>He(!0),children:e(`finance.createCostCenter`,`Create cost center`)}),D&&O&&(0,p.jsx)(u,{size:`sm`,variant:`secondary`,onClick:()=>We(!0),children:e(`finance.adjustWallet`,`Adjust wallet`)}),D&&O&&(0,p.jsx)(u,{size:`sm`,variant:`secondary`,onClick:()=>H(!0),children:e(`finance.addManualPrint`,`Add manual print`)}),E&&O&&(0,p.jsx)(u,{size:`sm`,variant:`secondary`,onClick:()=>Ke(!0),children:e(`finance.manageMembers`,`Manage cost center members`)})]})]})]}),(0,p.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2 xl:grid-cols-3`,children:[(0,p.jsxs)(l,{children:[(0,p.jsxs)(s,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,p.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`finance.currentBalance`,`Personal account balance`)}),(0,p.jsx)(me,{className:`w-4 h-4 text-bambu-green/90`})]}),(0,p.jsx)(c,{className:`pt-1`,children:(0,p.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:Dt?e(`common.loading`,`Loading...`):`${Y}${(Et?.balance??0).toFixed(2)}`})})]}),(0,p.jsxs)(l,{children:[(0,p.jsxs)(s,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,p.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:R===`admin`?e(`finance.transactions`,`Transactions`):e(`finance.personalTransactions`,`Personal transactions`)}),(0,p.jsx)(pe,{className:`w-4 h-4 text-blue-400`})]}),(0,p.jsx)(c,{className:`pt-1`,children:(0,p.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:Z?`-`:on})})]}),(0,p.jsxs)(l,{children:[(0,p.jsxs)(s,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,p.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`finance.costCenters`,`Cost centers`)}),(0,p.jsx)(fe,{className:`w-4 h-4 text-orange-400`})]}),(0,p.jsx)(c,{className:`pt-1`,children:(0,p.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:K?`-`:G?.length??0})})]})]}),Ve&&C&&(0,p.jsx)(b,{title:e(`finance.createCostCenter`,`Create cost center`),size:`md`,onClose:()=>He(!1),children:(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.costCenterName`,`Name`)}),(0,p.jsx)(`input`,{type:`text`,value:xe,onChange:e=>Se(e.target.value),placeholder:e(`finance.costCenterName`,`Name`),className:g})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.budgetType`,`Budget type`)}),(0,p.jsxs)(`select`,{value:k,onChange:e=>Ce(e.target.value),className:g,children:[(0,p.jsx)(`option`,{value:`monthly`,children:e(`finance.monthlyBudget`,`Monthly budget`)}),(0,p.jsx)(`option`,{value:`total`,children:e(`finance.totalBudget`,`Total budget`)})]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:k===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):e(`finance.totalBudget`,`Total budget`)}),(0,p.jsx)(`input`,{type:`number`,step:`0.01`,value:we,onChange:e=>Te(e.target.value),placeholder:`0.00`,className:g})]})]}),(0,p.jsx)(u,{className:`min-w-[180px]`,onClick:Gt,disabled:Nt.isPending,children:Nt.isPending?e(`common.saving`,`Saving...`):e(`finance.create`,`Create`)})]})}),Ue&&D&&O&&(0,p.jsx)(b,{title:e(`finance.adjustWallet`,`Adjust wallet`),size:`md`,onClose:()=>We(!1),children:(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.selectUser`,`Select user`)}),(0,p.jsx)(`select`,{value:A??``,onChange:e=>Ee(e.target.value?Number(e.target.value):null),className:g,children:(X||[]).map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.username},e.id))})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.transactionType`,`Type`)}),(0,p.jsxs)(`select`,{value:De,onChange:e=>Oe(e.target.value),className:g,children:[(0,p.jsx)(`option`,{value:`deposit`,children:e(`finance.deposit`,`Deposit`)}),(0,p.jsx)(`option`,{value:`withdraw`,children:e(`finance.withdraw`,`Withdraw`)})]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.amount`,`Amount`)}),(0,p.jsx)(`input`,{type:`number`,step:`0.01`,min:`0`,value:ke,onChange:e=>Ae(e.target.value),placeholder:`0.00`,className:g})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.costCenters`,`Cost centers`)}),(0,p.jsxs)(`select`,{value:Ne??``,onChange:e=>Pe(e.target.value?Number(e.target.value):null),className:g,children:[(0,p.jsx)(`option`,{value:``,children:e(`finance.noCostCenter`,`No cost center`)}),(G||[]).map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`common.description`,`Description`)}),(0,p.jsx)(`input`,{type:`text`,value:je,onChange:e=>Me(e.target.value),placeholder:e(`finance.descriptionOptional`,`Description (optional)`),className:g})]}),(0,p.jsx)(u,{className:`min-w-[180px]`,onClick:$t,disabled:Wt,children:Wt?e(`common.saving`,`Saving...`):e(`finance.applyAdjustment`,`Apply adjustment`)})]})}),Ge&&E&&O&&(0,p.jsx)(b,{title:e(`finance.manageMembers`,`Manage cost center members`),size:`lg`,onClose:()=>Ke(!1),children:(0,p.jsxs)(`div`,{className:`space-y-5`,children:[(0,p.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.costCenters`,`Cost centers`)}),(0,p.jsx)(`select`,{value:j??``,onChange:e=>M(e.target.value?Number(e.target.value):null),className:g,children:(G||[]).filter(e=>!e.is_private).map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.selectUser`,`Select user`)}),(0,p.jsxs)(`select`,{value:Fe??``,onChange:e=>Ie(e.target.value?Number(e.target.value):null),className:g,children:[(0,p.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user`)}),rn.map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-bambu-dark-tertiary bg-bambu-dark-secondary px-3 py-2`,children:[(0,p.jsx)(`input`,{id:`memberCanPrint`,type:`checkbox`,checked:Le,onChange:e=>Re(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,p.jsx)(`label`,{htmlFor:`memberCanPrint`,className:`text-sm text-bambu-gray`,children:e(`finance.memberCanPrint`,`Member can print`)})]}),(0,p.jsx)(`div`,{className:`flex items-end`,children:(0,p.jsx)(u,{className:`min-w-[180px]`,onClick:en,disabled:Ht.isPending||Fe==null,children:Ht.isPending?e(`common.saving`,`Saving...`):e(`finance.addMember`,`Add member`)})})]}),(0,p.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,p.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,p.jsx)(`th`,{className:v,children:e(`common.name`,`Name`)}),(0,p.jsx)(`th`,{className:v,children:e(`finance.canPrint`,`Can print`)}),(0,p.jsx)(`th`,{className:v,children:e(`common.actions`,`Actions`)})]})}),(0,p.jsxs)(`tbody`,{children:[(J?.members||[]).map(t=>(0,p.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,p.jsx)(`td`,{className:y,children:X.find(e=>e.id===t.user_id)?.username||`User ${t.user_id}`}),(0,p.jsx)(`td`,{className:y,children:t.can_print?e(`common.yes`,`Yes`):e(`common.no`,`No`)}),(0,p.jsx)(`td`,{className:y,children:(0,p.jsx)(u,{size:`sm`,variant:`danger`,onClick:()=>tn(t.user_id),disabled:Ut.isPending,children:e(`common.remove`,`Remove`)})})]},t.id)),(J?.members||[]).length===0&&(0,p.jsx)(`tr`,{children:(0,p.jsx)(`td`,{colSpan:3,className:`py-3 text-bambu-gray`,children:e(`finance.noMembers`,`No members assigned.`)})})]})]})})]})}),L&&(w||T)&&(0,p.jsx)(b,{title:e(`finance.editCostCenter`,`Edit cost center`),size:`md`,onClose:()=>qe(!1),children:(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.costCenterName`,`Name`)}),(0,p.jsx)(`input`,{type:`text`,value:Xe,onChange:e=>Ze(e.target.value),placeholder:e(`finance.costCenterName`,`Name`),className:g,disabled:!w})]}),(0,p.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.budgetType`,`Budget type`)}),(0,p.jsxs)(`select`,{value:Qe,onChange:e=>B(e.target.value),className:g,disabled:!T,children:[(0,p.jsx)(`option`,{value:`monthly`,children:e(`finance.monthlyBudget`,`Monthly budget`)}),(0,p.jsx)(`option`,{value:`total`,children:e(`finance.totalBudget`,`Total budget`)})]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:Qe===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):e(`finance.totalBudget`,`Total budget`)}),(0,p.jsx)(`input`,{type:`number`,step:`0.01`,value:$e,onChange:e=>V(e.target.value),placeholder:`0.00`,className:g,disabled:!T})]})]}),(0,p.jsx)(u,{className:`min-w-[180px]`,onClick:Kt,disabled:Ft.isPending||Pt.isPending||z==null,children:Ft.isPending||Pt.isPending?e(`common.saving`,`Saving...`):e(`common.save`,`Save`)})]})}),(0,p.jsxs)(`div`,{className:`grid gap-6 ${be&&x?`xl:grid-cols-2`:``}`,children:[be&&(0,p.jsxs)(l,{children:[(0,p.jsxs)(s,{children:[(0,p.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`finance.myCostCenters`,`My cost centers`)}),(0,p.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`finance.costCentersHint`,`Review budget limits and keep costs under control`)})]}),(0,p.jsxs)(c,{className:`space-y-3`,children:[K&&(0,p.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`,`Loading...`)}),!K&&(!G||G.length===0)&&(0,p.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noCostCenters`,`No cost centers found.`)}),!K&&G&&G.length>0&&(0,p.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,p.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,p.jsx)(`th`,{className:v,children:e(`common.name`,`Name`)}),$&&(0,p.jsx)(`th`,{className:v,children:e(`finance.owner`,`Owner`)}),(0,p.jsx)(`th`,{className:v,children:e(`finance.balance`,`Account balance`)}),(0,p.jsx)(`th`,{className:v,children:e(`finance.budget`,`Budget`)}),$&&(0,p.jsx)(`th`,{className:v,children:e(`common.actions`,`Actions`)})]})}),(0,p.jsx)(`tbody`,{children:G.map(t=>{let n=w||T,r=!t.is_private&&w;return(0,p.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,p.jsx)(`td`,{className:y,children:t.name}),$&&(0,p.jsx)(`td`,{className:y,children:t.is_private?dn(t.owner_user_id):e(`finance.shared`,`Shared`)}),(0,p.jsxs)(`td`,{className:y,children:[Y,t.total_balance.toFixed(2)]}),(0,p.jsx)(`td`,{className:y,children:(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,p.jsx)(`span`,{children:fn(t)}),(0,p.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:t.budget_mode===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):t.budget_mode===`total`?e(`finance.totalBudget`,`Total budget`):e(`finance.noBudget`,`No budget`)})]})}),$&&(0,p.jsx)(`td`,{className:y,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(u,{size:`sm`,variant:`ghost`,onClick:()=>qt(t.id),disabled:!n,title:n?e(`common.edit`,`Edit`):e(`finance.cannotEditPrivateCostCenter`,`Private cost centers cannot be edited here`),className:`p-1.5 sm:p-2`,children:(0,p.jsx)(ae,{className:`w-4 h-4`})}),r&&(0,p.jsx)(u,{size:`sm`,variant:`ghost`,onClick:()=>Ct({id:t.id,name:t.name}),disabled:It.isPending,title:e(`common.delete`,`Delete`),className:`text-red-400 hover:text-red-300 hover:bg-red-500/10 p-1.5 sm:p-2`,children:(0,p.jsx)(oe,{className:`w-4 h-4`})})]})})]},t.id)})})]})})]})]}),x&&(0,p.jsxs)(l,{children:[(0,p.jsxs)(s,{children:[(0,p.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`finance.recentTransactions`,`Recent transactions`)}),(0,p.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`finance.transactionsHint`,`Filter by type and cost center, then navigate pages`)})]}),(0,p.jsxs)(c,{className:`space-y-4`,children:[(0,p.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] items-end`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.transactionType`,`Type`)}),(0,p.jsxs)(`select`,{value:F,onChange:e=>ze(e.target.value),className:g,children:[(0,p.jsx)(`option`,{value:`all`,children:e(`finance.allTypes`)}),(0,p.jsx)(`option`,{value:`deposit`,children:e(`finance.deposit`)}),(0,p.jsx)(`option`,{value:`withdraw`,children:e(`finance.withdraw`)}),(0,p.jsx)(`option`,{value:`print_charge`,children:e(`finance.printCharge`)})]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.costCenters`,`Cost centers`)}),(0,p.jsxs)(`select`,{value:I,onChange:e=>Be(e.target.value===`all`?`all`:Number(e.target.value)),className:g,children:[(0,p.jsx)(`option`,{value:`all`,children:e(`finance.allCostCenters`)}),(G||[]).map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),Z&&(0,p.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`,`Loading...`)}),!Z&&(!Q||Q.length===0)&&(0,p.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noTransactions`,`No transactions available.`)}),!Z&&Q.length>0&&cn.length===0&&(0,p.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noTransactionsForFilter`,`No transactions match the selected filters.`)}),!Z&&cn.length>0&&(0,p.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,p.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,p.jsx)(`th`,{className:v,children:e(`common.date`,`Date`)}),$&&(0,p.jsx)(`th`,{className:v,children:e(`common.user`,`User`)}),(0,p.jsx)(`th`,{className:v,children:e(`finance.costCenter`,`Cost center`)}),(0,p.jsx)(`th`,{className:v,children:e(`finance.transactionType`,`Type`)}),(0,p.jsx)(`th`,{className:v,children:e(`common.description`,`Description`)}),(0,p.jsx)(`th`,{className:v,children:e(`finance.amount`,`Amount`)}),(0,p.jsx)(`th`,{className:v,children:e(`finance.balanceAfter`,`Balance after`)}),$&&(0,p.jsx)(`th`,{className:v,children:e(`common.actions`,`Actions`)})]})}),(0,p.jsx)(`tbody`,{children:cn.map(n=>{let r=n.amount>=0,ee=n.cost_center_id==null?null:(G||[]).find(e=>e.id===n.cost_center_id),te=nn.get(n.user_id),i=n.transaction_type===`print_charge`?he(n.description??null):null,a=i?.isPartial??!1;return(0,p.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,p.jsx)(`td`,{className:y,children:ge(n.created_at,t.language)}),$&&(0,p.jsx)(`td`,{className:y,children:te||e(`finance.userWithId`,`User #{{id}}`,{id:n.user_id})}),(0,p.jsx)(`td`,{className:y,children:ee?.name||`-`}),(0,p.jsx)(`td`,{className:y,children:(0,p.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,p.jsx)(`span`,{children:un(n.transaction_type)}),a&&(0,p.jsx)(`span`,{className:`rounded border border-yellow-500/40 bg-yellow-500/10 px-2 py-0.5 text-[11px] text-yellow-300`,children:i&&i.partialType?e(`finance.partialStatus.${i.partialType}`,i.partialType):e(`finance.partial`,`Partial`)})]})}),(0,p.jsx)(`td`,{className:y,children:(i?.cleanedDescription??n.description)||`-`}),(0,p.jsxs)(`td`,{className:`${y} ${r?`text-green-400`:`text-red-400`}`,children:[r?`+`:`-`,Y,Math.abs(n.amount).toFixed(2)]}),(0,p.jsx)(`td`,{className:y,children:n.balance_after==null?`-`:`${n.balance_after<0?`-`:``}${Y}${Math.abs(n.balance_after).toFixed(2)}`}),$&&(0,p.jsx)(`td`,{className:y,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(u,{size:`sm`,variant:`secondary`,onClick:()=>Xt(n),disabled:Rt.isPending,children:(0,p.jsx)(ae,{className:`w-4 h-4`})}),(0,p.jsx)(u,{size:`sm`,variant:`danger`,onClick:()=>Tt(n.id),disabled:Lt.isPending,children:(0,p.jsx)(oe,{className:`w-4 h-4`})})]})})]},n.id)})})]})}),!Z&&cn.length>0&&(0,p.jsx)(`div`,{className:`flex justify-end pt-2 lg:pt-0`,children:(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,onClick:()=>P(0),disabled:N===0||Z,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.first`,`First`),children:(0,p.jsx)(ne,{className:`w-4 h-4`})}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>P(e=>Math.max(0,e-50)),disabled:N===0||Z,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.prev`,`Previous`),children:(0,p.jsx)(ue,{className:`w-4 h-4`})}),(0,p.jsx)(`span`,{className:`text-bambu-gray px-1 whitespace-nowrap`,children:e(`finance.pageNumberOf`,`Page {{page}} of {{total}}`,{page:ln,total:sn})}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>P(e=>e+50),disabled:Z||ln>=sn,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.next`,`Next`),children:(0,p.jsx)(se,{className:`w-4 h-4`})}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>P(Math.max(0,(sn-1)*50)),disabled:Z||ln>=sn,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.last`,`Last`),children:(0,p.jsx)(re,{className:`w-4 h-4`})})]})})]})]}),et&&nt!==null&&(0,p.jsx)(b,{title:e(`finance.editTransaction`,`Edit Transaction`),onClose:()=>tt(!1),size:`md`,children:(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`common.user`,`User`)}),(0,p.jsxs)(`select`,{className:g,value:it||``,onChange:e=>at(e.target.value?Number(e.target.value):null),children:[(0,p.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user...`)}),X.map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.costCenter`,`Cost center (optional)`)}),(0,p.jsxs)(`select`,{className:g,value:ot||``,onChange:e=>st(e.target.value?Number(e.target.value):null),children:[(0,p.jsx)(`option`,{value:``,children:e(`finance.noCostCenter`,`Personal (no cost center)`)}),(G||[]).map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.amount`,`Amount`)}),(0,p.jsx)(`input`,{type:`number`,step:`0.01`,className:g,value:ct,onChange:e=>lt(e.target.value),placeholder:e(`finance.amountExample`,`e.g., 10.50`)})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`common.description`,`Description`)}),(0,p.jsx)(`textarea`,{className:`${g} resize-none`,rows:3,value:ut,onChange:e=>dt(e.target.value),placeholder:e(`finance.manualAdjustmentExample`,`e.g., Manual adjustment`)})]}),(0,p.jsxs)(`div`,{className:`flex justify-end gap-2 pt-4`,children:[(0,p.jsx)(u,{variant:`secondary`,onClick:()=>tt(!1),children:e(`common.cancel`,`Cancel`)}),(0,p.jsx)(u,{onClick:Zt,disabled:Rt.isPending,children:e(`common.save`,`Save`)})]})]})}),ft&&(0,p.jsx)(b,{title:e(`finance.addManualPrint`,`Add manual print`),onClose:()=>H(!1),size:`md`,children:(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`common.user`,`User`)}),(0,p.jsxs)(`select`,{className:g,value:pt||``,onChange:e=>mt(e.target.value?Number(e.target.value):null),children:[(0,p.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user...`)}),X.map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.costCenter`,`Cost center`)}),(0,p.jsxs)(`select`,{className:g,value:ht||``,onChange:e=>gt(e.target.value?Number(e.target.value):null),children:[(0,p.jsx)(`option`,{value:``,children:e(`finance.selectCostCenter`,`Select cost center...`)}),(G||[]).map(e=>(0,p.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`finance.amount`,`Amount`)}),(0,p.jsx)(`input`,{type:`number`,step:`0.01`,className:g,value:_t,onChange:e=>vt(e.target.value),placeholder:e(`finance.amountExample`,`e.g., 4.00`)})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`common.description`,`Description`)}),(0,p.jsx)(`input`,{type:`text`,value:yt,onChange:e=>bt(e.target.value),placeholder:e(`finance.descriptionOptional`,`Description (optional)`),className:g})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:_,children:e(`common.date`,`Date`)}),(0,p.jsx)(`input`,{type:`datetime-local`,value:xt,onChange:e=>St(e.target.value),className:g})]}),(0,p.jsxs)(`div`,{className:`flex justify-end gap-2 pt-4`,children:[(0,p.jsx)(u,{variant:`secondary`,onClick:()=>H(!1),children:e(`common.cancel`,`Cancel`)}),(0,p.jsx)(u,{onClick:Qt,disabled:zt.isPending,children:zt.isPending?e(`common.saving`,`Saving...`):e(`finance.addManualPrint`,`Add manual print`)})]})]})}),U&&(0,p.jsx)(ce,{title:e(`common.delete`,`Delete`),message:e(`finance.confirmDeleteCostCenter`,`Delete cost center "{{name}}"?`,{name:U.name}),confirmText:e(`common.delete`,`Delete`),variant:`danger`,isLoading:It.isPending,onConfirm:Jt,onCancel:()=>Ct(null)}),wt!=null&&(0,p.jsx)(ce,{title:e(`finance.deleteTransaction`,`Delete transaction`),message:e(`finance.deleteTransactionConfirm`,`Delete this transaction? Balances will be recalculated automatically.`),confirmText:e(`common.delete`,`Delete`),variant:`danger`,isLoading:Lt.isPending,onConfirm:Yt,onCancel:()=>Tt(null)})]})]}):(0,p.jsxs)(`div`,{className:`p-4 md:p-8 space-y-6`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(me,{className:`h-6 w-6 text-bambu-green`}),(0,p.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`finance.title`,`Finance`)})]}),(0,p.jsx)(`div`,{children:(0,p.jsx)(`p`,{className:`text-bambu-gray mt-2 max-w-2xl`,children:e(`finance.subtitle`,`Wallet, personal transactions, and cost centers`)})}),(0,p.jsx)(l,{children:(0,p.jsx)(c,{className:`py-8 text-center text-bambu-gray`,children:e(`finance.noAccess`,`You do not have permission to view finance data.`)})})]})}export{x as FinancePage}; \ No newline at end of file diff --git a/static/assets/GCodeViewerPage-DsmGciSh.js b/static/assets/GCodeViewerPage-DsmGciSh.js new file mode 100644 index 000000000..009d57d31 --- /dev/null +++ b/static/assets/GCodeViewerPage-DsmGciSh.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{t as a}from"./useQuery-BBCjCezC.js";import{t as o}from"./arrow-left-0Q6F2rjC.js";import{t as s}from"./GcodeToolpathViewer-Cg6UnTDw.js";import{Vn as c,Wn as l}from"./index-CovRLYqQ.js";var u=e(n(),1),d=t();function f(){let e=c(),[t,n]=l(),{t:f}=i(),p=t.get(`archive`),m=t.get(`library_file`),h=t.get(`plate`),g=a({queryKey:[`gcode-viewer-archive-colors`,p],queryFn:()=>r.getArchiveCapabilities(Number(p)),enabled:!!p,staleTime:5*6e4,retry:!1}),_=a({queryKey:[`gcode-viewer-library-colors`,m],queryFn:()=>r.getLibraryFilePlates(Number(m)),enabled:!!m,staleTime:5*6e4,retry:!1}),v=a({queryKey:[`gcode-viewer-archive-plates`,p],queryFn:()=>r.getArchivePlates(Number(p)),enabled:!!p,staleTime:5*6e4,retry:!1}),y=(0,u.useMemo)(()=>(p?v.data?.plates:_.data?.plates)??[],[p,v.data,_.data]),b=(0,u.useMemo)(()=>h?Number(h):y.length===0?null:Math.min(...y.map(e=>e.index)),[h,y]),x=e=>{if(e===b)return;let r=new URLSearchParams(t);r.set(`plate`,String(e)),n(r,{replace:!0})},S=(0,u.useMemo)(()=>{if(p)return g.data?.filament_colors;let e=y.find(e=>e.index===b)||y[0];if(!e?.filaments?.length)return;let t=[];for(let n of e.filaments){let e=Math.max(0,(n.slot_id??1)-1);n.color&&(t[e]=n.color)}return t.length>0?t:void 0},[p,g.data,y,b]),C=(0,u.useMemo)(()=>{let e=e=>h?`${e}?plate=${encodeURIComponent(h)}`:e;return p?e(r.getArchiveGcode(Number(p))):m?e(r.getLibraryFileGcodeUrl(Number(m))):null},[p,m,h]),w=()=>{window.history.length>1?e(-1):e(p?`/archives`:`/files`)},T=p?f(`gcodeViewer.backToArchives`,`Back to Archives`):f(`gcodeViewer.backToFiles`,`Back to File Manager`);return(0,d.jsxs)(`div`,{className:`flex flex-col min-h-[calc(100vh-64px)] lg:h-screen`,children:[(0,d.jsxs)(`div`,{className:`flex-shrink-0 px-4 py-2 border-b border-bambu-dark-tertiary flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,d.jsxs)(`button`,{type:`button`,onClick:w,className:`inline-flex items-center gap-1.5 text-sm text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors`,children:[(0,d.jsx)(o,{className:`w-4 h-4`}),T]}),y.length>1&&(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,d.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:f(`gcodeViewer.plates`,`Plates`)}),y.map(e=>(0,d.jsx)(`button`,{type:`button`,onClick:()=>x(e.index),"aria-pressed":e.index===b,title:e.name??void 0,className:`px-2 py-0.5 rounded text-xs transition-colors ${e.index===b?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white`}`,children:f(`gcodeViewer.plateN`,`Plate {{n}}`,{n:e.index})},e.index))]})]}),C?(0,d.jsx)(s,{gcodeUrl:C,filamentColors:S,className:`flex-1 min-h-0`}):(0,d.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-bambu-gray`,children:f(`gcodeViewer.noSource`,`No file was given to preview.`)})]})}export{f as GCodeViewerPage}; \ No newline at end of file diff --git a/static/assets/GcodeToolpathViewer-Cg6UnTDw.js b/static/assets/GcodeToolpathViewer-Cg6UnTDw.js new file mode 100644 index 000000000..31090a447 --- /dev/null +++ b/static/assets/GcodeToolpathViewer-Cg6UnTDw.js @@ -0,0 +1,129 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,l as r,w as i}from"./client-DnySrlFv.js";import{t as a}from"./createLucideIcon-DvBYJlWL.js";import{t as o}from"./loader-circle-BEmFtawu.js";import{A as s,O as c,_ as l,a as u,i as d,l as f,m as p,p as m,r as h,t as g,w as _}from"./OrbitControls-Bbqf07B-.js";var v=a(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),y=e(n(),1),b={travel:0,wall:1,sparseInfill:2,solidInfill:3,skirt:4,support:5,raft:6,gapFill:7,thinWall:8,bridge:9,ironing:10,primeTower:11},x={"outer wall":b.wall,"inner wall":b.wall,perimeter:b.wall,"external perimeter":b.wall,"overhang wall":b.bridge,"overhang perimeter":b.bridge,"sparse infill":b.sparseInfill,"internal infill":b.sparseInfill,"solid infill":b.solidInfill,"internal solid infill":b.solidInfill,"top surface":b.solidInfill,"top solid infill":b.solidInfill,"bottom surface":b.solidInfill,skirt:b.skirt,"skirt/brim":b.skirt,brim:b.skirt,support:b.support,"support material":b.support,"support interface":b.support,"support material interface":b.support,"support transition":b.support,raft:b.raft,"gap fill":b.gapFill,"gap infill":b.gapFill,"thin wall":b.thinWall,"floating vertical shell":b.solidInfill,"internal bridge":b.bridge,"bottom shell":b.solidInfill,bridge:b.bridge,"bridge infill":b.bridge,"internal bridge infill":b.bridge,ironing:b.ironing,"prime tower":b.primeTower,"wipe tower":b.primeTower,custom:b.wall},S=8,C=Math.PI*2,w=.02,T=256,E=15,D=class{data=new Float32Array(1024*S);count=0;widths=[];push(e,t,n,r,i,a,o,s,c){if((this.count+1)*S>this.data.length){let e=new Float32Array(this.data.length*2);e.set(this.data),this.data=e}let l=this.count*S;this.data[l]=e,this.data[l+1]=t,this.data[l+2]=n,this.data[l+3]=r,this.data[l+4]=i,this.data[l+5]=a,this.data[l+6]=o,this.data[l+7]=c,this.count+=1,this.widths.push(s)}get length(){return this.count}toFloat32Array(){return this.data.slice(0,this.count*S)}};function O(e){let t,n=0;for(let[r,i]of e)i>n&&(t=r,n=i);return t}function k(e,t){let n=e.indexOf(t);if(n<0)return;let r=Number.parseFloat(e.slice(n+1));return Number.isFinite(r)?r:void 0}function A(e){let t=[],n=0,r=0,i=0,a=0,o=!1,s=b.wall,c=0,l=new Map,u=0,d=0,f=new D,p=0,m=!1,h=null,g=!1,_=0,v=!1,y=1/0,S=1/0,A=1/0,j=-1/0,M=-1/0,N=-1/0,P=()=>{f.length!==0&&(t.push({z:p,paths:f.toFloat32Array(),widths:f.widths}),f=new D,g=!1,h!==null&&(p=h,h=null))},F=(e,t,a,o)=>{if(o){if(!m&&g&&a!==p&&P(),g||(p=a,h=null),g=!0,!v){v=!0,n=e,r=t,i=a;return}f.push(n,r,i,s,e,t,a,c,_),u+=1,ej&&(j=e),t>M&&(M=t),a>N&&(N=a)}else v&&(f.push(n,r,i,b.travel,e,t,a,0,_),d+=1);n=e,r=t,i=a,v=!0};for(let t of e.split(` +`)){let e=t.trim();if(e.length===0)continue;if(e.charCodeAt(0)===59){let t=e.slice(1).trimStart(),n=t.indexOf(`:`),r=(n>=0?t.slice(0,n):t).trim().toUpperCase(),i=n>=0?t.slice(n+1).trim():``;if(r===`FEATURE`||r===`TYPE`)s=x[i.toLowerCase()]??b.wall;else if(r===`LINE_WIDTH`||r===`WIDTH`){let e=Number.parseFloat(i);Number.isFinite(e)&&e>0&&(c=e,l.set(e,(l.get(e)??0)+1))}else if(r===`CHANGE_LAYER`||r===`LAYER_CHANGE`)m=!0,P();else if(r===`Z_HEIGHT`||r===`Z`){let e=Number.parseFloat(i);Number.isFinite(e)&&(h=e)}continue}if(e.startsWith(`M83`)){o=!0;continue}if(e.startsWith(`M82`)){o=!1;continue}if(e.startsWith(`G92`)){let t=k(e,`E`);t!==void 0&&(a=t);continue}if(e.charCodeAt(0)===84){let t=Number.parseInt(e.slice(1),10);Number.isFinite(t)&&t>=0&&t<=E&&(_=t);continue}let u=e.startsWith(`G2 `)||e.startsWith(`G3 `)||e.startsWith(`G2`)||e.startsWith(`G3`),d=e.startsWith(`G1`)||e.startsWith(`G0`);if(!d&&!u||u&&!/^G[23](\s|$)/.test(e)||d&&!/^G[01](\s|$)/.test(e))continue;let f=k(e,`X`)??n,p=k(e,`Y`)??r,g=k(e,`Z`)??i,v=k(e,`E`),y=0;v!==void 0&&(y=o?v:v-a,a=v);let S=y>0;if(u){let t=k(e,`I`)??0,a=k(e,`J`)??0,o=n+t,s=r+a,c=Math.hypot(t,a);if(c>0){let t=Math.atan2(r-s,n-o),a=Math.atan2(p-s,f-o),l=e.charCodeAt(1)===50,u=a-t;if(l){for(;u>=0;)u-=C;for(;u<-C;)u+=C}else{for(;u<=0;)u+=C;for(;u>C;)u-=C}if(f===n&&p===r){let t=Math.max(1,Math.round(k(e,`P`)??1));u=(l?-C:C)*t}let d=2*Math.acos(Math.max(-1,Math.min(1,1-w/c))),m=Math.max(1,Math.min(T,Math.ceil(Math.abs(u)/Math.max(d,.001))));for(let e=1;e<=m;e+=1){let n=e/m,r=t+u*n;F(o+c*Math.cos(r),s+c*Math.sin(r),i+(g-i)*n,S)}continue}}(f!==n||p!==r||g!==i)&&F(f,p,g,S)}return P(),{layers:t,segmentCount:u,travelCount:d,defaultWidth:O(l)??.42,bounds:u>0?{min:[y,S,A],max:[j,M,N]}:null}}function j(e){return e.map(e=>{let t=e.paths.slice();for(let e=0;e0?t:.42,i=Array(n);for(let t=0;t(a.push(e),o.push(t),s.push(n),u.push(r),c.push(i),l.push(p),d.push(C),f.push(!1),a.length-1);for(let t=0;t0?a[e/8]:r;i<16&&(h[i]+=Math.hypot(u-s,d-c));let D;v>=0&&S===i&&Math.abs(y-s)0&&f[e-1],p=f[e],m=0;if(d||p){let t=d?a[e]-a[e-1]:0,n=d?o[e]-o[e-1]:0,r=d?s[e]-s[e-1]:0,i=p?a[e+1]-a[e]:0,c=p?o[e+1]-o[e]:0,l=p?s[e+1]-s[e]:0;m=Math.atan2(t*c-n*i,t*i+n*c+r*l)}k[e*4]=t,k[e*4+1]=l[e],k[e*4+2]=m,k[e*4+3]=F(P[u[e]]||P[1]),(!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(m))&&(j=!0),A=Math.max(A,Math.abs(n),Math.abs(r),Math.abs(i)),nL&&(L=n),rR&&(R=r),iz&&(z=i)}let B=new Uint32Array(D*4);for(let e=0;eL&&(L=t),nR&&(R=n),rz&&(z=r)}let G=new Int32Array(n+1);{let e=0;for(let t=0;t0?{min:[M,N,I],max:[L,R,z]}:null;return{position:O,hwa:k,segIndex:B,nV:E,nSeg:D,layerSegPrefix:H,travelPos:W,travelPrefix:G,nTrav:U,layerCount:n,maxAbs:A,hasNaN:j,meta:V,typeLengths:h,bbox:ee}}var L=[[11,44,122],[19,89,133],[28,136,145],[4,214,15],[170,242,0],[252,249,3],[245,206,10],[227,136,32],[209,104,48],[194,82,60],[148,38,22]].map(e=>[e[0]/255,e[1]/255,e[2]/255]);function R(e,t,n,r){let i=r.length;if(!(n>t))return r[0];let a=(n-t)/(i-1),o=(e-t)/a,s=Math.max(0,Math.min(i-1,Math.floor(o))),c=Math.max(0,Math.min(i-1,s+1)),l=o-s,u=r[s],d=r[c];return[u[0]+(d[0]-u[0])*l,u[1]+(d[1]-u[1])*l,u[2]+(d[2]-u[2])*l]}var z=[{key:`feature`,label:`Feature type`,cont:!1,unit:``},{key:`speed`,label:`Speed`,cont:!0,unit:`mm/s`},{key:`height`,label:`Layer Height`,cont:!0,unit:`mm`},{key:`width`,label:`Line Width`,cont:!0,unit:`mm`},{key:`fan`,label:`Fan Speed`,cont:!0,unit:`%`},{key:`temp`,label:`Temperature`,cont:!0,unit:`°C`}];function B(e,t,n,r){let i=t.vType[n],a=t.vLayer[n],o=a===0;switch(e){case`height`:return t.vHeight[n];case`width`:return t.vWidth[n];case`speed`:return o?r.firstLayerSpeed:r.speedByType[i]??r.speedByType[1];case`fan`:return ae.key===t)||z[0];if(!o.cont){for(let e=0;ec&&(c=i)}Number.isFinite(s)||(s=0,c=1);for(let e=0;e> 16) & 0xFF; + int g = (c >> 8) & 0xFF; + int b = (c >> 0) & 0xFF; + float f = 1.0 / 255.0; + return f * vec3(r, g, b); +} +float lighting(vec3 eye_position, vec3 eye_normal) { + float top_diffuse = light_top_diffuse * max(dot(eye_normal, light_top_dir), 0.0); + float front_diffuse = light_front_diffuse * max(dot(eye_normal, light_front_dir), 0.0); + float top_specular = light_top_specular * pow(max(dot(-normalize(eye_position), reflect(-light_top_dir, eye_normal)), 0.0), light_top_shininess); + return ambient + top_diffuse + front_diffuse + top_specular + emission; +} +ivec2 tex_coord(sampler2D sampler, int id) { + ivec2 tex_size = textureSize(sampler, 0); + return (tex_size.y == 1) ? ivec2(id, 0) : ivec2(id % tex_size.x, id / tex_size.x); +} +void main() { + int vertex_id = int(vertex_id_float); + int seg_layer = int(seg_layer_u); + if (seg_layer < layer_lo || seg_layer > layer_hi) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; } // 범위 밖 → 클립 + int id_a = int(seg_id_a_u); + int id_b = id_a + 1; + vec3 pos_a = texelFetch(position_tex, tex_coord(position_tex, id_a), 0).xyz; + vec3 pos_b = texelFetch(position_tex, tex_coord(position_tex, id_b), 0).xyz; + vec3 line = pos_b - pos_a; + float line_len = length(line); + vec3 line_dir; + if (line_len < 1e-4) + line_dir = vec3(1.0, 0.0, 0.0); + else + line_dir = line / line_len; + vec3 line_right_dir; + if (abs(dot(line_dir, UP)) > 0.9) { + line_right_dir = normalize(cross(vec3(1, 0, 0), line_dir)); + } + else + line_right_dir = normalize(cross(line_dir, UP)); + vec3 line_up_dir = normalize(cross(line_right_dir, line_dir)); + const vec2 horizontal_vertical_view_signs_array[16] = vec2[]( + vec2(1.0, 0.0), vec2(0.0, 1.0), vec2(0.0, 0.0), vec2(0.0, -1.0), + vec2(0.0, -1.0), vec2(1.0, 0.0), vec2(0.0, 1.0), vec2(0.0, 0.0), + vec2(0.0, 1.0), vec2(-1.0, 0.0), vec2(0.0, 0.0), vec2(1.0, 0.0), + vec2(1.0, 0.0), vec2(0.0, 1.0), vec2(-1.0, 0.0), vec2(0.0, 0.0) + ); + int id = vertex_id < 4 ? id_a : id_b; + vec3 endpoint_pos = vertex_id < 4 ? pos_a : pos_b; + vec4 hwa_color = texelFetch(height_width_angle_tex, tex_coord(height_width_angle_tex, id), 0); // .xyz=h/w/angle, .w=packed color + vec3 height_width_angle = hwa_color.xyz; +#ifdef FIX_TWISTING + int closer_id = (dot(camera_position - pos_a, camera_position - pos_a) < dot(camera_position - pos_b, camera_position - pos_b)) ? id_a : id_b; + vec3 closer_pos = (closer_id == id_a) ? pos_a : pos_b; + vec3 camera_view_dir = normalize(closer_pos - camera_position); + vec3 closer_height_width_angle = texelFetch(height_width_angle_tex, tex_coord(height_width_angle_tex, closer_id), 0).xyz; + vec3 diagonal_dir_border = normalize(closer_height_width_angle.x * line_up_dir + closer_height_width_angle.y * line_right_dir); +#else + vec3 camera_view_dir = normalize(endpoint_pos - camera_position); + vec3 diagonal_dir_border = normalize(height_width_angle.x * line_up_dir + height_width_angle.y * line_right_dir); +#endif + bool is_vertical_view = abs(dot(camera_view_dir, line_up_dir)) / abs(dot(diagonal_dir_border, line_up_dir)) > + abs(dot(camera_view_dir, line_right_dir)) / abs(dot(diagonal_dir_border, line_right_dir)); + vec2 signs = horizontal_vertical_view_signs_array[vertex_id + 8 * int(is_vertical_view)]; +#ifndef POINTY_CAPS + if (vertex_id == 2 || vertex_id == 7) signs = -horizontal_vertical_view_signs_array[(vertex_id - 2) + 8 * int(is_vertical_view)]; +#endif + float view_right_sign = sign(dot(-camera_view_dir, line_right_dir)); + float view_top_sign = sign(dot(-camera_view_dir, line_up_dir)); + float half_height = 0.5 * height_width_angle.x; + float half_width = 0.5 * height_width_angle.y; + vec3 horizontal_dir = half_width * line_right_dir; + vec3 vertical_dir = half_height * line_up_dir; + float horizontal_sign = signs.x * view_right_sign; + float vertical_sign = signs.y * view_top_sign; + vec3 pos = endpoint_pos + horizontal_sign * horizontal_dir + vertical_sign * vertical_dir; + if (vertex_id == 2 || vertex_id == 7) { + float line_dir_sign = (vertex_id == 2) ? -1.0 : 1.0; + if (height_width_angle.z == 0.0) { +#ifdef POINTY_CAPS + pos += line_dir_sign * line_dir * half_width; +#endif + } + else { + pos += line_dir_sign * line_dir * half_width * sin(abs(height_width_angle.z) * 0.5); + pos += sign(height_width_angle.z) * horizontal_dir * cos(abs(height_width_angle.z) * 0.5); + } + } + vec3 eye_position = (view_matrix * vec4(pos, 1.0)).xyz; + vec3 eye_normal = (view_matrix * vec4(normalize(pos - endpoint_pos), 0.0)).xyz; + vec3 color_base = decode_color(hwa_color.w); + color = color_base * lighting(eye_position, eye_normal); + gl_Position = projection_matrix * vec4(eye_position, 1.0); +} +`,U=` +precision highp float; +in vec3 color; +out vec4 fragment_color; +void main() { + fragment_color = vec4(color, 1.0); +} +`;function W(e,t){let n=(t,n)=>{let r=Math.min(2048,Math.max(1,n)),i=Math.max(1,Math.ceil(n/r)),a=new Float32Array(r*i*4);a.set(t.subarray(0,Math.min(t.length,r*i*4)));let o=new e.DataTexture(a,r,i,e.RGBAFormat,e.FloatType);return o.minFilter=o.magFilter=e.NearestFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o},r=n(t.position,t.nV),i=n(t.hwa,t.nV),a=new e.InstancedBufferGeometry;a.setIndex(N),a.setAttribute(`position`,new e.BufferAttribute(new Float32Array(24),3)),a.setAttribute(`vertex_id_float`,new e.BufferAttribute(new Float32Array([0,1,2,3,4,5,6,7]),1));let o=new e.InstancedInterleavedBuffer(t.segIndex,4);a.setAttribute(`seg_id_a_u`,new e.InterleavedBufferAttribute(o,1,0)),a.setAttribute(`seg_layer_u`,new e.InterleavedBufferAttribute(o,1,1)),a.instanceCount=0;let s=new e.RawShaderMaterial({glslVersion:e.GLSL3,uniforms:{view_matrix:{value:new e.Matrix4},projection_matrix:{value:new e.Matrix4},camera_position:{value:new e.Vector3},position_tex:{value:r},height_width_angle_tex:{value:i},layer_lo:{value:0},layer_hi:{value:t.layerCount}},vertexShader:H,fragmentShader:U,side:e.DoubleSide}),c=new e.Mesh(a,s),l=null;if(t.bbox){let{min:n,max:r}=t.bbox,i=new e.Vector3((n[0]+r[0])/2,(n[1]+r[1])/2,(n[2]+r[2])/2),a=Math.hypot(r[0]-n[0],r[1]-n[1],r[2]-n[2])/2+2;l=new e.Sphere(i,a)}c.frustumCulled=!!l,l&&(a.boundingSphere=l);let u=new e.Matrix4,d=new e.Vector3;c.onBeforeRender=(e,t,n)=>{s.uniforms.projection_matrix.value.copy(n.projectionMatrix),s.uniforms.view_matrix.value.multiplyMatrices(n.matrixWorldInverse,c.matrixWorld),u.copy(c.matrixWorld).invert(),n.getWorldPosition(d).applyMatrix4(u),s.uniforms.camera_position.value.copy(d)};let f=new e.BufferGeometry;f.setAttribute(`position`,new e.BufferAttribute(t.travelPos,3)),f.setDrawRange(0,0);let p=new e.LineSegments(f,new e.LineBasicMaterial({color:7041658}));p.frustumCulled=!!l,p.visible=!1,l&&(f.boundingSphere=l);let m=!1,h=0,g=t.layerCount-1,_=()=>{let e=t.travelPrefix[h],n=t.travelPrefix[g+1];f.setDrawRange(m?e*2:0,m?(n-e)*2:0)},v=(e,n)=>{let r=t.layerCount;h=Math.max(0,Math.min(r-1,e|0)),g=Math.max(h,Math.min(r-1,n|0)),s.uniforms.layer_lo.value=h,s.uniforms.layer_hi.value=g,a.instanceCount=t.layerSegPrefix[g+1],_()};return{mesh:c,travLines:p,setVisibleLayers:e=>v(0,(e|0)-1),setLayerRange:v,setTravelVisible:e=>{m=!!e,p.visible=m,_()},setColors:e=>{let t=i.image.data,n=Math.min(e.length,t.length)/4;for(let r=0;r{a.dispose(),s.dispose(),r.dispose(),i.dispose(),f.dispose(),p.material.dispose()},nSeg:t.nSeg,layerCount:t.layerCount}}var G=t(),ee=[`filament`,`feature`,`height`,`width`],te=[{type:b.wall,key:`gcodeViewer.feature.wall`,fallback:`Walls`},{type:b.sparseInfill,key:`gcodeViewer.feature.sparseInfill`,fallback:`Sparse infill`},{type:b.solidInfill,key:`gcodeViewer.feature.solidInfill`,fallback:`Solid infill`},{type:b.bridge,key:`gcodeViewer.feature.bridge`,fallback:`Bridge / overhang`},{type:b.support,key:`gcodeViewer.feature.support`,fallback:`Support`},{type:b.skirt,key:`gcodeViewer.feature.skirt`,fallback:`Skirt / brim`},{type:b.gapFill,key:`gcodeViewer.feature.gapFill`,fallback:`Gap fill`},{type:b.ironing,key:`gcodeViewer.feature.ironing`,fallback:`Ironing`},{type:b.primeTower,key:`gcodeViewer.feature.primeTower`,fallback:`Prime tower`}];function ne(e){let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=Number.parseInt(n.slice(0,6),16);return Number.isFinite(r)?r:44610}var re=e=>e?`rgb(${e.map(e=>Math.round(e*255)).join(`,`)})`:`transparent`;function ie(){let e=L;return e.map((t,n)=>`${re(t)} ${(n/(e.length-1)*100).toFixed(0)}%`).join(`, `)}function ae(e){return Number.isFinite(e)?Math.abs(e)<10?e.toFixed(2):e.toFixed(0):`-`}function oe({gcodeUrl:e,buildVolume:t={x:256,y:256,z:256},filamentColors:n,className:a=``}){let{t:b}=i(),x=(0,y.useRef)(null),[S,C]=(0,y.useState)(!0),[w,T]=(0,y.useState)(null),[E,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(null),N=(n?.length??0)>0,[F,L]=(0,y.useState)(N?`filament`:`feature`),R=(0,y.useRef)(!1);(0,y.useEffect)(()=>{N&&!R.current&&L(`filament`)},[N]);let[z,B]=(0,y.useState)([0,0]),[H,U]=(0,y.useState)(new Set),[oe,se]=(0,y.useState)(new Set),K=F===`filament`,q=K?oe:H,ce=[...q].sort((e,t)=>e-t).join(`,`),le=e=>{let t=t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n};K?se(t):U(t)},[J,ue]=(0,y.useState)(!1),Y=(0,y.useRef)(null),X=(0,y.useRef)(null),de=(0,y.useRef)(null),Z=(0,y.useRef)(null),fe=(0,y.useRef)(null),[pe,me]=(0,y.useState)(0),he=(0,y.useRef)(J),ge=(0,y.useRef)(z);he.current=J,ge.current=z;let _e=(0,y.useRef)(!1),Q=(0,y.useMemo)(()=>({x:t.x,y:t.y,z:t.z}),[`${t.x}x${t.y}x${t.z}`]);(0,y.useEffect)(()=>{let t=!1;C(!0),T(null),D(!1),k(null);let n={},i=r();return i&&(n.Authorization=`Bearer ${i}`),fetch(e,{headers:n}).then(async e=>{if(!e.ok){if(e.status===404){let t=await e.json().catch(()=>({}));if(typeof t.detail==`string`&&t.detail.includes(`sliced`))throw D(!0),Error(`not_sliced`)}throw Error(`Failed to load G-code`)}return e.text()}).then(e=>{if(t)return;_e.current=!1;let n=A(e);k(n),B([0,Math.max(0,n.layers.length-1)]),C(!1)}).catch(e=>{t||(e.message!==`not_sliced`&&T(e.message),C(!1))}),()=>{t=!0}},[e]),(0,y.useEffect)(()=>{let e=x.current;if(!e)return;let t=e.clientWidth||1,n=e.clientHeight||1,r=new c;r.background=new f(1710618),Y.current=r;let i=new _(45,t/n,.1,1e4);X.current=i;let a=new h({antialias:!0});a.setSize(t,n),a.setPixelRatio(Math.min(window.devicePixelRatio,2)),a.domElement.style.display=`block`,a.domElement.style.position=`absolute`,a.domElement.style.inset=`0`,e.appendChild(a.domElement);let o=new g(i,a.domElement);o.enableDamping=!0,o.dampingFactor=.05,de.current=o;let s=new m(Math.max(Q.x,Q.y),Math.ceil(Math.max(Q.x,Q.y)/16),4473924,3355443);s.position.set(Q.x/2,0,-Q.y/2),r.add(s);let l=0,u=()=>{l=requestAnimationFrame(u),o.update(),a.render(r,i)};u();let d=()=>{let t=e.clientWidth||1,n=e.clientHeight||1;i.aspect=t/n,i.updateProjectionMatrix(),a.setSize(t,n)},p=new ResizeObserver(d);return p.observe(e),window.addEventListener(`resize`,d),()=>{window.removeEventListener(`resize`,d),p.disconnect(),cancelAnimationFrame(l),o.dispose(),s.geometry.dispose(),s.material.dispose(),a.dispose(),e.removeChild(a.domElement),Y.current=null,X.current=null,de.current=null}},[Q]),(0,y.useEffect)(()=>{let e=Y.current,t=X.current,n=de.current;if(!e||!t||!n||!O||O.layers.length===0)return;let r=I(M(K?j(O.layers):O.layers,q),O.defaultWidth),i=W(d,r);fe.current=r,Z.current=i;let a=new p;if(a.rotation.x=-Math.PI/2,a.add(i.mesh),a.add(i.travLines),e.add(a),i.setTravelVisible(he.current),i.setLayerRange(ge.current[0],ge.current[1]),me(e=>e+1),!_e.current){_e.current=!0;let e=O.bounds,r=e?new u(new s(e.min[0],e.min[2],-e.max[1]),new s(e.max[0],e.max[2],-e.min[1])):new u(new s(0,0,0),new s(Q.x,1,-Q.y)),i=r.getCenter(new s),a=Math.max(r.getSize(new s).length()/2,.001),o=l.degToRad(t.fov),c=2*Math.atan(Math.tan(o/2)*t.aspect),d=1.15*Math.max(a/Math.sin(o/2),a/Math.sin(c/2));t.position.copy(i).addScaledVector(new s(.7,.5,.7).normalize(),d),t.near=Math.max(d/1e3,.01),t.far=d+a*4,t.updateProjectionMatrix(),n.target.copy(i),n.update()}return()=>{e.remove(a),i.dispose(),Z.current=null,fe.current=null}},[O,K,Q,ce]),(0,y.useEffect)(()=>{Z.current?.setLayerRange(z[0],z[1])},[z]),(0,y.useEffect)(()=>{Z.current?.setTravelVisible(J)},[J]);let $=(0,y.useMemo)(()=>{let e=fe.current;if(!e||!O)return null;if(K){let t=new Float32Array(e.nV*4);for(let r=0;r{$&&Z.current?.setColors($.color)},[$]);let ve=O?.layers.length??0;return E?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 text-bambu-gray ${a}`,children:[(0,G.jsx)(v,{className:`w-8 h-8`}),b(`gcodeViewer.notSliced`,`This file has not been sliced yet.`)]}):w?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 text-bambu-gray ${a}`,children:[(0,G.jsx)(v,{className:`w-8 h-8`}),b(`gcodeViewer.loadFailed`,`Could not load the G-code for this file.`)]}):(0,G.jsxs)(`div`,{className:`relative ${a}`,children:[(0,G.jsx)(`div`,{ref:x,className:`absolute inset-0`}),S&&(0,G.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center gap-2 bg-bambu-dark/60 text-sm text-bambu-gray`,children:[(0,G.jsx)(o,{className:`w-4 h-4 animate-spin`}),b(`gcodeViewer.loading`,`Reading toolpath...`)]}),!S&&ve>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`absolute left-3 top-3 flex flex-col gap-2 rounded border border-bambu-dark-tertiary bg-bambu-dark/85 p-2`,children:[(0,G.jsx)(`div`,{className:`flex overflow-hidden rounded border border-bambu-dark-tertiary`,children:ee.filter(e=>e!==`filament`||N).map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>{R.current=!0,L(e)},className:`px-2 py-1 text-xs transition-colors ${F===e?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:b(`gcodeViewer.view.${e}`,e)},e))}),(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-xs text-bambu-gray`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:J,onChange:e=>ue(e.target.checked),className:`cursor-pointer`}),b(`gcodeViewer.showTravel`,`Travel moves`)]}),K?(0,G.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(n??[]).map((e,t)=>{let n=t+1,r=q.has(n);return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>le(n),"aria-pressed":!r,className:`flex w-full items-center gap-1.5 text-left text-[0.7rem] transition-opacity hover:text-white ${r?`text-bambu-gray/40`:`text-bambu-gray`}`,children:[(0,G.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 shrink-0 rounded-sm border border-white/20 ${r?`opacity-25`:``}`,style:{backgroundColor:e},"aria-hidden":!0}),(0,G.jsx)(`span`,{className:r?`line-through`:``,children:b(`gcodeViewer.filamentSlot`,`Filament {{n}}`,{n:t+1})})]})},t)})}):F===`feature`?(0,G.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:te.map(e=>{let t=q.has(e.type);return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>le(e.type),"aria-pressed":!t,className:`flex w-full items-center gap-1.5 text-left text-[0.7rem] transition-opacity hover:text-white ${t?`text-bambu-gray/40`:`text-bambu-gray`}`,children:[(0,G.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 shrink-0 rounded-sm ${t?`opacity-25`:``}`,style:{backgroundColor:re(P[e.type])},"aria-hidden":!0}),(0,G.jsx)(`span`,{className:t?`line-through`:``,children:b(e.key,e.fallback)})]})},e.type)})}):$&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{className:`h-2.5 w-full rounded-sm border border-white/10`,style:{background:`linear-gradient(to right, ${ie()})`},"aria-hidden":!0}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-[0.7rem] tabular-nums text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:ae($.min)}),(0,G.jsx)(`span`,{className:`text-bambu-gray/70`,children:$.unit}),(0,G.jsx)(`span`,{children:ae($.max)})]})]})]}),(0,G.jsxs)(`div`,{className:`absolute right-3 top-3 flex flex-col items-center gap-1 rounded border border-bambu-dark-tertiary bg-bambu-dark/85 p-2`,children:[(0,G.jsx)(`span`,{className:`text-[0.65rem] tabular-nums text-bambu-gray`,children:z[1]+1}),(0,G.jsx)(`input`,{type:`range`,min:0,max:Math.max(0,ve-1),value:z[1],onChange:e=>{let t=Number(e.target.value);B(([e])=>[Math.min(e,t),t])},"aria-label":b(`gcodeViewer.topLayer`,`Top layer`),className:`h-40 w-4 cursor-pointer`,style:{writingMode:`vertical-lr`,direction:`rtl`}}),(0,G.jsx)(`input`,{type:`range`,min:0,max:Math.max(0,ve-1),value:z[0],onChange:e=>{let t=Number(e.target.value);B(([,e])=>[t,Math.max(t,e)])},"aria-label":b(`gcodeViewer.bottomLayer`,`Bottom layer`),className:`h-40 w-4 cursor-pointer`,style:{writingMode:`vertical-lr`,direction:`rtl`}}),(0,G.jsx)(`span`,{className:`text-[0.65rem] tabular-nums text-bambu-gray`,children:z[0]+1})]})]})]})}export{oe as t}; \ No newline at end of file diff --git a/static/assets/GroupEditPage-n-or9M-C.js b/static/assets/GroupEditPage-n-or9M-C.js new file mode 100644 index 000000000..e4acbbb9b --- /dev/null +++ b/static/assets/GroupEditPage-n-or9M-C.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{t as ee}from"./arrow-left-0Q6F2rjC.js";import{t as c}from"./check-Ck0cMLU4.js";import{n as l}from"./ToastContext-BRX0SW3C.js";import{t as u}from"./loader-circle-BEmFtawu.js";import{t as d}from"./minus-DypeGjGR.js";import{t as f}from"./search-0n0CBc74.js";import{t as p}from"./shield-bODVqOJd.js";import{t as m}from"./triangle-alert-Dt_1FcBy.js";import{t as h}from"./Card-Bzc64K35.js";import{t as g}from"./Button-DDr6eAFy.js";import{Jt as _,Rn as v,Un as y,Ut as b,Vn as x}from"./index-CovRLYqQ.js";var S=e(n(),1),C=t();function w(){let{id:e}=y(),t=x(),n=a(),{t:w}=i(),{showToast:T}=l(),E=!!e,[D,O]=(0,S.useState)(``),[k,A]=(0,S.useState)(``),[j,M]=(0,S.useState)([]),[N,P]=(0,S.useState)(``),[F,I]=(0,S.useState)(!1),{data:L,isLoading:R}=o({queryKey:[`group`,e],queryFn:()=>r.getGroup(Number(e)),enabled:E}),{data:z,isLoading:B}=o({queryKey:[`permissions`],queryFn:()=>r.getPermissions()});E&&L&&!F&&(O(L.name),A(L.description||``),M(L.permissions),I(!0));let V=s({mutationFn:e=>r.createGroup(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`groups`]}),n.invalidateQueries({queryKey:[`group`]}),T(w(`groups.toast.created`)),t(`/settings?tab=users`)},onError:e=>{T(e.message,`error`)}}),H=s({mutationFn:t=>r.updateGroup(Number(e),t),onSuccess:r=>{n.invalidateQueries({queryKey:[`groups`]}),r&&n.setQueryData([`group`,e],r),T(w(`groups.toast.updated`)),t(`/settings?tab=users`)},onError:e=>{T(e.message,`error`)}}),U=V.isPending||H.isPending,W=E&&L?.is_system===!0&&L.name===`Administrators`,G=()=>{if(!D.trim()){T(w(`groups.toast.enterGroupName`),`error`);return}if(E){let e=!L||j.length!==L.permissions.length||j.some(e=>!L.permissions.includes(e));H.mutate({name:D===L?.name?void 0:D,description:k,permissions:L?.is_system&&!e?void 0:j})}else V.mutate({name:D,description:k||void 0,permissions:j})},K=e=>{M(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},q=(e,t)=>{let n=e.permissions.map(e=>e.value);M(e=>{let r=e.filter(e=>!n.includes(e));return t?[...r,...n]:r})},J=e=>e.permissions.every(e=>j.includes(e.value)),Y=e=>{let t=e.permissions.filter(e=>j.includes(e.value)).length;return t>0&&t{z&&M(z.all_permissions)},Z=()=>{M([])},Q=N.toLowerCase(),$=(0,S.useMemo)(()=>z?Q?z.categories.map(e=>({...e,permissions:e.permissions.filter(e=>e.label.toLowerCase().includes(Q))})).filter(e=>e.permissions.length>0):z.categories:[],[z,Q]),te=z?.all_permissions.length??0;return R||B?(0,C.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,C.jsx)(u,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,C.jsxs)(`div`,{className:`space-y-6 max-w-5xl mx-auto`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`button`,{onClick:()=>t(`/settings?tab=users`),className:`p-2 rounded-lg hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors`,children:(0,C.jsx)(ee,{className:`w-5 h-5`})}),(0,C.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:w(E?`groups.editor.title`:`groups.editor.createTitle`)})]}),E&&L?.is_system&&(0,C.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/20 text-yellow-700 dark:text-yellow-400 text-sm`,children:[(0,C.jsx)(m,{className:`w-4 h-4 shrink-0`}),w(`groups.form.systemGroupWarning`)]}),(0,C.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:w(`groups.form.groupName`)}),(0,C.jsx)(`input`,{type:`text`,value:D,onChange:e=>O(e.target.value),disabled:E&&L?.is_system,className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors disabled:opacity-50`,placeholder:w(`groups.form.groupNamePlaceholder`)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:w(`groups.form.description`)}),(0,C.jsx)(`input`,{type:`text`,value:k,onChange:e=>A(e.target.value),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:w(`groups.form.descriptionPlaceholder`)})]})]}),(0,C.jsx)(h,{children:(0,C.jsxs)(`div`,{className:`p-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,C.jsx)(_,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,C.jsx)(`span`,{className:`text-white font-medium text-sm`,children:w(`groups.editor.printerAccess`)}),(0,C.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:W?w(`groups.editor.adminsSeeAllPrinters`):E?L?.restrict_printers?w(`groups.editor.printerAccessLimited`,{printers:L.printer_ids.length,locations:L.locations?.length??0}):w(`groups.editor.printerAccessOpen`):w(`groups.editor.printerAccessAfterCreate`)})]}),E&&!W&&(0,C.jsx)(v,{to:`/settings?tab=users&sub=printer-access&group=${e}`,className:`text-sm text-bambu-green hover:underline shrink-0`,children:w(`groups.editor.managePrinterAccess`)})]})}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[w(`groups.editor.permissionsSelected`,{count:j.length}),` / `,te]}),(0,C.jsx)(g,{size:`sm`,variant:`ghost`,onClick:X,children:w(`groups.editor.selectAll`)}),(0,C.jsx)(g,{size:`sm`,variant:`ghost`,onClick:Z,children:w(`groups.editor.clearAll`)})]}),(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(f,{className:`w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray`}),(0,C.jsx)(`input`,{type:`text`,value:N,onChange:e=>P(e.target.value),placeholder:w(`groups.editor.search`),className:`pl-9 pr-4 py-2 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors w-64`})]})]}),$.length===0?(0,C.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:w(`groups.editor.noResults`)}):(0,C.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:$.map(e=>{let t=z.categories.find(t=>t.name===e.name),n=t.permissions.filter(e=>j.includes(e.value)).length,r=t.permissions.length,i=J(t),a=Y(t);return(0,C.jsxs)(h,{children:[(0,C.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between px-4 py-3 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary rounded-t-xl`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>q(t,!i),className:`w-5 h-5 rounded border flex items-center justify-center transition-colors shrink-0 ${i?`bg-bambu-green border-bambu-green`:a?`bg-bambu-green/50 border-bambu-green`:`border-bambu-gray hover:border-white`}`,children:[i&&(0,C.jsx)(c,{className:`w-3 h-3 text-white`}),a&&!i&&(0,C.jsx)(d,{className:`w-3 h-3 text-white`})]}),(0,C.jsx)(p,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,C.jsx)(`span`,{className:`text-white font-medium text-sm`,children:e.name})]}),(0,C.jsxs)(`span`,{className:`text-xs text-bambu-gray tabular-nums`,children:[n,`/`,r]})]}),(0,C.jsx)(`div`,{className:`p-3 space-y-1`,children:e.permissions.map(e=>(0,C.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-secondary cursor-pointer`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:j.includes(e.value),onChange:()=>K(e.value),className:`w-4 h-4 shrink-0 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark-secondary`}),(0,C.jsxs)(`span`,{className:`flex flex-col`,children:[(0,C.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.label}),e.value===`websocket:connect`&&(0,C.jsx)(`span`,{className:`text-xs text-bambu-gray/60`,children:w(`groups.editor.websocketHint`)})]})]},e.value))})]},e.name)})}),(0,C.jsx)(`div`,{className:`h-16`}),(0,C.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 z-20 px-6 py-3 bg-bambu-dark-secondary border-t border-bambu-dark-tertiary flex items-center justify-center gap-3`,children:[(0,C.jsx)(g,{variant:`secondary`,onClick:()=>t(`/settings?tab=users`),children:w(`common.cancel`)}),(0,C.jsx)(g,{onClick:G,disabled:U||!D.trim(),children:U?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(u,{className:`w-4 h-4 animate-spin`}),w(`common.saving`)]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(b,{className:`w-4 h-4`}),w(`common.save`)]})})]})]})}export{w as GroupEditPage}; \ No newline at end of file diff --git a/static/assets/ImagePreviewModal-CV42BcLH.js b/static/assets/ImagePreviewModal-CV42BcLH.js new file mode 100644 index 000000000..75de2a5b0 --- /dev/null +++ b/static/assets/ImagePreviewModal-CV42BcLH.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,l as i,w as a}from"./client-DnySrlFv.js";import{t as o}from"./loader-circle-BEmFtawu.js";import{n as s,t as c}from"./zoom-out-DNNe6DMN.js";import{t as l}from"./file-DDkFXH-b.js";import{Gt as u,un as d}from"./index-CovRLYqQ.js";import{n as f,r as p,t as m}from"./usePreviewFullscreen-ButueZqN.js";var h=e(n(),1),g=t(),_=.4,v=8,y=1.25,b=30,x=Math.log(y)/b,S=e=>Math.min(v,Math.max(_,e)),C={x:0,y:0};function w(e){return e.deltaMode===1?e.deltaY*16:e.deltaMode===2?e.deltaY*100:e.deltaY}function T({libraryFileId:e,filename:t,fileSize:n,onClose:_}){let{t:v}=a(),T=m(),{isFullscreen:E,toggleFullscreen:D}=T,O=(0,h.useRef)(null),k=(0,h.useRef)(null),[A,j]=(0,h.useState)(null),[M,N]=(0,h.useState)(!1),[P,F]=(0,h.useState)(null),[I,L]=(0,h.useState)(1),[R,z]=(0,h.useState)(C),[B,V]=(0,h.useState)(!1),H=(0,h.useRef)(1),U=(0,h.useRef)(C),W=(0,h.useRef)(new Map),G=(0,h.useRef)(null),K=(0,h.useCallback)((e,t)=>{let n=O.current,r=k.current;if(!n||!r)return e;let i=Math.max(0,(r.offsetWidth*t-n.clientWidth)/2),a=Math.max(0,(r.offsetHeight*t-n.clientHeight)/2);return{x:Math.min(i,Math.max(-i,e.x)),y:Math.min(a,Math.max(-a,e.y))}},[]),q=(0,h.useCallback)((e,t)=>{H.current=e,U.current=t,L(e),z(t)},[]),J=(0,h.useCallback)((e,t,n)=>{let r=H.current,i=S(r*e);if(i===r)return;let a=O.current,o=U.current,s={x:o.x*(i/r),y:o.y*(i/r)};if(a){let e=a.getBoundingClientRect(),c=(t??e.left+e.width/2)-(e.left+e.width/2),l=(n??e.top+e.height/2)-(e.top+e.height/2),u=i/r;s={x:c-(c-o.x)*u,y:l-(l-o.y)*u}}q(i,K(s,i))},[K,q]),Y=(0,h.useCallback)(()=>q(1,C),[q]);(0,h.useEffect)(()=>{let t=!1,a=null;if(j(null),N(!1),F(null),q(1,C),n>52428800){F(v(`fileManager.preview.tooLarge`,{size:l(n)}));return}let o={},s=i();return s&&(o.Authorization=`Bearer ${s}`),(async()=>{let n=await fetch(r.getLibraryFileDownloadUrl(e),{headers:o});if(!n.ok)throw Error(`HTTP ${n.status}`);let i=await n.blob();t||(a=URL.createObjectURL(i),j(a))})().catch(e=>{console.error(`[image-preview] load failed`,e),t||F(v(`fileManager.preview.error`))}),()=>{t=!0,a&&URL.revokeObjectURL(a)}},[e,n,v,q]),(0,h.useEffect)(()=>{let e=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`+`||e.key===`=`?(e.preventDefault(),J(y)):e.key===`-`?(e.preventDefault(),J(1/y)):e.key===`0`&&(e.preventDefault(),Y()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y,J]),(0,h.useEffect)(()=>{let e=O.current;if(!e)return;let t=e=>{e.preventDefault();let t=Math.max(-30,Math.min(b,w(e)));J(Math.exp(-t*x),e.clientX,e.clientY)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[J,A]);let X=e=>{W.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),G.current=null,W.current.size===1&&H.current>1&&(e.currentTarget.setPointerCapture(e.pointerId),V(!0))},Z=e=>{W.current.delete(e.pointerId),G.current=null,W.current.size===0&&V(!1)},Q=e=>{let t=W.current,n=t.get(e.pointerId);if(!n)return;if(e.pointerType===`mouse`&&e.buttons===0){Z(e);return}if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.size===1){if(H.current<=1)return;let t={x:U.current.x+(e.clientX-n.x),y:U.current.y+(e.clientY-n.y)};q(H.current,K(t,H.current));return}if(t.size!==2)return;let[r,i]=Array.from(t.values()),a=Math.hypot(r.x-i.x,r.y-i.y),o=G.current;G.current=a,o!=null&&o>0&&a>0&&J(a/o,(r.x+i.x)/2,(r.y+i.y)/2)},$=I>1;return(0,g.jsx)(f,{title:t,fullscreen:T,onClose:_,icon:(0,g.jsx)(d,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),actions:A?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`button`,{onClick:()=>J(1/y),className:p,"aria-label":v(`fileManager.preview.zoomOut`),children:(0,g.jsx)(c,{className:`w-4 h-4`})}),(0,g.jsx)(`button`,{onClick:()=>J(y),className:p,"aria-label":v(`fileManager.preview.zoomIn`),children:(0,g.jsx)(s,{className:`w-4 h-4`})}),(0,g.jsx)(`button`,{onClick:Y,className:p,"aria-label":v(`fileManager.preview.resetZoom`),children:(0,g.jsx)(u,{className:`w-4 h-4`})})]}):void 0,children:(0,g.jsx)(`div`,{ref:O,"data-testid":`image-preview-content`,className:`relative flex-1 min-h-0 overflow-hidden bg-bambu-dark flex items-center justify-center touch-none ${E?``:`rounded-b-lg`} ${$?B?`cursor-grabbing`:`cursor-grab`:``}`,onDoubleClick:D,onPointerDown:X,onPointerMove:Q,onPointerUp:Z,onPointerCancel:Z,onPointerLeave:Z,children:P?(0,g.jsx)(`p`,{className:`text-bambu-gray text-center p-6`,children:P}):(0,g.jsxs)(g.Fragment,{children:[A&&(0,g.jsx)(`img`,{ref:k,src:A,alt:t,draggable:!1,onLoad:()=>N(!0),onError:()=>F(v(`fileManager.preview.error`)),style:{transform:`translate(${R.x}px, ${R.y}px) scale(${I})`},className:`max-w-full max-h-full object-contain select-none`}),!M&&(0,g.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,g.jsx)(o,{className:`w-8 h-8 text-bambu-green animate-spin`})})]})})})}export{T as ImagePreviewModal}; \ No newline at end of file diff --git a/static/assets/InventoryPage-6lFm9yo0.js b/static/assets/InventoryPage-6lFm9yo0.js new file mode 100644 index 000000000..0a9a4eda3 --- /dev/null +++ b/static/assets/InventoryPage-6lFm9yo0.js @@ -0,0 +1,2 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,n as i,r as a,t as o,v as s,w as c}from"./client-DnySrlFv.js";import{n as l}from"./QueryClientProvider-Ce8_sN3w.js";import{t as u}from"./useQuery-BBCjCezC.js";import{t as d}from"./useMutation-B-Tr2hIP.js";import{t as f}from"./useQueries-Be6PMvSC.js";import{t as p}from"./createLucideIcon-DvBYJlWL.js";import{i as m,n as h,r as g}from"./haSensorDisplay-lPbcOxD8.js";import{t as _}from"./arrow-down-Cj0DZhNf.js";import{t as v}from"./arrow-up-down-BdyOV_2F.js";import{t as y}from"./arrow-up-D-pfJ3WZ.js";import{i as b,n as x,r as S,t as C}from"./ReferenceLine-clJprXoH.js";import{t as w}from"./check-Ck0cMLU4.js";import{a as T,i as E,n as D,t as O}from"./info-ROUoQhJR.js";import{n as ee,t as k}from"./chevrons-right-DTJgqnxZ.js";import{n as te,r as A}from"./ToastContext-BRX0SW3C.js";import{t as j}from"./columns-2-DVEObeDC.js";import{t as M}from"./copy-Cu_0GKCU.js";import{t as N}from"./layout-grid-DkD3u6wa.js";import{t as P}from"./link-2-MI-QCMh8.js";import{t as F}from"./loader-circle-BEmFtawu.js";import{t as ne}from"./lock-MLqgWH4Q.js";import{_ as I,c as L,g as re,h as R,s as ie,v as ae}from"./locationSensorDefaults-zb4rpqFF.js";import{t as oe}from"./package-BGUevlqS.js";import{t as se}from"./search-0n0CBc74.js";import{t as z}from"./sparkles-DRqKNlhr.js";import{L as ce,Rn as le,Xt as ue,c as de,p as fe,s as pe}from"./CartesianChart-BAcHzPFb.js";import{t as B}from"./triangle-alert-Dt_1FcBy.js";import{t as me}from"./unlink-C098nwOf.js";import{t as he}from"./x-DR-Trv6U.js";import{t as V}from"./Button-DDr6eAFy.js";import{r as ge,v as H,y as _e}from"./date-G9KUauqz.js";import{n as ve}from"./filamentSwatchHelpers-D3oXQSGk.js";import{$t as ye,At as be,Cn as xe,Gt as Se,H as Ce,Jt as U,Kt as we,Ln as Te,Lt as Ee,Mn as De,On as Oe,Pt as ke,Rt as Ae,Tt as je,Ut as Me,Wn as Ne,Zt as Pe,_t as Fe,a as Ie,at as Le,bt as Re,cn as ze,en as Be,ft as Ve,i as He,jn as Ue,kn as We,kt as Ge,lt as Ke,o as qe,ot as Je,r as Ye,s as Xe,st as W,w as Ze,wn as Qe,xn as $e,yt as et,zt as tt}from"./index-CovRLYqQ.js";import{i as nt,r as rt}from"./slicerPrinterMatch-CUdoNag2.js";import{t as it}from"./ColumnConfigModal-gVVhKfHC.js";import{n as at,t as ot}from"./AreaChart-DJpIJXxF.js";import{a as st,i as ct,n as lt,o as ut,r as G,s as dt,t as ft}from"./AdditionalSection-ZKpgGfxh.js";import{_ as pt,a as K,b as mt,c as ht,d as gt,f as _t,g as vt,i as yt,l as bt,m as xt,n as St,o as Ct,r as wt,s as Tt,t as Et,u as Dt,v as Ot}from"./utils-dMg0ogiz.js";import{t as kt}from"./AssignToAmsModal-DOax3BGf.js";import{t as At}from"./inventorySearch-CtBW7_f5.js";var q=p(`beaker`,[[`path`,{d:`M4.5 3h15`,key:`c7n0jr`}],[`path`,{d:`M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3`,key:`m1uhx7`}],[`path`,{d:`M6 14h12`,key:`4cwo0f`}]]),jt=p(`chart-no-axes-column`,[[`path`,{d:`M5 21v-6`,key:`1hz6c0`}],[`path`,{d:`M12 21V3`,key:`1lcnhd`}],[`path`,{d:`M19 21V9`,key:`unv183`}]]),Mt=p(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),Nt=p(`group`,[[`path`,{d:`M3 7V5c0-1.1.9-2 2-2h2`,key:`adw53z`}],[`path`,{d:`M17 3h2c1.1 0 2 .9 2 2v2`,key:`an4l38`}],[`path`,{d:`M21 17v2c0 1.1-.9 2-2 2h-2`,key:`144t0e`}],[`path`,{d:`M7 21H5c-1.1 0-2-.9-2-2v-2`,key:`rtnfgi`}],[`rect`,{width:`7`,height:`5`,x:`7`,y:`7`,rx:`1`,key:`1eyiv7`}],[`rect`,{width:`7`,height:`5`,x:`10`,y:`12`,rx:`1`,key:`1qlmkx`}]]),Pt=p(`package-check`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),Ft=p(`store`,[[`path`,{d:`M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5`,key:`slp6dd`}],[`path`,{d:`M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244`,key:`o0xfot`}],[`path`,{d:`M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05`,key:`wn3emo`}]]),It=p(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),J=e(n(),1),Y=t(),Lt=1.65,Rt=[`#1DB954`,`#3B82F6`,`#F59E0B`,`#EF4444`,`#8B5CF6`];function X(e,t,n,r){return`${e}||${t??``}||${n??``}||${r??``}`}function Z(e,t){let n=new Date(e);return n.setDate(n.getDate()+Math.round(t)),n}function zt(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Bt(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Vt(e){if(e.length<2)return null;let t=new Map;for(let n of e){let e=n.created_at.slice(0,10);t.set(e,(t.get(e)??0)+n.weight_used)}if(t.size<2)return null;let n=[...t.entries()].map(([e,t])=>({ms:new Date(e).getTime(),totalG:t})).sort((e,t)=>e.ms-t.ms),r=Date.now(),i=Math.LN2/30,a=[];for(let e=1;ee+t.weight,0);if(o===0)return null;let s=a.reduce((e,t)=>e+t.rate*t.weight,0)/o,c=a.reduce((e,t)=>e+t.weight*(t.rate-s)**2,0)/o;return{rate:s,stdDev:Math.sqrt(c)}}function Ht(e){let t=e.reduce((e,t)=>e+Math.max(0,t.weight_used-(t.weight_used_baseline??0)),0);if(t===0)return null;let n=Date.now(),r=(n-e.reduce((e,t)=>{let n=new Date(t.created_at).getTime();return nr.getAllUsageHistory(5e3),staleTime:6e4,enabled:s}),{data:M=[]}=u({queryKey:[`shopping-list`],queryFn:r.getShoppingList,staleTime:3e4,enabled:s}),N=k?.forecast_global_lead_time_days??0,P=(0,J.useMemo)(()=>{let e=new Map;for(let t of A)e.set(X(t.material,t.subtype,t.brand,t.color_name),t);return e},[A]),F=(0,J.useMemo)(()=>{let e=new Map;for(let t of j){let n=e.get(t.spool_id)??[];n.push(t),e.set(t.spool_id,n)}return e},[j]),I=(0,J.useMemo)(()=>{let t=new Map;for(let n of e){if(n.archived_at)continue;let e=X(n.material,n.subtype,n.brand,n.color_name),r=t.get(e)??{key:e,material:n.material,subtype:n.subtype,brand:n.brand,colorName:n.color_name,spools:[]};r.spools.push(n),t.set(e,r)}return[...t.values()]},[e]),L=(0,J.useMemo)(()=>{let e=new Date;return e.setHours(0,0,0,0),I.map(t=>{let n=P.get(t.key)??(t.colorName===null?null:P.get(X(t.material,t.subtype,t.brand,null))??null),r=n?.lead_time_days??0,i=Math.max(N,r),a=n?.safety_margin_value??14,o=n?.safety_margin_unit??`days`,s=t.spools.reduce((e,t)=>e+Math.max(0,t.label_weight-t.weight_used),0),c=t.spools.reduce((e,t)=>e+t.label_weight,0),l=t.spools.reduce((e,t)=>e+Math.max(0,t.weight_used-(t.weight_used_baseline??0)),0),u=[];for(let e of t.spools)(e.weight_used_baseline??0)===0&&u.push(...F.get(e.id)??[]);let d=null,f=null,p=`none`,m=Vt(u);if(m!==null)d=m.rate,f=m.stdDev,p=`history`;else{let e=Ht(t.spools);e!==null&&(d=e,p=`delta`)}let h=Lt*(f??(d===null?0:d*.2))*Math.sqrt(i)+(o===`g`?a:d===null?a*5:d*a),g=d===null?0:d*i+h,_=d&&d>0?Math.floor(s/d):null,v=_===null?null:Z(e,_),y=d&&d>0?Math.floor((s-g)/d):null,b=y===null?null:Z(e,Math.max(0,y)),x=_!==null&&i>0&&_<=i,S=!x&&y!==null&&y<=0;return{group:t,settings:n,totalRemainingG:s,totalLabelG:c,totalSpools:t.spools.length,totalUsedG:l,dailyRateG:d,dailyRateStdDev:f,rateTier:p,effectiveLeadTimeDays:i,safetyStockG:h,reorderPointG:g,daysRemaining:_,daysUntilROP:y,projectedEmptyDate:v,reorderTriggerDate:b,reorderAlert:S,stockBreakAlert:x}})},[I,P,F,N]),re=(0,J.useMemo)(()=>[...new Set(I.map(e=>e.material))].sort(),[I]),R=(0,J.useMemo)(()=>[...new Set(I.map(e=>e.brand).filter(Boolean))].sort(),[I]),ie=(0,J.useMemo)(()=>{let e=[...L];return v&&(e=e.filter(e=>e.group.material===v)),b&&(e=e.filter(e=>e.group.brand===b)),e.sort((e,t)=>{let n=0,r=0;switch(m){case`material`:n=[e.group.material,e.group.subtype??``,e.group.brand??``].join(` `).toLowerCase(),r=[t.group.material,t.group.subtype??``,t.group.brand??``].join(` `).toLowerCase();break;case`used`:n=e.totalUsedG,r=t.totalUsedG;break;case`days_left`:n=e.daysRemaining??999999,r=t.daysRemaining??999999;break;case`stock`:n=e.totalRemainingG,r=t.totalRemainingG;break}let i=nr);return g===`asc`?i:-i}),e},[L,m,g,v,b]),ae=(0,J.useMemo)(()=>L.filter(e=>!e.settings?.alerts_snoozed&&(e.stockBreakAlert||e.reorderAlert)),[L]),oe=(0,J.useMemo)(()=>[...L].filter(e=>e.dailyRateG!==null).sort((e,t)=>t.totalUsedG-e.totalUsedG).slice(0,5),[L]);if(!s)return(0,Y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-bambu-gray gap-3`,children:[(0,Y.jsx)(ne,{className:`w-8 h-8 opacity-40`}),(0,Y.jsx)(`p`,{className:`text-sm`,children:i(`forecast.noReadAccess`)})]});function se(e){m===e?_(e=>e===`asc`?`desc`:`asc`):(h(e),_(e===`days_left`?`asc`:`desc`))}let z=M.length>0?M.length:null;return(0,Y.jsxs)(`div`,{className:`space-y-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[ae.length>0&&(0,Y.jsxs)(`button`,{onClick:()=>p(e=>!e),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg border text-sm font-medium transition-colors ${ae.some(e=>e.stockBreakAlert)?`bg-red-100 dark:bg-red-500/15 border-red-300 dark:border-red-500/30 text-red-700 dark:text-red-300 hover:bg-red-200 dark:hover:bg-red-500/25`:`bg-yellow-100 dark:bg-yellow-500/15 border-yellow-300 dark:border-yellow-500/30 text-yellow-700 dark:text-yellow-300 hover:bg-yellow-200 dark:hover:bg-yellow-500/25`}`,children:[(0,Y.jsx)(B,{className:`w-4 h-4`}),i(`forecast.alertCount`,{count:ae.length}),f?(0,Y.jsx)(E,{className:`w-3.5 h-3.5`}):(0,Y.jsx)(T,{className:`w-3.5 h-3.5`})]}),d&&(0,Y.jsx)(Yt,{value:N,onSave:e=>{r.updateSettings({forecast_global_lead_time_days:e}).then(()=>{t.invalidateQueries({queryKey:[`settings`]}),n(i(`forecast.globalLeadTimeSaved`),`success`)})}}),(0,Y.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${v?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:i(`inventory.material`)}),re.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]}),(0,Y.jsxs)(`select`,{value:b,onChange:e=>x(e.target.value),className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${b?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:i(`inventory.brand`)}),R.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]}),(0,Y.jsxs)(`button`,{onClick:()=>D(e=>!e),className:`relative flex items-center gap-2 px-3 py-1.5 rounded-lg border border-bambu-dark-tertiary text-bambu-gray hover:bg-bambu-dark-tertiary text-sm transition-colors ml-auto`,children:[(0,Y.jsx)(tt,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:i(`forecast.shoppingList`)}),z&&(0,Y.jsx)(`span`,{className:`absolute -top-1.5 -right-1.5 w-4 h-4 rounded-full bg-bambu-green text-white text-[10px] font-bold flex items-center justify-center`,children:z})]})]}),f&&ae.length>0&&(0,Y.jsx)(`div`,{className:`space-y-2`,children:ae.map(e=>(0,Y.jsx)(Kt,{forecast:e,onCart:()=>C(e)},e.group.key))}),w&&(0,Y.jsx)(en,{items:M,forecasts:L,globalLeadTime:N,canWrite:d,onClose:()=>D(!1),onRemove:e=>{r.removeFromShoppingList(e).then(()=>t.invalidateQueries({queryKey:[`shopping-list`]})).catch(()=>n(i(`forecast.failedSaveSettings`),`error`))},onClear:()=>{r.clearShoppingList().then(()=>t.invalidateQueries({queryKey:[`shopping-list`]})).catch(()=>n(i(`forecast.failedSaveSettings`),`error`))}}),oe.length>0&&(0,Y.jsx)(Jt,{forecasts:oe,days:O,onDaysChange:ee}),L.length===0?(0,Y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-bambu-gray`,children:[(0,Y.jsx)(le,{className:`w-10 h-10 mb-3 opacity-40`}),(0,Y.jsx)(`p`,{className:`text-sm`,children:i(`forecast.noSpools`)})]}):(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,Y.jsx)(`th`,{className:`w-8 px-4 py-3`}),(0,Y.jsx)(Gt,{col:`material`,active:m,dir:g,onSort:se,children:i(`forecast.sku`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:i(`locations.spools`)}),(0,Y.jsx)(Gt,{col:`stock`,active:m,dir:g,onSort:se,children:i(`forecast.stock`)}),(0,Y.jsx)(Gt,{col:`used`,active:m,dir:g,onSort:se,children:i(`forecast.dailyRate`)}),(0,Y.jsx)(Gt,{col:`days_left`,active:m,dir:g,onSort:se,children:i(`forecast.daysLeft`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:i(`forecast.emptyBy`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:i(`forecast.reorderBy`)}),(0,Y.jsx)(`th`,{className:`w-24 px-4 py-3`})]})}),(0,Y.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:ie.map(e=>(0,Y.jsx)(Xt,{forecast:e,globalLeadTime:N,canWrite:d,onSaved:()=>t.invalidateQueries({queryKey:[`sku-settings`]}),onCart:()=>C(e),showToast:n},e.group.key))})]})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 px-4 py-3 text-xs text-bambu-gray border-t border-bambu-dark-tertiary bg-bambu-dark-tertiary/20`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-bambu-green inline-block`}),i(`forecast.trendLegend`)]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-blue-400 inline-block`}),i(`forecast.estimatedLegend`)]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-bambu-gray/40 inline-block`}),i(`forecast.noDataLegend`)]})]})]}),S&&(0,Y.jsx)(nn,{forecast:S,onClose:()=>C(null),onAdd:e=>{r.addToShoppingList(e).then(()=>{t.invalidateQueries({queryKey:[`shopping-list`]}),n(i(`forecast.addedToCart`),`success`),C(null),D(!0)}).catch(()=>n(i(`forecast.failedAddItem`),`error`))}})]})}function Gt({col:e,active:t,dir:n,onSort:r,children:i}){return(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide cursor-pointer select-none hover:text-white transition-colors`,onClick:()=>r(e),children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center`,children:[i,t===e?n===`asc`?(0,Y.jsx)(y,{className:`w-3 h-3 ml-1 text-bambu-green`}):(0,Y.jsx)(_,{className:`w-3 h-3 ml-1 text-bambu-green`}):(0,Y.jsx)(v,{className:`w-3 h-3 ml-1 opacity-40`})]})})}function Kt({forecast:e,onCart:t}){let{t:n}=c(),r=[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),i=e.stockBreakAlert;return(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 rounded-lg border text-sm ${i?`bg-red-50 dark:bg-red-500/10 border-red-300 dark:border-red-500/30 text-red-700 dark:text-red-300`:`bg-yellow-50 dark:bg-yellow-500/10 border-yellow-300 dark:border-yellow-500/30 text-yellow-700 dark:text-yellow-300`}`,children:[(0,Y.jsx)(B,{className:`w-4 h-4 flex-shrink-0`}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:r}),i?(0,Y.jsxs)(`span`,{className:`ml-2 text-xs opacity-80`,children:[n(`forecast.stockBreakRisk`),` — `,n(`forecast.stockBreakDetail`,{days:e.daysRemaining,lt:e.effectiveLeadTimeDays})]}):(0,Y.jsxs)(`span`,{className:`ml-2 text-xs opacity-80`,children:[n(`forecast.reorderNow`),` — `,n(`forecast.reorderTriggerPassed`,{date:e.reorderTriggerDate?zt(e.reorderTriggerDate):`—`})]})]}),(0,Y.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1.5 px-2.5 py-1 rounded border border-current text-xs opacity-70 hover:opacity-100 transition-opacity`,children:[(0,Y.jsx)(tt,{className:`w-3 h-3`}),` `,n(`forecast.order`)]})]})}var qt=[{label:`1W`,value:7},{label:`1M`,value:30},{label:`6M`,value:180}];function Jt({forecasts:e,days:t,onDaysChange:n}){let{t:r}=c(),i=Array.from({length:t+1},(e,t)=>t),a=e.map((e,n)=>({key:e.group.key,label:[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),color:Rt[n%Rt.length],rop:e.reorderPointG,points:Ut(e,t)})),o=i.map(e=>{let t={day:e,label:Bt(Z(new Date,e))};for(let n of a){let r=n.points.find(t=>t.day===e);t[n.key]=r?.stock??0}return t}),s=(()=>{for(let e=t;e>=0;e--)if(a.some(t=>o[e]?.[t.key]>0))return e;return t})(),l=o.slice(0,s+1),u=a.filter(e=>e.rop>0);return(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,Y.jsx)(le,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:r(`forecast.chartTitle`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1 hidden sm:inline`,children:r(`forecast.dashedLinesROP`)}),(0,Y.jsx)(`div`,{className:`ml-auto flex items-center bg-bambu-dark-tertiary rounded-lg p-0.5`,children:qt.map(e=>(0,Y.jsx)(`button`,{onClick:()=>n(e.value),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors ${t===e.value?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:e.label},e.value))})]}),(0,Y.jsx)(ue,{width:`100%`,height:220,children:(0,Y.jsxs)(ot,{data:l,margin:{top:4,right:8,bottom:0,left:0},children:[(0,Y.jsx)(`defs`,{children:a.map(e=>(0,Y.jsxs)(`linearGradient`,{id:`grad-${e.key}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Y.jsx)(`stop`,{offset:`5%`,stopColor:e.color,stopOpacity:.25}),(0,Y.jsx)(`stop`,{offset:`95%`,stopColor:e.color,stopOpacity:.02})]},e.key))}),(0,Y.jsx)(fe,{strokeDasharray:`3 3`,stroke:`#374151`,strokeOpacity:.5}),(0,Y.jsx)(de,{dataKey:`label`,tick:{fill:`#6B7280`,fontSize:10},interval:Math.max(0,Math.ceil(s/8)-1),axisLine:!1,tickLine:!1}),(0,Y.jsx)(pe,{tick:{fill:`#6B7280`,fontSize:10},axisLine:!1,tickLine:!1,tickFormatter:e=>e>=1e3?`${(e/1e3).toFixed(1)}kg`:`${e}g`,width:48}),(0,Y.jsx)(ce,{content:({label:e,payload:t})=>t?.length?(0,Y.jsxs)(`div`,{style:{background:`#1a1a2e`,border:`1px solid #374151`,borderRadius:8,fontSize:12,padding:`8px 12px`},children:[(0,Y.jsx)(`div`,{style:{color:`#9CA3AF`,marginBottom:6},children:e}),t.map(e=>{let t=a.find(t=>t.key===String(e.dataKey));return typeof e.value==`number`?(0,Y.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:`#E5E7EB`,marginBottom:2},children:[(0,Y.jsx)(`span`,{style:{color:t?.color??`#9CA3AF`,fontSize:10},children:`●`}),(0,Y.jsx)(`span`,{children:t?.label??String(e.dataKey)}),(0,Y.jsxs)(`span`,{style:{color:`#9CA3AF`,marginLeft:4},children:[e.value,`g`]})]},String(e.dataKey)):null})]}):null}),(0,Y.jsx)(x,{formatter:e=>(0,Y.jsx)(`span`,{style:{color:`#9CA3AF`,fontSize:11},children:a.find(t=>t.key===e)?.label??e})}),a.map(e=>(0,Y.jsx)(at,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:2,fill:`url(#grad-${e.key})`,dot:!1,activeDot:{r:3}},e.key)),u.map(e=>(0,Y.jsx)(C,{y:e.rop,stroke:e.color,strokeDasharray:`4 3`,strokeOpacity:.6},`rop-${e.key}`))]})})]})}function Yt({value:e,onSave:t}){let{t:n}=c(),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(String(e));function s(){let e=parseInt(a,10);isNaN(e)||e<0||(t(e),i(!1))}return(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-bambu-dark-tertiary/40 rounded-lg border border-bambu-dark-tertiary text-xs text-bambu-gray`,children:[(0,Y.jsx)(O,{className:`w-3.5 h-3.5 flex-shrink-0`,"aria-label":n(`forecast.globalLeadTimeHint`)}),(0,Y.jsxs)(`span`,{className:`hidden sm:inline`,children:[n(`forecast.globalLeadTime`),`:`]}),r?(0,Y.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault(),s()},children:[(0,Y.jsx)(`input`,{type:`number`,min:0,max:365,value:a,onChange:e=>o(e.target.value),className:`w-14 px-1.5 py-0.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,autoFocus:!0}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`d`}),(0,Y.jsx)(`button`,{type:`submit`,className:`px-2 py-0.5 bg-bambu-green text-white text-xs rounded hover:bg-bambu-green/80`,children:n(`forecast.save`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>i(!1),className:`text-xs text-bambu-gray hover:text-white`,children:`✕`})]}):(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsxs)(`span`,{className:`font-semibold text-white`,children:[e,`d`]}),(0,Y.jsx)(`button`,{onClick:()=>{o(String(e)),i(!0)},className:`p-0.5 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,Y.jsx)(I,{className:`w-3 h-3`})})]})]})}function Xt({forecast:e,globalLeadTime:t,canWrite:n,onSaved:i,onCart:a,showToast:o}){let{t:s}=c(),[l,u]=(0,J.useState)(!1),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(String(e.settings?.lead_time_days??0)),[v,y]=(0,J.useState)(String(e.settings?.safety_margin_value??14)),[x,S]=(0,J.useState)(e.settings?.safety_margin_unit??`days`);(0,J.useEffect)(()=>{f||_(String(e.settings?.lead_time_days??0))},[e.settings?.lead_time_days,f]),(0,J.useEffect)(()=>{m||(y(String(e.settings?.safety_margin_value??14)),S(e.settings?.safety_margin_unit??`days`))},[e.settings?.safety_margin_value,e.settings?.safety_margin_unit,m]);let C=d({mutationFn:r.upsertSkuSettings,onSuccess:()=>{i(),o(s(`forecast.settingsSaved`),`success`)},onError:()=>o(s(`forecast.failedSaveSettings`),`error`)}),D=e.settings?.alerts_snoozed??!1,O=[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),ee=e.group.spools[0]?.rgba?Ke(e.group.spools[0].rgba):{backgroundColor:`#4B5563`},k=e.totalLabelG>0?Math.round(e.totalRemainingG/e.totalLabelG*100):0,te=D||e.daysRemaining===null?`text-bambu-gray`:e.stockBreakAlert?`text-red-700 dark:text-red-400`:e.reorderAlert||e.daysRemaining<30?`text-yellow-700 dark:text-yellow-400`:`text-green-700 dark:text-green-400`;function A(t,n,r,i=D){C.mutate({material:e.group.material,subtype:e.group.subtype,brand:e.group.brand,color_name:e.group.colorName,lead_time_days:t,safety_margin_value:n,safety_margin_unit:r,alerts_snoozed:i})}function j(t){t.stopPropagation(),A(e.settings?.lead_time_days??0,e.settings?.safety_margin_value??14,e.settings?.safety_margin_unit??`days`,!D)}let M=e.rateTier===`history`?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-bambu-green/15 text-bambu-green`,children:[(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-bambu-green`}),s(`forecast.trend`)]}):e.rateTier===`delta`?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-400/15 text-blue-700 dark:text-blue-400`,children:[(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-blue-400`}),s(`forecast.estimated`)]}):(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-bambu-dark-tertiary text-bambu-gray/60`,children:[(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-bambu-gray/40`}),s(`forecast.noData`)]});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 cursor-pointer hover:bg-bambu-dark-tertiary/30 transition-colors ${D?``:e.stockBreakAlert?`bg-red-500/5`:e.reorderAlert?`bg-yellow-500/5`:``} ${D?`opacity-50`:``}`,onClick:()=>u(e=>!e),children:[(0,Y.jsx)(`td`,{className:`px-4 py-3`,children:(0,Y.jsx)(`span`,{className:`block w-5 h-5 rounded-full border border-black/20`,style:ee})}),(0,Y.jsx)(`td`,{className:`px-4 py-3`,children:(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:O})}),(0,Y.jsx)(`td`,{className:`px-4 py-3`,children:(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.totalSpools})}),(0,Y.jsx)(`td`,{className:`px-4 py-3 min-w-[140px]`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full ${k>50?`bg-bambu-green`:k>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(k,100)}%`}})}),(0,Y.jsxs)(`span`,{className:`text-xs text-bambu-gray min-w-[40px] text-right`,children:[Math.round(e.totalRemainingG),`g`]})]})}),(0,Y.jsx)(`td`,{className:`px-4 py-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:e.dailyRateG===null?`—`:`${e.dailyRateG.toFixed(1)}g/d`}),M]})}),(0,Y.jsx)(`td`,{className:`px-4 py-3`,children:(0,Y.jsx)(`span`,{className:`text-sm font-semibold ${te}`,children:e.daysRemaining===null?(0,Y.jsx)(`span`,{className:`text-bambu-gray font-normal`,children:`—`}):`${e.daysRemaining}d`})}),(0,Y.jsx)(`td`,{className:`px-4 py-3`,children:(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.projectedEmptyDate?zt(e.projectedEmptyDate):`—`})}),(0,Y.jsx)(`td`,{className:`px-4 py-3`,children:(0,Y.jsx)(`span`,{className:`text-sm ${!D&&e.reorderAlert?`text-yellow-700 dark:text-yellow-400`:`text-bambu-gray`}`,children:e.reorderTriggerDate?zt(e.reorderTriggerDate):`—`})}),(0,Y.jsx)(`td`,{className:`px-4 py-3`,onClick:e=>e.stopPropagation(),children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[n&&(0,Y.jsx)(`button`,{onClick:a,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded transition-colors`,title:s(`forecast.addToCart`),children:(0,Y.jsx)(tt,{className:`w-4 h-4`})}),!D&&(e.stockBreakAlert?(0,Y.jsx)(B,{className:`w-4 h-4 text-red-600 dark:text-red-400`,"aria-label":s(`forecast.stockBreakRisk`)}):e.reorderAlert?(0,Y.jsx)(B,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`,"aria-label":s(`forecast.reorderNow`)}):e.daysRemaining===null?null:(0,Y.jsx)(w,{className:`w-4 h-4 text-bambu-green/50`})),n&&(0,Y.jsx)(`button`,{onClick:j,className:`p-1 rounded transition-colors ${D?`text-amber-600/80 dark:text-amber-400/80 hover:text-amber-700 dark:hover:text-amber-300`:`text-slate-400 hover:text-white`}`,title:s(D?`forecast.alertsEnabled`:`forecast.alertsSnoozed`),children:(0,Y.jsx)(b,{className:`w-3.5 h-3.5`})}),(0,Y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),u(e=>!e)},className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,children:l?(0,Y.jsx)(E,{className:`w-4 h-4`}):(0,Y.jsx)(T,{className:`w-4 h-4`})})]})})]}),l&&(0,Y.jsx)(`tr`,{className:`bg-bambu-dark-tertiary/10`,children:(0,Y.jsx)(`td`,{colSpan:9,className:`px-6 py-4`,children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 ${n?`grid-cols-2 sm:grid-cols-4`:`grid-cols-2`}`,children:[(0,Y.jsx)(Zt,{label:s(`forecast.effectiveLeadTime`),value:`${e.effectiveLeadTimeDays}d`,hint:s(`forecast.effectiveLeadTimeHint`,{global:t,sku:e.settings?.lead_time_days??0})}),(0,Y.jsx)(Zt,{label:s(`forecast.reorderPoint`),value:`${Math.round(e.reorderPointG)}g`,hint:s(`forecast.reorderPointHint`)}),n&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Qt,{label:s(`forecast.skuLeadTimeOverride`),hint:s(`forecast.skuLeadTimeHint`),unit:s(`forecast.leadTime`),editing:f,value:e.settings?.lead_time_days??0,inputValue:g,onInputChange:_,onEdit:()=>{_(String(e.settings?.lead_time_days??0)),p(!0)},onSave:()=>{let t=parseInt(g,10);!isNaN(t)&&t>=0&&(A(t,e.settings?.safety_margin_value??14,x),p(!1))},onCancel:()=>p(!1),isPending:C.isPending,saveLabel:s(`forecast.save`),cancelLabel:s(`forecast.cancel`)}),(0,Y.jsx)($t,{value:e.settings?.safety_margin_value??14,unit:x,editing:m,inputValue:v,dailyRateG:e.dailyRateG,onInputChange:y,onUnitChange:e=>S(e),onEdit:()=>{y(String(e.settings?.safety_margin_value??14)),S(e.settings?.safety_margin_unit??`days`),h(!0)},onSave:()=>{let t=parseInt(v,10);!isNaN(t)&&t>=0&&(A(e.settings?.lead_time_days??0,t,x),h(!1))},onCancel:()=>h(!1),isPending:C.isPending,saveLabel:s(`forecast.save`),cancelLabel:s(`forecast.cancel`),safetyMarginLabel:s(`forecast.safetyMarginLabel`)})]})]}),e.group.spools.length>1&&(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:s(`forecast.individualSpools`)}),(0,Y.jsx)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`table`,{className:`w-full`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:`#`}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`inventory.remaining`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`inventory.used`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`forecast.labelWeight`)})]})}),(0,Y.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:e.group.spools.map(e=>{let t=Math.max(0,e.label_weight-e.weight_used),n=e.label_weight>0?t/e.label_weight*100:0;return(0,Y.jsxs)(`tr`,{className:`hover:bg-bambu-dark-tertiary/30 transition-colors`,children:[(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray/70`,children:[`#`,e.id]})}),(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`w-24 h-1.5 bg-bambu-dark-tertiary rounded-full overflow-hidden flex-shrink-0`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full ${n>50?`bg-bambu-green`:n>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(n,100)}%`}})}),(0,Y.jsxs)(`span`,{className:`text-sm text-white`,children:[Math.round(t),`g`]})]})}),(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[Math.round(Math.max(0,e.weight_used-(e.weight_used_baseline??0))),`g`]})}),(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[e.label_weight,`g`]})})]},e.id)})})]})})]})]})})})]})}function Zt({label:e,value:t,hint:n}){return(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-tertiary/40 rounded-lg p-3`,title:n,children:[(0,Y.jsx)(`div`,{className:`text-xs font-medium text-white mb-1`,children:e}),(0,Y.jsx)(`div`,{className:`text-lg font-semibold text-white`,children:t})]})}function Qt({label:e,hint:t,unit:n,editing:r,value:i,inputValue:a,onInputChange:o,onEdit:s,onSave:c,onCancel:l,isPending:u,saveLabel:d=`Save`,cancelLabel:f=`Cancel`}){return(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-tertiary/40 rounded-lg p-3 space-y-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-white`,children:e}),(0,Y.jsx)(`span`,{title:t,children:(0,Y.jsx)(O,{className:`w-3 h-3 text-bambu-gray/50`})})]}),r?(0,Y.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,Y.jsx)(`input`,{type:`number`,min:0,max:365,value:a,onChange:e=>o(e.target.value),className:`w-20 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,autoFocus:!0,disabled:u}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:n}),(0,Y.jsx)(`button`,{type:`submit`,disabled:u,className:`px-2 py-1 bg-bambu-green text-white text-xs rounded hover:bg-bambu-green/80 disabled:opacity-50`,children:d}),(0,Y.jsx)(`button`,{type:`button`,onClick:l,disabled:u,className:`px-2 py-1 text-xs text-bambu-gray hover:text-white`,children:f})]}):(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-lg font-semibold text-white`,children:i}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:n}),(0,Y.jsx)(`button`,{onClick:s,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,Y.jsx)(I,{className:`w-3 h-3`})})]})]})}function $t({value:e,unit:t,editing:n,inputValue:r,dailyRateG:i,onInputChange:a,onUnitChange:o,onEdit:s,onSave:l,onCancel:u,isPending:d,saveLabel:f=`Save`,cancelLabel:p=`Cancel`,safetyMarginLabel:m=`Safety Margin`}){let{t:h}=c(),g=t===`g`?e:i===null?null:Math.round(i*e),_=t===`days`?h(`forecast.safetyMarginHintDays`,{approx:g===null?``:h(`forecast.safetyMarginHintDaysApprox`,{g})}):h(`forecast.safetyMarginHintG`,{approx:i===null?``:h(`forecast.safetyMarginHintGApprox`,{days:Math.round(e/i)})});return(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-tertiary/40 rounded-lg p-3 space-y-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-white`,children:m}),(0,Y.jsx)(`span`,{title:_,children:(0,Y.jsx)(O,{className:`w-3 h-3 text-bambu-gray/50`})})]}),n?(0,Y.jsxs)(`form`,{className:`flex items-center gap-2 flex-wrap`,onSubmit:e=>{e.preventDefault(),l()},children:[(0,Y.jsx)(`input`,{type:`number`,min:0,max:t===`g`?1e4:365,value:r,onChange:e=>a(e.target.value),className:`w-20 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,autoFocus:!0,disabled:d}),(0,Y.jsxs)(`div`,{className:`flex bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded overflow-hidden text-xs`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(`days`),className:`px-2 py-1 transition-colors ${t===`days`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:`days`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(`g`),className:`px-2 py-1 transition-colors ${t===`g`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:`g`})]}),(0,Y.jsx)(`button`,{type:`submit`,disabled:d,className:`px-2 py-1 bg-bambu-green text-white text-xs rounded hover:bg-bambu-green/80 disabled:opacity-50`,children:f}),(0,Y.jsx)(`button`,{type:`button`,onClick:u,disabled:d,className:`px-2 py-1 text-xs text-bambu-gray hover:text-white`,children:p})]}):(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-lg font-semibold text-white`,children:e}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:t}),g!==null&&t===`days`&&(0,Y.jsxs)(`span`,{className:`text-lg font-semibold text-white`,children:[`≈ `,g,`g`]}),t===`g`&&i!==null&&(0,Y.jsxs)(`span`,{className:`text-lg font-semibold text-white`,children:[`≈ `,Math.round(e/i),`d`]}),(0,Y.jsx)(`button`,{onClick:s,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,Y.jsx)(I,{className:`w-3 h-3`})})]})]})}function en({items:e,forecasts:t,globalLeadTime:n,canWrite:i,onClose:a,onRemove:o,onClear:s}){let{t:u}=c(),f=l(),[p,m]=(0,J.useState)(`list`),h=d({mutationFn:async({id:e,status:t,item:n,avgSpoolG:i})=>{if(await r.updateShoppingListStatus(e,t),t===`received`&&n){let t=i??1e3,a={material:n.material,subtype:n.subtype,brand:n.brand,label_weight:t,core_weight:0,core_weight_catalog_id:null,color_name:n.color_name,rgba:null,extra_colors:null,effect_type:null,nozzle_temp_min:null,nozzle_temp_max:null,note:n.note??null,tag_uid:null,tray_uuid:null,data_origin:`manual`,tag_type:null,cost_per_kg:null,last_scale_weight:null,last_weighed_at:null,weight_used:0,slicer_filament:null,slicer_filament_name:null,added_full:null,last_used:null,encode_time:null,category:`Stock`,low_stock_threshold_pct:null,material_number:null};await r.bulkCreateSpools(a,n.quantity_spools),await r.removeFromShoppingList(e)}},onSuccess:()=>{f.invalidateQueries({queryKey:[`shopping-list`]}),f.invalidateQueries({queryKey:[`spools`]})}}),g=(0,J.useMemo)(()=>{let e=new Map;for(let n of t)e.set(n.group.key,n);return e},[t]),_=(0,J.useMemo)(()=>e.map(e=>({item:e,forecast:g.get(X(e.material,e.subtype,e.brand,e.color_name))??null})),[e,g]),v=(0,J.useMemo)(()=>_.filter(({forecast:e})=>!e||e.dailyRateG===null?!1:e.stockBreakAlert||e.daysRemaining!==null&&e.daysRemaining<=e.effectiveLeadTimeDays),[_]);function y(){let t=[u(`forecast.qty`),u(`forecast.material`),u(`inventory.brand`),u(`inventory.subtype`),u(`inventory.color`),`${u(`forecast.weight`)} (g)`,`${u(`forecast.leadTime`)} (d)`,u(`forecast.expectedRestock`),u(`forecast.status`),u(`forecast.note`)],r=e.map(e=>{let t=g.get(X(e.material,e.subtype,e.brand,e.color_name))??null,r=t&&t.totalSpools>0?t.totalLabelG/t.totalSpools:1e3,i=Math.round(e.quantity_spools*r),a=t?.effectiveLeadTimeDays??n??0,o=a>0?zt(Z(new Date,a)):``;return[e.quantity_spools,e.material,e.brand??``,e.subtype??``,e.color_name??``,i,a||``,o,e.status,e.note??``].map(e=>`"${String(e).replace(/"/g,`""`)}"`).join(`,`)}),i=[t.join(`,`),...r].join(` +`),a=new Blob([i],{type:`text/csv`}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=`shopping-list-${new Date().toISOString().slice(0,10)}.csv`,s.click(),setTimeout(()=>URL.revokeObjectURL(o),100)}return(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(tt,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:u(`forecast.shoppingList`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:u(`forecast.shoppingListItems`,{count:e.length})}),e.length>0&&(0,Y.jsxs)(`div`,{className:`flex bg-bambu-dark-tertiary rounded-md p-0.5 ml-1`,children:[(0,Y.jsxs)(`button`,{onClick:()=>m(`list`),className:`flex items-center gap-1.5 px-2 py-0.5 text-xs font-medium rounded transition-colors ${p===`list`?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:[(0,Y.jsx)(oe,{className:`w-3 h-3`}),u(`forecast.listView`)]}),(0,Y.jsxs)(`button`,{onClick:()=>m(`logistics`),className:`flex items-center gap-1.5 px-2 py-0.5 text-xs font-medium rounded transition-colors ${p===`logistics`?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:[(0,Y.jsx)(jt,{className:`w-3 h-3`}),u(`forecast.logisticsView`),v.length>0&&(0,Y.jsx)(`span`,{className:`w-3.5 h-3.5 rounded-full bg-red-500 text-white text-[9px] font-bold flex items-center justify-center`,children:v.length})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{onClick:y,className:`flex items-center gap-1.5 text-xs text-bambu-gray hover:text-white transition-colors px-2 py-1 rounded border border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`,children:[(0,Y.jsx)(Qe,{className:`w-3 h-3`}),u(`forecast.downloadCsv`)]}),i&&(0,Y.jsx)(`button`,{onClick:s,className:`text-xs text-red-700 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 transition-colors px-2 py-1 rounded border border-red-200 dark:border-red-500/20 hover:bg-red-50 dark:hover:bg-red-500/10`,children:u(`forecast.clearAll`)})]}),(0,Y.jsx)(`button`,{onClick:a,className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:(0,Y.jsx)(he,{className:`w-4 h-4`})})]})]}),e.length===0?(0,Y.jsxs)(`div`,{className:`flex flex-col items-center py-8 text-bambu-gray`,children:[(0,Y.jsx)(oe,{className:`w-8 h-8 mb-2 opacity-30`}),(0,Y.jsx)(`p`,{className:`text-sm`,children:u(`forecast.shoppingListEmpty`)})]}):p===`list`?(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/20`,children:[(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:u(`forecast.qty`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:u(`forecast.material`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:u(`forecast.weight`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:u(`forecast.leadTime`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:u(`forecast.expectedRestock`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:u(`forecast.status`)}),(0,Y.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:u(`forecast.note`)}),(0,Y.jsx)(`th`,{className:`px-4 py-2 text-right text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:u(`forecast.actions`)})]})}),(0,Y.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:e.map(e=>{let t=[e.brand,e.material,e.subtype,e.color_name].filter(Boolean).join(` `),r=v.some(t=>t.item.id===e.id),a=g.get(X(e.material,e.subtype,e.brand,e.color_name))??null,s=a&&a.totalSpools>0?a.totalLabelG/a.totalSpools:1e3,c=Math.round(e.quantity_spools*s),l=a?.effectiveLeadTimeDays??n??0,d=l>0?Z(new Date,l):null,f=e.status===`purchased`||e.status===`received`,p=e.status===`received`,m=h.isPending;return(0,Y.jsxs)(`tr`,{className:`hover:bg-bambu-dark-tertiary/30 transition-colors ${r&&!f?`bg-red-500/5`:``}`,children:[(0,Y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,Y.jsxs)(`span`,{className:`text-sm font-semibold text-bambu-green`,children:[e.quantity_spools,`×`]})}),(0,Y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:t}),r&&!f&&(0,Y.jsx)(B,{className:`w-3.5 h-3.5 text-red-600 dark:text-red-400 flex-shrink-0`,"aria-label":u(`forecast.stockBreakBefore`)})]})}),(0,Y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:c>=1e3?`${(c/1e3).toFixed(1)}kg`:`${c}g`})}),(0,Y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:l>0?`${l}d`:`—`})}),(0,Y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:d?zt(d):`—`})}),(0,Y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,Y.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${p?`bg-bambu-green/20 text-bambu-green`:f?`bg-blue-100 dark:bg-blue-400/20 text-blue-700 dark:text-blue-400`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:u(p?`forecast.received`:f?`forecast.purchased`:`forecast.pending`)})}),(0,Y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.note||`—`})}),(0,Y.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,Y.jsx)(`div`,{className:`flex items-center justify-end gap-1`,children:i&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{onClick:()=>h.mutate({id:e.id,status:f?`pending`:`purchased`}),disabled:m||p,title:u(f?`forecast.resetToPending`:`forecast.markPurchased`),className:`p-1.5 rounded transition-colors disabled:opacity-30 ${f?`text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300`:`text-blue-600/50 dark:text-blue-400/50 hover:text-blue-600 dark:hover:text-blue-400`}`,children:f?(0,Y.jsx)(Se,{className:`w-4 h-4`}):(0,Y.jsx)(Mt,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>h.mutate({id:e.id,status:`received`,item:e,avgSpoolG:s}),disabled:m||!f||p,title:u(`forecast.markReceived`),className:`p-1.5 rounded transition-colors text-bambu-green/50 hover:text-bambu-green disabled:opacity-30`,children:(0,Y.jsx)(Pt,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>o(e.id),className:`p-1 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors`,title:u(`forecast.remove`),children:(0,Y.jsx)(be,{className:`w-3.5 h-3.5`})})]})})})]},e.id)})})]})}):(0,Y.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:_.filter(({item:e})=>e.status!==`received`).map(({item:e,forecast:t})=>(0,Y.jsx)(tn,{item:e,forecast:t,globalLeadTime:n,canWrite:i,onRemove:()=>o(e.id)},e.id))})]})}function tn({item:e,forecast:t,globalLeadTime:n,canWrite:r,onRemove:i}){let{t:a}=c(),o=[e.brand,e.material,e.subtype,e.color_name].filter(Boolean).join(` `),s=(0,J.useMemo)(()=>{if(!t||t.dailyRateG===null||t.dailyRateG<=0)return null;let n=t.dailyRateG,r=t.effectiveLeadTimeDays,i=t.totalSpools>0?t.totalLabelG/t.totalSpools:1e3,a=e.quantity_spools*i,o=Math.max(0,t.totalRemainingG-n*r),s=o+a,c=Math.ceil(s/n),l=Math.min(r+c+5,365),u=[];for(let e=0;e<=l;e++){let i=Bt(Z(new Date,e));if(e===r)u.push({day:e,label:i,stock:Math.round(o),rop:Math.round(t.reorderPointG),safetyStock:Math.round(t.safetyStockG)}),u.push({day:e,label:i,stock:Math.round(s),rop:Math.round(t.reorderPointG),safetyStock:Math.round(t.safetyStockG),arrival:!0});else{let a=e{if(!t||t.dailyRateG===null||t.dailyRateG<=0)return null;let e=Math.floor(t.totalRemainingG/t.dailyRateG);return ee>=1e3?`${(e/1e3).toFixed(1)}kg`:`${e}g`,width:44}),(0,Y.jsx)(ce,{contentStyle:{background:`#1a1a2e`,border:`1px solid #374151`,borderRadius:8,fontSize:11},labelStyle:{color:`#9CA3AF`},formatter:(e,t)=>typeof e==`number`?t===`stock`?`${e}g — ${a(`forecast.stock`)}`:t===`rop`?`${e}g — ${a(`forecast.reorderPoint`)}`:t===`safetyStock`?`${e}g — ${a(`forecast.safetyMarginLabel`)}`:`${e}`:``}),(0,Y.jsx)(at,{type:`linear`,dataKey:`stock`,stroke:`#1DB954`,strokeWidth:2,fill:`url(#cart-post-${e.id})`,dot:!1,activeDot:{r:3}}),t.reorderPointG>0&&(0,Y.jsx)(C,{y:t.reorderPointG,stroke:`#F59E0B`,strokeDasharray:`5 3`,strokeOpacity:.8,label:{value:`ROP`,position:`insideTopRight`,fill:`#F59E0B`,fontSize:9}}),t.safetyStockG>0&&(0,Y.jsx)(C,{y:t.safetyStockG,stroke:`#6B7280`,strokeDasharray:`3 3`,strokeOpacity:.6,label:{value:`SS`,position:`insideTopRight`,fill:`#6B7280`,fontSize:9}}),(0,Y.jsx)(C,{x:Bt(Z(new Date,s.lt)),stroke:`#3B82F6`,strokeWidth:1.5,strokeDasharray:`4 3`,strokeOpacity:.9,label:{value:`+${s.arrivalG>=1e3?`${(s.arrivalG/1e3).toFixed(1)}kg`:`${Math.round(s.arrivalG)}g`} arrives (d${s.lt})`,position:`insideTopLeft`,fill:`#3B82F6`,fontSize:9}}),l!==null&&(0,Y.jsx)(C,{x:Bt(Z(new Date,l)),stroke:`#EF4444`,strokeWidth:1.5,strokeOpacity:.9,label:{value:`OUT`,position:`insideTopLeft`,fill:`#EF4444`,fontSize:9}})]})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mt-2 text-[10px] text-bambu-gray`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`inline-block w-4 border-t-2 border-yellow-400 border-dashed`}),` `,a(`forecast.ropLabel`)]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`inline-block w-4 border-t border-bambu-gray border-dashed`}),` `,a(`forecast.safetyStockLegend`)]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`inline-block w-4 border-t-2 border-blue-400 border-dashed`}),` `,a(`forecast.stockArrivalLegend`)]}),u&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-red-700 dark:text-red-400`,children:[(0,Y.jsx)(`span`,{className:`inline-block w-4 border-t-2 border-red-400`}),` `,a(`forecast.stockoutLegend`)]})]})]}):null]})}function nn({forecast:e,onClose:t,onAdd:n}){let{t:r}=c(),i=[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),[a,o]=(0,J.useState)(`qty`),[s,l]=(0,J.useState)(`1`),[u,d]=(0,J.useState)(`30`),[f,p]=(0,J.useState)(``),m=(0,J.useMemo)(()=>{if(!e.dailyRateG||e.dailyRateG<=0)return null;let t=e.dailyRateG*Number(u),n=e.group.spools.length>0?e.group.spools.reduce((e,t)=>e+t.label_weight,0)/e.group.spools.length:1e3;return Math.ceil(t/n)},[e,u]),h=a===`qty`?parseInt(s,10)||1:m??1;function g(t){t.preventDefault(),n({material:e.group.material,subtype:e.group.subtype,brand:e.group.brand,color_name:e.group.colorName,quantity_spools:h,note:f||null})}return(0,Y.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-2xl border border-bambu-dark-tertiary w-full max-w-sm shadow-2xl`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-5 pt-5 pb-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(tt,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-white`,children:r(`forecast.addToCartTitle`)})]}),(0,Y.jsx)(`button`,{onClick:t,className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:(0,Y.jsx)(he,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`form`,{onSubmit:g,className:`p-5 space-y-4`,children:[(0,Y.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:i}),(0,Y.jsxs)(`div`,{className:`flex bg-bambu-dark-tertiary rounded-lg p-0.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(`qty`),className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors ${a===`qty`?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:r(`forecast.byQuantity`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(`duration`),className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors ${a===`duration`?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:r(`forecast.byDuration`)})]}),a===`qty`?(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:r(`forecast.numberOfSpools`)}),(0,Y.jsx)(`input`,{type:`number`,min:1,max:99,value:s,onChange:e=>l(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,autoFocus:!0})]}):(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:r(`forecast.lastHowManyDays`)}),(0,Y.jsx)(`input`,{type:`number`,min:1,max:365,value:u,onChange:e=>d(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,autoFocus:!0})]}),e.dailyRateG===null?(0,Y.jsx)(`div`,{className:`text-xs text-yellow-700 dark:text-yellow-400 px-1`,children:r(`forecast.noUsageQty`)}):(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 bg-bambu-dark-tertiary/50 rounded-lg`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`≈`}),(0,Y.jsx)(`span`,{className:`text-sm font-semibold text-bambu-green`,children:r(`forecast.spoolCount`,{count:m??0})}),(0,Y.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`at `,e.dailyRateG.toFixed(1),`g/day`]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:r(`forecast.noteOptional`)}),(0,Y.jsx)(`input`,{type:`text`,maxLength:200,value:f,onChange:e=>p(e.target.value),placeholder:r(`forecast.notePlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/40 focus:outline-none focus:border-bambu-green`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,Y.jsx)(`button`,{type:`submit`,className:`flex-1 py-2 bg-bambu-green text-white text-sm font-medium rounded-lg hover:bg-bambu-green/80 transition-colors`,children:r(`forecast.addNSpools`,{count:h})}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-2 text-sm text-bambu-gray hover:text-white border border-bambu-dark-tertiary rounded-lg transition-colors`,children:r(`forecast.cancel`)})]})]})]})})}function rn({links:e,onChange:t,currencySymbol:n}){let{t:i}=c(),{showToast:a}=te(),s=l(),d=(0,J.useRef)(null),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(``),[g,_]=(0,J.useState)(!1),{data:v=[],isLoading:y,isError:b}=u({queryKey:Xe,queryFn:r.getSuppliers});(0,J.useEffect)(()=>{if(!f)return;let e=e=>{d.current&&!d.current.contains(e.target)&&(p(!1),h(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[f]);let x=(0,J.useMemo)(()=>new Set(e.map(e=>e.supplier_id)),[e]),S=(0,J.useMemo)(()=>v.filter(e=>!x.has(e.id)).filter(e=>e.name.toLowerCase().includes(m.trim().toLowerCase())),[v,x,m]),C=v.some(e=>e.name.toLowerCase()===m.trim().toLowerCase()),w=n=>{t([...e,{supplier_id:n.id,supplier_name:n.name,supplier_article_number:``,quoted_price_per_kg:null,is_purchase_source:!1}]),p(!1),h(``)},E=async()=>{let e=m.trim();if(e){_(!0);try{let t=await r.createSupplier({name:e});await He(s),w(t)}catch(e){console.error(`SupplierSection.createAndAdd failed:`,e),a(i(e instanceof o&&e.status===409?`inventory.suppliers.duplicateName`:`inventory.suppliers.createFailed`),`error`)}finally{_(!1)}}},D=(n,r)=>{t(e.map(e=>e.supplier_id===n?{...e,...r}:r.is_purchase_source?{...e,is_purchase_source:!1}:e))},O=n=>{t(e.filter(e=>e.supplier_id!==n))};return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:i(`inventory.suppliers.label`)}),e.length>0&&(0,Y.jsx)(`div`,{className:`space-y-2 mb-2`,children:e.map(e=>(0,Y.jsxs)(`div`,{className:`p-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bambu-green/10 text-bambu-green`,children:[(0,Y.jsx)(Ft,{className:`w-3 h-3`}),e.supplier_name]}),(0,Y.jsxs)(`label`,{className:`ml-auto flex items-center gap-1.5 text-xs text-bambu-gray cursor-pointer`,title:i(`inventory.suppliers.purchaseSourceHelp`),children:[(0,Y.jsx)(`input`,{type:`checkbox`,className:`w-3.5 h-3.5 accent-bambu-green`,checked:e.is_purchase_source,onChange:t=>D(e.supplier_id,{is_purchase_source:t.target.checked})}),i(`inventory.suppliers.purchaseSource`)]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>O(e.supplier_id),className:`p-1 rounded text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary`,"aria-label":i(`common.remove`),children:(0,Y.jsx)(he,{className:`w-3.5 h-3.5`})})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`flex-1 min-w-0 px-2 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:i(`inventory.suppliers.articleNumberPlaceholder`),value:e.supplier_article_number,maxLength:100,onChange:t=>D(e.supplier_id,{supplier_article_number:t.target.value})}),(0,Y.jsxs)(`div`,{className:`relative w-28`,children:[(0,Y.jsx)(`span`,{className:`absolute left-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray pointer-events-none`,children:n}),(0,Y.jsx)(`input`,{type:`number`,className:`w-full pl-6 pr-2 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs text-right placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:i(`inventory.suppliers.pricePlaceholder`),title:i(`inventory.suppliers.priceHelp`),min:0,step:.01,value:e.quoted_price_per_kg??``,onChange:t=>D(e.supplier_id,{quoted_price_per_kg:t.target.value===``?null:parseFloat(t.target.value)})})]})]})]},e.supplier_id))}),(0,Y.jsxs)(`div`,{className:`relative`,ref:d,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-bambu-gray hover:text-white flex items-center justify-between transition-colors focus:outline-none focus:border-bambu-green`,children:[(0,Y.jsx)(`span`,{children:i(`inventory.suppliers.addSupplier`)}),(0,Y.jsx)(T,{className:`w-4 h-4 transition-transform ${f?`rotate-180`:``}`})]}),f&&(0,Y.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg`,children:[(0,Y.jsx)(`div`,{className:`p-2 border-b border-bambu-dark-tertiary`,children:(0,Y.jsx)(`input`,{type:`text`,autoFocus:!0,className:`w-full px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:i(`inventory.suppliers.searchPlaceholder`),value:m,onChange:e=>h(e.target.value)})}),(0,Y.jsx)(`div`,{className:`max-h-48 overflow-y-auto py-1`,children:y?(0,Y.jsxs)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray flex items-center gap-2`,children:[(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}),i(`common.loading`)]}):b?(0,Y.jsxs)(`div`,{className:`px-3 py-2 text-sm text-red-400 flex items-center gap-2`,children:[(0,Y.jsx)(B,{className:`w-4 h-4`}),i(`inventory.suppliers.loadFailed`)]}):(0,Y.jsxs)(Y.Fragment,{children:[S.map(e=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>w(e),className:`w-full px-3 py-2 text-left text-sm text-white hover:bg-bambu-dark-tertiary`,children:e.name},e.id)),S.length===0&&!m.trim()&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:i(`inventory.suppliers.noneLeft`)}),m.trim()&&!C&&(0,Y.jsxs)(`button`,{type:`button`,onClick:E,disabled:g,className:`w-full px-3 py-2 text-left text-sm text-bambu-green hover:bg-bambu-dark-tertiary flex items-center gap-1.5`,children:[g?(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Pe,{className:`w-4 h-4`}),i(`inventory.suppliers.createNew`,{name:m.trim()})]})]})})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`inventory.suppliers.help`)})]})}function an({filaments:e,isLoading:t,selectedId:n,onSelect:r}){let{t:i}=c(),[a,o]=(0,J.useState)(!1),[s,l]=(0,J.useState)(``),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useMemo)(()=>e.find(e=>e.id===n)??null,[e,n]);(0,J.useEffect)(()=>{let e=e=>{u.current&&!u.current.contains(e.target)&&(o(!1),l(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let p=(0,J.useMemo)(()=>{let t=s.toLowerCase().trim();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.material?.toLowerCase().includes(t)??!1)||(e.vendor?.name.toLowerCase().includes(t)??!1)||(e.color_name?.toLowerCase().includes(t)??!1)):e},[e,s]);(0,J.useEffect)(()=>{a&&d.current?.focus()},[a]);let m=()=>{o(!0),l(``)},h=e=>{r(e),o(!1),l(``)};return(0,Y.jsxs)(`div`,{ref:u,className:`relative`,children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:i(`inventory.pickFromSpoolmanCatalog`)}),(0,Y.jsxs)(`button`,{type:`button`,onClick:m,className:`w-full flex items-center gap-2 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-left focus:outline-none focus:border-bambu-green hover:border-bambu-gray transition-colors`,children:[t?(0,Y.jsx)(F,{className:`w-4 h-4 text-bambu-gray animate-spin shrink-0`}):f?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`w-4 h-4 rounded-full shrink-0 border border-white/20`,style:Ke(f.color_hex),"aria-label":i(`inventory.spoolmanFilamentColorSwatch`)}),(0,Y.jsxs)(`span`,{className:`text-white text-sm truncate flex-1`,children:[f.vendor?.name?`${f.vendor.name} — `:``,f.name]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(oe,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray text-sm flex-1`,children:i(`inventory.spoolmanFilamentCatalog`)})]}),(0,Y.jsx)(T,{className:`w-4 h-4 text-bambu-gray shrink-0 ml-auto`})]}),a&&(0,Y.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl`,children:[(0,Y.jsx)(`div`,{className:`p-2 border-b border-bambu-dark-tertiary`,children:(0,Y.jsx)(`input`,{ref:d,type:`text`,value:s,onChange:e=>l(e.target.value),placeholder:i(`inventory.pickFromSpoolmanCatalog`),className:`w-full px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm placeholder-bambu-gray focus:outline-none focus:border-bambu-green`})}),(0,Y.jsx)(`ul`,{className:`max-h-56 overflow-y-auto py-1`,children:t?(0,Y.jsxs)(`li`,{className:`flex items-center justify-center gap-2 py-4 text-bambu-gray text-sm`,children:[(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}),(0,Y.jsx)(`span`,{children:i(`common.loading`,`Loading…`)})]}):p.length===0?(0,Y.jsx)(`li`,{className:`py-4 text-center text-bambu-gray text-sm`,children:i(`inventory.noSpoolmanFilaments`)}):p.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bambu-dark-tertiary transition-colors ${e.id===n?`bg-bambu-dark-tertiary`:``}`,children:[(0,Y.jsx)(`span`,{className:`w-4 h-4 rounded-full shrink-0 border border-white/20`,style:Ke(e.color_hex),"aria-label":i(`inventory.spoolmanFilamentColorSwatch`)}),(0,Y.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`block text-white text-sm truncate`,children:[e.vendor?.name?`${e.vendor.name} — `:``,e.name]}),(0,Y.jsxs)(`span`,{className:`block text-bambu-gray text-xs truncate`,children:[[e.material,e.color_name].filter(Boolean).join(` · `),e.weight?` · ${e.weight}g`:``]})]})]})},e.id))})]})]})}function on(e){let t=(e??``).trim().toUpperCase().slice(0,2);return t===`HH`||t===`HS`?t:null}function sn(e){return e?e===`HH`?`HF`:`S`:null}function cn(e,t){let n=e.nozzles??[];return on(n[(e.printer.nozzle_count??1)>1&&t>0?t:0]?.nozzle_type)??on(n[0]?.nozzle_type)}function ln(e){let t=new Set;for(let n of e.nozzles??[]){let e=(n?.nozzle_diameter??``).trim();e&&parseFloat(e)>0&&t.add(e)}for(let n of e.calibrations){let e=(n.nozzle_diameter??``).trim();e&&parseFloat(e)>0&&t.add(e)}return Array.from(t).sort((e,t)=>parseFloat(e)-parseFloat(t))}function un(e,t){return(e.printer.nozzle_count??1)>1?[{extruder:1,label:t.left},{extruder:0,label:t.right}]:[{extruder:0,label:t.single}]}function dn({formData:e,printersWithCalibrations:t,filamentOptions:n,modelPresets:r,setModelPresets:i,selectedProfiles:a,setSelectedProfiles:o,selectedGroupId:s,setSelectedGroupId:l,printerModels:u,isLoading:d=!1}){let{t:f}=c(),p=(0,J.useMemo)(()=>{let e=new Map,n=[];for(let r of t){let t=(r.printer.model||``).trim();if(!t){n.push(r);continue}let i=e.get(t);i?i.push(r):e.set(t,[r])}return[...Array.from(e.entries()).map(([e,t])=>({id:`m:${e}`,model:e,printers:t,diameters:Array.from(new Set([...mt,...t.flatMap(ln)])).sort((e,t)=>parseFloat(e)-parseFloat(t))})).sort((e,t)=>e.model.localeCompare(t.model)),...n.map(e=>({id:`p:${e.printer.id}`,model:``,printers:[e],diameters:Array.from(new Set([...mt,...ln(e)])).sort((e,t)=>parseFloat(e)-parseFloat(t))}))]},[t]),m=p.find(e=>e.id===s)??p[0],h=(0,J.useMemo)(()=>{let e=new Map;return(t,r)=>{if(!t)return n;let i=e.get(t);if(i||(i=n.filter(e=>{let n=rt(e.name,u??{});return!n||nt(n,t)}),e.set(t,i)),r&&!i.some(e=>e.code===r)){let e=n.find(e=>e.code===r);if(e)return[e,...i]}return i}},[n,u]),g=[e.brand,e.material,e.subtype].map(e=>e.trim()).filter(Boolean).join(` `),_=/^[0-9A-Fa-f]{6,8}$/.test(e.rgba)?`#${e.rgba.slice(0,6)}`:`var(--bambu-gray, #808080)`,v=e=>un(e,{left:f(`inventory.leftNozzle`),right:f(`inventory.rightNozzle`),single:f(`inventory.nozzle`)}),y=t=>t.printer.connected?t.calibrations.filter(t=>Ct(t,e)):[],b=e=>{let t=0;for(let n of e.printers){let r=y(n);for(let i of v(n))for(let o of e.diameters)r.some(e=>(e.extruder_id??0)===i.extruder&&((e.nozzle_diameter??``).trim()||`0.4`)===o)&&(a.get(K(n.printer.id,i.extruder,o))||t++)}return t},x=(e,t,n)=>{i(r=>{let i=new Map(r),a=gt(e,t);return n?i.set(a,{code:n.code,name:n.name}):i.delete(a),i})},S=(e,t,n,r)=>{o(i=>{let a=new Map(i),o=K(e,t,n);return r?a.set(o,r):a.delete(o),a})},C=()=>{let t=n.find(t=>t.code===e.slicer_filament);if(!t)return;let r=t.name.split(`@`)[0].trim().toLowerCase();r&&i(e=>{let t=new Map(e);for(let e of p){if(!e.model)continue;let n=h(e.model,void 0).filter(e=>e.name.toLowerCase().startsWith(r)&&rt(e.name,u??{})!==null);if(n.length!==0)for(let r of e.diameters){let i=n.find(e=>RegExp(`\\b${r.replace(`.`,`\\.`)}\\s*nozzle\\b`,`i`).test(e.name)),a=n.find(e=>!/\b[\d.]+\s*nozzle\b/i.test(e.name)),o=i??a;o&&t.set(gt(e.model,r),{code:o.code,name:o.name})}}return t})};if(t.length===0)return(0,Y.jsx)(`div`,{className:`p-6 bg-bambu-dark rounded-lg text-center`,children:(0,Y.jsxs)(`p`,{className:`text-bambu-gray flex items-center justify-center gap-2`,children:[d&&(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}),f(d?`common.loading`:`inventory.noPrintersConfigured`)]})});let T=(e,t,n)=>{let i=gt(e,t),a=r.get(i),o=h(e,a?.code);return(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,Y.jsx)(ct,{ariaLabel:`${e} ${t}mm ${f(`inventory.filamentPreset`)}`,value:a?.code??``,options:o,inheritLabel:n,disabled:!e,onChange:n=>x(e,t,n)})}),(0,Y.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide px-2 py-1 rounded-full shrink-0 ${a?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:f(a?`inventory.presetOverride`:`inventory.presetInherited`)})]})};return(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(g||e.color_name)&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg`,children:[(0,Y.jsx)(`span`,{className:`w-5 h-5 rounded-full border border-white/15 shrink-0`,style:{background:_},"aria-hidden":`true`}),g&&(0,Y.jsx)(`span`,{className:`text-sm text-white truncate`,children:g}),e.color_name&&(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray truncate`,children:e.color_name})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-4`,children:[(0,Y.jsx)(`div`,{role:`tablist`,"aria-label":f(`inventory.printersTab`),"aria-orientation":`vertical`,className:`md:w-52 md:shrink-0 md:self-start md:sticky md:top-0 flex md:flex-col gap-1.5 overflow-x-auto md:overflow-x-visible`,children:p.map(e=>{let t=e===m,n=b(e);return(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,onClick:()=>l(e.id),"aria-selected":t,className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-left transition-colors shrink-0 md:shrink ${t?`bg-bambu-green/10 border-bambu-green/40 text-white`:`bg-transparent border-transparent text-bambu-gray hover:bg-bambu-dark hover:text-white`}`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-semibold truncate`,children:e.model||f(`inventory.unknownModel`)}),(0,Y.jsx)(`div`,{className:`text-[11px] text-bambu-gray`,children:e.printers.length===1?f(`inventory.onePrinter`):f(`inventory.nPrinters`,{n:e.printers.length})})]}),n>0?(0,Y.jsx)(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray shrink-0`,children:n}):(0,Y.jsx)(w,{className:`w-3.5 h-3.5 text-bambu-green shrink-0`})]},e.id)})}),(0,Y.jsx)(`div`,{className:`flex-1 min-w-0`,children:m&&(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h4`,{className:`text-base font-semibold text-white truncate`,children:m.model||f(`inventory.unknownModel`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m.printers.map(e=>e.printer.name).join(`, `)})]}),e.slicer_filament&&(0,Y.jsxs)(`button`,{type:`button`,onClick:C,title:f(`inventory.autoMatchPresetsHint`),className:`flex items-center gap-1.5 px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white hover:border-bambu-green transition-colors shrink-0`,children:[(0,Y.jsx)(z,{className:`w-3.5 h-3.5`}),f(`inventory.autoMatchPresets`)]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-semibold text-bambu-gray uppercase tracking-wide`,children:f(`inventory.filamentPreset`)}),m.model?(0,Y.jsx)(`div`,{className:`space-y-2`,children:m.diameters.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray w-14 shrink-0`,children:[e,`mm`]}),(0,Y.jsx)(`div`,{className:`flex-1 min-w-0`,children:T(m.model,e,f(`inventory.presetUseSpoolDefault`))})]},e))}):(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray italic`,children:f(`inventory.presetNeedsModel`)})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-semibold text-bambu-gray uppercase tracking-wide`,children:f(`inventory.kProfilesPerPrinter`)}),e.material?m.printers.map(e=>{let t=y(e);return(0,Y.jsxs)(`div`,{className:`p-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,Y.jsx)(U,{className:`w-3.5 h-3.5 text-bambu-gray shrink-0`}),(0,Y.jsx)(`span`,{className:`text-sm font-semibold text-white truncate`,children:e.printer.name}),(0,Y.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide px-2 py-0.5 rounded-full shrink-0 ${e.printer.connected?`bg-green-500/20 text-green-500`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:e.printer.connected?f(`inventory.connected`):f(`inventory.offline`)})]}),e.printer.connected?t.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray italic py-1`,children:f(`inventory.noKProfilesMatch`)}):(0,Y.jsxs)(`div`,{className:`grid gap-x-3 gap-y-1.5 items-center`,style:{gridTemplateColumns:`3.5rem repeat(${v(e).length}, minmax(0, 1fr))`},children:[(0,Y.jsx)(`span`,{}),v(e).map(e=>(0,Y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wide text-bambu-gray`,children:e.label},e.extruder)),m.diameters.map(n=>(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray`,children:[n,`mm`]}),v(e).map(r=>{let i=t.filter(e=>(e.extruder_id??0)===r.extruder&&((e.nozzle_diameter??``).trim()||`0.4`)===n),o=K(e.printer.id,r.extruder,n),s=a.get(o);if(i.length===0)return(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray/50 px-2 py-1.5`,title:f(`inventory.noKProfilesMatch`),children:`—`},o);let c=cn(e,r.extruder),l=on(s?.nozzle_id),u=!!(c&&l&&c!==l);return(0,Y.jsxs)(`select`,{title:u?f(`inventory.kProfileFlowMismatch`,{profile:sn(l),fitted:sn(c)}):void 0,"aria-label":`${e.printer.name} ${r.label} ${n}mm`,value:s?String(s.cali_idx):``,onChange:t=>{let a=i.find(e=>String(e.cali_idx)===t.target.value)??null;S(e.printer.id,r.extruder,n,a)},className:`min-w-0 px-2 py-1.5 bg-bambu-dark-secondary border rounded-lg text-sm text-white focus:outline-none focus:border-bambu-green ${u?`border-amber-500/60`:`border-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:f(`inventory.kProfileNotSet`)}),i.map(e=>{let t=sn(on(e.nozzle_id));return(0,Y.jsx)(`option`,{value:e.cali_idx,children:`${t?`[${t}] `:``}${e.name||e.filament_id} K=${e.k_value.toFixed(3)}`},e.cali_idx)})]},o)})]},n))]}):(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray italic py-1`,children:f(`inventory.printerOffline`)})]},e.printer.id)}):(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray italic`,children:f(`inventory.selectMaterialFirst`)})]})]})})]})]})}function fn(e){let t=H(e);return t?t.toLocaleDateString(`en-GB`,{day:`2-digit`,month:`2-digit`,year:`2-digit`})+` `+t.toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`}):``}var pn={completed:`text-bambu-green`,failed:`text-red-700 dark:text-red-400`,aborted:`text-yellow-700 dark:text-yellow-400`};function mn({spoolId:e}){let{t}=c(),n=l(),{showToast:i}=te(),{data:a,isLoading:o}=u({queryKey:[`spool-usage`,e],queryFn:()=>r.getSpoolUsageHistory(e)}),s=d({mutationFn:()=>r.clearSpoolUsageHistory(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`spool-usage`,e]}),i(t(`inventory.historyCleared`),`success`)}});return o?(0,Y.jsx)(`div`,{className:`flex justify-center py-4`,children:(0,Y.jsx)(F,{className:`w-5 h-5 animate-spin text-bambu-green`})}):!a||a.length===0?(0,Y.jsxs)(`div`,{className:`text-center py-4 text-bambu-gray text-sm`,children:[(0,Y.jsx)(Oe,{className:`w-5 h-5 mx-auto mb-2 opacity-50`}),t(`inventory.noUsageHistory`)]}):(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:t(`inventory.usageHistory`)}),(0,Y.jsxs)(V,{variant:`ghost`,size:`sm`,onClick:()=>s.mutate(),disabled:s.isPending,className:`text-xs text-bambu-gray hover:text-red-700 dark:hover:text-red-400`,children:[(0,Y.jsx)(be,{className:`w-3 h-3 mr-1`}),t(`inventory.clearHistory`)]})]}),(0,Y.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-1`,children:a.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-bambu-dark/50 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:fn(e.created_at)}),e.print_name&&(0,Y.jsx)(`span`,{className:`text-white ml-2 truncate`,title:e.print_name,children:e.print_name})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0 ml-2`,children:[(0,Y.jsxs)(`span`,{className:`text-white font-medium`,children:[e.weight_used.toFixed(1),`g`]}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[`(`,e.percent_used,`%)`]}),(0,Y.jsx)(`span`,{className:pn[e.status]||`text-bambu-gray`,children:e.status})]})]},e.id))})]})}var hn={tag_uid:null,tray_uuid:null,tag_type:null,data_origin:null};function gn({isOpen:e,onClose:t,spool:n,mode:i,printersWithCalibrations:a=[],currencySymbol:s,onSpoolsCreated:f,spoolmanMode:p=!1,spoolsQueryKey:m=[`inventory-spools`]}){let{t:h}=c(),g=l(),{showToast:_}=te(),v=()=>Ie(g,m),y=i===`edit`,b=i===`copy`,[x,S]=(0,J.useState)(ut),[C,w]=(0,J.useState)({}),[T,E]=(0,J.useState)(`filament`),[D,O]=(0,J.useState)(!1),[ee,k]=(0,J.useState)(!1),[A,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(!1),[ne,I]=(0,J.useState)([]),[L,re]=(0,J.useState)(!1),[R,ie]=(0,J.useState)(!1),[ae,oe]=(0,J.useState)(1),[se,z]=(0,J.useState)(!1);(0,J.useEffect)(()=>{z(!1)},[e,n?.id]);let[ce,le]=(0,J.useState)(!1),[ue,de]=(0,J.useState)(!1),[fe,pe]=(0,J.useState)([]),[B,ge]=(0,J.useState)(new Set),[ve,ye]=(0,J.useState)(``),[be,xe]=(0,J.useState)([]),[Se,Ce]=(0,J.useState)([]),[U,we]=(0,J.useState)([]),[Te,Ee]=(0,J.useState)([]),[De,Oe]=(0,J.useState)([]),[Ae,je]=(0,J.useState)([]),[Ne,Pe]=(0,J.useState)([]),[Fe,Le]=(0,J.useState)(!1),[ze,Ve]=(0,J.useState)(new Map),[He,Ue]=(0,J.useState)(new Map),[We,Ge]=(0,J.useState)(``),Ke=a.length>0?a:Ne,qe=ze.size+He.size,{data:Je=[],isLoading:Xe,error:W}=u({queryKey:[`spoolman-inventory-filaments`],queryFn:()=>r.getSpoolmanInventoryFilaments(),enabled:p&&e,staleTime:6e4,retry:!1});(0,J.useEffect)(()=>{je(Tt())},[]),(0,J.useEffect)(()=>{let t=!1;return e&&((async()=>{de(!0);try{let[e,n]=await Promise.allSettled([(async()=>(await r.getCloudStatus()).is_authenticated?{connected:!0,presets:await r.getFilamentPresets()}:{connected:!1,presets:[]})(),(async()=>(await r.orcaCloudStatus()).connected?{connected:!0,presets:(await r.orcaCloudListProfiles()).filament}:{connected:!1,presets:[]})()]);if(t)return;let i=e.status===`fulfilled`&&e.value.connected,a=n.status===`fulfilled`&&n.value.connected,o=e.status===`fulfilled`?e.value.presets:[],s=n.status===`fulfilled`?n.value.presets:[];le(i||a),pe([...o,...s]),ge(new Set(s.map(e=>e.setting_id)))}catch(e){if(t)return;console.error(`Failed to fetch cloud presets:`,e),le(!1)}finally{t||de(!1)}})(),r.getSpoolCatalog().then(xe).catch(console.error),r.getColorCatalog().then(Oe).catch(console.error),r.getLocalPresets().then(e=>we(e.filament)).catch(console.error),r.getBuiltinFilaments().then(Ee).catch(console.error),r.getLocations().then(e=>Ce(e.map(e=>({id:e.id,name:e.name})))).catch(console.error),a.length===0&&(async()=>{Le(!0);try{let e=await r.getPrinters(),n=await Promise.all(e.map(e=>r.getPrinterStatus(e.id).catch(()=>null))),i=await Promise.all(e.map(async(e,t)=>{let r=n[t],i=r?.connected??!1,a=[];return i&&(a=await wt(e.id,r)),{printer:{...e,connected:i},calibrations:a,nozzles:r?.nozzles}}));t||Pe(i)}catch(e){console.error(`Failed to fetch printer calibrations:`,e)}finally{t||Le(!1)}})()),()=>{t=!0}},[e,a.length]);let Ze=(0,J.useMemo)(()=>Et(fe,new Set,U,Te,B),[fe,U,Te,B]),Qe=(0,J.useMemo)(()=>{let e=St(fe,U),t=De.map(e=>e.manufacturer?.trim()).filter(e=>!!e),n=new Set([...e,...t]);return Array.from(n).sort((e,t)=>e.localeCompare(t))},[fe,U,De]),$e=(0,J.useMemo)(()=>{let e=De.map(e=>e.material?.trim()).filter(e=>!!e),t=new Set([...Ot,...e]);return Array.from(t).sort((e,t)=>e.localeCompare(t))},[De]),et=(0,J.useMemo)(()=>{let e=[];for(let t of De){let n=t.manufacturer?.trim(),r=t.material?.trim();n&&r&&e.push({brand:n,material:r})}for(let t of fe){let n=Dt(t.name);n.brand&&n.material&&e.push({brand:n.brand,material:n.material})}for(let t of U){let n=Dt(t.name),r=t.filament_vendor?.trim()||n.brand,i=n.material;r&&i&&e.push({brand:r,material:i})}return e},[fe,De,U]),tt=(0,J.useMemo)(()=>{let e=new Map;for(let t of et){let n=t.brand.toLowerCase(),r=t.material.toLowerCase();e.has(n)||e.set(n,new Set),e.get(n).add(r)}return e},[et]),nt=(0,J.useMemo)(()=>{let e=new Map;for(let t of et){let n=t.brand.toLowerCase(),r=t.material.toLowerCase();e.has(r)||e.set(r,new Set),e.get(r).add(n)}return e},[et]),rt=(0,J.useMemo)(()=>xt(Qe,x.brand),[Qe,x.brand]),it=(0,J.useMemo)(()=>xt($e,x.material),[$e,x.material]),at=(0,J.useMemo)(()=>ht(rt,x.material,nt),[rt,x.material,nt]),ot=(0,J.useMemo)(()=>ht(it,x.brand,tt),[it,x.brand,tt]),ct=(0,J.useMemo)(()=>yt(x.slicer_filament,Ze),[x.slicer_filament,Ze]);(0,J.useEffect)(()=>{if(e){if(n){let e=n.rgba&&/^[0-9A-Fa-f]{8}$/.test(n.rgba)?n.rgba:`808080FF`;if(S({material:n.material||``,subtype:n.subtype||``,brand:n.brand||``,color_name:n.color_name_is_synthesized?``:n.color_name||``,rgba:e,extra_colors:n.extra_colors||``,effect_type:n.effect_type||``,label_weight:n.label_weight||1e3,core_weight:n.core_weight??250,core_weight_catalog_id:n.core_weight_catalog_id??null,weight_used:b?0:n.weight_used||0,slicer_filament:n.slicer_filament||``,note:n.note||``,cost_per_kg:n.cost_per_kg??null,category:n.category||``,low_stock_threshold_pct:n.low_stock_threshold_pct??null,material_number:n.material_number||``,location_id:n.location_id??null,last_dried_at:(()=>{let e=b?null:H(n.last_dried_at);return e?_e(e):``})(),spoolman_filament_id:null}),ye(n.slicer_filament_name||n.slicer_filament||``),n.k_profiles&&n.k_profiles.length>0){let e=new Map;for(let t of n.k_profiles){if(t.cali_idx===null||t.cali_idx===void 0)continue;let n=(t.nozzle_diameter||``).trim()||`0.4`,r=t.extruder??0;e.set(K(t.printer_id,r,n),{cali_idx:t.cali_idx,filament_id:``,setting_id:t.setting_id||``,name:t.name||``,k_value:t.k_value,n_coef:0,extruder_id:r,nozzle_diameter:n,nozzle_id:t.nozzle_type||``})}Ve(e)}else Ve(new Map);I((n.suppliers??[]).map(e=>({supplier_id:e.supplier_id,supplier_name:e.supplier_name,supplier_article_number:e.supplier_article_number??``,quoted_price_per_kg:e.quoted_price_per_kg,is_purchase_source:b?!1:e.is_purchase_source})))}else S(ut),ye(``),Ve(new Map),I([]);ie(!1),oe(1),w({}),E(`filament`),Ge(``),Ue(new Map),O(!1),N(!1),k(b&&n?.core_weight_is_inherited===!1),j(!1),re(!1)}},[e,n,i,b]),(0,J.useEffect)(()=>{if(!e||!n)return;let t=!1;return(p?r.getSpoolmanFilamentPresets:r.getSpoolFilamentPresets)(n.id).then(e=>{if(t)return;let n=new Map;for(let t of e)n.set(gt(t.printer_model,t.nozzle_diameter||``),{code:t.slicer_filament||``,name:t.slicer_filament_name||``});Ue(n)}).catch(e=>{t||(console.error(`Failed to load filament preset overrides:`,e),_(h(`inventory.filamentPresetsLoadFailed`),`warning`))}),()=>{t=!0}},[e,n?.id,p]),(0,J.useEffect)(()=>{if(!e||!n||A||x.location_id!=null)return;let t=n.storage_location?.trim();if(!t||Se.length===0)return;let r=Se.find(e=>e.name.toLowerCase()===t.toLowerCase());r&&S(e=>e.location_id===r.id?e:{...e,location_id:r.id})},[e,n,Se,x.location_id,A]);let pt=(e,t)=>{let n=st.has(e);p&&n&&x.spoolman_filament_id!==null&&_(h(`inventory.spoolmanFilamentUnlinked`),`info`),S(r=>({...r,[e]:t,...p&&n&&r.spoolman_filament_id!==null?{spoolman_filament_id:null}:{}})),e===`weight_used`&&O(!0),e===`core_weight`&&k(!0),e===`location_id`&&j(!0),e===`last_dried_at`&&N(!0),C[e]&&w(t=>({...t,[e]:void 0}))},mt=e=>{let t=e.material||``,n=e.name||``,r=t&&n.startsWith(t)?n.slice(t.length).trim():n,i=(e.color_hex??``).replace(`#`,``).toUpperCase(),a=/^[0-9A-F]{6}(?:[0-9A-F]{2})?$/.test(i)?i:`808080`,o=a.length===8?a:`${a}FF`;S(n=>({...n,spoolman_filament_id:e.id,material:t,subtype:r,brand:e.vendor?.name||``,rgba:o,color_name:e.color_name||``,label_weight:e.weight??n.label_weight})),_(h(`inventory.spoolmanFilamentSelected`),`success`)},vt=e=>{je(t=>_t(e,t))},Ct=d({mutationFn:e=>p?r.createSpoolmanInventorySpool(e):r.createSpool(e),onSuccess:async e=>{e?.id&&(!await Kt(e.id)||!await Gt(e.id))||(await v(),f&&f([e]),_(h(`inventory.spoolCreated`),`success`),t())},onError:e=>{e instanceof o&&e.status===503?_(h(`inventory.spoolmanUnreachable`),`error`):_(h(`inventory.saveFailed`),`error`)}}),At=d({mutationFn:({data:e,qty:t})=>p?r.bulkCreateSpoolmanInventorySpools(e,t):r.bulkCreateSpools(e,t),onSuccess:async e=>{let n=p&&`created`in e?e:null,r=n?n.created:e;if(ze.size>0||He.size>0)for(let e of r)await Kt(e.id);if(Wt)for(let e of r)await Gt(e.id);await v(),f&&f(r),n&&n.failed_count>0?_(h(`inventory.spoolsPartiallyCreated`,{created:r.length,total:n.requested_count}),`warning`):_(h(`inventory.spoolsCreated`,{count:r.length}),`success`),t()},onError:e=>{e instanceof o&&e.status===503?_(h(`inventory.spoolmanUnreachable`),`error`):_(h(`inventory.saveFailed`),`error`)}}),jt=d({mutationFn:e=>p?r.updateSpoolmanInventorySpool(n.id,e):r.updateSpool(n.id,e),onSuccess:async()=>{n?.id&&(!await Kt(n.id)||!await Gt(n.id))||(await v(),_(h(`inventory.spoolUpdated`),`success`),t())},onError:e=>{e instanceof o&&e.status===503?_(h(`inventory.spoolmanUnreachable`),`error`):_(h(`inventory.saveFailed`),`error`)}}),Mt=d({mutationFn:()=>p?r.updateSpoolmanInventorySpool(n.id,hn):r.updateSpool(n.id,hn),onSuccess:async()=>{await v(),_(h(`inventory.rfidCleared`,`RFID tag cleared`),`success`),t()},onError:e=>{e instanceof o&&e.status===503?_(h(`inventory.spoolmanUnreachable`),`error`):_(h(`inventory.tagClearFailed`),`error`)}}),{data:Nt,isLoading:Pt}=u({queryKey:[`spool-assignments`],queryFn:()=>r.getAssignments(),enabled:e&&y&&!p}),{data:Ft,isLoading:It}=u({queryKey:[`spoolman-slot-assignments-all`],queryFn:()=>r.getSpoolmanSlotAssignments(),enabled:e&&y&&p}),Lt=(()=>{if(n)return p?Ft?.find(e=>e.spoolman_spool_id===n.id):Nt?.find(e=>e.spool_id===n.id)})(),Rt=p?It:Pt,{data:X}=u({queryKey:[`inventory-spools`],queryFn:()=>r.getSpools(!0),enabled:e}),{data:Z}=u({queryKey:[`settings`],queryFn:r.getSettings,enabled:e}),{data:zt}=u({queryKey:[`slicerPrinterModels`],queryFn:r.getSlicerPrinterModels,enabled:e,staleTime:1/0}),Bt=(()=>{let e=new Set;for(let t of X??[]){let n=t.category?.trim();n&&e.add(n)}return Array.from(e).sort((e,t)=>e.localeCompare(t))})(),Vt=(()=>{let e=new Set;for(let t of X??[]){let n=t.material_number?.trim();n&&e.add(n)}return Array.from(e).sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))})(),Ht=Z?.low_stock_threshold??20,Ut=d({mutationFn:async()=>{if(!Lt)throw Error(`No assignment`);if(p){if(!n)throw Error(`No spool`);await r.unassignSpoolmanSlot(n.id);return}await r.unassignSpool(Lt.printer_id,Lt.ams_id,Lt.tray_id)},onSuccess:async()=>{p?(await g.invalidateQueries({queryKey:[`spoolman-slot-assignments-all`]}),await g.invalidateQueries({queryKey:[`spoolman-slot-assignments`]})):await g.invalidateQueries({queryKey:[`spool-assignments`]}),_(h(`inventory.unassignSuccess`,`Spool unassigned`),`success`),t()},onError:e=>{_(e.message,`error`)}}),Wt=L||b,Gt=async e=>{if(!Wt)return!0;let t=p?r.setSpoolmanSpoolSuppliers:r.setSpoolSuppliers;try{return await t(e,ne.map(e=>({supplier_id:e.supplier_id,supplier_article_number:e.supplier_article_number.trim()||null,quoted_price_per_kg:e.quoted_price_per_kg,is_purchase_source:e.is_purchase_source}))),!0}catch(e){return console.error(`SpoolFormModal.saveSupplierLinks failed:`,e),_(h(`inventory.suppliers.saveFailed`),`error`),!1}},Kt=async e=>{let t=p?r.saveSpoolmanKProfiles:r.saveSpoolKProfiles,n=p?r.saveSpoolmanFilamentPresets:r.saveSpoolFilamentPresets,i=[];for(let[e,t]of ze){let[n,r,a]=e.split(`:`);i.push({printer_id:parseInt(n),extruder:parseInt(r),nozzle_diameter:a||`0.4`,nozzle_type:on(t.nozzle_id),k_value:t.k_value,name:t.name||null,cali_idx:t.cali_idx,setting_id:t.setting_id||null})}let a=[];for(let[e,t]of He){let{model:n,diameter:r}=bt(e);n&&a.push({printer_model:n,nozzle_diameter:r,slicer_filament:t.code||null,slicer_filament_name:t.name||null})}try{await t(e,i)}catch(e){return console.error(`Failed to save K-profiles:`,e),_(h(`inventory.kProfileSaveFailed`),`warning`),!1}try{await n(e,a)}catch(e){return console.error(`Failed to save filament preset overrides:`,e),_(h(`inventory.filamentPresetSaveFailed`),`warning`),!1}return!0};if((0,J.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&!se&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,se]),!e)return null;let qt=()=>{let e=dt(x,R,p,i);if(!e.isValid){w(e.errors),(e.errors.slicer_filament||e.errors.material||e.errors.brand||e.errors.subtype)&&E(`filament`);return}let t=ct?.displayName||ve||null,n={material:x.material||null,subtype:x.subtype||null,brand:x.brand||null,color_name:x.color_name||null,rgba:x.rgba||null,extra_colors:x.extra_colors||null,effect_type:x.effect_type||null,label_weight:x.label_weight,...p?ee?{core_weight:x.core_weight}:{}:{core_weight:x.core_weight,core_weight_catalog_id:x.core_weight_catalog_id},slicer_filament:x.slicer_filament||null,slicer_filament_name:t,nozzle_temp_min:null,nozzle_temp_max:null,note:x.note||null,cost_per_kg:x.cost_per_kg,category:x.category.trim()||null,low_stock_threshold_pct:x.low_stock_threshold_pct,material_number:x.material_number.trim()||null,...p?{spoolman_filament_id:x.spoolman_filament_id}:{}};(!y||D)&&(n.weight_used=x.weight_used),(!y||A)&&(n.location_id=x.location_id),y&&M&&(n.last_dried_at=x.last_dried_at?new Date(x.last_dried_at).toISOString():null),y?jt.mutate(n):ae>1?At.mutate({data:n,qty:ae}):Ct.mutate(n)},Jt=Ct.isPending||At.isPending||jt.isPending||Mt.isPending||Ut.isPending;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:t}),(0,Y.jsxs)(`div`,{className:`relative w-full max-w-5xl mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-baseline gap-2`,children:[h(y?`inventory.editSpool`:b?`inventory.copySpool`:`inventory.addSpool`),y&&n&&(0,Y.jsxs)(`span`,{className:`text-sm font-mono text-bambu-gray`,children:[`#`,n.id]})]}),(0,Y.jsx)(`button`,{onClick:t,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,Y.jsx)(he,{className:`w-5 h-5`})})]}),i===`create`&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Re,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:h(`inventory.quickAdd`)})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{ie(!R),R||E(`filament`)},className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${R?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,children:(0,Y.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${R?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,Y.jsxs)(`div`,{className:`flex border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,Y.jsxs)(`button`,{onClick:()=>E(`filament`),className:`flex-1 px-4 py-2.5 text-sm font-medium flex items-center justify-center gap-2 transition-colors ${T===`filament`?`text-bambu-green border-b-2 border-bambu-green`:`text-bambu-gray hover:text-white`}`,children:[(0,Y.jsx)(q,{className:`w-4 h-4`}),h(`inventory.filamentInfoTab`)]}),!R&&(0,Y.jsxs)(`button`,{onClick:()=>E(`appearance`),className:`flex-1 px-4 py-2.5 text-sm font-medium flex items-center justify-center gap-2 transition-colors ${T===`appearance`?`text-bambu-green border-b-2 border-bambu-green`:`text-bambu-gray hover:text-white`}`,children:[(0,Y.jsx)(Be,{className:`w-4 h-4`}),h(`inventory.colorAndCostTab`)]}),!R&&(0,Y.jsxs)(`button`,{onClick:()=>E(`printers`),className:`flex-1 px-4 py-2.5 text-sm font-medium flex items-center justify-center gap-2 transition-colors ${T===`printers`?`text-bambu-green border-b-2 border-bambu-green`:`text-bambu-gray hover:text-white`}`,children:[(0,Y.jsx)(Re,{className:`w-4 h-4`}),h(`inventory.printersTab`),qe>0&&(0,Y.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded-full bg-bambu-green/20 text-bambu-green`,children:qe})]})]}),(0,Y.jsx)(`div`,{className:`p-4 overflow-y-auto flex-1`,style:{scrollbarGutter:`stable`},children:T===`filament`?(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[p&&!y&&(0,Y.jsx)(`div`,{children:W?(0,Y.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-400 px-1`,children:h(`inventory.spoolmanCatalogLoadFailed`)}):(0,Y.jsx)(an,{filaments:Je,isLoading:Xe,selectedId:x.spoolman_filament_id,onSelect:mt})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-bambu-gray uppercase tracking-wide mb-3`,children:h(`inventory.filamentInfo`)}),(0,Y.jsx)(G,{formData:x,updateField:pt,cloudAuthenticated:ce,loadingCloudPresets:ue,presetInputValue:ve,setPresetInputValue:ye,selectedPresetOption:ct,filamentOptions:Ze,availableBrands:rt,availableMaterials:it,suggestedBrands:at,suggestedMaterials:ot,quickAdd:R,detailsRequired:!R&&!p&&i===`create`,quantity:ae,onQuantityChange:oe,errors:C})]})]}):T===`appearance`?(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-bambu-gray uppercase tracking-wide mb-3`,children:h(`inventory.color`)}),(0,Y.jsx)(lt,{formData:x,updateField:pt,recentColors:Ae,onColorUsed:vt,catalogColors:De})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-bambu-gray uppercase tracking-wide mb-3`,children:h(`inventory.additional`)}),(0,Y.jsx)(ft,{formData:x,updateField:pt,spoolCatalog:be,currencySymbol:s,availableCategories:Bt,availableMaterialNumbers:Vt,availableLocations:Se,showLastDried:y,onCreateLocation:async e=>{try{let t=await r.createLocation({name:e});return Ce(e=>[...e,{id:t.id,name:t.name}].sort((e,t)=>e.name.localeCompare(t.name))),await Ye(g),{id:t.id,name:t.name}}catch(e){return console.error(e),_((e instanceof Error?e.message:h(`locations.saveFailed`))||h(`locations.saveFailed`),`error`),null}},globalLowStockThreshold:Ht,spoolmanMode:p})]}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(rn,{links:ne,onChange:e=>{I(e),re(!0)},currencySymbol:s})}),y&&n&&!p&&(0,Y.jsx)(`div`,{children:(0,Y.jsx)(mn,{spoolId:n.id})})]}):(0,Y.jsx)(dn,{formData:x,printersWithCalibrations:Ke,filamentOptions:Ze,modelPresets:He,setModelPresets:Ue,selectedProfiles:ze,setSelectedProfiles:Ve,selectedGroupId:We,setSelectedGroupId:Ge,printerModels:zt,isLoading:Fe})}),(0,Y.jsxs)(`div`,{className:`flex gap-2 p-4 border-t border-bambu-dark-tertiary flex-shrink-0`,children:[y&&(0,Y.jsxs)(`div`,{className:`flex gap-2 mr-auto`,children:[(0,Y.jsxs)(V,{variant:`secondary`,onClick:()=>Mt.mutate(),disabled:Jt||!(n?.tag_uid||n?.tray_uuid),children:[(0,Y.jsx)(ke,{className:`w-4 h-4`}),h(`inventory.clearRfid`,`Clear RFID Tag`)]}),Lt?(0,Y.jsxs)(V,{variant:`secondary`,onClick:()=>Ut.mutate(),disabled:Jt||Rt,children:[(0,Y.jsx)(me,{className:`w-4 h-4`}),h(`inventory.unassignSpool`,`Unassign`)]}):(0,Y.jsxs)(V,{variant:`secondary`,onClick:()=>z(!0),disabled:Jt||Rt,children:[(0,Y.jsx)(P,{className:`w-4 h-4`}),h(`inventory.assignSpool`,`Assign Spool`)]})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2 ml-auto`,children:[(0,Y.jsx)(V,{variant:`secondary`,onClick:t,children:h(`common.cancel`)}),(0,Y.jsx)(V,{onClick:qt,disabled:Jt,children:Jt?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}),h(`common.saving`)]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Me,{className:`w-4 h-4`}),h(y?`common.save`:b?`inventory.copySpool`:`inventory.addSpool`)]})})]})]})]})]}),y&&n&&(0,Y.jsx)(kt,{isOpen:se,onClose:()=>z(!1),spool:n,printerId:null,variant:`dialog`,spoolmanMode:p})]})}var Q=[{value:`ams_holder_74x33`,i18nKey:`amsHolderSmall`,fallbackLabel:`AMS holder — small (74 × 33 mm)`,fallbackHint:`Single label per page; matches the printable label from MakerWorld model 752566 (AMS Filament Label Holder).`},{value:`ams_holder_75x55`,i18nKey:`amsHolderLarge`,fallbackLabel:`AMS holder — large (75 × 55 mm)`,fallbackHint:`Single label per page; fits the cardstock-insert variant of the AMS Filament Label Holder. Roomy enough for swatch, brand, material, ID, and QR code.`},{value:`box_40x30`,i18nKey:`box40x30`,fallbackLabel:`Box label (40 × 30 mm)`,fallbackHint:`Single label per page; common DK/Brother roll size, good for filament-bag and storage-bin labels.`},{value:`box_62x29`,i18nKey:`box`,fallbackLabel:`Box label (62 × 29 mm)`,fallbackHint:`Single label per page; sized for Brother PT/QL and Dymo small labels.`},{value:`avery_l7160`,i18nKey:`averyL7160`,fallbackLabel:`Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)`,fallbackHint:`EU sheet stock; 21 labels per A4 page.`},{value:`avery_5160`,i18nKey:`avery5160`,fallbackLabel:`Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)`,fallbackHint:`US sheet stock; 30 labels per Letter page.`}],_n={avery_l7160:21,avery_5160:30},vn=[203,300,600],yn={brand:{i18nKey:`brand`,fallback:`Brand`},material:{i18nKey:`material`,fallback:`Material and subtype`},hex:{i18nKey:`hex`,fallback:`Colour code`},name:{i18nKey:`name`,fallback:`Colour or filament name`},location:{i18nKey:`location`,fallback:`Storage location`},material_number:{i18nKey:`materialNumber`,fallback:`Material number`},temps:{i18nKey:`temps`,fallback:`Nozzle temperature`},weight:{i18nKey:`weight`,fallback:`Net weight`},note:{i18nKey:`note`,fallback:`Note`},added:{i18nKey:`added`,fallback:`Date added`},qr:{i18nKey:`qr`,fallback:`QR code`},spool_id:{i18nKey:`spoolId`,fallback:`Spool ID`}},bn=`bambuddy-label-print-options`,xn={template:Q[0].value,fields:{},monochrome:!1,format:`pdf`,dpi:300};function Sn(){let e;try{e=JSON.parse(localStorage.getItem(bn)??`null`)}catch{return xn}if(!e||typeof e!=`object`)return xn;let t=e,n=Q.map(e=>e.value),r={};if(t.fields&&typeof t.fields==`object`)for(let[e,i]of Object.entries(t.fields))!n.includes(e)||!Array.isArray(i)||(r[e]=i.filter(e=>a.includes(e)));return{template:n.includes(t.template)?t.template:xn.template,fields:r,monochrome:t.monochrome===!0,format:t.format===`png`?`png`:`pdf`,dpi:vn.includes(t.dpi)?t.dpi:xn.dpi}}function Cn(e){try{localStorage.setItem(bn,JSON.stringify(e))}catch{}}function wn(e,t){return e.fields[t]??i}function Tn(e){let t=window.URL.createObjectURL(e);if(!window.open(t,`_blank`)){let e=document.createElement(`a`);e.href=t,e.download=`bambuddy-labels.pdf`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}setTimeout(()=>window.URL.revokeObjectURL(t),6e4)}function En(e,t){let n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`bambuddy-labels-${t}.${e.type===`application/zip`?`zip`:`png`}`,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>window.URL.revokeObjectURL(n),6e4)}function Dn(e){return Ke(e)}function On(e){return Ve(e.color_name,e.rgba,e.color_name_is_synthesized)}function $(e){return`${On(e)??`${e.material}${e.subtype?` ${e.subtype}`:``}`}${e.brand?` · ${e.brand}`:``}`}function kn(e){return[On(e),e.color_name,e.material,e.subtype,e.brand,`#${e.id}`].filter(Boolean).join(` `).toLowerCase()}function An(e){if(!e)return[1,0];let t=e.replace(/^#/,``).slice(0,6);if(t.length!==6)return[1,0];let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);if([n,r,i].some(Number.isNaN))return[1,0];let a=n/255,o=r/255,s=i/255,c=Math.max(a,o,s),l=Math.min(a,o,s),u=(c+l)/2,d=c-l;if((d===0?0:d/(1-Math.abs(2*u-1)))<.1)return[1,u];let f=0;return f=c===a?(o-s)/d%6:c===o?(s-a)/d+2:(a-o)/d+4,f*=60,f<0&&(f+=360),[0,f]}function jn({isOpen:e,onClose:t,availableSpools:n,initialSelectedIds:o,spoolmanMode:s}){let{t:l}=c(),u=Je(),{showToast:d}=te(),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(new Set),[g,_]=(0,J.useState)(``),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(`id`),[S,C]=(0,J.useState)(xn),[w,T]=(0,J.useState)(`1`),[E,D]=(0,J.useState)(null),[O,ee]=(0,J.useState)(!1),[k,A]=(0,J.useState)(null),j=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(e){let e=new Set(n.map(e=>e.id));h(new Set(o.filter(t=>e.has(t)))),_(``),y(``),x(`id`),C(Sn()),T(`1`),p(!1)}},[e]);let M=(0,J.useMemo)(()=>{let e=[...n];return b===`color`?(e.sort((e,t)=>{let n=An(e.rgba),r=An(t.rgba);return n[0]===r[0]?n[1]===r[1]?e.id-t.id:n[1]-r[1]:n[0]-r[0]}),e):(e.sort((e,t)=>e.id-t.id),e)},[n,b]),N=(0,J.useMemo)(()=>{let e=new Set;for(let t of M)t.material&&e.add(t.material.toUpperCase());return[...e].sort()},[M]),P=(0,J.useMemo)(()=>{let e=g.trim().toLowerCase();return M.filter(t=>!(v&&(t.material||``).toUpperCase()!==v||e&&!kn(t).includes(e)))},[M,g,v,u]),ne=P.length>0&&P.every(e=>m.has(e.id)),I=S.template,L=wn(S,I),re=L.join(`,`),R=M.find(e=>m.has(e.id))?.id??null;function ie(e){j.current&&window.URL.revokeObjectURL(j.current),j.current=e,D(e)}if((0,J.useEffect)(()=>{if(!e||R===null){ie(null),A(null),ee(!1);return}let t=new AbortController;ee(!0);let n=window.setTimeout(async()=>{let e={spool_id:R,template:I,monochrome:S.monochrome,fields:re?re.split(`,`):[]};try{let n=s?await r.previewSpoolmanSpoolLabel(e,t.signal):await r.previewSpoolLabel(e,t.signal);if(t.signal.aborted)return;ie(window.URL.createObjectURL(n)),A(null)}catch(e){if(t.signal.aborted)return;ie(null),A(e instanceof Error?e.message:String(e))}finally{t.signal.aborted||ee(!1)}},250);return()=>{window.clearTimeout(n),t.abort()}},[e,R,I,re,S.monochrome,s]),(0,J.useEffect)(()=>()=>{j.current&&window.URL.revokeObjectURL(j.current)},[]),!e)return null;let ae=m.size,oe=ae===0,z=_n[I],ce=Number(w),le=z===void 0||Number.isInteger(ce)&&ce>=1&&ce<=z,ue=Q.find(e=>e.value===I)??Q[0];function de(e){C(t=>{let n={...t,...e};return Cn(n),n})}function fe(e){let t=a.filter(t=>e.includes(t));de({fields:{...S.fields,[I]:t}})}function pe(e){fe(L.includes(e)?L.filter(t=>t!==e):[...L,e])}function B(e){h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function me(){h(e=>{let t=new Set(e);for(let e of P)t.add(e.id);return t})}function ge(){h(e=>{let t=new Set(e);for(let e of P)t.delete(e.id);return t})}function H(){h(new Set)}async function _e(){if(oe||f||!le)return;let e={spool_ids:M.filter(e=>m.has(e.id)).map(e=>e.id),template:I,monochrome:S.monochrome,starting_position:z===void 0?1:ce,fields:L,format:S.format,dpi:S.dpi};p(!0);try{let n=s?await r.printSpoolmanSpoolLabels(e):await r.printSpoolLabels(e);S.format===`pdf`?Tn(n):En(n,I),t()}catch(e){d(l(`inventory.labels.error`,`Could not generate labels: {{msg}}`,{msg:e instanceof Error?e.message:String(e)}),`error`)}finally{p(!1)}}let ve=e=>`px-2 py-0.5 text-xs rounded-full border transition ${e?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`;return(0,Y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start sm:items-center justify-center p-4 overflow-y-auto`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:t}),(0,Y.jsxs)(`div`,{"data-testid":`label-template-picker-panel`,className:`relative w-full max-w-5xl bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] overflow-clip flex flex-col my-auto`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(U,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:l(`inventory.labels.title`,`Print spool labels`)}),ae>0&&(0,Y.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[`(`,l(`inventory.labels.selectedCount`,`{{count}} selected`,{count:ae}),`)`]})]}),(0,Y.jsx)(`button`,{onClick:t,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,"aria-label":l(`common.close`,`Close`),children:(0,Y.jsx)(he,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto md:overflow-hidden grid grid-cols-1 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col min-h-0 md:border-r border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`p-4 space-y-2 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(se,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`}),(0,Y.jsx)(`input`,{type:`search`,value:g,onChange:e=>_(e.target.value),placeholder:l(`inventory.labels.searchPlaceholder`,`Search name, brand, or #ID`),className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green`})]}),N.length>1&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray mr-1`,children:l(`inventory.labels.filterByMaterial`,`Material:`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>y(``),className:`px-2 py-0.5 text-xs rounded-full border transition ${v===``?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:l(`inventory.labels.allMaterials`,`All`)}),N.map(e=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>y(e),className:`px-2 py-0.5 text-xs rounded-full border transition ${v===e?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:e},e))]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray mr-1`,children:l(`inventory.labels.sortBy.label`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>x(`id`),className:`px-2 py-0.5 text-xs rounded-full border transition ${b===`id`?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:l(`inventory.labels.sortBy.id`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>x(`color`),className:`px-2 py-0.5 text-xs rounded-full border transition ${b===`color`?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:l(`inventory.labels.sortBy.color`)})]})]}),(0,Y.jsxs)(`div`,{className:`px-4 pt-3 pb-2 flex items-center justify-between gap-3 flex-wrap`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:l(`inventory.labels.pickSpools`,`Pick which spools to print labels for:`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:ne?ge:me,disabled:P.length===0,className:`text-bambu-green hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:ne?l(`inventory.labels.deselectVisible`,`Deselect visible`):l(`inventory.labels.selectVisible`,`Select all visible ({{count}})`,{count:P.length})}),(0,Y.jsx)(`button`,{type:`button`,onClick:H,disabled:ae===0,className:`text-bambu-gray hover:text-white hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:l(`inventory.labels.clearAll`,`Clear all`)})]})]}),(0,Y.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 pb-2 min-h-0 max-h-72 md:max-h-none`,children:P.length===0?(0,Y.jsx)(`div`,{className:`text-center text-sm text-bambu-gray py-6`,children:M.length===0?l(`inventory.labels.noSpoolsToShow`,`No spools to show. Adjust your filter and try again.`):l(`inventory.labels.noMatches`,`No spools match the current search or filter.`)}):(0,Y.jsx)(`ul`,{className:`space-y-0.5`,children:P.map(e=>{let t=m.has(e.id);return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary/50 cursor-pointer`,children:[t?(0,Y.jsx)(Ae,{className:`w-4 h-4 text-bambu-green shrink-0`}):(0,Y.jsx)(Ee,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,Y.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>B(e.id),className:`sr-only`}),(0,Y.jsx)(`span`,{className:`w-4 h-4 rounded border border-black/20 shrink-0`,style:Dn(e.rgba)}),(0,Y.jsx)(`span`,{className:`flex-1 min-w-0 truncate text-sm text-white`,children:$(e)}),(0,Y.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray shrink-0`,children:[`#`,e.id]})]})},e.id)})})})]}),(0,Y.jsxs)(`div`,{className:`md:overflow-y-auto p-4 space-y-4 border-t md:border-t-0 border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`label`,{htmlFor:`label-template`,className:`text-sm font-medium text-white`,children:l(`inventory.labels.template`,`Label size`)}),(0,Y.jsx)(`select`,{id:`label-template`,"data-testid":`label-template-select`,value:I,onChange:e=>de({template:e.target.value}),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,children:Q.map(e=>(0,Y.jsx)(`option`,{value:e.value,children:l(`inventory.labels.templates.${e.i18nKey}.label`,e.fallbackLabel)},e.value))}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:l(`inventory.labels.templates.${ue.i18nKey}.hint`,ue.fallbackHint)})]}),(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-medium text-white`,children:R===null?l(`inventory.labels.preview`,`Preview`):l(`inventory.labels.previewOf`,`Preview of #{{id}}`,{id:R})}),(0,Y.jsxs)(`div`,{"data-testid":`label-preview`,className:`relative flex items-center justify-center min-h-40 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary`,children:[R===null?(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray text-center`,children:l(`inventory.labels.previewNoSelection`,`Select a spool to see its label.`)}):k?(0,Y.jsx)(`span`,{className:`text-sm text-red-400 text-center`,children:l(`inventory.labels.previewError`,`Could not render the preview: {{msg}}`,{msg:k})}):E?(0,Y.jsx)(`img`,{src:E,alt:l(`inventory.labels.previewAlt`,`Label preview`),className:`max-h-56 max-w-full object-contain bg-white shadow`}):null,O&&(0,Y.jsx)(F,{className:`absolute top-2 right-2 w-4 h-4 animate-spin text-bambu-green`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:l(`inventory.labels.previewHint`,`Lines that don't fit on this label size are left out.`)})]}),(0,Y.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`legend`,{className:`text-sm font-medium text-white`,children:l(`inventory.labels.content`,`Print on the label`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>fe(i),className:`text-xs text-bambu-green hover:underline`,children:l(`inventory.labels.resetFields`,`Reset to default`)})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-3 gap-y-1`,children:a.map(e=>{let t=L.includes(e),{i18nKey:n,fallback:r}=yn[e];return(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 py-0.5 cursor-pointer select-none`,children:[t?(0,Y.jsx)(Ae,{className:`w-4 h-4 text-bambu-green shrink-0`}):(0,Y.jsx)(Ee,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,Y.jsx)(`input`,{type:`checkbox`,"data-testid":`label-field-${e}`,checked:t,onChange:()=>pe(e),className:`sr-only`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:l(`inventory.labels.fields.${n}`,r)})]},e)})})]}),(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`label`,{className:`inline-flex items-center gap-2 cursor-pointer select-none`,children:[S.monochrome?(0,Y.jsx)(Ae,{className:`w-4 h-4 text-bambu-green shrink-0`}):(0,Y.jsx)(Ee,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,Y.jsx)(`input`,{type:`checkbox`,checked:S.monochrome,onChange:e=>de({monochrome:e.target.checked}),className:`sr-only`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:l(`inventory.labels.monochrome`,`Monochrome (black & white printer)`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:l(`inventory.labels.monochromeHint`,`Drops the colour swatch and widens the text`)})]}),z!==void 0&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`label`,{htmlFor:`label-starting-position`,className:`text-sm text-white whitespace-nowrap pt-1.5`,children:l(`inventory.labels.startingPosition`,`Starting label position`)}),(0,Y.jsx)(`input`,{id:`label-starting-position`,"data-testid":`label-starting-position`,type:`number`,min:1,max:z,step:1,value:w,onChange:e=>T(e.target.value),"aria-describedby":`label-starting-position-help`,className:`w-20 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,Y.jsx)(`div`,{id:`label-starting-position-help`,"data-testid":`label-starting-position-status`,className:`text-xs pt-1.5 ${le?`text-bambu-gray`:`text-red-400`}`,children:le?ce===1?l(`inventory.labels.startingPositionFirst`,`Printing starts at position 1.`):l(`inventory.labels.startingPositionSkipped`,`Positions 1 through {{lastPosition}} will be left blank on the first sheet.`,{lastPosition:ce-1}):l(`inventory.labels.startingPositionInvalid`,`Enter a whole number from 1 to {{capacity}}.`,{capacity:z})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white mr-1`,children:l(`inventory.labels.format`,`Output:`)}),(0,Y.jsx)(`button`,{type:`button`,"data-testid":`label-format-pdf`,"aria-pressed":S.format===`pdf`,onClick:()=>de({format:`pdf`}),className:ve(S.format===`pdf`),children:`PDF`}),(0,Y.jsx)(`button`,{type:`button`,"data-testid":`label-format-png`,"aria-pressed":S.format===`png`,onClick:()=>de({format:`png`}),className:ve(S.format===`png`),children:`PNG`}),S.format===`png`&&(0,Y.jsx)(`select`,{"data-testid":`label-dpi-select`,"aria-label":l(`inventory.labels.dpi`,`Resolution`),value:S.dpi,onChange:e=>de({dpi:Number(e.target.value)}),className:`ml-2 px-2 py-0.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-xs focus:outline-none focus:border-bambu-green`,children:vn.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[e,` dpi`]},e))})]}),S.format===`png`&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:l(`inventory.labels.pngHint`,`For label printer software that takes images. Match your printer's resolution; several labels come as a ZIP.`)})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 px-5 py-3 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsx)(V,{variant:`secondary`,onClick:t,disabled:f,children:l(`common.cancel`,`Cancel`)}),(0,Y.jsxs)(V,{"data-testid":`label-print-button`,onClick:_e,disabled:oe||f||!le,children:[f?(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}):S.format===`pdf`?(0,Y.jsx)(U,{className:`w-4 h-4`}):(0,Y.jsx)(Qe,{className:`w-4 h-4`}),S.format===`pdf`?l(`inventory.labels.createPdf`,`Create PDF`):l(`inventory.labels.downloadPng`,`Download PNG`)]})]})]})]})}function Mn({onClose:e,onImported:t}){let{t:n}=c(),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(null),_=(0,J.useRef)(null),v=async e=>{a(e),u(null),g(null),f(!0);try{u(await r.importSpoolsCsvPreview(e))}catch(e){g(e instanceof Error?e.message:n(`inventory.csv.previewError`,`Could not read the CSV file`))}finally{f(!1)}},y=e=>{let t=e.target.files?.[0];t&&v(t)},b=e=>{e.preventDefault(),s(!1);let t=e.dataTransfer.files?.[0];t&&v(t)},x=async()=>{if(i){m(!0),g(null);try{t((await r.importSpoolsCsv(i)).created)}catch(e){g(e instanceof Error?e.message:n(`inventory.csv.importError`,`Import failed`)),m(!1)}}},S=e=>e===`valid`?(0,Y.jsx)(A,{className:`w-4 h-4 text-green-500 flex-shrink-0`}):e===`error`?(0,Y.jsx)(D,{className:`w-4 h-4 text-red-500 flex-shrink-0`}):(0,Y.jsx)(We,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),C=l?.valid_count??0;return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-3xl border border-bambu-dark-tertiary flex flex-col max-h-[90vh]`,children:[(0,Y.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(`inventory.csv.modalTitle`,`Import spools from CSV`)}),(0,Y.jsx)(`button`,{onClick:e,className:`p-1 hover:bg-bambu-dark rounded`,children:(0,Y.jsx)(he,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,Y.jsxs)(`div`,{className:`p-4 space-y-4 overflow-y-auto flex-1`,children:[(0,Y.jsxs)(`div`,{onDragOver:e=>{e.preventDefault(),s(!0)},onDragLeave:e=>{e.preventDefault(),s(!1)},onDrop:b,onClick:()=>_.current?.click(),className:`border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors ${o?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-green/50`}`,children:[(0,Y.jsx)(Ge,{className:`w-9 h-9 mx-auto mb-2 ${o?`text-bambu-green`:`text-bambu-gray`}`}),i?(0,Y.jsxs)(`p`,{className:`text-white font-medium flex items-center justify-center gap-2`,children:[(0,Y.jsx)($e,{className:`w-4 h-4`}),` `,i.name]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`text-white font-medium`,children:n(`inventory.csv.selectFile`,`Choose a CSV file or drag it here`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1`,children:n(`inventory.csv.dragHint`,`Header: material (required), brand, subtype, color_name, rgba, …`)})]})]}),(0,Y.jsx)(`input`,{ref:_,type:`file`,accept:`.csv,text/csv`,className:`hidden`,onChange:y}),d&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-bambu-gray py-4`,children:[(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}),n(`inventory.csv.parsing`,`Reading file…`)]}),h&&(0,Y.jsxs)(`div`,{className:`p-3 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg flex items-start gap-3`,children:[(0,Y.jsx)(D,{className:`w-5 h-5 text-red-600 dark:text-red-400 mt-0.5 flex-shrink-0`}),(0,Y.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-300 break-words`,children:h})]}),l&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-sm`,children:[(0,Y.jsx)(`span`,{className:`px-2 py-1 rounded bg-green-50 dark:bg-green-500/10 text-green-700 dark:text-green-400`,children:n(`inventory.csv.validCount`,`{{count}} valid`,{count:l.valid_count})}),(0,Y.jsx)(`span`,{className:`px-2 py-1 rounded bg-red-50 dark:bg-red-500/10 text-red-700 dark:text-red-400`,children:n(`inventory.csv.errorCount`,`{{count}} error`,{count:l.error_count})}),(0,Y.jsx)(`span`,{className:`px-2 py-1 rounded bg-bambu-dark text-bambu-gray`,children:n(`inventory.csv.skippedCount`,`{{count}} skipped`,{count:l.skipped_count})})]}),l.warnings.length>0&&(0,Y.jsx)(`div`,{className:`p-3 bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30 rounded-lg space-y-1`,children:l.warnings.map((e,t)=>(0,Y.jsx)(`p`,{className:`text-xs text-yellow-700 dark:text-yellow-300`,children:e},t))}),l.rows.length>0&&(0,Y.jsx)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:(0,Y.jsx)(`div`,{className:`max-h-72 overflow-y-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{className:`bg-bambu-dark sticky top-0`,children:(0,Y.jsxs)(`tr`,{className:`text-left text-bambu-gray`,children:[(0,Y.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.csv.colRow`,`Row`)}),(0,Y.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.csv.colStatus`,`Status`)}),(0,Y.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.material`,`Material`)}),(0,Y.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.brand`,`Brand`)}),(0,Y.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.csv.colColor`,`Color`)})]})}),(0,Y.jsx)(`tbody`,{children:l.rows.map(e=>(0,Y.jsxs)(`tr`,{className:`border-t border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`td`,{className:`px-3 py-2 text-bambu-gray`,children:e.row_number}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[S(e.status),e.status===`error`&&e.reason&&(0,Y.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-400 break-words`,children:e.reason})]})}),(0,Y.jsx)(`td`,{className:`px-3 py-2 text-white`,children:e.material||`—`}),(0,Y.jsx)(`td`,{className:`px-3 py-2 text-white`,children:e.brand||`—`}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.rgba&&(0,Y.jsx)(`span`,{className:`inline-block w-4 h-4 rounded-full border border-bambu-dark-tertiary flex-shrink-0`,style:Ke(e.rgba)}),(0,Y.jsx)(`span`,{className:`text-white`,children:e.color_name||`—`}),e.resolved_color&&!e.cross_material_color&&(0,Y.jsx)(`span`,{title:n(`inventory.csv.colorResolved`,`Color filled from catalog`),children:(0,Y.jsx)(je,{className:`w-3.5 h-3.5 text-bambu-green flex-shrink-0`})}),e.cross_material_color&&(0,Y.jsx)(`span`,{title:n(`inventory.csv.colorCrossMaterial`,`Color taken from a different material — no exact match in catalog`),children:(0,Y.jsx)(B,{className:`w-3.5 h-3.5 text-yellow-500 flex-shrink-0`})}),e.duplicate_of_existing&&(0,Y.jsx)(`span`,{title:n(`inventory.csv.duplicateExisting`,`A spool with this material, brand and color already exists — it will still be imported as a new spool`),children:(0,Y.jsx)(M,{className:`w-3.5 h-3.5 text-amber-600 dark:text-amber-400 flex-shrink-0`})})]})})]},e.row_number))})]})})})]})]}),(0,Y.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary flex justify-end gap-2`,children:[(0,Y.jsx)(V,{variant:`secondary`,onClick:e,disabled:p,children:n(`common.cancel`)}),(0,Y.jsx)(V,{onClick:x,disabled:!l||C===0||p,children:p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(F,{className:`w-4 h-4 mr-2 animate-spin`}),n(`inventory.csv.importing`,`Importing…`)]}):C>0?n(`inventory.csv.importValidRows`,`Import {{count}} valid rows`,{count:C}):n(`inventory.csv.noValidRows`,`No valid rows`)})]})]})})}function Nn({open:e,onClose:t}){let{t:n}=c(),{showToast:i}=te(),a=l(),{data:s=[],isLoading:d,isError:f}=u({queryKey:Xe,queryFn:r.getSuppliers,enabled:e}),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(``),[x,S]=(0,J.useState)(``),[C,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(``),[O,ee]=(0,J.useState)(!1),[k,A]=(0,J.useState)(null);if((0,J.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let j=s.filter(e=>e.name.toLowerCase().includes(p.toLowerCase())),M=()=>{b(``),S(``),T(``),D(``)},N=()=>({name:y.trim(),website:x.trim()||null,customer_number:C.trim()||null,note:E.trim()||null}),P=async()=>{if(!y.trim()){i(n(`inventory.suppliers.nameRequired`),`error`);return}ee(!0);try{await r.createSupplier(N()),await He(a),g(!1),M(),i(n(`inventory.suppliers.added`),`success`)}catch(e){console.error(`SuppliersModal.handleAdd failed:`,e),i(n(e instanceof o&&e.status===409?`inventory.suppliers.duplicateName`:`inventory.suppliers.addFailed`),`error`)}finally{ee(!1)}},ne=e=>{v(e.id),b(e.name),S(e.website??``),T(e.customer_number??``),D(e.note??``)},I=()=>{v(null),M()},L=async e=>{if(!y.trim()){i(n(`inventory.suppliers.nameRequired`),`error`);return}ee(!0);try{await r.updateSupplier(e,N()),await He(a),I(),i(n(`inventory.suppliers.updated`),`success`)}catch(e){console.error(`SuppliersModal.handleUpdate failed:`,e),i(n(e instanceof o&&e.status===409?`inventory.suppliers.duplicateName`:`inventory.suppliers.updateFailed`),`error`)}finally{ee(!1)}},re=async()=>{if(k)try{await r.deleteSupplier(k.id),await He(a),i(n(`inventory.suppliers.deleted`),`success`)}catch(e){console.error(`SuppliersModal.handleDelete failed:`,e),e instanceof o&&e.status===409?i(n(`inventory.suppliers.deleteBlocked`,{count:k.spool_count}),`error`):i(n(`inventory.suppliers.deleteFailed`),`error`)}finally{A(null)}},R=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.namePlaceholder`),value:y,maxLength:200,onChange:e=>b(e.target.value)}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`flex-1 min-w-0 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.websitePlaceholder`),value:x,maxLength:500,onChange:e=>S(e.target.value)}),(0,Y.jsx)(`input`,{type:`text`,className:`w-40 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.customerNumberPlaceholder`),value:C,maxLength:100,onChange:e=>T(e.target.value)})]}),(0,Y.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.notePlaceholder`),value:E,maxLength:500,onChange:e=>D(e.target.value)})]});return(0,Y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:t}),(0,Y.jsxs)(`div`,{className:`relative w-full max-w-3xl mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`suppliers-modal-title`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Ft,{className:`w-5 h-5 text-bambu-gray`}),(0,Y.jsx)(`h2`,{id:`suppliers-modal-title`,className:`text-lg font-semibold text-white`,children:n(`inventory.suppliers.title`)}),(0,Y.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[`(`,s.length,`)`]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`button`,{onClick:()=>{g(!0),v(null),M()},className:`px-3 py-1.5 text-sm bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 transition-colors flex items-center gap-1.5`,children:[(0,Y.jsx)(Pe,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:n(`common.add`)})]}),(0,Y.jsx)(`button`,{onClick:t,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":n(`common.close`),children:(0,Y.jsx)(he,{className:`w-5 h-5`})})]})]}),(0,Y.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-6 py-4 space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`inventory.suppliers.description`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(se,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Y.jsx)(`input`,{type:`text`,className:`w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.search`),value:p,onChange:e=>m(e.target.value)})]}),h&&(0,Y.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary space-y-3`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:n(`inventory.suppliers.addNew`)}),R,(0,Y.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,Y.jsx)(`button`,{onClick:()=>{g(!1),M()},className:`px-3 py-2 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary`,children:n(`common.cancel`)}),(0,Y.jsxs)(`button`,{onClick:P,disabled:O,className:`px-3 py-2 bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 flex items-center gap-1`,children:[O?(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(w,{className:`w-4 h-4`}),n(`common.add`)]})]})]}),d?(0,Y.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-bambu-gray`,children:[(0,Y.jsx)(F,{className:`w-5 h-5 animate-spin mr-2`}),n(`common.loading`)]}):f?(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-sm text-red-400`,children:[(0,Y.jsx)(B,{className:`w-4 h-4`}),n(`inventory.suppliers.loadFailed`)]}):(0,Y.jsx)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg`,children:(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{className:`bg-bambu-dark sticky top-0`,children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`px-4 py-2 text-left text-bambu-gray font-medium`,children:n(`common.name`)}),(0,Y.jsx)(`th`,{className:`px-4 py-2 text-left text-bambu-gray font-medium hidden sm:table-cell`,children:n(`inventory.suppliers.customerNumber`)}),(0,Y.jsx)(`th`,{className:`px-4 py-2 text-right text-bambu-gray font-medium w-20`,children:n(`inventory.suppliers.spools`)}),(0,Y.jsx)(`th`,{className:`px-4 py-2 w-24`})]})}),(0,Y.jsx)(`tbody`,{children:j.length===0?(0,Y.jsx)(`tr`,{children:(0,Y.jsx)(`td`,{colSpan:4,className:`px-4 py-8 text-center text-bambu-gray`,children:n(p?`inventory.suppliers.noMatch`:`inventory.suppliers.empty`)})}):j.map(e=>(0,Y.jsx)(`tr`,{className:`border-t border-bambu-dark-tertiary hover:bg-bambu-dark align-top`,children:_===e.id?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`td`,{className:`px-4 py-2`,colSpan:3,children:R}),(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,Y.jsx)(`button`,{onClick:()=>L(e.id),disabled:O,className:`p-1.5 rounded hover:bg-green-500/20 text-green-500`,children:O?(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(w,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:I,className:`p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray`,children:(0,Y.jsx)(he,{className:`w-4 h-4`})})]})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`td`,{className:`px-4 py-2 text-white`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{children:e.name}),e.website&&(0,Y.jsx)(`a`,{href:e.website,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-gray hover:text-bambu-green`,title:e.website,children:(0,Y.jsx)(xe,{className:`w-3.5 h-3.5`})})]}),e.note&&(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray mt-0.5`,children:e.note})]}),(0,Y.jsx)(`td`,{className:`px-4 py-2 text-bambu-gray hidden sm:table-cell`,children:e.customer_number||`-`}),(0,Y.jsx)(`td`,{className:`px-4 py-2 text-right font-mono text-bambu-gray`,children:e.spool_count}),(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,Y.jsx)(`button`,{onClick:()=>{ne(e),g(!1)},className:`p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white`,children:(0,Y.jsx)(ye,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>A(e),className:`p-1.5 rounded bg-red-500/10 hover:bg-red-500/20 text-red-500`,children:(0,Y.jsx)(be,{className:`w-4 h-4`})})]})})]})},e.id))})]})})]})]}),k&&(0,Y.jsx)(Fe,{title:n(`inventory.suppliers.deleteTitle`),message:k.spool_count>0?n(`inventory.suppliers.deleteConfirmReferenced`,{name:k.name,count:k.spool_count}):n(`inventory.suppliers.deleteConfirm`,{name:k.name}),confirmText:n(`common.delete`),variant:`danger`,onConfirm:re,onCancel:()=>A(null)})]})}var Pn=[{id:`material`,type:`searchable`,labelKey:`inventory.material`},{id:`subtype`,type:`searchable`,labelKey:`inventory.subtype`},{id:`brand`,type:`searchable`,labelKey:`inventory.brand`},{id:`color_name`,type:`text`,labelKey:`inventory.colorName`},{id:`rgba`,type:`color`,labelKey:`inventory.color`,pattern:`^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$`},{id:`location_id`,type:`searchableClosed`,labelKey:`inventory.storageLocation`},{id:`slicer_filament_name`,type:`searchable`,labelKey:`inventory.slicerFilamentName`},{id:`slicer_filament`,type:`searchable`,labelKey:`inventory.slicerFilament`},{id:`cost_per_kg`,type:`number`,labelKey:`inventory.costPerKg`,min:0,step:.01},{id:`note`,type:`textarea`,labelKey:`inventory.note`},{id:`label_weight`,type:`number`,labelKey:`inventory.labelWeight`,min:1,step:1},{id:`core_weight`,type:`number`,labelKey:`inventory.coreWeight`,min:0,step:1},{id:`category`,type:`searchable`,labelKey:`inventory.category`,internalOnly:!0},{id:`low_stock_threshold_pct`,type:`number`,labelKey:`inventory.lowStockThresholdOverride`,min:1,max:99,step:1,internalOnly:!0},{id:`material_number`,type:`searchable`,labelKey:`inventory.materialNumber`,internalOnly:!0}];function Fn({value:e,onChange:t,options:n,allowCustom:r,placeholderKey:i,disabled:a}){let{t:o}=c(),s=(0,J.useRef)(null),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(``);(0,J.useEffect)(()=>{if(!l)return;let e=e=>{s.current&&!s.current.contains(e.target)&&(u(!1),f(``))},t=e=>{e.key===`Escape`&&(u(!1),f(``))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[l]);let p=l?d:n.find(t=>t.value===e)?.label??e,m=(0,J.useMemo)(()=>{if(!l)return n;let e=d.trim().toLowerCase();return e?n.filter(t=>t.label.toLowerCase().includes(e)||t.value.toLowerCase().includes(e)):n},[l,d,n]),h=l&&d.trim()&&!n.some(e=>e.value.toLowerCase()===d.trim().toLowerCase());return(0,Y.jsxs)(`div`,{className:`relative`,ref:s,children:[(0,Y.jsx)(`input`,{type:`text`,disabled:a,value:p,onChange:e=>{f(e.target.value),u(!0),r&&t(e.target.value)},onFocus:()=>{u(!0),f(``)},placeholder:i?o(i):void 0,className:`w-full px-3 py-2 pr-9 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(T,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),l&&(0,Y.jsxs)(`div`,{className:`absolute z-50 left-0 right-0 mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-64 overflow-y-auto`,children:[m.length===0&&!r&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:o(`inventory.noResults`)}),m.map(n=>(0,Y.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e===n.value?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{t(n.value),u(!1),f(``)},children:n.label},n.value)),r&&h&&(0,Y.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary`,onClick:()=>{t(d.trim()),u(!1),f(``)},children:o(`inventory.bulk.useCustom`,{value:d.trim()})})]})]})}function In(...e){let t=new Set;for(let n of e)for(let e of n){let n=e?.trim();n&&t.add(n)}return Array.from(t).sort((e,t)=>e.localeCompare(t))}function Ln({isOpen:e,selectedCount:t,isPending:n,availableLocations:i,availableMaterials:a,availableSubtypes:o,availableBrands:s,availableCategories:l,availableMaterialNumbers:d,availableSlicerFilaments:f,availableSlicerFilamentNames:p,spoolmanMode:m=!1,onClose:h,onApply:g}){let{t:_}=c(),v=(0,J.useMemo)(()=>Pn.filter(e=>!(m&&e.internalOnly)),[m]),{data:y=[]}=u({queryKey:[`bulk-edit-cloud-presets`],enabled:e,staleTime:300*1e3,queryFn:async()=>{let e=[];try{if((await r.getCloudStatus()).is_authenticated){let t=await r.getFilamentPresets();e.push(...t)}}catch{}try{if((await r.orcaCloudStatus()).connected){let t=await r.orcaCloudListProfiles();e.push(...t.filament)}}catch{}return e}}),{data:b}=u({queryKey:[`bulk-edit-local-presets`],enabled:e,staleTime:300*1e3,queryFn:r.getLocalPresets}),{data:x=[]}=u({queryKey:[`builtin-filaments`],enabled:e,staleTime:300*1e3,queryFn:r.getBuiltinFilaments}),S=(0,J.useMemo)(()=>Et(y,new Set,b?.filament??[],x),[y,b,x]),[C,w]=(0,J.useState)({}),T=(0,J.useMemo)(()=>In(Ot,a).map(e=>({value:e,label:e})),[a]),E=(0,J.useMemo)(()=>In(pt,o).map(e=>({value:e,label:e})),[o]),D=(0,J.useMemo)(()=>In(vt,s).map(e=>({value:e,label:e})),[s]),O=(0,J.useMemo)(()=>In(l).map(e=>({value:e,label:e})),[l]),ee=(0,J.useMemo)(()=>In(d).map(e=>({value:e,label:e})),[d]),k=(0,J.useMemo)(()=>{let e=S.map(e=>({value:e.code,label:e.displayName})),t=f.filter(t=>!e.some(e=>e.value===t)).map(e=>({value:e,label:e}));return[...e,...t].sort((e,t)=>e.label.localeCompare(t.label))},[S,f]),te=(0,J.useMemo)(()=>{let e=S.map(e=>({value:e.displayName,label:e.displayName})),t=p.filter(t=>!e.some(e=>e.value===t)).map(e=>({value:e,label:e}));return[...e,...t].sort((e,t)=>e.label.localeCompare(t.label))},[S,p]),A=(0,J.useMemo)(()=>i.map(e=>({value:String(e.id),label:e.name})),[i]);if(!e)return null;let j=(e,t)=>{w(n=>({...n,[e]:t}))},M=e=>{w(t=>{let n={...t};return delete n[e],n})},N=(()=>{let e={};for(let t of v){let n=C[t.id];if(n===void 0)continue;let r=typeof n==`string`?n.trim():n;if(!(r===``||r===null))if(t.type===`number`){let n=Number(r);Number.isFinite(n)&&(e[t.id]=n)}else if(t.id===`location_id`){let n=Number(r);Number.isFinite(n)&&n>0&&(e[t.id]=n)}else if(t.id===`rgba`){let n=String(r).replace(/^#/,``),i=n.length===6?`${n}FF`:n;/^[0-9A-Fa-f]{8}$/.test(i)&&(e[t.id]=i.toUpperCase())}else e[t.id]=String(r)}return e})(),P=Object.keys(N).length>0,ne=v.some(e=>{let t=C[e.id];return t===void 0||t.trim()===``?!1:N[e.id]===void 0}),I=e=>e===`material`?T:e===`subtype`?E:e===`brand`?D:e===`category`?O:e===`material_number`?ee:e===`slicer_filament`?k:e===`slicer_filament_name`?te:e===`location_id`?A:[],L=e=>{let t=C[e.id]??``;if(e.type===`searchable`||e.type===`searchableClosed`)return(0,Y.jsx)(Fn,{value:t,onChange:t=>{t===``?M(e.id):j(e.id,t)},options:I(e.id),allowCustom:e.type===`searchable`,disabled:n});if(e.type===`textarea`)return(0,Y.jsx)(`textarea`,{disabled:n,value:t,onChange:t=>j(e.id,t.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none resize-none min-h-[60px]`});if(e.type===`color`){let r=t.trim().replace(/^#/,``),i=r.length===6?`${r}FF`:r,a=t.trim()!==``&&!/^[0-9A-Fa-f]{8}$/.test(i);return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`color`,disabled:n,value:`#${(t||`808080`).replace(/^#/,``).slice(0,6)}`,onChange:t=>j(e.id,t.target.value.replace(/^#/,``).toUpperCase()),className:`h-9 w-12 rounded cursor-pointer`}),(0,Y.jsx)(`input`,{type:`text`,disabled:n,value:t,onChange:t=>j(e.id,t.target.value.replace(/^#/,``).toUpperCase()),placeholder:`RRGGBB or RRGGBBAA`,className:`flex-1 px-3 py-2 bg-bambu-dark border rounded-lg text-white placeholder-bambu-gray/50 focus:outline-none ${a?`border-red-500 focus:border-red-500`:`border-bambu-dark-tertiary focus:border-bambu-green`}`,pattern:e.pattern})]}),a&&(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:_(`inventory.bulk.invalidHex`)})]})}return(0,Y.jsx)(`input`,{type:e.type===`number`?`number`:`text`,disabled:n,value:t,onChange:t=>j(e.id,t.target.value),min:e.min,max:e.max,step:e.step,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none`})};return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50`,onClick:n?void 0:h,children:(0,Y.jsxs)(`div`,{className:`w-full max-w-3xl bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg max-h-[90vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between p-5 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:_(`inventory.bulk.editTitle`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-0.5`,children:_(`inventory.bulk.editSubtitle`,{count:t})})]}),(0,Y.jsx)(`button`,{onClick:h,disabled:n,className:`p-1 text-bambu-gray hover:text-white transition-colors`,"aria-label":_(`common.close`),children:(0,Y.jsx)(he,{className:`w-5 h-5`})})]}),(0,Y.jsx)(`p`,{className:`px-5 pt-4 text-xs text-bambu-gray`,children:_(`inventory.bulk.editHint`)}),(0,Y.jsx)(`div`,{className:`flex-1 overflow-y-auto p-5 space-y-3`,children:v.map(e=>{let t=C[e.id]!==void 0;return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md p-2 transition-colors ${t?`bg-bambu-green/5 border border-bambu-green/30`:`border border-transparent`}`,children:[(0,Y.jsx)(`div`,{className:`pt-2`,children:(0,Y.jsx)(`input`,{type:`checkbox`,className:`h-4 w-4 cursor-pointer`,checked:t,onChange:t=>{t.target.checked?j(e.id,``):M(e.id)},"aria-label":_(`inventory.bulk.toggleField`)})}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:_(e.labelKey)}),L(e)]})]},e.id)})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 p-5 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:_(`inventory.bulk.changeCount`,{count:Object.keys(N).length})}),(0,Y.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,Y.jsx)(V,{variant:`secondary`,onClick:h,disabled:n,children:_(`common.cancel`)}),(0,Y.jsx)(V,{onClick:()=>g(N),disabled:!P||n||ne,children:n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(F,{className:`w-4 h-4 mr-2 animate-spin`}),_(`inventory.bulk.applyPending`)]}):_(`inventory.bulk.applyButton`,{count:t})})]})]})]})})}function Rn(e){let t=e[0],n=0,r=0,i=0;for(let t of e)n+=t.label_weight,r+=t.weight_used,i+=t.core_weight;return{...t,label_weight:n,weight_used:r,core_weight:i}}function zn(e){let t=new Set;for(let n of e)if(typeof n==`string`){let e=n.trim();e&&t.add(e)}return Array.from(t).sort((e,t)=>e.localeCompare(t))}function Bn(e){return`${e.material}|${e.subtype||``}|${e.brand||``}|${e.color_name||``}|${e.rgba||``}|${e.extra_colors||``}|${e.effect_type||``}|${e.label_weight}|${e.last_dried_at||``}`}var Vn=`bambuddy-inventory-columns`,Hn=`none`.padStart(65,`_`);function Un(e){return(e||``).toLowerCase().replace(/\d+/g,e=>e.padStart(64,`0`))}var Wn=[{id:`id`,label:`#`,visible:!0},{id:`added_time`,label:`Added`,visible:!0},{id:`encode_time`,label:`Encoded`,visible:!1},{id:`last_used_time`,label:`Last Used`,visible:!1},{id:`rgba`,label:`Color`,visible:!0},{id:`material`,label:`Material`,visible:!0},{id:`subtype`,label:`Subtype`,visible:!0},{id:`color_name`,label:`Color Name`,visible:!1},{id:`brand`,label:`Brand`,visible:!0},{id:`slicer_filament`,label:`Slicer Filament`,visible:!1},{id:`location`,label:`Location`,visible:!0},{id:`storage_location`,label:`Storage Location`,visible:!1},{id:`temperature`,label:`Temperature`,visible:!1},{id:`humidity`,label:`Humidity`,visible:!1},{id:`last_dried`,label:`Last Dried`,visible:!0},{id:`battery`,label:`Battery`,visible:!1},{id:`label_weight`,label:`Label`,visible:!0},{id:`net`,label:`Net`,visible:!0},{id:`gross`,label:`Gross`,visible:!1},{id:`added_full`,label:`Full`,visible:!1},{id:`used`,label:`Used`,visible:!1},{id:`printed_total`,label:`Printed Total`,visible:!1},{id:`printed_since_weight`,label:`Printed Since Weight`,visible:!1},{id:`note`,label:`Note`,visible:!1},{id:`material_number`,label:`Material No.`,visible:!1},{id:`suppliers`,label:`Suppliers`,visible:!1},{id:`pa_k`,label:`PA(K)`,visible:!0},{id:`tag_id`,label:`Tag ID`,visible:!1},{id:`data_origin`,label:`Data Origin`,visible:!1},{id:`tag_type`,label:`Linked Tag Type`,visible:!1},{id:`stock`,label:`Stock`,visible:!1},{id:`remaining`,label:`Remaining`,visible:!0},{id:`spool_name`,label:`Spool`,visible:!1},{id:`cost_per_kg`,label:`Cost/kg`,visible:!1},{id:`weight_check`,label:`Weight Check`,visible:!1}];function Gn(){try{let e=localStorage.getItem(Vn);if(e){let t=JSON.parse(e),n=new Set(Wn.map(e=>e.id)),r=new Set(t.map(e=>e.id)),i=[...t.filter(e=>n.has(e.id))];for(let e of Wn){if(r.has(e.id))continue;let t=Wn.indexOf(e),n=i.length;for(let e=t-1;e>=0;e--){let t=i.findIndex(t=>t.id===Wn[e].id);if(t!==-1){n=t+1;break}}i.splice(n,0,e)}return i}}catch{}return Wn.map(e=>({...e}))}function Kn(e){try{localStorage.setItem(Vn,JSON.stringify(e))}catch{}}function qn(e,t=!1){return t&&e>=1e3?`${(e/1e3).toFixed(1)}kg`:`${Math.round(e)}g`}var Jn={PLA:`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`,ABS:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`,PETG:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,TPU:`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`,ASA:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`,PA:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`,PC:`bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-400`,PET:`bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400`};function Yn(e){let t=[];return e.last_dried_temp!=null&&t.push(`${e.last_dried_temp}°C`),e.last_dried_hours!=null&&t.push(`${Number(e.last_dried_hours.toFixed(1))}h`),t.join(` · `)}function Xn(e,t=`system`){if(!e)return`-`;let n=H(e);return n?ge(n,t):`-`}var Zn={id:()=>`#`,added_time:()=>`Added`,encode_time:()=>`Encoded`,last_used_time:()=>`Last Used`,rgba:e=>e(`inventory.color`),material:e=>e(`inventory.material`),subtype:e=>e(`inventory.subtype`),color_name:e=>e(`inventory.colorName`),brand:e=>e(`inventory.brand`),slicer_filament:e=>e(`inventory.slicerFilament`),location:()=>`Location`,storage_location:e=>e(`inventory.storageLocation`),temperature:e=>e(`inventory.temperature`),humidity:e=>e(`inventory.humidity`),last_dried:e=>e(`inventory.lastDried`),battery:e=>e(`inventory.battery`),label_weight:e=>e(`inventory.labelWeight`),net:e=>e(`inventory.net`),gross:()=>`Gross`,added_full:()=>`Full`,used:e=>e(`inventory.weightUsed`),printed_total:()=>`Printed Total`,printed_since_weight:()=>`Printed Since Weight`,note:e=>e(`inventory.note`),material_number:e=>e(`inventory.materialNumber`),suppliers:e=>e(`inventory.suppliers.label`),pa_k:()=>`PA(K)`,tag_id:()=>`Tag ID`,data_origin:()=>`Data Origin`,tag_type:()=>`Linked Tag Type`,stock:e=>e(`inventory.stock`),remaining:e=>e(`inventory.remaining`),spool_name:e=>e(`inventory.spoolName`),cost_per_kg:e=>e(`inventory.costPerKg`),weight_check:e=>e(`inventory.weightCheck`)},Qn={id:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm font-medium text-white`,children:e.id}),added_time:({spool:e,dateFormat:t})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:Xn(e.created_at,t)}),encode_time:({spool:e,dateFormat:t})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:Xn(e.encode_time,t)}),last_used_time:({spool:e,dateFormat:t})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.last_used?Xn(e.last_used,t):`Never`}),last_dried:({spool:e,dateFormat:t})=>{if(!e.last_dried_at)return(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`});let n=Yn(e);return(0,Y.jsxs)(`div`,{className:`text-sm text-bambu-gray`,children:[(0,Y.jsx)(`div`,{children:Xn(e.last_dried_at,t)}),n&&(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray/60`,children:n})]})},rgba:({spool:e})=>(0,Y.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,Y.jsx)(Ze,{rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,effectSize:`table`,subtype:e.subtype})}),material:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:e.material}),subtype:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.subtype||`-`}),color_name:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:Ve(e.color_name,e.rgba,e.color_name_is_synthesized)||`-`}),brand:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.brand||`-`}),slicer_filament:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,title:e.slicer_filament||void 0,children:e.slicer_filament_name||e.slicer_filament||`-`}),location:({spool:e,assignmentMap:t})=>{let n=t[e.id];if(!n)return(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`});let r=n.printer_name||`Printer ${n.printer_id}`,i=n.ams_id===254||n.ams_id===255,a=!i&&n.ams_id>=128;return(0,Y.jsxs)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`,children:[r,` `,Ce(n.ams_id,n.tray_id,a,i),n.ams_label?` (${n.ams_label})`:``]})},storage_location:({spool:e})=>e.storage_location?(0,Y.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:e.storage_location}):(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`}),temperature:({spool:e,locationReadingsMap:t,t:n,colorizeLocationSensors:r,locationSensorAboveColor:i,locationSensorBelowColor:a,locationSensorOptimalColor:o})=>{let s=e.location_id?t[e.location_id]?.find(e=>e.device_class===`temperature`):void 0;return s?(0,Y.jsx)(`span`,{title:s.name,className:`text-sm ${ur(s,r,i,a,o)}`,children:lr(s,n)}):(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`})},humidity:({spool:e,locationReadingsMap:t,t:n,colorizeLocationSensors:r,locationSensorAboveColor:i,locationSensorBelowColor:a,locationSensorOptimalColor:o})=>{let s=e.location_id?t[e.location_id]?.find(e=>e.device_class===`humidity`):void 0;return s?(0,Y.jsx)(`span`,{title:s.name,className:`text-sm ${ur(s,r,i,a,o)}`,children:lr(s,n)}):(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`})},battery:({spool:e,locationReadingsMap:t,t:n,colorizeLocationSensors:r,locationSensorAboveColor:i,locationSensorBelowColor:a,locationSensorOptimalColor:o})=>{let s=e.location_id?t[e.location_id]?.find(e=>e.device_class===`battery`):void 0;return s?(0,Y.jsx)(`span`,{title:s.name,className:`text-sm ${ur(s,r,i,a,o)}`,children:lr(s,n)}):(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`})},label_weight:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:qn(e.label_weight)}),net:({remaining:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:qn(e)}),gross:({spool:e,remaining:t})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:qn(t+e.core_weight)}),added_full:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.added_full==null?`-`:e.added_full?`Yes`:`No`}),used:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.weight_used>0?qn(e.weight_used):`-`}),printed_total:()=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`}),printed_since_weight:()=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`}),note:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray max-w-[150px] truncate block`,title:e.note||void 0,children:e.note||`-`}),material_number:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.material_number||`-`}),suppliers:({spool:e})=>{let t=e.suppliers??[];return t.length===0?(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`}):(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1 max-w-[220px]`,children:[...t].sort((e,t)=>Number(t.is_purchase_source)-Number(e.is_purchase_source)).map(e=>(0,Y.jsx)(`span`,{title:e.supplier_article_number||void 0,className:`inline-flex items-center px-1.5 py-0.5 rounded-full text-[10px] font-medium ${e.is_purchase_source?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-gray/10 text-bambu-gray`}`,children:e.supplier_name},e.id))})},pa_k:({spool:e})=>(e.k_profiles?.length??0)===0?(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`}):(0,Y.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-bambu-green/20 text-bambu-green`,children:`K`}),tag_id:({spool:e})=>{let t=e.tag_uid||e.tray_uuid;return t?(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray font-mono`,title:t,children:t.length>12?`${t.slice(0,6)}...${t.slice(-4)}`:t}):(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`})},data_origin:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.data_origin||`-`}),tag_type:({spool:e})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.tag_type||`-`}),stock:({spool:e,t})=>e.slicer_filament?(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`}):(0,Y.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`,children:t(`inventory.stock`)}),remaining:({remaining:e,pct:t})=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full ${t>50?`bg-bambu-green`:t>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(t,100)}%`}})}),(0,Y.jsxs)(`span`,{className:`text-xs text-bambu-gray min-w-[40px] text-right`,children:[Math.round(e),`g`]})]}),spool_name:({spool:e,catalogMap:t})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:(e.core_weight_catalog_id==null?void 0:t[e.core_weight_catalog_id])?.name||`-`}),cost_per_kg:({spool:e,currencySymbol:t})=>(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.cost_per_kg==null?`-`:`${t}${e.cost_per_kg.toFixed(2)}`}),weight_check:({spool:e,onSyncWeight:t})=>{let n=e.last_scale_weight;if(n==null)return(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,title:`No scale measurement`,children:`-`});let r=e.core_weight||0,i=Math.max(0,e.label_weight-e.weight_used)+r,a,o;n0?`+${Math.round(a)}`:`${Math.round(a)}`,c=o?`Scale: ${Math.round(n)}g\nCalculated: ${Math.round(i)}g\nDifference: ${s}g (within tolerance)`:`Scale: ${Math.round(n)}g\nCalculated: ${Math.round(i)}g\nDifference: ${s}g (mismatch!)`;return(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 text-sm font-medium ${o?`text-green-700 dark:text-green-400`:`text-yellow-700 dark:text-yellow-400`}`,title:c,children:[(0,Y.jsxs)(`span`,{children:[Math.round(n),`g`]}),o?(0,Y.jsx)(w,{className:`w-3 h-3`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(B,{className:`w-3 h-3`}),t&&(0,Y.jsx)(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),n.preventDefault(),t(e)},className:`p-1 hover:bg-bambu-green/20 rounded transition-colors text-bambu-green`,title:`Sync: trust scale weight and reset tracking`,children:(0,Y.jsx)(we,{className:`w-3.5 h-3.5`})})]})]})}},$n={id:e=>e.id,added_time:e=>e.created_at||``,encode_time:e=>e.encode_time||``,last_used_time:e=>e.last_used||``,last_dried:e=>e.last_dried_at||``,material:e=>(e.material||``).toLowerCase(),subtype:e=>(e.subtype||``).toLowerCase(),color_name:e=>(e.color_name||``).toLowerCase(),rgba:e=>W(e.rgba),brand:e=>(e.brand||``).toLowerCase(),slicer_filament:e=>(e.slicer_filament_name||e.slicer_filament||``).toLowerCase(),location:(e,t)=>{let n=t[e.id];if(!n)return``;let r=n.ams_id===254||n.ams_id===255,i=!r&&n.ams_id>=128,a=n.ams_label?` (${n.ams_label})`:``;return`${n.printer_name||``} ${Ce(n.ams_id,n.tray_id,i,r)}${a}`},storage_location:e=>(e.storage_location||``).toLowerCase(),label_weight:e=>e.label_weight,net:e=>Math.max(0,e.label_weight-e.weight_used),gross:e=>Math.max(0,e.label_weight-e.weight_used)+e.core_weight,used:e=>e.weight_used,remaining:e=>e.label_weight>0?Math.max(0,e.label_weight-e.weight_used)/e.label_weight:0,note:e=>(e.note||``).toLowerCase(),material_number:e=>Un(e.material_number),suppliers:e=>{let t=e.suppliers??[];return((t.find(e=>e.is_purchase_source)??t[0])?.supplier_name||``).toLowerCase()},data_origin:e=>(e.data_origin||``).toLowerCase(),tag_type:e=>(e.tag_type||``).toLowerCase(),stock:e=>+!!e.slicer_filament,spool_name:e=>e.core_weight_catalog_id??0,cost_per_kg:e=>e.cost_per_kg??0,weight_check:e=>{if(e.last_scale_weight==null)return-1;let t=Math.max(0,e.label_weight-e.weight_used)+e.core_weight;return Math.abs(e.last_scale_weight-t)},temperature:(e,t,n)=>(e.location_id?n[e.location_id]:void 0)?.find(e=>e.device_class===`temperature`)?.value??-1/0,humidity:(e,t,n)=>(e.location_id?n[e.location_id]:void 0)?.find(e=>e.device_class===`humidity`)?.value??-1/0,battery:(e,t,n)=>(e.location_id?n[e.location_id]:void 0)?.find(e=>e.device_class===`battery`)?.value??-1/0},er=`bambuddy-inventory-sort`;function tr(){try{let e=localStorage.getItem(er);if(e)return JSON.parse(e)}catch{}return null}function nr(e){try{e?localStorage.setItem(er,JSON.stringify(e)):localStorage.removeItem(er)}catch{}}function rr(){let{data:e}=u({queryKey:[`spoolman-settings`],queryFn:r.getSpoolmanSettings,staleTime:300*1e3}),t=e!==void 0;return(0,Y.jsx)(ir,{spoolmanMode:e?.spoolman_enabled===`true`&&!!e?.spoolman_url,spoolmanModeReady:t})}function ir({spoolmanMode:e=!1,spoolmanModeReady:t=!0}){let{t:n}=c(),i=Je(),a=l(),{showToast:p}=te(),{hasPermission:h,loading:g}=et(),b=!g&&h(`inventory:forecast_read`),[x,C]=Ne(),[w,E]=(0,J.useState)(null),D=(0,J.useRef)(!1),[O,A]=(0,J.useState)(null),[M,P]=(0,J.useState)(null),[L,ie]=(0,J.useState)(!1),[z,ce]=(0,J.useState)(!1),[ue,de]=(0,J.useState)(!1),[fe,pe]=(0,J.useState)(!1),[me,ge]=(0,J.useState)(`active`),[H,_e]=(0,J.useState)(`all`),[ye,xe]=(0,J.useState)(``),[Ce,we]=(0,J.useState)(``),[Ee,ke]=(0,J.useState)(``),[Ae,je]=(0,J.useState)(``),[Me,Re]=(0,J.useState)(``),[Be,He]=(0,J.useState)(``),[We,Ke]=(0,J.useState)(`all`),[Ye,Xe]=(0,J.useState)(``),[W,Ze]=(0,J.useState)(`table`),[$e,tt]=(0,J.useState)(tr),[nt,rt]=(0,J.useState)(Gn),[at,ot]=(0,J.useState)(!1),[st,ct]=(0,J.useState)(()=>{try{return localStorage.getItem(`bambuddy-inventory-group`)===`true`}catch{return!1}}),[lt,ut]=(0,J.useState)(new Set),[G,dt]=(0,J.useState)(new Set),[ft,pt]=(0,J.useState)(!1),[K,mt]=(0,J.useState)(null),ht=(0,J.useCallback)(e=>{dt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),gt=(0,J.useCallback)(()=>dt(new Set),[]);(0,J.useEffect)(()=>{dt(new Set)},[me,H,ye,Ce,Ee,Ae,Me,Be,We,Ye]);let[_t,vt]=(0,J.useState)(0),[yt,bt]=(0,J.useState)(()=>{try{let e=localStorage.getItem(`bambuddy-inventory-pageSize`);if(e){let t=Number(e);if([15,30,50,100,-1].includes(t))return t}}catch{}return 15}),{data:xt}=u({queryKey:[`settings`],queryFn:r.getSettings}),St=xt?.date_format||`system`,Ct=(xt?.location_sensor_poll_interval||120)*1e3,{colorize:wt,aboveColor:Tt,belowColor:Et,optimalColor:Dt}=R(),Ot=e?[`spoolman-inventory-spools`]:[`inventory-spools`],kt=()=>Ie(a,Ot),{data:q,isLoading:jt}=u({queryKey:Ot,queryFn:()=>e?r.getSpoolmanInventorySpools(!0):r.getSpools(!0),refetchInterval:3e4}),Mt=(0,J.useCallback)(async()=>{ce(!0);try{await r.exportSpoolsCsv()}catch(e){p(e instanceof Error?e.message:n(`inventory.csv.exportError`,`Export failed`),`error`)}finally{ce(!1)}},[p,n]),Pt=e?n(`inventory.csv.spoolmanHint`,`In Spoolman mode, use Spoolman's built-in CSV import/export.`):void 0,{data:Lt=[]}=u({queryKey:qe,queryFn:r.getLocations}),Rt=x.get(`location_id`),X=Rt===`__none__`?`__none__`:Rt&&/^\d+$/.test(Rt)&&Number(Rt)>0?Rt:``,Z=x.get(`spool`),zt=Z&&/^\d+$/.test(Z)&&Number(Z)>0?Number(Z):null,Bt=q?.find(e=>e.id===zt)??null,Vt=(0,J.useCallback)(()=>{D.current=!0,C(e=>(e.delete(`spool`),e),{replace:!0})},[C]),{data:Ht,isError:Ut,error:Gt}=u({queryKey:e?[`spoolman-inventory-spool`,zt]:[`inventory-spool`,zt],queryFn:()=>e?r.getSpoolmanInventorySpool(zt):r.getSpool(zt),enabled:t&&zt!==null&&Bt===null,staleTime:1/0,retry:(e,t)=>e<2&&!(t instanceof o&&t.status===404)});(0,J.useEffect)(()=>{if(!D.current){if(t&&zt&&Bt){Vt(),E({spool:Bt,mode:`edit`});return}if(Ht){Vt(),E({spool:Ht,mode:`edit`});return}Ut&&(Vt(),p(n(Gt instanceof o&&Gt.status===404?`inventory.deepLinkSpoolNotFound`:`inventory.deepLinkFetchFailed`),`error`))}},[t,zt,Bt,Ht,Ut,Gt,Vt,p,n]);let{data:Kt}=u({queryKey:[`spool-assignments`],queryFn:()=>r.getAssignments(),refetchInterval:3e4}),{data:qt=[],isError:Jt}=u({queryKey:[`spoolman-slot-assignments-all`],queryFn:()=>r.getSpoolmanSlotAssignments(),enabled:e,refetchInterval:3e4,staleTime:1e4,retry:1}),Yt=(0,J.useRef)(!1);(0,J.useEffect)(()=>{Jt&&!Yt.current?(Yt.current=!0,p(n(`inventory.spoolmanUnreachable`),`error`)):Jt||(Yt.current=!1)},[Jt,p,n]);let{data:Xt}=u({queryKey:[`spool-catalog`],queryFn:()=>r.getSpoolCatalog()}),Zt=d({mutationFn:t=>e?r.deleteSpoolmanInventorySpool(t):r.deleteSpool(t),onSuccess:()=>{kt(),p(n(`inventory.spoolDeleted`),`success`)},onError:e=>{e instanceof o&&e.status===404?p(n(`inventory.deleteSpoolNotFound`),`error`):e instanceof o&&e.status===503?p(n(`inventory.spoolmanUnreachable`),`error`):p(n(`inventory.deleteFailed`),`error`)}}),Qt=d({mutationFn:t=>e?r.archiveSpoolmanInventorySpool(t):r.archiveSpool(t),onSuccess:()=>{kt(),p(n(`inventory.spoolArchived`),`success`)},onError:e=>{e instanceof o&&e.status===404?p(n(`inventory.archiveSpoolNotFound`),`error`):e instanceof o&&e.status===503?p(n(`inventory.spoolmanUnreachable`),`error`):p(n(`inventory.archiveFailed`),`error`)}}),$t=d({mutationFn:t=>e?r.restoreSpoolmanInventorySpool(t):r.restoreSpool(t),onSuccess:()=>{kt(),p(n(`inventory.spoolRestored`),`success`)},onError:e=>{e instanceof o&&e.status===404?p(n(`inventory.restoreSpoolNotFound`),`error`):e instanceof o&&e.status===503?p(n(`inventory.spoolmanUnreachable`),`error`):p(n(`inventory.restoreFailed`),`error`)}}),en=d({mutationFn:t=>e?r.resetSpoolmanInventorySpoolConsumedCounter(t):r.resetSpoolConsumedCounter(t),onSuccess:()=>{a.invalidateQueries({queryKey:Ot}),p(n(`inventory.consumedCounterReset`),`success`)},onError:()=>{p(n(`inventory.resetConsumedCounterFailed`),`error`)}}),tn=d({mutationFn:t=>e?r.bulkResetSpoolmanInventorySpoolConsumedCounter(t):r.bulkResetSpoolConsumedCounter(t),onSuccess:e=>{a.invalidateQueries({queryKey:Ot}),p(n(`inventory.allConsumedCountersReset`,{count:e.reset}),`success`),mt(null),gt()},onError:()=>{p(n(`inventory.resetConsumedCounterFailed`),`error`)}}),nn=e=>(e.not_found?.length??0)+(e.errors?.length??0),rn=d({mutationFn:async({ids:t,update:n})=>e?r.bulkUpdateSpoolmanInventorySpools(t,n):r.bulkUpdateSpools(t,n),onSuccess:e=>{kt();let t=nn(e);if(e.updated===0){p(n(`inventory.bulk.updateAllFailed`,{count:t}),`error`);return}t>0?p(n(`inventory.bulk.updatePartial`,{ok:e.updated,failed:t}),`warning`):p(n(`inventory.bulk.updateSuccess`,{count:e.updated}),`success`),pt(!1),gt()},onError:e=>{p(e.message||n(`inventory.bulk.updateFailed`),`error`)}}),an=d({mutationFn:async t=>e?r.bulkDeleteSpoolmanInventorySpools(t):r.bulkDeleteSpools(t),onSuccess:e=>{kt();let t=nn(e);if(e.deleted===0){p(n(`inventory.bulk.deleteAllFailed`,{count:t}),`error`);return}t>0?p(n(`inventory.bulk.deletePartial`,{ok:e.deleted,failed:t}),`warning`):p(n(`inventory.bulk.deleteSuccess`,{count:e.deleted}),`success`),mt(null),gt()},onError:e=>{p(e.message||n(`inventory.bulk.deleteFailed`),`error`)}}),on=d({mutationFn:async t=>e?r.bulkArchiveSpoolmanInventorySpools(t):r.bulkArchiveSpools(t),onSuccess:e=>{kt();let t=nn(e);if(e.archived===0&&t>0){p(n(`inventory.bulk.archiveAllFailed`,{count:t}),`error`);return}t>0?p(n(`inventory.bulk.archivePartial`,{ok:e.archived,failed:t}),`warning`):p(n(`inventory.bulk.archiveSuccess`,{count:e.archived}),`success`),mt(null),gt()},onError:e=>{p(e.message||n(`inventory.bulk.archiveFailed`),`error`)}}),sn=d({mutationFn:async t=>e?r.bulkRestoreSpoolmanInventorySpools(t):r.bulkRestoreSpools(t),onSuccess:e=>{kt();let t=nn(e);if(e.restored===0&&t>0){p(n(`inventory.bulk.restoreAllFailed`,{count:t}),`error`);return}t>0?p(n(`inventory.bulk.restorePartial`,{ok:e.restored,failed:t}),`warning`):p(n(`inventory.bulk.restoreSuccess`,{count:e.restored}),`success`),mt(null),gt()},onError:e=>{p(e.message||n(`inventory.bulk.restoreFailed`),`error`)}}),cn=(0,J.useMemo)(()=>(q??[]).map(e=>e.id),[q]),ln=async t=>{if(t.last_scale_weight!=null)try{e?await r.syncSpoolmanSpoolWeight(t.id,t.last_scale_weight):await s.updateSpoolWeight(t.id,t.last_scale_weight),a.invalidateQueries({queryKey:Ot}),p(`Synced "${[t.brand,t.material,Ve(t.color_name,t.rgba,t.color_name_is_synthesized)].filter(Boolean).join(` `)}" to scale weight`,`success`)}catch(e){let t=e instanceof o&&e.status===404,r=e instanceof o&&e.status===503;p(n(t?`inventory.syncWeightSpoolNotFound`:r?`inventory.syncWeightSpoolmanUnreachable`:`inventory.syncWeightFailed`),`error`)}},un=xt?.low_stock_threshold??20,[dn,fn]=(0,J.useState)(!1),[pn,mn]=(0,J.useState)(un.toString());(0,J.useEffect)(()=>{dn||mn(un.toString())},[un,dn]);let hn=d({mutationFn:e=>r.updateSettings({low_stock_threshold:e}),onSuccess:()=>{a.invalidateQueries({queryKey:[`settings`]}),p(n(`common.saved`),`success`),fn(!1)},onError:()=>{p(n(`inventory.lowStockThresholdError`),`error`)}}),Q=(0,J.useMemo)(()=>{if(!q)return null;let e=0,t=0,n=0,r=0,i={};for(let a of q){if(t+=Math.max(0,a.weight_used-(a.weight_used_baseline??0)),a.archived_at)continue;r++;let o=Math.max(0,a.label_weight-a.weight_used);e+=o,(a.label_weight>0?o/a.label_weight*100:0)<(a.low_stock_threshold_pct??un)&&n++;let s=a.material||`Unknown`;i[s]||(i[s]={count:0,weight:0}),i[s].count++,i[s].weight+=o}return{totalWeight:e,totalConsumed:t,lowStock:n,byMaterial:i,totalSpools:r}},[q,un]),_n=(Kt?.length??0)+(e?qt.length:0),vn=Le(xt?.currency||`USD`),yn=(0,J.useMemo)(()=>{let e={};for(let t of Kt||[])e[t.spool_id]={printer_id:t.printer_id,printer_name:t.printer_name,ams_id:t.ams_id,tray_id:t.tray_id,ams_label:t.ams_label??null};for(let t of qt)typeof t?.spoolman_spool_id!=`number`||t.spoolman_spool_id<=0||typeof t.printer_id!=`number`||typeof t.ams_id!=`number`||typeof t.tray_id!=`number`||e[t.spoolman_spool_id]||(e[t.spoolman_spool_id]={printer_id:t.printer_id,printer_name:t.printer_name??null,ams_id:t.ams_id,tray_id:t.tray_id,ams_label:t.ams_label??null});return e},[Kt,qt]),bn=(0,J.useMemo)(()=>{let e={};for(let t of Xt||[])e[t.id]=t;return e},[Xt]),{data:xn}=u({queryKey:[`locationHaSensors`],queryFn:()=>r.getLocationHASensors()}),Sn=(0,J.useMemo)(()=>new Set((xn??[]).map(e=>e.location_id)),[xn]),Cn=(0,J.useMemo)(()=>{let e=new Set;for(let t of q||[])t.location_id&&Sn.has(t.location_id)&&e.add(t.location_id);return Array.from(e)},[q,Sn]),wn=W===`cards`||W===`table`&&nt.some(e=>e.visible&&(e.id===`temperature`||e.id===`humidity`||e.id===`battery`)),Tn=f({queries:Cn.map(e=>({queryKey:[`locationHaSensorReadings`,e],queryFn:()=>r.getLocationHASensorReadings(e,!1),refetchInterval:Ct,enabled:wn}))}),En=(0,J.useMemo)(()=>{let e={};return Cn.forEach((t,n)=>{let r=Tn[n]?.data;r&&(e[t]=r)}),e},[Cn,Tn]),Dn=(0,J.useMemo)(()=>Q?Object.entries(Q.byMaterial).sort((e,t)=>t[1].weight-e[1].weight).slice(0,4):[],[Q]),On=(0,J.useMemo)(()=>{let e=q||[];if(e=me===`active`?e.filter(e=>!e.archived_at):e.filter(e=>!!e.archived_at),H===`used`?e=e.filter(e=>e.weight_used>0):H===`new`?e=e.filter(e=>e.weight_used===0):H===`lowstock`&&(e=e.filter(e=>{let t=Math.max(0,e.label_weight-e.weight_used);return(e.label_weight>0?t/e.label_weight*100:0)<(e.low_stock_threshold_pct??un)})),ye&&(e=e.filter(e=>e.material===ye)),Ce&&(e=e.filter(e=>e.brand===Ce)),Ee&&(e=Ee===`__none__`?e.filter(e=>!e.category):e.filter(e=>e.category===Ee)),Ae&&(e=Ae===Hn?e.filter(e=>!e.material_number?.trim()):e.filter(e=>e.material_number===Ae)),Me)if(Me===`__none__`)e=e.filter(e=>(e.suppliers??[]).length===0);else{let t=Number(Me);e=e.filter(e=>(e.suppliers??[]).some(e=>e.supplier_id===t))}if(Be){let t=Number(Be);e=e.filter(e=>e.core_weight_catalog_id===t)}if(X)if(X===`__none__`)e=e.filter(e=>!e.location_id&&!e.storage_location?.trim());else{let t=Number(X),n=Lt.find(e=>e.id===t)?.name?.trim().toLowerCase();e=e.filter(e=>e.location_id==null?n?(e.storage_location||``).trim().toLowerCase()===n:!1:e.location_id===t)}return We===`stock`?e=e.filter(e=>!e.slicer_filament):We===`configured`&&(e=e.filter(e=>!!e.slicer_filament)),Ye&&(e=At(e,Ye)),e},[q,me,H,ye,Ce,Ee,Ae,Me,Be,We,X,Ye,un,Lt,i]),$=()=>vt(0),kn=(0,J.useCallback)(e=>{C(t=>(t.delete(`location_id`),e&&t.set(`location_id`,e),t),{replace:!0}),$()},[C]),An=[...new Set(q?.map(e=>e.material)||[])].sort(),Pn=[...new Set(q?.map(e=>e.brand).filter(Boolean)||[])].sort(),Fn=[...new Set(q?.map(e=>e.category?.trim()).filter(Boolean)||[])].sort(),In=(q??[]).some(e=>!e.category),Vn=[...new Set(q?.map(e=>e.material_number?.trim()).filter(Boolean)||[])].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0})),Un=(q??[]).some(e=>!e.material_number?.trim()),Yn=(0,J.useMemo)(()=>{let e=new Map;for(let t of q??[])for(let n of t.suppliers??[])e.set(n.supplier_id,n.supplier_name);return[...e.entries()].map(([e,t])=>({id:e,name:t})).sort((e,t)=>e.name.localeCompare(t.name))},[q]),Xn=(q??[]).some(e=>(e.suppliers??[]).length===0),Qn=[...new Set(q?.map(e=>e.core_weight_catalog_id).filter(e=>e!=null)||[])].sort((e,t)=>{let n=(bn[e]?.name||``).toLowerCase(),r=(bn[t]?.name||``).toLowerCase();return n.localeCompare(r)}),er=(q??[]).some(e=>!e.location_id&&!e.storage_location?.trim()),rr=me!==`active`||H!==`all`||!!ye||!!Ce||!!Ee||!!Ae||!!Me||!!Be||!!X||We!==`all`||!!Ye,ir=e=>{rt(e),Kn(e)},sr=(0,J.useMemo)(()=>nt.filter(e=>e.visible).map(e=>e.id),[nt]),cr=e=>{$n[e]&&(tt(t=>{let n;return n=t?.column===e?t.direction===`asc`?{column:e,direction:`desc`}:null:{column:e,direction:`asc`},nr(n),n}),$())},lr=(0,J.useMemo)(()=>{if(!$e)return On;let e=$n[$e.column];return e?[...On].sort((t,n)=>{let r=e(t,yn,En),i=e(n,yn,En);return ri?$e.direction===`asc`?1:-1:0}):On},[On,$e,yn,En]),ur=(0,J.useMemo)(()=>{if(!st)return lr.map(e=>({type:`single`,spool:e}));let e=new Map;for(let t of lr)if(!(t.weight_used>0||yn[t.id])){let n=Bn(t),r=e.get(n);r?r.push(t):e.set(n,[t])}let t=[],n=new Set;for(let r of lr){if(r.weight_used>0||yn[r.id]){t.push({type:`single`,spool:r});continue}let i=Bn(r);if(n.has(i))continue;n.add(i);let a=e.get(i);a.length===1?t.push({type:`single`,spool:a[0]}):t.push({type:`group`,key:i,spools:a,representative:a[0]})}return t},[lr,st,yn]),dr=yt===-1,hr=ur.length,gr=dr?hr||1:yt,_r=Math.max(1,Math.ceil(hr/gr)),vr=dr?0:Math.min(_t,_r-1),yr=dr?ur:ur.slice(vr*gr,(vr+1)*gr),br=()=>{let e=!st;ct(e),ut(new Set),$();try{localStorage.setItem(`bambuddy-inventory-group`,String(e))}catch{}},xr=e=>{ut(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Sr=e=>{bt(e),vt(0);try{localStorage.setItem(`bambuddy-inventory-pageSize`,String(e))}catch{}};return(0,Y.jsxs)(`div`,{className:`p-4 md:p-8 space-y-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,Y.jsx)(oe,{className:`w-7 h-7 text-bambu-green`}),n(`inventory.title`)]}),(0,Y.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:n(`inventory.subtitle`)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(V,{variant:`secondary`,disabled:e,onClick:()=>ie(!0),title:Pt,children:[(0,Y.jsx)(Ge,{className:`w-4 h-4`}),n(`inventory.csv.importButton`,`Import CSV`)]}),(0,Y.jsxs)(V,{variant:`secondary`,disabled:e||z,onClick:Mt,title:Pt,children:[z?(0,Y.jsx)(F,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Qe,{className:`w-4 h-4`}),n(`inventory.csv.exportButton`,`Export CSV`)]}),(0,Y.jsxs)(V,{variant:`secondary`,onClick:()=>de(!0),children:[(0,Y.jsx)(ae,{className:`w-4 h-4`}),n(`locations.manage`)]}),(0,Y.jsxs)(V,{variant:`secondary`,onClick:()=>pe(!0),children:[(0,Y.jsx)(Ft,{className:`w-4 h-4`}),n(`inventory.suppliers.title`)]}),(0,Y.jsxs)(V,{variant:`secondary`,disabled:On.length===0,onClick:()=>P(G.size>0?[...G]:On.map(e=>e.id)),title:On.length===0?n(`inventory.labels.noSpoolsTitle`,`No spools to label`):G.size>0?n(`inventory.labels.selectedTitle`,`Print labels for the {{count}} selected spools`,{count:G.size}):n(`inventory.labels.bulkTitle`,`Pick spools to print labels for from the {{count}} currently shown`,{count:On.length}),children:[(0,Y.jsx)(U,{className:`w-4 h-4`}),n(`inventory.labels.printLabels`,`Print labels…`)]}),(0,Y.jsxs)(V,{onClick:()=>E({spool:null,mode:`create`}),children:[(0,Y.jsx)(Pe,{className:`w-4 h-4`}),n(`inventory.addSpool`)]})]})]}),Q&&!jt&&(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3`,children:[(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,Y.jsx)(oe,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.totalInventory`)})]}),(0,Y.jsx)(`div`,{className:`text-xl font-bold text-white`,children:qn(Q.totalWeight,!0)}),(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[Q.totalSpools,` `,Q.totalSpools===1?n(`inventory.spool`):n(`inventory.spools`)]})]}),(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(le,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.totalConsumed`)})]}),Q.totalConsumed>0&&cn.length>0&&(0,Y.jsx)(`button`,{onClick:()=>A({type:`reset-all-consumed-counters`}),className:`p-1 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 rounded transition-colors`,title:n(`inventory.resetAllConsumedCountersTooltip`),"aria-label":n(`inventory.resetAllConsumedCounters`),children:(0,Y.jsx)(S,{className:`w-3.5 h-3.5`})})]}),(0,Y.jsx)(`div`,{className:`text-xl font-bold text-white`,children:qn(Q.totalConsumed,!0)}),(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:n(`inventory.sinceTracking`)})]}),(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,Y.jsx)(ze,{className:`w-4 h-4 text-green-600 dark:text-green-400`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.byMaterial`)})]}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1`,children:Dn.map(([e,t])=>(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${Jn[e]||`bg-bambu-dark-tertiary text-bambu-gray`}`,children:[e,` `,(0,Y.jsx)(`span`,{className:`opacity-70`,children:qn(t.weight,!0)})]},e))})]}),(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,Y.jsx)(U,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.inPrinter`)})]}),(0,Y.jsx)(`div`,{className:`text-xl font-bold text-white`,children:_n}),(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:n(`inventory.loadedInAms`)})]}),(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,Y.jsx)(B,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.lowStock`)})]}),(0,Y.jsx)(`div`,{className:`text-xl font-bold ${Q.lowStock>0?`text-yellow-700 dark:text-yellow-400`:`text-white`}`,children:Q.lowStock}),(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1 flex items-center gap-2`,children:dn?(0,Y.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=parseFloat(pn);!isNaN(t)&&t>=.1&&t<=99.9?hn.mutate(t):p(n(`inventory.lowStockThresholdError`),`error`)},className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`<`}),(0,Y.jsx)(`input`,{type:`text`,inputMode:`decimal`,pattern:`^\\d{0,2}(\\.\\d?)?$`,maxLength:4,value:pn,onChange:e=>{let t=e.target.value.replace(/[^\d.]/g,``);/^\d{0,2}(\.\d?)?$/.test(t)&&mn(t)},className:`px-1.5 py-1 rounded border border-bambu-dark-tertiary text-xs text-white bg-bambu-dark-secondary focus:outline-none focus:border-bambu-green w-14 text-center`,onWheel:e=>e.currentTarget.blur(),disabled:hn.isPending}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`%`}),(0,Y.jsx)(V,{type:`submit`,size:`sm`,disabled:hn.isPending,children:n(`common.save`)}),(0,Y.jsx)(V,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>fn(!1),disabled:hn.isPending,children:n(`common.cancel`)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[`< `,un,`%`]}),(0,Y.jsx)(`button`,{className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,title:n(`common.edit`),onClick:()=>{mn(un.toString()),fn(!0)},children:(0,Y.jsx)(I,{className:`w-4 h-4`})})]})})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3 items-start sm:items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`relative flex-1 max-w-md ${W===`forecast`?`invisible pointer-events-none`:``}`,children:[(0,Y.jsx)(se,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50`}),(0,Y.jsx)(`input`,{type:`text`,value:Ye,onChange:e=>{Xe(e.target.value),$()},placeholder:n(`inventory.search`),className:`w-full pl-10 pr-8 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`}),Ye&&(0,Y.jsx)(`button`,{onClick:()=>{Xe(``),$()},className:`absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,Y.jsx)(he,{className:`w-4 h-4`})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[W===`table`&&(0,Y.jsxs)(`button`,{onClick:()=>ot(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-bambu-gray border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark-tertiary transition-colors`,title:n(`inventory.configureColumns`),children:[(0,Y.jsx)(j,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.columns`)})]}),W!==`forecast`&&(0,Y.jsxs)(`button`,{onClick:br,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium border rounded-lg transition-colors ${st?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,title:n(`inventory.groupSimilar`),children:[(0,Y.jsx)(Nt,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.groupSimilar`)})]}),(0,Y.jsxs)(`div`,{className:`flex bg-bambu-dark-primary border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,Y.jsxs)(`button`,{onClick:()=>Ze(`table`),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${W===`table`?`bg-bambu-green text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(It,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.table`)})]}),(0,Y.jsxs)(`button`,{onClick:()=>Ze(`cards`),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${W===`cards`?`bg-bambu-green text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(N,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.cards`)})]}),(0,Y.jsxs)(`button`,{onClick:()=>b&&Ze(`forecast`),disabled:!b,title:b?void 0:n(`forecast.noReadAccess`),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${W===`forecast`?`bg-bambu-green text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[b?(0,Y.jsx)(m,{className:`w-4 h-4`}):(0,Y.jsx)(ne,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:n(`forecast.title`)})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${W===`forecast`?`hidden`:``}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden`,children:[(0,Y.jsxs)(`button`,{onClick:()=>{ge(`active`),$()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${me===`active`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(oe,{className:`w-3.5 h-3.5`}),n(`inventory.active`)]}),(0,Y.jsxs)(`button`,{onClick:()=>{ge(`archived`),$()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${me===`archived`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(Te,{className:`w-3.5 h-3.5`}),n(`inventory.archived`)]})]}),(0,Y.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary`}),(0,Y.jsxs)(`div`,{className:`flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden`,children:[(0,Y.jsx)(`button`,{onClick:()=>{_e(`all`),$()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${H===`all`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.all`)}),(0,Y.jsxs)(`button`,{onClick:()=>{_e(`used`),$()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${H===`used`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(Oe,{className:`w-3.5 h-3.5`}),n(`inventory.used`)]}),(0,Y.jsx)(`button`,{onClick:()=>{_e(`new`),$()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${H===`new`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.new`)}),(0,Y.jsxs)(`button`,{onClick:()=>{_e(`lowstock`),$()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${H===`lowstock`?`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(B,{className:`w-3.5 h-3.5`}),n(`inventory.lowStock`)]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden`,children:[(0,Y.jsx)(`button`,{onClick:()=>{Ke(`all`),$()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${We===`all`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.all`)}),(0,Y.jsx)(`button`,{onClick:()=>{Ke(`stock`),$()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${We===`stock`?`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.stock`)}),(0,Y.jsx)(`button`,{onClick:()=>{Ke(`configured`),$()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${We===`configured`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.configured`)})]}),(0,Y.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary`}),(0,Y.jsxs)(`select`,{value:ye,onChange:e=>{xe(e.target.value),$()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${ye?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`inventory.material`)}),An.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]}),(0,Y.jsxs)(`select`,{value:Ce,onChange:e=>{we(e.target.value),$()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${Ce?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`inventory.brand`)}),Pn.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]}),(Fn.length>0||Ee)&&(0,Y.jsxs)(`select`,{value:Ee,onChange:e=>{ke(e.target.value),$()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${Ee?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`inventory.category`)}),Fn.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e)),In&&(0,Y.jsx)(`option`,{value:`__none__`,children:n(`inventory.categoryNone`)})]}),(Vn.length>0||Ae)&&(0,Y.jsxs)(`select`,{value:Ae,onChange:e=>{je(e.target.value),$()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${Ae?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`inventory.materialNumber`)}),Vn.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e)),Un&&(0,Y.jsx)(`option`,{value:Hn,children:n(`inventory.materialNumberNone`)})]}),(Yn.length>0||Me)&&(0,Y.jsxs)(`select`,{value:Me,onChange:e=>{Re(e.target.value),$()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${Me?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`inventory.suppliers.label`)}),Yn.map(e=>(0,Y.jsx)(`option`,{value:String(e.id),children:e.name},e.id)),Xn&&(0,Y.jsx)(`option`,{value:`__none__`,children:n(`inventory.suppliers.none`)})]}),Qn.length>0&&(0,Y.jsxs)(`select`,{value:Be,onChange:e=>{He(e.target.value),$()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${Be?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`inventory.spoolName`)}),Qn.map(e=>(0,Y.jsx)(`option`,{value:e,children:bn[e]?.name||`#${e}`},e))]}),(Lt.length>0||X)&&(0,Y.jsxs)(`select`,{value:X,onChange:e=>{kn(e.target.value)},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${X?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`inventory.storageLocation`)}),Lt.map(e=>(0,Y.jsx)(`option`,{value:String(e.id),children:e.name},e.id)),er&&(0,Y.jsx)(`option`,{value:`__none__`,children:n(`inventory.storageLocationNone`)})]}),rr&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary`}),(0,Y.jsxs)(`button`,{onClick:()=>{ge(`active`),_e(`all`),xe(``),we(``),ke(``),je(``),Re(``),He(``),Ke(`all`),Xe(``),C(e=>(e.delete(`location_id`),e),{replace:!0}),$()},className:`flex items-center gap-1 text-xs text-bambu-gray hover:text-bambu-green transition-colors`,children:[(0,Y.jsx)(he,{className:`w-3.5 h-3.5`}),n(`inventory.clearFilters`)]})]}),W!==`forecast`&&(0,Y.jsxs)(`span`,{className:`ml-auto text-xs text-bambu-gray`,children:[lr.length,` `,lr.length===1?n(`inventory.spool`):n(`inventory.spools`),st&&hr0&&W!==`forecast`&&(0,Y.jsxs)(`div`,{className:`sticky top-2 z-10 mb-4 flex items-center gap-2 px-3 py-2 bg-bambu-green/10 border border-bambu-green/30 rounded-lg backdrop-blur-sm`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-bambu-green font-medium`,children:n(`inventory.bulk.selectionCount`,{count:G.size})}),(0,Y.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(V,{size:`sm`,variant:`secondary`,onClick:()=>pt(!0),children:[(0,Y.jsx)(I,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.edit`)]}),(0,Y.jsxs)(V,{size:`sm`,variant:`secondary`,onClick:()=>P([...G]),children:[(0,Y.jsx)(U,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.printLabels`)]}),(0,Y.jsxs)(V,{size:`sm`,variant:`secondary`,onClick:()=>mt(`reset-consumed-counter`),children:[(0,Y.jsx)(S,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.resetUsage`)]}),me===`archived`?(0,Y.jsxs)(V,{size:`sm`,variant:`secondary`,onClick:()=>mt(`restore`),children:[(0,Y.jsx)(Se,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.restore`)]}):(0,Y.jsxs)(V,{size:`sm`,variant:`secondary`,onClick:()=>mt(`archive`),children:[(0,Y.jsx)(Te,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.archive`)]}),(0,Y.jsxs)(V,{size:`sm`,variant:`danger`,onClick:()=>mt(`delete`),children:[(0,Y.jsx)(be,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.delete`)]}),(0,Y.jsx)(`button`,{className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,onClick:gt,title:n(`inventory.bulk.clearSelection`),"aria-label":n(`inventory.bulk.clearSelection`),children:(0,Y.jsx)(he,{className:`w-4 h-4`})})]})]}),jt?(0,Y.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,Y.jsx)(F,{className:`w-8 h-8 text-bambu-green animate-spin`})}):W===`forecast`?(0,Y.jsx)(Wt,{spools:q||[]}):W===`cards`?yr.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4`,children:yr.map(e=>{if(e.type===`group`){let{key:t,spools:r,representative:i}=e,a=r.reduce((e,t)=>e+Math.max(0,t.label_weight-t.weight_used),0),o=ve({rgba:i.rgba,extraColors:i.extra_colors,effectType:i.effect_type,subtype:i.subtype,effectSize:`groupheader`}),s=lt.has(t);return(0,Y.jsxs)(`div`,{className:`col-span-full`,children:[(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-green/30 hover:border-bambu-green transition-colors cursor-pointer`,onClick:()=>xr(t),children:[(0,Y.jsx)(`div`,{className:`h-10 flex items-center px-4 gap-3`,style:o,children:(0,Y.jsx)(`span`,{className:`bg-white/90 text-gray-800 px-3 py-0.5 rounded-full text-sm font-medium`,children:Ve(i.color_name,i.rgba,i.color_name_is_synthesized)||`-`})}),(0,Y.jsxs)(`div`,{className:`px-4 py-3 flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(T,{className:`w-4 h-4 text-bambu-gray transition-transform ${s?``:`-rotate-90`}`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h3`,{className:`font-semibold text-white`,children:[i.material,i.subtype?` ${i.subtype}`:``]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i.brand||`-`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,title:n(`inventory.remaining`),children:qn(a)}),(0,Y.jsx)(`span`,{className:`text-xs font-medium bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full`,children:n(`inventory.groupedSpools`,{count:r.length})})]})]})]}),s&&(0,Y.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 mt-2 ml-4`,children:r.map(e=>{let t=Math.max(0,e.label_weight-e.weight_used);return(0,Y.jsx)(or,{spool:e,remaining:t,pct:e.label_weight>0?t/e.label_weight*100:0,onClick:()=>E({spool:e,mode:`edit`}),onPrintLabel:()=>P([e.id]),onCopy:()=>E({spool:e,mode:`copy`}),t:n,colorizeLocationSensors:wt,locationSensorAboveColor:Tt,locationSensorBelowColor:Et,locationSensorOptimalColor:Dt,dateFormat:St},e.id)})})]},`group-${t}`)}let t=e.spool,r=Math.max(0,t.label_weight-t.weight_used);return(0,Y.jsx)(or,{spool:t,remaining:r,pct:t.label_weight>0?r/t.label_weight*100:0,onClick:()=>E({spool:t,mode:`edit`}),onPrintLabel:()=>P([t.id]),onCopy:()=>E({spool:t,mode:`copy`}),t:n,colorizeLocationSensors:wt,locationSensorAboveColor:Tt,locationSensorBelowColor:Et,locationSensorOptimalColor:Dt,dateFormat:St},t.id)})}),(0,Y.jsx)(ar,{pageIndex:vr,pageSize:yt,totalRows:hr,totalPages:_r,onPageChange:vt,onPageSizeChange:Sr,t:n})]}):(0,Y.jsx)(mr,{hasFilters:rr,onAddSpool:()=>E({spool:null,mode:`create`}),t:n}):yr.length>0?(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,Y.jsx)(`th`,{className:`w-10 px-3 py-3`,children:(0,Y.jsx)(`input`,{type:`checkbox`,className:`h-4 w-4 cursor-pointer`,"aria-label":n(`inventory.bulk.selectAllVisible`),checked:yr.length>0&&yr.every(e=>(e.type===`group`?e.spools.map(e=>e.id):[e.spool.id]).every(e=>G.has(e))),onChange:e=>{if(e.target.checked){let e=new Set(G);for(let t of yr){let n=t.type===`group`?t.spools.map(e=>e.id):[t.spool.id];for(let t of n)e.add(t)}dt(e)}else{let e=new Set(G);for(let t of yr){let n=t.type===`group`?t.spools.map(e=>e.id):[t.spool.id];for(let t of n)e.delete(t)}dt(e)}}})}),sr.map(e=>{let t=!!$n[e],r=$e?.column===e;return(0,Y.jsx)(`th`,{className:`text-left py-3 px-4 text-xs font-medium uppercase tracking-wide select-none ${e===`remaining`?`min-w-[150px]`:``} ${t?`cursor-pointer hover:text-bambu-green transition-colors`:``} ${r?`text-bambu-green`:`text-bambu-gray`}`,onClick:t?()=>cr(e):void 0,children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[Zn[e]?.(n)??e,t&&(r?$e.direction===`asc`?(0,Y.jsx)(y,{className:`w-3 h-3`}):(0,Y.jsx)(_,{className:`w-3 h-3`}):(0,Y.jsx)(v,{className:`w-3 h-3 opacity-30`}))]})},e)}),(0,Y.jsx)(`th`,{className:`text-right py-3 px-4 text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:n(`common.actions`)})]})}),(0,Y.jsx)(`tbody`,{children:yr.map(e=>{if(e.type===`group`){let{key:t,spools:r}=e,i=lt.has(t),a=Rn(r),o=Math.max(0,a.label_weight-a.weight_used);return(0,Y.jsx)(pr,{spools:r,headerSpool:a,remaining:o,pct:a.label_weight>0?o/a.label_weight*100:0,isExpanded:i,onToggle:()=>xr(t),selectedIds:G,onToggleSelected:ht,onToggleGroupSelected:(e,t)=>{dt(n=>{let r=new Set(n);for(let n of e)t?r.add(n):r.delete(n);return r})},onEdit:e=>E({spool:e,mode:`edit`}),onCopy:e=>E({spool:e,mode:`copy`}),onArchive:e=>A({type:`archive`,spoolId:e}),onDelete:e=>A({type:`delete`,spoolId:e}),onPrintLabel:e=>P([e]),onResetConsumedCounter:e=>A({type:`reset-consumed-counter`,spoolId:e}),visibleColumns:sr,assignmentMap:yn,catalogMap:bn,locationReadingsMap:En,currencySymbol:vn,dateFormat:St,t:n,onSyncWeight:ln,colorizeLocationSensors:wt,locationSensorAboveColor:Tt,locationSensorBelowColor:Et,locationSensorOptimalColor:Dt},`group-${t}`)}let t=e.spool,r=Math.max(0,t.label_weight-t.weight_used);return(0,Y.jsx)(fr,{spool:t,remaining:r,pct:t.label_weight>0?r/t.label_weight*100:0,isSelected:G.has(t.id),onToggleSelected:()=>ht(t.id),onEdit:()=>E({spool:t,mode:`edit`}),onCopy:()=>E({spool:t,mode:`copy`}),onRestore:()=>$t.mutate(t.id),onArchive:()=>A({type:`archive`,spoolId:t.id}),onDelete:()=>A({type:`delete`,spoolId:t.id}),onPrintLabel:()=>P([t.id]),onResetConsumedCounter:()=>A({type:`reset-consumed-counter`,spoolId:t.id}),visibleColumns:sr,assignmentMap:yn,catalogMap:bn,locationReadingsMap:En,currencySymbol:vn,dateFormat:St,t:n,onSyncWeight:ln,colorizeLocationSensors:wt,locationSensorAboveColor:Tt,locationSensorBelowColor:Et,locationSensorOptimalColor:Dt},t.id)})})]})}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 bg-bambu-dark-tertiary/50 border-t border-bambu-dark-tertiary text-sm`,children:[(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:dr?`${hr} ${n(hr===1?`inventory.spool`:`inventory.spools`)}`:(0,Y.jsxs)(Y.Fragment,{children:[n(`inventory.showing`),` `,vr*gr+1,` `,n(`inventory.to`),` `,Math.min((vr+1)*gr,hr),` `,n(`inventory.of`),` `,hr,` `,n(`inventory.spools`)]})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:n(`inventory.show`)}),(0,Y.jsxs)(`select`,{value:yt,onChange:e=>Sr(Number(e.target.value)),className:`px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:border-bambu-green`,children:[[15,30,50,100].map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e)),(0,Y.jsx)(`option`,{value:-1,children:n(`inventory.all`)})]}),!dr&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{onClick:()=>vt(0),disabled:vr===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,title:`First page`,children:(0,Y.jsx)(ee,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>vt(e=>Math.max(0,e-1)),disabled:vr===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Y.jsx)(Ue,{className:`w-4 h-4`})}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray px-2 whitespace-nowrap`,children:[n(`inventory.page`),` `,vr+1,` `,n(`inventory.of`),` `,_r]}),(0,Y.jsx)(`button`,{onClick:()=>vt(e=>Math.min(_r-1,e+1)),disabled:vr>=_r-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Y.jsx)(De,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>vt(_r-1),disabled:vr>=_r-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,title:`Last page`,children:(0,Y.jsx)(k,{className:`w-4 h-4`})})]})]})]})]}):(0,Y.jsx)(mr,{hasFilters:rr,onAddSpool:()=>E({spool:null,mode:`create`}),t:n}),w!==null&&(0,Y.jsx)(gn,{isOpen:!0,onClose:()=>E(null),spool:w.spool,mode:w.mode,currencySymbol:vn,spoolmanMode:e,spoolsQueryKey:Ot}),O&&(0,Y.jsx)(Fe,{title:O.type===`delete`?n(`common.delete`):O.type===`archive`?n(`inventory.archive`):O.type===`reset-consumed-counter`?n(`inventory.resetConsumedCounter`):n(`inventory.resetAllConsumedCounters`),message:O.type===`delete`?n(`inventory.deleteConfirm`):O.type===`archive`?n(`inventory.archiveConfirm`):O.type===`reset-consumed-counter`?n(`inventory.resetConsumedCounterConfirm`):n(`inventory.resetAllConsumedCountersConfirm`,{count:cn.length}),confirmText:O.type===`delete`?n(`common.delete`):O.type===`archive`?n(`inventory.archive`):n(`inventory.resetConsumedCounter`),variant:O.type===`archive`?`warning`:`danger`,onConfirm:()=>{O.type===`delete`?Zt.mutate(O.spoolId):O.type===`archive`?Qt.mutate(O.spoolId):O.type===`reset-consumed-counter`?en.mutate(O.spoolId):tn.mutate(cn),A(null)},onCancel:()=>A(null)}),(0,Y.jsx)(it,{isOpen:at,onClose:()=>ot(!1),columns:nt,defaultColumns:Wn,onSave:ir}),(0,Y.jsx)(jn,{isOpen:M!==null,onClose:()=>P(null),availableSpools:On,initialSelectedIds:M??[],spoolmanMode:e}),(0,Y.jsx)(Ln,{isOpen:ft,selectedCount:G.size,isPending:rn.isPending,availableLocations:Lt.map(e=>({id:e.id,name:e.name})),availableMaterials:zn((q??[]).map(e=>e.material)),availableSubtypes:zn((q??[]).map(e=>e.subtype)),availableBrands:zn((q??[]).map(e=>e.brand)),availableCategories:zn((q??[]).map(e=>e.category)),availableMaterialNumbers:zn((q??[]).map(e=>e.material_number)),availableSlicerFilaments:zn((q??[]).map(e=>e.slicer_filament)),availableSlicerFilamentNames:zn((q??[]).map(e=>e.slicer_filament_name)),spoolmanMode:e,onClose:()=>pt(!1),onApply:e=>rn.mutate({ids:[...G],update:e})}),K&&(0,Y.jsx)(Fe,{title:n(K===`delete`?`inventory.bulk.deleteTitle`:K===`archive`?`inventory.bulk.archiveTitle`:K===`restore`?`inventory.bulk.restoreTitle`:`inventory.bulk.resetUsageTitle`),message:n(K===`delete`?`inventory.bulk.deleteMessage`:K===`archive`?`inventory.bulk.archiveMessage`:K===`restore`?`inventory.bulk.restoreMessage`:`inventory.bulk.resetUsageMessage`,{count:G.size}),confirmText:n(K===`delete`?`common.delete`:K===`archive`?`inventory.archive`:K===`restore`?`inventory.restore`:`inventory.resetConsumedCounter`),variant:K===`delete`?`danger`:`warning`,isLoading:an.isPending||on.isPending||sn.isPending||tn.isPending,onConfirm:()=>{let e=[...G];K===`delete`?an.mutate(e):K===`archive`?on.mutate(e):K===`restore`?sn.mutate(e):tn.mutate(e)},onCancel:()=>mt(null)}),L&&(0,Y.jsx)(Mn,{onClose:()=>ie(!1),onImported:e=>{ie(!1),a.invalidateQueries({queryKey:Ot}),p(n(`inventory.csv.importSuccess`,`{{count}} spools imported`,{count:e}),`success`)}}),(0,Y.jsx)(re,{open:ue,onClose:()=>de(!1),onPickLocation:e=>kn(String(e))}),(0,Y.jsx)(Nn,{open:fe,onClose:()=>pe(!1)})]})}function ar({pageIndex:e,pageSize:t,totalRows:n,totalPages:r,onPageChange:i,onPageSizeChange:a,t:o}){let s=t===-1;if(r<=1&&!s)return null;let c=s?n||1:t;return(0,Y.jsxs)(`div`,{className:`flex items-center justify-between pt-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:s?`${n} ${o(n===1?`inventory.spool`:`inventory.spools`)}`:(0,Y.jsxs)(Y.Fragment,{children:[o(`inventory.showing`),` `,e*c+1,` `,o(`inventory.to`),` `,Math.min((e+1)*c,n),` `,o(`inventory.of`),` `,n,` `,o(`inventory.spools`)]})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:o(`inventory.show`)}),(0,Y.jsxs)(`select`,{value:t,onChange:e=>a(Number(e.target.value)),className:`px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:border-bambu-green`,children:[[15,30,50,100].map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e)),(0,Y.jsx)(`option`,{value:-1,children:o(`inventory.all`)})]}),!s&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{onClick:()=>i(0),disabled:e===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Y.jsx)(ee,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>i(Math.max(0,e-1)),disabled:e===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Y.jsx)(Ue,{className:`w-4 h-4`})}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray px-2 whitespace-nowrap`,children:[o(`inventory.page`),` `,e+1,` `,o(`inventory.of`),` `,r]}),(0,Y.jsx)(`button`,{onClick:()=>i(Math.min(r-1,e+1)),disabled:e>=r-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Y.jsx)(De,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>i(r-1),disabled:e>=r-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,Y.jsx)(k,{className:`w-4 h-4`})})]})]})]})}function or({spool:e,remaining:t,pct:n,onClick:r,onPrintLabel:i,onCopy:a,t:o,colorizeLocationSensors:s,locationSensorAboveColor:c,locationSensorBelowColor:l,locationSensorOptimalColor:u,dateFormat:d}){let f=ve({rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,subtype:e.subtype,effectSize:`card`});return(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors cursor-pointer ${e.archived_at?`opacity-50`:``}`,onClick:r,children:[(0,Y.jsxs)(`div`,{className:`h-14 flex items-center justify-center`,style:f,children:[(0,Y.jsx)(`span`,{className:`bg-white/90 text-gray-800 px-3 py-0.5 rounded-full text-sm font-medium`,children:Ve(e.color_name,e.rgba,e.color_name_is_synthesized)||`-`}),a&&(0,Y.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),a()},className:`p-1.5 bg-black/20 hover:bg-black/40 text-white rounded-full transition-colors`,title:o(`inventory.copySpool`),children:(0,Y.jsx)(M,{className:`w-3.5 h-3.5`})})]}),(0,Y.jsxs)(`div`,{className:`p-4 space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h3`,{className:`font-semibold text-white`,children:[e.material,e.subtype?` ${e.subtype}`:``]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e.brand||`-`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[i&&(0,Y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),i()},className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,title:o(`inventory.labels.printOne`),"aria-label":o(`inventory.labels.printOne`),children:(0,Y.jsx)(U,{className:`w-4 h-4`})}),(0,Y.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray bg-bambu-dark-tertiary px-2 py-1 rounded`,children:[`#`,e.id]})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex justify-between text-xs text-bambu-gray mb-1`,children:[(0,Y.jsx)(`span`,{children:o(`inventory.remaining`)}),(0,Y.jsxs)(`span`,{children:[Math.round(n),`%`]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`div`,{className:`flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full ${n>50?`bg-bambu-green`:n>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(n,100)}%`}})}),(0,Y.jsxs)(`span`,{className:`text-xs text-bambu-gray min-w-[40px] text-right`,children:[Math.round(t),`g`]})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs`,children:[e.last_dried_at&&(0,Y.jsxs)(`div`,{className:`col-span-2`,children:[(0,Y.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[o(`inventory.lastDried`),`: `]}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:[Xn(e.last_dried_at,d),Yn(e)].filter(Boolean).join(` · `)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[o(`inventory.labelWeight`),`: `]}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:qn(e.label_weight)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[o(`inventory.weightUsed`),`: `]}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:e.weight_used>0?qn(e.weight_used):`-`})]})]}),e.location_id&&(0,Y.jsx)(dr,{locationId:e.location_id,locationName:e.storage_location??null,isLast:!e.note,colorize:s,aboveColor:c,belowColor:l,optimalColor:u}),e.note&&(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray/60 pt-3 border-t border-bambu-dark-tertiary truncate`,title:e.note,children:e.note})]})]})}var sr={temperature:0,humidity:1,battery:2};function cr(e){return e===`humidity`?`mr-[2px]`:e===`battery`?`mr-[3px]`:``}function lr(e,t){return h(e,t,{decimals:2})}function ur(e,t,n,r,i){return t&&L(ie(e),n,r,i)||`text-bambu-gray`}function dr({locationId:e,locationName:t,isLast:n,colorize:i,aboveColor:a,belowColor:o,optimalColor:s}){let{t:l}=c(),{data:d}=u({queryKey:[`settings`],queryFn:r.getSettings}),f=(d?.location_sensor_poll_interval||120)*1e3,{data:p}=u({queryKey:[`locationHaSensors`],queryFn:()=>r.getLocationHASensors()}),m=(p??[]).some(t=>t.location_id===e),{data:h}=u({queryKey:[`locationHaSensorReadings`,e],queryFn:()=>r.getLocationHASensorReadings(e,!1),refetchInterval:f,enabled:m}),_=h?.filter(e=>e.show_on_card);if(!_?.length)return null;let v=_.find(e=>e.device_class===`battery`),y=_.filter(e=>e.device_class!==`battery`).sort((e,t)=>(sr[e.device_class??``]??99)-(sr[t.device_class??``]??99));return(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 pt-3 border-t border-bambu-dark-tertiary text-xs text-bambu-gray ${n?`-mb-1`:``}`,children:[t&&(0,Y.jsx)(`span`,{className:`truncate`,children:t}),(0,Y.jsx)(`span`,{className:`text-bambu-gray/40`,children:`|`}),(0,Y.jsx)(`div`,{className:`flex items-center gap-3`,children:y.map((e,t)=>{let n=g(e),r=t===0?`ml-[-3.6px]`:``;return(0,Y.jsxs)(`span`,{title:e.name,className:`flex items-center gap-[3px]`,children:[(0,Y.jsx)(n,{className:`w-3 h-3 ${cr(e.device_class)} ${r}`}),(0,Y.jsx)(`span`,{className:ur(e,i,a,o,s),children:lr(e,l)})]},e.id)})}),v&&(()=>{let e=g(v);return(0,Y.jsxs)(`span`,{title:v.name,className:`flex items-center gap-[3px] ml-auto`,children:[(0,Y.jsx)(e,{className:`w-3 h-3 ${cr(v.device_class)}`}),(0,Y.jsx)(`span`,{className:ur(v,i,a,o,s),children:lr(v,l)})]},v.id)})()]})}function fr({spool:e,remaining:t,pct:n,isSelected:r,onToggleSelected:i,onEdit:a,onCopy:o,onRestore:s,onArchive:c,onDelete:l,onPrintLabel:u,onResetConsumedCounter:d,visibleColumns:f,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:C,locationSensorOptimalColor:w}){return(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 hover:bg-bambu-dark-tertiary/30 transition-colors cursor-pointer ${e.archived_at?`opacity-50`:``} ${r?`bg-bambu-green/10`:``}`,onClick:a,children:[(0,Y.jsx)(`td`,{className:`w-10 px-3 py-3`,onClick:e=>e.stopPropagation(),children:i&&(0,Y.jsx)(`input`,{type:`checkbox`,className:`h-4 w-4 cursor-pointer`,"aria-label":v(`inventory.bulk.selectRow`),checked:!!r,onChange:i})}),f.map(r=>(0,Y.jsx)(`td`,{className:`py-3 px-4`,children:Qn[r]?.({spool:e,remaining:t,pct:n,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:C,locationSensorOptimalColor:w})},r)),(0,Y.jsx)(`td`,{className:`py-3 px-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(`button`,{onClick:a,className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,title:v(`common.edit`),children:(0,Y.jsx)(I,{className:`w-4 h-4`})}),o&&(0,Y.jsx)(`button`,{onClick:o,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded transition-colors`,title:v(`inventory.copySpool`),children:(0,Y.jsx)(M,{className:`w-4 h-4`})}),u&&(0,Y.jsx)(`button`,{onClick:u,className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,title:v(`inventory.labels.printOne`),children:(0,Y.jsx)(U,{className:`w-4 h-4`})}),d&&e.weight_used>0&&(0,Y.jsx)(`button`,{onClick:d,className:`p-1.5 text-bambu-gray hover:text-orange-600 dark:hover:text-orange-400 rounded transition-colors`,title:v(`inventory.resetConsumedCounterTooltip`),children:(0,Y.jsx)(S,{className:`w-4 h-4`})}),e.archived_at?(0,Y.jsx)(`button`,{onClick:s,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded transition-colors`,title:v(`inventory.restore`),children:(0,Y.jsx)(Se,{className:`w-4 h-4`})}):(0,Y.jsx)(`button`,{onClick:c,className:`p-1.5 text-bambu-gray hover:text-yellow-600 dark:hover:text-yellow-400 rounded transition-colors`,title:v(`inventory.archive`),children:(0,Y.jsx)(Te,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:l,className:`p-1.5 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 rounded transition-colors`,title:v(`common.delete`),children:(0,Y.jsx)(be,{className:`w-4 h-4`})})]})})]})}function pr({spools:e,headerSpool:t,remaining:n,pct:r,isExpanded:i,onToggle:a,onEdit:o,onCopy:s,onArchive:c,onDelete:l,onPrintLabel:u,onResetConsumedCounter:d,visibleColumns:f,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C,selectedIds:w,onToggleSelected:E,onToggleGroupSelected:D}){let O=!!w&&e.every(e=>w.has(e.id));return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 hover:bg-bambu-dark-tertiary/30 transition-colors cursor-pointer bg-bambu-green/5`,onClick:a,children:[(0,Y.jsx)(`td`,{className:`w-10 px-3 py-3`,onClick:e=>e.stopPropagation(),children:D&&(0,Y.jsx)(`input`,{type:`checkbox`,className:`h-4 w-4 cursor-pointer`,"aria-label":v(`inventory.bulk.selectGroup`),checked:O,onChange:t=>D(e.map(e=>e.id),t.target.checked)})}),f.map((a,o)=>(0,Y.jsx)(`td`,{className:`py-3 px-4`,children:o===0?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(T,{className:`w-4 h-4 text-bambu-gray transition-transform ${i?``:`-rotate-90`}`}),Qn[a]?.({spool:t,remaining:n,pct:r,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C})]}):a===`id`?(0,Y.jsx)(`span`,{className:`text-xs font-medium bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full`,children:v(`inventory.groupedSpools`,{count:e.length})}):Qn[a]?.({spool:t,remaining:n,pct:r,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C})},a)),(0,Y.jsx)(`td`,{className:`py-3 px-4`,children:(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.map(e=>`#${e.id}`).join(`, `)})})]}),i&&e.map(e=>{let t=Math.max(0,e.label_weight-e.weight_used);return(0,Y.jsx)(fr,{spool:e,remaining:t,pct:e.label_weight>0?t/e.label_weight*100:0,isSelected:w?.has(e.id),onToggleSelected:E?()=>E(e.id):void 0,onEdit:()=>o(e),onCopy:s?()=>s(e):void 0,onRestore:()=>{},onArchive:()=>c(e.id),onDelete:()=>l(e.id),onPrintLabel:u?()=>u(e.id):void 0,onResetConsumedCounter:d?()=>d(e.id):void 0,visibleColumns:f,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C},e.id)})]})}function mr({hasFilters:e,onAddSpool:t,t:n}){return(0,Y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 px-4`,children:[(0,Y.jsxs)(`div`,{className:`relative mb-6`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 -m-4 bg-bambu-green/5 rounded-full blur-2xl`}),(0,Y.jsxs)(`div`,{className:`relative flex items-center justify-center w-24 h-24 rounded-2xl bg-gradient-to-br from-bambu-dark-secondary to-bambu-dark-tertiary border border-bambu-dark-tertiary shadow-lg`,children:[(0,Y.jsx)(`div`,{className:`absolute -top-1 -right-1 w-3 h-3 rounded-full bg-bambu-green/30`}),(0,Y.jsx)(`div`,{className:`absolute -bottom-2 -left-2 w-2 h-2 rounded-full bg-bambu-green/20`}),e?(0,Y.jsx)(se,{className:`w-10 h-10 text-bambu-gray/40`,strokeWidth:1.5}):(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`div`,{className:`w-14 h-14 rounded-full border-4 border-bambu-gray/20 flex items-center justify-center`,children:(0,Y.jsx)(`div`,{className:`w-6 h-6 rounded-full bg-bambu-gray/10 border-2 border-bambu-gray/20`})}),(0,Y.jsx)(`div`,{className:`absolute -bottom-1 -right-1 w-6 h-6 rounded-full bg-bambu-green flex items-center justify-center shadow-md`,children:(0,Y.jsx)(`span`,{className:`text-white text-lg font-bold leading-none`,children:`+`})})]})]})]}),(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2 text-center`,children:e?n(`inventory.noSpoolsMatch`):n(`inventory.noSpools`).split(`.`)[0]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray text-center max-w-sm mb-6`,children:n(e?`inventory.noSpoolsMatchDesc`:`inventory.noSpools`)}),!e&&(0,Y.jsxs)(V,{onClick:t,children:[(0,Y.jsx)(oe,{className:`w-4 h-4`}),n(`inventory.addSpool`)]})]})}export{rr as default}; \ No newline at end of file diff --git a/static/assets/LibraryTrashPage-Ch5GUozX.js b/static/assets/LibraryTrashPage-Ch5GUozX.js new file mode 100644 index 000000000..44c6314de --- /dev/null +++ b/static/assets/LibraryTrashPage-Ch5GUozX.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{t as c}from"./arrow-left-0Q6F2rjC.js";import{n as l}from"./ToastContext-BRX0SW3C.js";import{t as u}from"./loader-circle-BEmFtawu.js";import{t as d}from"./file-DDkFXH-b.js";import{t as f}from"./Button-DDr6eAFy.js";import{v as p}from"./date-G9KUauqz.js";import{At as m,Gt as h,Rn as g,Ut as _,Vn as v,_t as y,yt as b}from"./index-CovRLYqQ.js";var x=e(n(),1),S=t();function C(e){let t=p(e);if(!t)return``;let n=Math.ceil((t.getTime()-Date.now())/(1e3*60*60*24));return n<=0?`any moment`:n===1?`1 day`:`${n} days`}function w(e){let t=p(e);return t?t.toLocaleString():e}function T(){let{t:e}=i(),t=v(),n=a(),{showToast:p}=l(),{hasPermission:T,authEnabled:E}=b(),[D,O]=(0,x.useState)(null),[k,A]=(0,x.useState)(new Set),j=!E||T(`library:purge`),M=o({queryKey:[`library-trash`],queryFn:()=>r.listLibraryTrash(200,0)}),N=o({queryKey:[`library-trash-settings`],queryFn:()=>r.getLibraryTrashSettings(),enabled:j}),[P,F]=(0,x.useState)(null);(0,x.useEffect)(()=>{N.data&&P===null&&F(N.data.retention_days)},[N.data,P]);let I=s({mutationFn:e=>{let t=N.data;return r.updateLibraryTrashSettings({retention_days:e,auto_purge_enabled:t?.auto_purge_enabled??!1,auto_purge_days:t?.auto_purge_days??90,auto_purge_include_never_printed:t?.auto_purge_include_never_printed??!0})},onSuccess:t=>{p(e(`libraryTrash.toast.retentionSaved`,{days:t.retention_days}),`success`),n.invalidateQueries({queryKey:[`library-trash-settings`]}),n.invalidateQueries({queryKey:[`library-trash`]})},onError:t=>p(t.message||e(`libraryTrash.toast.retentionFailed`),`error`)}),L=s({mutationFn:e=>r.restoreLibraryTrash(e),onSuccess:()=>{p(e(`libraryTrash.toast.restored`),`success`),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]}),n.invalidateQueries({queryKey:[`library-files`]}),n.invalidateQueries({queryKey:[`library-folders`]})},onError:t=>p(t.message||e(`libraryTrash.toast.restoreFailed`),`error`)}),R=s({mutationFn:e=>r.hardDeleteLibraryTrash(e),onSuccess:()=>{p(e(`libraryTrash.toast.purged`),`success`),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]})},onError:t=>p(t.message||e(`libraryTrash.toast.purgeFailed`),`error`)}),z=s({mutationFn:()=>r.emptyLibraryTrash(),onSuccess:t=>{p(e(`libraryTrash.toast.emptied`,{count:t.deleted}),`success`),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]})},onError:t=>p(t.message||e(`libraryTrash.toast.emptyFailed`),`error`)}),B=s({mutationFn:e=>Promise.all(e.map(e=>r.restoreLibraryTrash(e))),onSuccess:(t,r)=>{p(e(`libraryTrash.toast.bulkRestored`,{count:r.length}),`success`),A(new Set),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]}),n.invalidateQueries({queryKey:[`library-files`]}),n.invalidateQueries({queryKey:[`library-folders`]})},onError:t=>p(t.message||e(`libraryTrash.toast.restoreFailed`),`error`)}),V=s({mutationFn:e=>Promise.all(e.map(e=>r.hardDeleteLibraryTrash(e))),onSuccess:(t,r)=>{p(e(`libraryTrash.toast.bulkPurged`,{count:r.length}),`success`),A(new Set),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]})},onError:t=>p(t.message||e(`libraryTrash.toast.purgeFailed`),`error`)}),H=(0,x.useMemo)(()=>M.data?.items??[],[M.data?.items]),U=M.data?.retention_days??30,W=(0,x.useMemo)(()=>H.reduce((e,t)=>e+t.file_size,0),[H]),G=H.length>0&&H.every(e=>k.has(e.id)),K=k.size>0&&!G,q=e=>{A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,S.jsxs)(`div`,{className:`p-6 max-w-screen-2xl mx-auto`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-3 mb-4`,children:(0,S.jsxs)(g,{to:`/files`,className:`inline-flex items-center gap-1 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200`,children:[(0,S.jsx)(c,{className:`w-4 h-4`}),` `,e(`libraryTrash.backToFiles`)]})}),(0,S.jsxs)(`div`,{className:`flex items-start justify-between mb-6 gap-4 flex-wrap`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900 dark:text-gray-100`,children:e(`libraryTrash.title`)}),(0,S.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 mt-1`,children:e(j?`libraryTrash.subtitleAdmin`:`libraryTrash.subtitleUser`,{days:U})})]}),H.length>0&&(0,S.jsxs)(f,{variant:`secondary`,onClick:()=>O({type:`empty`}),className:`text-red-600 dark:text-red-400`,children:[(0,S.jsx)(m,{className:`w-4 h-4 mr-1`}),e(`libraryTrash.emptyTrash`)]})]}),j&&N.data&&(0,S.jsxs)(`div`,{className:`mb-4 border border-gray-200 dark:border-gray-700 rounded-lg p-3 flex items-center gap-3 bg-gray-50 dark:bg-gray-800/40`,children:[(0,S.jsx)(`label`,{htmlFor:`retention-days`,className:`text-sm font-medium text-gray-700 dark:text-gray-300`,children:e(`libraryTrash.retentionLabel`)}),(0,S.jsx)(`input`,{id:`retention-days`,type:`number`,min:1,max:365,value:P??N.data.retention_days,onChange:e=>F(Math.max(1,Math.min(365,parseInt(e.target.value||`0`,10)||0))),className:`w-20 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm px-2 py-1 text-gray-900 dark:text-gray-100`}),(0,S.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:e(`libraryTrash.days`)}),(0,S.jsxs)(f,{variant:`secondary`,onClick:()=>P!=null&&I.mutate(P),disabled:I.isPending||P==null||P===N.data.retention_days,className:`ml-auto`,children:[(0,S.jsx)(_,{className:`w-4 h-4 mr-1`}),e(`common.save`)]})]}),M.isLoading?(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-500 dark:text-gray-400`,children:[(0,S.jsx)(u,{className:`w-4 h-4 animate-spin`}),` `,e(`libraryTrash.loading`)]}):H.length===0?(0,S.jsx)(`div`,{className:`border border-dashed border-gray-300 dark:border-gray-700 rounded-lg p-12 text-center`,children:(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:e(`libraryTrash.empty`)})}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e(`libraryTrash.summary`,{count:H.length,size:d(W)})}),k.size>0&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,S.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,children:e(`libraryTrash.selectionCount`,{count:k.size})}),(0,S.jsxs)(f,{variant:`secondary`,onClick:()=>B.mutate(Array.from(k)),disabled:B.isPending,children:[(0,S.jsx)(h,{className:`w-4 h-4 mr-1`}),e(`libraryTrash.bulkRestore`)]}),(0,S.jsxs)(f,{variant:`secondary`,onClick:()=>O({type:`bulkDelete`,count:k.size}),disabled:V.isPending,className:`text-red-600 dark:text-red-400`,children:[(0,S.jsx)(m,{className:`w-4 h-4 mr-1`}),e(`libraryTrash.bulkPurge`)]})]})]}),(0,S.jsx)(`div`,{className:`border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,S.jsx)(`thead`,{className:`bg-gray-50 dark:bg-gray-800 text-left text-gray-600 dark:text-gray-300`,children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{className:`px-3 py-2 w-10`,children:(0,S.jsx)(`input`,{type:`checkbox`,checked:G,ref:e=>{e&&(e.indeterminate=K)},onChange:()=>{A(e=>e.size===H.length?new Set:new Set(H.map(e=>e.id)))},"aria-label":e(`libraryTrash.selectAll`),className:`rounded border-gray-300 cursor-pointer`})}),(0,S.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`libraryTrash.col.filename`)}),(0,S.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`libraryTrash.col.folder`)}),(0,S.jsx)(`th`,{className:`px-3 py-2 font-medium text-right`,children:e(`libraryTrash.col.size`)}),(0,S.jsx)(`th`,{className:`px-3 py-2 font-medium whitespace-nowrap`,children:e(`libraryTrash.col.deleted`)}),(0,S.jsx)(`th`,{className:`px-3 py-2 font-medium whitespace-nowrap`,children:e(`libraryTrash.col.autoPurge`)}),j&&(0,S.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`libraryTrash.col.owner`)}),(0,S.jsx)(`th`,{className:`px-3 py-2 font-medium text-right`,children:e(`libraryTrash.col.actions`)})]})}),(0,S.jsx)(`tbody`,{className:`divide-y divide-gray-100 dark:divide-gray-800`,children:H.map(t=>(0,S.jsxs)(`tr`,{className:`hover:bg-gray-50 dark:hover:bg-gray-800/50`,children:[(0,S.jsx)(`td`,{className:`px-3 py-2`,children:(0,S.jsx)(`input`,{type:`checkbox`,checked:k.has(t.id),onChange:()=>q(t.id),"aria-label":e(`libraryTrash.selectOne`,{filename:t.filename}),className:`rounded border-gray-300 cursor-pointer`})}),(0,S.jsx)(`td`,{className:`px-3 py-2 text-gray-900 dark:text-gray-100 truncate max-w-md`,title:t.filename,children:t.filename}),(0,S.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400`,children:t.folder_name??`—`}),(0,S.jsx)(`td`,{className:`px-3 py-2 text-right text-gray-600 dark:text-gray-400 tabular-nums whitespace-nowrap`,children:d(t.file_size)}),(0,S.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400 whitespace-nowrap`,children:w(t.deleted_at)}),(0,S.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400 whitespace-nowrap`,children:(0,S.jsx)(`span`,{title:w(t.auto_purge_at),children:e(`libraryTrash.autoPurgeIn`,{when:C(t.auto_purge_at)})})}),j&&(0,S.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400`,children:t.created_by_username??`—`}),(0,S.jsxs)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap`,children:[(0,S.jsxs)(`button`,{onClick:()=>L.mutate(t.id),disabled:L.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-xs text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300`,children:[(0,S.jsx)(h,{className:`w-3.5 h-3.5`}),e(`libraryTrash.restore`)]}),(0,S.jsxs)(`button`,{onClick:()=>O({type:`delete`,id:t.id,filename:t.filename}),disabled:R.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300 ml-2`,children:[(0,S.jsx)(m,{className:`w-3.5 h-3.5`}),e(`libraryTrash.purgeNow`)]})]})]},t.id))})]})})]}),D&&(0,S.jsx)(y,{onCancel:()=>O(null),onConfirm:()=>{D&&(D.type===`delete`?R.mutate(D.id):D.type===`bulkDelete`?V.mutate(Array.from(k)):z.mutate(),O(null))},title:D.type===`delete`?e(`libraryTrash.confirm.purgeTitle`):D.type===`bulkDelete`?e(`libraryTrash.confirm.bulkPurgeTitle`):e(`libraryTrash.confirm.emptyTitle`),message:D.type===`delete`?e(`libraryTrash.confirm.purgeBody`,{filename:D.filename}):D.type===`bulkDelete`?e(`libraryTrash.confirm.bulkPurgeBody`,{count:D.count}):e(`libraryTrash.confirm.emptyBody`,{count:H.length}),confirmText:e(`libraryTrash.confirm.cta`),variant:`danger`}),M.isError&&(0,S.jsxs)(`div`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:[M.error?.message??e(`libraryTrash.loadError`),(0,S.jsx)(f,{variant:`secondary`,onClick:()=>t(`/files`),className:`ml-3`,children:e(`libraryTrash.backToFiles`)})]})]})}export{T as LibraryTrashPage}; \ No newline at end of file diff --git a/static/assets/LoginPage-COCFpNMo.js b/static/assets/LoginPage-COCFpNMo.js new file mode 100644 index 000000000..e4e91ce56 --- /dev/null +++ b/static/assets/LoginPage-COCFpNMo.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{t as a}from"./useQuery-BBCjCezC.js";import{t as o}from"./useMutation-B-Tr2hIP.js";import{n as s}from"./ToastContext-BRX0SW3C.js";import{t as ee}from"./shield-bODVqOJd.js";import{t as te}from"./smartphone-DaDGaGLT.js";import{t as ne}from"./x-DR-Trv6U.js";import{i as re,n as ie,t as ae}from"./Card-Bzc64K35.js";import{t as c}from"./Button-DDr6eAFy.js";import{Bn as oe,Vn as se,Wn as ce,in as le,ln as ue,vt as de,yt as fe}from"./index-CovRLYqQ.js";var l=e(n(),1),u=t(),d=`auth_remember_me`,f=`auth_post_login_redirect`;function p(e){return e?`persistent`:`session`}function pe(){try{let e=sessionStorage.getItem(d)===`1`;return sessionStorage.removeItem(d),e}catch(e){return console.warn(`consumeSavedRememberMe: sessionStorage unavailable, Remember Me preference lost across OIDC redirect`,e),!1}}function m(e){return!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/login`)?null:e}function h(e){let t=m(e);if(t)try{sessionStorage.setItem(f,t)}catch(e){console.warn(`stashPostLoginRedirect: sessionStorage unavailable, post-login target will be lost across OIDC redirect`,e)}}function me(){try{let e=sessionStorage.getItem(f);return sessionStorage.removeItem(f),m(e)}catch(e){return console.warn(`consumePostLoginRedirect: sessionStorage unavailable`,e),null}}function he({provider:e,onClick:t,disabled:n}){let{t:a}=i(),[o,s]=(0,l.useState)(!1);return(0,u.jsxs)(`button`,{type:`button`,onClick:t,disabled:n,className:`w-full flex items-center justify-center gap-3 py-3 px-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary hover:border-bambu-green/50 rounded-lg text-white font-medium transition-colors disabled:opacity-50`,children:[e.has_icon&&!o?(0,u.jsx)(`img`,{src:r.oidcProviderIconUrl(e.id),alt:``,className:`w-5 h-5 object-contain`,onError:()=>s(!0)}):(0,u.jsx)(ee,{className:`w-5 h-5 text-bambu-green`}),a(`login.twoFA.signInWith`,{provider:e.name})]})}function g(){let e=se(),t=oe(),[n]=ce(),{t:f}=i(),{login:g,loginWithToken:_,user:v,loading:ge}=fe(),{showToast:y}=s(),{mode:_e}=de();function b(){let e=t.state?.from;if(e?.pathname){let t=m(`${e.pathname}${e.search??``}`);if(t)return t}return me()??`/`}let[x,ve]=(0,l.useState)(``),[S,ye]=(0,l.useState)(``),[be,C]=(0,l.useState)(!1),[w,T]=(0,l.useState)(``),[E,D]=(0,l.useState)(`credentials`),[O,k]=(0,l.useState)(``),[A,j]=(0,l.useState)([]),[M,N]=(0,l.useState)(`totp`),[P,F]=(0,l.useState)(``),[I,L]=(0,l.useState)(!1),xe=(0,l.useRef)(null),[R,z]=(0,l.useState)(!1),[Se,B]=(0,l.useState)(``),[V,H]=(0,l.useState)(``),[U,W]=(0,l.useState)(``),{data:G}=a({queryKey:[`advancedAuthStatus`],queryFn:()=>r.getAdvancedAuthStatus()}),{data:K}=a({queryKey:[`oidcProviders`],queryFn:()=>r.getOIDCProviders()}),[Ce,we]=(0,l.useState)(!1);(0,l.useEffect)(()=>{!ge&&v&&E===`credentials`&&e(`/`,{replace:!0})},[ge,v,E,e]);let Te=(0,l.useRef)(!1);(0,l.useEffect)(()=>{if(Te.current||n.get(`fallback`)===`local`||!G||!G.autologin_provider_id||window.location.hash.startsWith(`#oidc_token=`)||n.get(`oidc_error`))return;Te.current=!0;let e=G.autologin_provider_id,i=new Promise((e,t)=>setTimeout(()=>t(Error(`autologin timeout`)),5e3));Promise.race([r.getOIDCAuthorizeUrl(e),i]).then(e=>{let n=t.state?.from;n?.pathname&&h(`${n.pathname}${n.search??``}`),window.location.href=e.auth_url}).catch(()=>{we(!0)})},[G,n,t.state]);let q=G?.local_login_enabled!==!1,Ee=Ce&&G?.autologin_provider_id!=null;(0,l.useEffect)(()=>{let t=window.location.hash,n=t.startsWith(`#reset_token=`)?t.slice(13):null;n&&(B(n),D(`reset-password`),e(`/login`,{replace:!0}))},[]),(0,l.useEffect)(()=>{let t=window.location.hash,i=t.startsWith(`#oidc_token=`)?t.slice(12):null,a=n.get(`oidc_error`);if(!i&&!a)return;let o=pe();if(a){y({oidc_provider_error:f(`login.oidcErrors.providerError`),missing_parameters:f(`login.oidcErrors.missingParameters`),invalid_state:f(`login.oidcErrors.invalidState`),state_expired:f(`login.oidcErrors.stateExpired`),provider_not_found:f(`login.oidcErrors.providerNotFound`),discovery_failed:f(`login.oidcErrors.discoveryFailed`),invalid_discovery_document:f(`login.oidcErrors.invalidDiscovery`),token_exchange_network_error:f(`login.oidcErrors.networkError`),token_exchange_bad_response:f(`login.oidcErrors.badResponse`),no_id_token:f(`login.oidcErrors.noIdToken`),token_validation_failed:f(`login.oidcErrors.validationFailed`),nonce_mismatch:f(`login.oidcErrors.nonceMismatch`),missing_sub_claim:f(`login.oidcErrors.missingSubClaim`),no_linked_account:f(`login.oidcErrors.noLinkedAccount`),account_inactive:f(`login.oidcErrors.accountInactive`),user_resolution_failed:f(`login.oidcErrors.userResolutionFailed`),internal_error:f(`login.oidcErrors.internalError`)}[a]??(a.startsWith(`token_exchange_`)?f(`login.oidcErrors.tokenExchangeFailed`):f(`login.oidcLoginFailed`)),`error`),e(`/login`,{replace:!0});return}i&&r.exchangeOIDCToken(i).then(t=>{if(t.requires_2fa&&t.pre_auth_token){z(o),k(t.pre_auth_token);let n=t.two_fa_methods??[];j(n),n.includes(`totp`)?N(`totp`):n.includes(`email`)?N(`email`):N(`backup`),D(`2fa`),e(`/login`,{replace:!0})}else t.access_token&&t.user?(_(t.access_token,t.user,p(o)),y(f(`login.loginSuccess`)),e(b(),{replace:!0})):(y(f(`login.oidcLoginFailed`),`error`),e(`/login`,{replace:!0}))}).catch(t=>{console.error(`OIDC token exchange failed`,t),y(f(`login.oidcLoginFailed`),`error`),e(`/login`,{replace:!0})})},[n]);let J=o({mutationFn:()=>g(x,S,p(R)),onSuccess:t=>{if(t.requires_2fa&&t.pre_auth_token){k(t.pre_auth_token);let e=t.two_fa_methods??[];j(e),e.includes(`totp`)?N(`totp`):e.includes(`email`)?N(`email`):N(`backup`),D(`2fa`)}else t.access_token&&t.user&&(y(f(`login.loginSuccess`)),e(b(),{replace:!0}))},onError:e=>{y(e.message||f(`login.loginFailed`),`error`)}}),Y=o({mutationFn:e=>r.forgotPassword({email:e}),onSuccess:e=>{y(e.message,`success`),C(!1),T(``)},onError:e=>{y(e.message,`error`)}}),X=o({mutationFn:()=>r.forgotPasswordConfirm(Se,V),onSuccess:e=>{y(e.message,`success`),D(`credentials`),B(``),H(``),W(``)},onError:e=>{y(e.message||f(`login.resetPassword.resetFailed`),`error`)}}),Z=o({mutationFn:()=>r.sendEmailOTP(O),onSuccess:e=>{L(!0),e.pre_auth_token&&k(e.pre_auth_token),y(e.message,`success`)},onError:e=>{y(e.message||f(`login.twoFA.sendCodeFailed`),`error`)}}),Q=o({mutationFn:()=>r.verify2FA({pre_auth_token:O,code:P,method:M}),onSuccess:t=>{t.access_token&&t.user?(_(t.access_token,t.user,p(R)),y(f(`login.loginSuccess`)),e(b(),{replace:!0})):(console.error(`2FA verify: unexpected response shape`,t),y(f(`login.loginFailed`),`error`))},onError:e=>{y(e.message||f(`login.twoFA.invalidCode`),`error`),F(``)}}),De=o({mutationFn:e=>r.getOIDCAuthorizeUrl(e),onSuccess:e=>{try{R?sessionStorage.setItem(d,`1`):sessionStorage.removeItem(d)}catch(e){console.warn(`setItem/removeItem auth_remember_me failed, Remember Me will not carry through OIDC redirect`,e)}let n=t.state?.from;n?.pathname&&h(`${n.pathname}${n.search??``}`),window.location.href=e.auth_url},onError:e=>{y(e.message||f(`login.oidcLoginFailed`),`error`)}}),Oe=e=>{if(e.preventDefault(),!x||!S){y(f(`login.enterCredentials`),`error`);return}J.mutate()},ke=e=>{if(e.preventDefault(),!P.trim()){y(f(`login.twoFA.enterCode`),`error`);return}Q.mutate()},Ae=e=>{if(e.preventDefault(),!w){y(f(`login.enterEmail`),`error`);return}Y.mutate(w)},$=e=>{N(e),F(``),L(!1),setTimeout(()=>xe.current?.focus(),0)};return E===`reset-password`?(0,u.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,u.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,u.jsxs)(`div`,{className:`text-center`,children:[(0,u.jsx)(`div`,{className:`flex items-center justify-center mb-4`,children:(0,u.jsx)(`div`,{className:`w-14 h-14 rounded-full bg-bambu-green/20 flex items-center justify-center`,children:(0,u.jsx)(ue,{className:`w-7 h-7 text-bambu-green`})})}),(0,u.jsx)(`h2`,{className:`text-2xl font-bold text-white`,children:f(`login.resetPassword.title`)}),(0,u.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:f(`login.resetPassword.subtitle`)})]}),(0,u.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),V!==U){y(f(`login.resetPassword.passwordsDoNotMatch`),`error`);return}if(V.length<8){y(f(`login.resetPassword.passwordTooShort`),`error`);return}X.mutate()},className:`space-y-4`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`new-password`,className:`block text-sm font-medium text-white mb-2`,children:f(`login.resetPassword.newPassword`)}),(0,u.jsx)(`input`,{id:`new-password`,type:`password`,required:!0,value:V,onChange:e=>H(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:f(`login.resetPassword.newPasswordPlaceholder`),autoFocus:!0,autoComplete:`new-password`,minLength:8})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`confirm-password`,className:`block text-sm font-medium text-white mb-2`,children:f(`login.resetPassword.confirmPassword`)}),(0,u.jsx)(`input`,{id:`confirm-password`,type:`password`,required:!0,value:U,onChange:e=>W(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:f(`login.resetPassword.confirmPasswordPlaceholder`),autoComplete:`new-password`})]}),(0,u.jsx)(`button`,{type:`submit`,disabled:X.isPending||!V||!U,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:X.isPending?f(`login.resetPassword.saving`):f(`login.resetPassword.submit`)})]}),(0,u.jsx)(`div`,{className:`text-center`,children:(0,u.jsx)(`button`,{type:`button`,onClick:()=>{D(`credentials`),B(``),H(``),W(``)},className:`text-sm text-bambu-gray hover:text-bambu-green transition-colors`,children:f(`login.resetPassword.backToLogin`)})})]})}):E===`2fa`?(0,u.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,u.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,u.jsxs)(`div`,{className:`text-center`,children:[(0,u.jsx)(`div`,{className:`flex items-center justify-center mb-4`,children:(0,u.jsx)(`div`,{className:`w-14 h-14 rounded-full bg-bambu-green/20 flex items-center justify-center`,children:(0,u.jsx)(ee,{className:`w-7 h-7 text-bambu-green`})})}),(0,u.jsx)(`h2`,{className:`text-2xl font-bold text-white`,children:f(`login.twoFA.title`)}),(0,u.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:f(`login.twoFA.subtitle`)})]}),A.length>1&&(0,u.jsxs)(`div`,{className:`flex gap-2`,children:[A.includes(`totp`)&&(0,u.jsxs)(`button`,{type:`button`,onClick:()=>$(`totp`),className:`flex-1 flex flex-col items-center gap-1 py-2 px-3 rounded-lg border text-xs font-medium transition-colors ${M===`totp`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-green/50`}`,children:[(0,u.jsx)(te,{className:`w-4 h-4`}),f(`login.twoFA.methodAuthenticator`)]}),A.includes(`email`)&&(0,u.jsxs)(`button`,{type:`button`,onClick:()=>$(`email`),className:`flex-1 flex flex-col items-center gap-1 py-2 px-3 rounded-lg border text-xs font-medium transition-colors ${M===`email`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-green/50`}`,children:[(0,u.jsx)(le,{className:`w-4 h-4`}),f(`login.twoFA.methodEmail`)]}),A.includes(`backup`)&&(0,u.jsxs)(`button`,{type:`button`,onClick:()=>$(`backup`),className:`flex-1 flex flex-col items-center gap-1 py-2 px-3 rounded-lg border text-xs font-medium transition-colors ${M===`backup`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-green/50`}`,children:[(0,u.jsx)(ue,{className:`w-4 h-4`}),f(`login.twoFA.methodBackup`)]})]}),(0,u.jsxs)(`form`,{onSubmit:ke,className:`space-y-4`,children:[M===`totp`&&(0,u.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:f(`login.twoFA.instructionsTotp`)}),M===`email`&&(0,u.jsxs)(`div`,{className:`space-y-3`,children:[(0,u.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:f(I?`login.twoFA.instructionsEmail`:`login.twoFA.instructionsEmailNotSent`)}),!I&&(0,u.jsx)(c,{type:`button`,variant:`secondary`,className:`w-full`,onClick:()=>Z.mutate(),disabled:Z.isPending,children:Z.isPending?f(`login.twoFA.sendingCode`):f(`login.twoFA.sendCodeButton`)}),I&&(0,u.jsx)(`button`,{type:`button`,onClick:()=>{L(!1),Z.mutate()},className:`text-xs text-bambu-gray hover:text-bambu-green transition-colors`,children:f(`login.twoFA.resendCode`)})]}),M===`backup`&&(0,u.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:f(`login.twoFA.instructionsBackup`)}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`twofa-code`,className:`block text-sm font-medium text-white mb-2`,children:f(M===`backup`?`login.twoFA.backupCodeLabel`:`login.twoFA.codeLabel`)}),(0,u.jsx)(`input`,{ref:xe,id:`twofa-code`,type:`text`,inputMode:M===`backup`?`text`:`numeric`,autoComplete:`one-time-code`,value:P,onChange:e=>F(e.target.value.trim()),disabled:M===`email`&&!I,className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray text-center tracking-widest text-xl font-mono focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors disabled:opacity-40`,placeholder:f(M===`backup`?`login.twoFA.backupCodePlaceholder`:`login.twoFA.codePlaceholder`),maxLength:M===`backup`?8:6,autoFocus:!0})]}),(0,u.jsx)(`button`,{type:`submit`,disabled:Q.isPending||!P.trim()||M===`email`&&!I,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:Q.isPending?f(`login.twoFA.verifyingButton`):f(`login.twoFA.verifyButton`)})]}),(0,u.jsx)(`div`,{className:`text-center`,children:(0,u.jsx)(`button`,{type:`button`,onClick:()=>{D(`credentials`),k(``),F(``),L(!1)},className:`text-sm text-bambu-gray hover:text-bambu-green transition-colors`,children:f(`login.twoFA.backToLogin`)})})]})}):(0,u.jsxs)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:[(0,u.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,u.jsxs)(`div`,{className:`text-center`,children:[(0,u.jsx)(`div`,{className:`flex items-center justify-center mb-6`,children:(0,u.jsx)(`img`,{src:_e===`dark`?`/img/bambuddy_logo_dark_transparent.png`:`/img/bambuddy_logo_light.png`,alt:`Bambuddy`,className:`h-16`})}),(0,u.jsx)(`h2`,{className:`text-3xl font-bold text-white`,children:f(`login.title`)}),(0,u.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:f(`login.subtitle`)})]}),Ee&&(0,u.jsx)(`div`,{className:`mt-6 rounded-lg border border-amber-300 dark:border-amber-500/40 bg-amber-50 dark:bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200`,children:f(`login.autologinFailed`)}),!q&&(0,u.jsx)(`div`,{className:`mt-6 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark/40 px-4 py-3 text-sm text-bambu-gray`,children:f(`login.localDisabledNotice`)}),q&&(0,u.jsxs)(`form`,{className:`mt-8 space-y-6`,onSubmit:Oe,children:[(0,u.jsxs)(`div`,{className:`space-y-4`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`username`,className:`block text-sm font-medium text-white mb-2`,children:G?.advanced_auth_enabled?f(`login.usernameOrEmail`):f(`login.username`)}),(0,u.jsx)(`input`,{id:`username`,type:`text`,required:!0,value:x,onChange:e=>ve(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:G?.advanced_auth_enabled?f(`login.usernameOrEmailPlaceholder`):f(`login.usernamePlaceholder`),autoComplete:`username`})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`password`,className:`block text-sm font-medium text-white mb-2`,children:f(`login.password`)||`Password`}),(0,u.jsx)(`input`,{id:`password`,type:`password`,required:!0,value:S,onChange:e=>ye(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:f(`login.passwordPlaceholder`),autoComplete:`current-password`})]})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`input`,{id:`remember-me`,type:`checkbox`,checked:R,onChange:e=>z(e.target.checked),className:`h-4 w-4 rounded border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green/50 cursor-pointer`}),(0,u.jsx)(`label`,{htmlFor:`remember-me`,className:`text-sm text-bambu-gray cursor-pointer`,children:f(`login.rememberMe`)})]}),(0,u.jsx)(`div`,{children:(0,u.jsx)(`button`,{type:`submit`,disabled:J.isPending,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-bambu-green`,children:J.isPending?f(`login.signingIn`):f(`login.signIn`)})}),(0,u.jsx)(`div`,{className:`text-center`,children:(0,u.jsx)(`button`,{type:`button`,onClick:()=>C(!0),className:`text-sm text-bambu-gray hover:text-bambu-green transition-colors`,children:f(`login.forgotPassword`)})})]}),K&&K.length>0&&(0,u.jsxs)(`div`,{className:`space-y-3`,children:[q&&(0,u.jsxs)(`div`,{className:`relative`,children:[(0,u.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,u.jsx)(`div`,{className:`w-full border-t border-bambu-dark-tertiary`})}),(0,u.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,u.jsx)(`span`,{className:`px-2 bg-bambu-dark-secondary text-bambu-gray`,children:f(`login.twoFA.orContinueWith`)})})]}),!q&&(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`input`,{id:`remember-me`,type:`checkbox`,checked:R,onChange:e=>z(e.target.checked),className:`h-4 w-4 rounded border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green/50 cursor-pointer`}),(0,u.jsx)(`label`,{htmlFor:`remember-me`,className:`text-sm text-bambu-gray cursor-pointer`,children:f(`login.rememberMe`)})]}),(0,u.jsx)(`div`,{className:`space-y-2`,children:K.map(e=>(0,u.jsx)(he,{provider:e,onClick:()=>De.mutate(e.id),disabled:De.isPending},e.id))})]})]}),be&&(0,u.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:()=>C(!1),children:(0,u.jsxs)(ae,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,u.jsx)(re,{children:(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(le,{className:`w-5 h-5 text-bambu-green`}),(0,u.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:f(`login.forgotPasswordTitle`)})]}),(0,u.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>{C(!1),T(``)},children:(0,u.jsx)(ne,{className:`w-5 h-5`})})]})}),(0,u.jsx)(ie,{children:G?.advanced_auth_enabled?(0,u.jsxs)(`form`,{onSubmit:Ae,className:`space-y-4`,children:[(0,u.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:f(`login.forgotPasswordEmailMessage`)}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`forgot-email`,className:`block text-sm font-medium text-white mb-2`,children:f(`login.emailAddress`)}),(0,u.jsx)(`input`,{id:`forgot-email`,type:`email`,required:!0,value:w,onChange:e=>T(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:f(`login.emailPlaceholder`)})]}),(0,u.jsxs)(`div`,{className:`flex gap-2`,children:[(0,u.jsx)(c,{type:`button`,variant:`secondary`,className:`flex-1`,onClick:()=>{C(!1),T(``)},children:f(`login.cancel`)}),(0,u.jsx)(c,{type:`submit`,className:`flex-1`,disabled:Y.isPending,children:Y.isPending?f(`login.sending`):f(`login.sendResetEmail`)})]})]}):(0,u.jsxs)(`div`,{className:`space-y-4`,children:[(0,u.jsx)(`p`,{className:`text-bambu-gray`,children:f(`login.forgotPasswordMessage`)}),(0,u.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4 space-y-2`,children:[(0,u.jsx)(`p`,{className:`text-sm text-white font-medium`,children:f(`login.howToReset`)}),(0,u.jsxs)(`ol`,{className:`text-sm text-bambu-gray space-y-1 list-decimal list-inside`,children:[(0,u.jsx)(`li`,{children:f(`login.resetStep1`)}),(0,u.jsx)(`li`,{children:f(`login.resetStep2`)}),(0,u.jsx)(`li`,{children:f(`login.resetStep3`)}),(0,u.jsx)(`li`,{children:f(`login.resetStep4`)})]})]}),(0,u.jsx)(c,{variant:`secondary`,className:`w-full`,onClick:()=>C(!1),children:f(`login.gotIt`)})]})})]})})]})}export{g as LoginPage}; \ No newline at end of file diff --git a/static/assets/MaintenancePage-DUkfiEWj.js b/static/assets/MaintenancePage-DUkfiEWj.js new file mode 100644 index 000000000..1963825b9 --- /dev/null +++ b/static/assets/MaintenancePage-DUkfiEWj.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{t as c}from"./createLucideIcon-DvBYJlWL.js";import{t as l}from"./box-DAdKb9s5.js";import{n as u,t as d}from"./fan-D6AmXZMv.js";import{t as f}from"./calendar-BLKPnWqV.js";import{t as p}from"./check-Ck0cMLU4.js";import{a as m,i as h}from"./info-ROUoQhJR.js";import{n as g}from"./ToastContext-BRX0SW3C.js";import{t as _}from"./cog-Dol1I0kq.js";import{t as v}from"./droplet-CqYXMF2u.js";import{t as y}from"./funnel-C3dyAMK9.js";import{t as ee}from"./loader-circle-BEmFtawu.js";import{t as b}from"./pen-line-BWR04BX-.js";import{t as x}from"./sparkles-DRqKNlhr.js";import{t as S}from"./target-B40GQtrA.js";import{n as C,t as w}from"./wind-CI8UoBMf.js";import{t as T}from"./timer-GUTR9dAu.js";import{t as E}from"./triangle-alert-Dt_1FcBy.js";import{n as D,t as O}from"./Card-Bzc64K35.js";import{t as k}from"./Button-DDr6eAFy.js";import{At as te,Cn as A,Gt as j,Jt as ne,Kt as M,Lt as re,On as N,Vt as P,Zt as ie,_t as ae,bn as F,bt as I,cn as L,xt as R,yt as oe}from"./index-CovRLYqQ.js";import{t as z}from"./Toggle-KiqA_5fU.js";var B=c(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),V=c(`ruler`,[[`path`,{d:`M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z`,key:`icamh8`}],[`path`,{d:`m14.5 12.5 2-2`,key:`inckbg`}],[`path`,{d:`m11.5 9.5 2-2`,key:`fmmyf7`}],[`path`,{d:`m8.5 6.5 2-2`,key:`vc6u1g`}],[`path`,{d:`m17.5 15.5 2-2`,key:`wo5hmg`}]]),H=e(n(),1);function U(e,t){let n=(t||``).toUpperCase().replace(/[- ]/g,``),r=n.includes(`X1`),i=n.includes(`P1`),a=n.includes(`A1MINI`),o=n.includes(`A1`)&&!a,s=n.includes(`H2D`),c=n.includes(`H2C`),l=n.includes(`H2S`),u=s||c||l,d=n.includes(`P2S`),f=n.includes(`X2D`),p=d||f;switch(e){case`Lubricate Steel Rods`:return p?`https://wiki.bambulab.com/en/p2s/maintenance/lubricate-x-y-z-axis`:null;case`Clean Steel Rods`:return p?`https://wiki.bambulab.com/en/p2s/maintenance/lubricate-x-y-z-axis`:null;case`Lubricate Linear Rails`:return a?`https://wiki.bambulab.com/en/a1-mini/maintenance/lubricate-y-axis`:o?`https://wiki.bambulab.com/en/a1/maintenance/lubricate-y-axis`:u?`https://wiki.bambulab.com/en/h2/maintenance/x-axis-lubrication`:null;case`Clean Nozzle/Hotend`:return r||i?`https://wiki.bambulab.com/en/x1/troubleshooting/nozzle-clog`:a||o?`https://wiki.bambulab.com/en/a1-mini/troubleshooting/nozzle-clog`:u?`https://wiki.bambulab.com/en/h2/maintenance/nozzl-cold-pull-maintenance-and-cleaning`:p?`https://wiki.bambulab.com/en/p2s/maintenance/cold-pull-maintenance-hotend`:`https://wiki.bambulab.com/en/x1/troubleshooting/nozzle-clog`;case`Check Belt Tension`:return r?`https://wiki.bambulab.com/en/x1/maintenance/belt-tension`:i?`https://wiki.bambulab.com/en/p1/maintenance/p1p-maintenance`:a?`https://wiki.bambulab.com/en/a1-mini/maintenance/belt_tension`:o?`https://wiki.bambulab.com/en/a1/maintenance/belt_tension`:s?`https://wiki.bambulab.com/en/h2/maintenance/belt-tension`:c?`https://wiki.bambulab.com/en/h2c/maintenance/belt-tension`:l?`https://wiki.bambulab.com/en/h2s/maintenance/belt-tension`:p?`https://wiki.bambulab.com/en/p2s/maintenance/belt-tension`:`https://wiki.bambulab.com/en/x1/maintenance/belt-tension`;case`Clean Carbon Rods`:return r||i?`https://wiki.bambulab.com/en/general/carbon-rods-clearance`:null;case`Clean Linear Rails`:return a?`https://wiki.bambulab.com/en/a1-mini/maintenance/lubricate-y-axis`:o?`https://wiki.bambulab.com/en/a1/maintenance/lubricate-y-axis`:u?`https://wiki.bambulab.com/en/h2/maintenance/x-axis-lubrication`:null;case`Clean Build Plate`:return`https://wiki.bambulab.com/en/filament-acc/acc/pei-plate-clean-guide`;case`Check PTFE Tube`:return r||i?`https://wiki.bambulab.com/en/x1/maintenance/replace-ptfe-tube`:a||o?`https://wiki.bambulab.com/en/a1-mini/maintenance/ptfe-tube`:s?`https://wiki.bambulab.com/en/h2/maintenance/replace-ptfe-tube-on-h2d-printer`:l?`https://wiki.bambulab.com/en/h2s/maintenance/replace-ptfe-tube-on-h2s-printer`:c?`https://wiki.bambulab.com/en/h2/maintenance/replace-ptfe-tube-on-h2d-printer`:`https://wiki.bambulab.com/en/x1/maintenance/replace-ptfe-tube`;case`Replace HEPA Filter`:case`HEPA Filter`:case`Replace Carbon Filter`:case`Carbon Filter`:return u?`https://wiki.bambulab.com/en/h2/maintenance/replace-smoke-purifier-air-filte`:`https://wiki.bambulab.com/en/x1/maintenance/replace-carbon-filter`;case`Lubricate Left Nozzle Rail`:case`Left Nozzle Rail`:return u?`https://wiki.bambulab.com/en/h2/maintenance/x-axis-lubrication`:null;default:return null}}var W=t(),G={Droplet:v,Flame:F,Ruler:V,Sparkles:x,Square:re,Cable:u,Wrench:R,Calendar:f,Timer:T,Cog:_,Fan:d,Zap:I,Wind:w,Thermometer:C,Layers:L,Box:l,Target:S,RefreshCw:M,Settings:P,Filter:y,CircleDot:B};function K(e){return e&&G[e]||R}function q(e,t,n){if(t===`days`){if(e<1)return n?n(`common.today`):`Today`;if(e===1)return n?n(`maintenance.day`):`1 day`;if(e<7){let t=Math.round(e);return n?n(`maintenance.days`,{count:t}):`${t} days`}if(e<180){let t=Math.round(e/7);return t===1?n?n(`maintenance.week`):`1 week`:n?n(`maintenance.weeks`,{count:t}):`${t} weeks`}let t=Math.round(e/30);return t===1?n?n(`maintenance.month`):`1 month`:n?n(`maintenance.months`,{count:t}):`${t} months`}else{if(e<1)return`${Math.round(e*60)}m`;if(e<24)return`${e<10?e.toFixed(1):Math.round(e)}h`;let t=e/24;if(t<7)return`${t<2?t.toFixed(1):Math.round(t)}d`;let n=t/7;return n<12?`${n<2?n.toFixed(1):Math.round(n)}w`:`${Math.round(n/4)}mo`}}function J(e,t,n){return t===`days`?e===1?n?n(`maintenance.day`):`1 day`:e===7?n?n(`maintenance.week`):`1 week`:e===14?n?n(`maintenance.weeks`,{count:2}):`2 weeks`:e===30?n?n(`maintenance.month`):`1 month`:e===60?n?n(`maintenance.months`,{count:2}):`2 months`:e===90?n?n(`maintenance.months`,{count:3}):`3 months`:e===180?n?n(`maintenance.months`,{count:6}):`6 months`:e===365?n?n(`maintenance.year`):`1 year`:n?n(`maintenance.days`,{count:e}):`${e} days`:`${e}h`}function Y({item:e,onPerform:t,onToggle:n,hasPermission:r,t:i}){let a=K(e.maintenance_type_icon),o=e.interval_type||`hours`,s=(()=>{if(o===`days`){let t=e.days_since_maintenance??0;return Math.max(0,Math.min(100,t/e.interval_hours*100))}return Math.max(0,Math.min(100,(e.interval_hours-e.hours_until_due)/e.interval_hours*100))})(),c=()=>e.enabled?e.is_due?`text-red-700 dark:text-red-400`:e.is_warning?`text-amber-700 dark:text-amber-400`:`text-bambu-green`:`text-bambu-gray`;return(0,W.jsx)(`div`,{className:`rounded-xl border p-4 transition-all ${e.enabled?e.is_due?`bg-red-500/5 border-red-500/20`:e.is_warning?`bg-amber-500/5 border-amber-500/20`:`bg-bambu-dark-secondary border-bambu-dark-tertiary`:`bg-bambu-dark-secondary/50`}`,children:(0,W.jsxs)(`div`,{className:`flex items-start gap-3 max-[550px]:flex-wrap`,children:[(0,W.jsxs)(`div`,{className:`relative p-2.5 rounded-lg shrink-0 ${e.is_due?`bg-red-500/20`:e.is_warning?`bg-amber-500/20`:e.enabled?`bg-bambu-dark`:`bg-bambu-dark/50`}`,children:[(0,W.jsx)(a,{className:`w-5 h-5 ${c()}`}),e.enabled&&(e.is_due||e.is_warning)&&(0,W.jsx)(`span`,{className:`absolute -top-1 -right-1 w-2.5 h-2.5 rounded-full ${e.is_due?`bg-red-500`:`bg-amber-500`} animate-pulse`})]}),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`h3`,{className:`font-medium truncate ${e.enabled?`text-white`:`text-bambu-gray`}`,children:e.maintenance_type_name}),o===`days`&&(0,W.jsx)(`span`,{title:i(`maintenance.timeBasedInterval`),children:(0,W.jsx)(f,{className:`w-3.5 h-3.5 text-bambu-gray shrink-0`})}),(()=>{let t=e.maintenance_type_wiki_url||U(e.maintenance_type_name,e.printer_model);return t?(0,W.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-gray hover:text-bambu-green transition-colors shrink-0`,title:i(`maintenance.viewDocumentation`),onClick:e=>e.stopPropagation(),children:(0,W.jsx)(A,{className:`w-3.5 h-3.5`})}):null})()]}),(0,W.jsx)(`div`,{className:`mt-2 mb-1.5`,children:(0,W.jsx)(`div`,{className:`w-full h-1.5 bg-bambu-dark rounded-full overflow-hidden`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500 ${e.enabled?e.is_due?`bg-red-500`:e.is_warning?`bg-amber-500`:`bg-bambu-green`:`bg-bambu-gray/30`}`,style:{width:`${s}%`}})})}),(0,W.jsxs)(`div`,{className:`text-xs flex items-center gap-1 ${c()}`,children:[e.is_due&&(0,W.jsx)(E,{className:`w-3 h-3`}),e.is_warning&&!e.is_due&&(0,W.jsx)(N,{className:`w-3 h-3`}),!e.is_due&&!e.is_warning&&e.enabled&&(0,W.jsx)(p,{className:`w-3 h-3`}),(()=>{if(!e.enabled)return i(`common.disabled`);if(o===`days`){let t=e.days_until_due??0;return e.is_due?i(`maintenance.overdueBy`,{duration:q(Math.abs(t),`days`,i)}):e.is_warning?i(`maintenance.dueIn`,{duration:q(t,`days`,i)}):i(`maintenance.timeLeft`,{duration:q(t,`days`,i)})}else return e.is_due?i(`maintenance.overdueBy`,{duration:q(Math.abs(e.hours_until_due),`hours`,i)}):e.is_warning?i(`maintenance.dueIn`,{duration:q(e.hours_until_due,`hours`,i)}):i(`maintenance.timeLeft`,{duration:q(e.hours_until_due,`hours`,i)})})()]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 max-[550px]:w-full max-[550px]:justify-end max-[550px]:mt-1`,children:[(0,W.jsx)(`span`,{title:r(`maintenance:update`)?void 0:i(`maintenance.noPermissionUpdate`),children:(0,W.jsx)(z,{checked:e.enabled,onChange:t=>n(e.id,t),disabled:!r(`maintenance:update`)})}),(0,W.jsxs)(k,{size:`sm`,variant:e.is_due?`primary`:`secondary`,onClick:()=>t(e.id),disabled:!e.enabled||!r(`maintenance:update`),title:r(`maintenance:update`)?void 0:i(`maintenance.noPermissionPerform`),className:`!px-3`,children:[(0,W.jsx)(j,{className:`w-3.5 h-3.5`}),i(`common.reset`)]})]})]})})}function X({overview:e,onPerform:t,onToggle:n,onSetHours:r,hasPermission:i,t:a}){let[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(e.total_print_hours.toFixed(1)),f=[...e.maintenance_items].sort((e,t)=>e.is_due&&!t.is_due?-1:!e.is_due&&t.is_due?1:e.is_warning&&!t.is_warning?-1:!e.is_warning&&t.is_warning?1:e.maintenance_type_id-t.maintenance_type_id),g=f.find(e=>e.enabled&&(e.is_due||e.is_warning)),_=()=>{let t=parseFloat(u);!isNaN(t)&&t>=0&&(r(e.printer_id,t),l(!1))};return(0,W.jsxs)(O,{className:`overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`p-5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,W.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:e.printer_name}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.due_count>0&&(0,W.jsxs)(`span`,{className:`px-2.5 py-1 bg-red-100 text-red-700 dark:bg-red-500/20 dark:text-red-400 text-xs font-medium rounded-full flex items-center gap-1.5`,children:[(0,W.jsx)(E,{className:`w-3 h-3`}),a(`maintenance.overdueCount`,{count:e.due_count})]}),e.warning_count>0&&(0,W.jsxs)(`span`,{className:`px-2.5 py-1 bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400 text-xs font-medium rounded-full flex items-center gap-1.5`,children:[(0,W.jsx)(N,{className:`w-3 h-3`}),a(`maintenance.dueSoonCount`,{count:e.warning_count})]}),e.due_count===0&&e.warning_count===0&&(0,W.jsxs)(`span`,{className:`px-2.5 py-1 bg-bambu-green/20 text-bambu-green text-xs font-medium rounded-full flex items-center gap-1.5`,children:[(0,W.jsx)(p,{className:`w-3 h-3`}),a(`maintenance.allGood`)]})]})]}),(0,W.jsxs)(`button`,{onClick:()=>s(!o),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm text-bambu-gray hover:text-white hover:bg-bambu-dark rounded-lg transition-colors`,children:[o?(0,W.jsx)(h,{className:`w-4 h-4`}):(0,W.jsx)(m,{className:`w-4 h-4`}),a(o?`common.collapse`:`common.expand`)]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-6 mt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`p-2 bg-bambu-dark/50 rounded-lg`,children:(0,W.jsx)(T,{className:`w-4 h-4 text-bambu-gray`})}),c?(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`number`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_(),e.key===`Escape`&&l(!1)},className:`w-24 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm`,min:`0`,step:`1`,autoFocus:!0}),(0,W.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:a(`common.hours`)}),(0,W.jsx)(k,{size:`sm`,onClick:_,children:a(`common.save`)}),(0,W.jsx)(k,{size:`sm`,variant:`secondary`,onClick:()=>l(!1),children:a(`common.cancel`)})]}):(0,W.jsxs)(`button`,{onClick:()=>{i(`maintenance:update`)&&(d(Math.round(e.total_print_hours).toString()),l(!0))},className:`group ${i(`maintenance:update`)?``:`cursor-not-allowed opacity-60`}`,title:i(`maintenance:update`)?void 0:a(`maintenance.noPermissionEditHours`),children:[(0,W.jsxs)(`div`,{className:`text-sm font-medium text-white ${i(`maintenance:update`)?`group-hover:text-bambu-green`:``} transition-colors flex items-center gap-1`,children:[Math.round(e.total_print_hours),` `,a(`common.hours`),(0,W.jsx)(b,{className:`w-3 h-3 text-bambu-gray ${i(`maintenance:update`)?`group-hover:text-bambu-green`:``}`})]}),(0,W.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:a(`maintenance.totalPrintTime`)})]})]}),(0,W.jsx)(`div`,{className:`w-px h-10 bg-bambu-dark-tertiary`}),g&&(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`p-2 rounded-lg ${g.is_due?`bg-red-500/20`:`bg-amber-500/20`}`,children:(0,W.jsx)(K(g.maintenance_type_icon),{className:`w-4 h-4 ${g.is_due?`text-red-600 dark:text-red-400`:`text-amber-600 dark:text-amber-400`}`})}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm font-medium ${g.is_due?`text-red-700 dark:text-red-400`:`text-amber-700 dark:text-amber-400`}`,children:g.maintenance_type_name}),(0,W.jsx)(`div`,{className:`text-xs ${g.is_due?`text-red-700/80 dark:text-red-400/70`:`text-amber-700/80 dark:text-amber-400/70`}`,children:g.is_due?a(`common.overdue`):a(`maintenance.dueSoon`)})]})]})]})]}),o&&(0,W.jsx)(D,{className:`pt-0 border-t border-bambu-dark-tertiary`,children:(0,W.jsx)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-3 pt-4`,children:f.map(e=>(0,W.jsx)(Y,{item:e,onPerform:t,onToggle:n,hasPermission:i,t:a},e.id))})})]})}function Z({overview:e,types:t,onUpdateInterval:n,onAddType:r,onUpdateType:i,onDeleteType:a,onRestoreDefaults:o,isRestoringDefaults:s,onAssignType:c,onRemoveItem:l,hasPermission:u,t:d}){let[p,h]=(0,H.useState)(null),[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(`hours`),[ee,x]=(0,H.useState)(!1),[S,C]=(0,H.useState)(``),[w,E]=(0,H.useState)(`100`),[A,j]=(0,H.useState)(`hours`),[M,re]=(0,H.useState)(`Wrench`),[P,F]=(0,H.useState)(``),[I,L]=(0,H.useState)(new Set),[R,oe]=(0,H.useState)(null),[z,B]=(0,H.useState)(null),V=(0,H.useMemo)(()=>e?e.map(e=>({id:e.printer_id,name:e.printer_name})):[],[e]),U=t=>e?e.filter(e=>e.maintenance_items.some(e=>e.maintenance_type_id===t)).map(e=>({printerId:e.printer_id,printerName:e.printer_name,itemId:e.maintenance_items.find(e=>e.maintenance_type_id===t)?.id})):[],q=t=>{if(!e)return[];let n=new Set(U(t).map(e=>e.printerId));return V.filter(e=>!n.has(e.id))},[Y,X]=(0,H.useState)(null),[Z,Q]=(0,H.useState)(``),[$,se]=(0,H.useState)(``),[ce,le]=(0,H.useState)(`hours`),[ue,de]=(0,H.useState)(`Wrench`),[fe,pe]=(0,H.useState)(``),me=e=>{X(e),Q(e.name),se(e.default_interval_hours.toString()),le(e.interval_type||`hours`),de(e.icon||`Wrench`),pe(e.wiki_url||``)},he=()=>{Y&&Z.trim()&&parseFloat($)>0&&(i(Y.id,{name:Z.trim(),default_interval_hours:parseFloat($),interval_type:ce,icon:ue,wiki_url:fe.trim()||null}),X(null))},ge=(e,t,r)=>{let i=parseFloat(g);!isNaN(i)&&i>0&&n(e,{custom_interval_hours:Math.abs(i-t)<.01?null:i,custom_interval_type:v===r?null:v}),h(null)},_e=e=>{e.preventDefault(),S.trim()&&parseFloat(w)>0&&I.size>0&&(r({name:S.trim(),default_interval_hours:parseFloat(w),interval_type:A,icon:M,wiki_url:P.trim()||null},Array.from(I)),C(``),E(`100`),j(`hours`),F(``),L(new Set),x(!1))},ve=e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ye=e?.map(e=>({printerId:e.printer_id,printerName:e.printer_name,items:e.maintenance_items.sort((e,t)=>e.maintenance_type_id-t.maintenance_type_id)})).sort((e,t)=>e.printerName.localeCompare(t.printerName))||[],be=t.filter(e=>e.is_system),xe=t.filter(e=>!e.is_system);return(0,W.jsxs)(`div`,{className:`space-y-8`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:d(`maintenance.maintenanceTypes`)}),(0,W.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:d(`maintenance.maintenanceTypesDescription`)})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(k,{variant:`secondary`,onClick:o,disabled:!u(`maintenance:delete`)||s,title:u(`maintenance:delete`)?void 0:d(`maintenance.noPermissionDeleteTypes`),children:d(`maintenance.restoreDefaults`)}),(0,W.jsxs)(k,{onClick:()=>x(!ee),disabled:!u(`maintenance:create`),title:u(`maintenance:create`)?void 0:d(`maintenance.noPermissionEditTypes`),children:[(0,W.jsx)(ie,{className:`w-4 h-4`}),d(`maintenance.addCustomType`)]})]})]}),ee&&(0,W.jsx)(O,{className:`mb-6`,children:(0,W.jsx)(D,{className:`py-4`,children:(0,W.jsxs)(`form`,{onSubmit:_e,children:[(0,W.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,W.jsxs)(`div`,{className:`lg:col-span-2`,children:[(0,W.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1.5`,children:d(`common.name`)}),(0,W.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,placeholder:d(`maintenance.exampleName`),autoFocus:!0})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1.5`,children:d(`maintenance.intervalType`)}),(0,W.jsxs)(`select`,{value:A,onChange:e=>{j(e.target.value),e.target.value===`days`?E(`30`):E(`100`)},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,W.jsx)(`option`,{value:`hours`,children:d(`maintenance.printHours`)}),(0,W.jsx)(`option`,{value:`days`,children:d(`maintenance.calendarDays`)})]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1.5`,children:d(`maintenance.intervalValue`,{type:A===`days`?d(`maintenance.calendarDays`).toLowerCase():d(`common.hours`)})}),(0,W.jsx)(`input`,{type:`number`,value:w,onChange:e=>E(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,min:`1`})]})]}),(0,W.jsx)(`div`,{className:`mt-4 flex items-end justify-between`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1.5`,children:d(`maintenance.icon`)}),(0,W.jsx)(`div`,{className:`flex gap-1`,children:Object.keys(G).map(e=>{let t=G[e];return(0,W.jsx)(`button`,{type:`button`,onClick:()=>re(e),className:`p-2 rounded-lg transition-colors ${M===e?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary`}`,children:(0,W.jsx)(t,{className:`w-4 h-4`})},e)})})]})}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1.5`,children:d(`maintenance.documentationLink`)}),(0,W.jsx)(`input`,{type:`url`,value:P,onChange:e=>F(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,placeholder:`https://wiki.bambulab.com/...`})]}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1.5`,children:d(`maintenance.assignToPrinters`)}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:V.map(e=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>ve(e.id),className:`px-3 py-1.5 rounded-lg text-sm transition-colors ${I.has(e.id)?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary`}`,children:e.name},e.id))}),I.size===0&&(0,W.jsx)(`p`,{className:`text-xs text-orange-700 dark:text-orange-400 mt-1`,children:d(`maintenance.selectAtLeastOnePrinter`)})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,W.jsx)(k,{type:`button`,variant:`secondary`,onClick:()=>{x(!1),L(new Set)},children:d(`common.cancel`)}),(0,W.jsx)(k,{type:`submit`,disabled:!S.trim()||I.size===0,children:d(`maintenance.addType`)})]})]})})}),(0,W.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:[be.map(e=>{let t=K(e.icon),n=e.interval_type||`hours`;return(0,W.jsx)(`div`,{className:`bg-bambu-dark-secondary rounded-xl p-4 border border-bambu-dark-tertiary`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`p-2.5 bg-bambu-dark rounded-lg`,children:(0,W.jsx)(t,{className:`w-5 h-5 text-bambu-gray`})}),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-white truncate`,children:e.name}),(0,W.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-0.5 flex items-center gap-1`,children:[n===`days`?(0,W.jsx)(f,{className:`w-3 h-3`}):(0,W.jsx)(T,{className:`w-3 h-3`}),J(e.default_interval_hours,n,d)]})]}),(0,W.jsx)(`button`,{onClick:()=>{u(`maintenance:delete`)&&B(e)},disabled:!u(`maintenance:delete`),title:u(`maintenance:delete`)?void 0:d(`maintenance.noPermissionDeleteTypes`),className:`p-2 rounded-lg hover:bg-bambu-dark text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors ${u(`maintenance:delete`)?``:`opacity-50 cursor-not-allowed`}`,children:(0,W.jsx)(te,{className:`w-4 h-4`})})]})},e.id)}),xe.map(e=>{let t=K(e.icon),n=e.interval_type||`hours`;if(Y?.id===e.id)return(0,W.jsx)(`div`,{className:`bg-bambu-dark-secondary rounded-xl p-4 border border-bambu-green`,children:(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(`input`,{type:`text`,value:Z,onChange:e=>Q(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,placeholder:d(`common.name`),autoFocus:!0}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsxs)(`select`,{value:ce,onChange:e=>le(e.target.value),className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,W.jsx)(`option`,{value:`hours`,children:d(`maintenance.printHours`)}),(0,W.jsx)(`option`,{value:`days`,children:d(`maintenance.calendarDays`)})]}),(0,W.jsx)(`input`,{type:`number`,value:$,onChange:e=>se(e.target.value),className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,min:`1`})]}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.keys(G).map(e=>{let t=G[e];return(0,W.jsx)(`button`,{type:`button`,onClick:()=>de(e),className:`p-1.5 rounded transition-colors ${ue===e?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,children:(0,W.jsx)(t,{className:`w-3.5 h-3.5`})},e)})}),(0,W.jsx)(`input`,{type:`url`,value:fe,onChange:e=>pe(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,placeholder:d(`maintenance.documentationLink`)}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(k,{size:`sm`,onClick:he,disabled:!Z.trim(),children:d(`common.save`)}),(0,W.jsx)(k,{size:`sm`,variant:`secondary`,onClick:()=>X(null),children:d(`common.cancel`)})]})]})},e.id);let r=U(e.id),i=q(e.id),o=R===e.id;return(0,W.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl p-4 border border-bambu-green/30`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`p-2.5 bg-bambu-green/20 rounded-lg`,children:(0,W.jsx)(t,{className:`w-5 h-5 text-bambu-green`})}),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:e.name}),(0,W.jsx)(`span`,{className:`px-1.5 py-0.5 bg-bambu-green/20 text-bambu-green text-[10px] font-medium rounded`,children:d(`maintenance.custom`)})]}),(0,W.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-0.5 flex items-center gap-1`,children:[n===`days`?(0,W.jsx)(f,{className:`w-3 h-3`}):(0,W.jsx)(T,{className:`w-3 h-3`}),J(e.default_interval_hours,n,d)]})]}),(0,W.jsxs)(`button`,{onClick:()=>oe(o?null:e.id),className:`px-2 py-1 rounded-lg border transition-colors flex items-center gap-1 ${r.length>0?`border-bambu-green/50 bg-bambu-green/10 text-bambu-green hover:bg-bambu-green/20`:`border-orange-300 bg-orange-50 text-orange-700 hover:bg-orange-100 dark:border-orange-400/50 dark:bg-orange-400/10 dark:text-orange-400 dark:hover:bg-orange-400/20`}`,title:d(`maintenance.printersAssignedClick`,{count:r.length}),children:[(0,W.jsx)(ne,{className:`w-3 h-3`}),(0,W.jsx)(`span`,{className:`text-xs font-medium`,children:r.length}),(0,W.jsx)(m,{className:`w-3 h-3 transition-transform ${o?`rotate-180`:``}`})]}),(0,W.jsx)(`button`,{onClick:()=>me(e),disabled:!u(`maintenance:update`),title:u(`maintenance:update`)?void 0:d(`maintenance.noPermissionEditTypes`),className:`p-2 rounded-lg hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors ${u(`maintenance:update`)?``:`opacity-50 cursor-not-allowed`}`,children:(0,W.jsx)(b,{className:`w-4 h-4`})}),(0,W.jsx)(`button`,{onClick:()=>{confirm(d(`maintenance.deleteTypeConfirm`,{name:e.name}))&&a(e.id)},disabled:!u(`maintenance:delete`),title:u(`maintenance:delete`)?void 0:d(`maintenance.noPermissionDeleteTypes`),className:`p-2 rounded-lg hover:bg-bambu-dark text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors ${u(`maintenance:delete`)?``:`opacity-50 cursor-not-allowed`}`,children:(0,W.jsx)(te,{className:`w-4 h-4`})})]}),o&&(0,W.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-bambu-dark-tertiary`,children:[(0,W.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:d(`maintenance.assignedToPrinters`)}),r.length===0?(0,W.jsx)(`p`,{className:`text-xs text-orange-700 dark:text-orange-400`,children:d(`maintenance.noPrintersAssigned`)}):(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:r.map(e=>(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 bg-bambu-dark rounded text-xs text-white`,children:[e.printerName,(0,W.jsx)(`button`,{onClick:()=>e.itemId&&l(e.itemId),disabled:!u(`maintenance:delete`),title:u(`maintenance:delete`)?d(`maintenance.removeFromPrinter`):d(`maintenance.noPermissionRemovePrinter`),className:`ml-1 ${u(`maintenance:delete`)?`hover:text-red-600 dark:hover:text-red-400`:`opacity-50 cursor-not-allowed`}`,children:`×`})]},e.printerId))}),i.length>0&&(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,W.jsx)(`span`,{className:`text-xs text-bambu-gray mr-1`,children:d(`maintenance.addPrinterShort`)}),i.map(t=>(0,W.jsxs)(`button`,{onClick:()=>c(t.id,e.id),disabled:!u(`maintenance:create`),title:u(`maintenance:create`)?void 0:d(`maintenance.noPermissionAssignPrinter`),className:`px-2 py-1 bg-bambu-dark rounded text-xs transition-colors ${u(`maintenance:create`)?`hover:bg-bambu-green/20 text-bambu-gray hover:text-bambu-green`:`opacity-50 cursor-not-allowed text-bambu-gray`}`,children:[`+ `,t.name]},t.id))]})]})]},e.id)})]})]}),ye.length>0&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`mb-4`,children:[(0,W.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:d(`maintenance.intervalOverrides`)}),(0,W.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:d(`maintenance.intervalOverridesDescription`)})]}),(0,W.jsx)(`div`,{className:`space-y-4`,children:ye.map(e=>(0,W.jsx)(O,{children:(0,W.jsxs)(D,{className:`py-4`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-medium text-white mb-3`,children:e.printerName}),(0,W.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2`,children:e.items.map(e=>{let n=K(e.maintenance_type_icon),r=t.find(t=>t.id===e.maintenance_type_id),i=r?.default_interval_hours||e.interval_hours,a=r?.interval_type||`hours`,o=e.interval_type||`hours`,s=p===e.id;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 p-2.5 bg-bambu-dark rounded-lg`,children:[(0,W.jsx)(n,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,W.jsx)(`span`,{className:`text-xs text-bambu-gray flex-1 truncate`,children:e.maintenance_type_name}),s?(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v===`days`?(0,W.jsx)(f,{className:`w-3.5 h-3.5 text-bambu-gray shrink-0`}):(0,W.jsx)(T,{className:`w-3.5 h-3.5 text-bambu-gray shrink-0`}),(0,W.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),className:`px-1.5 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs`,children:[(0,W.jsx)(`option`,{value:`hours`,children:d(`maintenance.printHours`)}),(0,W.jsx)(`option`,{value:`days`,children:d(`maintenance.calendarDays`)})]}),(0,W.jsx)(`input`,{type:`number`,value:g,onChange:e=>_(e.target.value),onKeyDown:t=>{t.key===`Enter`&&ge(e.id,i,a),t.key===`Escape`&&h(null)},className:`w-16 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs`,min:`1`}),(0,W.jsx)(k,{size:`sm`,onClick:()=>ge(e.id,i,a),children:`OK`})]}):(0,W.jsxs)(`button`,{onClick:()=>{u(`maintenance:update`)&&(h(e.id),_(e.interval_hours.toString()),y(o))},disabled:!u(`maintenance:update`),title:u(`maintenance:update`)?void 0:d(`maintenance.noPermissionEditIntervals`),className:`px-2 py-1 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-xs font-medium text-white transition-colors flex items-center gap-1 ${u(`maintenance:update`)?`hover:bg-bambu-dark-secondary hover:border-bambu-green`:`opacity-50 cursor-not-allowed`}`,children:[o===`days`?(0,W.jsx)(f,{className:`w-3 h-3`}):(0,W.jsx)(T,{className:`w-3 h-3`}),J(e.interval_hours,o,d),(0,W.jsx)(b,{className:`w-3 h-3 text-bambu-gray`})]})]},e.id)})})]})},e.printerId))})]}),ye.length===0&&(0,W.jsx)(O,{children:(0,W.jsxs)(D,{className:`text-center py-12`,children:[(0,W.jsx)(N,{className:`w-12 h-12 mx-auto mb-4 text-bambu-gray/30`}),(0,W.jsx)(`p`,{className:`text-bambu-gray`,children:d(`common.noPrinters`)}),(0,W.jsx)(`p`,{className:`text-sm text-bambu-gray/70 mt-1`,children:d(`maintenance.intervalOverridesDescription`)})]})}),z&&(0,W.jsx)(ae,{title:d(`maintenance.deleteSystemTypeTitle`),message:d(`maintenance.deleteSystemTypeMessage`,{name:z.name}),confirmText:d(`common.delete`),cancelText:d(`common.cancel`),variant:`danger`,cancelVariant:`primary`,cardClassName:`bg-red-950/70 border border-red-800/70`,onConfirm:()=>{a(z.id),B(null)},onCancel:()=>B(null)})]})}function Q(){let{t:e}=i(),t=a(),{showToast:n}=g(),{hasPermission:c}=oe(),[l,u]=(0,H.useState)(`status`),{data:d,isLoading:f}=o({queryKey:[`maintenanceOverview`],queryFn:r.getMaintenanceOverview}),{data:p}=o({queryKey:[`maintenanceTypes`],queryFn:r.getMaintenanceTypes}),m=s({mutationFn:({id:e,notes:t})=>r.performMaintenance(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`maintenanceOverview`]}),t.invalidateQueries({queryKey:[`maintenanceSummary`]}),n(e(`maintenance.maintenanceComplete`))},onError:e=>{n(e.message,`error`)}}),h=s({mutationFn:({id:e,data:t})=>r.updateMaintenanceItem(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`maintenanceOverview`]})},onError:e=>{n(e.message,`error`)}}),_=s({mutationFn:({id:e,data:t})=>r.updateMaintenanceType(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`maintenanceTypes`]}),t.invalidateQueries({queryKey:[`maintenanceOverview`]}),n(e(`maintenance.typeUpdated`))},onError:e=>{n(e.message,`error`)}}),v=s({mutationFn:r.deleteMaintenanceType,onSuccess:()=>{t.invalidateQueries({queryKey:[`maintenanceTypes`]}),t.invalidateQueries({queryKey:[`maintenanceOverview`]}),n(e(`maintenance.typeDeleted`))},onError:e=>{n(e.message,`error`)}}),y=s({mutationFn:r.restoreDefaultMaintenanceTypes,onSuccess:r=>{t.invalidateQueries({queryKey:[`maintenanceTypes`]}),t.invalidateQueries({queryKey:[`maintenanceOverview`]}),n(e(`maintenance.defaultsRestored`,{count:r.restored}))},onError:e=>{n(e.message,`error`)}}),b=s({mutationFn:({printerId:e,hours:t})=>r.setPrinterHours(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`maintenanceOverview`]}),t.invalidateQueries({queryKey:[`maintenanceSummary`]}),n(e(`maintenance.printHoursUpdated`))},onError:e=>{n(e.message,`error`)}}),x=s({mutationFn:({printerId:e,typeId:t})=>r.assignMaintenanceType(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`maintenanceOverview`]}),n(e(`maintenance.printerAssigned`))},onError:e=>{n(e.message,`error`)}}),S=s({mutationFn:r.removeMaintenanceItem,onSuccess:()=>{t.invalidateQueries({queryKey:[`maintenanceOverview`]}),n(e(`maintenance.printerRemoved`))},onError:e=>{n(e.message,`error`)}}),C=e=>{m.mutate({id:e})},w=(e,t)=>{h.mutate({id:e,data:{enabled:t}})},T=(e,t)=>{b.mutate({printerId:e,hours:t})};if(f)return(0,W.jsx)(`div`,{className:`p-4 md:p-8 flex justify-center`,children:(0,W.jsx)(ee,{className:`w-8 h-8 text-bambu-green animate-spin`})});let E=d?.reduce((e,t)=>e+t.due_count,0)||0,k=d?.reduce((e,t)=>e+t.warning_count,0)||0;return(0,W.jsxs)(`div`,{className:`p-4 md:p-8`,children:[(0,W.jsxs)(`div`,{className:`mb-6`,children:[(0,W.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,W.jsx)(R,{className:`w-7 h-7 text-bambu-green`}),e(`maintenance.title`)]}),(0,W.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:l===`status`?(0,W.jsxs)(W.Fragment,{children:[E>0&&(0,W.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:e(`maintenance.dueCount`,{count:E})}),E>0&&k>0&&` · `,k>0&&(0,W.jsx)(`span`,{className:`text-amber-700 dark:text-amber-400`,children:e(`maintenance.warningCount`,{count:k})}),E===0&&k===0&&(0,W.jsx)(`span`,{className:`text-bambu-green`,children:e(`maintenance.allOk`)})]}):e(`maintenance.configureSettings`)})]}),(0,W.jsxs)(`div`,{className:`flex gap-1 mb-6 border-b border-bambu-dark-tertiary`,children:[(0,W.jsx)(`button`,{onClick:()=>u(`status`),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${l===`status`?`text-bambu-green border-bambu-green`:`text-bambu-gray border-transparent hover:text-white`}`,children:e(`maintenance.statusTab`)}),(0,W.jsx)(`button`,{onClick:()=>u(`settings`),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${l===`settings`?`text-bambu-green border-bambu-green`:`text-bambu-gray border-transparent hover:text-white`}`,children:e(`maintenance.settingsTab`)})]}),l===`status`?(0,W.jsx)(`div`,{className:`space-y-6`,children:d&&d.length>0?[...d].sort((e,t)=>{let n=e.due_count*10+e.warning_count,r=t.due_count*10+t.warning_count;return n===r?e.printer_name.localeCompare(t.printer_name):r-n}).map(t=>(0,W.jsx)(X,{overview:t,onPerform:C,onToggle:w,onSetHours:T,hasPermission:c,t:e},t.printer_id)):(0,W.jsx)(O,{children:(0,W.jsxs)(D,{className:`text-center py-16`,children:[(0,W.jsx)(R,{className:`w-16 h-16 mx-auto mb-4 text-bambu-gray/30`}),(0,W.jsx)(`p`,{className:`text-lg font-medium text-white mb-2`,children:e(`common.noPrinters`)}),(0,W.jsx)(`p`,{className:`text-bambu-gray`,children:e(`maintenance.configureSettings`)})]})})}):(0,W.jsx)(Z,{overview:d,types:p||[],onUpdateInterval:(e,t)=>h.mutate({id:e,data:t}),onAddType:async(i,a)=>{let o=await r.createMaintenanceType(i);for(let e of a)await r.assignMaintenanceType(e,o.id);t.invalidateQueries({queryKey:[`maintenanceTypes`]}),t.invalidateQueries({queryKey:[`maintenanceOverview`]}),n(e(`maintenance.typeUpdated`))},onUpdateType:(e,t)=>_.mutate({id:e,data:t}),onDeleteType:e=>v.mutate(e),onRestoreDefaults:()=>y.mutate(),isRestoringDefaults:y.isPending,onAssignType:(e,t)=>x.mutate({printerId:e,typeId:t}),onRemoveItem:e=>S.mutate(e),hasPermission:c,t:e})]})}export{Q as MaintenancePage}; \ No newline at end of file diff --git a/static/assets/ModelSourcesPage-COtV7L7T.js b/static/assets/ModelSourcesPage-COtV7L7T.js new file mode 100644 index 000000000..f3265f083 --- /dev/null +++ b/static/assets/ModelSourcesPage-COtV7L7T.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,t as i,w as a}from"./client-DnySrlFv.js";import{n as o}from"./QueryClientProvider-Ce8_sN3w.js";import{t as s}from"./useQuery-BBCjCezC.js";import{t as c}from"./useMutation-B-Tr2hIP.js";import{t as l}from"./createLucideIcon-DvBYJlWL.js";import{t as u}from"./arrow-left-0Q6F2rjC.js";import{t as d}from"./arrow-right-DedpIMhP.js";import{t as f}from"./box-DAdKb9s5.js";import{t as p}from"./check-Ck0cMLU4.js";import{r as m}from"./info-ROUoQhJR.js";import{n as h}from"./ToastContext-BRX0SW3C.js";import{t as g}from"./cog-Dol1I0kq.js";import{t as _}from"./SliceModal-2Iz_Qz3v.js";import{t as v}from"./loader-circle-BEmFtawu.js";import{t as y}from"./search-0n0CBc74.js";import{t as b}from"./x-DR-Trv6U.js";import{i as x,n as S,t as C}from"./Card-Bzc64K35.js";import{t as w}from"./Button-DDr6eAFy.js";import{At as T,Cn as E,Mn as D,Rn as O,Vn as k,Vt as A,Wn as j,_t as M,hn as N,jn as ee,vn as P,wn as te,yt as ne}from"./index-CovRLYqQ.js";import{a as re,o as ie}from"./slicer-DgCA7cW6.js";import{t as ae}from"./purify.es-F_7NWVtX.js";import{t as oe}from"./libraryFiles-B0B1SFfn.js";var F=l(`images`,[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]),I=l(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),L=e(n(),1),R=t(),z=new Set([`manyfold_not_configured`,`manyfold_credentials`,`manyfold_scope`,`manyfold_rate_limited`,`manyfold_unreachable`,`manyfold_forbidden`,`manyfold_not_found`,`manyfold_too_large`,`manyfold_not_importable`,`manyfold_bad_url`,`manyfold_secret_required`,`manyfold_failed`]);function B(e,t){return e instanceof i&&e.code&&z.has(e.code)?t(`manyfold.errors.${e.code}`):e instanceof Error&&e.message?e.message:t(`manyfold.errors.manyfold_failed`)}function V(e){return((e.split(`/`)[1]??``).replace(/^x-/,``).split(/[+.;]/)[0]||`?`).toUpperCase()}function H(e,t=0,n=[]){n.push({folder:e,depth:t});for(let r of e.children??[])H(r,t+1,n);return n}function U({modelId:e,className:t}){let{data:n,isLoading:i}=s({queryKey:[`manyfold-preview`,e],queryFn:()=>r.getManyfoldPreview(e),staleTime:1/0,retry:!1}),[a,o]=(0,L.useState)(null);return(0,L.useEffect)(()=>{if(!n){o(null);return}let e=URL.createObjectURL(n);return o(e),()=>URL.revokeObjectURL(e)},[n]),(0,R.jsx)(`div`,{className:`flex items-center justify-center bg-bambu-dark overflow-hidden ${t??``}`,children:a?(0,R.jsx)(`img`,{src:a,alt:``,className:`w-full h-full object-contain`}):i?(0,R.jsx)(v,{className:`w-6 h-6 text-bambu-gray animate-spin`}):(0,R.jsx)(f,{className:`w-10 h-10 text-bambu-gray/50`,"aria-hidden":!0})})}function W({onDone:e}){let{t}=a(),{showToast:n}=h(),i=o(),l=s({queryKey:[`manyfold-config`],queryFn:()=>r.getManyfoldConfig()}),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(``),[m,g]=(0,L.useState)(``),[_,y]=(0,L.useState)(null),[b,T]=(0,L.useState)(!1);(0,L.useEffect)(()=>{l.data&&(d(l.data.url),p(l.data.client_id))},[l.data]);let E=l.data?.has_client_secret??!1,D={url:u.trim(),client_id:f.trim(),client_secret:m.trim()||void 0},O=!!D.url&&!!D.client_id&&(!!D.client_secret||E),k=()=>{i.invalidateQueries({queryKey:[`manyfold-config`]}),i.invalidateQueries({queryKey:[`manyfold-status`]}),i.invalidateQueries({queryKey:[`manyfold-models`]}),i.invalidateQueries({queryKey:[`manyfold-model`]}),i.invalidateQueries({queryKey:[`manyfold-preview`]})},j=c({mutationFn:()=>r.testManyfoldConfig(D),onSuccess:e=>y({ok:!0,text:t(`manyfold.testOk`,{count:e.model_count})}),onError:e=>y({ok:!1,text:B(e,t)})}),N=c({mutationFn:()=>r.updateManyfoldConfig(D),onSuccess:()=>{g(``),k(),n(t(`settings.toast.settingsSaved`),`success`),e?.()},onError:e=>n(B(e,t),`error`)}),ee=c({mutationFn:()=>r.deleteManyfoldConfig(),onSuccess:()=>{T(!1),d(``),p(``),g(``),y(null),k(),n(t(`manyfold.disconnected`),`success`)},onError:e=>{T(!1),n(B(e,t),`error`)}}),P=`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`;return(0,R.jsxs)(C,{children:[(0,R.jsx)(x,{children:(0,R.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,R.jsx)(A,{className:`w-5 h-5 text-bambu-green`}),t(`manyfold.connectionTitle`)]})}),(0,R.jsxs)(S,{className:`space-y-4`,children:[(0,R.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t(`manyfold.connectionHelp`)}),(0,R.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),O&&N.mutate()},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`manyfold-url`,className:`block text-sm text-bambu-gray mb-1`,children:t(`manyfold.url`)}),(0,R.jsx)(`input`,{id:`manyfold-url`,type:`url`,value:u,onChange:e=>{d(e.target.value),y(null)},placeholder:t(`manyfold.urlPlaceholder`),className:P,autoComplete:`off`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`manyfold-client-id`,className:`block text-sm text-bambu-gray mb-1`,children:t(`manyfold.clientId`)}),(0,R.jsx)(`input`,{id:`manyfold-client-id`,type:`text`,value:f,onChange:e=>{p(e.target.value),y(null)},className:P,autoComplete:`off`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`manyfold-client-secret`,className:`block text-sm text-bambu-gray mb-1`,children:t(`manyfold.clientSecret`)}),(0,R.jsx)(`input`,{id:`manyfold-client-secret`,type:`password`,value:m,onChange:e=>{g(e.target.value),y(null)},placeholder:E?t(`manyfold.clientSecretStored`):``,className:P,autoComplete:`new-password`})]}),_&&(0,R.jsx)(`p`,{role:`status`,className:`text-sm ${_.ok?`text-bambu-green`:`text-red-400`}`,children:_.text}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(w,{type:`submit`,disabled:!O||N.isPending,children:[N.isPending?(0,R.jsx)(v,{className:`w-4 h-4 animate-spin`}):null,t(`common.save`)]}),(0,R.jsxs)(w,{type:`button`,variant:`secondary`,disabled:!O||j.isPending,onClick:()=>j.mutate(),children:[j.isPending?(0,R.jsx)(v,{className:`w-4 h-4 animate-spin`}):null,t(`manyfold.test`)]}),l.data?.configured&&(0,R.jsx)(w,{type:`button`,variant:`danger`,onClick:()=>T(!0),children:t(`manyfold.disconnect`)}),e&&l.data?.configured&&(0,R.jsx)(w,{type:`button`,variant:`ghost`,onClick:e,children:t(`common.cancel`)})]})]})]}),b&&(0,R.jsx)(M,{title:t(`manyfold.disconnectTitle`),message:t(`manyfold.disconnectBody`),confirmText:t(`manyfold.disconnect`),variant:`danger`,isLoading:ee.isPending,onCancel:()=>T(!1),onConfirm:()=>ee.mutate()})]})}function se({value:e,onChange:t,disabled:n}){let{t:i}=a(),o=(s({queryKey:[`library-folders`],queryFn:()=>r.getLibraryFolders()}).data??[]).filter(e=>!(e.is_external&&e.external_readonly)).flatMap(e=>H(e));return(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[i(`manyfold.importTo`),(0,R.jsxs)(`select`,{value:e??``,disabled:n,onChange:e=>t(e.target.value?Number(e.target.value):null),className:`px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm`,children:[(0,R.jsx)(`option`,{value:``,children:i(`manyfold.folderAuto`)}),o.map(({folder:e,depth:t})=>(0,R.jsx)(`option`,{value:e.id,disabled:e.can_write===!1,children:`${`— `.repeat(t)}${e.name}`},e.id))]})]})}function G(e){return e.length>3?`${e.slice(0,3).join(`, `)} +${e.length-3}`:e.join(`, `)}function K(){let{t:e}=a(),{showToast:t}=h(),n=o(),[i,s]=(0,L.useState)(null);return{run:async(i,a)=>{if(i.length===0){t(e(`manyfold.bulkNothing`),`info`);return}let o=0,c=0,l=[],u=null;try{for(let e=0;er.getManyfoldModel(e)}),N=s({queryKey:[`settings`],queryFn:()=>r.getSettings()}),ee=N.data?.use_slicer_api??!1,re=ie(N.data?.open_in_slicer,N.data?.preferred_slicer),ae=c({mutationFn:t=>r.importManyfoldFile(e,t.id,y),onMutate:e=>D(e.id),onSettled:()=>D(null),onSuccess:t=>{f.invalidateQueries({queryKey:[`manyfold-model`,e]}),f.invalidateQueries({queryKey:[`library-files`]}),f.invalidateQueries({queryKey:[`library-folders`]}),d(t.was_existing?i(`manyfold.alreadyInLibrary`):i(`manyfold.imported`,{filename:t.filename}),`success`)},onError:e=>d(B(e,i),`error`)});if(M.isLoading)return(0,R.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,R.jsx)(v,{className:`w-8 h-8 text-bambu-green animate-spin`})});if(M.isError||!M.data)return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:t,children:[(0,R.jsx)(u,{className:`w-4 h-4`}),i(`manyfold.back`)]}),(0,R.jsx)(`p`,{className:`text-red-400 text-sm`,children:B(M.error,i)})]});let F=M.data,I=F.files.filter(e=>e.importable&&!e.library_file),z=I.filter(e=>O.has(e.id)),H=I.length>0&&z.length===I.length,W=j.busy||ae.isPending,G=async e=>{await j.run(e.map(e=>({modelId:F.id,fileId:e.id,name:e.name})),y),A(new Set)};return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:t,children:[(0,R.jsx)(u,{className:`w-4 h-4`}),i(`manyfold.back`)]}),(0,R.jsx)(C,{children:(0,R.jsx)(S,{children:(0,R.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-6 py-2`,children:[(0,R.jsx)(U,{modelId:F.id,className:`w-full md:w-72 aspect-square rounded-lg shrink-0`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-xl font-semibold text-white break-words`,children:F.name}),F.caption&&(0,R.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:F.caption})]}),F.description&&(0,R.jsx)(`p`,{className:`text-sm text-bambu-gray whitespace-pre-line break-words`,children:F.description}),F.tags.length>0&&(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:F.tags.map(e=>(0,R.jsx)(`span`,{className:`px-2 py-0.5 rounded-full bg-bambu-dark-tertiary text-xs text-white`,children:e},e))}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[F.license&&(0,R.jsxs)(`span`,{className:`text-bambu-gray`,children:[i(`manyfold.license`),`: `,(0,R.jsx)(`span`,{className:`text-white`,children:F.license})]}),(0,R.jsxs)(`a`,{href:F.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-bambu-green hover:underline`,children:[(0,R.jsx)(E,{className:`w-3.5 h-3.5`}),i(`manyfold.openInManyfold`)]})]})]})]})})}),(0,R.jsxs)(C,{children:[(0,R.jsxs)(x,{children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:i(`manyfold.files`)}),_&&(0,R.jsx)(se,{value:y,onChange:b,disabled:W})]}),_&&I.length>0&&(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mt-3`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-white`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:H,ref:e=>{e&&(e.indeterminate=z.length>0&&!H)},disabled:W,onChange:()=>A(H?new Set:new Set(I.map(e=>e.id))),className:`accent-bambu-green`}),i(`manyfold.selectAll`)]}),j.progress?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,R.jsx)(v,{className:`w-4 h-4 animate-spin`}),i(`manyfold.importProgress`,j.progress)]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(w,{variant:`primary`,size:`sm`,disabled:W||z.length===0,onClick:()=>G(z),children:[(0,R.jsx)(te,{className:`w-3.5 h-3.5`}),i(`manyfold.importSelected`,{count:z.length})]}),(0,R.jsx)(w,{variant:`secondary`,size:`sm`,disabled:W,onClick:()=>G(I),children:i(`manyfold.importAll`)})]})]})]}),(0,R.jsx)(S,{children:F.files.length===0?(0,R.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`manyfold.noFiles`)}):(0,R.jsx)(`ul`,{className:`divide-y divide-bambu-dark-tertiary`,children:F.files.map(e=>{let t=e.library_file,r=t!==null&&oe({filename:t.filename},ee,re);return(0,R.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 py-2`,children:[_&&I.length>0&&(0,R.jsx)(`span`,{className:`w-4 shrink-0 flex`,children:e.importable&&!t&&(0,R.jsx)(`input`,{type:`checkbox`,"aria-label":i(`manyfold.selectFile`,{name:e.name}),checked:O.has(e.id),disabled:W,onChange:()=>A(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-bambu-green`})}),(0,R.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-bambu-dark-tertiary text-[11px] font-mono text-bambu-gray shrink-0`,children:V(e.mime)}),(0,R.jsx)(`span`,{className:`text-sm text-white min-w-0 flex-1 break-words`,children:e.name}),(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.importable?t?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-bambu-green`,children:[(0,R.jsx)(p,{className:`w-3.5 h-3.5`}),i(`manyfold.inLibrary`)]}),(0,R.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>m(t.folder_id?`/files?folder=${t.folder_id}`:`/files`),children:[(0,R.jsx)(P,{className:`w-3.5 h-3.5`}),i(`manyfold.showInLibrary`)]}),r&&(0,R.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>n(t.id,t.filename),children:[(0,R.jsx)(g,{className:`w-3.5 h-3.5`}),i(`slice.action`,`Slice`)]})]}):_?(0,R.jsxs)(w,{variant:`secondary`,size:`sm`,disabled:W,onClick:()=>ae.mutate(e),children:[T===e.id?(0,R.jsx)(v,{className:`w-3.5 h-3.5 animate-spin`}):(0,R.jsx)(te,{className:`w-3.5 h-3.5`}),T===e.id?i(`manyfold.importing`):i(`manyfold.import`)]}):null:(0,R.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:i(`manyfold.notImportable`)})})]},e.id)})})})]})]})}function le(){let{t:e}=a(),{hasPermission:t}=ne(),n=t(`settings:update`),[i,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(1),[g,b]=(0,L.useState)(null),[x,T]=(0,L.useState)(null),[E,O]=(0,L.useState)(new Map),[k,j]=(0,L.useState)(null),[M,N]=(0,L.useState)(null),P=t(`manyfold:import`),ae=o(),{showToast:oe}=h(),F=K(),I=M!==null||F.busy,z=M?e(`manyfold.collectProgress`,M):F.progress?e(`manyfold.importProgress`,F.progress):null,V=(e,t)=>O(n=>{let r=new Map(n);return r.has(e)?r.delete(e):r.set(e,t),r}),H=async()=>{let t=[...E.keys()],n=[],i=[];try{for(let e=0;er.getManyfoldModel(t[e])});for(let e of i.files)e.importable&&!e.library_file&&n.push({modelId:i.id,fileId:e.id,name:`${i.name}: ${e.name}`})}catch{i.push(E.get(t[e])??t[e])}}}finally{N(null)}i.length&&oe(e(`manyfold.modelsUnreadable`,{names:G(i)}),`error`),await F.run(n,k),O(new Map)},le=s({queryKey:[`settings`],queryFn:()=>r.getSettings()}),q=s({queryKey:[`manyfold-status`],queryFn:()=>r.getManyfoldStatus()}),ue=q.data?.configured??!1,J=s({queryKey:[`manyfold-models`,d,p],queryFn:()=>r.listManyfoldModels(d,p),enabled:ue,placeholderData:e=>e}),Y=async(e,t)=>{if(le.data?.use_slicer_api){T({kind:`libraryFile`,id:e,filename:t});return}let n=ie(le.data?.open_in_slicer,le.data?.preferred_slicer);try{let{token:i}=await r.createLibrarySlicerToken(e);re(`${window.location.origin}${r.getLibrarySlicerDownloadUrl(e,i,t)}`,n)}catch{re(`${window.location.origin}${r.getLibraryFileDownloadUrl(e)}`,n)}};if(q.isLoading)return(0,R.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,R.jsx)(v,{className:`w-8 h-8 text-bambu-green animate-spin`})});if(!ue||i)return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(`p`,{className:`text-bambu-gray`,children:e(`manyfold.description`)}),n?(0,R.jsx)(W,{onDone:ue?()=>c(!1):void 0}):(0,R.jsx)(C,{children:(0,R.jsx)(S,{children:(0,R.jsxs)(`div`,{className:`py-2`,children:[(0,R.jsx)(`p`,{className:`font-medium text-white`,children:e(`manyfold.notConnectedTitle`)}),(0,R.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`manyfold.notConnectedBody`)})]})})})]});let X=J.data;return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[g?(0,R.jsx)(ce,{modelId:g,onBack:()=>b(null),onSlice:Y}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsx)(`p`,{className:`text-bambu-gray flex-1 min-w-[16rem]`,children:e(`manyfold.description`)}),n&&(0,R.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>c(!0),children:[(0,R.jsx)(A,{className:`w-4 h-4`}),e(`manyfold.editConnection`)]})]}),(0,R.jsxs)(`form`,{className:`flex gap-2`,role:`search`,onSubmit:e=>{e.preventDefault(),f(l.trim()),m(1)},children:[(0,R.jsxs)(`div`,{className:`relative flex-1`,children:[(0,R.jsx)(y,{className:`w-4 h-4 text-bambu-gray absolute left-3 top-1/2 -translate-y-1/2`}),(0,R.jsx)(`input`,{type:`search`,value:l,onChange:e=>u(e.target.value),placeholder:e(`manyfold.searchPlaceholder`),"aria-label":e(`manyfold.searchPlaceholder`),className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`})]}),(0,R.jsx)(w,{type:`submit`,children:e(`common.search`)})]}),J.isError?(0,R.jsx)(`p`,{className:`text-sm text-red-400`,children:B(J.error,e)}):X?X.models.length===0?(0,R.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`manyfold.noModels`)}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`manyfold.modelCount`,{count:X.total})}),P&&(0,R.jsx)(w,{variant:`ghost`,size:`sm`,disabled:I,onClick:()=>O(e=>{let t=new Map(e);for(let e of X.models)t.set(e.id,e.name);return t}),children:e(`manyfold.selectPage`)})]}),P&&E.size>0&&(0,R.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-wrap items-center gap-3 rounded-lg border border-bambu-green/40 bg-bambu-dark-secondary px-4 py-3`,children:[(0,R.jsx)(`span`,{className:`text-sm text-white`,children:e(`manyfold.modelsSelected`,{count:E.size})}),(0,R.jsx)(se,{value:k,onChange:j,disabled:I}),z?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,R.jsx)(v,{className:`w-4 h-4 animate-spin`}),z]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(w,{variant:`primary`,size:`sm`,onClick:H,children:[(0,R.jsx)(te,{className:`w-3.5 h-3.5`}),e(`manyfold.importModels`)]}),(0,R.jsx)(w,{variant:`ghost`,size:`sm`,onClick:()=>O(new Map),children:e(`manyfold.clearSelection`)})]})]}),(0,R.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4`,children:X.models.map(t=>{let n=E.has(t.id);return(0,R.jsxs)(`div`,{className:`relative rounded-lg border bg-bambu-dark-secondary overflow-hidden transition-colors ${n?`border-bambu-green ring-1 ring-bambu-green`:`border-bambu-dark-tertiary hover:border-bambu-green`}`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>b(t.id),disabled:I,className:`block w-full text-left disabled:cursor-wait`,children:[(0,R.jsx)(U,{modelId:t.id,className:`aspect-square`}),(0,R.jsx)(`span`,{className:`block px-3 py-2 text-sm text-white truncate`,title:t.name,children:t.name})]}),P&&(0,R.jsx)(`label`,{className:`absolute top-2 left-2 flex items-center justify-center w-7 h-7 rounded bg-black/60 cursor-pointer`,children:(0,R.jsx)(`input`,{type:`checkbox`,"aria-label":e(`manyfold.selectModel`,{name:t.name}),checked:n,disabled:I,onChange:()=>V(t.id,t.name),className:`accent-bambu-green w-4 h-4`})})]},t.id)})}),(X.has_previous||X.has_next)&&(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[(0,R.jsxs)(w,{variant:`secondary`,size:`sm`,disabled:!X.has_previous||J.isFetching,onClick:()=>m(e=>Math.max(1,e-1)),children:[(0,R.jsx)(ee,{className:`w-4 h-4`}),e(`manyfold.previous`)]}),(0,R.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`manyfold.page`,{page:X.page})}),(0,R.jsxs)(w,{variant:`secondary`,size:`sm`,disabled:!X.has_next||J.isFetching,onClick:()=>m(e=>e+1),children:[e(`manyfold.next`),(0,R.jsx)(D,{className:`w-4 h-4`})]})]})]}):(0,R.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,R.jsx)(v,{className:`w-8 h-8 text-bambu-green animate-spin`})})]}),x&&(0,R.jsx)(_,{source:x,onClose:()=>T(null)})]})}function q(e,t){let n=e?.[t];return typeof n==`string`?n:``}function ue(e){return e.replace(/(https?:\/\/(?:makerworld|public-cdn)\.bblmw\.com\/[^\s"']+)/gi,e=>`/api/v1/makerworld/thumbnail?url=${encodeURIComponent(e)}`)}function J(e){return e?/^https?:\/\/(makerworld|public-cdn)\.bblmw\.com\//i.test(e)?`/api/v1/makerworld/thumbnail?url=${encodeURIComponent(e)}`:e:``}function Y(e,t){let n=e?.[t];return typeof n==`number`?n:null}function X(e,t){let n=e?.[t];return n&&typeof n==`object`&&!Array.isArray(n)?n:void 0}function de(e,t=0,n=[]){n.push({folder:e,depth:t});for(let r of e.children??[])de(r,t+1,n);return n}function fe(e,t){return t(e<1?`makerworld.phaseResolving`:`makerworld.phaseDownloading`)}function pe(e){let[t,n]=(0,L.useState)(0);return(0,L.useEffect)(()=>{if(!e){n(0);return}let t=Date.now(),r=()=>n(Math.floor((Date.now()-t)/1e3));r();let i=window.setInterval(r,1e3);return()=>window.clearInterval(i)},[e]),t}function me({embedded:e=!1}={}){let{t}=a(),{hasPermission:n}=ne(),{showToast:i}=h(),l=o(),u=n(`makerworld:import`),[f,y]=(0,L.useState)(``),[k,A]=(0,L.useState)(null),[j,oe]=(0,L.useState)(null),[I,z]=(0,L.useState)(null),[B,V]=(0,L.useState)(null),[H,U]=(0,L.useState)(null),[W,se]=(0,L.useState)(``),[G,K]=(0,L.useState)({}),ce=s({queryKey:[`makerworld-status`],queryFn:()=>r.getMakerworldStatus()}),le=s({queryKey:[`library-folders`],queryFn:()=>r.getLibraryFolders()}),me=s({queryKey:[`makerworld-recent-imports`],queryFn:()=>r.getMakerworldRecentImports(10)}),he=s({queryKey:[`settings`],queryFn:()=>r.getSettings()}),ge=he.data?.use_slicer_api??!1,_e=he.data?.preferred_slicer||`bambu_studio`,ve=ie(he.data?.open_in_slicer,he.data?.preferred_slicer),ye=ge?_e:ve,be=ye===`orcaslicer`?`OrcaSlicer`:`Bambu Studio`,[xe,Se]=(0,L.useState)(null),Ce=(e,t)=>{Se({kind:`libraryFile`,id:e,filename:t})},we=c({mutationFn:e=>r.resolveMakerworldUrl(e),onSuccess:(e,t)=>{A(e),se(t),K({})},onError:e=>i(e.message||t(`makerworld.errors.resolveFailed`),`error`)});(0,L.useEffect)(()=>{k!==null&&f.trim()!==W.trim()&&(A(null),se(``),K({}))},[f,k,W]);let Z=c({mutationFn:({instanceId:e,profileId:t})=>r.importMakerworldInstance(k?.model_id??0,e,t,j),onSuccess:e=>{l.invalidateQueries({queryKey:[`library-files`]}),l.invalidateQueries({queryKey:[`library-folders`]}),e.profile_id&&K(t=>({...t,[e.profile_id]:e})),i(e.was_existing?t(`makerworld.alreadyInLibrary`):t(`makerworld.importSuccess`,{filename:e.filename}),`success`)},onError:e=>i(e.message||t(`makerworld.errors.downloadFailed`),`error`)}),Te=c({mutationFn:({libraryFileId:e})=>r.deleteLibraryFile(e),onSuccess:(e,{profileId:n})=>{l.invalidateQueries({queryKey:[`library-files`]}),l.invalidateQueries({queryKey:[`library-folders`]}),l.invalidateQueries({queryKey:[`makerworld-recent-imports`]}),K(e=>{let t={...e};return delete t[n],t}),V(null),i(t(`makerworld.importDeleted`),`success`)},onError:e=>{V(null),i(e.message||t(`makerworld.errors.deleteFailed`),`error`)}}),Ee=c({mutationFn:({instanceId:e,profileId:t})=>r.importMakerworldInstance(k?.model_id??0,e,t,j),onSuccess:async e=>{l.invalidateQueries({queryKey:[`library-files`]}),l.invalidateQueries({queryKey:[`library-folders`]}),l.invalidateQueries({queryKey:[`makerworld-recent-imports`]}),e.profile_id&&K(t=>({...t,[e.profile_id]:e})),ge?Ce(e.library_file_id,e.filename):await je(e.library_file_id,e.filename,ye)},onError:e=>i(e.message||t(`makerworld.errors.downloadFailed`),`error`)}),Q=pe(Z.isPending||Ee.isPending),De=fe(Q,t),Oe=e=>{e?.preventDefault();let t=f.trim();t&&we.mutate(t)};(0,L.useEffect)(()=>{if(!H)return;let e=e=>{e.key===`Escape`?U(null):e.key===`ArrowLeft`?U(e=>e&&e.index>0?{...e,index:e.index-1}:e):e.key===`ArrowRight`&&U(e=>e&&e.indexwindow.removeEventListener(`keydown`,e)},[H]);let ke=e=>{let t=(Array.isArray(e.pictures)?e.pictures:[]).filter(e=>typeof e==`object`&&!!e).map(e=>({name:q(e,`name`)||`image`,url:q(e,`url`)})).filter(e=>e.url);if(t.length>0)return t;let n=q(e,`cover`);return n?[{name:`cover`,url:n}]:[]},Ae=async()=>{if(!k)return;let e=k.instances.filter(e=>{let t=Y(e,`profileId`);return t!==null&&!G[t]});if(e.length!==0){z({current:0,total:e.length});try{for(let t=0;t{try{let{token:i}=await r.createLibrarySlicerToken(e),a=r.getLibrarySlicerDownloadUrl(e,i,t);re(`${window.location.origin}${a}`,n)}catch{let t=r.getLibraryFileDownloadUrl(e);re(`${window.location.origin}${t}`,n)}},$=k?.design,Me=X($,`designCreator`),Ne=k?.instances??[],Pe=(k?.already_imported_library_ids.length??0)>0,Fe=ce.data?.can_download??!1,Ie=ce.data?.sign_in_expired??!1,Le=(0,L.useMemo)(()=>q($,`coverUrl`),[$]),Re=q($,`title`),ze=q($,`summary`),Be=q($,`license`),Ve=Y($,`downloadCount`);return(0,R.jsxs)(`div`,{className:e?`space-y-6`:`p-4 md:p-8 max-w-screen-2xl space-y-6`,children:[e?(0,R.jsx)(`p`,{className:`text-bambu-gray`,children:t(`makerworld.description`)}):(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,R.jsx)(N,{className:`w-7 h-7 text-bambu-green`}),t(`makerworld.title`)]}),(0,R.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:t(`makerworld.description`)})]}),(0,R.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[1fr_20rem]`,children:[(0,R.jsxs)(`div`,{className:`space-y-6 min-w-0`,children:[!Fe&&(0,R.jsx)(C,{className:`border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/20`,children:(0,R.jsx)(S,{children:(0,R.jsxs)(`div`,{className:`flex items-start gap-3 py-2`,children:[(0,R.jsx)(m,{className:`w-5 h-5 text-amber-600 dark:text-amber-400 mt-0.5 shrink-0`}),(0,R.jsxs)(`div`,{className:`text-sm`,children:[(0,R.jsx)(`p`,{className:`font-medium text-amber-900 dark:text-amber-100`,children:t(Ie?`makerworld.signInExpiredTitle`:`makerworld.signInRequiredTitle`)}),(0,R.jsxs)(`p`,{className:`text-amber-800 dark:text-amber-200 mt-1`,children:[t(Ie?`makerworld.signInExpiredBody`:`makerworld.signInRequiredBody`),` `,(0,R.jsx)(O,{to:`/profiles`,className:`underline`,children:t(`makerworld.openCloudSettings`)})]})]})]})})}),(0,R.jsxs)(C,{children:[(0,R.jsx)(x,{children:(0,R.jsx)(`h2`,{className:`text-lg font-semibold`,children:t(`makerworld.pasteUrlHeader`)})}),(0,R.jsx)(S,{children:(0,R.jsxs)(`form`,{onSubmit:Oe,className:`flex gap-2`,children:[(0,R.jsx)(`input`,{type:`text`,value:f,onChange:e=>y(e.target.value),placeholder:t(`makerworld.pasteUrlPlaceholder`),className:`flex-1 min-w-0 px-3 py-2 border rounded bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-700`,autoComplete:`off`}),(0,R.jsxs)(w,{type:`submit`,variant:`primary`,disabled:!f.trim()||we.isPending,children:[we.isPending?(0,R.jsx)(v,{className:`w-4 h-4 animate-spin`}):(0,R.jsx)(d,{className:`w-4 h-4`}),(0,R.jsx)(`span`,{className:`ml-2`,children:t(`makerworld.resolveButton`)})]})]})})]}),k&&(0,R.jsx)(C,{children:(0,R.jsx)(S,{children:(0,R.jsxs)(`div`,{className:`flex gap-4 py-2`,children:[Le&&(0,R.jsx)(`img`,{src:J(Le),alt:Re,className:`w-32 h-32 object-cover rounded`,loading:`lazy`}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsx)(`h3`,{className:`text-xl font-semibold truncate`,children:Re||t(`makerworld.untitledModel`)}),Me&&(0,R.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 mt-1`,children:t(`makerworld.byCreator`,{name:q(Me,`name`)})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 mt-2 text-xs text-gray-500 dark:text-gray-400`,children:[Ve!==null&&(0,R.jsx)(`span`,{children:t(`makerworld.downloadsCount`,{count:Ve})}),Be&&(0,R.jsxs)(`span`,{children:[t(`makerworld.licensePrefix`),`: `,Be]}),Pe&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-emerald-600 dark:text-emerald-400`,children:[(0,R.jsx)(p,{className:`w-3 h-3`}),` `,t(`makerworld.alreadyImported`)]})]}),ze&&(0,R.jsx)(`div`,{className:`mt-3 text-sm prose prose-sm max-w-none dark:prose-invert line-clamp-3`,dangerouslySetInnerHTML:{__html:ae.sanitize(ue(ze))}}),k&&(0,R.jsxs)(`a`,{href:`https://makerworld.com/models/${k.model_id}${k.profile_id?`#profileId-${k.profile_id}`:``}`,target:`_blank`,rel:`noopener noreferrer`,className:`mt-3 inline-flex items-center gap-1 text-xs text-brand-500 hover:underline`,children:[(0,R.jsx)(E,{className:`w-3 h-3`}),` `,t(`makerworld.openOnMakerworld`)]})]})]})})}),k&&Ne.length>0&&(0,R.jsxs)(C,{children:[(0,R.jsx)(x,{children:(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`h2`,{className:`text-lg font-semibold`,children:t(`makerworld.platesHeader`,{count:Ne.length})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`label`,{className:`text-xs text-gray-600 dark:text-gray-400`,children:t(`makerworld.importTo`)}),(0,R.jsxs)(`select`,{value:j??``,onChange:e=>oe(e.target.value?Number(e.target.value):null),className:`text-sm px-2 py-1 border rounded bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-700`,disabled:I!==null,children:[(0,R.jsx)(`option`,{value:``,children:t(`makerworld.folderAuto`)}),(le.data??[]).filter(e=>!(e.is_external&&e.external_readonly)).flatMap(e=>de(e)).map(({folder:e,depth:t})=>(0,R.jsx)(`option`,{value:e.id,disabled:e.can_write===!1,children:`${`— `.repeat(t)}${e.name}`},e.id))]}),(0,R.jsx)(w,{variant:`primary`,size:`sm`,disabled:!u||!Fe||I!==null||Z.isPending||Ee.isPending,onClick:Ae,children:I===null?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(te,{className:`w-4 h-4`}),(0,R.jsx)(`span`,{className:`ml-2`,children:t(`makerworld.importAll`)})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(v,{className:`w-4 h-4 animate-spin`}),(0,R.jsxs)(`span`,{className:`ml-2`,children:[t(`makerworld.importAllProgress`,{current:I.current,total:I.total}),Q>0&&` · ${De} · ${Q}s`]})]})})]})]})}),(0,R.jsx)(S,{children:(0,R.jsx)(`div`,{className:`grid gap-3`,children:Ne.map((e,n)=>{let r=Y(e,`id`),i=Y(e,`profileId`),a=q(e,`title`),o=q(e,`cover`),s=Y(e,`materialCnt`),c=e?.needAms===!0,l=Y(e,`downloadCount`),d=e?.compatibility??null,f=e?.otherCompatibility??null,m=d?.devProductName??null,h=Array.isArray(f)?f.map(e=>e?.devProductName??``).filter(Boolean):[];if(r==null)return null;let _=Z.isPending&&Z.variables?.instanceId===r,y=Ee.isPending&&Ee.variables?.instanceId===r,b=i===null?void 0:G[i];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 border rounded border-gray-200 dark:border-gray-700`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(()=>{let n=ke(e),r=n.length>0;return(0,R.jsxs)(`button`,{type:`button`,disabled:!r,onClick:()=>r&&U({images:n,index:0}),className:`relative w-16 h-16 shrink-0 rounded overflow-hidden group`,"aria-label":t(`makerworld.openGallery`),children:[o?(0,R.jsx)(`img`,{src:J(o),alt:``,className:`w-16 h-16 object-cover`,loading:`lazy`}):(0,R.jsx)(`div`,{className:`w-16 h-16 bg-gray-100 dark:bg-gray-800`}),n.length>1&&(0,R.jsxs)(`span`,{className:`absolute bottom-0.5 right-0.5 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded flex items-center gap-1`,children:[(0,R.jsx)(F,{className:`w-2.5 h-2.5`}),n.length]})]})})(),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsx)(`p`,{className:`font-medium truncate`,children:a||t(`makerworld.plateDefaultName`,{n:n+1})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400 mt-1`,children:[m&&(0,R.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-gray-300`,children:t(`makerworld.slicedFor`,{printer:m,defaultValue:`Sliced for {{printer}}`})}),s!==null&&(0,R.jsx)(`span`,{children:t(`makerworld.materialCount`,{count:s})}),c&&(0,R.jsx)(`span`,{children:t(`makerworld.amsRequired`)}),l!==null&&(0,R.jsx)(`span`,{children:t(`makerworld.downloadsCount`,{count:l})})]}),h.length>0&&(0,R.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,title:h.join(`, `),children:t(`makerworld.alsoCompatible`,{printers:h.slice(0,6).join(`, `)+(h.length>6?`…`:``),defaultValue:`Also marked compatible: {{printers}}`})})]}),(0,R.jsxs)(`div`,{className:`flex gap-2 shrink-0`,children:[(0,R.jsx)(w,{variant:`ghost`,size:`sm`,disabled:!u||!Fe||_||y||I!==null,onClick:()=>Z.mutate({instanceId:r,profileId:i}),title:Fe?void 0:t(`makerworld.signInRequiredTitle`),children:_?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(v,{className:`w-4 h-4 animate-spin`}),(0,R.jsxs)(`span`,{className:`ml-2`,children:[De,Q>0&&` · ${Q}s`]})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(te,{className:`w-4 h-4`}),(0,R.jsx)(`span`,{className:`ml-2`,children:t(`makerworld.importToLibrary`)})]})}),(0,R.jsx)(w,{variant:`primary`,size:`sm`,disabled:!u||!Fe||_||y||I!==null,onClick:()=>Ee.mutate({instanceId:r,profileId:i}),title:Fe?void 0:t(`makerworld.signInRequiredTitle`),children:y?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(v,{className:`w-4 h-4 animate-spin`}),(0,R.jsxs)(`span`,{className:`ml-2`,children:[De,Q>0&&` · ${Q}s`]})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(E,{className:`w-4 h-4`}),(0,R.jsx)(`span`,{className:`ml-2`,children:t(`makerworld.sliceIn`,{slicer:be})})]})})]})]}),b&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2 pl-20 text-xs`,children:[(0,R.jsx)(p,{className:`w-3.5 h-3.5 text-emerald-600 dark:text-emerald-400 shrink-0`}),(0,R.jsx)(`span`,{className:`text-emerald-700 dark:text-emerald-300`,children:b.was_existing?t(`makerworld.lastImportAlreadyInLibrary`):t(`makerworld.lastImportSuccess`)}),(0,R.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>{let e=b.folder_id?`/files?folder=${b.folder_id}`:`/files`;window.location.assign(e)},children:[(0,R.jsx)(P,{className:`w-3.5 h-3.5`}),(0,R.jsx)(`span`,{className:`ml-1.5`,children:t(`makerworld.viewInLibrary`)})]}),ge?(0,R.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>Ce(b.library_file_id,b.filename),children:[(0,R.jsx)(g,{className:`w-3.5 h-3.5`}),(0,R.jsx)(`span`,{className:`ml-1.5`,children:t(`slice.action`,`Slice`)})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>je(b.library_file_id,b.filename,`bambu_studio`),children:[(0,R.jsx)(E,{className:`w-3.5 h-3.5`}),(0,R.jsx)(`span`,{className:`ml-1.5`,children:t(`makerworld.openInBambuStudio`)})]}),(0,R.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>je(b.library_file_id,b.filename,`orcaslicer`),children:[(0,R.jsx)(E,{className:`w-3.5 h-3.5`}),(0,R.jsx)(`span`,{className:`ml-1.5`,children:t(`makerworld.openInOrcaSlicer`)})]})]}),(0,R.jsx)(`div`,{className:`ml-auto`,children:(0,R.jsx)(w,{variant:`ghost`,size:`sm`,disabled:Te.isPending&&Te.variables?.profileId===i,onClick:()=>{i!==null&&V({libraryFileId:b.library_file_id,profileId:i,filename:b.filename})},title:t(`makerworld.deleteImport`),children:Te.isPending&&Te.variables?.profileId===i?(0,R.jsx)(v,{className:`w-3.5 h-3.5 animate-spin`}):(0,R.jsx)(T,{className:`w-3.5 h-3.5 text-red-500`})})})]})]},r)})})})]})]}),(0,R.jsx)(`aside`,{className:`lg:sticky lg:top-6 lg:self-start min-w-0`,children:me.data&&me.data.length>0&&(0,R.jsxs)(C,{children:[(0,R.jsx)(x,{children:(0,R.jsx)(`h2`,{className:`text-base font-semibold`,children:t(`makerworld.recentImportsHeader`)})}),(0,R.jsx)(S,{children:(0,R.jsx)(`div`,{className:`flex flex-col gap-2 max-h-[28rem] overflow-y-auto -mx-2 px-2`,children:me.data.map(e=>(0,R.jsxs)(`div`,{className:`flex gap-2 p-2 border rounded border-gray-200 dark:border-gray-700`,children:[e.thumbnail_path?(0,R.jsx)(`img`,{src:r.getLibraryFileThumbnailUrl(e.library_file_id),alt:``,className:`w-12 h-12 shrink-0 object-cover rounded bg-gray-100 dark:bg-gray-800`,loading:`lazy`}):(0,R.jsx)(`div`,{className:`w-12 h-12 shrink-0 rounded bg-gray-100 dark:bg-gray-800`}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col gap-1`,children:[(0,R.jsx)(`p`,{className:`text-xs font-medium truncate`,title:e.filename,children:e.filename}),(0,R.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,R.jsx)(w,{variant:`ghost`,size:`sm`,onClick:()=>{let t=e.folder_id?`/files?folder=${e.folder_id}`:`/files`;window.location.assign(t)},title:t(`makerworld.viewInLibrary`),children:(0,R.jsx)(P,{className:`w-3.5 h-3.5`})}),ge?(0,R.jsx)(w,{variant:`ghost`,size:`sm`,onClick:()=>Ce(e.library_file_id,e.filename),title:t(`slice.action`,`Slice`),children:(0,R.jsx)(g,{className:`w-3.5 h-3.5`})}):(0,R.jsx)(w,{variant:`ghost`,size:`sm`,onClick:()=>je(e.library_file_id,e.filename,`bambu_studio`),title:t(`makerworld.openInBambuStudio`),children:(0,R.jsx)(E,{className:`w-3.5 h-3.5`})}),e.source_url&&(0,R.jsx)(`a`,{href:e.source_url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center h-7 w-7 rounded text-gray-500 hover:text-gray-700 dark:hover:text-gray-300`,title:t(`makerworld.openOnMakerworld`),children:(0,R.jsx)(N,{className:`w-3.5 h-3.5`})})]})]})]},e.library_file_id))})})]})})]}),(0,R.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 pt-4 border-t border-gray-200 dark:border-gray-700`,children:t(`makerworld.disclaimer`)}),B&&(0,R.jsx)(M,{title:t(`makerworld.deleteImport`),message:t(`makerworld.confirmDelete`,{filename:B.filename}),confirmText:t(`makerworld.deleteImport`),variant:`danger`,isLoading:Te.isPending,loadingText:t(`makerworld.importDeleting`),onCancel:()=>V(null),onConfirm:()=>Te.mutate({libraryFileId:B.libraryFileId,profileId:B.profileId})}),xe&&(0,R.jsx)(_,{source:xe,onClose:()=>Se(null)}),H&&(0,R.jsxs)(`div`,{className:`fixed inset-0 bg-black/90 flex items-center justify-center z-50`,onClick:()=>U(null),role:`dialog`,"aria-modal":`true`,children:[(0,R.jsx)(`button`,{type:`button`,className:`absolute top-4 right-4 p-2 bg-white/10 hover:bg-white/20 rounded-full text-white`,onClick:e=>{e.stopPropagation(),U(null)},"aria-label":t(`common.close`,`Close`),children:(0,R.jsx)(b,{className:`w-5 h-5`})}),H.images.length>1&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,className:`absolute left-4 p-2 bg-white/10 hover:bg-white/20 rounded-full text-white disabled:opacity-30`,disabled:H.index===0,onClick:e=>{e.stopPropagation(),U(e=>e&&{...e,index:Math.max(0,e.index-1)})},"aria-label":t(`makerworld.galleryPrev`),children:(0,R.jsx)(ee,{className:`w-6 h-6`})}),(0,R.jsx)(`button`,{type:`button`,className:`absolute right-4 p-2 bg-white/10 hover:bg-white/20 rounded-full text-white disabled:opacity-30`,disabled:H.index>=H.images.length-1,onClick:e=>{e.stopPropagation(),U(e=>e&&{...e,index:Math.min(e.images.length-1,e.index+1)})},"aria-label":t(`makerworld.galleryNext`),children:(0,R.jsx)(D,{className:`w-6 h-6`})})]}),(0,R.jsx)(`img`,{src:J(H.images[H.index].url),alt:H.images[H.index].name,className:`max-w-[90vw] max-h-[90vh] object-contain`,onClick:e=>e.stopPropagation()}),H.images.length>1&&(0,R.jsxs)(`div`,{className:`absolute bottom-6 left-1/2 -translate-x-1/2 text-white bg-black/60 px-3 py-1 rounded text-xs`,children:[H.index+1,` / `,H.images.length]})]})]})}function he(){let{t:e}=a(),{hasPermission:t}=ne(),[n,i]=j(),o=t(`manyfold:view`),c=s({queryKey:[`manyfold-status`],queryFn:()=>r.getManyfoldStatus(),enabled:o}),l=o&&(c.data?.configured===!0||t(`settings:update`)),u=[];t(`makerworld:view`)&&u.push({id:`makerworld`,label:e(`modelSources.tabMakerworld`),icon:N}),l&&u.push({id:`manyfold`,label:e(`modelSources.tabManyfold`),icon:I});let d=n.get(`tab`),f=u.find(e=>e.id===d)?.id??u[0]?.id??(o?`manyfold`:void 0);return(0,R.jsxs)(`div`,{className:`p-4 md:p-8 max-w-screen-2xl`,children:[(0,R.jsx)(`div`,{className:`mb-6`,children:(0,R.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,R.jsx)(N,{className:`w-7 h-7 text-bambu-green`}),e(`modelSources.title`)]})}),u.length>1&&(0,R.jsx)(`div`,{className:`flex border-b border-bambu-dark-tertiary mb-6`,role:`tablist`,children:u.map(({id:e,label:t,icon:n})=>(0,R.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":f===e,onClick:()=>i({tab:e},{replace:!0}),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${f===e?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-white border-transparent`}`,children:[(0,R.jsx)(n,{className:`w-4 h-4`}),t]},e))}),f===`makerworld`&&(0,R.jsx)(me,{embedded:!0}),f===`manyfold`&&(0,R.jsx)(le,{})]})}export{he as ModelSourcesPage}; \ No newline at end of file diff --git a/static/assets/NotificationsPage-PUM7obke.js b/static/assets/NotificationsPage-PUM7obke.js new file mode 100644 index 000000000..86df262a0 --- /dev/null +++ b/static/assets/NotificationsPage-PUM7obke.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{n as c}from"./ToastContext-BRX0SW3C.js";import{t as l}from"./loader-circle-BEmFtawu.js";import{i as u,n as d,t as f}from"./Card-Bzc64K35.js";import{t as p}from"./Button-DDr6eAFy.js";import{An as m,In as h,Ut as g,Vn as _,in as v,yt as y}from"./index-CovRLYqQ.js";var b=e(n(),1),x=t();function S(){let{t:e}=i(),{user:t}=y(),{showToast:n}=c(),S=a(),C=_(),[w,T]=(0,b.useState)(!0),[E,D]=(0,b.useState)(!0),[O,k]=(0,b.useState)(!0),[A,j]=(0,b.useState)(!0),[M,N]=(0,b.useState)(!1),{data:P,isLoading:F}=o({queryKey:[`advancedAuthStatus`],queryFn:r.getAdvancedAuthStatus,staleTime:300*1e3}),{data:I,isLoading:L}=o({queryKey:[`settings`],queryFn:r.getSettings,staleTime:300*1e3}),{data:R,isLoading:z}=o({queryKey:[`user-email-preferences`],queryFn:()=>r.getUserEmailPreferences()});(0,b.useEffect)(()=>{(P&&!P.advanced_auth_enabled||I&&!I.user_notifications_enabled)&&C(`/settings`,{replace:!0})},[P,I,C]),(0,b.useEffect)(()=>{R&&(T(R.notify_print_start),D(R.notify_print_complete),k(R.notify_print_failed),j(R.notify_print_stopped),N(!1))},[R]);let B=s({mutationFn:()=>r.updateUserEmailPreferences({notify_print_start:w,notify_print_complete:E,notify_print_failed:O,notify_print_stopped:A}),onSuccess:()=>{S.invalidateQueries({queryKey:[`user-email-preferences`]}),N(!1),n(e(`notifications.userEmail.saveSuccess`),`success`)},onError:t=>{n(t.message||e(`notifications.userEmail.saveError`),`error`)}}),V=(e,t)=>{e(!t),N(!0)};return z||F||L?(0,x.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,x.jsx)(l,{className:`w-8 h-8 animate-spin text-bambu-green`})}):(0,x.jsxs)(`div`,{className:`p-4 md:p-6 max-w-2xl mx-auto`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 mb-6`,children:[(0,x.jsx)(h,{className:`w-7 h-7 text-bambu-green`}),(0,x.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`notifications.userEmail.title`)})]}),(0,x.jsx)(f,{className:`mb-6 border-blue-300 bg-blue-50 dark:border-blue-500/30 dark:bg-blue-500/5`,children:(0,x.jsx)(d,{className:`py-4`,children:(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center bg-blue-100 dark:bg-blue-500/20 flex-shrink-0`,children:(0,x.jsx)(v,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`})}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-white font-medium`,children:e(`notifications.userEmail.emailNotifications`)}),(0,x.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`notifications.userEmail.emailNotificationsDesc`)}),t?.email?(0,x.jsxs)(`p`,{className:`text-sm text-blue-700 dark:text-blue-400 mt-2`,children:[e(`notifications.userEmail.sendingTo`),`: `,(0,x.jsx)(`strong`,{children:t.email})]}):(0,x.jsx)(`p`,{className:`text-sm text-yellow-700 dark:text-yellow-400 mt-2`,children:e(`notifications.userEmail.noEmailWarning`)})]})]})})}),(0,x.jsxs)(f,{className:`mb-6`,children:[(0,x.jsxs)(u,{children:[(0,x.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`notifications.userEmail.printJobNotifications`)}),(0,x.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`notifications.userEmail.printJobNotificationsDesc`)})]}),(0,x.jsxs)(d,{className:`space-y-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${w?`bg-bambu-green/20`:`bg-bambu-dark-tertiary`}`,children:(0,x.jsx)(m,{className:`w-5 h-5 ${w?`text-bambu-green`:`text-bambu-gray`}`})}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-white font-medium`,children:e(`notifications.userEmail.printJobStarts`)}),(0,x.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`notifications.userEmail.printJobStartsDesc`)})]})]}),(0,x.jsx)(`button`,{onClick:()=>V(T,w),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${w?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,role:`switch`,"aria-checked":w,children:(0,x.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${w?`translate-x-6`:`translate-x-1`}`})})]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${E?`bg-bambu-green/20`:`bg-bambu-dark-tertiary`}`,children:(0,x.jsx)(m,{className:`w-5 h-5 ${E?`text-bambu-green`:`text-bambu-gray`}`})}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-white font-medium`,children:e(`notifications.userEmail.printJobFinishes`)}),(0,x.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`notifications.userEmail.printJobFinishesDesc`)})]})]}),(0,x.jsx)(`button`,{onClick:()=>V(D,E),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${E?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,role:`switch`,"aria-checked":E,children:(0,x.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${E?`translate-x-6`:`translate-x-1`}`})})]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${O?`bg-bambu-green/20`:`bg-bambu-dark-tertiary`}`,children:(0,x.jsx)(m,{className:`w-5 h-5 ${O?`text-bambu-green`:`text-bambu-gray`}`})}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-white font-medium`,children:e(`notifications.userEmail.printErrors`)}),(0,x.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`notifications.userEmail.printErrorsDesc`)})]})]}),(0,x.jsx)(`button`,{onClick:()=>V(k,O),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${O?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,role:`switch`,"aria-checked":O,children:(0,x.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${O?`translate-x-6`:`translate-x-1`}`})})]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${A?`bg-bambu-green/20`:`bg-bambu-dark-tertiary`}`,children:(0,x.jsx)(m,{className:`w-5 h-5 ${A?`text-bambu-green`:`text-bambu-gray`}`})}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-white font-medium`,children:e(`notifications.userEmail.printJobStops`)}),(0,x.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`notifications.userEmail.printJobStopsDesc`)})]})]}),(0,x.jsx)(`button`,{onClick:()=>V(j,A),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${A?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,role:`switch`,"aria-checked":A,children:(0,x.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${A?`translate-x-6`:`translate-x-1`}`})})]})]})]}),(0,x.jsx)(`div`,{className:`flex justify-end`,children:(0,x.jsx)(p,{onClick:()=>B.mutate(),disabled:!M||B.isPending||!t?.email,children:B.isPending?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l,{className:`w-4 h-4 animate-spin`}),e(`common.saving`)]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(g,{className:`w-4 h-4`}),e(`common.save`)]})})})]})}export{S as NotificationsPage}; \ No newline at end of file diff --git a/static/assets/OrbitControls-Bbqf07B-.js b/static/assets/OrbitControls-Bbqf07B-.js new file mode 100644 index 000000000..78fe29884 --- /dev/null +++ b/static/assets/OrbitControls-Bbqf07B-.js @@ -0,0 +1,3947 @@ +import{n as e}from"./chunk-aKtaBQYM.js";var t={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},r=`attached`,i=`detached`,a=1e3,o=1001,s=1002,c=1003,l=1004,u=1004,d=1005,f=1005,p=1006,m=1007,h=1007,g=1008,_=1008,v=1009,y=1010,b=1011,x=1012,S=1013,C=1014,w=1015,T=1016,E=1017,D=1018,ee=1020,O=35902,k=35899,te=1021,ne=1022,A=1023,re=1026,j=1027,M=1028,ie=1029,ae=1030,oe=1031,se=1032,ce=1033,le=33776,ue=33777,N=33778,de=33779,fe=35840,pe=35841,me=35842,he=35843,ge=36196,_e=37492,ve=37496,ye=37808,be=37809,xe=37810,Se=37811,Ce=37812,we=37813,Te=37814,Ee=37815,P=37816,De=37817,Oe=37818,ke=37819,F=37820,Ae=37821,I=36492,L=36494,je=36495,Me=36283,Ne=36284,Pe=36285,Fe=36286,Ie=2200,Le=2201,Re=2202,ze=2300,Be=2301,Ve=2302,He=2400,Ue=2401,We=2402,Ge=2500,Ke=2501,qe=3200,Je=3201,Ye=3202,Xe=3203,Ze=`srgb`,Qe=`srgb-linear`,$e=`linear`,et=`srgb`,tt=7680,nt=7681,rt=7682,it=7683,at=34055,ot=34056,st=5386,ct=35044,lt=35048,ut=35040,dt=35045,ft=35049,pt=35041,mt=35046,ht=35050,gt=35042,_t=`300 es`,vt=2e3,yt=2001,bt={COMPUTE:`compute`,RENDER:`render`},xt={PERSPECTIVE:`perspective`,LINEAR:`linear`,FLAT:`flat`},St={NORMAL:`normal`,CENTROID:`centroid`,SAMPLE:`sample`,FIRST:`first`,EITHER:`either`};function Ct(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var wt={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Tt(e,t){return new wt[e](t)}function Et(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function Dt(){let e=Et(`canvas`);return e.style.display=`block`,e}var Ot={},kt=null;function At(e){kt=e}function jt(){return kt}function Mt(...e){let t=`THREE.`+e.shift();kt?kt(`log`,t,...e):console.log(t,...e)}function R(...e){let t=`THREE.`+e.shift();kt?kt(`warn`,t,...e):console.warn(t,...e)}function z(...e){let t=`THREE.`+e.shift();kt?kt(`error`,t,...e):console.error(t,...e)}function Nt(...e){let t=e.join(` `);t in Ot||(Ot[t]=!0,R(...e))}function Pt(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}var Ft=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+It[e>>16&255]+It[e>>24&255]+`-`+It[t&255]+It[t>>8&255]+`-`+It[t>>16&15|64]+It[t>>24&255]+`-`+It[n&63|128]+It[n>>8&255]+`-`+It[n>>16&255]+It[n>>24&255]+It[r&255]+It[r>>8&255]+It[r>>16&255]+It[r>>24&255]).toLowerCase()}function B(e,t,n){return Math.max(t,Math.min(n,e))}function Vt(e,t){return(e%t+t)%t}function Ht(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function Ut(e,t,n){return e===t?0:(n-e)/(t-e)}function Wt(e,t,n){return(1-n)*e+n*t}function Gt(e,t,n,r){return Wt(e,t,1-Math.exp(-n*r))}function Kt(e,t=1){return t-Math.abs(Vt(e,t*2)-t)}function qt(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Jt(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Yt(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Xt(e,t){return e+Math.random()*(t-e)}function Zt(e){return e*(.5-Math.random())}function Qt(e){e!==void 0&&(Lt=e);let t=Lt+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function $t(e){return e*Rt}function en(e){return e*zt}function tn(e){return(e&e-1)==0&&e!==0}function nn(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function rn(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function an(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:R(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function on(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function V(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var sn={DEG2RAD:Rt,RAD2DEG:zt,generateUUID:Bt,clamp:B,euclideanModulo:Vt,mapLinear:Ht,inverseLerp:Ut,lerp:Wt,damp:Gt,pingpong:Kt,smoothstep:qt,smootherstep:Jt,randInt:Yt,randFloat:Xt,randFloatSpread:Zt,seededRandom:Qt,degToRad:$t,radToDeg:en,isPowerOfTwo:tn,ceilPowerOfTwo:nn,floorPowerOfTwo:rn,setQuaternionFromProperEuler:an,normalize:V,denormalize:on},H=class e{constructor(t=0,n=0){e.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=B(this.x,e.x,t.x),this.y=B(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=B(this.x,e,t),this.y=B(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(B(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(B(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},cn=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(o<=0){e[t+0]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u;return}if(o>=1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:R(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(B(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},U=class e{constructor(t=0,n=0,r=0){e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(un.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(un.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=B(this.x,e.x,t.x),this.y=B(this.y,e.y,t.y),this.z=B(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=B(this.x,e,t),this.y=B(this.y,e,t),this.z=B(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(B(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ln.copy(this).projectOnVector(e),this.sub(ln)}reflect(e){return this.sub(ln.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(B(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},ln=new U,un=new cn,W=class e{constructor(t,n,r,i,a,o,s,c,l){e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(dn.makeScale(e,t)),this}rotate(e){return this.premultiply(dn.makeRotation(-e)),this}translate(e,t){return this.premultiply(dn.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},dn=new W,fn=new W().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),pn=new W().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function mn(){let e={enabled:!0,workingColorSpace:Qe,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=hn(e.r),e.g=hn(e.g),e.b=hn(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=gn(e.r),e.g=gn(e.g),e.b=gn(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?$e:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return Nt(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return Nt(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Qe]:{primaries:t,whitePoint:r,transfer:$e,toXYZ:fn,fromXYZ:pn,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Ze},outputColorSpaceConfig:{drawingBufferColorSpace:Ze}},[Ze]:{primaries:t,whitePoint:r,transfer:et,toXYZ:fn,fromXYZ:pn,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Ze}}}),e}var G=mn();function hn(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function gn(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var _n,vn=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{_n===void 0&&(_n=Et(`canvas`)),_n.width=e.width,_n.height=e.height;let t=_n.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=_n}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=Et(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0}get width(){return this.source.getSize(Cn).x}get height(){return this.source.getSize(Cn).y}get depth(){return this.source.getSize(Cn).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){R(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){R(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case a:e.x-=Math.floor(e.x);break;case o:e.x=e.x<0?0:1;break;case s:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case a:e.y-=Math.floor(e.y);break;case o:e.y=e.y<0?0:1;break;case s:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};wn.DEFAULT_IMAGE=null,wn.DEFAULT_MAPPING=300,wn.DEFAULT_ANISOTROPY=1;var K=class e{constructor(t=0,n=0,r=0,i=1){e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Nn),Nn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Vn),Hn.subVectors(this.max,Vn),Fn.subVectors(e.a,Vn),In.subVectors(e.b,Vn),Ln.subVectors(e.c,Vn),Rn.subVectors(In,Fn),zn.subVectors(Ln,In),Bn.subVectors(Fn,Ln);let t=[0,-Rn.z,Rn.y,0,-zn.z,zn.y,0,-Bn.z,Bn.y,Rn.z,0,-Rn.x,zn.z,0,-zn.x,Bn.z,0,-Bn.x,-Rn.y,Rn.x,0,-zn.y,zn.x,0,-Bn.y,Bn.x,0];return!Gn(t,Fn,In,Ln,Hn)||(t=[1,0,0,0,1,0,0,0,1],!Gn(t,Fn,In,Ln,Hn))?!1:(Un.crossVectors(Rn,zn),t=[Un.x,Un.y,Un.z],Gn(t,Fn,In,Ln,Hn))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Nn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Nn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Mn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Mn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Mn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Mn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Mn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Mn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Mn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Mn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Mn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Mn=[new U,new U,new U,new U,new U,new U,new U,new U],Nn=new U,Pn=new jn,Fn=new U,In=new U,Ln=new U,Rn=new U,zn=new U,Bn=new U,Vn=new U,Hn=new U,Un=new U,Wn=new U;function Gn(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){Wn.fromArray(e,a);let o=i.x*Math.abs(Wn.x)+i.y*Math.abs(Wn.y)+i.z*Math.abs(Wn.z),s=t.dot(Wn),c=n.dot(Wn),l=r.dot(Wn);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var Kn=new jn,qn=new U,Jn=new U,Yn=class{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?Kn.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;qn.subVectors(e,this.center);let t=qn.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(qn,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Jn.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(qn.copy(e.center).add(Jn)),this.expandByPoint(qn.copy(e.center).sub(Jn))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Xn=new U,Zn=new U,Qn=new U,$n=new U,er=new U,tr=new U,nr=new U,rr=class{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Xn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Xn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Xn.copy(this.origin).addScaledVector(this.direction,t),Xn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Zn.copy(e).add(t).multiplyScalar(.5),Qn.copy(t).sub(e).normalize(),$n.copy(this.origin).sub(Zn);let i=e.distanceTo(t)*.5,a=-this.direction.dot(Qn),o=$n.dot(this.direction),s=-$n.dot(Qn),c=$n.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Zn).addScaledVector(Qn,d),f}intersectSphere(e,t){Xn.subVectors(e.center,this.origin);let n=Xn.dot(this.direction),r=Xn.dot(Xn)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Xn)!==null}intersectTriangle(e,t,n,r,i){er.subVectors(t,e),tr.subVectors(n,e),nr.crossVectors(er,tr);let a=this.direction.dot(nr),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;$n.subVectors(this.origin,e);let s=o*this.direction.dot(tr.crossVectors($n,tr));if(s<0)return null;let c=o*this.direction.dot(er.cross($n));if(c<0||s+c>a)return null;let l=-o*$n.dot(nr);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},q=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/ir.setFromMatrixColumn(e,0).length(),i=1/ir.setFromMatrixColumn(e,1).length(),a=1/ir.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(or,e,sr)}lookAt(e,t,n){let r=this.elements;return ur.subVectors(e,t),ur.lengthSq()===0&&(ur.z=1),ur.normalize(),cr.crossVectors(n,ur),cr.lengthSq()===0&&(Math.abs(n.z)===1?ur.x+=1e-4:ur.z+=1e-4,ur.normalize(),cr.crossVectors(n,ur)),cr.normalize(),lr.crossVectors(ur,cr),r[0]=cr.x,r[4]=lr.x,r[8]=ur.x,r[1]=cr.y,r[5]=lr.y,r[9]=ur.y,r[2]=cr.z,r[6]=lr.z,r[10]=ur.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],ee=r[13],O=r[2],k=r[6],te=r[10],ne=r[14],A=r[3],re=r[7],j=r[11],M=r[15];return i[0]=a*x+o*T+s*O+c*A,i[4]=a*S+o*E+s*k+c*re,i[8]=a*C+o*D+s*te+c*j,i[12]=a*w+o*ee+s*ne+c*M,i[1]=l*x+u*T+d*O+f*A,i[5]=l*S+u*E+d*k+f*re,i[9]=l*C+u*D+d*te+f*j,i[13]=l*w+u*ee+d*ne+f*M,i[2]=p*x+m*T+h*O+g*A,i[6]=p*S+m*E+h*k+g*re,i[10]=p*C+m*D+h*te+g*j,i[14]=p*w+m*ee+h*ne+g*M,i[3]=_*x+v*T+y*O+b*A,i[7]=_*S+v*E+y*k+b*re,i[11]=_*C+v*D+y*te+b*j,i[15]=_*w+v*ee+y*ne+b*M,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=u*h*c-m*d*c+m*s*f-o*h*f-u*s*g+o*d*g,v=p*d*c-l*h*c-p*s*f+a*h*f+l*s*g-a*d*g,y=l*m*c-p*u*c+p*o*f-a*m*f-l*o*g+a*u*g,b=p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h,x=t*_+n*v+r*y+i*b;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/x;return e[0]=_*S,e[1]=(m*d*i-u*h*i-m*r*f+n*h*f+u*r*g-n*d*g)*S,e[2]=(o*h*i-m*s*i+m*r*c-n*h*c-o*r*g+n*s*g)*S,e[3]=(u*s*i-o*d*i-u*r*c+n*d*c+o*r*f-n*s*f)*S,e[4]=v*S,e[5]=(l*h*i-p*d*i+p*r*f-t*h*f-l*r*g+t*d*g)*S,e[6]=(p*s*i-a*h*i-p*r*c+t*h*c+a*r*g-t*s*g)*S,e[7]=(a*d*i-l*s*i+l*r*c-t*d*c-a*r*f+t*s*f)*S,e[8]=y*S,e[9]=(p*u*i-l*m*i-p*n*f+t*m*f+l*n*g-t*u*g)*S,e[10]=(a*m*i-p*o*i+p*n*c-t*m*c-a*n*g+t*o*g)*S,e[11]=(l*o*i-a*u*i-l*n*c+t*u*c+a*n*f-t*o*f)*S,e[12]=b*S,e[13]=(l*m*r-p*u*r+p*n*d-t*m*d-l*n*h+t*u*h)*S,e[14]=(p*o*r-a*m*r-p*n*s+t*m*s+a*n*h-t*o*h)*S,e[15]=(a*u*r-l*o*r+l*n*s-t*u*s-a*n*d+t*o*d)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=ir.set(r[0],r[1],r[2]).length(),a=ir.set(r[4],r[5],r[6]).length(),o=ir.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],ar.copy(this);let s=1/i,c=1/a,l=1/o;return ar.elements[0]*=s,ar.elements[1]*=s,ar.elements[2]*=s,ar.elements[4]*=c,ar.elements[5]*=c,ar.elements[6]*=c,ar.elements[8]*=l,ar.elements[9]*=l,ar.elements[10]*=l,t.setFromRotationMatrix(ar),n.x=i,n.y=a,n.z=o,this}makePerspective(e,t,n,r,i,a,o=vt,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=vt,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},ir=new U,ar=new q,or=new U(0,0,0),sr=new U(1,1,1),cr=new U,lr=new U,ur=new U,dr=new q,fr=new cn,pr=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(B(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-B(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(B(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-B(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(B(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-B(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:R(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return dr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(dr,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fr.setFromEuler(this),this.setFromQuaternion(fr,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};pr.DEFAULT_ORDER=`XYZ`;var mr=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Ar.subVectors(r,t),jr.subVectors(n,t),Mr.subVectors(e,t);let a=Ar.dot(Ar),o=Ar.dot(jr),s=Ar.dot(Mr),c=jr.dot(jr),l=jr.dot(Mr),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Nr)===null?!1:Nr.x>=0&&Nr.y>=0&&Nr.x+Nr.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Nr)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Nr.x),s.addScaledVector(a,Nr.y),s.addScaledVector(o,Nr.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Br.setScalar(0),Vr.setScalar(0),Hr.setScalar(0),Br.fromBufferAttribute(e,t),Vr.fromBufferAttribute(e,n),Hr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Br,i.x),a.addScaledVector(Vr,i.y),a.addScaledVector(Hr,i.z),a}static isFrontFacing(e,t,n,r){return Ar.subVectors(n,t),jr.subVectors(e,t),Ar.cross(jr).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ar.subVectors(this.c,this.b),jr.subVectors(this.a,this.b),Ar.cross(jr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Pr.subVectors(r,n),Fr.subVectors(i,n),Lr.subVectors(e,n);let s=Pr.dot(Lr),c=Fr.dot(Lr);if(s<=0&&c<=0)return t.copy(n);Rr.subVectors(e,r);let l=Pr.dot(Rr),u=Fr.dot(Rr);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(Pr,a);zr.subVectors(e,i);let f=Pr.dot(zr),p=Fr.dot(zr);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Fr,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return Ir.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(Ir,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Pr,a).addScaledVector(Fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Wr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Gr={h:0,s:0,l:0},Kr={h:0,s:0,l:0};function qr(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var Y=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ze){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,G.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=G.workingColorSpace){return this.r=e,this.g=t,this.b=n,G.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=G.workingColorSpace){if(e=Vt(e,1),t=B(t,0,1),n=B(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=qr(i,r,e+1/3),this.g=qr(i,r,e),this.b=qr(i,r,e-1/3)}return G.colorSpaceToWorking(this,r),this}setStyle(e,t=Ze){function n(t){t!==void 0&&parseFloat(t)<1&&R(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:R(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);R(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ze){let n=Wr[e.toLowerCase()];return n===void 0?R(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=hn(e.r),this.g=hn(e.g),this.b=hn(e.b),this}copyLinearToSRGB(e){return this.r=gn(e.r),this.g=gn(e.g),this.b=gn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ze){return G.workingToColorSpace(Jr.copy(this),e),Math.round(B(Jr.r*255,0,255))*65536+Math.round(B(Jr.g*255,0,255))*256+Math.round(B(Jr.b*255,0,255))}getHexString(e=Ze){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=G.workingColorSpace){G.workingToColorSpace(Jr.copy(this),t);let n=Jr.r,r=Jr.g,i=Jr.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){R(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){R(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},Zr=class extends Xr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new pr,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Qr=$r();function $r(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[e|256]=32768,i[e]=24,i[e|256]=24):t<-14?(r[e]=1024>>-t-14,r[e|256]=1024>>-t-14|32768,i[e]=-t-1,i[e|256]=-t-1):t<=15?(r[e]=t+15<<10,r[e|256]=t+15<<10|32768,i[e]=13,i[e|256]=13):t<128?(r[e]=31744,r[e|256]=64512,i[e]=24,i[e|256]=24):(r[e]=31744,r[e|256]=64512,i[e]=13,i[e|256]=13)}let a=new Uint32Array(2048),o=new Uint32Array(64),s=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(t&8388608);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)e!==32&&(s[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:a,exponentTable:o,offsetTable:s}}function ei(e){Math.abs(e)>65504&&R(`DataUtils.toHalfFloat(): Value out of range.`),e=B(e,-65504,65504),Qr.floatView[0]=e;let t=Qr.uint32View[0],n=t>>23&511;return Qr.baseTable[n]+((t&8388607)>>Qr.shiftTable[n])}function ti(e){let t=e>>10;return Qr.uint32View[0]=Qr.mantissaTable[Qr.offsetTable[t]+(e&1023)]+Qr.exponentTable[t],Qr.floatView[0]}var ni=class{static toHalfFloat(e){return ei(e)}static fromHalfFloat(e){return ti(e)}},ri=new U,ii=new H,ai=0,oi=class{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ai++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=ct,this.updateRanges=[],this.gpuType=w,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rt.count&&R(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new jn);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){z(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(Si.copy(i).invert(),Ci.copy(e.ray).applyMatrix4(Si),!(n.boundingBox!==null&&Ci.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ci)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:Mi.clone(),object:e}}function Fi(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,Ei),e.getVertexPosition(c,Di),e.getVertexPosition(l,Oi);let u=Pi(e,t,n,r,Ei,Di,Oi,ji);if(u){let e=new U;Ur.getBarycoord(ji,Ei,Di,Oi,e),i&&(u.uv=Ur.getInterpolatedAttribute(i,s,c,l,e,new H)),a&&(u.uv1=Ur.getInterpolatedAttribute(a,s,c,l,e,new H)),o&&(u.normal=Ur.getInterpolatedAttribute(o,s,c,l,e,new U),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new U,materialIndex:0};Ur.getNormal(Ei,Di,Oi,t.normal),u.face=t,u.barycoord=e}return u}var Ii=class e extends Z{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new X(c,3)),this.setAttribute(`normal`,new X(l,3)),this.setAttribute(`uv`,new X(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new U;for(let a=0;a0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},Gi=class extends J{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new q,this.projectionMatrix=new q,this.projectionMatrixInverse=new q,this.coordinateSystem=vt,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},Ki=new U,qi=new H,Ji=new H,Yi=class extends Gi{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=zt*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Rt*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return zt*2*Math.atan(Math.tan(Rt*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Ki.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ki.x,Ki.y).multiplyScalar(-e/Ki.z),Ki.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ki.x,Ki.y).multiplyScalar(-e/Ki.z)}getViewSize(e,t){return this.getViewBounds(e,qi,Ji),t.subVectors(Ji,qi)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Rt*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},Xi=-90,Zi=1,Qi=class extends J{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Yi(Xi,Zi,e,t);r.layers=this.layers,this.add(r);let i=new Yi(Xi,Zi,e,t);i.layers=this.layers,this.add(i);let a=new Yi(Xi,Zi,e,t);a.layers=this.layers,this.add(a);let o=new Yi(Xi,Zi,e,t);o.layers=this.layers,this.add(o);let s=new Yi(Xi,Zi,e,t);s.layers=this.layers,this.add(s);let c=new Yi(Xi,Zi,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,s),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},$i=class extends wn{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},ea=class extends En{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new $i(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new Ii(5,5,5),i=new Wi({name:`CubemapFromEquirect`,uniforms:Li(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new Ni(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=p),new Qi(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}},ta=class extends J{constructor(){super(),this.isGroup=!0,this.type=`Group`}},na={type:`move`},ra=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ta,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ta,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ta,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(na)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new ta;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},ia=class e{constructor(e,t=25e-5){this.isFogExp2=!0,this.name=``,this.color=new Y(e),this.density=t}clone(){return new e(this.color,this.density)}toJSON(){return{type:`FogExp2`,name:this.name,color:this.color.getHex(),density:this.density}}},aa=class e{constructor(e,t=1,n=1e3){this.isFog=!0,this.name=``,this.color=new Y(e),this.near=t,this.far=n}clone(){return new e(this.color,this.near,this.far)}toJSON(){return{type:`Fog`,name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},oa=class extends J{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new pr,this.environmentIntensity=1,this.environmentRotation=new pr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},sa=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=ct,this.updateRanges=[],this.version=0,this.uuid=Bt()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;re.far||t.push({distance:s,point:fa.clone(),uv:Ur.getInterpolation(fa,va,ya,ba,xa,Sa,Ca,new H),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function Ta(e,t,n,r,i,a){ha.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?ga.copy(ha):(ga.x=a*ha.x-i*ha.y,ga.y=i*ha.x+a*ha.y),e.copy(t),e.x+=ga.x,e.y+=ga.y,e.applyMatrix4(_a)}var Ea=new U,Da=new U,Oa=class extends J{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type=`LOD`,Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e0){let n,r;for(n=1,r=t.length;n0){Ea.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo(Ea);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){Ea.setFromMatrixPosition(e.matrixWorld),Da.setFromMatrixPosition(this.matrixWorld);let n=Ea.distanceTo(Da)/e.zoom;t[0].object.visible=!0;let r,i;for(r=1,i=t.length;r=e)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||to.getNormalMatrix(e),r=this.coplanarPoint($a).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},ro=new Yn,io=new H(.5,.5),ao=new U,oo=class{constructor(e=new no,t=new no,n=new no,r=new no,i=new no,a=new no){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=vt,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),ro.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ro.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ro)}intersectsSprite(e){return ro.center.set(0,0,0),ro.radius=.7071067811865476+io.distanceTo(e.center),ro.applyMatrix4(e.matrixWorld),this.intersectsSphere(ro)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,ao.y=r.normal.y>0?e.max.y:e.min.y,ao.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(ao)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},so=new q,co=new oo,lo=class e{constructor(){this.coordinateSystem=vt}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let o=i[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}},ho=new q,go=new Y(1,1,1),_o=new oo,vo=new lo,yo=new jn,bo=new Yn,xo=new U,So=new U,Co=new U,wo=new mo,To=new Ni,Eo=[];function Do(e,t,n=0){let r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let i=e.count;for(let a=0;a65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new oi(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error(`THREE.BatchedMesh: All geometries must consistently have "index".`);for(let n in t.attributes){if(!e.hasAttribute(n))throw Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let r=e.getAttribute(n),i=t.getAttribute(n);if(r.itemSize!==i.itemSize||r.normalized!==i.normalized)throw Error(`THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.`)}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new jn);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw Error(`THREE.BatchedMesh: Maximum item count reached.`);let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(uo),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let r=this._matricesTexture;ho.identity().toArray(r.image.data,n*16),r.needsUpdate=!0;let i=this._colorsTexture;return i&&(go.toArray(i.image.data,n*4),i.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},i=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute(`position`).count:t;let a=e.getIndex();if(a!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=n===-1?a.count:n),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error(`THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.`);let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(uo),o=this._availableGeometryIds.shift(),i[o]=r):(o=this._geometryCount,this._geometryCount++,i.push(r)),this.setGeometryAt(o,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,o}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error(`THREE.BatchedMesh: Maximum geometry count reached.`);this._validateGeometry(t);let n=this.geometry,r=n.getIndex()!==null,i=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(r&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw Error(`THREE.BatchedMesh: Reserved space not large enough for provided geometry.`);let s=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=t.getAttribute(`position`).count;for(let e in n.attributes){let r=t.getAttribute(e),i=n.getAttribute(e);Do(r,i,s);let a=r.itemSize;for(let e=r.count,t=c;e=t.length||t[e].active===!1)return this;let n=this._instanceInfo;for(let t=0,r=n.length;tt).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),i=this.geometry;for(let a=0,o=n.length;a=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){let e=new jn,t=n.index,i=n.attributes.position;for(let n=r.start,a=r.start+r.count;n=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){let t=new Yn;this.getBoundingBoxAt(e,yo),yo.getCenter(t.center);let i=n.index,a=n.attributes.position,o=0;for(let e=r.start,n=r.start+r.count;ee.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);let r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Z,this._initializeGeometry(r));let i=this.geometry;r.index&&Oo(r.index.array,i.index.array);for(let e in r.attributes)Oo(r.attributes[e].array,i.attributes[e].array)}raycast(e,t){let n=this._instanceInfo,r=this._geometryInfo,i=this.matrixWorld,a=this.geometry;To.material=this.material,To.geometry.index=a.index,To.geometry.attributes=a.attributes,To.geometry.boundingBox===null&&(To.geometry.boundingBox=new jn),To.geometry.boundingSphere===null&&(To.geometry.boundingSphere=new Yn);for(let a=0,o=n.length;a({...e,boundingBox:e.boundingBox===null?null:e.boundingBox.clone(),boundingSphere:e.boundingSphere===null?null:e.boundingSphere.clone()})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,i){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=r.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,s=this._instanceInfo,c=this._multiDrawStarts,l=this._multiDrawCounts,u=this._geometryInfo,d=this.perObjectFrustumCulled,f=this._indirectTexture,p=f.image.data,m=n.isArrayCamera?vo:_o;d&&!n.isArrayCamera&&(ho.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),_o.setFromProjectionMatrix(ho,n.coordinateSystem,n.reversedDepth));let h=0;if(this.sortObjects){ho.copy(this.matrixWorld).invert(),xo.setFromMatrixPosition(n.matrixWorld).applyMatrix4(ho),So.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(ho);for(let e=0,t=s.length;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;Io.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(Io);if(!(ct.far))return{distance:c,point:Lo.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var Bo=new U,Vo=new U,Ho=class extends Ro{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var Zo=class extends wn{constructor(e,t,n,r,i=p,a=p,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let l=this;function u(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}`requestVideoFrameCallback`in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!(`requestVideoFrameCallback`in e)&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},Qo=class extends Zo{constructor(e,t,n,r,i,a,o,s){super({},e,t,n,r,i,a,o,s),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}},$o=class extends wn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=c,this.minFilter=c,this.generateMipmaps=!1,this.needsUpdate=!0}},es=class extends wn{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}},ts=class extends es{constructor(e,t,n,r,i,a){super(e,t,n,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=o,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},ns=class extends es{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}},rs=class extends wn{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},is=class extends wn{constructor(e,t,n=C,r,i,a,o=c,s=c,l,u=re,d=1){if(u!==1026&&u!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:d},r,i,a,o,s,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new bn(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},as=class extends wn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},os=class e extends Z{constructor(e=1,t=1,n=4,r=8,i=1){super(),this.type=`CapsuleGeometry`,this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:i},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r)),i=Math.max(1,Math.floor(i));let a=[],o=[],s=[],c=[],l=t/2,u=Math.PI/2*e,d=t,f=2*u+d,p=n*2+i,m=r+1,h=new U,g=new U;for(let _=0;_<=p;_++){let v=0,y=0,b=0,x=0;if(_<=n){let t=_/n,r=t*Math.PI/2;y=-l-e*Math.cos(r),b=e*Math.sin(r),x=-e*Math.cos(r),v=t*u}else if(_<=n+i){let r=(_-n)/i;y=-l+r*t,b=e,x=0,v=u+r*d}else{let t=(_-n-i)/n,r=t*Math.PI/2;y=l+e*Math.sin(r),b=e*Math.cos(r),x=e*Math.sin(r),v=u+d+t*u}let S=Math.max(0,Math.min(1,v/f)),C=0;_===0?C=.5/r:_===p&&(C=-.5/r);for(let e=0;e<=r;e++){let t=e/r,n=t*Math.PI*2,i=Math.sin(n),a=Math.cos(n);g.x=-b*a,g.y=y,g.z=b*i,o.push(g.x,g.y,g.z),h.set(-b*a,x,b*i),h.normalize(),s.push(h.x,h.y,h.z),c.push(t+C,S)}if(_>0){let e=(_-1)*m;for(let t=0;t0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new X(u,3)),this.setAttribute(`normal`,new X(d,3)),this.setAttribute(`uv`,new X(f,2));function _(){let a=new U,_=new U,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new H,m=new U,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e.9&&Math.min(t,n,r)<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}function d(e){i.push(e.x,e.y,e.z)}function f(t,n){let r=t*3;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function p(){let e=new U,t=new U,n=new U,r=new U,o=new H,s=new H,c=new H;for(let l=0,u=0;l0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new H:new U);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new U,r=[],i=[],a=[],o=new U,s=new q;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new U)}i[0]=new U,a[0]=new U;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(B(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(B(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},vs=class extends _s{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type=`EllipseCurve`,this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new H){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},ys=class extends vs{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}};function bs(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}var xs=new U,Ss=new bs,Cs=new bs,ws=new bs,Ts=class extends _s{constructor(e=[],t=!1,n=`centripetal`,r=.5){super(),this.isCatmullRomCurve3=!0,this.type=`CatmullRomCurve3`,this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new U){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(xs.subVectors(r[0],r[1]).add(r[0]),c=xs);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Es(o,s.x,c.x,l.x,u.x),Es(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){let e=r[i]-n,a=this.curves[i],o=a.getLength(),s=o===0?0:1-e/o;return a.getPointAt(s,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Ks=class extends Gs{constructor(e){super(e),this.uuid=Bt(),this.type=`Shape`,this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;at&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return Xs(a,o,n,s,c,l,0),o}function Js(e,t,n,r,i){let a;if(i===Tc(e,t,n,r)>0)for(let i=t;i=t;i-=r)a=Sc(i/r|0,e[i],e[i+1],a);return a&&mc(a,a.next)&&(Cc(a),a=a.next),a}function Ys(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(mc(n,n.next)||pc(n.prev,n,n.next)===0)){if(Cc(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Xs(e,t,n,r,i,a,o){if(!e)return;!o&&a&&oc(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?Qs(e,r,i,a):Zs(e)){t.push(c.i,e.i,l.i),Cc(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=$s(Ys(e),t),Xs(e,t,n,r,i,a,2)):o===2&&ec(e,t,n,r,i,a):Xs(Ys(e),t,n,r,i,a,1);break}}}function Zs(e){let t=e.prev,n=e,r=e.next;if(pc(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&dc(i,s,a,c,o,l,m.x,m.y)&&pc(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Qs(e,t,n,r){let i=e.prev,a=e,o=e.next;if(pc(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=cc(p,m,t,n,r),v=cc(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&dc(s,u,c,d,l,f,y.x,y.y)&&pc(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&dc(s,u,c,d,l,f,b.x,b.y)&&pc(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&dc(s,u,c,d,l,f,y.x,y.y)&&pc(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&dc(s,u,c,d,l,f,b.x,b.y)&&pc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function $s(e,t){let n=e;do{let r=n.prev,i=n.next.next;!mc(r,i)&&hc(r,n,n.next,i)&&yc(r,i)&&yc(i,r)&&(t.push(r.i,n.i,i.i),Cc(n),Cc(n.next),n=e=i),n=n.next}while(n!==e);return Ys(n)}function ec(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&fc(o,e)){let s=xc(o,e);o=Ys(o,o.next),s=Ys(s,s.next),Xs(o,t,n,r,i,a,0),Xs(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function tc(e,t,n,r){let i=[];for(let n=0,a=t.length;n=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x=n.x&&n.x>=c&&r!==n.x&&uc(io.x||n.x===o.x&&ac(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function ac(e,t){return pc(e.prev,e,t.prev)<0&&pc(t.next,e,e.next)<0}function oc(e,t,n,r){let i=e;do i.z===0&&(i.z=cc(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,sc(i)}function sc(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function cc(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function lc(e){let t=e,n=e;do(t.x=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function dc(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&uc(e,t,n,r,i,a,o,s)}function fc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!vc(e,t)&&(yc(e,t)&&yc(t,e)&&bc(e,t)&&(pc(e.prev,e,t.prev)||pc(e,t.prev,t))||mc(e,t)&&pc(e.prev,e,e.next)>0&&pc(t.prev,t,t.next)>0)}function pc(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function mc(e,t){return e.x===t.x&&e.y===t.y}function hc(e,t,n,r){let i=_c(pc(e,t,n)),a=_c(pc(e,t,r)),o=_c(pc(n,r,e)),s=_c(pc(n,r,t));return!!(i!==a&&o!==s||i===0&&gc(e,n,t)||a===0&&gc(e,r,t)||o===0&&gc(n,e,r)||s===0&&gc(n,t,r))}function gc(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function _c(e){return e>0?1:e<0?-1:0}function vc(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&hc(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function yc(e,t){return pc(e.prev,e,e.next)<0?pc(e,t,e.next)>=0&&pc(e,e.prev,t)>=0:pc(e,t,e.prev)<0||pc(e,e.next,t)<0}function bc(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function xc(e,t){let n=wc(e.i,e.x,e.y),r=wc(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Sc(e,t,n,r){let i=wc(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Cc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function wc(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Tc(e,t,n,r){let i=0;for(let a=t,o=n-r;a2&&e[t-1].equals(e[0])&&e.pop()}function kc(e,t){for(let n=0;n2**-52){let d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=t.x-s/d,m=t.y+o/d,h=n.x-l/f,g=n.y+c/f,_=((h-p)*l-(g-m)*c)/(o*l-s*c);r=p+o*_-e.x,i=m+s*_-e.y;let v=r*r+i*i;if(v<=2)return new H(r,i);a=Math.sqrt(v/2)}else{let e=!1;o>2**-52?c>2**-52&&(e=!0):o<-(2**-52)?c<-(2**-52)&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new H(r/a,i/a)}let te=[];for(let e=0,t=D.length,n=t-1,r=e+1;e=0;e--){let t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+f;for(let e=0,t=D.length;e=0;){let r=n,i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+p*2;e0)&&f.push(t,i,c),(e!==n-1||s0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},Qc=class extends Xr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=`MeshPhongMaterial`,this.color=new Y(16777215),this.specular=new Y(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new H(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new pr,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},$c=class extends Xr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:``},this.type=`MeshToonMaterial`,this.color=new Y(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new H(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},el=class extends Xr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type=`MeshNormalMaterial`,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new H(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},tl=class extends Xr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type=`MeshLambertMaterial`,this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new H(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new pr,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},nl=class extends Xr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=qe,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},rl=class extends Xr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},il=class extends Xr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:``},this.type=`MeshMatcapMaterial`,this.color=new Y(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new H(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:``},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},al=class extends Ao{constructor(e){super(),this.isLineDashedMaterial=!0,this.type=`LineDashedMaterial`,this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function ol(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function sl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function cl(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function ll(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function ul(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}function dl(e,t,n,r,i=30){let a=e.clone();a.name=t;let o=[];for(let e=0;e=r)){c.push(t.times[e]);for(let n=0;na.tracks[e].times[0]&&(s=a.tracks[e].times[0]);for(let e=0;e=r.times[d]){let e=d*c+s,t=e+c-s;f=r.values.slice(e,t)}else{let e=r.createInterpolant(),t=s,n=c-s;e.evaluate(a),f=e.resultBuffer.slice(t,n)}i===`quaternion`&&new cn().fromArray(f).normalize().conjugate().toArray(f);let p=o.times.length;for(let e=0;e=i)){let o=t[1];e=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n>>1;et;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(z(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(z(`KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){z(`KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){z(`KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&sl(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){z(`KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Ve,i=e.length-1,a=1;for(let o=1;o0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};vl.prototype.ValueTypeName=``,vl.prototype.TimeBufferType=Float32Array,vl.prototype.ValueBufferType=Float32Array,vl.prototype.DefaultInterpolation=Be;var yl=class extends vl{constructor(e,t,n){super(e,t,n)}};yl.prototype.ValueTypeName=`bool`,yl.prototype.ValueBufferType=Array,yl.prototype.DefaultInterpolation=ze,yl.prototype.InterpolantFactoryMethodLinear=void 0,yl.prototype.InterpolantFactoryMethodSmooth=void 0;var bl=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}};bl.prototype.ValueTypeName=`color`;var xl=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}};xl.prototype.ValueTypeName=`number`;var Sl=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)cn.slerpFlat(i,0,a,c-o,a,c,s);return i}},Cl=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new Sl(this.times,this.values,this.getValueSize(),e)}};Cl.prototype.ValueTypeName=`quaternion`,Cl.prototype.InterpolantFactoryMethodSmooth=void 0;var wl=class extends vl{constructor(e,t,n){super(e,t,n)}};wl.prototype.ValueTypeName=`string`,wl.prototype.ValueBufferType=Array,wl.prototype.DefaultInterpolation=ze,wl.prototype.InterpolantFactoryMethodLinear=void 0,wl.prototype.InterpolantFactoryMethodSmooth=void 0;var Tl=class extends vl{constructor(e,t,n,r){super(e,t,n,r)}};Tl.prototype.ValueTypeName=`vector`;var El=class{constructor(e=``,t=-1,n=[],r=Ge){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Bt(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(Ol(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i.userData=JSON.parse(e.userData||`{}`),i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,r=n.length;e!==r;++e)t.push(vl.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(R(`AnimationClip: parseAnimation() is deprecated and will be removed with r185`),!e)return z(`AnimationClip: No animation in JSONLoader data.`),null;let n=function(e,t,n,r,i){if(n.length!==0){let a=[],o=[];ul(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.fps||30,o=e.blendMode,s=e.length||-1,c=e.hierarchy||[];for(let e=0;e{t&&t(i),this.manager.itemEnd(e)},0),i;if(Nl[e]!==void 0){Nl[e].push({onLoad:t,onProgress:n,onError:r});return}Nl[e]=[],Nl[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`,signal:typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&R(`FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=Nl[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e{e.error(t)})}}});return new Response(c)}else throw new Pl(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{kl.add(`file:${e}`,t);let n=Nl[e];delete Nl[e];for(let e=0,r=n.length;e{let n=Nl[e];if(n===void 0)throw this.manager.itemError(e),t;delete Nl[e];for(let e=0,r=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},Il=class extends Ml{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new Fl(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):z(t),i.manager.itemError(e)}},n,r)}parse(e){let t=[];for(let n=0;n0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(let t in e.uniforms){let i=e.uniforms[t];switch(r.uniforms[t]={},i.type){case`t`:r.uniforms[t].value=n(i.value);break;case`c`:r.uniforms[t].value=new Y().setHex(i.value);break;case`v2`:r.uniforms[t].value=new H().fromArray(i.value);break;case`v3`:r.uniforms[t].value=new U().fromArray(i.value);break;case`v4`:r.uniforms[t].value=new K().fromArray(i.value);break;case`m3`:r.uniforms[t].value=new W().fromArray(i.value);break;case`m4`:r.uniforms[t].value=new q().fromArray(i.value);break;default:r.uniforms[t].value=i.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(let t in e.extensions)r.extensions[t]=e.extensions[t];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let t=e.normalScale;Array.isArray(t)===!1&&(t=[t,t]),r.normalScale=new H().fromArray(t)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new H().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=n(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(t){return e.createMaterialFromType(t)}static createMaterialFromType(e){return new{ShadowMaterial:Jc,SpriteMaterial:ua,RawShaderMaterial:Yc,ShaderMaterial:Wi,PointsMaterial:Wo,MeshPhysicalMaterial:Zc,MeshStandardMaterial:Xc,MeshPhongMaterial:Qc,MeshToonMaterial:$c,MeshNormalMaterial:el,MeshLambertMaterial:tl,MeshDepthMaterial:nl,MeshDistanceMaterial:rl,MeshBasicMaterial:Zr,MeshMatcapMaterial:il,LineDashedMaterial:al,LineBasicMaterial:Ao,Material:Xr}[e]}},uu=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},du=class extends Z{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type=`InstancedBufferGeometry`,this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}},fu=class extends Ml{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new Fl(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):z(t),i.manager.itemError(e)}},n,r)}parse(e){let t={},n={};function r(e,n){if(t[n]!==void 0)return t[n];let r=e.interleavedBuffers[n],a=i(e,r.buffer),o=new sa(Tt(r.type,a),r.stride);return o.uuid=r.uuid,t[n]=o,o}function i(e,t){if(n[t]!==void 0)return n[t];let r=e.arrayBuffers[t],i=new Uint32Array(r).buffer;return n[t]=i,i}let a=e.isInstancedBufferGeometry?new du:new Z,o=e.data.index;if(o!==void 0){let e=Tt(o.type,o.array);a.setIndex(new oi(e,1))}let s=e.data.attributes;for(let t in s){let n=s[t],i;if(n.isInterleavedBufferAttribute)i=new la(r(e.data,n.data),n.itemSize,n.offset,n.normalized);else{let e=Tt(n.type,n.array);i=new(n.isInstancedBufferAttribute?Wa:oi)(e,n.itemSize,n.normalized)}n.name!==void 0&&(i.name=n.name),n.usage!==void 0&&i.setUsage(n.usage),a.setAttribute(t,i)}let c=e.data.morphAttributes;if(c)for(let t in c){let n=c[t],i=[];for(let t=0,a=n.length;t0){i=new zl(new Al(t)),i.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){r=new zl(this.manager),r.setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t{let t=null,n=null;return e.boundingBox!==void 0&&(t=new jn().fromJSON(e.boundingBox)),e.boundingSphere!==void 0&&(n=new Yn().fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:n}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new Yn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new jn().fromJSON(e.boundingBox));break;case`LOD`:a=new Oa;break;case`Line`:a=new Ro(o(e.geometry),s(e.material));break;case`LineLoop`:a=new Uo(o(e.geometry),s(e.material));break;case`LineSegments`:a=new Ho(o(e.geometry),s(e.material));break;case`PointCloud`:case`Points`:a=new Yo(o(e.geometry),s(e.material));break;case`Sprite`:a=new wa(s(e.material));break;case`Group`:a=new ta;break;case`Bone`:a=new za;break;default:a=new J}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix===void 0?(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)):(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){let o=e.children;for(let e=0;e`u`&&R(`ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&R(`ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=kl.get(`image-bitmap:${e}`);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{if(_u.has(a)===!0)r&&r(_u.get(a)),i.manager.itemError(e),i.manager.itemEnd(e);else return t&&t(n),i.manager.itemEnd(e),n});return}return setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader,o.signal=typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){return kl.add(`image-bitmap:${e}`,n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),_u.set(s,t),kl.remove(`image-bitmap:${e}`),i.manager.itemError(e),i.manager.itemEnd(e)});kl.add(`image-bitmap:${e}`,s),i.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},yu,bu=class{static getContext(){return yu===void 0&&(yu=new(window.AudioContext||window.webkitAudioContext)),yu}static setContext(e){yu=e}},xu=class extends Ml{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new Fl(this.manager);a.setResponseType(`arraybuffer`),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(e){try{let n=e.slice(0);bu.getContext().decodeAudioData(n,function(e){t(e)}).catch(o)}catch(e){o(e)}},n,r);function o(t){r?r(t):z(t),i.manager.itemError(e)}}},Su=new q,Cu=new q,wu=new q,Tu=class{constructor(){this.type=`StereoCamera`,this.aspect=1,this.eyeSep=.064,this.cameraL=new Yi,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Yi,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,wu.copy(e.projectionMatrix);let n=t.eyeSep/2,r=n*t.near/t.focus,i=t.near*Math.tan(Rt*t.fov*.5)/t.zoom,a,o;Cu.elements[12]=-n,Su.elements[12]=n,a=-i*t.aspect+r,o=i*t.aspect+r,wu.elements[0]=2*t.near/(o-a),wu.elements[8]=(o+a)/(o-a),this.cameraL.projectionMatrix.copy(wu),a=-i*t.aspect-r,o=i*t.aspect-r,wu.elements[0]=2*t.near/(o-a),wu.elements[8]=(o+a)/(o-a),this.cameraR.projectionMatrix.copy(wu)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Cu),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Su)}},Eu=class extends Yi{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},Du=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}},Ou=new U,ku=new cn,Au=new U,ju=new U,Mu=new U,Nu=class extends J{constructor(){super(),this.type=`AudioListener`,this.context=bu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Du}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter===null?this.gain.disconnect(this.context.destination):(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Ou,ku,Au),ju.set(0,0,-1).applyQuaternion(ku),Mu.set(0,1,0).applyQuaternion(ku),t.positionX){let e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ou.x,e),t.positionY.linearRampToValueAtTime(Ou.y,e),t.positionZ.linearRampToValueAtTime(Ou.z,e),t.forwardX.linearRampToValueAtTime(ju.x,e),t.forwardY.linearRampToValueAtTime(ju.y,e),t.forwardZ.linearRampToValueAtTime(ju.z,e),t.upX.linearRampToValueAtTime(Mu.x,e),t.upY.linearRampToValueAtTime(Mu.y,e),t.upZ.linearRampToValueAtTime(Mu.z,e)}else t.setPosition(Ou.x,Ou.y,Ou.z),t.setOrientation(ju.x,ju.y,ju.z,Mu.x,Mu.y,Mu.z)}},Pu=class extends J{constructor(e){super(),this.type=`Audio`,this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType=`empty`,this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType=`audioNode`,this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaNode`,this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaStreamNode`,this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType=`buffer`,this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){R(`Audio: Audio is already playing.`);return}if(this.hasPlaybackControl===!1){R(`Audio: this Audio has no playback control.`);return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){R(`Audio: this Audio has no playback control.`);return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){R(`Audio: this Audio has no playback control.`);return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let e=t,i=t+t;e!==i;++e)if(n[e]!==n[e+t]){o.setValue(n,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let e=n,i=r;e!==i;++e)t[e]=t[r+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let r=0;r!==i;++r)e[t+r]=e[n+r]}_slerp(e,t,n,r){cn.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,i){let a=this._workIndex*i;cn.multiplyQuaternionsFlat(e,a,e,t,e,n),cn.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,n,r,i){let a=1-r;for(let o=0;o!==i;++o){let i=t+o;e[i]=e[i]*a+e[n+o]*r}}_lerpAdditive(e,t,n,r,i){for(let a=0;a!==i;++a){let i=t+a;e[i]=e[i]+e[n+a]*r}}},Hu=`\\[\\]\\.:\\/`,Uu=RegExp(`[\\[\\]\\.:\\/]`,`g`),Wu=`[^\\[\\]\\.:\\/]`,Gu=`[^`+Hu.replace(`\\.`,``)+`]`,Ku=`((?:WC+[\\/:])*)`.replace(`WC`,Wu),qu=`(WCOD+)?`.replace(`WCOD`,Gu),Ju=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,Wu),Yu=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,Wu),Xu=RegExp(`^`+Ku+qu+Ju+Yu+`$`),Zu=[`material`,`materials`,`bones`,`map`],Qu=class{constructor(e,t,n){let r=n||$u.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},$u=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(Uu,``)}static parseTrackName(e){let t=Xu.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);Zu.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;r=i){let a=i++,l=e[a];t[l.uuid]=c,e[c]=l,t[s]=a,e[a]=o;for(let e=0,t=r;e!==t;++e){let t=n[e],r=t[a],i=t[c];t[c]=r,t[a]=i}}}this.nCachedObjects_=i}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length;for(let o=0,s=arguments.length;o!==s;++o){let s=arguments[o].uuid,c=t[s];if(c!==void 0)if(delete t[s],c0&&(t[o.uuid]=c),e[c]=o,e.pop();for(let e=0,t=r;e!==t;++e){let t=n[e];t[c]=t[i],t.pop()}}}this.nCachedObjects_=i}subscribe_(e,t){let n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(r!==void 0)return i[r];let a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(let n=l,r=s.length;n!==r;++n){let r=s[n];u[n]=new $u(r,e,t)}return u}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){let r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}},td=class{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;let i=t.tracks,a=i.length,o=Array(a),s={endingStart:He,endingEnd:He};for(let e=0;e!==a;++e){let t=i[e].createInterpolant(null);o[e]=t,t.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Le,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){let n=this._clip.duration,r=e._clip.duration,i=r/n,a=n/r;e.warp(1,i,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;o===null&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);let s=o.parameterPositions,c=o.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/a,c[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}let i=this._startTime;if(i!==null){let r=(e-i)*n;r<0||n===0?t=0:(this._startTime=null,t=n*r)}t*=this._updateTimeScale(e);let a=this._updateTime(t),o=this._updateWeight(e);if(o>0){let e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case Ke:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulateAdditive(o);break;case Ge:default:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulate(r,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===Re;if(e===0)return i===-1?r:a&&(i&1)==1?t-r:r;if(n===2200){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));handle_stop:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break handle_stop}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){let n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);let o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e>0?1:-1});else{if(o===1){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:`loop`,action:this,loopDelta:n})}}else this.time=r;if(a&&(i&1)==1)return t-r}return r}_setEndings(e,t,n){let r=this._interpolantSettings;n?(r.endingStart=Ue,r.endingEnd=Ue):(e?r.endingStart=this.zeroSlopeAtStart?Ue:He:r.endingStart=We,t?r.endingEnd=this.zeroSlopeAtEnd?Ue:He:r.endingEnd=We)}_scheduleFading(e,t,n){let r=this._mixer,i=r.time,a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}},nd=new Float32Array(1),rd=class extends Ft{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];l===void 0&&(l={},c[s]=l);for(let e=0;e!==i;++e){let i=r[e],c=i.name,u=l[c];if(u!==void 0)++u.referenceCount,a[e]=u;else{if(u=a[e],u!==void 0){u._cacheIndex===null&&(++u.referenceCount,this._addInactiveBinding(u,s,c));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;u=new Vu($u.create(n,c,r),i.ValueTypeName,i.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,s,c),a[e]=u}o[e].resultBuffer=u.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];n.useCount++===0&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];--n.useCount===0&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let o=0;o!==n;++o)t[o]._update(r,e,i,a);let o=this._bindings,s=this._nActiveBindings;for(let e=0;e!==s;++e)o[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,yd).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},xd=new U,Sd=new U,Cd=new U,wd=new U,Td=new U,Ed=new U,Dd=new U,Od=class{constructor(e=new U,t=new U){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){xd.subVectors(e,this.start),Sd.subVectors(this.end,this.start);let n=Sd.dot(Sd),r=Sd.dot(xd)/n;return t&&(r=B(r,0,1)),r}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=Ed,n=Dd){let r=1e-8*1e-8,i,a,o=this.start,s=e.start,c=this.end,l=e.end;Cd.subVectors(c,o),wd.subVectors(l,s),Td.subVectors(o,s);let u=Cd.dot(Cd),d=wd.dot(wd),f=wd.dot(Td);if(u<=r&&d<=r)return t.copy(o),n.copy(s),t.sub(n),t.dot(t);if(u<=r)i=0,a=f/d,a=B(a,0,1);else{let e=Cd.dot(Td);if(d<=r)a=0,i=B(-e/u,0,1);else{let t=Cd.dot(wd),n=u*d-t*t;i=n===0?0:B((t*f-e*d)/n,0,1),a=(t*i+f)/d,a<0?(a=0,i=B(-e/u,0,1)):a>1&&(a=1,i=B((t-e)/u,0,1))}}return t.copy(o).add(Cd.multiplyScalar(i)),n.copy(s).add(wd.multiplyScalar(a)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},kd=new U,Ad=class extends J{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type=`SpotLightHelper`;let n=new Z,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1;e<32;e++,t++){let n=e/32*Math.PI*2,i=t/32*Math.PI*2;r.push(Math.cos(n),Math.sin(n),1,Math.cos(i),Math.sin(i),1)}n.setAttribute(`position`,new X(r,3));let i=new Ao({fog:!1,toneMapped:!1});this.cone=new Ho(n,i),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),kd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(kd),this.color===void 0?this.cone.material.color.copy(this.light.color):this.cone.material.color.set(this.color)}},jd=new U,Md=new q,Nd=new q,Pd=class extends Ho{constructor(e){let t=Fd(e),n=new Z,r=[],i=[];for(let e=0;e1)for(let n=0;n.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{tf.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(tf,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},of=class extends Ho{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Z;r.setAttribute(`position`,new X(t,3)),r.setAttribute(`color`,new X(n,3));let i=new Ao({vertexColors:!0,toneMapped:!1});super(r,i),this.type=`AxesHelper`}setColors(e,t,n){let r=new Y,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},sf=class{constructor(){this.type=`ShapePath`,this.color=new Y,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Gs,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e){let t=[];for(let n=0,r=e.length;n2**-52){if(c<0&&(n=t[a],s=-s,o=t[i],c=-c),e.yo.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{let t=c*(e.x-n.x)-s*(e.y-n.y);if(t===0)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return r}let r=Dc.isClockWise,i=this.subPaths;if(i.length===0)return[];let a,o,s,c=[];if(i.length===1)return o=i[0],s=new Ks,s.curves=o.curves,c.push(s),c;let l=!r(i[0].getPoints());l=e?!l:l;let u=[],d=[],f=[],p=0,m;d[p]=void 0,f[p]=[];for(let t=0,n=i.length;t1){let e=!1,t=0;for(let e=0,t=d.length;e0&&e===!1&&(f=u)}let h;for(let e=0,t=d.length;et?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}function uf(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}function df(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}function ff(e,t,n,r){let i=pf(r);switch(n){case te:return e*t;case M:return e*t/i.components*i.byteLength;case ie:return e*t/i.components*i.byteLength;case ae:return e*t*2/i.components*i.byteLength;case oe:return e*t*2/i.components*i.byteLength;case ne:return e*t*3/i.components*i.byteLength;case A:return e*t*4/i.components*i.byteLength;case ce:return e*t*4/i.components*i.byteLength;case le:case ue:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case N:case de:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case pe:case he:return Math.max(e,16)*Math.max(t,8)/4;case fe:case me:return Math.max(e,8)*Math.max(t,8)/2;case ge:case _e:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case ve:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case ye:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case be:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case xe:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Se:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case Ce:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case we:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case Te:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Ee:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case P:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case De:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Oe:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case ke:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case F:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case Ae:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case I:case L:case je:return Math.ceil(e/4)*Math.ceil(t/4)*16;case Me:case Ne:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Pe:case Fe:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function pf(e){switch(e){case v:case y:return{byteLength:1,components:1};case x:case b:case T:return{byteLength:2,components:1};case E:case D:return{byteLength:2,components:4};case C:case S:case w:return{byteLength:4,components:1};case O:case k:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${e}.`)}var mf=class{static contain(e,t){return lf(e,t)}static cover(e,t){return uf(e,t)}static fill(e){return df(e)}static getByteLength(e,t,n,r){return ff(e,t,n,r)}};typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`181`}})),typeof window<`u`&&(window.__THREE__?R(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`181`);var hf=e({ACESFilmicToneMapping:()=>4,AddEquation:()=>100,AddOperation:()=>2,AdditiveAnimationBlendMode:()=>Ke,AdditiveBlending:()=>2,AgXToneMapping:()=>6,AlphaFormat:()=>te,AlwaysCompare:()=>519,AlwaysDepth:()=>1,AlwaysStencilFunc:()=>519,AmbientLight:()=>au,AnimationAction:()=>td,AnimationClip:()=>El,AnimationLoader:()=>Il,AnimationMixer:()=>rd,AnimationObjectGroup:()=>ed,AnimationUtils:()=>pl,ArcCurve:()=>ys,ArrayCamera:()=>Eu,ArrowHelper:()=>af,AttachedBindMode:()=>r,Audio:()=>Pu,AudioAnalyser:()=>Bu,AudioContext:()=>bu,AudioListener:()=>Nu,AudioLoader:()=>xu,AxesHelper:()=>of,BackSide:()=>1,BasicDepthPacking:()=>qe,BasicShadowMap:()=>0,BatchedMesh:()=>ko,Bone:()=>za,BooleanKeyframeTrack:()=>yl,Box2:()=>bd,Box3:()=>jn,Box3Helper:()=>$d,BoxGeometry:()=>Ii,BoxHelper:()=>Qd,BufferAttribute:()=>oi,BufferGeometry:()=>Z,BufferGeometryLoader:()=>fu,ByteType:()=>y,Cache:()=>kl,Camera:()=>Gi,CameraHelper:()=>Yd,CanvasTexture:()=>rs,CapsuleGeometry:()=>os,CatmullRomCurve3:()=>Ts,CineonToneMapping:()=>3,CircleGeometry:()=>ss,ClampToEdgeWrapping:()=>o,Clock:()=>Du,Color:()=>Y,ColorKeyframeTrack:()=>bl,ColorManagement:()=>G,CompressedArrayTexture:()=>ts,CompressedCubeTexture:()=>ns,CompressedTexture:()=>es,CompressedTextureLoader:()=>Ll,ConeGeometry:()=>ls,ConstantAlphaFactor:()=>213,ConstantColorFactor:()=>211,Controls:()=>cf,CubeCamera:()=>Qi,CubeReflectionMapping:()=>301,CubeRefractionMapping:()=>302,CubeTexture:()=>$i,CubeTextureLoader:()=>Bl,CubeUVReflectionMapping:()=>306,CubicBezierCurve:()=>Is,CubicBezierCurve3:()=>Ls,CubicInterpolant:()=>hl,CullFaceBack:()=>1,CullFaceFront:()=>2,CullFaceFrontBack:()=>3,CullFaceNone:()=>0,Curve:()=>_s,CurvePath:()=>Ws,CustomBlending:()=>5,CustomToneMapping:()=>5,CylinderGeometry:()=>cs,Cylindrical:()=>_d,Data3DTexture:()=>kn,DataArrayTexture:()=>Dn,DataTexture:()=>Ba,DataTextureLoader:()=>Vl,DataUtils:()=>ni,DecrementStencilOp:()=>it,DecrementWrapStencilOp:()=>ot,DefaultLoadingManager:()=>jl,DepthFormat:()=>re,DepthStencilFormat:()=>j,DepthTexture:()=>is,DetachedBindMode:()=>i,DirectionalLight:()=>iu,DirectionalLightHelper:()=>Kd,DiscreteInterpolant:()=>_l,DodecahedronGeometry:()=>ds,DoubleSide:()=>2,DstAlphaFactor:()=>206,DstColorFactor:()=>208,DynamicCopyUsage:()=>ht,DynamicDrawUsage:()=>lt,DynamicReadUsage:()=>ft,EdgesGeometry:()=>gs,EllipseCurve:()=>vs,EqualCompare:()=>514,EqualDepth:()=>4,EqualStencilFunc:()=>514,EquirectangularReflectionMapping:()=>303,EquirectangularRefractionMapping:()=>304,Euler:()=>pr,EventDispatcher:()=>Ft,ExternalTexture:()=>as,ExtrudeGeometry:()=>Ac,FileLoader:()=>Fl,Float16BufferAttribute:()=>mi,Float32BufferAttribute:()=>X,FloatType:()=>w,Fog:()=>aa,FogExp2:()=>ia,FramebufferTexture:()=>$o,FrontSide:()=>0,Frustum:()=>oo,FrustumArray:()=>lo,GLBufferAttribute:()=>ld,GLSL1:()=>`100`,GLSL3:()=>_t,GreaterCompare:()=>516,GreaterDepth:()=>6,GreaterEqualCompare:()=>518,GreaterEqualDepth:()=>5,GreaterEqualStencilFunc:()=>518,GreaterStencilFunc:()=>516,GridHelper:()=>Vd,Group:()=>ta,HalfFloatType:()=>T,HemisphereLight:()=>Wl,HemisphereLightHelper:()=>Bd,IcosahedronGeometry:()=>Nc,ImageBitmapLoader:()=>vu,ImageLoader:()=>zl,ImageUtils:()=>vn,IncrementStencilOp:()=>rt,IncrementWrapStencilOp:()=>at,InstancedBufferAttribute:()=>Wa,InstancedBufferGeometry:()=>du,InstancedInterleavedBuffer:()=>cd,InstancedMesh:()=>Qa,Int16BufferAttribute:()=>ui,Int32BufferAttribute:()=>fi,Int8BufferAttribute:()=>si,IntType:()=>S,InterleavedBuffer:()=>sa,InterleavedBufferAttribute:()=>la,Interpolant:()=>ml,InterpolateDiscrete:()=>ze,InterpolateLinear:()=>Be,InterpolateSmooth:()=>Ve,InterpolationSamplingMode:()=>St,InterpolationSamplingType:()=>xt,InvertStencilOp:()=>st,KeepStencilOp:()=>tt,KeyframeTrack:()=>vl,LOD:()=>Oa,LatheGeometry:()=>Pc,Layers:()=>mr,LessCompare:()=>513,LessDepth:()=>2,LessEqualCompare:()=>515,LessEqualDepth:()=>3,LessEqualStencilFunc:()=>515,LessStencilFunc:()=>513,Light:()=>Ul,LightProbe:()=>cu,Line:()=>Ro,Line3:()=>Od,LineBasicMaterial:()=>Ao,LineCurve:()=>Rs,LineCurve3:()=>zs,LineDashedMaterial:()=>al,LineLoop:()=>Uo,LineSegments:()=>Ho,LinearFilter:()=>p,LinearInterpolant:()=>gl,LinearMipMapLinearFilter:()=>_,LinearMipMapNearestFilter:()=>h,LinearMipmapLinearFilter:()=>g,LinearMipmapNearestFilter:()=>m,LinearSRGBColorSpace:()=>Qe,LinearToneMapping:()=>1,LinearTransfer:()=>$e,Loader:()=>Ml,LoaderUtils:()=>uu,LoadingManager:()=>Al,LoopOnce:()=>Ie,LoopPingPong:()=>Re,LoopRepeat:()=>Le,MOUSE:()=>t,Material:()=>Xr,MaterialLoader:()=>lu,MathUtils:()=>sn,Matrix2:()=>vd,Matrix3:()=>W,Matrix4:()=>q,MaxEquation:()=>104,Mesh:()=>Ni,MeshBasicMaterial:()=>Zr,MeshDepthMaterial:()=>nl,MeshDistanceMaterial:()=>rl,MeshLambertMaterial:()=>tl,MeshMatcapMaterial:()=>il,MeshNormalMaterial:()=>el,MeshPhongMaterial:()=>Qc,MeshPhysicalMaterial:()=>Zc,MeshStandardMaterial:()=>Xc,MeshToonMaterial:()=>$c,MinEquation:()=>103,MirroredRepeatWrapping:()=>s,MixOperation:()=>1,MultiplyBlending:()=>4,MultiplyOperation:()=>0,NearestFilter:()=>c,NearestMipMapLinearFilter:()=>f,NearestMipMapNearestFilter:()=>u,NearestMipmapLinearFilter:()=>d,NearestMipmapNearestFilter:()=>l,NeutralToneMapping:()=>7,NeverCompare:()=>512,NeverDepth:()=>0,NeverStencilFunc:()=>512,NoBlending:()=>0,NoColorSpace:()=>``,NoToneMapping:()=>0,NormalAnimationBlendMode:()=>Ge,NormalBlending:()=>1,NotEqualCompare:()=>517,NotEqualDepth:()=>7,NotEqualStencilFunc:()=>517,NumberKeyframeTrack:()=>xl,Object3D:()=>J,ObjectLoader:()=>pu,ObjectSpaceNormalMap:()=>1,OctahedronGeometry:()=>Fc,OneFactor:()=>201,OneMinusConstantAlphaFactor:()=>214,OneMinusConstantColorFactor:()=>212,OneMinusDstAlphaFactor:()=>207,OneMinusDstColorFactor:()=>209,OneMinusSrcAlphaFactor:()=>205,OneMinusSrcColorFactor:()=>203,OrthographicCamera:()=>nu,PCFShadowMap:()=>1,PCFSoftShadowMap:()=>2,PMREMGenerator:()=>zf,Path:()=>Gs,PerspectiveCamera:()=>Yi,Plane:()=>no,PlaneGeometry:()=>Ic,PlaneHelper:()=>ef,PointLight:()=>tu,PointLightHelper:()=>Id,Points:()=>Yo,PointsMaterial:()=>Wo,PolarGridHelper:()=>Hd,PolyhedronGeometry:()=>us,PositionalAudio:()=>zu,PropertyBinding:()=>$u,PropertyMixer:()=>Vu,QuadraticBezierCurve:()=>Bs,QuadraticBezierCurve3:()=>Vs,Quaternion:()=>cn,QuaternionKeyframeTrack:()=>Cl,QuaternionLinearInterpolant:()=>Sl,RED_GREEN_RGTC2_Format:()=>Pe,RED_RGTC1_Format:()=>Me,REVISION:()=>`181`,RGBADepthPacking:()=>Je,RGBAFormat:()=>A,RGBAIntegerFormat:()=>ce,RGBA_ASTC_10x10_Format:()=>ke,RGBA_ASTC_10x5_Format:()=>P,RGBA_ASTC_10x6_Format:()=>De,RGBA_ASTC_10x8_Format:()=>Oe,RGBA_ASTC_12x10_Format:()=>F,RGBA_ASTC_12x12_Format:()=>Ae,RGBA_ASTC_4x4_Format:()=>ye,RGBA_ASTC_5x4_Format:()=>be,RGBA_ASTC_5x5_Format:()=>xe,RGBA_ASTC_6x5_Format:()=>Se,RGBA_ASTC_6x6_Format:()=>Ce,RGBA_ASTC_8x5_Format:()=>we,RGBA_ASTC_8x6_Format:()=>Te,RGBA_ASTC_8x8_Format:()=>Ee,RGBA_BPTC_Format:()=>I,RGBA_ETC2_EAC_Format:()=>ve,RGBA_PVRTC_2BPPV1_Format:()=>he,RGBA_PVRTC_4BPPV1_Format:()=>me,RGBA_S3TC_DXT1_Format:()=>ue,RGBA_S3TC_DXT3_Format:()=>N,RGBA_S3TC_DXT5_Format:()=>de,RGBDepthPacking:()=>Ye,RGBFormat:()=>ne,RGBIntegerFormat:()=>se,RGB_BPTC_SIGNED_Format:()=>L,RGB_BPTC_UNSIGNED_Format:()=>je,RGB_ETC1_Format:()=>ge,RGB_ETC2_Format:()=>_e,RGB_PVRTC_2BPPV1_Format:()=>pe,RGB_PVRTC_4BPPV1_Format:()=>fe,RGB_S3TC_DXT1_Format:()=>le,RGDepthPacking:()=>Xe,RGFormat:()=>ae,RGIntegerFormat:()=>oe,RawShaderMaterial:()=>Yc,Ray:()=>rr,Raycaster:()=>dd,RectAreaLight:()=>ou,RedFormat:()=>M,RedIntegerFormat:()=>ie,ReinhardToneMapping:()=>2,RenderTarget:()=>Tn,RenderTarget3D:()=>id,RepeatWrapping:()=>a,ReplaceStencilOp:()=>nt,ReverseSubtractEquation:()=>102,RingGeometry:()=>Lc,SIGNED_RED_GREEN_RGTC2_Format:()=>Fe,SIGNED_RED_RGTC1_Format:()=>Ne,SRGBColorSpace:()=>Ze,SRGBTransfer:()=>et,Scene:()=>oa,ShaderChunk:()=>Q,ShaderLib:()=>vf,ShaderMaterial:()=>Wi,ShadowMaterial:()=>Jc,Shape:()=>Ks,ShapeGeometry:()=>Rc,ShapePath:()=>sf,ShapeUtils:()=>Dc,ShortType:()=>b,Skeleton:()=>Ua,SkeletonHelper:()=>Pd,SkinnedMesh:()=>Ra,Source:()=>bn,Sphere:()=>Yn,SphereGeometry:()=>Bc,Spherical:()=>gd,SphericalHarmonics3:()=>su,SplineCurve:()=>Hs,SpotLight:()=>Xl,SpotLightHelper:()=>Ad,Sprite:()=>wa,SpriteMaterial:()=>ua,SrcAlphaFactor:()=>204,SrcAlphaSaturateFactor:()=>210,SrcColorFactor:()=>202,StaticCopyUsage:()=>mt,StaticDrawUsage:()=>ct,StaticReadUsage:()=>dt,StereoCamera:()=>Tu,StreamCopyUsage:()=>gt,StreamDrawUsage:()=>ut,StreamReadUsage:()=>pt,StringKeyframeTrack:()=>wl,SubtractEquation:()=>101,SubtractiveBlending:()=>3,TOUCH:()=>n,TangentSpaceNormalMap:()=>0,TetrahedronGeometry:()=>Vc,Texture:()=>wn,TextureLoader:()=>Hl,TextureUtils:()=>mf,Timer:()=>md,TimestampQuery:()=>bt,TorusGeometry:()=>Hc,TorusKnotGeometry:()=>Uc,Triangle:()=>Ur,TriangleFanDrawMode:()=>2,TriangleStripDrawMode:()=>1,TrianglesDrawMode:()=>0,TubeGeometry:()=>Wc,UVMapping:()=>300,Uint16BufferAttribute:()=>di,Uint32BufferAttribute:()=>pi,Uint8BufferAttribute:()=>ci,Uint8ClampedBufferAttribute:()=>li,Uniform:()=>ad,UniformsGroup:()=>sd,UniformsLib:()=>$,UniformsUtils:()=>Vi,UnsignedByteType:()=>v,UnsignedInt101111Type:()=>k,UnsignedInt248Type:()=>ee,UnsignedInt5999Type:()=>O,UnsignedIntType:()=>C,UnsignedShort4444Type:()=>E,UnsignedShort5551Type:()=>D,UnsignedShortType:()=>x,VSMShadowMap:()=>3,Vector2:()=>H,Vector3:()=>U,Vector4:()=>K,VectorKeyframeTrack:()=>Tl,VideoFrameTexture:()=>Qo,VideoTexture:()=>Zo,WebGL3DRenderTarget:()=>An,WebGLArrayRenderTarget:()=>On,WebGLCoordinateSystem:()=>vt,WebGLCubeRenderTarget:()=>ea,WebGLRenderTarget:()=>En,WebGLRenderer:()=>yh,WebGLUtils:()=>sh,WebGPUCoordinateSystem:()=>yt,WebXRController:()=>ra,WireframeGeometry:()=>Gc,WrapAroundEnding:()=>We,ZeroCurvatureEnding:()=>He,ZeroFactor:()=>200,ZeroSlopeEnding:()=>Ue,ZeroStencilOp:()=>0,createCanvasElement:()=>Dt,error:()=>z,getConsoleFunction:()=>jt,log:()=>Mt,setConsoleFunction:()=>At,warn:()=>R,warnOnce:()=>Nt});function gf(){let e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){t!==!0&&n!==null&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function _f(e){let t=new WeakMap;function n(t,n){let r=t.array,i=t.usage,a=r.byteLength,o=e.createBuffer();e.bindBuffer(n,o),e.bufferData(n,r,i),t.onUploadCallback();let s;if(r instanceof Float32Array)s=e.FLOAT;else if(typeof Float16Array<`u`&&r instanceof Float16Array)s=e.HALF_FLOAT;else if(r instanceof Uint16Array)s=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)s=e.SHORT;else if(r instanceof Uint32Array)s=e.UNSIGNED_INT;else if(r instanceof Int32Array)s=e.INT;else if(r instanceof Int8Array)s=e.BYTE;else if(r instanceof Uint8Array)s=e.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)s=e.UNSIGNED_BYTE;else throw Error(`THREE.WebGLAttributes: Unsupported buffer data format: `+r);return{buffer:o,type:s,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:a}}function r(t,n,r){let i=n.array,a=n.updateRanges;if(e.bindBuffer(r,t),a.length===0)e.bufferSubData(r,0,i);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,color_fragment:`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,color_pars_fragment:`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,color_pars_vertex:`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,color_vertex:`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,common:`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,colorspace_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,colorspace_pars_fragment:`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,envmap_fragment:`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,envmap_vertex:`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,fog_vertex:`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,fog_pars_vertex:`#ifdef USE_FOG + varying float vFogDepth; +#endif`,fog_fragment:`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,fog_pars_fragment:`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,lights_lambert_fragment:`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,lights_toon_fragment:`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,lights_physical_pars_fragment:`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 uv = vec2( roughness, dotNV ); + return texture2D( dfgLUT, uv ).rg; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness ); + vec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness ); + vec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,lights_fragment_begin:` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,logdepthbuf_fragment:`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_vertex:`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,map_fragment:`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,map_pars_fragment:`#ifdef USE_MAP + uniform sampler2D map; +#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,map_particle_pars_fragment:`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,metalnessmap_fragment:`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,morphinstance_vertex:`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,normal_fragment_maps:`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_vertex:`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,opaque_fragment:`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,dithering_pars_fragment:`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,roughnessmap_fragment:`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + float depth = unpackRGBAToDepth( texture2D( depths, uv ) ); + #ifdef USE_REVERSED_DEPTH_BUFFER + return step( depth, compare ); + #else + return step( compare, depth ); + #endif + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow( sampler2D shadow, vec2 uv, float compare ) { + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( distribution.x, compare ); + #else + float hard_shadow = step( compare, distribution.x ); + #endif + if ( hard_shadow != 1.0 ) { + float distance = compare - distribution.x; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,shadowmask_pars_fragment:`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,skinbase_vertex:`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,skinning_vertex:`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,skinnormal_vertex:`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,specularmap_fragment:`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,tonemapping_pars_fragment:`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,uv_pars_fragment:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uv_pars_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uv_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`,background_vert:`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,background_frag:`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,backgroundCube_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,cube_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,cube_frag:`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,depth_vert:`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,depth_frag:`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,distanceRGBA_vert:`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,distanceRGBA_frag:`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,equirect_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,equirect_frag:`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,linedashed_vert:`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,linedashed_frag:`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,meshbasic_vert:`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,meshbasic_frag:`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,meshlambert_vert:`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,meshlambert_frag:`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,meshmatcap_vert:`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,meshmatcap_frag:`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,meshnormal_vert:`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,meshnormal_frag:`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,meshphong_vert:`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,meshphong_frag:`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,meshphysical_vert:`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,meshphysical_frag:`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,meshtoon_vert:`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,meshtoon_frag:`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,points_vert:`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,points_frag:`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,shadow_vert:`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,shadow_frag:`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,sprite_vert:`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,sprite_frag:`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`},$={common:{diffuse:{value:new Y(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new W},alphaMap:{value:null},alphaMapTransform:{value:new W},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new W}},envmap:{envMap:{value:null},envMapRotation:{value:new W},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new W}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new W}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new W},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new W},normalScale:{value:new H(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new W},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new W}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new W}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new W}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Y(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Y(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new W},alphaTest:{value:0},uvTransform:{value:new W}},sprite:{diffuse:{value:new Y(16777215)},opacity:{value:1},center:{value:new H(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new W},alphaMap:{value:null},alphaMapTransform:{value:new W},alphaTest:{value:0}}},vf={basic:{uniforms:Ri([$.common,$.specularmap,$.envmap,$.aomap,$.lightmap,$.fog]),vertexShader:Q.meshbasic_vert,fragmentShader:Q.meshbasic_frag},lambert:{uniforms:Ri([$.common,$.specularmap,$.envmap,$.aomap,$.lightmap,$.emissivemap,$.bumpmap,$.normalmap,$.displacementmap,$.fog,$.lights,{emissive:{value:new Y(0)}}]),vertexShader:Q.meshlambert_vert,fragmentShader:Q.meshlambert_frag},phong:{uniforms:Ri([$.common,$.specularmap,$.envmap,$.aomap,$.lightmap,$.emissivemap,$.bumpmap,$.normalmap,$.displacementmap,$.fog,$.lights,{emissive:{value:new Y(0)},specular:{value:new Y(1118481)},shininess:{value:30}}]),vertexShader:Q.meshphong_vert,fragmentShader:Q.meshphong_frag},standard:{uniforms:Ri([$.common,$.envmap,$.aomap,$.lightmap,$.emissivemap,$.bumpmap,$.normalmap,$.displacementmap,$.roughnessmap,$.metalnessmap,$.fog,$.lights,{emissive:{value:new Y(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},toon:{uniforms:Ri([$.common,$.aomap,$.lightmap,$.emissivemap,$.bumpmap,$.normalmap,$.displacementmap,$.gradientmap,$.fog,$.lights,{emissive:{value:new Y(0)}}]),vertexShader:Q.meshtoon_vert,fragmentShader:Q.meshtoon_frag},matcap:{uniforms:Ri([$.common,$.bumpmap,$.normalmap,$.displacementmap,$.fog,{matcap:{value:null}}]),vertexShader:Q.meshmatcap_vert,fragmentShader:Q.meshmatcap_frag},points:{uniforms:Ri([$.points,$.fog]),vertexShader:Q.points_vert,fragmentShader:Q.points_frag},dashed:{uniforms:Ri([$.common,$.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Q.linedashed_vert,fragmentShader:Q.linedashed_frag},depth:{uniforms:Ri([$.common,$.displacementmap]),vertexShader:Q.depth_vert,fragmentShader:Q.depth_frag},normal:{uniforms:Ri([$.common,$.bumpmap,$.normalmap,$.displacementmap,{opacity:{value:1}}]),vertexShader:Q.meshnormal_vert,fragmentShader:Q.meshnormal_frag},sprite:{uniforms:Ri([$.sprite,$.fog]),vertexShader:Q.sprite_vert,fragmentShader:Q.sprite_frag},background:{uniforms:{uvTransform:{value:new W},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Q.background_vert,fragmentShader:Q.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new W}},vertexShader:Q.backgroundCube_vert,fragmentShader:Q.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Q.cube_vert,fragmentShader:Q.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Q.equirect_vert,fragmentShader:Q.equirect_frag},distanceRGBA:{uniforms:Ri([$.common,$.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Q.distanceRGBA_vert,fragmentShader:Q.distanceRGBA_frag},shadow:{uniforms:Ri([$.lights,$.fog,{color:{value:new Y(0)},opacity:{value:1}}]),vertexShader:Q.shadow_vert,fragmentShader:Q.shadow_frag}};vf.physical={uniforms:Ri([vf.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new W},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new W},clearcoatNormalScale:{value:new H(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new W},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new W},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new W},sheen:{value:0},sheenColor:{value:new Y(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new W},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new W},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new W},transmissionSamplerSize:{value:new H},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new W},attenuationDistance:{value:0},attenuationColor:{value:new Y(0)},specularColor:{value:new Y(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new W},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new W},anisotropyVector:{value:new H},anisotropyMap:{value:null},anisotropyMapTransform:{value:new W}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag};var yf={r:0,b:0,g:0},bf=new pr,xf=new q;function Sf(e,t,n,r,i,a,o){let s=new Y(0),c=a===!0?0:1,l,u,d=null,f=0,p=null;function m(e){let r=e.isScene===!0?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function h(t){let n=!1,i=m(t);i===null?_(s,c):i&&i.isColor&&(_(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();a===`additive`?r.buffers.color.setClear(0,0,0,1,o):a===`alpha-blend`&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function g(t,n){let r=m(n);r&&(r.isCubeTexture||r.mapping===306)?(u===void 0&&(u=new Ni(new Ii(1,1,1),new Wi({name:`BackgroundCubeMaterial`,uniforms:Li(vf.backgroundCube.uniforms),vertexShader:vf.backgroundCube.vertexShader,fragmentShader:vf.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute(`normal`),u.geometry.deleteAttribute(`uv`),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),bf.copy(n.backgroundRotation),bf.x*=-1,bf.y*=-1,bf.z*=-1,r.isCubeTexture&&r.isRenderTargetTexture===!1&&(bf.y*=-1,bf.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&r.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(xf.makeRotationFromEuler(bf)),u.material.toneMapped=G.getTransfer(r.colorSpace)!==et,(d!==r||f!==r.version||p!==e.toneMapping)&&(u.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(l===void 0&&(l=new Ni(new Ic(2,2),new Wi({name:`BackgroundMaterial`,uniforms:Li(vf.background.uniforms),vertexShader:vf.background.vertexShader,fragmentShader:vf.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=G.getTransfer(r.colorSpace)!==et,r.matrixAutoUpdate===!0&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}function _(t,n){t.getRGB(yf,Bi(e)),r.buffers.color.setClear(yf.r,yf.g,yf.b,n,o)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),c=t,_(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,_(s,c)},render:h,addToRenderList:g,dispose:v}}function Cf(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n){let i=n.wireframe===!0,a=r[e.id];a===void 0&&(a={},r[e.id]=a);let o=a[t.id];o===void 0&&(o={},a[t.id]=o);let s=o[i];return s===void 0&&(s=f(c()),o[i]=s),s}function f(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(R(`WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reversedDepthBuffer===!0&&t.has(`EXT_clip_control`),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=m>0,S=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reversedDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,vertexTextures:x,maxSamples:S}}function Ef(e){let t=this,n=null,r=0,i=!1,a=!1,o=new no,s=new W,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length0){let o=new ea(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener(`dispose`,i),n(o.texture,r.mapping)}else return null}}return r}function i(e){let n=e.target;n.removeEventListener(`dispose`,i);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function a(){t=new WeakMap}return{get:r,dispose:a}}var Of=4,kf=[.125,.215,.35,.446,.526,.582],Af=20,jf=256,Mf=new nu,Nf=new Y,Pf=null,Ff=0,If=0,Lf=!1,Rf=new U,zf=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=Rf}=i;Pf=this._renderer.getRenderTarget(),Ff=this._renderer.getActiveCubeFace(),If=this._renderer.getActiveMipmapLevel(),Lf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Kf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Gf(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?l:0,l,l),c.setRenderTarget(r),p&&c.render(d,a),c.render(e,a)}c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Kf()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Gf());let i=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=i;let o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;Hf(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,Mf)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;td-Of?n-d+Of:0),m=4*(this._cubeSize-f);s.envMap.value=e.texture,s.roughness.value=u,s.mipInt.value=d-t,Hf(i,p,m,3*f,2*f),r.setRenderTarget(i),r.render(o,Mf),s.envMap.value=i.texture,s.roughness.value=0,s.mipInt.value=d-n,Hf(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,Mf)}_blur(e,t,n,r,i){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,`latitudinal`,i),this._halfBlur(a,e,n,n,r,`longitudinal`,i)}_halfBlur(e,t,n,r,i,a,o){let s=this._renderer,c=this._blurMaterial;a!==`latitudinal`&&a!==`longitudinal`&&z(`blur direction must be either latitudinal or longitudinal!`);let l=this._lodMeshes[r];l.material=c;let u=c.uniforms,d=this._sizeLods[n]-1,f=isFinite(i)?Math.PI/(2*d):2*Math.PI/(2*Af-1),p=i/f,m=isFinite(i)?1+Math.floor(3*p):Af;m>Af&&R(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Af}`);let h=[],g=0;for(let e=0;e_-Of?r-_+Of:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,Mf)}};function Bf(e){let t=[],n=[],r=[],i=e,a=e-Of+1+kf.length;for(let o=0;oe-Of?s=kf[o-e+Of-1]:o===0&&(s=0),n.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new Z;h.setAttribute(`position`,new oi(f,3)),h.setAttribute(`uv`,new oi(p,2)),h.setAttribute(`faceIndex`,new oi(m,1)),r.push(new Ni(h,null)),i>Of&&i--}return{lodMeshes:r,sizeLods:t,sigmas:n}}function Vf(e,t,n){let r=new En(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function Hf(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Uf(e,t,n){return new Wi({name:`PMREMGGXConvolution`,defines:{GGX_SAMPLES:jf,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:qf(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 3.2: Transform view direction to hemisphere configuration + vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z)); + + // Section 4.1: Orthonormal basis + float lensq = Vh.x * Vh.x + Vh.y * Vh.y; + vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(Vh, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + Vh.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:0,depthTest:!1,depthWrite:!1})}function Wf(e,t,n){let r=new Float32Array(Af),i=new U(0,1,0);return new Wi({name:`SphericalGaussianBlur`,defines:{n:Af,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:qf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function Gf(){return new Wi({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:qf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function Kf(){return new Wi({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:qf(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function qf(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function Jf(e){let t=new WeakMap,n=null;function r(r){if(r&&r.isTexture){let o=r.mapping,s=o===303||o===304,c=o===301||o===302;if(s||c){let o=t.get(r),l=o===void 0?0:o.texture.pmremVersion;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return n===null&&(n=new zf(e)),o=s?n.fromEquirectangular(r,o):n.fromCubemap(r,o),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),o.texture;if(o!==void 0)return o.texture;{let l=r.image;return s&&l&&l.height>0||c&&l&&i(l)?(n===null&&(n=new zf(e)),o=s?n.fromEquirectangular(r):n.fromCubemap(r),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),r.addEventListener(`dispose`,a),o.texture):null}}}return r}function i(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function a(e){let n=e.target;n.removeEventListener(`dispose`,a);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function o(){t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function Yf(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r=e.getExtension(n);return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&Nt(`WebGLRenderer: `+e+` extension not supported.`),t}}}function Xf(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;tt.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new Dn(h,p,m,u);g.type=w,g.needsUpdate=!0;let _=f*4;for(let t=0;t0)return e;let i=t*n,a=op[i];if(a===void 0&&(a=new Float32Array(i),op[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function fp(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n`:` `} ${i}: ${n[e]}`)}return r.join(` +`)}var fm=new W;function pm(e){G._getMatrix(fm,G.workingColorSpace,e);let t=`mat3( ${fm.elements.map(e=>e.toFixed(4))} )`;switch(G.getTransfer(e)){case $e:return[t,`LinearTransferOETF`];case et:return[t,`sRGBTransferOETF`];default:return R(`WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function mm(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||``).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` + +`+i+` + +`+dm(e.getShaderSource(t),r)}else return i}function hm(e,t){let n=pm(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(` +`)}function gm(e,t){let n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Cineon`;break;case 4:n=`ACESFilmic`;break;case 6:n=`AgX`;break;case 7:n=`Neutral`;break;case 5:n=`Custom`;break;default:R(`WebGLProgram: Unsupported toneMapping:`,t),n=`Linear`}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}var _m=new U;function vm(){return G.getLuminanceCoefficients(_m),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${_m.x.toFixed(4)}, ${_m.y.toFixed(4)}, ${_m.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` +`)}function ym(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(Sm).join(` +`)}function bm(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(` +`)}function xm(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function Em(e){return e.replace(Tm,Om)}var Dm=new Map;function Om(e,t){let n=Q[t];if(n===void 0){let e=Dm.get(t);if(e!==void 0)n=Q[e],R(`WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`Can not resolve #include <`+t+`>`)}return Em(n)}var km=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Am(e){return e.replace(km,jm)}function jm(e,t,n,r){let i=``;for(let e=parseInt(t);e0&&(g+=` +`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(Sm).join(` +`),_.length>0&&(_+=` +`)):(g=[Mm(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGARITHMIC_DEPTH_BUFFER`:``,n.reversedDepthBuffer?`#define USE_REVERSED_DEPTH_BUFFER`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` +`].filter(Sm).join(` +`),_=[Mm(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor||n.batchingColor?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGARITHMIC_DEPTH_BUFFER`:``,n.reversedDepthBuffer?`#define USE_REVERSED_DEPTH_BUFFER`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:Q.tonemapping_pars_fragment,n.toneMapping===0?``:gm(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,Q.colorspace_pars_fragment,hm(`linearToOutputTexel`,n.outputColorSpace),vm(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` +`].filter(Sm).join(` +`)),o=Em(o),o=Cm(o,n),o=wm(o,n),s=Em(s),s=Cm(s,n),s=wm(s,n),o=Am(o),s=Am(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es +`,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` +`)+` +`+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(` +`)+` +`+_);let y=v+g+o,b=v+_+s,x=cm(i,i.VERTEX_SHADER,y),S=cm(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.morphTargets===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h)||``,r=i.getShaderInfoLog(x)||``,a=i.getShaderInfoLog(S)||``,o=n.trim(),s=r.trim(),c=a.trim(),l=!0,u=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1)if(l=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=mm(i,x,`vertex`),n=mm(i,S,`fragment`);z(`THREE.WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` + +Material Name: `+t.name+` +Material Type: `+t.type+` + +Program Info Log: `+o+` +`+e+` +`+n)}else o===``?(s===``||c===``)&&(u=!1):R(`WebGLProgram: Program Info Log:`,o);u&&(t.diagnostics={runnable:l,programLog:o,vertexShader:{log:s,prefix:g},fragmentShader:{log:c,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new sm(i,h),T=xm(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,lm)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=um++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var zm=0,Bm=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Vm(e),t.set(e,n)),n}},Vm=class{constructor(e){this.id=zm++,this.code=e,this.usedTimes=0}};function Hm(e,t,n,r,i,a,o){let s=new mr,c=new Bm,l=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures,p=i.precision,m={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function h(e){return l.add(e),e===0?`uv`:`uv${e}`}function g(a,s,u,g,_){let v=g.fog,y=_.geometry,b=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),S=x&&x.mapping===306?x.image.height:null,C=m[a.type];a.precision!==null&&(p=i.getMaxPrecision(a.precision),p!==a.precision&&R(`WebGLProgram.getParameters:`,a.precision,`not supported, using`,p,`instead.`));let w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=w===void 0?0:w.length,E=0;y.morphAttributes.position!==void 0&&(E=1),y.morphAttributes.normal!==void 0&&(E=2),y.morphAttributes.color!==void 0&&(E=3);let D,ee,O,k;if(C){let e=vf[C];D=e.vertexShader,ee=e.fragmentShader}else D=a.vertexShader,ee=a.fragmentShader,c.update(a),O=c.getVertexShaderID(a),k=c.getFragmentShaderID(a);let te=e.getRenderTarget(),ne=e.state.buffers.depth.getReversed(),A=_.isInstancedMesh===!0,re=_.isBatchedMesh===!0,j=!!a.map,M=!!a.matcap,ie=!!x,ae=!!a.aoMap,oe=!!a.lightMap,se=!!a.bumpMap,ce=!!a.normalMap,le=!!a.displacementMap,ue=!!a.emissiveMap,N=!!a.metalnessMap,de=!!a.roughnessMap,fe=a.anisotropy>0,pe=a.clearcoat>0,me=a.dispersion>0,he=a.iridescence>0,ge=a.sheen>0,_e=a.transmission>0,ve=fe&&!!a.anisotropyMap,ye=pe&&!!a.clearcoatMap,be=pe&&!!a.clearcoatNormalMap,xe=pe&&!!a.clearcoatRoughnessMap,Se=he&&!!a.iridescenceMap,Ce=he&&!!a.iridescenceThicknessMap,we=ge&&!!a.sheenColorMap,Te=ge&&!!a.sheenRoughnessMap,Ee=!!a.specularMap,P=!!a.specularColorMap,De=!!a.specularIntensityMap,Oe=_e&&!!a.transmissionMap,ke=_e&&!!a.thicknessMap,F=!!a.gradientMap,Ae=!!a.alphaMap,I=a.alphaTest>0,L=!!a.alphaHash,je=!!a.extensions,Me=0;a.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(Me=e.toneMapping);let Ne={shaderID:C,shaderType:a.type,shaderName:a.name,vertexShader:D,fragmentShader:ee,defines:a.defines,customVertexShaderID:O,customFragmentShaderID:k,isRawShaderMaterial:a.isRawShaderMaterial===!0,glslVersion:a.glslVersion,precision:p,batching:re,batchingColor:re&&_._colorsTexture!==null,instancing:A,instancingColor:A&&_.instanceColor!==null,instancingMorph:A&&_.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:te===null?e.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:Qe,alphaToCoverage:!!a.alphaToCoverage,map:j,matcap:M,envMap:ie,envMapMode:ie&&x.mapping,envMapCubeUVHeight:S,aoMap:ae,lightMap:oe,bumpMap:se,normalMap:ce,displacementMap:f&&le,emissiveMap:ue,normalMapObjectSpace:ce&&a.normalMapType===1,normalMapTangentSpace:ce&&a.normalMapType===0,metalnessMap:N,roughnessMap:de,anisotropy:fe,anisotropyMap:ve,clearcoat:pe,clearcoatMap:ye,clearcoatNormalMap:be,clearcoatRoughnessMap:xe,dispersion:me,iridescence:he,iridescenceMap:Se,iridescenceThicknessMap:Ce,sheen:ge,sheenColorMap:we,sheenRoughnessMap:Te,specularMap:Ee,specularColorMap:P,specularIntensityMap:De,transmission:_e,transmissionMap:Oe,thicknessMap:ke,gradientMap:F,opaque:a.transparent===!1&&a.blending===1&&a.alphaToCoverage===!1,alphaMap:Ae,alphaTest:I,alphaHash:L,combine:a.combine,mapUv:j&&h(a.map.channel),aoMapUv:ae&&h(a.aoMap.channel),lightMapUv:oe&&h(a.lightMap.channel),bumpMapUv:se&&h(a.bumpMap.channel),normalMapUv:ce&&h(a.normalMap.channel),displacementMapUv:le&&h(a.displacementMap.channel),emissiveMapUv:ue&&h(a.emissiveMap.channel),metalnessMapUv:N&&h(a.metalnessMap.channel),roughnessMapUv:de&&h(a.roughnessMap.channel),anisotropyMapUv:ve&&h(a.anisotropyMap.channel),clearcoatMapUv:ye&&h(a.clearcoatMap.channel),clearcoatNormalMapUv:be&&h(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:xe&&h(a.clearcoatRoughnessMap.channel),iridescenceMapUv:Se&&h(a.iridescenceMap.channel),iridescenceThicknessMapUv:Ce&&h(a.iridescenceThicknessMap.channel),sheenColorMapUv:we&&h(a.sheenColorMap.channel),sheenRoughnessMapUv:Te&&h(a.sheenRoughnessMap.channel),specularMapUv:Ee&&h(a.specularMap.channel),specularColorMapUv:P&&h(a.specularColorMap.channel),specularIntensityMapUv:De&&h(a.specularIntensityMap.channel),transmissionMapUv:Oe&&h(a.transmissionMap.channel),thicknessMapUv:ke&&h(a.thicknessMap.channel),alphaMapUv:Ae&&h(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(ce||fe),vertexColors:a.vertexColors,vertexAlphas:a.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,pointsUvs:_.isPoints===!0&&!!y.attributes.uv&&(j||Ae),fog:!!v,useFog:a.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:a.flatShading===!0&&a.wireframe===!1,sizeAttenuation:a.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:ne,skinning:_.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:Me,decodeVideoTexture:j&&a.map.isVideoTexture===!0&&G.getTransfer(a.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:ue&&a.emissiveMap.isVideoTexture===!0&&G.getTransfer(a.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===2,flipSided:a.side===1,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:je&&a.extensions.clipCullDistance===!0&&r.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(je&&a.extensions.multiDraw===!0||re)&&r.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:r.has(`KHR_parallel_shader_compile`),customProgramCacheKey:a.customProgramCacheKey()};return Ne.vertexUv1s=l.has(1),Ne.vertexUv2s=l.has(2),Ne.vertexUv3s=l.has(3),l.clear(),Ne}function _(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(v(n,t),y(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function v(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function y(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),t.gradientMap&&s.enable(22),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.reversedDepthBuffer&&s.enable(4),t.skinning&&s.enable(5),t.morphTargets&&s.enable(6),t.morphNormals&&s.enable(7),t.morphColors&&s.enable(8),t.premultipliedAlpha&&s.enable(9),t.shadowMapEnabled&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),t.decodeVideoTexture&&s.enable(19),t.decodeVideoTextureEmissive&&s.enable(20),t.alphaToCoverage&&s.enable(21),e.push(s.mask)}function b(e){let t=m[e.type],n;if(t){let e=vf[t];n=Vi.clone(e.uniforms)}else n=e.uniforms;return n}function x(t,n){let r;for(let e=0,t=u.length;e0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function c(e,t,a,s,c,l){let u=o(e,t,a,s,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function l(e,t){n.length>1&&n.sort(e||Wm),r.length>1&&r.sort(t||Gm),i.length>1&&i.sort(t||Gm)}function u(){for(let n=t,r=e.length;n=r.length?(i=new Km,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function Jm(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new U,color:new Y};break;case`SpotLight`:n={position:new U,direction:new U,color:new Y,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new U,color:new Y,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new U,skyColor:new Y,groundColor:new Y};break;case`RectAreaLight`:n={color:new Y,position:new U,halfWidth:new U,halfHeight:new U};break}return e[t.id]=n,n}}}function Ym(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new H};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new H};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new H,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var Xm=0;function Zm(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function Qm(e){let t=new Jm,n=Ym(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new U);let i=new U,a=new q,o=new q;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort(Zm);for(let e=0,y=i.length;e0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=$.LTC_FLOAT_1,r.rectAreaLTC2=$.LTC_FLOAT_2):(r.rectAreaLTC1=$.LTC_HALF_1,r.rectAreaLTC2=$.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=Xm++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t=i.length?(a=new $m(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var th=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,nh=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function rh(e,t,n){let r=new oo,i=new H,a=new H,o=new K,s=new nl({depthPacking:Je}),l=new rl,u={},d=n.maxTextureSize,f={0:1,1:0,2:2},p=new Wi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new H},radius:{value:4}},vertexShader:th,fragmentShader:nh}),m=p.clone();m.defines.HORIZONTAL_PASS=1;let h=new Z;h.setAttribute(`position`,new oi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new Ni(h,p),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let v=this.type;this.render=function(t,n,s){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||t.length===0)return;let l=e.getRenderTarget(),u=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.state;p.setBlending(0),p.buffers.depth.getReversed()===!0?p.buffers.color.setClear(0,0,0,0):p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);let m=v!==3&&this.type===3,h=v===3&&this.type!==3;for(let l=0,u=t.length;ld||i.y>d)&&(i.x>d&&(a.x=Math.floor(d/g.x),i.x=a.x*g.x,f.mapSize.x=a.x),i.y>d&&(a.y=Math.floor(d/g.y),i.y=a.y*g.y,f.mapSize.y=a.y)),f.map===null||m===!0||h===!0){let e=this.type===3?{}:{minFilter:c,magFilter:c};f.map!==null&&f.map.dispose(),f.map=new En(i.x,i.y,e),f.map.texture.name=u.name+`.shadowMap`,f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();let _=f.getViewportCount();for(let e=0;e<_;e++){let t=f.getViewport(e);o.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),p.viewport(o),f.updateMatrices(u,e),r=f.getFrustum(),x(n,s,f.camera,u,this.type)}f.isPointLightShadow!==!0&&this.type===3&&y(f,s),f.needsUpdate=!1}v=this.type,_.needsUpdate=!1,e.setRenderTarget(l,u,f)};function y(n,r){let a=t.update(g);p.defines.VSM_SAMPLES!==n.blurSamples&&(p.defines.VSM_SAMPLES=n.blurSamples,m.defines.VSM_SAMPLES=n.blurSamples,p.needsUpdate=!0,m.needsUpdate=!0),n.mapPass===null&&(n.mapPass=new En(i.x,i.y)),p.uniforms.shadow_pass.value=n.map.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,p,g,null),m.uniforms.shadow_pass.value=n.mapPass.texture,m.uniforms.resolution.value=n.mapSize,m.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,m,g,null)}function b(t,n,r,i){let a=null,o=r.isPointLight===!0?t.customDistanceMaterial:t.customDepthMaterial;if(o!==void 0)a=o;else if(a=r.isPointLight===!0?l:s,e.localClippingEnabled&&n.clipShadows===!0&&Array.isArray(n.clippingPlanes)&&n.clippingPlanes.length!==0||n.displacementMap&&n.displacementScale!==0||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=u[e];r===void 0&&(r={},u[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,S)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?f[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function x(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l=2):(A=parseFloat(/^WebGL (\d)/.exec(re)[1]),ne=A>=1);let j=null,M={},ie=e.getParameter(e.SCISSOR_BOX),ae=e.getParameter(e.VIEWPORT),oe=new K().fromArray(ie),se=new K().fromArray(ae);function ce(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o`u`?!1:/OculusBrowser/g.test(navigator.userAgent),v=new H,y=new WeakMap,b,x=new WeakMap,S=!1;try{S=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function C(e,t){return S?new OffscreenCanvas(e,t):Et(`canvas`)}function w(e,t,n){let r=1,i=L(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);b===void 0&&(b=C(n,a));let o=t?C(n,a):b;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),R(`WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}else return`data`in e&&R(`WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e;return e}function T(e){return e.generateMipmaps}function E(t){e.generateMipmap(t)}function D(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function ee(n,r,i,a,o=!1){if(n!==null){if(e[n]!==void 0)return e[n];R(`WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(s=e.R11F_G11F_B10F)),r===e.RGBA){let t=o?$e:G.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return(s===e.R16F||s===e.R32F||s===e.RG16F||s===e.RG32F||s===e.RGBA16F||s===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),s}function O(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,R(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function k(e,t){return T(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function te(e){let t=e.target;t.removeEventListener(`dispose`,te),A(t),t.isVideoTexture&&y.delete(t)}function ne(e){let t=e.target;t.removeEventListener(`dispose`,ne),M(t)}function A(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=x.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&re(e),Object.keys(i).length===0&&x.delete(n)}r.remove(e)}function re(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=x.get(i);delete a[n.__cacheKey],f.memory.textures--}function M(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r=i.maxTextures&&R(`WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),ie+=1,e}function se(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function ce(t,i){let a=r.get(t);if(t.isVideoTexture&&Ae(t),t.isRenderTargetTexture===!1&&t.isExternalTexture!==!0&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)R(`WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)R(`WebGLRenderer: Texture marked for update but image is incomplete`);else{ve(a,t,i);return}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function le(t,i){let a=r.get(t);if(t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){ve(a,t,i);return}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function ue(t,i){let a=r.get(t);if(t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){ve(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function N(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ye(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let de={[a]:e.REPEAT,[o]:e.CLAMP_TO_EDGE,[s]:e.MIRRORED_REPEAT},fe={[c]:e.NEAREST,[l]:e.NEAREST_MIPMAP_NEAREST,[d]:e.NEAREST_MIPMAP_LINEAR,[p]:e.LINEAR,[m]:e.LINEAR_MIPMAP_NEAREST,[g]:e.LINEAR_MIPMAP_LINEAR},pe={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function me(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&R(`WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,de[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,de[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,de[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,fe[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,fe[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,pe[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function he(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,te));let i=n.source,a=x.get(i);a===void 0&&(a={},x.set(i,a));let o=se(n);if(o!==t.__cacheKey){a[o]===void 0&&(a[o]={texture:e.createTexture(),usedTimes:0},f.memory.textures++,r=!0),a[o].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&re(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return r}function ge(e,t,n){return Math.floor(Math.floor(e/n)/t)}function _e(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e0){y&&b&&n.texStorage2D(e.TEXTURE_2D,S,g,v[0].width,v[0].height);for(let t=0,r=v.length;t0){let r=ff(_.width,_.height,a.format,a.type);for(let i of a.layerUpdates){let a=_.data.subarray(i*r/_.data.BYTES_PER_ELEMENT,(i+1)*r/_.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,_.width,_.height,1,m,a)}a.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,p.depth,m,_.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,g,_.width,_.height,p.depth,0,_.data,0,0);else R(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else y?x&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,p.depth,m,h,_.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,g,_.width,_.height,p.depth,0,m,h,_.data)}else{y&&b&&n.texStorage2D(e.TEXTURE_2D,S,g,v[0].width,v[0].height);for(let t=0,r=v.length;t0){let t=ff(p.width,p.height,a.format,a.type);for(let r of a.layerUpdates){let i=p.data.subarray(r*t/p.data.BYTES_PER_ELEMENT,(r+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,p.width,p.height,1,m,h,i)}a.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,h,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,g,p.width,p.height,p.depth,0,m,h,p.data);else if(a.isData3DTexture)y?(b&&n.texStorage3D(e.TEXTURE_3D,S,g,p.width,p.height,p.depth),x&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,h,p.data)):n.texImage3D(e.TEXTURE_3D,0,g,p.width,p.height,p.depth,0,m,h,p.data);else if(a.isFramebufferTexture){if(b)if(y)n.texStorage2D(e.TEXTURE_2D,S,g,p.width,p.height);else{let t=p.width,r=p.height;for(let i=0;i>=1,r>>=1}}else if(v.length>0){if(y&&b){let t=L(v[0]);n.texStorage2D(e.TEXTURE_2D,S,g,t.width,t.height)}for(let t=0,r=v.length;t0&&S++;let t=L(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,S,v,t.width,t.height)}for(let t=0;t<6;t++)if(p){y?x&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,g,_,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,v,m[t].width,m[t].height,0,g,_,m[t].data);for(let r=0;r>c),r=Math.max(1,i.height>>c);s===e.TEXTURE_3D||s===e.TEXTURE_2D_ARRAY?n.texImage3D(s,c,f,t,r,i.depth,0,l,d,null):n.texImage2D(s,c,f,t,r,0,l,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),F(i)?h.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,s,m.__webglTexture,0,ke(i)):(s===e.TEXTURE_2D||s>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&s<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,s,m.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function xe(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=O(n.stencilBuffer,a),s=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=ke(n);F(n)?h.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,s,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error(`target.depthTexture not supported in Cube render targets`);let e=t.texture.mipmaps;e&&e.length>0?Se(i.__webglFramebuffer[0],t):Se(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),xe(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),xe(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function we(t,n,i){let a=r.get(t);n!==void 0&&be(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&Ce(t)}function Te(t){let i=t.texture,a=r.get(t),o=r.get(i);t.addEventListener(`dispose`,ne);let s=t.textures,c=t.isWebGLCubeRenderTarget===!0,l=s.length>1;if(l||(o.__webglTexture===void 0&&(o.__webglTexture=e.createTexture()),o.__version=i.version,f.memory.textures++),c){a.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){a.__webglFramebuffer[t]=[];for(let n=0;n0){a.__webglFramebuffer=[];for(let t=0;t0&&F(t)===!1){a.__webglMultisampledFramebuffer=e.createFramebuffer(),a.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(F(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,l=r.get(t),u=i.length>1;if(u)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,l.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,l.__webglFramebuffer);for(let n=0;n0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function Ae(e){let t=f.render.frame;y.get(e)!==t&&(y.set(e,t),e.update())}function I(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(G.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&R(`WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):z(`WebGLTextures: Unsupported texture color space:`,n)),t}function L(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(v.width=e.naturalWidth||e.width,v.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(v.width=e.displayWidth,v.height=e.displayHeight):(v.width=e.width,v.height=e.height),v}this.allocateTextureUnit=oe,this.resetTextureUnits=ae,this.setTexture2D=ce,this.setTexture2DArray=le,this.setTexture3D=ue,this.setTextureCube=N,this.rebindTextures=we,this.setupRenderTarget=Te,this.updateRenderTargetMipmap=Ee,this.updateMultisampleRenderTarget=Oe,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=be,this.useMultisampledRTT=F}function sh(e,t){function n(n,r=``){let i,a=G.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===35899)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===`srgb`)if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496)if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36283)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var ch=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,lh=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`,uh=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new as(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new Wi({vertexShader:ch,fragmentShader:lh,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ni(new Ic(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},dh=class extends Ft{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new uh,g={},_=t.getContextAttributes(),y=null,b=null,x=[],S=[],w=new H,T=null,E=new Yi;E.viewport=new K;let D=new Yi;D.viewport=new K;let O=[E,D],k=new Eu,te=null,ne=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return t===void 0&&(t=new ra,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return t===void 0&&(t=new ra,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return t===void 0&&(t=new ra,x[e]=t),t.getHandSpace()};function M(e){let t=S.indexOf(e.inputSource);if(t===-1)return;let n=x[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function ie(){r.removeEventListener(`select`,M),r.removeEventListener(`selectstart`,M),r.removeEventListener(`selectend`,M),r.removeEventListener(`squeeze`,M),r.removeEventListener(`squeezestart`,M),r.removeEventListener(`squeezeend`,M),r.removeEventListener(`end`,ie),r.removeEventListener(`inputsourceschange`,ae);for(let e=0;e=0&&(S[r]=null,x[r].disconnect(n))}for(let t=0;t=S.length){S.push(n),r=e;break}else if(S[e]===null){S[e]=n,r=e;break}if(r===-1)break}let i=x[r];i&&i.connect(n)}}let oe=new U,se=new U;function ce(e,t,n){oe.setFromMatrixPosition(t.matrixWorld),se.setFromMatrixPosition(n.matrixWorld);let r=oe.distanceTo(se),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function le(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),k.near=D.near=E.near=t,k.far=D.far=E.far=n,(te!==k.near||ne!==k.far)&&(r.updateRenderState({depthNear:k.near,depthFar:k.far}),te=k.near,ne=k.far),k.layers.mask=e.layers.mask|6,E.layers.mask=k.layers.mask&3,D.layers.mask=k.layers.mask&5;let i=e.parent,a=k.cameras;le(k,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,fh.copy(o),fh.x*=-1,fh.y*=-1,fh.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(fh.y*=-1,fh.z*=-1),e.envMapRotation.value.setFromMatrix4(ph.makeRotationFromEuler(fh)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function hh(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?R(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):R(`WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var gh=new Uint16Array([11481,15204,11534,15171,11808,15015,12385,14843,12894,14716,13396,14600,13693,14483,13976,14366,14237,14171,14405,13961,14511,13770,14605,13598,14687,13444,14760,13305,14822,13066,14876,12857,14923,12675,14963,12517,14997,12379,15025,12230,15049,12023,15070,11843,15086,11687,15100,11551,15111,11433,15120,11330,15127,11217,15132,11060,15135,10922,15138,10801,15139,10695,15139,10600,13012,14923,13020,14917,13064,14886,13176,14800,13349,14666,13513,14526,13724,14398,13960,14230,14200,14020,14383,13827,14488,13651,14583,13491,14667,13348,14740,13132,14803,12908,14856,12713,14901,12542,14938,12394,14968,12241,14992,12017,15010,11822,15024,11654,15034,11507,15041,11380,15044,11269,15044,11081,15042,10913,15037,10764,15031,10635,15023,10520,15014,10419,15003,10330,13657,14676,13658,14673,13670,14660,13698,14622,13750,14547,13834,14442,13956,14317,14112,14093,14291,13889,14407,13704,14499,13538,14586,13389,14664,13201,14733,12966,14792,12758,14842,12577,14882,12418,14915,12272,14940,12033,14959,11826,14972,11646,14980,11490,14983,11355,14983,11212,14979,11008,14971,10830,14961,10675,14950,10540,14936,10420,14923,10315,14909,10204,14894,10041,14089,14460,14090,14459,14096,14452,14112,14431,14141,14388,14186,14305,14252,14130,14341,13941,14399,13756,14467,13585,14539,13430,14610,13272,14677,13026,14737,12808,14790,12617,14833,12449,14869,12303,14896,12065,14916,11845,14929,11655,14937,11490,14939,11347,14936,11184,14930,10970,14921,10783,14912,10621,14900,10480,14885,10356,14867,10247,14848,10062,14827,9894,14805,9745,14400,14208,14400,14206,14402,14198,14406,14174,14415,14122,14427,14035,14444,13913,14469,13767,14504,13613,14548,13463,14598,13324,14651,13082,14704,12858,14752,12658,14795,12483,14831,12330,14860,12106,14881,11875,14895,11675,14903,11501,14905,11351,14903,11178,14900,10953,14892,10757,14880,10589,14865,10442,14847,10313,14827,10162,14805,9965,14782,9792,14757,9642,14731,9507,14562,13883,14562,13883,14563,13877,14566,13862,14570,13830,14576,13773,14584,13689,14595,13582,14613,13461,14637,13336,14668,13120,14704,12897,14741,12695,14776,12516,14808,12358,14835,12150,14856,11910,14870,11701,14878,11519,14882,11361,14884,11187,14880,10951,14871,10748,14858,10572,14842,10418,14823,10286,14801,10099,14777,9897,14751,9722,14725,9567,14696,9430,14666,9309,14702,13604,14702,13604,14702,13600,14703,13591,14705,13570,14707,13533,14709,13477,14712,13400,14718,13305,14727,13106,14743,12907,14762,12716,14784,12539,14807,12380,14827,12190,14844,11943,14855,11727,14863,11539,14870,11376,14871,11204,14868,10960,14858,10748,14845,10565,14829,10406,14809,10269,14786,10058,14761,9852,14734,9671,14705,9512,14674,9374,14641,9253,14608,9076,14821,13366,14821,13365,14821,13364,14821,13358,14821,13344,14821,13320,14819,13252,14817,13145,14815,13011,14814,12858,14817,12698,14823,12539,14832,12389,14841,12214,14850,11968,14856,11750,14861,11558,14866,11390,14867,11226,14862,10972,14853,10754,14840,10565,14823,10401,14803,10259,14780,10032,14754,9820,14725,9635,14694,9473,14661,9333,14627,9203,14593,8988,14557,8798,14923,13014,14922,13014,14922,13012,14922,13004,14920,12987,14919,12957,14915,12907,14909,12834,14902,12738,14894,12623,14888,12498,14883,12370,14880,12203,14878,11970,14875,11759,14873,11569,14874,11401,14872,11243,14865,10986,14855,10762,14842,10568,14825,10401,14804,10255,14781,10017,14754,9799,14725,9611,14692,9445,14658,9301,14623,9139,14587,8920,14548,8729,14509,8562,15008,12672,15008,12672,15008,12671,15007,12667,15005,12656,15001,12637,14997,12605,14989,12556,14978,12490,14966,12407,14953,12313,14940,12136,14927,11934,14914,11742,14903,11563,14896,11401,14889,11247,14879,10992,14866,10767,14851,10570,14833,10400,14812,10252,14789,10007,14761,9784,14731,9592,14698,9424,14663,9279,14627,9088,14588,8868,14548,8676,14508,8508,14467,8360,15080,12386,15080,12386,15079,12385,15078,12383,15076,12378,15072,12367,15066,12347,15057,12315,15045,12253,15030,12138,15012,11998,14993,11845,14972,11685,14951,11530,14935,11383,14920,11228,14904,10981,14887,10762,14870,10567,14850,10397,14827,10248,14803,9997,14774,9771,14743,9578,14710,9407,14674,9259,14637,9048,14596,8826,14555,8632,14514,8464,14471,8317,14427,8182,15139,12008,15139,12008,15138,12008,15137,12007,15135,12003,15130,11990,15124,11969,15115,11929,15102,11872,15086,11794,15064,11693,15041,11581,15013,11459,14987,11336,14966,11170,14944,10944,14921,10738,14898,10552,14875,10387,14850,10239,14824,9983,14794,9758,14762,9563,14728,9392,14692,9244,14653,9014,14611,8791,14569,8597,14526,8427,14481,8281,14436,8110,14391,7885,15188,11617,15188,11617,15187,11617,15186,11618,15183,11617,15179,11612,15173,11601,15163,11581,15150,11546,15133,11495,15110,11427,15083,11346,15051,11246,15024,11057,14996,10868,14967,10687,14938,10517,14911,10362,14882,10206,14853,9956,14821,9737,14787,9543,14752,9375,14715,9228,14675,8980,14632,8760,14589,8565,14544,8395,14498,8248,14451,8049,14404,7824,14357,7630,15228,11298,15228,11298,15227,11299,15226,11301,15223,11303,15219,11302,15213,11299,15204,11290,15191,11271,15174,11217,15150,11129,15119,11015,15087,10886,15057,10744,15024,10599,14990,10455,14957,10318,14924,10143,14891,9911,14856,9701,14820,9516,14782,9352,14744,9200,14703,8946,14659,8725,14615,8533,14568,8366,14521,8220,14472,7992,14423,7770,14374,7578,14315,7408,15260,10819,15260,10819,15259,10822,15258,10826,15256,10832,15251,10836,15246,10841,15237,10838,15225,10821,15207,10788,15183,10734,15151,10660,15120,10571,15087,10469,15049,10359,15012,10249,14974,10041,14937,9837,14900,9647,14860,9475,14820,9320,14779,9147,14736,8902,14691,8688,14646,8499,14598,8335,14549,8189,14499,7940,14448,7720,14397,7529,14347,7363,14256,7218,15285,10410,15285,10411,15285,10413,15284,10418,15282,10425,15278,10434,15272,10442,15264,10449,15252,10445,15235,10433,15210,10403,15179,10358,15149,10301,15113,10218,15073,10059,15033,9894,14991,9726,14951,9565,14909,9413,14865,9273,14822,9073,14777,8845,14730,8641,14682,8459,14633,8300,14583,8129,14531,7883,14479,7670,14426,7482,14373,7321,14305,7176,14201,6939,15305,9939,15305,9940,15305,9945,15304,9955,15302,9967,15298,9989,15293,10010,15286,10033,15274,10044,15258,10045,15233,10022,15205,9975,15174,9903,15136,9808,15095,9697,15053,9578,15009,9451,14965,9327,14918,9198,14871,8973,14825,8766,14775,8579,14725,8408,14675,8259,14622,8058,14569,7821,14515,7615,14460,7435,14405,7276,14350,7108,14256,6866,14149,6653,15321,9444,15321,9445,15321,9448,15320,9458,15317,9470,15314,9490,15310,9515,15302,9540,15292,9562,15276,9579,15251,9577,15226,9559,15195,9519,15156,9463,15116,9389,15071,9304,15025,9208,14978,9023,14927,8838,14878,8661,14827,8496,14774,8344,14722,8206,14667,7973,14612,7749,14556,7555,14499,7382,14443,7229,14385,7025,14322,6791,14210,6588,14100,6409,15333,8920,15333,8921,15332,8927,15332,8943,15329,8965,15326,9002,15322,9048,15316,9106,15307,9162,15291,9204,15267,9221,15244,9221,15212,9196,15175,9134,15133,9043,15088,8930,15040,8801,14990,8665,14938,8526,14886,8391,14830,8261,14775,8087,14719,7866,14661,7664,14603,7482,14544,7322,14485,7178,14426,6936,14367,6713,14281,6517,14166,6348,14054,6198,15341,8360,15341,8361,15341,8366,15341,8379,15339,8399,15336,8431,15332,8473,15326,8527,15318,8585,15302,8632,15281,8670,15258,8690,15227,8690,15191,8664,15149,8612,15104,8543,15055,8456,15001,8360,14948,8259,14892,8122,14834,7923,14776,7734,14716,7558,14656,7397,14595,7250,14534,7070,14472,6835,14410,6628,14350,6443,14243,6283,14125,6135,14010,5889,15348,7715,15348,7717,15348,7725,15347,7745,15345,7780,15343,7836,15339,7905,15334,8e3,15326,8103,15310,8193,15293,8239,15270,8270,15240,8287,15204,8283,15163,8260,15118,8223,15067,8143,15014,8014,14958,7873,14899,7723,14839,7573,14778,7430,14715,7293,14652,7164,14588,6931,14524,6720,14460,6531,14396,6362,14330,6210,14207,6015,14086,5781,13969,5576,15352,7114,15352,7116,15352,7128,15352,7159,15350,7195,15348,7237,15345,7299,15340,7374,15332,7457,15317,7544,15301,7633,15280,7703,15251,7754,15216,7775,15176,7767,15131,7733,15079,7670,15026,7588,14967,7492,14906,7387,14844,7278,14779,7171,14714,6965,14648,6770,14581,6587,14515,6420,14448,6269,14382,6123,14299,5881,14172,5665,14049,5477,13929,5310,15355,6329,15355,6330,15355,6339,15355,6362,15353,6410,15351,6472,15349,6572,15344,6688,15337,6835,15323,6985,15309,7142,15287,7220,15260,7277,15226,7310,15188,7326,15142,7318,15090,7285,15036,7239,14976,7177,14914,7045,14849,6892,14782,6736,14714,6581,14645,6433,14576,6293,14506,6164,14438,5946,14369,5733,14270,5540,14140,5369,14014,5216,13892,5043,15357,5483,15357,5484,15357,5496,15357,5528,15356,5597,15354,5692,15351,5835,15347,6011,15339,6195,15328,6317,15314,6446,15293,6566,15268,6668,15235,6746,15197,6796,15152,6811,15101,6790,15046,6748,14985,6673,14921,6583,14854,6479,14785,6371,14714,6259,14643,6149,14571,5946,14499,5750,14428,5567,14358,5401,14242,5250,14109,5111,13980,4870,13856,4657,15359,4555,15359,4557,15358,4573,15358,4633,15357,4715,15355,4841,15353,5061,15349,5216,15342,5391,15331,5577,15318,5770,15299,5967,15274,6150,15243,6223,15206,6280,15161,6310,15111,6317,15055,6300,14994,6262,14928,6208,14860,6141,14788,5994,14715,5838,14641,5684,14566,5529,14492,5384,14418,5247,14346,5121,14216,4892,14079,4682,13948,4496,13822,4330,15359,3498,15359,3501,15359,3520,15359,3598,15358,3719,15356,3860,15355,4137,15351,4305,15344,4563,15334,4809,15321,5116,15303,5273,15280,5418,15250,5547,15214,5653,15170,5722,15120,5761,15064,5763,15002,5733,14935,5673,14865,5597,14792,5504,14716,5400,14640,5294,14563,5185,14486,5041,14410,4841,14335,4655,14191,4482,14051,4325,13918,4183,13790,4012,15360,2282,15360,2285,15360,2306,15360,2401,15359,2547,15357,2748,15355,3103,15352,3349,15345,3675,15336,4020,15324,4272,15307,4496,15285,4716,15255,4908,15220,5086,15178,5170,15128,5214,15072,5234,15010,5231,14943,5206,14871,5166,14796,5102,14718,4971,14639,4833,14559,4687,14480,4541,14402,4401,14315,4268,14167,4142,14025,3958,13888,3747,13759,3556,15360,923,15360,925,15360,946,15360,1052,15359,1214,15357,1494,15356,1892,15352,2274,15346,2663,15338,3099,15326,3393,15309,3679,15288,3980,15260,4183,15226,4325,15185,4437,15136,4517,15080,4570,15018,4591,14950,4581,14877,4545,14800,4485,14720,4411,14638,4325,14556,4231,14475,4136,14395,3988,14297,3803,14145,3628,13999,3465,13861,3314,13729,3177,15360,263,15360,264,15360,272,15360,325,15359,407,15358,548,15356,780,15352,1144,15347,1580,15339,2099,15328,2425,15312,2795,15292,3133,15264,3329,15232,3517,15191,3689,15143,3819,15088,3923,15025,3978,14956,3999,14882,3979,14804,3931,14722,3855,14639,3756,14554,3645,14470,3529,14388,3409,14279,3289,14124,3173,13975,3055,13834,2848,13701,2658,15360,49,15360,49,15360,52,15360,75,15359,111,15358,201,15356,283,15353,519,15348,726,15340,1045,15329,1415,15314,1795,15295,2173,15269,2410,15237,2649,15197,2866,15150,3054,15095,3140,15032,3196,14963,3228,14888,3236,14808,3224,14725,3191,14639,3146,14553,3088,14466,2976,14382,2836,14262,2692,14103,2549,13952,2409,13808,2278,13674,2154,15360,4,15360,4,15360,4,15360,13,15359,33,15358,59,15357,112,15353,199,15348,302,15341,456,15331,628,15316,827,15297,1082,15272,1332,15241,1601,15202,1851,15156,2069,15101,2172,15039,2256,14970,2314,14894,2348,14813,2358,14728,2344,14640,2311,14551,2263,14463,2203,14376,2133,14247,2059,14084,1915,13930,1761,13784,1609,13648,1464,15360,0,15360,0,15360,0,15360,3,15359,18,15358,26,15357,53,15354,80,15348,97,15341,165,15332,238,15318,326,15299,427,15275,529,15245,654,15207,771,15161,885,15108,994,15046,1089,14976,1170,14900,1229,14817,1266,14731,1284,14641,1282,14550,1260,14460,1223,14370,1174,14232,1116,14066,1050,13909,981,13761,910,13623,839]),_h=null;function vh(){return _h===null&&(_h=new Ba(gh,32,32,ae,T),_h.minFilter=p,_h.magFilter=p,_h.wrapS=o,_h.wrapT=o,_h.generateMipmaps=!1,_h.needsUpdate=!0),_h}var yh=class{constructor(e={}){let{canvas:t=Dt(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);f=n.getContextAttributes().alpha}else f=a;let p=new Set([ce,oe,ie]),m=new Set([v,C,x,ee,E,D]),h=new Uint32Array(4),_=new Int32Array(4),y=null,b=null,S=[],w=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let O=this,k=!1;this._outputColorSpace=Ze;let te=0,ne=0,A=null,re=-1,j=null,M=new K,ae=new K,se=null,le=new Y(0),ue=0,N=t.width,de=t.height,fe=1,pe=null,me=null,he=new K(0,0,N,de),ge=new K(0,0,N,de),_e=!1,ve=new oo,ye=!1,be=!1,xe=new q,Se=new U,Ce=new K,we={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Te=!1;function Ee(){return A===null?fe:1}let P=n;function De(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r181`),t.addEventListener(`webglcontextlost`,$e,!1),t.addEventListener(`webglcontextrestored`,et,!1),t.addEventListener(`webglcontextcreationerror`,tt,!1),P===null){let t=`webgl2`;if(P=De(t,e),P===null)throw De(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw e(`WebGLRenderer: `+e.message),e}let Oe,ke,F,Ae,I,L,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je;function Ye(){Oe=new Yf(P),Oe.init(),Ke=new sh(P,Oe),ke=new Tf(P,Oe,e,Ke),F=new ah(P,Oe),ke.reversedDepthBuffer&&d&&F.buffers.depth.setReversed(!0),Ae=new Qf(P),I=new Um,L=new oh(P,Oe,F,I,ke,Ke,Ae),je=new Df(O),Me=new Jf(O),Ne=new _f(P),qe=new Cf(P,Ne),Pe=new Xf(P,Ne,Ae,qe),Fe=new ep(P,Pe,Ne,Ae),Ue=new $f(P,ke,L),Be=new Ef(I),Ie=new Hm(O,je,Me,Oe,ke,qe,Be),Le=new mh(O,I),Re=new qm,ze=new eh(Oe),He=new Sf(O,je,Me,F,Fe,f,s),Ve=new rh(O,Fe,ke),Je=new hh(P,Ae,ke,F),We=new wf(P,Oe,Ae),Ge=new Zf(P,Oe,Ae),Ae.programs=Ie.programs,O.capabilities=ke,O.extensions=Oe,O.properties=I,O.renderLists=Re,O.shadowMap=Ve,O.state=F,O.info=Ae}Ye();let Xe=new dh(O,P);this.xr=Xe,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let e=Oe.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=Oe.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(e){e!==void 0&&(fe=e,this.setSize(N,de,!1))},this.getSize=function(e){return e.set(N,de)},this.setSize=function(e,n,r=!0){if(Xe.isPresenting){R(`WebGLRenderer: Can't change size while VR device is presenting.`);return}N=e,de=n,t.width=Math.floor(e*fe),t.height=Math.floor(n*fe),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(N*fe,de*fe).floor()},this.setDrawingBufferSize=function(e,n,r){N=e,de=n,fe=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(M)},this.getViewport=function(e){return e.copy(he)},this.setViewport=function(e,t,n,r){e.isVector4?he.set(e.x,e.y,e.z,e.w):he.set(e,t,n,r),F.viewport(M.copy(he).multiplyScalar(fe).round())},this.getScissor=function(e){return e.copy(ge)},this.setScissor=function(e,t,n,r){e.isVector4?ge.set(e.x,e.y,e.z,e.w):ge.set(e,t,n,r),F.scissor(ae.copy(ge).multiplyScalar(fe).round())},this.getScissorTest=function(){return _e},this.setScissorTest=function(e){F.setScissorTest(_e=e)},this.setOpaqueSort=function(e){pe=e},this.setTransparentSort=function(e){me=e},this.getClearColor=function(e){return e.copy(He.getClearColor())},this.setClearColor=function(){He.setClearColor(...arguments)},this.getClearAlpha=function(){return He.getClearAlpha()},this.setClearAlpha=function(){He.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(A!==null){let t=A.texture.format;e=p.has(t)}if(e){let e=A.texture.type,t=m.has(e),n=He.getClearColor(),r=He.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(h[0]=i,h[1]=a,h[2]=o,h[3]=r,P.clearBufferuiv(P.COLOR,0,h)):(_[0]=i,_[1]=a,_[2]=o,_[3]=r,P.clearBufferiv(P.COLOR,0,_))}else r|=P.COLOR_BUFFER_BIT}t&&(r|=P.DEPTH_BUFFER_BIT),n&&(r|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,$e,!1),t.removeEventListener(`webglcontextrestored`,et,!1),t.removeEventListener(`webglcontextcreationerror`,tt,!1),He.dispose(),Re.dispose(),ze.dispose(),I.dispose(),je.dispose(),Me.dispose(),Fe.dispose(),qe.dispose(),Je.dispose(),Ie.dispose(),Xe.dispose(),Xe.removeEventListener(`sessionstart`,ct),Xe.removeEventListener(`sessionend`,lt),ut.stop()};function $e(e){e.preventDefault(),Mt(`WebGLRenderer: Context Lost.`),k=!0}function et(){Mt(`WebGLRenderer: Context Restored.`),k=!1;let e=Ae.autoReset,t=Ve.enabled,n=Ve.autoUpdate,r=Ve.needsUpdate,i=Ve.type;Ye(),Ae.autoReset=e,Ve.enabled=t,Ve.autoUpdate=n,Ve.needsUpdate=r,Ve.type=i}function tt(e){z(`WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function nt(e){let t=e.target;t.removeEventListener(`dispose`,nt),rt(t)}function rt(e){it(e),I.remove(e)}function it(e){let t=I.get(e).programs;t!==void 0&&(t.forEach(function(e){Ie.releaseProgram(e)}),e.isShaderMaterial&&Ie.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=we);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=bt(e,t,n,r,i);F.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=Pe.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;qe.setup(i,r,s,n,c);let h,g=We;if(c!==null&&(h=Ne.get(c),g=Ge,g.setIndex(h)),i.isMesh)r.wireframe===!0?(F.setLineWidth(r.wireframeLinewidth*Ee()),g.setMode(P.LINES)):g.setMode(P.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),F.setLineWidth(e*Ee()),i.isLineSegments?g.setMode(P.LINES):i.isLineLoop?g.setMode(P.LINE_LOOP):g.setMode(P.LINE_STRIP)}else i.isPoints?g.setMode(P.POINTS):i.isSprite&&g.setMode(P.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)Nt(`WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(Oe.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?Ne.get(c).bytesPerElement:1,o=I.get(r).currentProgram.getUniforms();for(let r=0;r{function n(){if(r.forEach(function(e){I.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}Oe.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let ot=null;function st(e){ot&&ot(e)}function ct(){ut.stop()}function lt(){ut.start()}let ut=new gf;ut.setAnimationLoop(st),typeof self<`u`&&ut.setContext(self),this.setAnimationLoop=function(e){ot=e,Xe.setAnimationLoop(e),e===null?ut.stop():ut.start()},Xe.addEventListener(`sessionstart`,ct),Xe.addEventListener(`sessionend`,lt),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){z(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(k===!0)return;if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Xe.enabled===!0&&Xe.isPresenting===!0&&(Xe.cameraAutoUpdate===!0&&Xe.updateCamera(t),t=Xe.getCamera()),e.isScene===!0&&e.onBeforeRender(O,e,t,A),b=ze.get(e,w.length),b.init(t),w.push(b),xe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ve.setFromProjectionMatrix(xe,vt,t.reversedDepth),be=this.localClippingEnabled,ye=Be.init(this.clippingPlanes,be),y=Re.get(e,S.length),y.init(),S.push(y),Xe.enabled===!0&&Xe.isPresenting===!0){let e=O.xr.getDepthSensingMesh();e!==null&&dt(e,t,-1/0,O.sortObjects)}dt(e,t,0,O.sortObjects),y.finish(),O.sortObjects===!0&&y.sort(pe,me),Te=Xe.enabled===!1||Xe.isPresenting===!1||Xe.hasDepthSensing()===!1,Te&&He.addToRenderList(y,e),this.info.render.frame++,ye===!0&&Be.beginShadows();let n=b.state.shadowsArray;Ve.render(n,e,t),ye===!0&&Be.endShadows(),this.info.autoReset===!0&&this.info.reset();let r=y.opaque,i=y.transmissive;if(b.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t0&&pt(r,i,e,t),Te&&He.render(e),ft(y,e,t);A!==null&&ne===0&&(L.updateMultisampleRenderTarget(A),L.updateRenderTargetMipmap(A)),e.isScene===!0&&e.onAfterRender(O,e,t),qe.resetDefaultState(),re=-1,j=null,w.pop(),w.length>0?(b=w[w.length-1],ye===!0&&Be.setGlobalState(O.clippingPlanes,b.state.camera)):b=null,S.pop(),y=S.length>0?S[S.length-1]:null};function dt(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)b.pushLight(e),e.castShadow&&b.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ve.intersectsSprite(e)){r&&Ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(xe);let t=Fe.update(e),i=e.material;i.visible&&y.push(e,t,i,n,Ce.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ve.intersectsObject(e))){let t=Fe.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),Ce.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),Ce.copy(e.boundingSphere.center)),Ce.applyMatrix4(e.matrixWorld).applyMatrix4(xe)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&mt(i,t,n),a.length>0&&mt(a,t,n),o.length>0&&mt(o,t,n),F.buffers.depth.setTest(!0),F.buffers.depth.setMask(!0),F.buffers.color.setMask(!0),F.setPolygonOffset(!1)}function pt(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;b.state.transmissionRenderTarget[r.id]===void 0&&(b.state.transmissionRenderTarget[r.id]=new En(1,1,{generateMipmaps:!0,type:Oe.has(`EXT_color_buffer_half_float`)||Oe.has(`EXT_color_buffer_float`)?T:v,minFilter:g,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:G.workingColorSpace}));let a=b.state.transmissionRenderTarget[r.id],o=r.viewport||M;a.setSize(o.z*O.transmissionResolutionScale,o.w*O.transmissionResolutionScale);let s=O.getRenderTarget(),c=O.getActiveCubeFace(),l=O.getActiveMipmapLevel();O.setRenderTarget(a),O.getClearColor(le),ue=O.getClearAlpha(),ue<1&&O.setClearColor(16777215,.5),O.clear(),Te&&He.render(n);let u=O.toneMapping;O.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),b.setupLightsView(r),ye===!0&&Be.setGlobalState(O.clippingPlanes,r),mt(e,n,r),L.updateMultisampleRenderTarget(a),L.updateRenderTargetMipmap(a),Oe.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0),d=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=0;r.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(m=O.toneMapping);let h=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=h===void 0?0:h.length,_=I.get(r),v=b.state.lights;if(ye===!0&&(be===!0||e!==j)){let t=e===j&&r.id===re;Be.setState(r,e,t)}let y=!1;r.version===_.__version?_.needsLights&&_.lightsStateVersion!==v.state.version?y=!0:_.outputColorSpace===s?i.isBatchedMesh&&_.batching===!1||!i.isBatchedMesh&&_.batching===!0||i.isBatchedMesh&&_.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&_.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&_.instancing===!1||!i.isInstancedMesh&&_.instancing===!0||i.isSkinnedMesh&&_.skinning===!1||!i.isSkinnedMesh&&_.skinning===!0||i.isInstancedMesh&&_.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&_.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&_.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&_.instancingMorph===!1&&i.morphTexture!==null?y=!0:_.envMap===c?r.fog===!0&&_.fog!==a||_.numClippingPlanes!==void 0&&(_.numClippingPlanes!==Be.numPlanes||_.numIntersection!==Be.numIntersection)?y=!0:_.vertexAlphas===l&&_.vertexTangents===u&&_.morphTargets===d&&_.morphNormals===f&&_.morphColors===p&&_.toneMapping===m?_.morphTargetsCount!==g&&(y=!0):y=!0:y=!0:y=!0:(y=!0,_.__version=r.version);let x=_.currentProgram;y===!0&&(x=gt(r,t,i));let S=!1,C=!1,w=!1,T=x.getUniforms(),E=_.uniforms;if(F.useProgram(x.program)&&(S=!0,C=!0,w=!0),r.id!==re&&(re=r.id,C=!0),S||j!==e){F.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),T.setValue(P,`projectionMatrix`,e.projectionMatrix),T.setValue(P,`viewMatrix`,e.matrixWorldInverse);let t=T.map.cameraPosition;t!==void 0&&t.setValue(P,Se.setFromMatrixPosition(e.matrixWorld)),ke.logarithmicDepthBuffer&&T.setValue(P,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&T.setValue(P,`isOrthographic`,e.isOrthographicCamera===!0),j!==e&&(j=e,C=!0,w=!0)}if(i.isSkinnedMesh){T.setOptional(P,i,`bindMatrix`),T.setOptional(P,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),T.setValue(P,`boneTexture`,e.boneTexture,L))}i.isBatchedMesh&&(T.setOptional(P,i,`batchingTexture`),T.setValue(P,`batchingTexture`,i._matricesTexture,L),T.setOptional(P,i,`batchingIdTexture`),T.setValue(P,`batchingIdTexture`,i._indirectTexture,L),T.setOptional(P,i,`batchingColorTexture`),i._colorsTexture!==null&&T.setValue(P,`batchingColorTexture`,i._colorsTexture,L));let D=n.morphAttributes;if((D.position!==void 0||D.normal!==void 0||D.color!==void 0)&&Ue.update(i,n,x),(C||_.receiveShadow!==i.receiveShadow)&&(_.receiveShadow=i.receiveShadow,T.setValue(P,`receiveShadow`,i.receiveShadow)),r.isMeshGouraudMaterial&&r.envMap!==null&&(E.envMap.value=c,E.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1),r.isMeshStandardMaterial&&r.envMap===null&&t.environment!==null&&(E.envMapIntensity.value=t.environmentIntensity),E.dfgLUT!==void 0&&(E.dfgLUT.value=vh()),C&&(T.setValue(P,`toneMappingExposure`,O.toneMappingExposure),_.needsLights&&xt(E,w),a&&r.fog===!0&&Le.refreshFogUniforms(E,a),Le.refreshMaterialUniforms(E,r,fe,de,b.state.transmissionRenderTarget[e.id]),sm.upload(P,_t(_),E,L)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(sm.upload(P,_t(_),E,L),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&T.setValue(P,`center`,i.center),T.setValue(P,`modelViewMatrix`,i.modelViewMatrix),T.setValue(P,`normalMatrix`,i.normalMatrix),T.setValue(P,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&L.useMultisampledRTT(e)===!1?I.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,M.copy(e.viewport),ae.copy(e.scissor),se=e.scissorTest}else M.copy(he).multiplyScalar(fe).floor(),ae.copy(ge).multiplyScalar(fe).floor(),se=_e;if(n!==0&&(i=Ct),F.bindFramebuffer(P.FRAMEBUFFER,i)&&r&&F.drawBuffers(e,i),F.viewport(M),F.scissor(ae),F.setScissorTest(se),a){let r=I.get(e.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){let r=t;for(let t=0;t=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+s),P.readPixels(t,n,r,i,Ke.convert(c),Ke.convert(l),a))}finally{let e=A===null?null:I.get(A).__webglFramebuffer;F.bindFramebuffer(P.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=I.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){F.bindFramebuffer(P.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(!ke.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!ke.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,d),P.bufferData(P.PIXEL_PACK_BUFFER,a.byteLength,P.STREAM_READ),e.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+s),P.readPixels(t,n,r,i,Ke.convert(l),Ke.convert(u),0);let f=A===null?null:I.get(A).__webglFramebuffer;F.bindFramebuffer(P.FRAMEBUFFER,f);let p=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Pt(P,p,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,d),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,a),P.deleteBuffer(d),P.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;L.setTexture2D(e,0),P.copyTexSubImage2D(P.TEXTURE_2D,n,0,0,o,s,i,a),F.unbindTexture()};let wt=P.createFramebuffer(),Tt=P.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=null){a===null&&(i===0?a=0:(Nt(`WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.`),a=i,i=0));let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ke.convert(t.format),_=Ke.convert(t.type),v;t.isData3DTexture?(L.setTexture3D(t,0),v=P.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(L.setTexture2DArray(t,0),v=P.TEXTURE_2D_ARRAY):(L.setTexture2D(t,0),v=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,t.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,t.unpackAlignment);let y=P.getParameter(P.UNPACK_ROW_LENGTH),b=P.getParameter(P.UNPACK_IMAGE_HEIGHT),x=P.getParameter(P.UNPACK_SKIP_PIXELS),S=P.getParameter(P.UNPACK_SKIP_ROWS),C=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,h.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,h.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,l),P.pixelStorei(P.UNPACK_SKIP_ROWS,u),P.pixelStorei(P.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=I.get(e),r=I.get(t),h=I.get(n.__renderTarget),g=I.get(r.__renderTarget);F.bindFramebuffer(P.READ_FRAMEBUFFER,h.__webglFramebuffer),F.bindFramebuffer(P.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=Dh),r<-Math.PI?r+=Dh:r>Math.PI&&(r-=Dh),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(Eh.setFromSpherical(this._spherical),Eh.applyQuaternion(this._quatInverse),t.copy(this.target).add(Eh),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=Eh.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new U(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new U(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=Eh.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(Ch.origin.copy(this.object.position),Ch.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Ch.direction))kh||8*(1-this._lastQuaternion.dot(this.object.quaternion))>kh||this._lastTargetPosition.distanceToSquared(this.target)>kh?(this.dispatchEvent(bh),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?Dh/60/60*this.autoRotateSpeed:Dh/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Eh.setFromMatrixColumn(t,0),Eh.multiplyScalar(-e),this._panOffset.add(Eh)}_panUp(e,t){this.screenSpacePanning===!0?Eh.setFromMatrixColumn(t,1):(Eh.setFromMatrixColumn(t,0),Eh.crossVectors(this.object.up,Eh)),Eh.multiplyScalar(e),this._panOffset.add(Eh)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;Eh.copy(r).sub(this.target);let i=Eh.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dh*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dh*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Dh*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Dh*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Dh*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Dh*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dh*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dh*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t{if(!e)return;let i=new AbortController,a;return r.getOverlayLogo(t,i.signal).then(e=>{i.signal.aborted||(e?(a=URL.createObjectURL(e),o({url:a,token:t,revision:n})):o(null))}).catch(()=>{i.signal.aborted||o(null)}),()=>{i.abort(),a&&URL.revokeObjectURL(a)}},[e,t,n]),e&&a?.token===t&&a.revision===n?a.url:null}var o={logo:!1,logoRevision:0,from:``,to:``};function s(e){return/^#[0-9a-f]{6}$/i.test(e)}function c(e,t){return e&&t&&s(e)&&s(t)?`linear-gradient(to right, ${e}, ${t})`:void 0}function l(e){if(e)return{backgroundImage:e,backgroundClip:`text`,WebkitBackgroundClip:`text`,color:`transparent`,WebkitTextFillColor:`transparent`}}var u={landscape:{width:1920,height:1080},portrait:{width:1080,height:1920}},d=t();function f({layout:e,preview:t=!1,children:n}){let r=(0,i.useRef)(null),[a,o]=(0,i.useState)(0),{width:s,height:c}=u[e];(0,i.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=()=>o(Math.min(e.clientWidth/s,e.clientHeight/c));if(t(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,c]);let l={width:s,height:c,"--overlay-vmin":`10.8px`,"--overlay-height":`${c}px`,position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%) scale(${a})`,transformOrigin:`center`};return(0,d.jsx)(`div`,{ref:r,className:t?`relative w-full overflow-hidden`:`fixed inset-0 overflow-hidden`,style:t?{aspectRatio:`${s} / ${c}`}:void 0,children:(0,d.jsx)(`div`,{style:l,children:n})})}export{c as a,s as i,u as n,l as o,o as r,a as s,f as t}; \ No newline at end of file diff --git a/static/assets/PdfPreviewModal-4n0YPMFt.js b/static/assets/PdfPreviewModal-4n0YPMFt.js new file mode 100644 index 000000000..a47000a83 --- /dev/null +++ b/static/assets/PdfPreviewModal-4n0YPMFt.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-HcZyFCUi.js","assets/index-CovRLYqQ.js","assets/chunk-aKtaBQYM.js","assets/QueryClientProvider-Ce8_sN3w.js","assets/client-DnySrlFv.js","assets/useMutation-B-Tr2hIP.js","assets/useQueries-Be6PMvSC.js","assets/useQuery-BBCjCezC.js","assets/createLucideIcon-DvBYJlWL.js","assets/arrow-down-Cj0DZhNf.js","assets/arrow-up-D-pfJ3WZ.js","assets/calendar-BLKPnWqV.js","assets/check-Ck0cMLU4.js","assets/info-ROUoQhJR.js","assets/ToastContext-BRX0SW3C.js","assets/loader-circle-BEmFtawu.js","assets/x-DR-Trv6U.js","assets/file-DDkFXH-b.js","assets/triangle-alert-Dt_1FcBy.js","assets/react-dom-B8Dg6xzp.js","assets/Button-DDr6eAFy.js","assets/Card-Bzc64K35.js","assets/filamentSwatchHelpers-D3oXQSGk.js","assets/date-G9KUauqz.js","assets/index-LBjsy7mY.css"])))=>i.map(i=>d[i]); +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,l as i,w as a}from"./client-DnySrlFv.js";import{t as o}from"./loader-circle-BEmFtawu.js";import{n as s,t as c}from"./zoom-out-DNNe6DMN.js";import{t as l}from"./file-DDkFXH-b.js";import{Kn as u,Mn as d,jn as ee,xn as te}from"./index-CovRLYqQ.js";import{n as ne,r as f,t as p}from"./usePreviewFullscreen-ButueZqN.js";var m=e(n(),1),h=t(),g=.4,_=4,v=1.25,y=30,b=Math.log(v)/y,re=150,x=16*1024*1024,S=`/assets/pdfjs/`,C=e=>Math.min(_,Math.max(g,e));function w(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(!n)return Promise.resolve(null);n.fillStyle=`#ffffff`,n.fillRect(0,0,256,256);let r=256/Math.max(e.width,e.height),i=e.width*r,a=e.height*r;return n.drawImage(e,(256-i)/2,(256-a)/2,i,a),new Promise(e=>t.toBlob(e,`image/png`))}function ie(e){return e.deltaMode===1?e.deltaY*16:e.deltaMode===2?e.deltaY*100:e.deltaY}function T({libraryFileId:e,filename:t,fileSize:n,onClose:g,onSnapshot:_}){let{t:T}=a(),E=p(),{panelRef:D,isFullscreen:ae,toggleFullscreen:oe}=E,O=(0,m.useRef)(null),k=(0,m.useRef)(null),A=(0,m.useRef)(null),j=(0,m.useRef)(!1),M=(0,m.useRef)(_);(0,m.useEffect)(()=>{M.current=_});let[N,P]=(0,m.useState)(null),[F,I]=(0,m.useState)(1),[L,R]=(0,m.useState)(1),[z,B]=(0,m.useState)(1),[V,se]=(0,m.useState)(0),[H,U]=(0,m.useState)(null),[ce,W]=(0,m.useState)(!0),G=(0,m.useRef)(L),K=(0,m.useRef)(null),q=(0,m.useRef)(null),J=(0,m.useRef)(new Map),Y=(0,m.useRef)(null),X=(0,m.useCallback)((e,t,n)=>{let r=O.current,i=k.current;if(r&&i){let e=r.getBoundingClientRect(),a=i.getBoundingClientRect(),o=t==null?e.width/2:t-e.left,s=n==null?e.height/2:n-e.top;q.current=a.width>0&&a.height>0?{fx:(o+e.left-a.left)/a.width,fy:(s+e.top-a.top)/a.height,px:o,py:s}:null}R(t=>C(t*e))},[]);(0,m.useEffect)(()=>{let e=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`+`||e.key===`=`?(e.preventDefault(),X(v)):e.key===`-`?(e.preventDefault(),X(1/v)):e.key===`0`&&(e.preventDefault(),q.current=null,R(1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[X]),(0,m.useEffect)(()=>{let e=O.current;if(!e)return;let t=t=>{if(!k.current||!K.current||!(t.ctrlKey||t.metaKey)&&!(e.scrollHeight<=e.clientHeight&&e.scrollWidth<=e.clientWidth))return;t.preventDefault();let n=Math.max(-30,Math.min(y,ie(t)));X(Math.exp(-n*b),t.clientX,t.clientY)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[X]);let le=e=>{e.pointerType===`touch`&&(J.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),Y.current=null)},ue=e=>{if(e.pointerType!==`touch`)return;let t=J.current,n=t.get(e.pointerId);if(!n)return;if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.size===1){let t=O.current;t&&(t.scrollLeft-=e.clientX-n.x,t.scrollTop-=e.clientY-n.y);return}if(t.size!==2)return;let[r,i]=Array.from(t.values()),a=Math.hypot(r.x-i.x,r.y-i.y),o=Y.current;Y.current=a,o!=null&&o>0&&a>0&&X(a/o,(r.x+i.x)/2,(r.y+i.y)/2)},Z=e=>{e.pointerType===`touch`&&(J.current.delete(e.pointerId),Y.current=null)};(0,m.useLayoutEffect)(()=>{G.current=L;let e=k.current,t=O.current,n=K.current;if(!e||!t||!n)return;e.style.width=`${n.width*L}px`,e.style.height=`${n.height*L}px`;let r=q.current;q.current=null,r&&(t.scrollLeft=e.offsetLeft+r.fx*e.offsetWidth-r.px,t.scrollTop=e.offsetTop+r.fy*e.offsetHeight-r.py)},[L]),(0,m.useEffect)(()=>{if(L===z)return;let e=window.setTimeout(()=>B(L),re);return()=>window.clearTimeout(e)},[L,z]),(0,m.useEffect)(()=>{let e=D.current;if(!e)return;let t=new ResizeObserver(()=>se(e=>e+1));return t.observe(e),()=>t.disconnect()},[D]),(0,m.useEffect)(()=>{let t=!1,a=null;if(P(null),U(null),I(1),W(!0),n>52428800){U(T(`fileManager.preview.tooLarge`,{size:l(n)})),W(!1);return}let o={},s=i();return s&&(o.Authorization=`Bearer ${s}`),(async()=>{let n=await fetch(r.getLibraryFileDownloadUrl(e),{headers:o});if(!n.ok)throw Error(`HTTP ${n.status}`);let i=await n.arrayBuffer(),s=await u(()=>import(`./pdf-HcZyFCUi.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]));if(s.GlobalWorkerOptions.workerSrc||(s.GlobalWorkerOptions.workerSrc=(await u(async()=>{let{default:e}=await import(`./pdf.worker.min-DpOxPwGP.js`);return{default:e}},[])).default),a=s.getDocument({data:new Uint8Array(i),cMapUrl:`${S}cmaps/`,iccUrl:`${S}iccs/`,standardFontDataUrl:`${S}standard_fonts/`,wasmUrl:`${S}wasm/`}),t){a.destroy();return}let c=await a.promise;t||P(c)})().catch(e=>{console.error(`[pdf-preview] load failed`,e),t||(U(T(`fileManager.preview.error`)),W(!1))}),()=>{t=!0,A.current?.cancel(),A.current=null,a?.destroy()}},[e,n,T]),(0,m.useEffect)(()=>{if(!N)return;let e=!1;return W(!0),(async()=>{let t=await N.getPage(F),n=k.current,r=O.current;if(!n||!r||e)return;let i=t.getViewport({scale:1}),a=Math.max((r.clientWidth-32)/i.width,.1),o=Math.min(window.devicePixelRatio||1,2),s=a*z*o,c=i.width*s*(i.height*s),l=c>x?s*Math.sqrt(x/c):s,u=t.getViewport({scale:l});n.width=u.width,n.height=u.height,K.current={width:i.width*a,height:i.height*a},n.style.width=`${K.current.width*G.current}px`,n.style.height=`${K.current.height*G.current}px`,A.current?.cancel();let d=t.render({canvas:n,viewport:u});if(A.current=d,await d.promise,!e&&(W(!1),F===1&&M.current&&!j.current)){j.current=!0;let t=await w(n);t&&!e&&M.current?.(t)}})().catch(t=>{!e&&t?.name!==`RenderingCancelledException`&&(console.error(`[pdf-preview] render failed`,t),U(T(`fileManager.preview.error`)),W(!1))}),()=>{e=!0}},[N,F,z,V,T]);let Q=N?.numPages??0,$=f;return(0,h.jsx)(ne,{title:t,fullscreen:E,onClose:g,icon:(0,h.jsx)(te,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),actions:(0,h.jsxs)(h.Fragment,{children:[N&&Q>1&&(0,h.jsxs)(`div`,{className:`flex items-center gap-1 mr-2`,children:[(0,h.jsx)(`button`,{onClick:()=>I(e=>Math.max(1,e-1)),disabled:F<=1,className:`${$} disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":T(`fileManager.preview.prevPage`),children:(0,h.jsx)(ee,{className:`w-4 h-4`})}),(0,h.jsx)(`span`,{className:`text-sm text-bambu-gray whitespace-nowrap`,children:T(`fileManager.preview.page`,{current:F,total:Q})}),(0,h.jsx)(`button`,{onClick:()=>I(e=>Math.min(Q,e+1)),disabled:F>=Q,className:`${$} disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":T(`fileManager.preview.nextPage`),children:(0,h.jsx)(d,{className:`w-4 h-4`})})]}),N&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`button`,{onClick:()=>X(1/v),className:$,"aria-label":T(`fileManager.preview.zoomOut`),children:(0,h.jsx)(c,{className:`w-4 h-4`})}),(0,h.jsx)(`button`,{onClick:()=>X(v),className:$,"aria-label":T(`fileManager.preview.zoomIn`),children:(0,h.jsx)(s,{className:`w-4 h-4`})})]})]}),children:(0,h.jsxs)(`div`,{ref:O,"data-testid":`pdf-preview-page`,className:`relative flex-1 min-h-0 overflow-auto bg-bambu-dark p-4 touch-none ${ae?``:`rounded-b-lg`}`,onDoubleClick:oe,onPointerDown:le,onPointerMove:ue,onPointerUp:Z,onPointerCancel:Z,onPointerLeave:Z,children:[H?(0,h.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,h.jsx)(`p`,{className:`text-bambu-gray text-center`,children:H})}):(0,h.jsx)(`div`,{className:`flex justify-center min-w-fit`,children:(0,h.jsx)(`canvas`,{ref:k,className:`shadow-lg`})}),!H&&ce&&(0,h.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,h.jsx)(o,{className:`w-8 h-8 text-bambu-green animate-spin`})})]})})}export{T as PdfPreviewModal}; \ No newline at end of file diff --git a/static/assets/PhotoGalleryModal-CHRwUNN5.js b/static/assets/PhotoGalleryModal-CHRwUNN5.js new file mode 100644 index 000000000..9fec89235 --- /dev/null +++ b/static/assets/PhotoGalleryModal-CHRwUNN5.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{n as c}from"./ToastContext-BRX0SW3C.js";import{t as l}from"./cog-Dol1I0kq.js";import{t as u}from"./loader-circle-BEmFtawu.js";import{t as d}from"./play-DIDYtk2S.js";import{t as f}from"./triangle-alert-Dt_1FcBy.js";import{t as p}from"./x-DR-Trv6U.js";import{t as m}from"./Button-DDr6eAFy.js";import{At as h,Jt as g,Mn as _,_t as v,jn as y,t as b,wn as x}from"./index-CovRLYqQ.js";var S=e(n(),1),C=t();function w({source:e,onClose:t}){let{t:n}=i(),l=a(),{showToast:u}=c(),[f,m]=(0,S.useState)(null),[h,g]=(0,S.useState)(null),[_,v]=(0,S.useState)(1),{trackJob:y}=b(),{data:x,isLoading:w}=o({queryKey:[`slicer-pipelines`],queryFn:()=>r.listSlicerPipelines()}),{data:D}=o({queryKey:[`printers`],queryFn:()=>r.getPrinters()}),{data:O}=o({queryKey:[`app-settings`],queryFn:()=>r.getSettings()}),k=O?.pipeline_max_copies??50,A={kind:e.kind,id:e.id},j=s({mutationFn:e=>r.checkPipelineEligibility(e,A)}),M=s({mutationFn:({pipelineId:e,force:t})=>r.runPipeline(e,A,t,_),onSuccess:r=>{l.invalidateQueries({queryKey:[`slicer-pipelines`]}),l.invalidateQueries({queryKey:[`pipeline-runs`]}),r.slice_job_id&&y(r.slice_job_id,e.kind,e.filename),u(n(`library.runWithPipeline.toast.started`,`Pipeline run started`),`success`),t()},onError:e=>{u(e.message||n(`library.runWithPipeline.toast.failed`,`Could not start run`),`error`)}}),N=x?.pipelines??[],P=(D??[]).reduce((e,t)=>(e[t.id]=t,e),{});return(0,C.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":n(`library.runWithPipeline.modalTitle`,`Run with pipeline`),children:(0,C.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary`,children:[(0,C.jsxs)(`h3`,{className:`text-sm font-semibold text-white flex items-center gap-2`,children:[(0,C.jsx)(d,{className:`w-4 h-4 text-bambu-green`}),f&&h?n(`library.runWithPipeline.confirmTitle`,`Confirm run`):n(`library.runWithPipeline.modalTitle`,`Run with pipeline`)]}),(0,C.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`common.close`,`Close`),className:`text-bambu-gray hover:text-white`,children:(0,C.jsx)(p,{className:`w-4 h-4`})})]}),(0,C.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-3`,children:f&&h?(0,C.jsx)(E,{pipeline:f,report:h,source:e,onBack:()=>{m(null),g(null)},onConfirm:()=>{f&&M.mutate({pipelineId:f.id,force:!0})},running:M.isPending}):(0,C.jsx)(T,{source:e,pipelines:N,printerById:P,loading:w||j.isPending,onPick:async e=>{if(!(e.target_printer_id||e.target_kind===`printer_class`&&e.target_model_class)){u(n(`library.runWithPipeline.noTargetMessage`,`This pipeline has no target printer set. Open it in Settings to pick one.`),`error`);return}m(e);try{let t=await j.mutateAsync(e.id);g(t),t.ok&&M.mutate({pipelineId:e.id,force:!1})}catch{m(null)}},copies:_,maxCopies:k,onCopiesChange:v})})]})})}function T({source:e,pipelines:t,printerById:n,loading:r,onPick:a,copies:o,maxCopies:s,onCopiesChange:c}){let{t:d}=i();return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[d(`library.runWithPipeline.sourceHint`,`Source`),`:`,` `,(0,C.jsx)(`span`,{className:`text-white`,children:e.filename})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(`label`,{className:`text-xs text-bambu-gray`,htmlFor:`run-pipeline-copies`,children:[d(`library.runWithPipeline.copies`,`Copies`),`:`]}),(0,C.jsx)(`input`,{id:`run-pipeline-copies`,type:`number`,min:1,max:s,value:o,onChange:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||c(Math.max(1,Math.min(s,t)))},"aria-label":d(`library.runWithPipeline.copies`,`Copies`),className:`w-20 px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`}),(0,C.jsx)(`span`,{className:`text-xs text-bambu-gray/60`,children:d(`library.runWithPipeline.copiesHint`,`max {{n}}`,{n:s})})]}),r&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,C.jsx)(u,{className:`w-4 h-4 animate-spin`}),d(`library.runWithPipeline.loading`,`Loading…`)]}),!r&&t.length===0&&(0,C.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:d(`library.runWithPipeline.empty`,`No pipelines saved yet. Open the Slice dialog and click "Save as pipeline" to create one.`)}),!r&&t.length>0&&(0,C.jsx)(`ul`,{className:`space-y-1.5`,"aria-label":d(`library.runWithPipeline.pipelineListAria`,`Available pipelines`),children:t.map(e=>{let t=e.target_kind===`printer_class`,r=e.target_printer_id?n[e.target_printer_id]?.name:null,i=t&&e.target_model_class?d(`library.runWithPipeline.classTarget`,`Any {{model}}`,{model:e.target_model_class}):null;return(0,C.jsx)(`li`,{children:(0,C.jsxs)(`button`,{type:`button`,onClick:()=>a(e),disabled:!(e.target_printer_id||t&&e.target_model_class),className:`w-full text-left px-3 py-2 rounded-md border border-bambu-dark-tertiary bg-bambu-dark/40 hover:bg-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(l,{className:`w-3.5 h-3.5 text-bambu-green flex-shrink-0`}),(0,C.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:e.name})]}),(0,C.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,C.jsx)(g,{className:`w-3 h-3`}),i?(0,C.jsx)(`span`,{children:i}):r?(0,C.jsx)(`span`,{children:r}):(0,C.jsx)(`span`,{className:`text-amber-700 dark:text-amber-400`,children:d(`library.runWithPipeline.noTarget`,`No target printer set`)})]})]})},e.id)})})]})}function E({pipeline:e,report:t,source:n,onBack:r,onConfirm:a,running:o}){let{t:s}=i();return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`text-xs text-bambu-gray`,children:[(0,C.jsxs)(`p`,{children:[s(`library.runWithPipeline.confirmIntro`,`Pre-flight found issues with this run`),`:`]}),(0,C.jsxs)(`p`,{className:`mt-1`,children:[(0,C.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[s(`library.runWithPipeline.sourceHint`,`Source`),`: `]}),(0,C.jsx)(`span`,{className:`text-white`,children:n.filename})]}),(0,C.jsxs)(`p`,{children:[(0,C.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[s(`library.runWithPipeline.pipelineHint`,`Pipeline`),`: `]}),(0,C.jsx)(`span`,{className:`text-white`,children:e.name})]}),t.target_printer_name&&(0,C.jsxs)(`p`,{children:[(0,C.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[s(`library.runWithPipeline.targetHint`,`Target`),`: `]}),(0,C.jsx)(`span`,{className:`text-white`,children:t.target_printer_name})]})]}),(0,C.jsx)(`ul`,{className:`space-y-1.5`,children:t.issues.map((e,t)=>(0,C.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,children:[(0,C.jsx)(f,{className:`w-3.5 h-3.5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`}),(0,C.jsx)(`span`,{className:`text-bambu-gray`,children:(0,C.jsx)(D,{issue:e})})]},t))}),(0,C.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:r,disabled:o,className:`px-3 py-1.5 text-xs text-bambu-gray hover:text-white`,children:s(`common.back`,`Back`)}),(0,C.jsxs)(`button`,{type:`button`,onClick:a,disabled:o,className:`px-3 py-1.5 text-xs bg-amber-500 hover:bg-amber-600 text-white rounded disabled:opacity-50 flex items-center gap-1`,children:[o?(0,C.jsx)(u,{className:`w-3 h-3 animate-spin`}):(0,C.jsx)(d,{className:`w-3 h-3`}),s(`library.runWithPipeline.runAnyway`,`Run anyway`)]})]})]})}function D({issue:e}){let{t}=i();switch(e.kind){case`printer_not_set`:return(0,C.jsx)(C.Fragment,{children:t(`library.runWithPipeline.issue.printerNotSet`,`No target printer set on this pipeline.`)});case`printer_not_found`:return(0,C.jsx)(C.Fragment,{children:t(`library.runWithPipeline.issue.printerNotFound`,`Target printer no longer exists.`)});case`printer_disabled`:return(0,C.jsx)(C.Fragment,{children:t(`library.runWithPipeline.issue.printerDisabled`,`Target printer is disabled.`)});case`printer_offline`:return(0,C.jsx)(C.Fragment,{children:t(`library.runWithPipeline.issue.printerOffline`,`Target printer is offline.`)});case`filament_type_mismatch`:return(0,C.jsx)(C.Fragment,{children:t(`library.runWithPipeline.issue.filamentType`,`Filament slot {{slot}}: expected {{expected}}, AMS has {{actual}}`,{slot:(e.slot_index??0)+1,expected:e.expected??`?`,actual:e.actual??`?`})});case`filament_color_mismatch`:return(0,C.jsx)(C.Fragment,{children:t(`library.runWithPipeline.issue.filamentColor`,`Filament slot {{slot}}: colour differs (expected {{expected}}, AMS has {{actual}})`,{slot:(e.slot_index??0)+1,expected:e.expected??`?`,actual:e.actual??`?`})});case`ams_slot_missing`:return(0,C.jsx)(C.Fragment,{children:t(`library.runWithPipeline.issue.amsSlotMissing`,`AMS slot {{slot}} not available on this printer`,{slot:(e.slot_index??0)+1})});case`filament_unverified`:return(0,C.jsx)(C.Fragment,{children:t(`library.runWithPipeline.issue.filamentUnverified`,`Filament slot {{slot}} comes from a cloud / standard preset and could not be statically verified.`,{slot:(e.slot_index??0)+1})});default:return(0,C.jsx)(C.Fragment,{children:e.kind})}}function O({onFiles:e,onRejected:t,extensions:n,disabled:r=!1}){let[i,a]=(0,S.useState)(!1),o=(0,S.useRef)(e),s=(0,S.useRef)(t),c=(0,S.useRef)(n);(0,S.useEffect)(()=>{o.current=e},[e]),(0,S.useEffect)(()=>{s.current=t},[t]),(0,S.useEffect)(()=>{c.current=n},[n]);let l=(0,S.useCallback)(e=>{r||(e.preventDefault(),e.dataTransfer.types.includes(`Files`)&&a(!0))},[r]),u=(0,S.useCallback)(e=>{r||(e.preventDefault(),e.dataTransfer.types.includes(`Files`)&&a(!0))},[r]),d=(0,S.useCallback)(e=>{if(r)return;e.preventDefault();let t=e.currentTarget,n=e.relatedTarget;(!n||!t.contains(n))&&a(!1)},[r]),f=(0,S.useCallback)(e=>{if(r)return;e.preventDefault(),a(!1);let t=Array.from(e.dataTransfer.files);if(t.length===0)return;let n=c.current,i=n&&n.length>0?t.filter(e=>n.some(t=>e.name.toLowerCase().endsWith(t))):t;i.length>0?o.current(i):s.current?.()},[r]);return(0,S.useEffect)(()=>{if(!i)return;let e=()=>a(!1),t=t=>{t.key===`Escape`&&e()};return document.addEventListener(`drop`,e),document.addEventListener(`dragend`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`drop`,e),document.removeEventListener(`dragend`,e),document.removeEventListener(`keydown`,t)}},[i]),{isDraggingOver:i,dragHandlers:{onDragOver:l,onDragEnter:u,onDragLeave:d,onDrop:f}}}function k(e){let{archiveName:t,photos:n,initialIndex:i,onClose:a,onDelete:o}=e,[s,c]=(0,S.useState)(()=>Math.min(Math.max(i??0,0),Math.max(n.length-1,0))),[l,u]=(0,S.useState)(!1);if((0,S.useEffect)(()=>{if(l)return;let e=e=>{e.key===`Escape`&&a(),e.key===`ArrowLeft`&&c(e=>Math.max(0,e-1)),e.key===`ArrowRight`&&c(e=>Math.min(n.length-1,e+1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a,n.length,l]),(0,S.useEffect)(()=>{s>=n.length&&c(Math.max(0,n.length-1))},[n.length,s]),n.length===0)return a(),null;let d=t=>e.getPhotoUrl?e.getPhotoUrl(t):r.getArchivePhotoUrl(e.archiveId,t),f=n[s],g=d(f);return(0,C.jsxs)(`div`,{className:`fixed inset-0 bg-black/90 flex items-center justify-center z-50`,onClick:e=>{e.stopPropagation(),a()},children:[(0,C.jsxs)(`div`,{className:`relative w-full h-full flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 bg-black/50`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:t}),(0,C.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`Photo `,s+1,` of `,n.length]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(m,{variant:`secondary`,size:`sm`,onClick:()=>{let e=document.createElement(`a`);e.href=g,e.download=`${t}_photo_${s+1}.jpg`,e.click()},children:[(0,C.jsx)(x,{className:`w-4 h-4`}),`Download`]}),o&&(0,C.jsx)(m,{variant:`secondary`,size:`sm`,onClick:()=>{o&&u(!0)},className:`text-red-400 hover:text-red-300`,children:(0,C.jsx)(h,{className:`w-4 h-4`})}),(0,C.jsx)(`button`,{onClick:a,className:`p-2 text-bambu-gray hover:text-white transition-colors`,children:(0,C.jsx)(p,{className:`w-6 h-6`})})]})]}),(0,C.jsxs)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center p-4 relative overflow-hidden`,children:[s>0&&(0,C.jsx)(`button`,{onClick:()=>c(e=>e-1),className:`absolute left-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors`,children:(0,C.jsx)(y,{className:`w-8 h-8 text-white`})}),(0,C.jsx)(`img`,{src:g,alt:`Photo ${s+1}`,className:`max-w-full max-h-full object-contain rounded-lg`,style:{maxHeight:`calc(100vh - 200px)`}}),sc(e=>e+1),className:`absolute right-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors`,children:(0,C.jsx)(_,{className:`w-8 h-8 text-white`})})]}),n.length>1&&(0,C.jsx)(`div`,{className:`flex justify-center gap-2 p-4 bg-black/50`,children:n.map((e,t)=>(0,C.jsx)(`button`,{onClick:()=>c(t),className:`w-16 h-16 rounded-lg overflow-hidden border-2 transition-colors ${t===s?`border-bambu-green`:`border-transparent hover:border-bambu-gray`}`,children:(0,C.jsx)(`img`,{src:d(e),alt:`Thumbnail ${t+1}`,className:`w-full h-full object-cover`})},e))})]}),l&&(0,C.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,C.jsx)(v,{title:`Delete Photo`,message:`Delete this photo? This cannot be undone.`,confirmText:`Delete`,variant:`danger`,onConfirm:()=>{o?.(f),u(!1)},onCancel:()=>u(!1)})})]})}export{O as n,w as r,k as t}; \ No newline at end of file diff --git a/static/assets/PrinterLocationsPage-Bh8TYbzi.js b/static/assets/PrinterLocationsPage-Bh8TYbzi.js new file mode 100644 index 000000000..9bc4dc9a3 --- /dev/null +++ b/static/assets/PrinterLocationsPage-Bh8TYbzi.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{t as c}from"./useQueries-Be6PMvSC.js";import{t as l}from"./createLucideIcon-DvBYJlWL.js";import{t as u}from"./arrow-left-0Q6F2rjC.js";import{t as d}from"./box-DAdKb9s5.js";import{a as f}from"./info-ROUoQhJR.js";import{n as p}from"./ToastContext-BRX0SW3C.js";import{t as m}from"./loader-circle-BEmFtawu.js";import{t as ee}from"./move-Bc1EIjTD.js";import{t as te}from"./search-0n0CBc74.js";import{t as h}from"./x-DR-Trv6U.js";import{n as g,t as _}from"./Card-Bzc64K35.js";import{t as v}from"./Button-DDr6eAFy.js";import{$t as ne,At as re,Lt as y,Rn as ie,Rt as b,Zt as ae,_t as oe,ht as x,mt as se,yt as ce}from"./index-CovRLYqQ.js";var S=l(`user-minus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),C=e(n(),1),w=t(),le=100,T=[`#ef4444`,`#f97316`,`#eab308`,`#22c55e`,`#14b8a6`,`#3b82f6`,`#8b5cf6`,`#ec4899`,`#6b7280`],ue=[`name-asc`,`name-desc`,`count-asc`,`count-desc`],de=`printerLocations.hideEmpty`,fe=`printerLocations.sort`;function pe(e,t,n){try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}}function me(e,t){try{localStorage.setItem(e,t)}catch{}}var he=e=>e.location?.trim()||``;function ge({location:e}){return(0,w.jsxs)(`div`,{className:`p-2 rounded-lg bg-bambu-dark relative overflow-hidden flex-shrink-0`,children:[(0,w.jsx)(se.find(t=>t.name===e.icon)?.icon??d,{className:`w-[25px] h-[25px] text-bambu-gray`}),e.color&&(0,w.jsx)(`div`,{className:`absolute top-0 left-0 w-1 h-full`,style:{backgroundColor:e.color}})]})}function _e({printer:e,status:t,selected:n,canEdit:r,busy:a,onToggle:o,onMove:s,onRemove:c}){let{t:l}=i(),u=t?.state,d=t?.connected,f=l(d?u===`RUNNING`?`printers.status.printing`:u===`PAUSE`?`printers.status.paused`:u===`FINISH`?`printers.status.finished`:`printers.status.idle`:`printers.status.offline`),p=d?u===`RUNNING`?`bg-orange-500/20 text-orange-400`:u===`PAUSE`?`bg-yellow-500/20 text-yellow-400`:u===`FINISH`?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark text-bambu-gray`:`bg-gray-500/20 text-gray-400`;return(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2 py-2 px-3 rounded-lg transition-colors ${n?`bg-bambu-green/10 border border-bambu-green/30`:`bg-bambu-dark-secondary hover:bg-bambu-dark`}`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[r&&(0,w.jsx)(`button`,{type:`button`,onClick:o,className:`text-bambu-gray hover:text-bambu-green transition-colors`,title:l(`printers.locations.selectPrinter`),"aria-label":l(`printers.locations.selectPrinter`),"aria-pressed":n,children:n?(0,w.jsx)(b,{className:`w-4 h-4 text-bambu-green`}):(0,w.jsx)(y,{className:`w-4 h-4`})}),(0,w.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${d?u===`RUNNING`||u===`PAUSE`?`bg-orange-500`:`bg-bambu-green`:`bg-gray-500`}`}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`p`,{className:`text-white text-sm font-medium truncate`,children:e.name}),(0,w.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:e.model||l(`printers.status.unknown`)})]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,w.jsx)(`span`,{className:`text-xs px-2 py-1 rounded-full ${p}`,children:f}),r&&(0,w.jsx)(v,{variant:`ghost`,size:`sm`,onClick:s,disabled:a,className:`text-bambu-gray hover:text-bambu-green hover:bg-bambu-green/10`,title:l(`printers.locations.move`),"aria-label":l(`printers.locations.move`),children:(0,w.jsx)(ee,{className:`w-3.5 h-3.5`})}),r&&c&&(0,w.jsx)(v,{variant:`ghost`,size:`sm`,onClick:c,disabled:a,className:`text-bambu-gray hover:text-red-400 hover:bg-red-500/10`,title:l(`printers.locations.removeFromLocation`),"aria-label":l(`printers.locations.removeFromLocation`),children:(0,w.jsx)(S,{className:`w-3.5 h-3.5`})})]})]})}function ve({initial:e,saving:t,onSave:n,onCancel:r}){let{t:a}=i(),[o,s]=(0,C.useState)(e?.name??``),[c,l]=(0,C.useState)(e?.icon??``),[u,d]=(0,C.useState)(e?.color??``),f=o.trim().length>0&&!t,p=()=>f&&n({name:o.trim(),icon:c,color:u});return(0,w.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,w.jsx)(_,{className:`w-full max-w-md`,children:(0,w.jsxs)(g,{className:`space-y-4`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:a(e?`printers.locations.editTitle`:`printers.locations.createTitle`)}),(0,w.jsx)(`input`,{type:`text`,value:o,maxLength:le,onChange:e=>s(e.target.value),placeholder:a(`printers.locations.namePlaceholder`),"aria-label":a(`printers.locations.namePlaceholder`),className:`w-full px-4 py-2 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&p(),e.key===`Escape`&&r()}}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:a(`printers.locations.icon`)}),(0,w.jsx)(x,{value:c,onChange:l})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:a(`printers.locations.color`)}),(0,w.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[T.map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>d(u===e?``:e),className:`w-8 h-8 rounded-lg transition-all ${u===e?`ring-2 ring-white ring-offset-2 ring-offset-bambu-dark-secondary scale-110`:`hover:scale-105`}`,style:{backgroundColor:e},title:e,"aria-label":e,"aria-pressed":u===e},e)),u&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>d(``),className:`w-8 h-8 rounded-lg border-2 border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-gray hover:text-white hover:border-bambu-gray transition-all flex items-center justify-center`,title:a(`printers.locations.noColor`),"aria-label":a(`printers.locations.noColor`),children:(0,w.jsx)(h,{className:`w-3.5 h-3.5`})})]})]}),(0,w.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,w.jsx)(v,{variant:`secondary`,onClick:r,disabled:t,children:a(`common.cancel`)}),(0,w.jsx)(v,{onClick:p,disabled:!f,children:t?(0,w.jsx)(m,{className:`w-4 h-4 animate-spin`}):a(e?`common.save`:`printers.locations.create`)})]})]})})})}var E=`__none__`;function ye({count:e,printerName:t,locations:n,saving:r,onMove:a,onCancel:o}){let{t:s}=i(),[c,l]=(0,C.useState)(``);return(0,w.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,w.jsx)(_,{className:`w-full max-w-md`,children:(0,w.jsxs)(g,{className:`space-y-4`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e===1?s(`printers.locations.moveTitle`):s(`printers.locations.moveTitleMany`,{count:e})}),t&&(0,w.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t}),(0,w.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),"aria-label":s(`printers.locations.targetPlaceholder`),className:`w-full px-4 py-2 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,disabled:r,autoFocus:!0,children:[(0,w.jsx)(`option`,{value:``,disabled:!0,children:s(`printers.locations.targetPlaceholder`)}),n.map(e=>(0,w.jsx)(`option`,{value:e.name,children:e.name},e.name)),(0,w.jsx)(`option`,{value:E,children:s(`printers.locations.noLocation`)})]}),(0,w.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,w.jsx)(v,{variant:`secondary`,onClick:o,disabled:r,children:s(`common.cancel`)}),(0,w.jsx)(v,{onClick:()=>a(c===E?null:c),disabled:r||!c,children:r?(0,w.jsx)(m,{className:`w-4 h-4 animate-spin`}):s(`printers.locations.moveButton`)})]})]})})})}function D(){let e=a(),{t}=i(),{showToast:n}=p(),{hasPermission:l}=ce(),h=l(`printers:update`),[x,se]=(0,C.useState)(``),[S,le]=(0,C.useState)(()=>pe(de,[`true`,`false`],`false`)===`true`),[T,E]=(0,C.useState)(()=>pe(fe,ue,`name-asc`)),[D,O]=(0,C.useState)(!1),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(!1),[N,P]=(0,C.useState)(new Set),[F,I]=(0,C.useState)(new Set),[L,R]=(0,C.useState)(null),[z,B]=(0,C.useState)(null),[V,H]=(0,C.useState)(null);(0,C.useEffect)(()=>me(de,String(S)),[S]),(0,C.useEffect)(()=>me(fe,T),[T]),(0,C.useEffect)(()=>{j&&A(null)},[j]);let{data:U,isLoading:be}=o({queryKey:[`printers`],queryFn:r.getPrinters}),{data:W,isLoading:xe}=o({queryKey:[`printer-locations`],queryFn:r.getPrinterLocations}),Se=c({queries:(U??[]).map(e=>({queryKey:[`printerStatus`,e.id],queryFn:()=>r.getPrinterStatus(e.id),refetchInterval:3e4}))}),Ce=new Map((U??[]).map((e,t)=>[e.id,Se[t]?.data])),G=(0,C.useMemo)(()=>{let e=new Map;for(let t of U??[]){let n=he(t);e.set(n,[...e.get(n)??[],t])}return e},[U]),K=G.get(``)??[],we=(U?.length??0)-K.length,Te=(0,C.useMemo)(()=>{let e=x.trim().toLowerCase(),t=(W??[]).filter(t=>(!e||t.name.toLowerCase().includes(e))&&(!S||t.printer_count>0)),n=(e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0,sensitivity:`base`});return[...t].sort((e,t)=>{switch(T){case`name-desc`:return n(t,e);case`count-asc`:return e.printer_count-t.printer_count||n(e,t);case`count-desc`:return t.printer_count-e.printer_count||n(e,t);default:return n(e,t)}})},[W,x,S,T]),q=()=>{e.invalidateQueries({queryKey:[`printer-locations`]}),e.invalidateQueries({queryKey:[`printers`]})},J=e=>n(t(`printers.locations.failed`,{error:e instanceof Error?e.message:String(e)}),`error`),Y=s({mutationFn:({value:e,location:t})=>t?r.updatePrinterLocation({name:t.name,...e.name===t.name?{}:{new_name:e.name},icon:e.icon||null,color:e.color||null}):r.createPrinterLocation({name:e.name,icon:e.icon||null,color:e.color||null}),onSuccess:(e,{location:r})=>{q(),r&&k===r.name&&A(e.name),n(t(r?`printers.locations.saved`:`printers.locations.created`)),R(null)},onError:J}),X=s({mutationFn:({ids:e,location:t})=>r.assignPrinterLocation(e,t),onSuccess:({moved:e})=>{q(),n(t(`printers.locations.moved`,{count:e})),I(new Set),B(null)},onError:J}),Z=s({mutationFn:e=>r.deletePrinterLocations(e),onSuccess:({deleted:e})=>{q(),n(t(`printers.locations.deleted`,{count:e})),P(new Set),M(!1),H(null)},onError:e=>{J(e),H(null)}}),Q=X.isPending||Z.isPending||Y.isPending,Ee=(e,t)=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n};if(be||xe)return(0,w.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,w.jsx)(m,{className:`w-8 h-8 text-bambu-green animate-spin`})});let De=(V??[]).reduce((e,t)=>e+(W?.find(e=>e.name===t)?.printer_count??0),0),Oe=e=>({"name-asc":t(`printers.locations.sortNameAsc`),"name-desc":t(`printers.locations.sortNameDesc`),"count-asc":t(`printers.locations.sortCountAsc`),"count-desc":t(`printers.locations.sortCountDesc`)})[e],ke=(e,t)=>(0,w.jsx)(_e,{printer:e,status:Ce.get(e.id),selected:F.has(e.id),canEdit:h&&!j,busy:Q,onToggle:()=>I(Ee(F,e.id)),onMove:()=>B({ids:[e.id],printerName:e.name}),onRemove:t?()=>X.mutate({ids:[e.id],location:null}):void 0},e.id),$=K.length>0&&K.every(e=>F.has(e.id));return(0,w.jsxs)(`div`,{className:`p-4 md:p-8 pb-28`,children:[(0,w.jsxs)(ie,{to:`/`,className:`inline-flex items-center gap-1 mb-3 text-sm text-bambu-gray hover:text-white transition-colors`,children:[(0,w.jsx)(u,{className:`w-4 h-4`}),` `,t(`printers.locations.backToPrinters`)]}),(0,w.jsxs)(`div`,{className:`mb-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 mb-1`,children:[(0,w.jsx)(d,{className:`w-[25px] h-[25px] text-bambu-green`}),(0,w.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:t(`printers.locations.title`)})]}),(0,w.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t(`printers.locations.subtitle`,{grouped:we,ungrouped:K.length})})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-3 mb-6`,children:[(0,w.jsxs)(`div`,{className:`relative flex-1 min-w-[12rem]`,children:[(0,w.jsx)(te,{className:`w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray`}),(0,w.jsx)(`input`,{type:`text`,value:x,onChange:e=>se(e.target.value),placeholder:t(`printers.locations.search`),"aria-label":t(`printers.locations.search`),className:`w-full pl-9 pr-4 py-2 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`})]}),(0,w.jsx)(v,{onClick:()=>le(!S),variant:S?`primary`:`secondary`,children:t(S?`printers.locations.showEmpty`:`printers.locations.hideEmpty`)}),h&&(0,w.jsxs)(v,{onClick:()=>{P(new Set),M(!j)},variant:j?`primary`:`secondary`,children:[(0,w.jsx)(b,{className:`w-4 h-4 mr-1`}),t(j?`printers.locations.done`:`printers.locations.select`)]}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsxs)(v,{onClick:()=>O(!D),variant:`secondary`,"aria-haspopup":`menu`,children:[(0,w.jsx)(f,{className:`w-4 h-4 mr-1 transition-transform ${D?`rotate-180`:``}`}),Oe(T)]}),D&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`fixed inset-0 z-40`,onClick:()=>O(!1)}),(0,w.jsx)(`div`,{role:`menu`,className:`absolute right-0 top-full mt-1 z-50 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg p-1 min-w-[10rem]`,children:ue.map(e=>(0,w.jsx)(`button`,{role:`menuitem`,onClick:()=>{E(e),O(!1)},className:`w-full text-left px-3 py-2 text-sm rounded transition-colors ${T===e?`bg-bambu-green text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary hover:text-white`}`,children:Oe(e)},e))})]})]}),h&&(0,w.jsxs)(v,{onClick:()=>R({mode:`create`}),children:[(0,w.jsx)(ae,{className:`w-4 h-4 mr-1`}),t(`printers.locations.create`)]})]}),Te.length===0&&K.length===0?(0,w.jsx)(_,{children:(0,w.jsx)(g,{className:`text-center py-12 text-bambu-gray`,children:t(x?`printers.locations.noResults`:`printers.locations.none`)})}):(0,w.jsxs)(`div`,{className:`space-y-3`,children:[Te.map(e=>{let n=k===e.name,r=N.has(e.name);return(0,w.jsx)(_,{children:(0,w.jsxs)(g,{className:`p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>j?P(Ee(N,e.name)):A(n?null:e.name),className:`flex items-center gap-3 flex-1 min-w-0 text-left`,"aria-expanded":j?void 0:n,"aria-pressed":j?r:void 0,children:[j?r?(0,w.jsx)(b,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}):(0,w.jsx)(y,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}):(0,w.jsx)(f,{className:`w-4 h-4 text-bambu-gray flex-shrink-0 transition-transform ${n?`rotate-180`:``}`}),(0,w.jsx)(ge,{location:e}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.name}),(0,w.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t(`printers.locations.printerCount`,{count:e.printer_count})})]})]}),h&&!j&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>R({mode:`edit`,location:e}),disabled:Q,className:`text-bambu-gray hover:text-blue-400 hover:bg-blue-500/10`,title:t(`common.edit`),"aria-label":t(`common.edit`),children:(0,w.jsx)(ne,{className:`w-4 h-4`})}),(0,w.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>H([e.name]),disabled:Q,className:`text-red-500 hover:text-red-400 hover:bg-red-500/10`,title:t(`common.delete`),"aria-label":t(`common.delete`),children:(0,w.jsx)(re,{className:`w-4 h-4`})})]})]}),n&&(0,w.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3 mt-3 space-y-2`,children:(G.get(e.name)??[]).length===0?(0,w.jsx)(`p`,{className:`text-sm text-bambu-gray text-center py-4`,children:t(`printers.locations.noPrinters`)}):(G.get(e.name)??[]).map(e=>ke(e,!0))})]})},e.name)}),K.length>0&&(0,w.jsxs)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray`,children:t(`printers.locations.ungroupedPrinters`,{count:K.length})}),h&&!j&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>{let e=new Set(F);K.forEach(t=>$?e.delete(t.id):e.add(t.id)),I(e)},className:`text-xs text-bambu-green hover:text-bambu-green-light transition-colors`,children:t($?`common.deselectAll`:`common.selectAll`)})]}),(0,w.jsx)(`div`,{className:`space-y-2`,children:K.map(e=>ke(e,!1))})]})]}),h&&!j&&F.size>0&&(0,w.jsxs)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 bg-bambu-dark border border-bambu-dark-tertiary rounded-xl shadow-2xl px-6 py-4 flex items-center gap-4 z-40`,children:[(0,w.jsx)(`span`,{className:`text-white text-sm`,children:t(`printers.locations.selected`,{count:F.size})}),(0,w.jsxs)(v,{onClick:()=>B({ids:Array.from(F)}),disabled:Q,children:[(0,w.jsx)(ee,{className:`w-4 h-4 mr-1`}),t(`printers.locations.moveButton`)]}),(0,w.jsx)(v,{variant:`ghost`,onClick:()=>I(new Set),disabled:Q,children:t(`common.cancel`)})]}),j&&N.size>0&&(0,w.jsxs)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 bg-bambu-dark border border-bambu-dark-tertiary rounded-xl shadow-2xl px-6 py-4 flex items-center gap-4 z-40`,children:[(0,w.jsx)(`span`,{className:`text-white text-sm`,children:t(`printers.locations.selected`,{count:N.size})}),(0,w.jsxs)(v,{variant:`danger`,onClick:()=>H(Array.from(N)),disabled:Q,children:[(0,w.jsx)(re,{className:`w-4 h-4 mr-1`}),t(`printers.locations.deleteSelected`)]}),(0,w.jsx)(v,{variant:`ghost`,onClick:()=>P(new Set),disabled:Q,children:t(`common.cancel`)})]}),L&&(0,w.jsx)(ve,{initial:L.mode===`edit`?L.location:void 0,saving:Y.isPending,onSave:e=>Y.mutate({value:e,location:L.mode===`edit`?L.location:void 0}),onCancel:()=>R(null)}),z&&(0,w.jsx)(ye,{count:z.ids.length,printerName:z.printerName,locations:W??[],saving:X.isPending,onMove:e=>X.mutate({ids:z.ids,location:e}),onCancel:()=>B(null)}),V&&(0,w.jsx)(oe,{title:V.length===1?t(`printers.locations.deleteTitle`):t(`printers.locations.deleteTitleMany`,{count:V.length}),message:t(`printers.locations.deleteMessage`,{count:De,names:V.join(`, `)}),confirmText:t(`common.delete`),variant:`danger`,isLoading:Z.isPending,onConfirm:()=>Z.mutate(V),onCancel:()=>H(null)})]})}export{D as PrinterLocationsPage}; \ No newline at end of file diff --git a/static/assets/PrintersPage-CQ9ERKo2.js b/static/assets/PrintersPage-CQ9ERKo2.js new file mode 100644 index 000000000..d099f5a37 --- /dev/null +++ b/static/assets/PrintersPage-CQ9ERKo2.js @@ -0,0 +1,49 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,S as r,a as i,c as a,l as o,s,t as c,w as l,x as u}from"./client-DnySrlFv.js";import{t as d}from"./react-dom-B8Dg6xzp.js";import{n as f}from"./QueryClientProvider-Ce8_sN3w.js";import{t as p}from"./useQuery-BBCjCezC.js";import{t as m}from"./useMutation-B-Tr2hIP.js";import{t as h}from"./createLucideIcon-DvBYJlWL.js";import{c as g,i as _,n as v,o as y,r as b,s as x}from"./haSensorDisplay-lPbcOxD8.js";import{t as S}from"./arrow-down-Cj0DZhNf.js";import{t as C}from"./arrow-left-0Q6F2rjC.js";import{t as w}from"./arrow-right-DedpIMhP.js";import{t as T}from"./arrow-up-down-BdyOV_2F.js";import{t as E}from"./arrow-up-D-pfJ3WZ.js";import{i as D,n as O,r as k,t as A}from"./ReferenceLine-clJprXoH.js";import{t as j}from"./box-DAdKb9s5.js";import{n as M,t as N}from"./fan-D6AmXZMv.js";import{t as P}from"./calendar-BLKPnWqV.js";import{t as F}from"./check-Ck0cMLU4.js";import{a as I,n as L,r as R,t as ee}from"./info-ROUoQhJR.js";import{n as te,r as ne}from"./ToastContext-BRX0SW3C.js";import{t as z}from"./copy-Cu_0GKCU.js";import{t as re}from"./ellipsis-vertical-t2D7cYyp.js";import{t as B}from"./eye-off-6CkaxYwP.js";import{t as ie}from"./file-box-04V4jZ9_.js";import{t as ae}from"./GcodeToolpathViewer-Cg6UnTDw.js";import{n as V,t as oe}from"./ContextMenu-Bt5_A0ZU.js";import{n as se,t as ce}from"./scan-search-BDoNAXzz.js";import{t as le}from"./funnel-C3dyAMK9.js";import{t as ue}from"./gauge-D21zgWMb.js";import{t as de}from"./grip-vertical-C_1RDxRw.js";import{t as fe}from"./hard-drive-CgXAHN37.js";import{t as pe}from"./layout-grid-DkD3u6wa.js";import{t as H}from"./loader-circle-BEmFtawu.js";import{t as me}from"./log-in-n0ckHxnD.js";import{t as he}from"./maximize-2-kPQ77q72.js";import{t as U}from"./minimize-2-dqT-k7oI.js";import{a as ge,i as _e,n as ve,r as ye,t as W}from"./CameraDiagnoseModal-RgByyfP2.js";import{t as G}from"./minus-DypeGjGR.js";import{a as be,c as xe,i as Se,l as K,n as Ce,r as we,s as Te,t as q,u as J}from"./CopyButton-C5In5weo.js";import{t as Ee}from"./move-Bc1EIjTD.js";import{t as De}from"./package-BGUevlqS.js";import{t as Oe}from"./pause-DFb6GX_6.js";import{t as ke}from"./play-DIDYtk2S.js";import{t as Ae}from"./search-0n0CBc74.js";import{t as je}from"./settings-2-Cvn837lh.js";import{n as Me,t as Ne}from"./wind-CI8UoBMf.js";import{D as Pe,Fn as Fe,It as Ie,Kt as Le,L as Re,Ln as ze,Lt as Be,M as Ve,Mn as He,On as Ue,Pn as We,R as Ge,Rn as Ke,S as qe,Sn as Je,St as Ye,T as Xe,Ut as Ze,Xt as Qe,Zt as $e,an as et,at as tt,b as nt,c as rt,cn as it,d as at,f as ot,gn as st,j as ct,jt as lt,k as ut,l as dt,ln as ft,mn as pt,mt,nn as ht,p as gt,pt as _t,s as vt,sn as yt,t as bt,u as xt,vn as St,w as Ct,wn as wt,x as Tt,y as Et,z as Dt}from"./CartesianChart-BAcHzPFb.js";import{t as Ot}from"./triangle-alert-Dt_1FcBy.js";import{t as kt}from"./unlink-C098nwOf.js";import{i as At,n as jt,r as Mt,t as Nt}from"./CameraWall-lBUed8MZ.js";import{t as Pt}from"./x-DR-Trv6U.js";import{n as Ft,t as It}from"./zoom-out-DNNe6DMN.js";import{n as Lt,t as Rt}from"./Card-Bzc64K35.js";import{t as zt}from"./file-DDkFXH-b.js";import{t as Y}from"./Button-DDr6eAFy.js";import{a as Bt,c as Vt,i as Ht,o as Ut,s as Wt,t as Gt,u as Kt,v as qt}from"./date-G9KUauqz.js";import{n as Jt,r as Yt}from"./filamentSwatchHelpers-D3oXQSGk.js";import{$ as Xt,$t as Zt,At as Qt,Cn as $t,Ct as en,D as tn,E as nn,Et as rn,Ft as an,G as on,H as sn,J as cn,Jt as ln,K as un,Kt as dn,Lt as fn,Mn as pn,Mt as mn,N as hn,Nt as gn,O as _n,On as vn,Ot as yn,Rn as bn,Rt as xn,Sn,U as Cn,V as wn,Vn as Tn,Vt as En,W as Dn,Wt as On,X as kn,Y as An,Yt as jn,Z as Mn,Zt as Nn,_ as Pn,_n as Fn,_t as In,an as Ln,at as Rn,b as zn,bn as Bn,bt as Vn,cn as Hn,ct as Un,dt as Wn,et as Gn,fn as Kn,ft as qn,h as Jn,jn as Yn,jt as Xn,k as Zn,q as Qn,sn as $n,tt as er,un as tr,ut as nr,v as rr,vt as ir,wn as ar,xn as or,xt as sr,y as cr,yt as lr,z as ur}from"./index-CovRLYqQ.js";import{n as dr,t as fr}from"./FileUploadModal-AIFgu8X7.js";import{n as pr,t as mr}from"./ErrorBarContext-CcijMMkA.js";import{t as hr}from"./Toggle-KiqA_5fU.js";import{t as gr}from"./printerModel-DrNvERGQ.js";import{t as _r}from"./queueItemName-UFY7kpjG.js";import{n as vr,r as yr,t as br}from"./ConfigureAmsSlotModal-CpOmPM3O.js";var xr=h(`air-vent`,[[`path`,{d:`M18 17.5a2.5 2.5 0 1 1-4 2.03V12`,key:`yd12zl`}],[`path`,{d:`M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`larmp2`}],[`path`,{d:`M6 8h12`,key:`6g4wlu`}],[`path`,{d:`M6.6 15.572A2 2 0 1 0 10 17v-5`,key:`1x1kqn`}]]),Sr=h(`chart-line`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`m19 9-5 5-4-4-3 3`,key:`2osh9i`}]]),Cr=h(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),wr=h(`fullscreen`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`rect`,{width:`10`,height:`8`,x:`7`,y:`8`,rx:`1`,key:`vys8me`}]]),Tr=h(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Er=h(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Dr=h(`picture-in-picture-2`,[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]),Or=h(`repeat`,[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]),kr=h(`signal`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}],[`path`,{d:`M22 4v16`,key:`sih9yq`}]]),Ar=h(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),jr=h(`snowflake`,[[`path`,{d:`m10 20-1.25-2.5L6 18`,key:`18frcb`}],[`path`,{d:`M10 4 8.75 6.5 6 6`,key:`7mghy3`}],[`path`,{d:`m14 20 1.25-2.5L18 18`,key:`1chtki`}],[`path`,{d:`m14 4 1.25 2.5L18 6`,key:`1b4wsy`}],[`path`,{d:`m17 21-3-6h-4`,key:`15hhxa`}],[`path`,{d:`m17 3-3 6 1.5 3`,key:`11697g`}],[`path`,{d:`M2 12h6.5L10 9`,key:`kv9z4n`}],[`path`,{d:`m20 10-1.5 2 1.5 2`,key:`1swlpi`}],[`path`,{d:`M22 12h-6.5L14 15`,key:`1mxi28`}],[`path`,{d:`m4 10 1.5 2L4 14`,key:`k9enpj`}],[`path`,{d:`m7 21 3-6-1.5-3`,key:`j8hb9u`}],[`path`,{d:`m7 3 3 6h4`,key:`1otusx`}]]),Mr=h(`square-minus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),Nr=(e,t,n,r)=>tt(e,`xAxis`,t,r),Pr=(e,t,n,r)=>_t(e,`xAxis`,t,r),Fr=(e,t,n,r)=>tt(e,`yAxis`,n,r),Ir=(e,t,n,r)=>_t(e,`yAxis`,n,r),Lr=pt([Ze,Nr,Fr,Pr,Ir],(e,t,n,r,i)=>ft(e,`xAxis`)?ht(t,r,!1):ht(n,i,!1)),Rr=(e,t,n,r,i)=>i;function zr(e){return e.type===`line`}var Br=pt([Ze,Nr,Fr,Pr,Ir,pt([mt,Rr],(e,t)=>e.filter(zr).find(e=>e.id===t)),Lr,lt],(e,t,n,r,i,a,o,s)=>{var{chartData:c,dataStartIndex:l,dataEndIndex:u}=s;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var{dataKey:d,data:f}=a,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return di({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),X=e(n()),Vr=[`id`],Hr=[`type`,`layout`,`connectNulls`,`needClip`,`shape`],Ur=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function Wr(){return Wr=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:yt(n,t),payload:e}]},Qr=X.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:n,getPosition:Ue,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:yt(o,t),hide:s,type:l,color:r,unit:c,graphicalItemId:u}};return X.createElement(Pe,{tooltipEntrySettings:d})}),$r=(e,t)=>`${t}px ${e-t}px`;function ei(e,t){for(var n=e.length%2==0?e:[...e,0],r=[],i=0;i{var r=n.reduce((e,t)=>e+t);if(!r)return $r(t,e);for(var i=Math.floor(e/r),a=e%r,o=t-e,s=[],c=0,l=0;ca){s=[...n.slice(0,c),a-l];break}}var f=s.length%2==0?[0,o]:[o];return[...ei(n,i),...s,...f].map(e=>`${e}px`).join(`, `)};function ni(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,c=Fe(Yr(r,Vr));return X.createElement(Tt,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function Q(e){var{showLabels:t,children:n,points:r}=e,i=(0,X.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return X.createElement(ct,{value:t?i:void 0},n)}function ri(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:c,needClip:l,shape:u}=a,d=Z(Z({},We(Yr(a,Hr))),{},{fill:`none`,className:`recharts-line-curve`,clipPath:l?`url(#clipPath-${t})`:void 0,points:r,type:o,layout:s,connectNulls:c,strokeDasharray:i??a.strokeDasharray});return X.createElement(X.Fragment,null,r?.length>1&&X.createElement(pr,Wr({shapeType:`curve`,option:u},d,{pathRef:n})),X.createElement(ni,{points:r,clipPathId:t,props:a}))}function ii(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function ai(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,animateNewValues:f,width:p,height:m,onAnimationEnd:h,onAnimationStart:g}=n,_=i.current,v=Ie(o,`recharts-line-`),y=(0,X.useRef)(v),[b,x]=(0,X.useState)(!1),S=!b,C=(0,X.useCallback)(()=>{typeof h==`function`&&h(),x(!1)},[h]),w=(0,X.useCallback)(()=>{typeof g==`function`&&g(),x(!0)},[g]),T=ii(r.current),E=(0,X.useRef)(0);y.current!==v&&(E.current=a.current,y.current=v);var D=E.current;return X.createElement(Q,{points:o,showLabels:S},n.children,X.createElement(Be,{animationId:v,begin:l,duration:u,isActive:c,easing:d,onAnimationEnd:C,onAnimationStart:w,key:v},e=>{var l=Je(D,T+D,e),u=Math.min(l,T),d=c?s?ti(u,T,`${s}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):$r(T,u):s==null?void 0:String(s);if(e>0&&T>0&&(i.current=o,a.current=Math.max(a.current,u)),_){var h=_.length/o.length,g=e===1?o:o.map((t,n)=>{var r=Math.floor(n*h);if(_[r]){var i=_[r];return Z(Z({},t),{},{x:Je(i.x,t.x,e),y:Je(i.y,t.y,e)})}return f?Z(Z({},t),{},{x:Je(p*2,t.x,e),y:Je(m/2,t.y,e)}):Z(Z({},t),{},{x:t.x,y:t.y})});return i.current=g,X.createElement(ri,{props:n,points:g,clipPathId:t,pathRef:r,strokeDasharray:d})}return X.createElement(ri,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:d})}),X.createElement(Ve,{label:n.label}))}function oi(e){var{clipPathId:t,props:n}=e,r=(0,X.useRef)(null),i=(0,X.useRef)(0),a=(0,X.useRef)(null);return X.createElement(ai,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var si=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:it(e.payload,t)}),ci=class extends X.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:c,height:l,id:u,needClip:d,zIndex:f}=this.props;if(e)return null;var p=ze(`recharts-line`,r),m=u,{r:h,strokeWidth:g}=xt(t),_=ut(t),v=h*2+g,y=d?`url(#clipPath-${_?``:`dots-`}${m})`:void 0;return X.createElement(Dt,{zIndex:f},X.createElement(He,{className:p},d&&X.createElement(`defs`,null,X.createElement(at,{clipPathId:m,xAxisId:i,yAxisId:a}),!_&&X.createElement(`clipPath`,{id:`clipPath-dots-${m}`},X.createElement(`rect`,{x:s-v/2,y:o-v/2,width:c+v,height:l+v}))),X.createElement(mr,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:si,errorBarOffset:0},X.createElement(oi,{props:this.props,clipPathId:m}))),X.createElement(Et,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:y}))}},li={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Ye.line,type:`linear`};function ui(e){var t=St(e,li),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:c,hide:l,isAnimationActive:u,label:d,legendType:f,xAxisId:p,yAxisId:m,id:h}=t,g=Yr(t,Ur),{needClip:_}=ot(p,m),v=nt(),y=Le(),b=$e(),x=st(e=>Br(e,p,m,b,h));if(y!==`horizontal`&&y!==`vertical`||x==null||v==null)return null;var{height:S,width:C,x:w,y:T}=v;return X.createElement(ci,Wr({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:x,layout:y,height:S,width:C,left:w,top:T,needClip:_}))}function di(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:c}=e;return c.map((e,c)=>{var l=it(e,o);if(t===`horizontal`)return{x:et({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(wt(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=wt(l)?null:n.scale.map(l),d=et({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function fi(e){var t=St(e,li),n=$e();return X.createElement(Ct,{id:t.id,type:`line`},e=>X.createElement(X.Fragment,null,X.createElement(Xe,{legendPayload:Zr(t)}),X.createElement(Qr,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),X.createElement(qe,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),X.createElement(ui,Wr({},t,{id:e}))))}var pi=X.memo(fi,dt);pi.displayName=`Line`;var mi=[`axis`],hi=(0,X.forwardRef)((e,t)=>X.createElement(bt,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:mi,tooltipPayloadSearcher:Ge,categoricalChartProps:e,ref:t})),gi=e(d(),1);function _i(e,t){let n=e.split(`.`).map(e=>parseInt(e,10)||0),r=t.split(`.`).map(e=>parseInt(e,10)||0);for(;n.length<4;)n.push(0);for(;r.length<4;)r.push(0);for(let e=0;e<4;e++)if(n[e]!==r[e])return n[e]-r[e];return 0}function vi(e,t,n,r){if(!e)return``;if(r)return`${e} — ${r}`;if(!t)return e;let i=t.match(/plate_(\d+)\.gcode/);return i&&parseInt(i[1],10)>1?`${e} — ${n(`printers.plateNumber`,`Plate {{number}}`,{number:i[1]})}`:e}var yi=new Set([`A1`,`A1MINI`,`A2L`,`A1M`,`N1`,`N2S`,`N9`,`A04`,`A11`,`A12`]);function bi(e){return e?yi.has(e.toUpperCase().replace(/[^A-Z0-9]/g,``)):!1}function xi(e){let t=typeof window<`u`&&window.visualViewport?window.visualViewport.height:typeof window<`u`?window.innerHeight:0,{triggerRect:n,popoverWidth:r,estimatedHeight:i,viewportHeight:a=t,viewportWidth:o=window.innerWidth,margin:s=8,gap:c=4,horizontalAlign:l=`right`}=e,u=n.bottom+c,d=`below`;if(u+i>a-s){let e=n.top-c-i;e>=s&&(u=e,d=`above`)}let f=n.left+(n.right-n.left)/2,p=l===`center`?f-r/2:n.right-r;po-s&&(p=Math.max(s,o-r-s));let m=d===`above`?n.top-c:u,h=Math.max(14,Math.min(r-14,f-p));return{top:u,left:p,placement:d,anchorY:m,arrowLeft:h}}var Si=`cameraViewMode`,Ci=`cameraWindowState`;function wi(e){return e===`window`||e===`embedded`}function Ti(){try{let e=localStorage.getItem(Si);return wi(e)?e:null}catch{return null}}function Ei(e){try{localStorage.setItem(Si,e)}catch{}}function Di(e){let t={width:640,height:400};try{let e=localStorage.getItem(Ci);if(e){let n=JSON.parse(e);n&&typeof n==`object`&&(t=n)}}catch{}let n=[`width=${t.width??640}`,`height=${t.height??400}`,t.left===void 0?``:`left=${t.left}`,t.top===void 0?``:`top=${t.top}`,`menubar=no,toolbar=no,location=no,status=no`].filter(Boolean).join(`,`);window.open(`/camera/${e}`,`camera-${e}`,n)}var Oi={NYLON:`PA`,PA6:`PA`,PA11:`PA`,PA12:`PA`,PAHT:`PA`,PPA:`PA`};function ki(e,t){let n=(e||``).split(` `)[0].toUpperCase();for(let e of[n,n.split(`-`)[0]]){let n=Oi[e]??e;if(t[n])return n}return`PLA`}function Ai(e,t,n,r=new Date){return e===`now`?null:e===`delay`?new Date(r.getTime()+t*6e4).toISOString():new Date(n).toISOString()}var ji=`printerHiddenExternalSpools`;function Mi(){try{let e=localStorage.getItem(ji);if(!e)return{};let t=JSON.parse(e);return!t||typeof t!=`object`||Array.isArray(t)?{}:t}catch{return{}}}function Ni(e){return Mi()[String(e)]===!0}function Pi(e,t){let n=Mi();t?n[String(e)]=!0:delete n[String(e)];try{localStorage.setItem(ji,JSON.stringify(n))}catch{}}var $=t(),Fi=[{key:`printing`,dot:`bg-bambu-green`},{key:`paused`,dot:`bg-status-warning`},{key:`finished`,dot:`bg-blue-400`},{key:`idle`,dot:`bg-bambu-green`},{key:`error`,dot:`bg-status-error`},{key:`offline`,dot:`bg-gray-400`}];function Ii({selectedIds:e,printers:t,onClose:n,onSelectAll:r,onSelectByLocation:i,onSelectByState:a,onAction:o,actionPending:s}){let{t:c}=l(),{hasPermission:u}=lr(),d=f(),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(!1),_=Array.from(e).map(e=>({id:e,status:d.getQueryData([`printerStatus`,e])})),v=_.some(({status:e})=>e?.connected&&e.state===`RUNNING`),y=_.some(({status:e})=>e?.connected&&e.state===`PAUSE`),b=v||y,x=_.some(({status:e})=>!!(e?.connected&&e.awaiting_plate_clear)),S=_.some(({status:e})=>!e?.connected||!e.hms_errors?!1:Mt(e.hms_errors).length>0),C=u(`printers:control`),w=u(`printers:clear_plate`),T=[...new Set(t.map(e=>e.location).filter(e=>!!e))].sort(),E={printing:0,paused:0,finished:0,idle:0,error:0,offline:0};t.forEach(e=>{let t=d.getQueryData([`printerStatus`,e.id]);if(!t||!t.connected){E.offline++;return}let n=t.hms_errors?Mt(t.hms_errors).length>0:!1;switch(n&&E.error++,t.state){case`RUNNING`:E.printing++;break;case`PAUSE`:E.paused++;break;case`FINISH`:E.finished++;break;case`FAILED`:n||E.finished++;break;default:E.idle++;break}});let O={printing:c(`printers.status.printing`),paused:c(`printers.status.paused`,`Paused`),finished:c(`printers.status.finished`,`Finished`),idle:c(`printers.status.idle`),error:c(`printers.status.problem`),offline:c(`printers.status.offline`)};return(0,$.jsxs)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl px-4 py-3 flex items-center gap-3 flex-wrap`,children:[(0,$.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:n,children:(0,$.jsx)(Pt,{className:`w-4 h-4`})}),(0,$.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,$.jsx)(`span`,{className:`text-white font-medium text-sm`,children:c(`printers.bulk.selected`,{count:e.size})}),(0,$.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,$.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:r,children:c(`printers.bulk.selectAll`)}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>{g(!h),m(!1)},children:[c(`printers.bulk.selectByState`),(0,$.jsx)(I,{className:`w-3 h-3 transition-transform ${h?`rotate-180`:``}`})]}),h&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>g(!1)}),(0,$.jsx)(`div`,{className:`absolute bottom-full mb-2 left-0 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg z-20 py-1`,children:Fi.filter(({key:e})=>E[e]>0).map(({key:e,dot:t})=>(0,$.jsxs)(`button`,{onClick:()=>{a(e),g(!1)},className:`w-full text-left px-3 py-2 text-sm text-bambu-gray-light hover:bg-bambu-dark-tertiary hover:text-white transition-colors flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`w-2 h-2 rounded-full ${t}`}),O[e],(0,$.jsx)(`span`,{className:`ml-auto text-bambu-gray text-xs`,children:E[e]})]},e))})]})]}),T.length>0&&(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>{m(!p),g(!1)},children:[c(`printers.bulk.selectByLocation`),(0,$.jsx)(I,{className:`w-3 h-3 transition-transform ${p?`rotate-180`:``}`})]}),p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>m(!1)}),(0,$.jsx)(`div`,{className:`absolute bottom-full mb-2 left-0 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg z-20 py-1`,children:T.map(e=>(0,$.jsx)(`button`,{onClick:()=>{i(e),m(!1)},className:`w-full text-left px-3 py-2 text-sm text-bambu-gray-light hover:bg-bambu-dark-tertiary hover:text-white transition-colors`,children:e},e))})]})]}),(0,$.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,$.jsxs)(Y,{size:`sm`,className:`bg-red-500 hover:bg-red-600`,onClick:()=>o(`stop`),disabled:s||!C||!b,title:C?b?void 0:c(`printers.bulk.noneApplicable`):c(`printers.permission.noControl`),children:[(0,$.jsx)(fn,{className:`w-3.5 h-3.5`}),c(`printers.bulk.actions.stop`)]}),(0,$.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>o(`pause`),disabled:s||!C||!v,title:C?v?void 0:c(`printers.bulk.noneApplicable`):c(`printers.permission.noControl`),children:[(0,$.jsx)(Oe,{className:`w-3.5 h-3.5`}),c(`printers.bulk.actions.pause`)]}),(0,$.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>o(`resume`),disabled:s||!C||!y,title:C?y?void 0:c(`printers.bulk.noneApplicable`):c(`printers.permission.noControl`),children:[(0,$.jsx)(ke,{className:`w-3.5 h-3.5`}),c(`printers.bulk.actions.resume`)]}),(0,$.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>o(`clearHMS`),disabled:s||!C||!S,title:C?S?void 0:c(`printers.bulk.noneApplicable`):c(`printers.permission.noControl`),children:[(0,$.jsx)(D,{className:`w-3.5 h-3.5`}),c(`printers.bulk.actions.clearHMS`)]}),(0,$.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>o(`clearPlate`),disabled:s||!w||!x,title:w?x?void 0:c(`printers.bulk.noneApplicable`):c(`printers.permission.noControl`),children:[(0,$.jsx)(k,{className:`w-3.5 h-3.5`}),c(`printers.bulk.actions.clearPlate`)]})]})}function Li({printerId:e,filePath:t,filename:n,onClose:r}){let[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)([]),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),p=n.toLowerCase().split(`.`).pop()||``,m=p===`3mf`||p===`stl`,h=p===`gcode`||p===`3mf`;(0,X.useEffect)(()=>{o(m?`3d`:h?`gcode`:null)},[m,h]),(0,X.useEffect)(()=>{c([]),f(null),m&&(u(!0),i.getPrinterFilePlates(e,t).then(e=>c(e.plates||[])).catch(()=>c([])).finally(()=>u(!1)))},[t,m,e]);let g=s.length>1,_=d==null?null:s.find(e=>e.index===d)??null;return(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-6`,onClick:r,children:(0,$.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-4xl h-[80vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate flex-1 mr-4`,children:n}),(0,$.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:r,children:(0,$.jsx)(Pt,{className:`w-5 h-5`})})]}),(0,$.jsxs)(`div`,{className:`flex border-b border-bambu-dark-tertiary`,children:[(0,$.jsxs)(`button`,{onClick:()=>m&&o(`3d`),disabled:!m,className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors ${a===`3d`?`text-bambu-green border-b-2 border-bambu-green`:m?`text-bambu-gray hover:text-white`:`text-bambu-gray/30 cursor-not-allowed`}`,children:[(0,$.jsx)(j,{className:`w-4 h-4`}),`3D Model`,!m&&(0,$.jsx)(`span`,{className:`text-xs`,children:`(not available)`})]}),(0,$.jsxs)(`button`,{onClick:()=>h&&o(`gcode`),disabled:!h,className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors ${a===`gcode`?`text-bambu-green border-b-2 border-bambu-green`:h?`text-bambu-gray hover:text-white`:`text-bambu-gray/30 cursor-not-allowed`}`,children:[(0,$.jsx)(or,{className:`w-4 h-4`}),`G-code Preview`,!h&&(0,$.jsx)(`span`,{className:`text-xs`,children:`(not sliced)`})]})]}),(0,$.jsx)(`div`,{className:`flex-1 overflow-hidden p-4`,children:a===`3d`&&m?(0,$.jsxs)(`div`,{className:`w-full h-full flex flex-col gap-3`,children:[g&&(0,$.jsxs)(`div`,{className:`rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray mb-2`,children:[(0,$.jsx)(j,{className:`w-4 h-4`}),`Plates`,l&&(0,$.jsx)(H,{className:`w-3 h-3 animate-spin`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 gap-2`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(null),className:`flex items-center gap-2 rounded-lg border p-2 text-left transition-colors ${d==null?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark-secondary hover:border-bambu-gray`}`,children:[(0,$.jsx)(`div`,{className:`w-10 h-10 rounded bg-bambu-dark-tertiary flex items-center justify-center`,children:(0,$.jsx)(j,{className:`w-5 h-5 text-bambu-gray`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm text-white font-medium truncate`,children:`All Plates`}),(0,$.jsxs)(`p`,{className:`text-xs text-bambu-gray truncate`,children:[s.length,` plate`,s.length===1?``:`s`]})]}),d==null&&(0,$.jsx)(xn,{className:`w-4 h-4 text-bambu-green flex-shrink-0`})]}),s.map(n=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(n.index),className:`flex items-center gap-2 rounded-lg border p-2 text-left transition-colors ${d===n.index?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark-secondary hover:border-bambu-gray`}`,children:[n.has_thumbnail?(0,$.jsx)(`img`,{src:i.getPrinterFilePlateThumbnail(e,n.index,t),alt:`Plate ${n.index}`,className:`w-10 h-10 rounded object-cover bg-bambu-dark-tertiary`}):(0,$.jsx)(`div`,{className:`w-10 h-10 rounded bg-bambu-dark-tertiary flex items-center justify-center`,children:(0,$.jsx)(j,{className:`w-5 h-5 text-bambu-gray`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm text-white font-medium truncate`,children:n.name||`Plate ${n.index}`}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray truncate`,children:n.objects.length>0?n.objects.slice(0,2).join(`, `)+(n.objects.length>2?`…`:``):`${n.filaments.length} filament${n.filaments.length===1?``:`s`}`})]}),d===n.index&&(0,$.jsx)(xn,{className:`w-4 h-4 text-bambu-green flex-shrink-0`})]},n.index))]}),_&&(0,$.jsxs)(`div`,{className:`mt-3 text-xs text-bambu-gray flex flex-wrap gap-x-4 gap-y-1`,children:[(0,$.jsxs)(`span`,{children:[`Plate `,_.index]}),_.print_time_seconds!=null&&(0,$.jsxs)(`span`,{children:[`ETA `,Math.round(_.print_time_seconds/60),` min`]}),_.filament_used_grams!=null&&(0,$.jsxs)(`span`,{children:[_.filament_used_grams.toFixed(1),` g`]}),_.filaments.length>0&&(0,$.jsxs)(`span`,{children:[_.filaments.length,` filament`,_.filaments.length===1?``:`s`]})]})]}),(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(dr,{url:i.getPrinterFileDownloadUrl(e,t),fileType:p,selectedPlateId:d,className:`w-full h-full`})})]}):a===`gcode`&&h?(0,$.jsx)(ae,{gcodeUrl:i.getPrinterFileGcodeUrl(e,t),className:`w-full h-full`}):(0,$.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-bambu-gray`,children:`No preview available for this file`})})]})})}function Ri(e){if(e===0)return`0 GB`;let t=e/(1024*1024*1024);return t>=1?`${t.toFixed(1)} GB`:`${(e/(1024*1024)).toFixed(0)} MB`}function zi(e,t){if(t)return Fn;switch(e.toLowerCase().split(`.`).pop()||``){case`3mf`:return ie;case`gcode`:return or;case`mp4`:case`avi`:return se;case`png`:case`jpg`:case`jpeg`:return tr;default:return V}}var Bi=[{value:`name-asc`,label:`Name (A-Z)`},{value:`name-desc`,label:`Name (Z-A)`},{value:`size-asc`,label:`Size (smallest)`},{value:`size-desc`,label:`Size (largest)`},{value:`date-asc`,label:`Date (oldest)`},{value:`date-desc`,label:`Date (newest)`}];function Vi({printerId:e,printerName:t,onClose:n}){let{t:r}=l(),{showToast:a}=te(),o=f(),[s,c]=(0,X.useState)(`/`),[u,d]=(0,X.useState)(new Set),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)([]),[y,b]=(0,X.useState)(`name-asc`),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);let{data:O,isLoading:k,refetch:A}=p({queryKey:[`printerFiles`,e,s],queryFn:()=>i.getPrinterFiles(e,s)}),{data:M}=p({queryKey:[`printerStorage`,e],queryFn:()=>i.getPrinterStorage(e),staleTime:3e4}),N=(0,X.useMemo)(()=>[...O?.files??[]].filter(e=>!h||e.name.toLowerCase().includes(h.toLowerCase())).sort((e,t)=>{if(e.is_directory&&!t.is_directory)return-1;if(!e.is_directory&&t.is_directory)return 1;switch(y){case`name-asc`:return e.name.localeCompare(t.name);case`name-desc`:return t.name.localeCompare(e.name);case`size-asc`:return e.size-t.size;case`size-desc`:return t.size-e.size;case`date-asc`:return(e.mtime?qt(e.mtime)?.getTime()??0:0)-(t.mtime?qt(t.mtime)?.getTime()??0:0);case`date-desc`:{let n=e.mtime?qt(e.mtime)?.getTime()??0:0;return(t.mtime?qt(t.mtime)?.getTime()??0:0)-n}default:return e.name.localeCompare(t.name)}}),[O?.files,h,y]),P=!!O&&!O.warnings?.includes(`printer_unavailable`);(0,X.useEffect)(()=>{if(!P)return;let e=new Set(N.filter(e=>!e.is_directory).map(e=>e.path));d(t=>new Set([...t].filter(t=>e.has(t)))),E.current&&!e.has(E.current)&&(E.current=null)},[N,P]),(0,X.useEffect)(()=>()=>D.current?.abort(),[]);let F=m({mutationFn:async t=>{for(let n of t)await i.deletePrinterFile(e,n)},onSuccess:()=>{a(r(`printerFiles.toast.filesDeleted`,{count:_.length})),o.invalidateQueries({queryKey:[`printerFiles`,e]}),d(new Set),E.current=null,v([])},onError:e=>{a(r(`printerFiles.toast.deleteFailed`,{error:e.message}),`error`)}}),I=e=>{c(e),d(new Set),E.current=null},L=()=>{if(s===`/`)return;let e=s.split(`/`).filter(Boolean);e.pop(),c(e.length?`/`+e.join(`/`):`/`),d(new Set),E.current=null},R=(e,t)=>{t.stopPropagation();let n=N.filter(e=>!e.is_directory).map(e=>e.path),r=E.current?n.indexOf(E.current):-1,i=n.indexOf(e),a=t.shiftKey&&r!==-1&&i!==-1;a||(E.current=e),d(t=>{let o=new Set(t);if(a){let e=Math.min(r,i),t=Math.max(r,i);n.slice(e,t+1).forEach(e=>o.add(e))}else o.has(e)?o.delete(e):o.add(e);return o})};return(0,$.jsxs)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:n,children:[(0,$.jsxs)(`div`,{className:`w-full max-w-3xl max-h-[85vh] flex flex-col bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(fe,{className:`w-5 h-5 text-bambu-green`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:r(`printerFiles.title`)}),(0,$.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[M&&(M.used_bytes!=null||M.free_bytes!=null)&&(0,$.jsxs)(`div`,{className:`text-sm text-bambu-gray flex items-center gap-2`,children:[M.used_bytes!=null&&(0,$.jsxs)(`span`,{children:[r(`printerFiles.storageUsed`),` `,Ri(M.used_bytes)]}),M.used_bytes!=null&&M.free_bytes!=null&&(0,$.jsx)(`span`,{className:`text-bambu-dark-tertiary`,children:`|`}),M.free_bytes!=null&&(0,$.jsxs)(`span`,{children:[r(`printerFiles.storageFree`),` `,Ri(M.free_bytes)]})]}),(0,$.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,title:`Close file manager`,"aria-label":`Close file manager`,children:(0,$.jsx)(Pt,{className:`w-5 h-5`})})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-3 border-b border-bambu-dark-tertiary bg-bambu-dark/50 flex-shrink-0`,children:[[{path:`/`,label:`Root`},{path:`/cache`,label:`Cache`},{path:`/model`,label:`Models`},{path:`/timelapse`,label:`Timelapse`}].map(e=>(0,$.jsx)(`button`,{onClick:()=>{I(e.path),g(``)},className:`px-3 py-1 text-sm rounded-full transition-colors ${s===e.path?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:e.label},e.path)),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ae,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,$.jsx)(`input`,{type:`text`,placeholder:r(`printerFiles.filterPlaceholder`),value:h,onChange:e=>g(e.target.value),className:`w-40 pl-8 pr-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`})]}),(0,$.jsxs)(`div`,{className:`relative flex items-center gap-1`,children:[(0,$.jsx)(T,{className:`w-4 h-4 text-bambu-gray`}),(0,$.jsx)(`select`,{value:y,onChange:e=>b(e.target.value),className:`appearance-none bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm py-1.5 pl-2 pr-6 focus:border-bambu-green focus:outline-none cursor-pointer`,title:`Sort files`,"aria-label":`Sort files`,children:Bi.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>A(),disabled:k,"aria-label":r(`common.refresh`),title:r(`common.refresh`),children:(0,$.jsx)(dn,{className:`w-4 h-4 ${k?`animate-spin`:``}`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 bg-bambu-dark text-sm flex-shrink-0`,children:[(0,$.jsx)(`button`,{onClick:L,disabled:s===`/`,className:`p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed`,title:`Go to parent folder`,"aria-label":`Go to parent folder`,children:(0,$.jsx)(Yn,{className:`w-4 h-4`})}),(0,$.jsx)(`span`,{className:`text-bambu-gray font-mono`,children:s})]}),(0,$.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2 min-h-0`,children:k?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,$.jsx)(H,{className:`w-8 h-8 text-bambu-green animate-spin`})}):O?.warnings?.includes(`printer_unavailable`)?(0,$.jsx)(`div`,{className:`text-center py-12 text-amber-600 dark:text-amber-400`,children:r(`printerFiles.printerUnavailable`)}):O?.files?.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:N.map(e=>{let t=zi(e.name,e.is_directory),n=u.has(e.path);return(0,$.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors ${n?`bg-bambu-green/20 border border-bambu-green/50`:`hover:bg-bambu-dark-tertiary`}`,onClick:t=>{e.is_directory?I(e.path):R(e.path,t)},children:[e.is_directory?null:(0,$.jsx)(`button`,{onClick:t=>R(e.path,t),className:`flex-shrink-0 text-bambu-gray hover:text-white`,"aria-label":r(n?`printerFiles.deselectFile`:`printerFiles.selectFile`,{name:e.name}),title:r(`printerFiles.shiftSelectHint`),children:n?(0,$.jsx)(xn,{className:`w-5 h-5 text-bambu-green`}):(0,$.jsx)(fn,{className:`w-5 h-5`})}),(0,$.jsx)(t,{className:`w-5 h-5 flex-shrink-0 ${e.is_directory?`text-bambu-green`:`text-bambu-gray`}`}),(0,$.jsx)(`span`,{className:`flex-1 text-white truncate`,children:e.name}),!e.is_directory&&(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:zt(e.size)}),(e.name.toLowerCase().endsWith(`.3mf`)||e.name.toLowerCase().endsWith(`.gcode`)||e.name.toLowerCase().endsWith(`.stl`))&&(0,$.jsx)(`button`,{onClick:t=>{t.stopPropagation(),w({path:e.path,name:e.name})},className:`p-1 rounded hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`,title:`3D View`,children:(0,$.jsx)(j,{className:`w-4 h-4`})})]}),e.is_directory&&(0,$.jsx)(Yn,{className:`w-4 h-4 text-bambu-gray rotate-180`})]},e.path)})}):(0,$.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:r(`printerFiles.noFiles`)})}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-t border-bambu-dark-tertiary bg-bambu-dark/50 flex-shrink-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:u.size>0?`${u.size} selected`:h?`${O?.files?.filter(e=>e.name.toLowerCase().includes(h.toLowerCase())).length||0} of ${O?.files?.length||0} items`:`${O?.files?.length||0} items`}),O?.files?.some(e=>!e.is_directory)&&(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:u.size>0?(0,$.jsxs)(`button`,{onClick:()=>{d(new Set),E.current=null},className:`flex items-center gap-1 text-xs text-bambu-gray hover:text-white transition-colors`,children:[(0,$.jsx)(Mr,{className:`w-4 h-4`}),`Deselect All`]}):(0,$.jsxs)(`button`,{onClick:()=>{let e=N.filter(e=>!e.is_directory).map(e=>e.path);d(new Set(e)),E.current=null},className:`flex items-center gap-1 text-xs text-bambu-gray hover:text-white transition-colors`,children:[(0,$.jsx)(xn,{className:`w-4 h-4`}),`Select All`]})})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(Y,{variant:`secondary`,disabled:u.size===0||x!==null,onClick:async()=>{if(u.size===0)return;let n=N.filter(e=>!e.is_directory&&u.has(e.path)).map(e=>e.path);if(n.length===0)return;let o=new AbortController;D.current=o,S({current:0,total:n.length});try{let s=Object.fromEntries(n.map(e=>[e,O?.files.find(t=>t.path===e)?.size??0])),c=await i.downloadPrinterFilesAsZip(e,n,s,n.length===1?O?.files.find(e=>e.path===n[0])?.name??`printer-file`:`${t.replace(/[^a-zA-Z0-9]/g,`_`)}-files.zip`,n.length>1,o.signal,(e,t)=>S({current:e,total:t}));c.failed>0?a(r(`printerFiles.zipPartial`,{successful:c.successful,total:c.requested}),`warning`):a(r(`printerFiles.zipStarted`,{count:c.successful})),d(new Set),E.current=null}catch(e){a(r(`printerFiles.downloadFailed`,{error:e instanceof Error?e.message:r(`printerFiles.unknownError`)}),`error`)}finally{D.current===o&&(D.current=null),S(null)}},children:x?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{className:`w-4 h-4 animate-spin`}),x.current,`/`,x.total]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ar,{className:`w-4 h-4`}),`Download`,u.size>1?` (${u.size})`:``]})}),(0,$.jsxs)(Y,{variant:`secondary`,disabled:u.size===0||F.isPending,onClick:()=>{u.size!==0&&v(N.filter(e=>!e.is_directory&&u.has(e.path)).map(e=>e.path))},className:`text-red-700 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300`,children:[F.isPending?(0,$.jsx)(H,{className:`w-4 h-4 animate-spin`}):(0,$.jsx)(Qt,{className:`w-4 h-4`}),r(`printerFiles.deleteButton`),u.size>1?` (${u.size})`:``]})]})]})]}),_.length>0&&(0,$.jsx)(In,{title:_.length>1?r(`printerFiles.deleteFiles`,{count:_.length}):r(`fileManager.deleteFile`),message:_.length>1?r(`printerFiles.deleteFilesConfirm`,{count:_.length}):r(`printerFiles.deleteFileConfirm`,{name:_[0].split(`/`).pop()}),confirmText:r(`common.delete`),variant:`danger`,onConfirm:()=>{F.mutate(_)},onCancel:()=>v([])}),C&&(0,$.jsx)(Li,{printerId:e,filePath:C.path,filename:C.name,onClose:()=>w(null)})]})}var Hi=`embeddedCameraState_`,Ui=5,Wi=2e3,Gi=3e4,Ki=5e3,qi={x:window.innerWidth-420,y:20,width:400,height:300};function Ji({printerId:e,printerName:t,viewerIndex:n=0,onClose:a}){let{t:s}=l(),c=f(),{showToast:u}=te(),{hasPermission:d}=lr(),h=`${Hi}${e}`,[g,_]=(0,X.useState)(()=>{try{let e=localStorage.getItem(h);if(e){let t=JSON.parse(e);return{x:Math.min(Math.max(0,t.x),window.innerWidth-100),y:Math.min(Math.max(0,t.y),window.innerHeight-100),width:Math.max(200,Math.min(t.width,window.innerWidth-20)),height:Math.max(150,Math.min(t.height,window.innerHeight-20))}}}catch{}let e=n*30;return{...qi,x:Math.max(0,qi.x-e),y:Math.max(0,qi.y+e)}}),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)({x:0,y:0}),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),[O,k]=(0,X.useState)(1),[A,j]=(0,X.useState)({x:0,y:0}),[M,N]=(0,X.useState)(!1),[P,F]=(0,X.useState)({x:0,y:0}),[I,L]=(0,X.useState)(null),[R,ee]=(0,X.useState)(null),[ne,z]=(0,X.useState)(!1),[re,B]=(0,X.useState)(!0),[ie,ae]=(0,X.useState)(Date.now()),[V,oe]=(0,X.useState)(0),[se,ce]=(0,X.useState)(!1),[le,ue]=(0,X.useState)(0),fe=(0,X.useRef)(null),pe=(0,X.useRef)(null),H=(0,X.useRef)(null),me=(0,X.useRef)(null),G=(0,X.useRef)(null),[be,xe]=(0,X.useState)(!1),[Se,K]=(0,X.useState)(!1),{data:Ce}=p({queryKey:[`printer`,e],queryFn:()=>i.getPrinter(e),enabled:e>0}),{data:we}=p({queryKey:[`printerStatus`,e],queryFn:()=>i.getPrinterStatus(e),refetchInterval:3e4,enabled:e>0}),Te=m({mutationFn:t=>i.setChamberLight(e,t),onMutate:async t=>{await c.cancelQueries({queryKey:[`printerStatus`,e]});let n=c.getQueryData([`printerStatus`,e]);return c.setQueryData([`printerStatus`,e],e=>({...e,chamber_light:t})),{previousStatus:n}},onSuccess:(e,t)=>{u(`Chamber light ${t?`on`:`off`}`)},onError:(t,n,r)=>{r?.previousStatus&&c.setQueryData([`printerStatus`,e],r.previousStatus),u(t.message||s(`printers.toast.failedToControlChamberLight`),`error`)}}),q=(we?.state===`RUNNING`||we?.state===`PAUSE`)&&(we?.printable_objects_count??0)>=2;(0,X.useEffect)(()=>{let e=setTimeout(()=>{localStorage.setItem(h,JSON.stringify(g))},500);return()=>clearTimeout(e)},[g,h]);let J=(0,X.useRef)(!1);(0,X.useEffect)(()=>{J.current=!1;let t=`/api/v1/printers/${e}/camera/stop`,n=()=>{if(e>0&&!J.current){J.current=!0;let e={},n=o();n&&(e.Authorization=`Bearer ${n}`),fetch(t,{method:`POST`,keepalive:!0,headers:e}).catch(()=>{})}},r=pe.current;return()=>{r&&(r.src=``),n(),H.current&&clearTimeout(H.current),me.current&&clearInterval(me.current),G.current&&clearInterval(G.current)}},[e]),(0,X.useEffect)(()=>{if(re){let e=setTimeout(()=>B(!1),3e3);return()=>clearTimeout(e)}},[re,ie]);let Ee=(0,X.useCallback)(()=>{if(V>=Ui){ce(!1),z(!0);return}let e=Math.min(Wi*2**V,Gi);ce(!0),ue(Math.ceil(e/1e3)),me.current=setInterval(()=>{ue(e=>e<=1?(me.current&&clearInterval(me.current),0):e-1)},1e3),H.current=setTimeout(()=>{oe(e=>e+1),ce(!1),B(!0),z(!1),pe.current&&(pe.current.src=``),ae(Date.now())},e)},[V]);(0,X.useEffect)(()=>{if(re||se||w){G.current&&=(clearInterval(G.current),null);return}return G.current=setInterval(async()=>{try{let t=await i.getCameraStatus(e);(t.stalled||!t.active&&!ne)&&(G.current&&=(clearInterval(G.current),null),B(!1),Ee())}catch{}},Ki),()=>{G.current&&=(clearInterval(G.current),null)}},[re,ne,se,w,e,Ee]),(0,X.useEffect)(()=>{let e=()=>{let e=!!document.fullscreenElement;D(e),e||(k(1),j({x:0,y:0}))};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let De=()=>{fe.current&&(document.fullscreenElement?document.exitFullscreen():fe.current.requestFullscreen())},Oe=()=>{k(e=>Math.min(e+.5,4))},ke=()=>{k(e=>{let t=Math.max(e-.5,1);return t===1&&j({x:0,y:0}),t})},Ae=e=>{e.preventDefault(),e.deltaY<0?Oe():ke()},je=e=>{O>1&&(e.preventDefault(),N(!0),F({x:e.clientX-A.x,y:e.clientY-A.y}))},Me=(0,X.useCallback)(()=>{if(!fe.current||!pe.current)return{x:200,y:150};let e=fe.current.getBoundingClientRect(),t=e.width*(O-1)/2,n=e.height*(O-1)/2;return{x:Math.max(50,t),y:Math.max(50,n)}},[O]),Ne=e=>{if(M&&O>1){let t=e.clientX-P.x,n=e.clientY-P.y,r=Me();j({x:Math.max(-r.x,Math.min(r.x,t)),y:Math.max(-r.y,Math.min(r.y,n))})}},Pe=()=>{N(!1)},Fe=e=>{if(e.length<2)return 0;let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.sqrt(t*t+n*n)},Ie=e=>e.length<2?{x:e[0].clientX,y:e[0].clientY}:{x:(e[0].clientX+e[1].clientX)/2,y:(e[0].clientY+e[1].clientY)/2},Le=e=>{e.touches.length===2?(e.preventDefault(),L(Fe(e.touches)),ee(Ie(e.touches))):e.touches.length===1&&O>1&&(e.preventDefault(),N(!0),F({x:e.touches[0].clientX-A.x,y:e.touches[0].clientY-A.y}))},Re=e=>{if(e.touches.length===2&&I!==null){e.preventDefault();let t=Fe(e.touches),n=t/I;k(e=>{let t=Math.max(1,Math.min(4,e*n));return t===1&&j({x:0,y:0}),t}),L(t);let r=Ie(e.touches);if(R){let e=Me();j(t=>({x:Math.max(-e.x,Math.min(e.x,t.x+(r.x-R.x))),y:Math.max(-e.y,Math.min(e.y,t.y+(r.y-R.y)))}))}ee(r)}else if(e.touches.length===1&&M&&O>1){e.preventDefault();let t=e.touches[0].clientX-P.x,n=e.touches[0].clientY-P.y,r=Me();j({x:Math.max(-r.x,Math.min(r.x,t)),y:Math.max(-r.y,Math.min(r.y,n))})}},ze=e=>{e.touches.length<2&&(L(null),ee(null)),e.touches.length===0&&N(!1)},Be=()=>{k(1),j({x:0,y:0})},Ve=()=>{B(!1),V{B(!1),z(!1),oe(0),ce(!1),H.current&&clearTimeout(H.current),me.current&&clearInterval(me.current)},Ue=()=>{B(!0),z(!1),oe(0),ce(!1),H.current&&clearTimeout(H.current),me.current&&clearInterval(me.current);let t={},n=o();n&&(t.Authorization=`Bearer ${n}`),fetch(`/api/v1/printers/${e}/camera/stop`,{method:`POST`,headers:t}).catch(()=>{}),pe.current&&(pe.current.src=``),setTimeout(()=>ae(Date.now()),100)},We=e=>{e.target.closest(`.no-drag`)||(y(!0),C({x:e.clientX-g.x,y:e.clientY-g.y}))},Ge=e=>{if(e.target.closest(`.no-drag`))return;let t=e.touches[0];y(!0),C({x:t.clientX-g.x,y:t.clientY-g.y})},Ke=e=>{e.stopPropagation(),x(!0)},qe=e=>{e.stopPropagation(),x(!0)};(0,X.useEffect)(()=>{let e=e=>{if(v)_(t=>({...t,x:Math.max(0,Math.min(e.clientX-S.x,window.innerWidth-t.width)),y:Math.max(0,Math.min(e.clientY-S.y,window.innerHeight-t.height))}));else if(b&&fe.current){let t=fe.current.getBoundingClientRect();_(n=>({...n,width:Math.max(200,Math.min(e.clientX-t.left,window.innerWidth-n.x-10)),height:Math.max(150,Math.min(e.clientY-t.top,window.innerHeight-n.y-10))}))}},t=e=>{if(!v&&!b)return;e.preventDefault();let t=e.touches[0];if(v)_(e=>({...e,x:Math.max(0,Math.min(t.clientX-S.x,window.innerWidth-e.width)),y:Math.max(0,Math.min(t.clientY-S.y,window.innerHeight-e.height))}));else if(b&&fe.current){let e=fe.current.getBoundingClientRect();_(n=>({...n,width:Math.max(200,Math.min(t.clientX-e.left,window.innerWidth-n.x-10)),height:Math.max(150,Math.min(t.clientY-e.top,window.innerHeight-n.y-10))}))}},n=()=>{y(!1),x(!1)};if(v||b)return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,n),document.addEventListener(`touchmove`,t,{passive:!1}),document.addEventListener(`touchend`,n),document.addEventListener(`touchcancel`,n),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,n),document.removeEventListener(`touchmove`,t),document.removeEventListener(`touchend`,n),document.removeEventListener(`touchcancel`,n)}},[v,b,S]);let Je=r(`/api/v1/printers/${e}/camera/stream?fps=15&t=${ie}`);return(0,$.jsxs)(`div`,{ref:fe,className:`${E?`fixed inset-0 z-[100]`:`fixed z-40 rounded-lg shadow-2xl border border-bambu-dark-tertiary`} bg-bambu-dark-secondary overflow-hidden`,style:E?void 0:{left:g.x,top:g.y,width:w?200:g.width,height:w?40:g.height,cursor:v?`grabbing`:`default`},children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-bambu-dark border-b border-bambu-dark-tertiary cursor-grab active:cursor-grabbing`,onMouseDown:We,onTouchStart:Ge,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-white truncate`,children:[(0,$.jsx)(de,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:Ce?.name||t})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 no-drag`,children:[(0,$.jsx)(`button`,{onClick:()=>Te.mutate(!we?.chamber_light),disabled:!we?.connected||Te.isPending||!d(`printers:control`),className:`p-1 rounded disabled:opacity-50 ${we?.chamber_light?`bg-yellow-500/20 hover:bg-yellow-500/30`:`hover:bg-bambu-dark-tertiary`}`,title:d(`printers:control`)?s(`camera.chamberLight`):s(`printers.permission.noControl`),children:(0,$.jsx)(_e,{on:we?.chamber_light??!1,className:`w-3.5 h-3.5`})}),(0,$.jsx)(`button`,{onClick:()=>xe(!0),disabled:!q||!d(`printers:control`),className:`p-1 rounded disabled:opacity-50 ${q&&d(`printers:control`)?`hover:bg-bambu-dark-tertiary`:``}`,title:d(`printers:control`)?s(q?`printers.skipObjects.tooltip`:`printers.skipObjects.onlyWhilePrinting`):s(`printers.permission.noControl`),children:(0,$.jsx)(ve,{className:`w-3.5 h-3.5 text-bambu-gray`})}),(0,$.jsx)(`button`,{onClick:Ue,disabled:re||se,className:`p-1 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50`,title:`Refresh stream`,children:(0,$.jsx)(dn,{className:`w-3.5 h-3.5 text-bambu-gray ${re?`animate-spin`:``}`})}),(0,$.jsx)(`button`,{onClick:()=>K(!0),className:`p-1 hover:bg-bambu-dark-tertiary rounded`,title:s(`camera.diagnose.button`),children:(0,$.jsx)(an,{className:`w-3.5 h-3.5 text-bambu-gray`})}),(0,$.jsx)(`button`,{onClick:De,className:`p-1 hover:bg-bambu-dark-tertiary rounded`,title:E?`Exit fullscreen`:`Fullscreen`,children:E?(0,$.jsx)(ge,{className:`w-3.5 h-3.5 text-bambu-gray`}):(0,$.jsx)(wr,{className:`w-3.5 h-3.5 text-bambu-gray`})}),(0,$.jsx)(`button`,{onClick:()=>T(!w),className:`p-1 hover:bg-bambu-dark-tertiary rounded`,title:w?`Expand`:`Minimize`,children:w?(0,$.jsx)(he,{className:`w-3.5 h-3.5 text-bambu-gray`}):(0,$.jsx)(U,{className:`w-3.5 h-3.5 text-bambu-gray`})}),(0,$.jsx)(`button`,{onClick:a,className:`p-1 hover:bg-red-500/20 rounded`,title:`Close`,children:(0,$.jsx)(Pt,{className:`w-3.5 h-3.5 text-bambu-gray hover:text-red-600 dark:hover:text-red-400`})})]})]}),!w&&(0,$.jsxs)(`div`,{className:`relative w-full bg-black flex items-center justify-center overflow-hidden h-[calc(100%-40px)]`,onWheel:Ae,onMouseMove:Ne,onMouseUp:Pe,onMouseLeave:Pe,onTouchStart:Le,onTouchMove:Re,onTouchEnd:ze,style:{touchAction:`none`},children:[re&&!se&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/50 z-10`,children:(0,$.jsx)(dn,{className:`w-6 h-6 text-bambu-gray animate-spin`})}),se&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/80 z-10`,children:(0,$.jsxs)(`div`,{className:`text-center p-2`,children:[(0,$.jsx)(en,{className:`w-6 h-6 text-orange-400 mx-auto mb-2`}),(0,$.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[`Reconnecting in `,le,`s...`]})]})}),ne&&!se&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black z-10`,children:(0,$.jsxs)(`div`,{className:`text-center p-2`,children:[(0,$.jsx)(Ot,{className:`w-6 h-6 text-orange-400 mx-auto mb-2`}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:s(`camera.unavailable`)}),(0,$.jsxs)(`div`,{className:`flex gap-2 justify-center`,children:[(0,$.jsx)(`button`,{onClick:Ue,className:`px-2 py-1 text-xs bg-bambu-green text-white rounded hover:bg-bambu-green/80`,children:s(`camera.retry`)}),(0,$.jsx)(`button`,{onClick:()=>K(!0),className:`px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray hover:text-white rounded transition-colors`,children:s(`camera.diagnose.button`)})]})]})}),(0,$.jsx)(`img`,{ref:pe,src:Je,alt:`Camera stream`,className:`max-w-full max-h-full object-contain select-none`,style:{transform:`scale(${O}) translate(${A.x/O}px, ${A.y/O}px) rotate(${Ce?.camera_rotation||0}deg)`,...Ce?.camera_rotation===90||Ce?.camera_rotation===270?{maxWidth:`100%`,maxHeight:`100%`}:{},cursor:O>1?M?`grabbing`:`grab`:`default`},onError:Ve,onLoad:He,onMouseDown:je,draggable:!1},ie),(0,$.jsxs)(`div`,{className:`absolute bottom-2 left-2 flex items-center gap-1 bg-black/60 rounded px-1.5 py-1 no-drag`,children:[(0,$.jsx)(`button`,{onClick:ke,disabled:O<=1,className:`p-1 hover:bg-white/10 rounded disabled:opacity-30`,title:`Zoom out`,children:(0,$.jsx)(It,{className:`w-3.5 h-3.5 text-white`})}),(0,$.jsxs)(`button`,{onClick:Be,className:`px-1.5 py-0.5 text-xs text-white hover:bg-white/10 rounded min-w-[32px]`,title:`Reset zoom`,children:[Math.round(O*100),`%`]}),(0,$.jsx)(`button`,{onClick:Oe,disabled:O>=4,className:`p-1 hover:bg-white/10 rounded disabled:opacity-30`,title:`Zoom in`,children:(0,$.jsx)(Ft,{className:`w-3.5 h-3.5 text-white`})})]}),!E&&(0,$.jsx)(`div`,{className:`absolute bottom-0 right-0 w-6 h-6 cursor-se-resize no-drag hover:bg-white/10 rounded-tl transition-colors`,onMouseDown:Ke,onTouchStart:qe,title:`Drag to resize`,children:(0,$.jsx)(`svg`,{className:`w-6 h-6 text-bambu-gray/70 hover:text-bambu-gray`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,$.jsx)(`path`,{d:`M22 22H20V20H22V22ZM22 18H20V16H22V18ZM18 22H16V20H18V22ZM22 14H20V12H22V14ZM18 18H16V16H18V18ZM14 22H12V20H14V22ZM22 10H20V8H22V10ZM18 14H16V12H18V14ZM14 18H12V16H14V18ZM10 22H8V20H10V22Z`})})})]}),(0,$.jsx)(ye,{printerId:e,isOpen:be,onClose:()=>xe(!1)}),Se&&(0,$.jsx)(W,{printerId:e,printerName:Ce?.name||null,onClose:()=>K(!1)})]})}function Yi({printerId:e,printerName:t,onClose:n}){let{t:r}=l(),a=f(),[o,s]=(0,X.useState)(!0),[c,u]=(0,X.useState)(new Set),[d,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(`all`),v=(0,X.useRef)(null),{data:y,isLoading:b,refetch:x}=p({queryKey:[`mqtt-logs`,e],queryFn:()=>i.getMQTTLogs(e),refetchInterval:1e3}),C=m({mutationFn:()=>i.enableMQTTLogging(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`mqtt-logs`,e]})}}),w=m({mutationFn:()=>i.disableMQTTLogging(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`mqtt-logs`,e]})}}),T=m({mutationFn:()=>i.clearMQTTLogs(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`mqtt-logs`,e]})}});(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,X.useEffect)(()=>{o&&v.current&&(v.current.scrollTop=v.current.scrollHeight)},[y?.logs,o]);let D=e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},O=e=>new Date(e).toLocaleTimeString(`en-US`,{hour12:!1,fractionalSecondDigits:3}),k=(e,t)=>{if(e==null)return``;let n=typeof e==`string`?JSON.parse(e):e,r=JSON.stringify(n,null,t?2:0);return!t&&r.length>100?r.substring(0,100)+`...`:r},A=y?.logging_enabled??!1,j=(0,X.useMemo)(()=>y?.logs??[],[y?.logs]),M=(0,X.useMemo)(()=>j.filter(e=>{if(g!==`all`&&e.direction!==g)return!1;if(d.trim()){let t=d.toLowerCase(),n=e.topic.toLowerCase().includes(t),r=JSON.stringify(e.payload).toLowerCase().includes(t);return n||r}return!0}),[j,d,g]);return(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,$.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[85vh] flex flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:r(`mqttDebug.title`)}),(0,$.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t})]}),(0,$.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,$.jsx)(Pt,{className:`w-5 h-5`})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 p-4 border-b border-bambu-dark-tertiary`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A?(0,$.jsxs)(Y,{size:`sm`,variant:`secondary`,onClick:()=>w.mutate(),disabled:w.isPending,children:[(0,$.jsx)(fn,{className:`w-4 h-4`}),r(`mqttDebug.stopLogging`)]}):(0,$.jsxs)(Y,{size:`sm`,onClick:()=>C.mutate(),disabled:C.isPending,children:[(0,$.jsx)(ke,{className:`w-4 h-4`}),r(`mqttDebug.startLogging`)]}),(0,$.jsxs)(Y,{size:`sm`,variant:`secondary`,onClick:()=>T.mutate(),disabled:T.isPending||j.length===0,children:[(0,$.jsx)(Qt,{className:`w-4 h-4`}),r(`mqttDebug.clearLog`)]}),(0,$.jsx)(Y,{size:`sm`,variant:`secondary`,onClick:()=>x(),disabled:b,children:(0,$.jsx)(dn,{className:`w-4 h-4 ${b?`animate-spin`:``}`})}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-bambu-gray cursor-pointer`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`rounded border-bambu-dark-tertiary`}),`Auto-scroll`]}),(0,$.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[M.length,`/`,j.length]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1`,children:[(0,$.jsx)(Ae,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,$.jsx)(`input`,{type:`text`,placeholder:r(`mqttDebug.searchPlaceholder`),value:d,onChange:e=>h(e.target.value),className:`w-full pl-8 pr-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`}),d&&(0,$.jsx)(`button`,{onClick:()=>h(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,$.jsx)(Pt,{className:`w-4 h-4`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-bambu-dark rounded border border-bambu-dark-tertiary`,children:[(0,$.jsx)(`button`,{onClick:()=>_(`all`),className:`px-2 py-1.5 text-xs rounded-l transition-colors ${g===`all`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:r(`mqttDebug.all`)}),(0,$.jsxs)(`button`,{onClick:()=>_(`in`),className:`px-2 py-1.5 text-xs transition-colors flex items-center gap-1 ${g===`in`?`bg-blue-500 text-white`:`text-bambu-gray hover:text-white`}`,children:[(0,$.jsx)(S,{className:`w-3 h-3`}),r(`mqttDebug.incoming`)]}),(0,$.jsxs)(`button`,{onClick:()=>_(`out`),className:`px-2 py-1.5 text-xs rounded-r transition-colors flex items-center gap-1 ${g===`out`?`bg-green-500 text-white`:`text-bambu-gray hover:text-white`}`,children:[(0,$.jsx)(E,{className:`w-3 h-3`}),r(`mqttDebug.outgoing`)]})]})]})]}),(0,$.jsx)(`div`,{ref:v,className:`flex-1 overflow-auto p-4 font-mono text-xs bg-black min-h-[400px]`,children:j.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-bambu-gray`,children:[(0,$.jsx)(`p`,{className:`mb-2`,children:r(`mqttDebug.noMessages`)}),!A&&(0,$.jsx)(`p`,{className:`text-sm`,children:r(`mqttDebug.startLoggingHint`)})]}):M.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-bambu-gray`,children:[(0,$.jsx)(`p`,{className:`mb-2`,children:r(`mqttDebug.noMessagesMatch`)}),(0,$.jsx)(`p`,{className:`text-sm`,children:r(`mqttDebug.adjustFilterHint`)})]}):(0,$.jsx)(`div`,{className:`space-y-1`,children:M.map((e,t)=>{let n=c.has(t),i=e.direction===`in`;return(0,$.jsxs)(`div`,{className:`p-2 rounded cursor-pointer hover:bg-bambu-dark-secondary transition-colors ${n?`bg-bambu-dark-secondary`:``}`,onClick:()=>D(t),children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`span`,{className:`text-bambu-gray shrink-0`,children:O(e.timestamp)}),(0,$.jsx)(`span`,{className:`shrink-0 ${i?`text-blue-400`:`text-green-400`}`,title:r(i?`mqttDebug.incoming`:`mqttDebug.outgoing`),children:i?(0,$.jsx)(S,{className:`w-3 h-3`}):(0,$.jsx)(E,{className:`w-3 h-3`})}),(0,$.jsx)(`span`,{className:`text-purple-400 shrink-0`,children:e.topic})]}),n?(0,$.jsx)(`pre`,{className:`mt-2 p-3 bg-gray-900 border border-gray-700 rounded text-green-400 overflow-x-auto whitespace-pre-wrap break-all max-h-96 overflow-y-auto text-xs`,children:k(e.payload,!0)}):(0,$.jsx)(`pre`,{className:`mt-1 text-white/80 truncate`,children:k(e.payload,!1)})]},t)})})}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-t border-bambu-dark-tertiary`,children:[(0,$.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:A?(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`w-2 h-2 bg-green-500 rounded-full animate-pulse`}),r(`mqttDebug.loggingActive`)]}):(0,$.jsx)(`span`,{children:r(`mqttDebug.loggingStopped`)})}),(0,$.jsx)(Y,{variant:`secondary`,onClick:n,children:r(`common.close`)})]})]})})}function Xi(e){if(!e)return`idle`;switch(e.class){case`failure`:case`warning`:case`safe`:case`error`:return e.class;default:return`unknown`}}function Zi(e){return e===`failure`||e===`warning`||e===`safe`}function Qi({printerName:e,detection:t,lastError:n,onClose:r}){let{t:i}=l(),a=Tn();(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let o=Xi(t),s=o===`failure`?`text-status-error`:o===`warning`?`text-status-warning`:o===`safe`?`text-status-ok`:o===`error`?`text-amber-600 dark:text-amber-400`:`text-bambu-gray`,c=t?.error??n;return(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,$.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg shadow-xl max-w-lg w-full max-h-[80vh] flex flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(K,{className:`w-5 h-5 text-bambu-green`}),(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`printers.aiDetection.modalTitle`,{name:e})})]}),(0,$.jsx)(`button`,{onClick:r,className:`p-1 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,"aria-label":i(`common.close`),children:(0,$.jsx)(Pt,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4 text-sm`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between`,children:[(0,$.jsx)(`span`,{className:`text-bambu-gray`,children:i(`printers.aiDetection.currentStatus`)}),(0,$.jsx)(`span`,{className:`font-medium ${s}`,children:i(`printers.aiDetection.${o}`)})]}),t&&Zi(o)&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex justify-between`,children:[(0,$.jsx)(`span`,{className:`text-bambu-gray`,children:i(`printers.aiDetection.score`)}),(0,$.jsx)(`span`,{className:`text-white font-mono`,children:t.score.toFixed(3)})]}),(0,$.jsxs)(`div`,{className:`flex justify-between`,children:[(0,$.jsx)(`span`,{className:`text-bambu-gray`,children:i(`printers.aiDetection.framesAnalyzed`)}),(0,$.jsx)(`span`,{className:`text-white font-mono`,children:t.frame_count})]})]}),o===`error`&&(0,$.jsx)(`p`,{className:`text-bambu-gray`,children:i(`printers.aiDetection.errorHint`)}),!t&&(0,$.jsx)(`p`,{className:`text-bambu-gray`,children:i(`printers.aiDetection.idleHint`)})]}),c&&(0,$.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30`,children:[(0,$.jsx)(R,{className:`w-4 h-4 mt-0.5 flex-shrink-0 text-red-700 dark:text-red-400`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`font-medium text-red-700 dark:text-red-400`,children:i(`printers.aiDetection.lastError`)}),(0,$.jsx)(`p`,{className:`text-red-700/80 dark:text-red-300/80 break-words mt-1`,children:c})]})]})]}),(0,$.jsx)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary flex items-center justify-end`,children:(0,$.jsxs)(`button`,{onClick:()=>a(`/settings?tab=failure-detection`),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors`,children:[(0,$.jsx)(En,{className:`w-4 h-4`}),i(`printers.aiDetection.openSettings`)]})})]})})}function $i({printerId:e,printerModel:t,loadedFilamentTypes:n,loadedFilaments:r,loadedVariants:a,variant:o=`card`}){let{t:s}=l(),{data:c}=p({queryKey:[`queue`,e,`pending`,t],queryFn:()=>i.getQueue(e,`pending`,t||void 0),refetchInterval:3e4}),u=c?nn(c,n,r,a):void 0,d=u?.length||0;if(d===0)return null;let f=u?.[0];return(0,$.jsx)(bn,{to:`/queue`,className:o===`panelExtension`?`block mt-2 border-t border-bambu-dark-tertiary pt-2 pl-1 hover:opacity-90 transition-opacity`:`block mb-3 p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,$.jsx)(P,{className:`w-5 h-5 text-yellow-600 dark:text-yellow-400 flex-shrink-0`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:s(`queue.nextInQueue`)}),(0,$.jsx)(`p`,{className:`text-sm text-white truncate`,children:f?_r(f):``})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-bambu-gray flex items-center gap-1`,children:[(0,$.jsx)(vn,{className:`w-3 h-3`}),f?.scheduled_time?Kt(f.scheduled_time,`system`,s):s(`time.waiting`)]}),d>1&&(0,$.jsxs)(`span`,{className:`text-xs px-1.5 py-0.5 bg-yellow-100 dark:bg-yellow-400/20 text-yellow-700 dark:text-yellow-400 rounded`,children:[`+`,d-1]}),(0,$.jsx)(pn,{className:`w-4 h-4 text-bambu-gray`})]})]})})}function ea({printerId:e}){let{t}=l(),{data:n}=p({queryKey:[`haSensorReadings`,e],queryFn:()=>i.getHASensorReadings(e),refetchInterval:15e3});if(!n?.length)return null;let r=e=>v(e,t);return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,$.jsx)(ue,{className:`w-[var(--pc-i35,0.875rem)] h-[var(--pc-i35,0.875rem)] text-blue-600 dark:text-blue-400 flex-shrink-0`}),(0,$.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:t(`haSensors.label`)}),(0,$.jsx)(`div`,{className:`h-[2px] w-5 bg-bambu-dark-tertiary/50`}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.map(e=>{let n=b(e),i=!e.reachable||e.state===null;return(0,$.jsxs)(`span`,{title:e.block_print?t(`haSensors.blocksPrints`,{entity:e.entity_id}):e.entity_id,className:`px-2 py-0.5 text-xs rounded flex items-center gap-1 ${i?`bg-bambu-dark-tertiary/50 text-bambu-gray`:e.alerting?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:[(0,$.jsx)(n,{className:`w-[var(--pc-i25,0.625rem)] h-[var(--pc-i25,0.625rem)]`}),(0,$.jsx)(`span`,{children:e.name}),(0,$.jsx)(`span`,{className:`font-medium`,children:r(e)})]},e.id)})})]})}var ta=[{value:`6h`,label:`6h`,hours:6},{value:`24h`,label:`24h`,hours:24},{value:`48h`,label:`48h`,hours:48},{value:`7d`,label:`7d`,hours:168}];function na({isOpen:e,onClose:t,printerId:n,printerName:r,amsId:a,amsLabel:o,initialMode:s=`humidity`,thresholds:c}){let{t:u}=l(),[d,f]=(0,X.useState)(`24h`),[m,h]=(0,X.useState)(s),{data:g}=p({queryKey:[`settings`],queryFn:i.getSettings}),v=g?.time_format||`system`;(0,X.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let b=ta.find(e=>e.value===d)?.hours||24,{data:x,isLoading:S,error:C}=p({queryKey:[`ams-history`,n,a,b],queryFn:()=>i.getAMSHistory(n,a,b),enabled:e,refetchInterval:6e4});if(!e)return null;let w=x?.data.map(e=>({time:(qt(e.recorded_at)||new Date).getTime(),humidity:e.humidity,temperature:e.temperature}))||[],T=Date.now()-b*60*60*1e3,E=Date.now(),D=[...w];if(D.length>0){let e=D[0];e.time>T&&D.unshift({...e,time:T});let t=D[D.length-1];t.time{let t=e.filter(e=>e!=null);if(t.length<4)return`stable`;let n=t.slice(0,Math.floor(t.length/4)),r=t.slice(-Math.floor(t.length/4)),i=n.reduce((e,t)=>e+t,0)/n.length,a=r.reduce((e,t)=>e+t,0)/r.length-i;return Math.abs(a)<2?`stable`:a>0?`up`:`down`},R=L(D.map(e=>e.humidity)),ee=L(D.map(e=>e.temperature)),te=({trend:e})=>e===`up`?(0,$.jsx)(_,{className:`w-4 h-4 text-red-600 dark:text-red-400`}):e===`down`?(0,$.jsx)(Ke,{className:`w-4 h-4 text-green-600 dark:text-green-400`}):(0,$.jsx)(G,{className:`w-4 h-4 text-gray-400 dark:text-bambu-gray`}),ne=e=>e==null?`#9ca3af`:e<=k?`#22a352`:e<=j?`#d4a017`:`#c62828`,z=e=>e==null?`#9ca3af`:e<=M?`#22a352`:e<=N?`#d4a017`:`#c62828`,re=`var(--bg-secondary)`,B=`var(--bg-primary)`,ie=`var(--border-color)`,ae=`var(--text-primary)`,V=`var(--text-secondary)`,oe=`var(--text-muted)`;return(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:t,children:(0,$.jsxs)(`div`,{className:`rounded-xl w-full max-w-4xl max-h-[90vh] overflow-hidden shadow-xl`,style:{backgroundColor:re},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b`,style:{borderColor:ie},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-lg font-semibold`,style:{color:ae},children:[o,` `,u(`common.history`,`History`)]}),(0,$.jsx)(`p`,{className:`text-sm`,style:{color:V},children:r})]}),(0,$.jsx)(`button`,{onClick:t,className:`p-2 rounded-lg transition-colors`,style:{color:V},children:(0,$.jsx)(Pt,{className:`w-5 h-5`})})]}),(0,$.jsxs)(`div`,{className:`p-6 space-y-6 overflow-y-auto max-h-[calc(90vh-80px)]`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between max-[550px]:flex-col max-[550px]:items-start max-[550px]:gap-3`,children:[(0,$.jsxs)(`div`,{className:`inline-flex gap-1 rounded-lg p-1 max-w-full flex-wrap w-fit`,style:{backgroundColor:B},children:[(0,$.jsxs)(`button`,{onClick:()=>h(`humidity`),className:`flex items-center gap-2 px-3 py-1.5 text-sm rounded-md transition-colors ${m===`humidity`?`bg-blue-600 text-white`:``}`,style:m===`humidity`?void 0:{color:V},children:[(0,$.jsx)(y,{className:`w-4 h-4`}),u(`common.humidity`,`Humidity`)]}),(0,$.jsxs)(`button`,{onClick:()=>h(`temperature`),className:`flex items-center gap-2 px-3 py-1.5 text-sm rounded-md transition-colors ${m===`temperature`?`bg-orange-600 text-white`:``}`,style:m===`temperature`?void 0:{color:V},children:[(0,$.jsx)(Me,{className:`w-4 h-4`}),u(`common.temperature`,`Temperature`)]})]}),(0,$.jsx)(`div`,{className:`inline-flex gap-1 rounded-lg p-1 max-w-full flex-wrap w-fit`,style:{backgroundColor:B},children:ta.map(e=>(0,$.jsx)(`button`,{onClick:()=>f(e.value),className:`px-3 py-1 text-sm rounded-md transition-colors ${d===e.value?`bg-bambu-green text-white`:``}`,style:d===e.value?void 0:{color:V},children:e.label},e.value))})]}),(0,$.jsx)(`div`,{className:`grid grid-cols-4 gap-4 max-[550px]:grid-cols-2`,children:m===`humidity`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`rounded-lg p-4 max-[550px]:order-2`,style:{backgroundColor:B},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:V},children:u(`common.current`,`Current`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:ne(F)},children:F==null?`—`:`${F}%`}),(0,$.jsx)(te,{trend:R})]})]}),(0,$.jsxs)(`div`,{className:`rounded-lg p-4 max-[550px]:order-4`,style:{backgroundColor:B},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:V},children:u(`common.average`,`Average`)}),(0,$.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:ae},children:x?.avg_humidity==null?`—`:`${x.avg_humidity}%`})]}),(0,$.jsxs)(`div`,{className:`rounded-lg p-4 max-[550px]:order-1`,style:{backgroundColor:B},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:V},children:u(`common.min`,`Min`)}),(0,$.jsx)(`p`,{className:`text-2xl font-bold text-green-500`,children:x?.min_humidity==null?`—`:`${x.min_humidity}%`})]}),(0,$.jsxs)(`div`,{className:`rounded-lg p-4 max-[550px]:order-3`,style:{backgroundColor:B},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:V},children:u(`common.max`,`Max`)}),(0,$.jsx)(`p`,{className:`text-2xl font-bold text-red-500`,children:x?.max_humidity==null?`—`:`${x.max_humidity}%`})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`rounded-lg p-4 max-[550px]:order-2`,style:{backgroundColor:B},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:V},children:u(`common.current`,`Current`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:z(I)},children:I==null?`—`:`${I}°C`}),(0,$.jsx)(te,{trend:ee})]})]}),(0,$.jsxs)(`div`,{className:`rounded-lg p-4 max-[550px]:order-4`,style:{backgroundColor:B},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:V},children:u(`common.average`,`Average`)}),(0,$.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:ae},children:x?.avg_temperature==null?`—`:`${x.avg_temperature}°C`})]}),(0,$.jsxs)(`div`,{className:`rounded-lg p-4 max-[550px]:order-1`,style:{backgroundColor:B},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:V},children:u(`common.min`,`Min`)}),(0,$.jsx)(`p`,{className:`text-2xl font-bold text-blue-500`,children:x?.min_temperature==null?`—`:`${x.min_temperature}°C`})]}),(0,$.jsxs)(`div`,{className:`rounded-lg p-4 max-[550px]:order-3`,style:{backgroundColor:B},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:V},children:u(`common.max`,`Max`)}),(0,$.jsx)(`p`,{className:`text-2xl font-bold text-red-500`,children:x?.max_temperature==null?`—`:`${x.max_temperature}°C`})]})]})}),(0,$.jsx)(`div`,{className:`rounded-lg p-4`,style:{backgroundColor:B},children:S?(0,$.jsx)(`div`,{className:`h-[300px] flex items-center justify-center`,style:{color:V},children:u(`common.loading`,`Loading...`)}):C?(0,$.jsx)(`div`,{className:`h-[300px] flex items-center justify-center text-red-500`,children:u(`common.error`,`Error loading data`)}):D.length===0?(0,$.jsx)(`div`,{className:`h-[300px] flex items-center justify-center`,style:{color:V},children:u(`common.noData`,`No data available for this time range`)}):(0,$.jsx)(Qe,{width:`100%`,height:300,children:(0,$.jsxs)(hi,{data:D,children:[(0,$.jsx)(gt,{strokeDasharray:`3 3`,stroke:ie}),(0,$.jsx)(rt,{dataKey:`time`,type:`number`,domain:[Date.now()-b*60*60*1e3,Date.now()],tickFormatter:e=>{let t=new Date(e);return b>24?t.toLocaleDateString([],{day:`numeric`,month:`short`}):t.toLocaleTimeString([],Gt({hour:`2-digit`,minute:`2-digit`},v))},stroke:oe,tick:{fontSize:12}}),(0,$.jsx)(vt,{stroke:oe,tick:{fontSize:12},domain:m===`humidity`?[0,100]:[`auto`,`auto`],tickFormatter:e=>m===`humidity`?`${e}%`:`${e}°C`}),(0,$.jsx)(Re,{contentStyle:{backgroundColor:re,border:`1px solid ${ie}`,borderRadius:`8px`,color:ae},labelFormatter:e=>new Date(e).toLocaleString(void 0,Gt({year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`},v)),formatter:e=>[m===`humidity`?`${e??0}%`:`${e??0}°C`,m===`humidity`?`Humidity`:`Temperature`]}),(0,$.jsx)(O,{}),m===`humidity`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A,{y:k,stroke:`#22a352`,strokeDasharray:`5 5`,label:{value:`Good`,fill:`#22a352`,fontSize:10}}),(0,$.jsx)(A,{y:j,stroke:`#d4a017`,strokeDasharray:`5 5`,label:{value:`Fair`,fill:`#d4a017`,fontSize:10}})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A,{y:M,stroke:`#22a352`,strokeDasharray:`5 5`,label:{value:`Good`,fill:`#22a352`,fontSize:10}}),(0,$.jsx)(A,{y:N,stroke:`#d4a017`,strokeDasharray:`5 5`,label:{value:`Fair`,fill:`#d4a017`,fontSize:10}})]}),(0,$.jsx)(pi,{type:`monotone`,dataKey:m,name:m===`humidity`?`Humidity`:`Temperature`,stroke:m===`humidity`?`#3b82f6`:`#f97316`,strokeWidth:2,dot:!1,activeDot:{r:4},connectNulls:!0})]})})}),(0,$.jsx)(`div`,{className:`text-xs text-center`,style:{color:V},children:u(`amsHistory.recordingInfo`,`Data is recorded every 5 minutes while the printer is connected`)})]})]})})}function ra(e,t,n){let r=n===1||e>=128,i=e>=128?e-128:e,a=String.fromCharCode(65+i);return r?`HT·${t+1}`:`${a}·${t+1}`}function ia(e){let t=(e||``).replace(`#`,``).slice(0,6);if(t.length!==6)return`#FFFFFF`;let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);return[n,r,i].some(Number.isNaN)?`#FFFFFF`:(.2126*n+.7152*r+.0722*i)/255>.55?`#1A1A1A`:`#FFFFFF`}function aa({group:e,trayCountByAms:t,innerBg:n,textPrimary:r,textSecondary:i,showExtruderBadge:a,extruderLabel:o}){let s=Mn(e.trayColor||void 0),c=ia(e.trayColor),l=c===`#FFFFFF`?`rgba(0,0,0,0.45)`:`rgba(255,255,255,0.7)`,u=e.members.length;return(0,$.jsxs)(`div`,{className:`relative flex flex-col items-center`,children:[a&&(0,$.jsx)(`span`,{className:`absolute -top-1 -left-1 z-10 w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shadow`,style:{backgroundColor:r,color:n},"aria-label":o,title:o,children:o}),(0,$.jsxs)(`svg`,{viewBox:`-100 -100 200 200`,className:`w-44 h-44`,children:[(0,$.jsx)(`circle`,{cx:`0`,cy:`0`,r:`95`,fill:`none`,stroke:i,strokeOpacity:`0.25`,strokeWidth:`1`}),(0,$.jsx)(`circle`,{cx:`0`,cy:`0`,r:`92`,fill:s}),(0,$.jsx)(`circle`,{cx:`0`,cy:`0`,r:`56`,fill:n}),(0,$.jsx)(`circle`,{cx:`0`,cy:`0`,r:`56`,fill:`none`,stroke:i,strokeOpacity:`0.3`,strokeWidth:`1`}),(0,$.jsx)(`text`,{x:`0`,y:`-4`,textAnchor:`middle`,dominantBaseline:`middle`,fontSize:`14`,fontWeight:`700`,fill:r,children:e.displayName||`—`}),(0,$.jsx)(`text`,{x:`0`,y:`16`,textAnchor:`middle`,dominantBaseline:`middle`,fontSize:`11`,fontWeight:`500`,fill:i,children:`${u}× ↻`}),e.members.map((e,n)=>{let r=(n*360/u-90)*Math.PI/180,i=76*Math.cos(r),a=76*Math.sin(r),o=ra(e.amsId,e.slotIdx,t.get(e.amsId)??4),s=Math.max(22,o.length*7+8);return(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`rect`,{x:i-s/2,y:a-9,width:s,height:18,rx:9,ry:9,fill:l}),(0,$.jsx)(`text`,{x:i,y:a,textAnchor:`middle`,dominantBaseline:`middle`,fontSize:`12`,fontWeight:`700`,fill:c,children:o})]},`${e.amsId}-${e.slotIdx}`)})]})]})}function oa({isOpen:e,state:t,amsUnits:n,amsExtruderMap:r,isDualNozzle:i,canToggle:a,pending:o,onToggle:s,onClose:c}){let{t:u}=l();if((0,X.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&(e.stopPropagation(),c())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,c]),!e)return null;let d=`var(--bg-secondary)`,f=`var(--border-color)`,p=`var(--text-primary)`,m=`var(--text-secondary)`,h=(()=>{if(!i||!r)return!1;let e=new Set;for(let t of n||[]){let n=r[String(t.id)];if(n!==void 0&&(e.add(Number(n)),e.size>1))return!0}return!1})(),g=wn(n,r,h),_=new Map((n||[]).map(e=>[e.id,e.tray.length])),v=g.filter(e=>e.members.length>=2),y=t===!0,b=t===null;return(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:c,"data-testid":`ams-backup-modal`,children:(0,$.jsxs)(`div`,{className:`rounded-xl w-full max-w-2xl max-h-[90vh] overflow-hidden shadow-xl flex flex-col`,style:{backgroundColor:d},onClick:e=>e.stopPropagation(),role:`dialog`,"aria-modal":`true`,"aria-labelledby":`ams-backup-modal-title`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b`,style:{borderColor:f},children:[(0,$.jsx)(`h2`,{id:`ams-backup-modal-title`,className:`text-base font-semibold`,style:{color:p},children:u(`printers.amsBackup.modalTitle`)}),(0,$.jsx)(`button`,{type:`button`,onClick:c,className:`p-1 rounded-md transition-colors hover:bg-black/10`,style:{color:m},"aria-label":u(`common.close`),children:(0,$.jsx)(Pt,{className:`w-5 h-5`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b`,style:{borderColor:f,backgroundColor:`var(--bg-primary)`},children:[(0,$.jsxs)(`div`,{className:`min-w-0 mr-3`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium`,style:{color:p},children:u(b?`printers.amsBackup.stateUnknown`:y?`printers.amsBackup.stateOn`:`printers.amsBackup.stateOff`)}),(0,$.jsx)(`p`,{className:`text-xs mt-0.5`,style:{color:m},children:u(`printers.amsBackup.modalHelp`)})]}),(0,$.jsx)(hr,{checked:y,onChange:s,disabled:!a||b||o})]}),(0,$.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-6`,children:v.length===0?(0,$.jsx)(`p`,{className:`text-sm text-center py-8`,style:{color:m},children:u(`printers.amsBackup.modalNoPairs`)}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-6 justify-items-center`,children:v.map(e=>(0,$.jsx)(aa,{group:e,trayCountByAms:_,innerBg:d,textPrimary:p,textSecondary:m,showExtruderBadge:h,extruderLabel:e.extruder===0?u(`printers.amsBackup.extruderRightShort`):u(`printers.amsBackup.extruderLeftShort`)},e.key))})})]})})}var sa=[{value:`6h`,label:`6h`,hours:6},{value:`24h`,label:`24h`,hours:24},{value:`48h`,label:`48h`,hours:48},{value:`7d`,label:`7d`,hours:168}],ca={nozzle:`#fb923c`,nozzle_2:`#f97316`,bed:`#60a5fa`,chamber:`#34d399`},la={nozzle:`#fed7aa`,nozzle_2:`#fdba74`,bed:`#bfdbfe`,chamber:`#a7f3d0`};function ua({isOpen:e,onClose:t,printerId:n,printerName:r,initialKind:a=`nozzle`,availableKinds:o=[`nozzle`,`bed`,`chamber`]}){let{t:s}=l(),[c,u]=(0,X.useState)(`24h`),[d,f]=(0,X.useState)(a);(0,X.useEffect)(()=>{f(a)},[a]);let{data:m}=p({queryKey:[`settings`],queryFn:i.getSettings}),h=m?.time_format||`system`;(0,X.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let g=sa.find(e=>e.value===c)?.hours||24,{data:v,isLoading:y,error:b}=p({queryKey:[`printer-sensor-history`,n,g,o.join(`,`)],queryFn:()=>i.getPrinterSensorHistory(n,g,o),enabled:e,refetchInterval:6e4});if(!e)return null;let x=v?.series.find(e=>e.sensor_kind===d),S=(x?.data||[]).map(e=>({time:(qt(e.recorded_at)||new Date).getTime(),value:e.value,target:e.target})),C=Date.now()-g*60*60*1e3,w=Date.now(),T=[...S];if(T.length>0){let e=T[0];e.time>C&&T.unshift({...e,time:C});let t=T[T.length-1];t.time{let t=e.filter(e=>e!=null);if(t.length<4)return`stable`;let n=t.slice(0,Math.floor(t.length/4)),r=t.slice(-Math.floor(t.length/4)),i=n.reduce((e,t)=>e+t,0)/n.length,a=r.reduce((e,t)=>e+t,0)/r.length-i;return Math.abs(a)<2?`stable`:a>0?`up`:`down`})(T.map(e=>e.value)),M=({trend:e})=>e===`up`?(0,$.jsx)(_,{className:`w-4 h-4 text-red-600 dark:text-red-400`}):e===`down`?(0,$.jsx)(Ke,{className:`w-4 h-4 text-green-600 dark:text-green-400`}):(0,$.jsx)(G,{className:`w-4 h-4 text-gray-400 dark:text-bambu-gray`}),N=`var(--bg-secondary)`,P=`var(--bg-primary)`,F=`var(--border-color)`,I=`var(--text-primary)`,L=`var(--text-secondary)`,R=`var(--text-muted)`,ee=e=>{switch(e){case`nozzle`:return s(`printers.heaterHistory.nozzle`,`Nozzle`);case`nozzle_2`:return s(`printers.heaterHistory.nozzle2`,`Nozzle 2`);case`bed`:return s(`printers.heaterHistory.bed`,`Bed`);case`chamber`:return s(`printers.heaterHistory.chamber`,`Chamber`)}},te=({k:e})=>e===`nozzle`||e===`nozzle_2`?(0,$.jsx)(Bn,{className:`w-4 h-4`}):e===`bed`?(0,$.jsx)(fn,{className:`w-4 h-4`}):(0,$.jsx)(j,{className:`w-4 h-4`});return(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:t,children:(0,$.jsxs)(`div`,{className:`rounded-xl w-full max-w-4xl max-h-[90vh] overflow-hidden shadow-xl`,style:{backgroundColor:N},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b`,style:{borderColor:F},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-lg font-semibold`,style:{color:I},children:s(`printers.heaterHistory.title`,`Heater History`)}),(0,$.jsx)(`p`,{className:`text-sm`,style:{color:L},children:r})]}),(0,$.jsx)(`button`,{onClick:t,className:`p-2 rounded-lg transition-colors`,style:{color:L},"aria-label":s(`common.close`,`Close`),children:(0,$.jsx)(Pt,{className:`w-5 h-5`})})]}),(0,$.jsxs)(`div`,{className:`p-6 space-y-6 overflow-y-auto max-h-[calc(90vh-80px)]`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between max-[550px]:flex-col max-[550px]:items-start max-[550px]:gap-3`,children:[(0,$.jsx)(`div`,{className:`inline-flex gap-1 rounded-lg p-1 max-w-full flex-wrap w-fit`,style:{backgroundColor:P},children:o.map(e=>(0,$.jsxs)(`button`,{onClick:()=>f(e),className:`flex items-center gap-2 px-3 py-1.5 text-sm rounded-md transition-colors ${d===e?`text-white`:``}`,style:d===e?{backgroundColor:ca[e]}:{color:L},children:[(0,$.jsx)(te,{k:e}),ee(e)]},e))}),(0,$.jsx)(`div`,{className:`inline-flex gap-1 rounded-lg p-1 max-w-full flex-wrap w-fit`,style:{backgroundColor:P},children:sa.map(e=>(0,$.jsx)(`button`,{onClick:()=>u(e.value),className:`px-3 py-1 text-sm rounded-md transition-colors ${c===e.value?`bg-bambu-green text-white`:``}`,style:c===e.value?void 0:{color:L},children:e.label},e.value))})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-4 gap-4 max-[550px]:grid-cols-2`,children:[(0,$.jsxs)(`div`,{className:`rounded-lg p-4`,style:{backgroundColor:P},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:L},children:s(`common.current`,`Current`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:ca[d]},children:D==null?`—`:`${Math.round(D)}°C`}),(0,$.jsx)(M,{trend:A})]}),k!=null&&k>0&&(0,$.jsxs)(`p`,{className:`text-xs mt-1`,style:{color:L},children:[s(`common.target`,`Target`),`: `,Math.round(k),`°C`]})]}),(0,$.jsxs)(`div`,{className:`rounded-lg p-4`,style:{backgroundColor:P},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:L},children:s(`common.average`,`Average`)}),(0,$.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:I},children:x?.avg_value==null?`—`:`${x.avg_value}°C`})]}),(0,$.jsxs)(`div`,{className:`rounded-lg p-4`,style:{backgroundColor:P},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:L},children:s(`common.min`,`Min`)}),(0,$.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:I},children:x?.min_value==null?`—`:`${Math.round(x.min_value)}°C`})]}),(0,$.jsxs)(`div`,{className:`rounded-lg p-4`,style:{backgroundColor:P},children:[(0,$.jsx)(`p`,{className:`text-xs`,style:{color:L},children:s(`common.max`,`Max`)}),(0,$.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:I},children:x?.max_value==null?`—`:`${Math.round(x.max_value)}°C`})]})]}),(0,$.jsx)(`div`,{className:`rounded-lg p-4`,style:{backgroundColor:P},children:y?(0,$.jsx)(`div`,{className:`h-64 flex items-center justify-center`,style:{color:L},children:s(`common.loading`,`Loading...`)}):b?(0,$.jsx)(`div`,{className:`h-64 flex items-center justify-center text-red-700 dark:text-red-400`,children:s(`printers.heaterHistory.error`,`Failed to load history`)}):T.length===0?(0,$.jsx)(`div`,{className:`h-64 flex items-center justify-center`,style:{color:L},children:s(`printers.heaterHistory.empty`,`No data recorded yet`)}):(0,$.jsx)(Qe,{width:`100%`,height:300,children:(0,$.jsxs)(hi,{data:T,margin:{top:5,right:10,left:0,bottom:5},children:[(0,$.jsx)(gt,{strokeDasharray:`3 3`,stroke:F}),(0,$.jsx)(rt,{dataKey:`time`,type:`number`,domain:[C,w],tickFormatter:e=>new Date(e).toLocaleTimeString([],Gt({hour:`2-digit`,minute:`2-digit`},h)),stroke:R,fontSize:11}),(0,$.jsx)(vt,{stroke:R,fontSize:11,domain:[0,`auto`],tickFormatter:e=>`${Math.round(e)}°`}),(0,$.jsx)(Re,{contentStyle:{backgroundColor:N,border:`1px solid ${F}`,borderRadius:6,color:I},labelFormatter:e=>new Date(e).toLocaleString(void 0,Gt({month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`},h)),formatter:e=>e==null?`—`:`${Math.round(Number(e))}°C`}),(0,$.jsx)(O,{}),(0,$.jsx)(pi,{type:`monotone`,dataKey:`value`,name:s(`common.current`,`Current`),stroke:ca[d],strokeWidth:2,dot:!1,isAnimationActive:!1}),(0,$.jsx)(pi,{type:`stepAfter`,dataKey:`target`,name:s(`common.target`,`Target`),stroke:la[d],strokeDasharray:`4 4`,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})})]})]})})}function da({data:e,children:t,disabled:n,className:r=``,spoolman:i,inventory:a,configureSlot:o,actions:s}){let{t:c}=l(),u=Tn(),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(`top`),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null),T=()=>{let t=e.trayUuid;t&&(navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(t).then(()=>{v(!0),setTimeout(()=>v(!1),2e3)}).catch(()=>{E(t)}):E(t))},E=e=>{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();try{document.execCommand(`copy`),v(!0),setTimeout(()=>v(!1),2e3)}catch{console.error(`Failed to copy to clipboard`)}document.body.removeChild(t)};(0,X.useLayoutEffect)(()=>{if(!d){g(null);return}let e=()=>{if(!S.current||!C.current)return;let e=S.current.getBoundingClientRect(),t=C.current.offsetHeight,n=C.current.offsetWidth,r=e.top-56,i=window.innerHeight-e.bottom,a=rr?`bottom`:`top`,o=e.left+e.width/2,s=Math.max(8,Math.min(o-n/2,window.innerWidth-n-8)),c=a===`top`?e.top-t-8:e.bottom+8;m(a),g({top:c,left:s})};e();let t=requestAnimationFrame(e);return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{cancelAnimationFrame(t),window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[d]);let D=()=>{n||(w.current&&clearTimeout(w.current),w.current=setTimeout(()=>f(!0),80))},O=()=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>f(!1),100)},k=()=>{w.current&&clearTimeout(w.current),f(!1)};(0,X.useEffect)(()=>()=>{w.current&&clearTimeout(w.current)},[]);let A=e=>e<=15?`#ef4444`:e<=30?`#f97316`:e<=50?`#eab308`:`#22c55e`,j=e.colorHex?`#${e.colorHex.replace(`#`,``)}`:null,M=(a?.assignedSpool?.color_name_is_synthesized?void 0:qn(a?.assignedSpool?.color_name??null,null)?.trim())||e.colorName,N=a?.assignedSpool?qn(a.assignedSpool.color_name,a.assignedSpool.rgba??null,a.assignedSpool.color_name_is_synthesized):null,P=a?.assignedSpool?.remainingWeightGrams??null,I=a?.assignedSpool??null,L=Yt(I?.extra_colors),R=!!I?.effect_type,ee=!!I&&(L.length>0||R),te=ee?Jt({effectSize:`card`,rgba:I?.rgba??j,extraColors:I?.extra_colors,effectType:I?.effect_type,subtype:I?.subtype}):null,ne=L.length>1,re=ee?L.length===1?L[0]:I?.rgba??j:j;return(0,$.jsxs)(`div`,{ref:S,"data-testid":`filament-slot`,className:`relative ${r}`,onMouseEnter:D,onMouseLeave:O,children:[t,d&&(0,gi.createPortal)((0,$.jsxs)(`div`,{ref:C,className:`fixed z-[60]`,style:{top:h?.top??-9999,left:h?.left??-9999,maxWidth:`calc(100vw - 24px)`,visibility:h?`visible`:`hidden`},onMouseEnter:D,onMouseLeave:O,children:[(0,$.jsxs)(`div`,{className:` + w-52 bg-bambu-dark-secondary border border-bambu-dark-tertiary + rounded-lg shadow-xl overflow-hidden + backdrop-blur-sm + `,children:[(0,$.jsxs)(`div`,{className:`h-12 relative overflow-hidden`,style:te?{...te,backgroundColor:j||`#3d3d3d`}:{backgroundColor:j||`#3d3d3d`},children:[(0,$.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-b from-white/10 to-transparent`}),(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,$.jsx)(`span`,{className:ne?`px-2 py-0.5 rounded bg-black/60 text-white font-semibold text-sm tracking-wide`:`font-semibold text-sm tracking-wide ${nr(re)?`text-black/80`:`text-white/90`}`,children:M})}),(0,$.jsx)(`div`,{className:` + absolute top-1.5 right-1.5 px-1.5 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider + ${e.vendor===`Bambu Lab`?`bg-black/60 text-white`:`bg-black/50 text-white/90`} + `,children:e.vendor===`Bambu Lab`?`BBL`:`GEN`})]}),(0,$.jsxs)(`div`,{className:`p-3 space-y-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-bambu-gray font-medium`,children:c(`ams.profile`)}),(0,$.jsx)(`span`,{className:`text-xs text-white font-semibold truncate max-w-[120px]`,children:e.profile})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-bambu-gray font-medium`,children:c(`ams.kFactor`)}),(0,$.jsx)(`span`,{className:`text-xs text-bambu-green font-mono font-bold`,children:e.kFactor})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wider text-bambu-gray font-medium flex items-center gap-1`,children:[(0,$.jsx)(y,{className:`w-3 h-3`}),c(`ams.fill`)]}),(0,$.jsxs)(`span`,{className:`text-xs text-white font-semibold flex items-center gap-1`,children:[(0,$.jsx)(`span`,{children:e.fillLevel===null?`—`:`${e.fillLevel}%`}),P!==null&&e.fillLevel!==null&&(0,$.jsxs)(`span`,{className:`text-[9px] text-bambu-gray font-normal`,children:[`• `,P,`g`]})]})]}),(0,$.jsx)(`div`,{className:`h-1.5 bg-black/40 rounded-full overflow-hidden`,children:e.fillLevel===null?(0,$.jsx)(`div`,{className:`h-full w-full bg-bambu-gray/30 rounded-full`}):(0,$.jsx)(`div`,{className:`h-full rounded-full transition-all duration-300`,style:{width:`${e.fillLevel}%`,backgroundColor:A(e.fillLevel)}})})]}),i?.enabled&&(0,$.jsxs)(`div`,{className:`pt-2 mt-2 border-t border-bambu-dark-tertiary space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-bambu-gray font-medium`,children:c(`spoolman.spoolId`)}),e.trayUuid?(0,$.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),T()},className:`flex items-center gap-1 text-xs text-bambu-gray hover:text-white transition-colors`,title:`Copy spool UUID`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-[10px] truncate max-w-[80px]`,children:[e.trayUuid.slice(0,8),`...`]}),_?(0,$.jsx)(F,{className:`w-3 h-3 text-bambu-green`}):(0,$.jsx)(z,{className:`w-3 h-3`})]}):(0,$.jsx)(`span`,{className:`text-[10px] text-bambu-gray`,children:`—`})]}),i.linkedSpoolId&&(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),k(),u(`/inventory?spool=${i.linkedSpoolId}`)},className:`w-full flex items-center justify-start gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-green/20 hover:bg-bambu-green/40 text-bambu-green`,title:c(`inventory.openInInventory`),children:[(0,$.jsx)(De,{className:`w-3.5 h-3.5`}),c(`inventory.openInInventory`)]})})]}),a&&(0,$.jsx)(`div`,{className:`pt-2 mt-2 border-t border-bambu-dark-tertiary space-y-2`,children:a.assignedSpool?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(De,{className:`w-3 h-3 text-bambu-green`}),(0,$.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-bambu-gray font-medium`,children:c(`inventory.assigned`)})]}),(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5 min-w-0 mb-1`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-white truncate`,children:[a.assignedSpool.brand?`${a.assignedSpool.brand} `:``,a.assignedSpool.material,a.assignedSpool.subtype?` ${a.assignedSpool.subtype}`:``,N?` - ${N}`:``]}),(0,$.jsxs)(`span`,{className:`text-[10px] font-mono text-bambu-gray shrink-0`,children:[`#`,a.assignedSpool.id]})]}),(!i?.linkedSpoolId||a.assignedSpool.id!==i.linkedSpoolId)&&(0,$.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),k(),u(`/inventory?spool=${a.assignedSpool.id}`)},className:`w-full flex items-center justify-start gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-green/20 hover:bg-bambu-green/40 text-bambu-green`,title:c(`inventory.openInInventory`),children:[(0,$.jsx)(De,{className:`w-3.5 h-3.5`}),c(`inventory.openInInventory`)]}),a.onUnassignSpool&&(0,$.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),k(),a.onUnassignSpool?.()},className:`w-full flex items-center justify-start gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-red-100 dark:bg-red-500/20 hover:bg-red-200 dark:hover:bg-red-500/40 text-red-700 dark:text-red-400`,children:[(0,$.jsx)(kt,{className:`w-3.5 h-3.5`}),c(`inventory.unassignSpool`)]})]}):a.onAssignSpool?(0,$.jsxs)(`button`,{onClick:a.isAssigned?void 0:e=>{e.stopPropagation(),k(),a.onAssignSpool?.()},disabled:!!a.isAssigned,className:`w-full flex items-center justify-start gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-blue/20 text-bambu-blue ${a.isAssigned?`opacity-50 cursor-not-allowed`:`hover:bg-bambu-blue/40`}`,children:[(0,$.jsx)(De,{className:`w-3.5 h-3.5`}),c(`inventory.assignSpool`)]}):null}),o?.enabled&&(0,$.jsx)(`div`,{className:`${i?.enabled&&e.trayUuid?``:`pt-2 mt-2 border-t border-bambu-dark-tertiary`}`,children:(0,$.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),k(),o.onConfigure?.()},className:`w-full flex items-center justify-start gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-blue/20 hover:bg-bambu-blue/40 text-bambu-blue`,title:c(`ams.configureSlot`),children:[(0,$.jsx)(je,{className:`w-3.5 h-3.5`}),c(`ams.configure`)]})}),s&&(0,$.jsx)(`div`,{className:`pt-2 mt-2 border-t border-bambu-dark-tertiary space-y-1`,children:s})]})]}),(0,$.jsx)(`div`,{className:` + absolute left-1/2 -translate-x-1/2 w-0 h-0 + border-l-[6px] border-l-transparent + border-r-[6px] border-r-transparent + ${p===`top`?`top-full border-t-[6px] border-t-bambu-dark-tertiary`:`bottom-full border-b-[6px] border-b-bambu-dark-tertiary`} + `})]}),document.body),b&&(0,$.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center`,onClick:()=>x(!1),children:[(0,$.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`}),(0,$.jsx)(`div`,{className:`relative bg-bambu-dark-secondary rounded-lg shadow-xl w-full max-w-sm mx-4 border border-bambu-dark-tertiary`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold text-white`,children:c(`spoolman.unlinkConfirmTitle`)}),(0,$.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:c(`spoolman.unlinkConfirmMessage`)})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`button`,{onClick:()=>x(!1),className:`flex-1 px-3 py-2 text-sm font-medium rounded transition-colors bg-bambu-dark hover:bg-bambu-dark-tertiary text-white`,children:c(`common.cancel`)}),(0,$.jsx)(`button`,{onClick:()=>{i?.onUnlinkSpool?.(),x(!1)},className:`flex-1 px-3 py-2 text-sm font-medium rounded transition-colors bg-red-100 dark:bg-red-500/20 hover:bg-red-200 dark:hover:bg-red-500/40 text-red-700 dark:text-red-400`,children:c(`inventory.unassignSpool`)})]})]})})]})]})}function fa({children:e,className:t=``,configureSlot:n,onAssignSpool:r,actions:i,kind:a}){let{t:o}=l(),[s,c]=(0,X.useState)(!1),[u,d]=(0,X.useState)(null),f=(0,X.useRef)(null),p=(0,X.useRef)(null),m=(0,X.useRef)(null),h=()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>c(!0),80)},g=()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>c(!1),100)},_=()=>{m.current&&clearTimeout(m.current),c(!1)};return(0,X.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]),(0,X.useLayoutEffect)(()=>{if(!s){d(null);return}let e=()=>{if(!f.current||!p.current)return;let e=f.current.getBoundingClientRect(),t=p.current.offsetHeight,n=p.current.offsetWidth,r=e.left+e.width/2,i=Math.max(8,Math.min(r-n/2,window.innerWidth-n-8));d({top:e.top-t-8,left:i})};e();let t=requestAnimationFrame(e);return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{cancelAnimationFrame(t),window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[s]),(0,$.jsxs)(`div`,{ref:f,className:`relative ${t}`,onMouseEnter:h,onMouseLeave:g,children:[e,s&&(0,gi.createPortal)((0,$.jsxs)(`div`,{ref:p,className:`fixed z-[60]`,style:{top:u?.top??-9999,left:u?.left??-9999,visibility:u?`visible`:`hidden`},onMouseEnter:h,onMouseLeave:g,children:[(0,$.jsxs)(`div`,{className:` + bg-bambu-dark-secondary border border-bambu-dark-tertiary + rounded-md shadow-lg overflow-hidden + `,children:[(0,$.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-bambu-gray whitespace-nowrap`,children:o(a===`reset`?`ams.emptySlotReset`:`ams.emptySlot`)}),(n?.enabled||r||i)&&(0,$.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[r&&(0,$.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),_(),r()},className:`w-full flex items-center justify-start gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-blue/20 hover:bg-bambu-blue/40 text-bambu-blue`,children:[(0,$.jsx)(De,{className:`w-3.5 h-3.5`}),o(`inventory.assignSpool`)]}),n?.enabled&&(0,$.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),_(),n.onConfigure?.()},className:`w-full flex items-center justify-start gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-blue/20 hover:bg-bambu-blue/40 text-bambu-blue`,title:o(`ams.configureSlot`),children:[(0,$.jsx)(je,{className:`w-3.5 h-3.5`}),o(`ams.configure`)]}),i&&(0,$.jsx)(`div`,{className:`pt-1 mt-1 border-t border-bambu-dark-tertiary space-y-1`,children:i})]})]}),(0,$.jsx)(`div`,{className:` + absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 + border-l-[5px] border-l-transparent + border-r-[5px] border-r-transparent + border-t-[5px] border-t-bambu-dark-tertiary + `})]}),document.body)]})}function pa({className:e=`w-4 h-4`}){return(0,$.jsx)(`svg`,{viewBox:`0 0 1945 1370`,fill:`none`,className:e,"aria-hidden":`true`,children:(0,$.jsxs)(`g`,{transform:`translate(-754.293 -471.685)`,children:[(0,$.jsxs)(`g`,{transform:`translate(0.18191 255.976)`,children:[(0,$.jsx)(`g`,{transform:`matrix(1.05469 0 0 0.241063 -153.484 1120.2)`,children:(0,$.jsx)(`rect`,{x:`922.048`,y:`1195.15`,width:`1721.5`,height:`470.135`,stroke:`currentColor`,strokeOpacity:`0.99`,strokeWidth:`168.84`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,$.jsx)(`g`,{transform:`matrix(0.983656 0 0 1.0767 -62.2035 141.539)`,children:(0,$.jsx)(`path`,{d:`M2741.42,1175.93L895.832,1175.93L1125.16,621.902L2512.09,621.902L2741.42,1175.93Z`,fill:`currentColor`,fillOpacity:`0.05`,stroke:`currentColor`,strokeOpacity:`0.99`,strokeWidth:`125.26`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,$.jsx)(`g`,{transform:`translate(21.1916 0.684817)`,children:(0,$.jsx)(`path`,{d:`M1981.31,567.518C1954.86,567.518 1933.39,546.047 1933.39,519.601C1933.39,493.156 1954.86,471.685 1981.31,471.685L2146.61,471.685C2173.07,471.685 2194.53,493.138 2194.53,519.601L2194.53,688.741C2194.53,715.187 2173.05,736.658 2146.61,736.658C2120.16,736.658 2098.69,715.187 2098.69,688.741L2098.69,567.518L1981.31,567.518ZM2098.69,1252.54C2098.69,1226.1 2120.16,1204.62 2146.61,1204.62C2173.05,1204.62 2194.53,1226.1 2194.53,1252.54L2194.53,1421.68C2194.53,1448.14 2173.07,1469.6 2146.61,1469.6L1981.31,1469.6C1954.86,1469.6 1933.39,1448.13 1933.39,1421.68C1933.39,1395.24 1954.86,1373.76 1981.31,1373.76L2098.69,1373.76L2098.69,1252.54ZM1430.29,1373.76C1456.74,1373.76 1478.21,1395.24 1478.21,1421.68C1478.21,1448.13 1456.74,1469.6 1430.29,1469.6L1264.99,1469.6C1238.53,1469.6 1217.07,1448.14 1217.07,1421.68L1217.07,1252.54C1217.07,1226.1 1238.55,1204.62 1264.99,1204.62C1291.44,1204.62 1312.91,1226.1 1312.91,1252.54L1312.91,1373.76L1430.29,1373.76ZM1312.91,688.741C1312.91,715.187 1291.44,736.658 1264.99,736.658C1238.55,736.658 1217.07,715.187 1217.07,688.741L1217.07,519.601C1217.07,493.138 1238.53,471.685 1264.99,471.685L1430.29,471.685C1456.74,471.685 1478.21,493.156 1478.21,519.601C1478.21,546.047 1456.74,567.518 1430.29,567.518L1312.91,567.518L1312.91,688.741Z`,fill:`currentColor`,fillOpacity:`0.99`})})]})})}function ma({printer:e,status:t,totalPrintHours:n,onClose:r}){let{t:i}=l();(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=[];if(a.push({label:i(`printers.model`),value:e.model??`—`}),a.push({label:i(`common.status`),value:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium ${t?.connected?`bg-bambu-green/20 text-bambu-green`:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`}`,children:[(0,$.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${t?.connected?`bg-bambu-green`:`bg-red-400`}`}),t?.connected?i(`printers.status.available`):i(`printers.status.offline`)]})}),t?.state&&a.push({label:i(`printers.state`),value:i({IDLE:`printers.status.idle`,RUNNING:`printers.status.printing`,PAUSE:`printers.status.paused`,FINISH:`printers.status.finished`,FAILED:`printers.status.error`}[t.state]??`printers.status.unknown`)}),a.push({label:i(`printers.ipAddress`),value:(0,$.jsxs)(`span`,{className:`flex items-center`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.ip_address}),(0,$.jsx)(q,{value:e.ip_address})]})}),a.push({label:i(`printers.serialNumber`),value:(0,$.jsxs)(`span`,{className:`flex items-center`,children:[(0,$.jsx)(`span`,{className:`font-mono truncate`,children:e.serial_number}),(0,$.jsx)(q,{value:e.serial_number})]})}),t?.wired_network)a.push({label:i(`printers.networkLabel`,`Network`),value:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(M,{className:`w-4 h-4 text-bambu-green`}),(0,$.jsx)(`span`,{className:`text-bambu-green`,children:i(`printers.connection.ethernet`,`Ethernet`)})]})});else if(t?.wifi_signal!=null){let e=_n(t.wifi_signal);a.push({label:i(`printers.wifiSignalLabel`),value:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(kr,{className:`w-4 h-4 ${e.color}`}),(0,$.jsx)(`span`,{className:e.color,children:i(e.labelKey)}),(0,$.jsxs)(`span`,{className:`text-bambu-gray text-xs`,children:[`(`,t.wifi_signal,` dBm)`]})]})})}return a.push({label:i(`printers.firmware`),value:t?.firmware_version??`—`}),t?.developer_mode!=null&&a.push({label:i(`printers.developerMode`),value:(0,$.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${t.developer_mode?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:t.developer_mode?i(`printers.enabled`):i(`printers.disabled`)})}),a.push({label:i(`printers.nozzleCount`),value:e.nozzle_count}),a.push({label:i(`printers.autoArchive`),value:(0,$.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${e.auto_archive?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:e.auto_archive?i(`printers.enabled`):i(`printers.disabled`)})}),n!=null&&n>0&&a.push({label:i(`printers.totalPrintHours`),value:`${Math.round(n)}h`}),e.location&&a.push({label:i(`printers.sort.location`),value:e.location}),a.push({label:i(`printers.addedOn`),value:Ht(e.created_at)}),(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,role:`dialog`,"aria-modal":`true`,onClick:r,children:(0,$.jsx)(Rt,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(Lt,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e.name}),(0,$.jsx)(`button`,{onClick:r,className:`p-1 hover:bg-bambu-dark rounded flex-shrink-0`,children:(0,$.jsx)(Pt,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,$.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,$.jsx)(`img`,{src:tn(e.model),alt:e.model??e.name,className:`h-24 object-contain`})}),(0,$.jsx)(`div`,{className:`space-y-0`,children:a.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5 border-b border-bambu-dark-tertiary last:border-0`,children:[(0,$.jsx)(`span`,{className:`text-sm text-bambu-gray whitespace-nowrap`,children:e.label}),(0,$.jsx)(`span`,{className:`text-sm text-white text-right`,children:e.value})]},t))})]})})})}var ha=0,ga=1;function _a({slotLabel:e,amsId:t,slotId:n,extruderSlots:r,isLoading:i=!1,onConfirm:a,onCancel:o}){let{t:s}=l(),[c,u]=(0,X.useState)(null);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!i&&o()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o,i]);let d=e=>{let i=r[String(e)];return i?.ams_id===t&&i?.slot_id===n},f=[{extruderId:ga,label:s(`printers.ams.feedLeft`),taken:d(ga)},{extruderId:ha,label:s(`printers.ams.feedRight`),taken:d(ha)}],p=f.some(e=>e.extruderId===c&&e.taken);return(0,X.useEffect)(()=>{p&&u(null)},[p]),(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50`,onClick:i?void 0:o,children:(0,$.jsx)(Rt,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(Lt,{className:`p-6`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:s(`printers.ams.feedTitle`,{slot:e})}),(0,$.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:s(`printers.ams.feedPrompt`)}),(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-3 mt-4`,children:f.map(({extruderId:e,label:t,taken:n})=>{let r=c===e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>u(e),disabled:n||i,title:n?s(`printers.ams.feedAlreadyLoaded`):void 0,className:`p-3 rounded-lg border text-sm transition-colors ${n?`border-transparent bg-bambu-dark text-bambu-gray/50 cursor-not-allowed`:r?`border-bambu-green/50 bg-bambu-green/10 text-white`:`border-transparent bg-bambu-dark text-white hover:bg-bambu-dark-tertiary`}`,children:[(0,$.jsx)(`div`,{className:`font-medium`,children:t}),n&&(0,$.jsx)(`div`,{className:`text-xs mt-1`,children:s(`printers.ams.feedAlreadyLoaded`)})]},e)})}),(0,$.jsxs)(`div`,{className:`flex gap-3 mt-6`,children:[(0,$.jsx)(Y,{variant:`secondary`,onClick:o,className:`flex-1`,disabled:i,children:s(`common.cancel`)}),(0,$.jsx)(Y,{onClick:()=>c!==null&&a(c),className:`flex-1`,disabled:c===null||i,children:i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{className:`w-4 h-4 mr-2 animate-spin`}),s(`common.loading`)]}):s(`common.confirm`)})]})]})})})}function va(e){if(!e||e.length<6)return!1;let t=parseInt(e.slice(0,2),16),n=parseInt(e.slice(2,4),16),r=parseInt(e.slice(4,6),16);return(.299*t+.587*n+.114*r)/255>.6}function ya({trayColor:e,trayType:t,isEmpty:n,emptyKind:r,slotNumber:i}){let a=r===`reset`?`#3d3d3d`:`#666`;return(0,$.jsx)(`div`,{className:`w-3.5 h-3.5 rounded-full mx-auto mb-0.5 border-2 flex items-center justify-center`,style:{backgroundColor:e?`#${e}`:t?`#333`:`transparent`,borderColor:n?a:`rgba(255,255,255,0.1)`,borderStyle:n?`dashed`:`solid`},children:(0,$.jsx)(`span`,{className:`text-[6px] font-bold leading-none select-none`,style:{color:e&&va(e)?`#000`:`#fff`},children:i})})}var ba=240,xa=440,Sa=[30,60,120,240,480,720,1440],Ca=[`scheduled-dryings`],wa={ams_power_required:`printers.drying.powerRequired`,ams_retract_filament:`printers.drying.retractFilament`,ams_blocked:`printers.drying.cannotDryNow`,ams_not_found:`printers.drying.waitingAmsNotFound`,printer_offline:`printers.drying.waitingOffline`,printer_busy:`printers.drying.waitingPrinterBusy`,already_drying:`printers.drying.waitingAlreadyDrying`,interrupted:`printers.drying.waitingInterrupted`};function Ta(e){return e?wa[e]:void 0}var Ea={screen_only:`printers.drying.screenOnly`,unsupported:`printers.drying.notSupported`,did_not_start:`printers.drying.scheduleFailedDidNotStart`};function Da(e){return e?Ea[e]:void 0}function Oa(e){let t=(e??[]).map(e=>Number(e));return t.some(e=>e===1||e===8)?`printers.drying.powerRequired`:t.includes(3)?`printers.drying.retractFilament`:`printers.drying.cannotDryNow`}var ka=[{value:`all`,labelKey:`printers.filter.allStatuses`},{value:`printing`,labelKey:`printers.status.printing`},{value:`paused`,labelKey:`printers.status.paused`},{value:`idle`,labelKey:`printers.status.idle`},{value:`finished`,labelKey:`printers.status.finished`},{value:`error`,labelKey:`printers.status.error`},{value:`offline`,labelKey:`printers.status.offline`}];function Aa(e){return ka.some(t=>t.value===e)}function ja(e){return(e??.02).toFixed(3)}function Ma({k:e,reserve:t}){let{t:n}=l(),r=`text-[length:var(--pc-t8,8px)] text-bambu-gray tabular-nums leading-none truncate`;return e?(0,$.jsxs)(`div`,{className:r,title:n(`ams.kFactor`),children:[n(`ams.kFactorShort`),` `,ja(e)]}):t?(0,$.jsx)(`div`,{className:r,"aria-hidden":`true`,children:`\xA0`}):null}function Na({side:e}){let{mode:t}=ir(),{t:n}=l();return(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] text-[length:var(--pc-t10,10px)] font-bold rounded`,style:{backgroundColor:t===`dark`?`#1a4d2e`:`#e7f5e9`,color:`#00ae42`},title:n(e===`L`?`common.left`:`common.right`),children:e})}function Pa({inlet:e,title:t}){let{mode:n}=ir();return(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] text-[length:var(--pc-t10,10px)] font-bold rounded`,style:{backgroundColor:n===`dark`?`#1e3a5f`:`#e3f0fb`,color:`#3b82f6`},title:t,children:ur[e]})}function Fa(e,t,n,r){let i=n[String(e)];if(i)return{kind:`inlet`,inlet:i};let a=t[String(e)],o=a===void 0?r?void 0:e>=128?e-128:e:a;return o===1?{kind:`nozzle`,side:`L`}:o===0?{kind:`nozzle`,side:`R`}:null}function Ia(e,t){if(!e)return``;if(e.includes(`hardened`))return t(`printers.nozzleHardenedSteel`);if(e.includes(`stainless`))return t(`printers.nozzleStainlessSteel`);if(e.includes(`tungsten`))return t(`printers.nozzleTungstenCarbide`);if(e.length>=4){let n=e.slice(2,4);if(n===`00`)return t(`printers.nozzleStainlessSteel`);if(n===`01`)return t(`printers.nozzleHardenedSteel`);if(n===`05`)return t(`printers.nozzleTungstenCarbide`)}return e===`00`?t(`printers.nozzleStainlessSteel`):e===`01`?t(`printers.nozzleHardenedSteel`):e===`05`?t(`printers.nozzleTungstenCarbide`):e.startsWith(`H`)?t(`printers.nozzleHardenedSteel`):e}function La(e,t){return e?e.startsWith(`HH`)?t(`printers.nozzleHighFlow`):e.startsWith(`HS`)?t(`printers.nozzleStandardFlow`):``:``}function Ra({slot:e,index:t,activeStatus:n,filamentName:r,children:i}){let{t:a}=l(),[o,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(`top`),d=(0,X.useRef)(null),f=(0,X.useRef)(null),p=(0,X.useRef)(null),m=!e.nozzle_diameter&&!e.nozzle_type,h=e.stat===1;(0,X.useEffect)(()=>{if(o&&d.current&&f.current){let e=d.current.getBoundingClientRect(),t=f.current.offsetHeight,n=e.top-56,r=window.innerHeight-e.bottom;nn?u(`bottom`):u(`top`)}},[o]);let g=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>s(!0),80)},_=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>s(!1),100)};(0,X.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]);let v=Wn(e.filament_color),y=Ia(e.nozzle_type,a),b=La(e.nozzle_type,a);return(0,$.jsxs)(`div`,{ref:d,className:`relative`,onMouseEnter:g,onMouseLeave:_,children:[i,o&&(0,$.jsxs)(`div`,{ref:f,className:` + absolute left-1/2 -translate-x-1/2 z-50 + ${c===`top`?`bottom-full mb-2`:`top-full mt-2`} + animate-in fade-in-0 zoom-in-95 duration-150 + `,style:{maxWidth:`calc(100vw - 24px)`},children:[(0,$.jsx)(`div`,{className:`w-44 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl overflow-hidden backdrop-blur-sm`,children:m?(0,$.jsxs)(`div`,{className:`px-3 py-2 text-xs text-bambu-gray text-center whitespace-nowrap`,children:[`Slot `,t+1,` — Empty`]}):(0,$.jsxs)(`div`,{className:`p-2.5 space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:a(`printers.nozzleDiameter`)}),(0,$.jsxs)(`span`,{className:`text-xs text-white font-semibold`,children:[e.nozzle_diameter,` mm`]})]}),y&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:a(`printers.nozzleType`)}),(0,$.jsx)(`span`,{className:`text-xs text-white font-semibold truncate max-w-[100px]`,children:y})]}),b&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:a(`printers.nozzleFlow`)}),(0,$.jsx)(`span`,{className:`text-xs text-white font-semibold`,children:b})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:a(`printers.nozzleStatus`)}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] font-bold px-1.5 py-0.5 rounded ${n||h?`bg-green-900/50 text-green-400`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:a(n?`printers.nozzleActive`:h?`printers.nozzleMounted`:`printers.nozzleDocked`)})]}),e.wear!=null&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:a(`printers.nozzleWear`)}),(0,$.jsxs)(`span`,{className:`text-xs text-white font-semibold`,children:[e.wear,`%`]})]}),e.max_temp>0&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:a(`printers.nozzleMaxTemp`)}),(0,$.jsxs)(`span`,{className:`text-xs text-white font-semibold`,children:[e.max_temp,`°C`]})]}),e.serial_number&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:a(`printers.nozzleSerial`)}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-white font-mono truncate max-w-[80px]`,children:e.serial_number})]}),(v||e.filament_type)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:a(`printers.nozzleFilament`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v&&(0,$.jsx)(`div`,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] rounded-sm border border-white/20`,style:{backgroundColor:v}}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-white font-semibold truncate max-w-[100px]`,children:r||e.filament_type||e.filament_id||``})]})]})]})}),(0,$.jsx)(`div`,{className:` + absolute left-1/2 -translate-x-1/2 w-0 h-0 + border-l-[6px] border-l-transparent + border-r-[6px] border-r-transparent + ${c===`top`?`top-full border-t-[6px] border-t-bambu-dark-tertiary`:`bottom-full border-b-[6px] border-b-bambu-dark-tertiary`} + `})]})]})}function za({leftSlot:e,rightSlot:t,activeNozzle:n,filamentInfo:r,children:i}){let{t:a}=l(),[o,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(`top`),d=(0,X.useRef)(null),f=(0,X.useRef)(null),p=(0,X.useRef)(null);(0,X.useEffect)(()=>{if(o&&d.current&&f.current){let e=d.current.getBoundingClientRect(),t=f.current.offsetHeight,n=e.top-56,r=window.innerHeight-e.bottom;nn?u(`bottom`):u(`top`)}},[o]);let m=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>s(!0),80)},h=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>s(!1),100)};if((0,X.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),!e&&!t)return(0,$.jsx)($.Fragment,{children:i});let g=(e,t)=>{let i=n===t,o=Ia(e.nozzle_type,a),s=La(e.nozzle_type,a),c=Wn(e.filament_color),l=e.filament_id?r?.[e.filament_id]?.name:void 0;return(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(`div`,{className:`text-[length:var(--pc-t10,10px)] font-bold pb-1 border-b border-bambu-dark-tertiary/50 ${i?`text-amber-700 dark:text-amber-400`:`text-bambu-gray`}`,children:a(t===`L`?`common.left`:`common.right`)}),e.nozzle_diameter&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:a(`printers.nozzleDiameter`)}),(0,$.jsxs)(`span`,{className:`text-xs text-white font-semibold`,children:[e.nozzle_diameter,` mm`]})]}),o&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:a(`printers.nozzleType`)}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-white font-semibold`,children:o})]}),s&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:a(`printers.nozzleFlow`)}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-white font-semibold`,children:s})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:a(`printers.nozzleStatus`)}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] font-bold px-1.5 py-0.5 rounded ${i?`bg-green-900/50 text-green-400`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:a(i?`printers.nozzleActive`:`printers.nozzleIdle`)})]}),e.wear!=null&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:a(`printers.nozzleWear`)}),(0,$.jsxs)(`span`,{className:`text-xs text-white font-semibold`,children:[e.wear,`%`]})]}),t===`R`&&e.max_temp>0&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:a(`printers.nozzleMaxTemp`)}),(0,$.jsxs)(`span`,{className:`text-xs text-white font-semibold`,children:[e.max_temp,`°C`]})]}),t===`R`&&e.serial_number&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:a(`printers.nozzleSerial`)}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-white font-mono`,children:e.serial_number})]}),(c||e.filament_type||e.filament_id)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:a(`printers.nozzleFilament`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c&&(0,$.jsx)(`div`,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] rounded-sm border border-white/20`,style:{backgroundColor:c}}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-white font-semibold truncate max-w-[100px]`,children:l||e.filament_type||e.filament_id||``})]})]})]})};return(0,$.jsxs)(`div`,{ref:d,className:`relative flex-1`,onMouseEnter:m,onMouseLeave:h,children:[i,o&&(0,$.jsxs)(`div`,{ref:f,className:` + absolute left-1/2 -translate-x-1/2 z-50 + ${c===`top`?`bottom-full mb-2`:`top-full mt-2`} + animate-in fade-in-0 zoom-in-95 duration-150 + `,style:{maxWidth:`calc(100vw - 24px)`},children:[(0,$.jsx)(`div`,{className:`w-96 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl overflow-hidden backdrop-blur-sm`,children:(0,$.jsxs)(`div`,{className:`p-2.5 flex gap-3`,children:[e&&g(e,`L`),e&&t&&(0,$.jsx)(`div`,{className:`w-px bg-bambu-dark-tertiary/50`}),t&&g(t,`R`)]})}),(0,$.jsx)(`div`,{className:` + absolute left-1/2 -translate-x-1/2 w-0 h-0 + border-l-[6px] border-l-transparent + border-r-[6px] border-r-transparent + ${c===`top`?`top-full border-t-[6px] border-t-bambu-dark-tertiary`:`bottom-full border-b-[6px] border-b-bambu-dark-tertiary`} + `})]})]})}function Ba({slots:e,filamentInfo:t}){let{t:n}=l(),r=e.filter(e=>e.id>=2),i=Array.from({length:6},(e,t)=>r.find(e=>e.id===16+t)??{id:-(t+1),nozzle_type:``,nozzle_diameter:``,wear:null,stat:null,max_temp:0,serial_number:``,filament_color:``,filament_id:``,filament_type:``});return(0,$.jsxs)(`div`,{className:`text-center px-2.5 py-1.5 bg-bambu-dark rounded-lg flex-[0_1_auto] flex flex-col justify-center`,children:[(0,$.jsx)(`p`,{className:`text-[length:var(--pc-t9,9px)] text-bambu-gray mb-1`,children:n(`printers.nozzleRack`)}),(0,$.jsx)(`div`,{className:`flex gap-[3px] justify-center`,children:i.map((e,n)=>{let r=!e.nozzle_diameter&&!e.nozzle_type,i=r?null:Wn(e.filament_color),a=i?nr(e.filament_color):!1;return(0,$.jsx)(Ra,{slot:e,index:n,filamentName:e.filament_id?t?.[e.filament_id]?.name:void 0,children:(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5`,children:[(0,$.jsx)(`div`,{className:`w-[var(--pc-i7,28px)] h-[var(--pc-i7,28px)] rounded flex items-center justify-center cursor-default transition-colors border-b-2 ${r?`bg-bambu-dark-tertiary/20 border-bambu-dark-tertiary/20`:`bg-bambu-dark-tertiary/40 border-bambu-dark-tertiary/40`}`,style:i?{backgroundColor:i}:void 0,children:(0,$.jsx)(`span`,{"data-rack-diameter":!0,className:`text-[length:var(--pc-t10,10px)] font-semibold ${r?`text-bambu-gray/30`:a?`text-black/80`:`text-white`}`,style:i&&!a?{textShadow:`0 1px 3px rgba(0,0,0,0.9)`}:void 0,children:r?`—`:e.nozzle_diameter||`?`})}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t8,8px)] leading-none tabular-nums text-bambu-gray/70`,children:n+1})]})},e.id>=0?e.id:`empty-${n}`)})})]})}function Va({className:e}){return(0,$.jsx)(`svg`,{className:e,viewBox:`0 0 36 54`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,$.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 Ha({className:e}){return(0,$.jsxs)(`svg`,{className:e,viewBox:`0 0 35 53`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,$.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,$.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 Ua({className:e}){return(0,$.jsxs)(`svg`,{className:e,viewBox:`0 0 36 54`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,$.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,$.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 Wa({className:e}){return(0,$.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,$.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,$.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2.5`,stroke:`#C3C2C1`,strokeWidth:`1`,fill:`none`})]})}function Ga({className:e}){return(0,$.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,$.jsx)(`rect`,{x:`4.5`,y:`8`,width:`3`,height:`4.5`,fill:`#d4a017`,rx:`0.5`}),(0,$.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2`,fill:`#d4a017`}),(0,$.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 Ka({className:e}){return(0,$.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,$.jsx)(`rect`,{x:`4.5`,y:`3`,width:`3`,height:`9.5`,fill:`#c62828`,rx:`0.5`}),(0,$.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2`,fill:`#c62828`}),(0,$.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 qa({className:e}){return(0,$.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,$.jsx)(`rect`,{x:`9.2`,y:`3.4`,width:`5.6`,height:`8.1`}),(0,$.jsx)(`rect`,{x:`6`,y:`11.5`,width:`12.1`,height:`3.7`}),(0,$.jsx)(`path`,{d:`M 7.3 15.2 L 12.1 19.6 L 16.7 15.2`})]})}function Ja({className:e,color:t,isHeating:n}){let r={"text-orange-400":`#fb923c`,"text-blue-400":`#60a5fa`,"text-green-400":`#4ade80`}[t]||`#888`,i=n?{filter:`drop-shadow(0 0 4px ${r}) drop-shadow(0 0 8px ${r})`}:{};return n?(0,$.jsxs)(`svg`,{className:e,style:i,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,$.jsx)(`rect`,{x:`4.5`,y:`3`,width:`3`,height:`9.5`,fill:r,rx:`0.5`}),(0,$.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2`,fill:r}),(0,$.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:r,strokeWidth:`1`,fill:`none`})]}):(0,$.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,$.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:r,strokeWidth:`1`,fill:`none`}),(0,$.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2.5`,stroke:r,strokeWidth:`1`,fill:`none`})]})}function Ya({state:e,onClick:t}){let{t:n}=l(),r=e!==null,i=`flex items-center justify-center w-[18px] h-[18px] rounded text-[length:var(--pc-t10,10px)] transition-colors `,a;return e===!0?(i+=r?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 hover:bg-blue-500/30 cursor-pointer`:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 cursor-default`,a=n(`printers.amsBackup.titleOn`)):e===!1?(i+=r?`bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark/80 cursor-pointer`:`bg-bambu-dark text-bambu-gray cursor-default`,a=n(`printers.amsBackup.titleOff`)):(i+=`bg-bambu-dark text-bambu-gray/50 cursor-default`,a=n(`printers.amsBackup.titleUnknown`)),(0,$.jsx)(`button`,{type:`button`,disabled:!r,onClick:()=>r&&t(),className:i,title:a,"aria-label":a,children:r?(0,$.jsx)(Or,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}):(0,$.jsx)(`span`,{children:`?`})})}function Xa({hidden:e,onClick:t}){let{t:n}=l(),r=n(e?`printers.externalSpool.show`:`printers.externalSpool.hide`);return(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-pressed":e,className:`flex items-center justify-center w-[18px] h-[18px] rounded transition-colors cursor-pointer ${e?`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30`:`bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark/80`}`,title:r,"aria-label":r,children:e?(0,$.jsx)(B,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}):(0,$.jsx)(Sn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})}function Za({humidity:e,goodThreshold:t=40,fairThreshold:n=60,onClick:r,compact:i}){let a=typeof e==`string`?parseInt(e,10):e,o=typeof t==`number`?t:40,s=typeof n==`number`?n:60,c,l;isNaN(a)?(c=`#C3C2C1`,l=`Unknown`):a<=o?(c=`#22a352`,l=`Good`):a<=s?(c=`#d4a017`,l=`Fair`):(c=`#c62828`,l=`Bad`);let u;return u=isNaN(a)||a<=o?Va:a<=s?Ha:Ua,(0,$.jsxs)(`button`,{type:`button`,onClick:r,className:`flex items-center gap-1 ${r?`cursor-pointer hover:opacity-80 transition-opacity`:``}`,title:`Humidity: ${a}% - ${l}${r?` (click for history)`:``}`,children:[(0,$.jsx)(u,{className:i?`w-2.5 h-3`:`w-3 h-4`}),(0,$.jsxs)(`span`,{className:`font-medium tabular-nums ${i?`text-[length:var(--pc-t10,10px)]`:`text-xs`}`,style:{color:c},children:[a,`%`]})]})}function Qa({temp:e,goodThreshold:t=28,fairThreshold:n=35,onClick:r,compact:i}){let a=typeof t==`number`?t:28,o=typeof n==`number`?n:35,s,c,l;return e<=a?(s=`#22a352`,c=`Good`,l=Wa):e<=o?(s=`#d4a017`,c=`Fair`,l=Ga):(s=`#c62828`,c=`Bad`,l=Ka),(0,$.jsxs)(`button`,{type:`button`,onClick:r,className:`flex items-center gap-1 ${r?`cursor-pointer hover:opacity-80 transition-opacity`:``}`,title:`Temperature: ${e}°C - ${c}${r?` (click for history)`:``}`,children:[(0,$.jsx)(l,{className:i?`w-2.5 h-3`:`w-3 h-4`}),(0,$.jsxs)(`span`,{className:`tabular-nums text-right ${i?`text-[length:var(--pc-t10,10px)] w-8`:`w-12`}`,style:{color:s},children:[e,`°C`]})]})}var $a=3e4;function eo({url:e,printName:t,className:n=`w-20 h-20`,radiusClass:r=`rounded-lg`}){let{t:i}=l(),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),p=(0,X.useRef)(null),m=(0,X.useMemo)(()=>e?u(`${e}${e.includes(`?`)?`&`:`?`}v=${encodeURIComponent(t||Date.now().toString())}`):null,[e,t]);return(0,X.useEffect)(()=>{c(!1);let e=p.current;o(!!(e?.complete&&e.naturalWidth>0))},[m]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`${n} flex-shrink-0 ${r} overflow-hidden bg-bambu-dark-tertiary flex items-center justify-center ${m&&a?`cursor-pointer`:``}`,onClick:()=>m&&a&&f(!0),children:m&&!s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`img`,{ref:p,src:m,alt:i(`printers.printPreview`),className:`w-full h-full object-cover ${a?`block`:`hidden`}`,onLoad:()=>o(!0),onError:()=>c(!0)}),!a&&(0,$.jsx)(j,{className:`w-8 h-8 text-bambu-gray`})]}):(0,$.jsx)(j,{className:`w-8 h-8 text-bambu-gray`})}),d&&m&&(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-8`,onClick:()=>f(!1),children:(0,$.jsxs)(`div`,{className:`relative max-w-2xl max-h-full`,children:[(0,$.jsx)(`img`,{src:m,alt:i(`printers.printPreview`),className:`max-w-full max-h-[80vh] rounded-lg shadow-2xl`}),t&&(0,$.jsx)(`p`,{className:`text-white text-center mt-4 text-lg`,children:t})]})})]})}function to({printers:e}){let{t}=l(),n=f(),[r,i]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=!1,t=n.getQueryCache().subscribe(()=>{e||(e=!0,requestAnimationFrame(()=>{i(e=>e+1),e=!1}))});return()=>t()},[n]);let{counts:a,nextFinish:o}=(0,X.useMemo)(()=>{let t=0,r=0,i=0,a=0,o=0,s=0,c=0,l=null,u=null,d=0;return e?.forEach(e=>{let f=n.getQueryData([`printerStatus`,e.id]);if(f===void 0)s++;else if(!f.connected)o++;else{let n=f.hms_errors?Mt(f.hms_errors).length:0;switch(n>0&&c++,f.state){case`RUNNING`:t++,f.remaining_time!=null&&f.remaining_time>0&&(u===null||f.remaining_time0||i++;break;default:a++;break}}}),{counts:{printing:t,paused:r,finished:i,idle:a,offline:o,loading:s,error:c,total:e?.length||0},nextFinish:l&&u?{name:l,remainingMin:u,progress:d}:null}},[e,n,r]);return e?.length?(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-4 gap-y-2 text-bambu-gray`,children:[[{count:a.printing,dot:`bg-bambu-green animate-pulse`,label:t(`printers.status.printing`).toLowerCase()},{count:a.paused,dot:`bg-status-warning`,label:t(`printers.status.paused`,`paused`).toLowerCase()},{count:a.finished,dot:`bg-blue-400`,label:t(`printers.status.finished`,`finished`).toLowerCase()},{count:a.idle,dot:a.idle>0?`bg-bambu-green`:`bg-gray-500`,label:t(`printers.status.available`).toLowerCase()},{count:a.error,dot:`bg-status-error`,label:t(`printers.status.problem`).toLowerCase()},{count:a.offline,dot:`bg-gray-400`,label:t(`printers.status.offline`).toLowerCase()}].map(({count:e,dot:t,label:n})=>e>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`div`,{className:`w-2 h-2 rounded-full ${t}`}),(0,$.jsxs)(`span`,{className:`text-bambu-gray`,children:[(0,$.jsx)(`span`,{className:`text-white font-medium`,children:e}),` `,n]})]},n)),o&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`w-px h-4 bg-bambu-dark-tertiary`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-bambu-green font-medium`,children:[t(`printers.nextAvailable`),`:`]}),(0,$.jsx)(`span`,{className:`text-white font-medium`,children:o.name})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 w-full sm:w-auto`,children:[(0,$.jsx)(`div`,{className:`w-full sm:w-16 bg-bambu-dark-tertiary rounded-full h-1.5`,children:(0,$.jsx)(`div`,{className:`bg-bambu-green h-1.5 rounded-full transition-all`,style:{width:`${o.progress}%`}})}),(0,$.jsxs)(`span`,{className:`text-white font-medium`,children:[Math.round(o.progress),`%`]}),(0,$.jsxs)(`span`,{className:`text-bambu-gray`,children:[`(`,Ut(o.remainingMin*60),`)`]})]})]})]})]}):null}function no({value:e,options:t,onChange:n,fullWidth:r=!1}){let[i,a]=(0,X.useState)(!1),o=t.find(t=>t.value===e)??t[0];return(0,$.jsxs)(`div`,{className:`relative ${r?`w-full min-w-0`:``}`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`h-8 px-2 rounded-lg border bg-bambu-dark border-bambu-dark-tertiary text-white text-sm font-medium transition-colors hover:bg-bambu-dark-tertiary focus:outline-none focus:border-bambu-green flex items-center justify-between gap-2 ${r?`w-full`:`min-w-28`}`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:o?.label}),(0,$.jsx)(I,{className:`w-4 h-4 text-bambu-gray transition-transform ${i?`rotate-180`:``}`})]}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>a(!1)}),(0,$.jsx)(`div`,{className:`absolute left-0 top-full z-20 mt-1 min-w-full rounded-lg border border-bambu-dark-tertiary bg-bambu-dark-secondary py-1 shadow-xl`,children:t.map(t=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>{n(t.value),a(!1)},className:`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-bambu-dark-tertiary ${t.value===e?`text-bambu-green`:`text-white`}`,children:t.label},t.value))})]})]})}function ro({label:e,icon:t,children:n}){let[r,i]=(0,X.useState)(!1);return(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`h-8 w-8 rounded-lg border bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center justify-center`,"aria-label":e,title:e,children:t}),r&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>i(!1)}),(0,$.jsx)(`div`,{className:`absolute right-0 top-full z-20 mt-1 min-w-40 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark-secondary p-2 shadow-xl`,children:n})]})]})}function io({title:e,options:t=[],unit:n,customMin:r,customMax:i,customStep:a=1,widthClass:o=`w-[240px]`,popoverWidth:s=240,popoverHeight:c=280,isPending:l,onClose:u,onSubmit:d,children:f}){let p=(0,X.useRef)(null),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(``);(0,X.useLayoutEffect)(()=>{let e=p.current?.parentElement;if(!e)return;let t=()=>{h(xi({triggerRect:e.getBoundingClientRect(),popoverWidth:s,estimatedHeight:c,horizontalAlign:`center`}))};return t(),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0)}},[s,c]);let v=n!==void 0,y=()=>{let e=Number(g);Number.isFinite(e)&&d?.(Math.round(Math.min(i??e,Math.max(r??e,e))))};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{ref:p,className:`hidden`,"aria-hidden":`true`}),(0,gi.createPortal)((0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-[1000]`,onClick:u}),(0,$.jsxs)(`div`,{className:`fixed z-[1001] flex ${o} flex-col overflow-hidden rounded-xl border border-bambu-dark-tertiary bg-bambu-dark-secondary shadow-2xl`,style:{top:m?.top??-9999,left:m?.left??-9999,visibility:m?`visible`:`hidden`},onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`div`,{className:`shrink-0 px-3 py-2.5 text-center text-sm font-medium text-white`,children:e}),(0,$.jsx)(`div`,{className:`shrink-0 h-px bg-bambu-dark-tertiary`}),t.length>0&&(0,$.jsx)(`div`,{className:`px-3 py-2.5`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:t.map(e=>(0,$.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>d?.(e.value),className:`h-8 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark px-2 text-xs font-medium text-white transition-colors hover:bg-bambu-dark-tertiary disabled:cursor-not-allowed disabled:opacity-50`,children:e.label},`${e.label}-${e.value}`))})}),f,v&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`shrink-0 h-px bg-bambu-dark-tertiary`}),(0,$.jsxs)(`form`,{className:`flex gap-1.5 px-3 pt-2.5 pb-3`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,$.jsx)(`input`,{type:`number`,min:r,max:i,step:a,value:g,onChange:e=>_(e.target.value),placeholder:`Custom`,className:`h-8 min-w-0 flex-1 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark px-2 text-xs text-white placeholder:text-bambu-gray/60 focus:border-bambu-green focus:outline-none`}),(0,$.jsx)(`button`,{type:`submit`,disabled:l||g.trim()===``,className:`h-8 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark px-2 text-xs font-medium text-white transition-colors hover:bg-bambu-dark-tertiary disabled:cursor-not-allowed disabled:opacity-50`,children:`Set`})]})]})]})]}),document.body)]})}var ao=Te(be,`C`);function oo({label:e,current:t,target:n,isActive:r,isPending:i,onSubmit:a,options:o=ao}){let[s,c]=(0,X.useState)(``),l=()=>{let e=Number(s);Number.isFinite(e)&&a(Math.min(320,Math.max(0,Math.round(e))))};return(0,$.jsxs)(`div`,{className:`rounded-lg border p-2 ${r?`border-amber-500/60 dark:border-amber-400/60 bg-amber-50 dark:bg-amber-400/10`:`border-bambu-dark-tertiary bg-bambu-dark`}`,children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium ${r?`text-amber-700 dark:text-amber-300`:`text-white`}`,children:e}),(0,$.jsxs)(`span`,{className:`text-[10px] text-bambu-gray`,children:[Math.round(t??0),`°C`,n===void 0?``:` / ${Math.round(n)}°`]})]}),(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:o.map(t=>(0,$.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>a(t.value),className:`h-7 rounded-md border border-bambu-dark-tertiary bg-bambu-dark-secondary px-1.5 text-[11px] font-medium text-white transition-colors hover:bg-bambu-dark-tertiary disabled:cursor-not-allowed disabled:opacity-50`,children:t.label},`${e}-${t.value}`))}),(0,$.jsxs)(`form`,{className:`mt-1.5 flex gap-1`,onSubmit:e=>{e.preventDefault(),l()},children:[(0,$.jsx)(`input`,{type:`number`,min:0,max:320,step:1,value:s,onChange:e=>c(e.target.value),placeholder:`Custom`,className:`h-7 min-w-0 flex-1 rounded-md border border-bambu-dark-tertiary bg-bambu-dark-secondary px-1.5 text-[11px] text-white placeholder:text-bambu-gray/60 focus:border-bambu-green focus:outline-none`}),(0,$.jsx)(`button`,{type:`submit`,disabled:i||s.trim()===``,className:`h-7 rounded-md border border-bambu-dark-tertiary bg-bambu-dark-secondary px-2 text-[11px] font-medium text-white transition-colors hover:bg-bambu-dark-tertiary disabled:cursor-not-allowed disabled:opacity-50`,children:`Set`})]})]})}var so=[`error`,`printing`,`paused`,`finished`,`idle`,`offline`],co={error:{labelKey:`printers.status.problem`,dot:`bg-status-error`},printing:{labelKey:`printers.status.printing`,dot:`bg-bambu-green animate-pulse`},paused:{labelKey:`printers.status.paused`,dot:`bg-status-warning`},finished:{labelKey:`printers.status.finished`,dot:`bg-blue-400`},idle:{labelKey:`printers.status.idle`,dot:`bg-bambu-green`},offline:{labelKey:`printers.status.offline`,dot:`bg-gray-400`}};function lo(e){if(!e?.connected)return`offline`;if((e.hms_errors?Mt(e.hms_errors):[]).length>0)return`error`;switch(e.state){case`RUNNING`:return`printing`;case`PAUSE`:return`paused`;case`FINISH`:return`finished`;case`FAILED`:return`finished`;default:return`idle`}}function uo(e,t){if(t)return t;switch(e){case`RUNNING`:return`Printing`;case`PAUSE`:return`Paused`;case`FINISH`:return`Finished`;case`FAILED`:return`Failed`;case`IDLE`:return`Idle`;default:return e?e.charAt(0)+e.slice(1).toLowerCase():`Idle`}}var fo=new Set([`X1C`,`X1`,`X1E`,`X2D`,`P1S`,`P2S`,`H2D`,`H2D Pro`,`H2C`,`H2S`]),po=new Set([`P2S`,`X2D`]);function mo({ams:e,printerId:t,label:n,amsLabels:r,canEdit:a,onSaved:o,children:s}){let{t:c}=l(),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(`top`),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(!1),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null);(0,X.useEffect)(()=>{u&&(h(r?.[e.id]??``),y(null),requestAnimationFrame(()=>{if(S.current&&C.current){let e=S.current.getBoundingClientRect(),t=e.top-56,n=window.innerHeight-e.bottom;p(tt?`bottom`:`top`)}}))},[u,r,e.id]);let T=()=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>d(!0),80)},E=()=>{w.current&&clearTimeout(w.current),b||(w.current=setTimeout(()=>d(!1),200))};(0,X.useEffect)(()=>()=>{w.current&&clearTimeout(w.current)},[]);let D=async()=>{if(a){_(!0),y(null);try{let n=m.trim();n?await i.saveAmsLabel(t,e.id,n,e.serial_number):await i.deleteAmsLabel(t,e.id,e.serial_number),o(),d(!1)}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}};return(0,$.jsxs)(`div`,{ref:S,className:`relative inline-block`,onMouseEnter:T,onMouseLeave:E,children:[s,u&&(0,$.jsx)(`div`,{ref:C,className:` + absolute left-0 z-50 + ${f===`top`?`bottom-full mb-2`:`top-full mt-2`} + animate-in fade-in-0 zoom-in-95 duration-150 + `,style:{maxWidth:`calc(100vw - 24px)`},onMouseEnter:T,onMouseLeave:E,children:(0,$.jsxs)(`div`,{className:`w-52 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl overflow-hidden backdrop-blur-sm p-2.5 space-y-2`,children:[(0,$.jsx)(`div`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:n}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] tracking-wide text-bambu-gray font-medium shrink-0`,children:c(`printers.amsPopup.serialNumber`)}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-white font-mono truncate`,children:e.serial_number||`—`})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] tracking-wide text-bambu-gray font-medium shrink-0`,children:c(`printers.amsPopup.firmwareVersion`)}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-white font-mono truncate`,children:e.sw_ver||`—`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray font-medium shrink-0`,children:c(`printers.amsPopup.friendlyName`)}),(0,$.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary/50`})]}),(0,$.jsx)(`input`,{type:`text`,value:m,onChange:e=>a&&h(e.target.value),onKeyDown:e=>e.key===`Enter`&&D(),onFocus:()=>x(!0),onBlur:()=>{x(!1),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>d(!1),200)},placeholder:a?c(`printers.amsPopup.friendlyNamePlaceholder`):r?.[e.id]||`—`,disabled:!a,title:a?void 0:c(`printers.amsPopup.noEditPermission`),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-xs text-white placeholder-bambu-gray/60 focus:outline-none focus:border-bambu-green disabled:opacity-50 disabled:cursor-not-allowed`,maxLength:100}),a&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[v&&(0,$.jsx)(`p`,{className:`text-[length:var(--pc-t10,10px)] text-red-700 dark:text-red-400 break-words`,children:v}),(0,$.jsxs)(`div`,{className:`flex gap-1 justify-end`,children:[(0,$.jsx)(`button`,{onClick:D,disabled:g,className:`px-2 py-0.5 text-[length:var(--pc-t10,10px)] bg-bambu-green text-white rounded hover:bg-bambu-green/80 disabled:opacity-50`,children:c(`printers.amsPopup.save`)}),r?.[e.id]&&(0,$.jsx)(`button`,{onClick:async()=>{if(a){_(!0),y(null);try{await i.deleteAmsLabel(t,e.id,e.serial_number),o(),d(!1)}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}},disabled:g,className:`px-2 py-0.5 text-[length:var(--pc-t10,10px)] bg-bambu-dark-tertiary text-bambu-gray rounded hover:bg-bambu-dark-tertiary/70 disabled:opacity-50`,children:c(`printers.amsPopup.clear`)})]})]})]})]})})]})}var ho={PLA:{n3f:45,n3s:45,n3f_hours:12,n3s_hours:12},PETG:{n3f:65,n3s:65,n3f_hours:12,n3s_hours:12},TPU:{n3f:65,n3s:75,n3f_hours:12,n3s_hours:18},ABS:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},ASA:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},PA:{n3f:65,n3s:85,n3f_hours:12,n3s_hours:12},PC:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},PVA:{n3f:65,n3s:85,n3f_hours:12,n3s_hours:18}},go={1:1,2:1,3:1.2,4:1.4};function _o(e){let t=go[e]??1,n=e=>`${Math.round(e*t*10)/10}px`;return{"--pc-t8":n(8),"--pc-t9":n(9),"--pc-t10":n(10),"--pc-t11":n(11),"--pc-i2":n(8),"--pc-i25":n(10),"--pc-i3":n(12),"--pc-i35":n(14),"--pc-i4":n(16),"--pc-i5":n(20),"--pc-i7":n(28)}}function vo({printerId:e,dryingActive:t,timeFormat:n}){let{t:r}=l(),a=f(),{showToast:o}=te(),{data:s=[]}=p({queryKey:Ca,queryFn:()=>i.listScheduledDryings(),refetchInterval:3e4});(0,X.useEffect)(()=>{t&&a.invalidateQueries({queryKey:Ca})},[t,a]);let c=m({mutationFn:e=>i.cancelScheduledDrying(e),onSuccess:()=>a.invalidateQueries({queryKey:Ca}),onError:e=>o(e.message||r(`printers.drying.scheduleFailed`),`error`)}),u=s.filter(t=>t.printer_id===e&&(t.status===`pending`||t.status===`failed`));return u.length===0?null:(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:u.map(e=>{let t=e.status===`failed`,i=Ta(e.waiting_reason),a=Da(e.error_code);return(0,$.jsxs)(`div`,{"data-testid":t?`scheduled-drying-failed`:`scheduled-drying-pending`,className:`flex items-center justify-between px-2 py-1 rounded-lg text-[length:var(--pc-t11,11px)] ${t?`bg-red-500/10 border border-red-500/30`:`bg-amber-500/10 border border-amber-500/30`}`,children:[(0,$.jsx)(`span`,{className:t?`text-red-700 dark:text-red-400`:`text-amber-700 dark:text-amber-400`,children:t?r(`printers.drying.scheduleFailedReason`,{reason:a?r(a):e.error_message||r(`printers.drying.scheduleFailedUnknown`)}):(0,$.jsxs)($.Fragment,{children:[e.start_after?r(`printers.drying.scheduledFor`,{time:Bt(e.start_after,n)}):r(`printers.drying.scheduledAsap`),i&&(0,$.jsx)(`span`,{className:`ml-1 opacity-80`,children:r(i)})]})}),(0,$.jsx)(`button`,{onClick:()=>c.mutate(e.id),disabled:c.isPending,title:r(t?`printers.drying.dismissFailed`:`printers.drying.cancelScheduled`),className:`text-bambu-gray hover:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,$.jsx)(Pt,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]},e.id)})})}function yo({printer:e,hideIfDisconnected:t,maintenanceInfo:n,viewMode:r=`expanded`,cardSize:o=2,amsThresholds:s,spoolmanEnabled:c=!1,linkedSpools:u,spoolmanUrl:d,spoolmanSyncMode:h,onGetAssignment:_,onUnassignSpool:v,spoolmanSpools:y,spoolmanSlotAssignments:b,spoolmanLoading:T=!1,onUnassignSpoolmanSpool:D,timeFormat:O=`system`,cameraViewMode:k=`window`,onOpenEmbeddedCamera:A,onSelectCameraViewMode:j,checkPrinterFirmware:P=!0,dryingPresets:F=ho,requirePlateClear:R=!1,selectionMode:z=!1,isSelected:ie=!1,onToggleSelect:ae,onOpenCompactCard:V,nozzleTempPresets:se=be,bedTempPresets:le=Ce,chamberTempPresets:de=we,fanSpeedPresets:pe=Se,aiDetectionEnabled:he=!1,aiDetection:U,aiLastError:ge=null}){let{t:W}=l(),G=f(),xe=Tn(),{showToast:q}=te(),{hasPermission:J,canModify:De,authEnabled:Ae,isAdmin:je}=lr(),[Me,Pe]=(0,X.useState)(!1),[Fe,Ie]=(0,X.useState)(!1),[Le,Re]=(0,X.useState)(!0),[ze,Be]=(0,X.useState)(!1),[Ve,He]=(0,X.useState)(!1),[Ue,We]=(0,X.useState)(!1),[Ge,Ke]=(0,X.useState)(!1),[qe,Je]=(0,X.useState)(!1),[Ye,Xe]=(0,X.useState)(null),[Ze,Qe]=(0,X.useState)(!1),[$e,et]=(0,X.useState)(!1),[tt,nt]=(0,X.useState)(!1),[rt,it]=(0,X.useState)(()=>Ni(e.id)),at=(0,X.useCallback)(()=>{it(t=>{let n=!t;return Pi(e.id,n),n})},[e.id]),[ot,st]=(0,X.useState)(!1),[ct,lt]=(0,X.useState)(!1),[ut,dt]=(0,X.useState)(null),[ft,pt]=(0,X.useState)(null),[mt,ht]=(0,X.useState)(null),[gt,_t]=(0,X.useState)(null),[vt,yt]=(0,X.useState)(10),[bt,xt]=(0,X.useState)(!1),[St,Ct]=(0,X.useState)(!1),[wt,Tt]=(0,X.useState)(!1),[Et,Dt]=(0,X.useState)(!1),[Nt,Ft]=(0,X.useState)(!1),It=(0,X.useCallback)(()=>Dt(!1),[]),[zt,Bt]=(0,X.useState)(null),[Gt,Kt]=(0,X.useState)(null),[Jt,Yt]=(0,X.useState)(`n3f`),[en,pn]=(0,X.useState)(`PLA`),[bn,Sn]=(0,X.useState)(50),[wn,En]=(0,X.useState)(4),[jn,Mn]=(0,X.useState)(!1),[Nn,Fn]=(0,X.useState)(`now`),[Rn,Wn]=(0,X.useState)(120),[qn,Jn]=(0,X.useState)(``),[Yn,tr]=(0,X.useState)(null),[nr,rr]=(0,X.useState)(null),ir=(0,X.useCallback)((e,t)=>{let n=ki(e.tray.find(e=>e.tray_type)?.tray_type,F),r=F[n]??ho.PLA,i=e.module_type;pn(n),Sn(r[i]||r.n3f),En(i===`n3s`?r.n3s_hours:r.n3f_hours),Mn(!1),Fn(`now`),Wn(120),Jn(``),Yt(e.module_type),Kt(e.id),rr(t)},[F]);(0,X.useLayoutEffect)(()=>{if(Gt===null||!nr)return;let e=()=>{tr(xi({triggerRect:nr.getBoundingClientRect(),popoverWidth:ba,estimatedHeight:xa,horizontalAlign:`center`}))};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[Gt,nr]);let or=(0,X.useRef)(null),dr=(0,X.useRef)(!1),[pr,mr]=(0,X.useState)(null),[hr,_r]=(0,X.useState)(!1),[Cr,wr]=(0,X.useState)(!1),Or=(0,X.useRef)(null),[Ar,Mr]=(0,X.useState)(null),Nr=(0,X.useRef)(0),[Pr,Fr]=(0,X.useState)(null),[Ir,Lr]=(0,X.useState)(null),[Rr,zr]=(0,X.useState)(null),[Br,Vr]=(0,X.useState)(null),[Hr,Ur]=(0,X.useState)(null),[Wr,Gr]=(0,X.useState)(!1),[Z,Kr]=(0,X.useState)(null),[qr,Jr]=(0,X.useState)(!1),[Yr,Xr]=(0,X.useState)(!1),[Zr,Qr]=(0,X.useState)(null),[$r,ei]=(0,X.useState)(!1),[ti,ni]=(0,X.useState)(!1),{data:Q}=p({queryKey:[`printerStatus`,e.id],queryFn:()=>i.getPrinterStatus(e.id),refetchInterval:3e4}),{data:ri}=p({queryKey:[`firmwareUpdate`,e.id],queryFn:()=>a.checkPrinterUpdate(e.id),staleTime:300*1e3,refetchInterval:300*1e3,enabled:P&&J(`firmware:read`)}),ii=(0,X.useMemo)(()=>{let e=new Set;if(Q?.ams)for(let t of Q.ams)for(let n of t.tray||[])n.tray_info_idx&&e.add(n.tray_info_idx);for(let t of Q?.vt_tray??[])t.tray_info_idx&&e.add(t.tray_info_idx);if(Q?.nozzle_rack)for(let t of Q.nozzle_rack)t.filament_id&&e.add(t.filament_id);return Array.from(e)},[Q?.ams,Q?.vt_tray,Q?.nozzle_rack]),ai=(0,X.useMemo)(()=>{let e=new Set;if(Q?.ams)for(let t of Q.ams)for(let n of t.tray||[])n.tray_type&&e.add(n.tray_type.toUpperCase());for(let t of Q?.vt_tray??[])t.tray_type&&e.add(t.tray_type.toUpperCase());return e},[Q?.ams,Q?.vt_tray]),oi=(0,X.useMemo)(()=>{let e=new Set;if(Q?.ams){for(let t of Q.ams)for(let n of t.tray||[])if(n.tray_type&&n.tray_color){let t=n.tray_color.replace(`#`,``).toLowerCase().slice(0,6);e.add(`${n.tray_type.toUpperCase()}:${t}`)}}for(let t of Q?.vt_tray??[])if(t.tray_type&&t.tray_color){let n=t.tray_color.replace(`#`,``).toLowerCase().slice(0,6);e.add(`${t.tray_type.toUpperCase()}:${n}`)}return e},[Q?.ams,Q?.vt_tray]),si=(0,X.useMemo)(()=>{let e=new Set;if(Q?.ams){for(let t of Q.ams)for(let n of t.tray||[])if(n.tray_type&&n.tray_color){let t=n.tray_color.replace(`#`,``).toLowerCase().slice(0,6);e.add(`${n.tray_type.toUpperCase()}:${t}:${n.tray_info_idx||``}`)}}for(let t of Q?.vt_tray??[])if(t.tray_type&&t.tray_color){let n=t.tray_color.replace(`#`,``).toLowerCase().slice(0,6);e.add(`${t.tray_type.toUpperCase()}:${n}:${t.tray_info_idx||``}`)}return e},[Q?.ams,Q?.vt_tray]),{data:ci}=p({queryKey:[`filamentInfo`,ii],queryFn:()=>i.getFilamentInfo(ii),enabled:ii.length>0,staleTime:300*1e3}),{data:li}=p({queryKey:[`slotPresets`,e.id],queryFn:()=>i.getSlotPresets(e.id),staleTime:120*1e3}),ui=Q?.state===`RUNNING`||Q?.state===`PAUSE`?Q?.current_archive_id??null:null,{data:di}=p({queryKey:[`archive-plates`,ui],queryFn:()=>i.getArchivePlates(ui),enabled:ui!=null,staleTime:300*1e3}),fi=!di?.is_multi_plate||Q?.current_plate_id==null?null:di.plates.find(e=>e.index===Q.current_plate_id)?.name||W(`printers.plateNumber`,`Plate {{number}}`,{number:Q.current_plate_id}),{data:pi,refetch:mi}=p({queryKey:[`amsLabels`,e.id],queryFn:()=>i.getAmsLabels(e.id),staleTime:300*1e3}),[hi,gi]=(0,X.useState)(null);(0,X.useEffect)(()=>{Q?.wifi_signal!=null&&gi(Q.wifi_signal)},[Q?.wifi_signal]);let _i=Q?.wifi_signal??hi,yi=(0,X.useRef)(void 0);(0,X.useEffect)(()=>{Q?.connected!==void 0&&(yi.current=Q.connected)},[Q?.connected]);let Si=Q?.connected??yi.current,Ci=(0,X.useRef)({});(0,X.useEffect)(()=>{Q?.ams_extruder_map&&Object.keys(Q.ams_extruder_map).length>0&&(Ci.current=Q.ams_extruder_map)},[Q?.ams_extruder_map]);let wi=Q?.ams_extruder_map&&Object.keys(Q.ams_extruder_map).length>0?Q.ams_extruder_map:Ci.current,Ti=(0,X.useRef)({});(0,X.useEffect)(()=>{Q?.ams_switch_inlet&&Object.keys(Q.ams_switch_inlet).length>0&&(Ti.current=Q.ams_switch_inlet)},[Q?.ams_switch_inlet]);let Ei=Q?.fila_switch?.installed===!0,Oi=Q?.ams_switch_inlet&&Object.keys(Q.ams_switch_inlet).length>0?Q.ams_switch_inlet:Ti.current,ji=(0,X.useRef)([]);(0,X.useEffect)(()=>{Q?.ams&&Q.ams.length>0&&(ji.current=Q.ams)},[Q?.ams]);let Mi=Q?.ams&&Q.ams.length>0?Q.ams:ji.current,Fi=Mi.some(e=>e.tray.some(e=>e.k))||(Q?.vt_tray??[]).some(e=>e.k);(0,X.useEffect)(()=>{if(!pr)return;let e=Mi.find(e=>e.id===pr.amsId);e&&(e.dry_time>0||e.dry_status>0)&&mr(null)},[pr,Mi]),(0,X.useEffect)(()=>{if(!pr)return;let e=setTimeout(()=>{mr(null),q(W(`printers.drying.toastNotStarted`),`error`)},$a);return()=>clearTimeout(e)},[pr,q,W]);let Ii=(0,X.useRef)(void 0),Li=Q?.tray_now;Li!==void 0&&Li!==255?Ii.current=Li:Li===255&&(Ii.current=void 0);let Ri=Li!==void 0&&Li!==255?Li:Ii.current,zi=Q?.expected_tray??null,Bi=Q?.previous_tray??null,Hi=e=>{if(e===null)return null;if(e===254)return W(`printers.expectedSlot.external`);if(e>=128&&e<=135)return pi?.[e]||Cn(e,1);let t=Math.floor(e/4),n=e%4;return W(`printers.expectedSlot.label`,{ams:pi?.[t]||Cn(t,4),slot:n+1})},Ui=Q?.state===`PAUSE`?{expectedSlotLabel:Hi(zi),ranOutSlotLabel:Hi(Bi)}:null,{data:Wi}=p({queryKey:[`smartPlugByPrinter`,e.id],queryFn:()=>i.getSmartPlugByPrinter(e.id)}),{data:Gi}=p({queryKey:[`scriptPlugsByPrinter`,e.id],queryFn:()=>i.getScriptPlugsByPrinter(e.id)}),{data:Ki}=p({queryKey:[`smartPlugStatus`,Wi?.id],queryFn:()=>Wi?i.getSmartPlugStatus(Wi.id):null,enabled:!!Wi,refetchInterval:1e4}),{data:qi}=p({queryKey:[`queue`,e.id,`pending`],queryFn:()=>i.getQueue(e.id,`pending`)}),Ji=(0,X.useMemo)(()=>qi?.length?nn(qi,ai,oi,si).length:0,[qi,ai,oi,si]),{data:Zi}=p({queryKey:[`queue`,e.id,`printing`],queryFn:()=>i.getQueue(e.id,`printing`),enabled:Q?.state===`RUNNING`}),{data:ta}=p({queryKey:[`currentPrintUser`,e.id],queryFn:()=>i.getCurrentPrintUser(e.id),enabled:Q?.state===`RUNNING`}),ra=Zi?.[0]?.created_by_username||ta?.username,{data:ia}=p({queryKey:[`archives`,`last-per-printer`],queryFn:()=>i.getLastArchivePerPrinter(),select:t=>t.find(t=>t.printer_id===e.id)}),aa=Q?.state===`RUNNING`||Q?.state===`PAUSE`,sa=R&&Q?.awaiting_plate_clear===!0,ca=ia&&ia.status===`completed`&&ia.confirm_requested&&ia.user_verdict==null&&De(`archives`,`update`,ia.created_by_id)?ia:null,la=sa&&!aa,ha=Q?.current_print&&aa?vi(Q.subtask_name||Q.current_print||null,Q.gcode_file,W,fi):null,[ga,va]=(0,X.useState)(null);(0,X.useEffect)(()=>{ha?va({name:ha,coverUrl:Q?.cover_url??null}):sa||va(null)},[ha,sa,Q?.cover_url]);let wa=!R||!Q?.connected?null:aa?{label:W(`printers.plateStatus.inUse`),className:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`}:Q.awaiting_plate_clear?{label:W(`printers.plateStatus.notCleared`),className:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`}:{label:W(`printers.plateStatus.cleared`),className:`bg-status-ok/20 text-status-ok`},Ta=wa?(0,$.jsx)(`span`,{className:`inline-flex flex-shrink-0 items-center rounded-full px-2 py-0.5 text-[length:var(--pc-t10,10px)] font-medium ${wa.className}`,children:wa.label}):null,Ea=t&&Si===!1,Da=m({mutationFn:t=>i.deletePrinter(e.id,t.deleteArchives),onSuccess:()=>{G.invalidateQueries({queryKey:[`printers`]}),G.invalidateQueries({queryKey:[`archives`]}),G.invalidateQueries({queryKey:[`maintenanceOverview`]})},onError:e=>q(e.message||W(`printers.toast.failedToDelete`),`error`)}),ka=m({mutationFn:()=>i.connectPrinter(e.id),onSuccess:()=>{G.invalidateQueries({queryKey:[`printerStatus`,e.id]})}}),Aa=m({mutationFn:()=>i.refreshPrinterStatus(e.id),onSuccess:()=>{G.invalidateQueries({queryKey:[`printerStatus`,e.id]}),q(W(`printers.forceRefreshSuccess`),`success`)},onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),Ia=m({mutationFn:e=>i.unlinkSpool(e),onSuccess:e=>{q(W(`spoolman.unlinkSuccess`)||e?.message,`success`),G.invalidateQueries({queryKey:[`linked-spools`]}),G.invalidateQueries({queryKey:[`unlinked-spools`]}),G.invalidateQueries({queryKey:[`spoolman-slot-assignments`]})},onError:e=>{q(e.message||W(`spoolman.unlinkFailed`),`error`)}}),La=m({mutationFn:({amsId:t,temp:n,duration:r,filament:a,rotateTray:o})=>i.startDrying(e.id,t,n,r,a,o),onSuccess:(t,{amsId:n})=>{Kt(null),mr({amsId:n}),q(W(`printers.drying.toastCommandSent`),`success`),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),Va=m({mutationFn:t=>i.createScheduledDrying({printer_id:e.id,ams_id:t.amsId,temp:t.temp,duration_hours:t.duration,filament:t.filament,rotate_tray:t.rotateTray,start_after:t.startAfter}),onSuccess:()=>{G.invalidateQueries({queryKey:Ca}),Kt(null)},onError:e=>q(e.message||W(`printers.drying.scheduleFailed`),`error`)}),Ha=m({mutationFn:t=>i.stopDrying(e.id,t),onSuccess:()=>{mr(null),q(W(`printers.drying.toastStopped`),`success`),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),Ua=m({mutationFn:t=>i.setAmsFilamentBackup(e.id,t),onSuccess:(t,n)=>{G.invalidateQueries({queryKey:[`printerStatus`,e.id]}),G.invalidateQueries({queryKey:[`printer-status`,e.id]}),q(W(n?`printers.amsBackup.toastEnabled`:`printers.amsBackup.toastDisabled`),`success`)},onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),Wa=m({mutationFn:e=>Wi?i.controlSmartPlug(Wi.id,e):Promise.reject(`No plug`),onSuccess:()=>{G.invalidateQueries({queryKey:[`smartPlugStatus`,Wi?.id]})}}),Ga=m({mutationFn:e=>Wi?i.updateSmartPlug(Wi.id,{auto_off:e}):Promise.reject(`No plug`),onSuccess:()=>{G.invalidateQueries({queryKey:[`smartPlugByPrinter`,e.id]}),G.invalidateQueries({queryKey:[`smart-plugs`]})}}),Ka=m({mutationFn:({id:e,action:t})=>i.controlSmartPlug(e,t),onSuccess:()=>{q(W(`printers.toast.scriptTriggered`))},onError:e=>q(e.message||W(`printers.toast.failedToRunScript`),`error`)}),to=m({mutationFn:()=>i.stopPrint(e.id),onSuccess:()=>{q(W(`printers.toast.printStopped`)),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:e=>q(e.message||W(`printers.toast.failedToStopPrint`),`error`)}),ro=m({mutationFn:()=>i.pausePrint(e.id),onSuccess:()=>{q(W(`printers.toast.printPaused`)),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:e=>q(e.message||W(`printers.toast.failedToPausePrint`),`error`)}),ao=m({mutationFn:()=>i.resumePrint(e.id),onSuccess:()=>{q(W(`printers.toast.printResumed`)),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:e=>q(e.message||W(`printers.toast.failedToResumePrint`),`error`)}),so=m({mutationFn:()=>i.clearPlate(e.id),onSuccess:()=>{q(W(`queue.clearPlateSuccess`)),G.setQueryData([`printerStatus`,e.id],e=>e&&{...e,awaiting_plate_clear:!1}),G.invalidateQueries({queryKey:[`printerStatus`,e.id]}),G.invalidateQueries({queryKey:[`queue`,e.id]})},onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),[co,lo]=(0,X.useState)(!1),yo=m({mutationFn:e=>i.updateArchive(ca.id,{user_verdict:e,user_verdict_source:`printer_card`}),onSuccess:()=>{q(W(`confirmOutcome.savedGood`),`success`),G.invalidateQueries({queryKey:[`archives`]})},onError:e=>q(e.message||W(`confirmOutcome.saveFailed`),`error`)}),bo=(0,$.jsxs)($.Fragment,{children:[ca&&(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`flex-1 min-w-0 truncate text-xs text-bambu-gray`,title:ca.print_name||ca.filename,children:W(`confirmOutcome.cardPrompt`)}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>lo(!0),disabled:yo.isPending,className:`p-1.5 rounded-lg border border-red-500/40 text-red-500 hover:bg-red-500/10 transition-colors`,title:W(`confirmOutcome.reject`),children:(0,$.jsx)(mn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>yo.mutate(`good`),disabled:yo.isPending,className:`p-1.5 rounded-lg border border-bambu-green/50 text-bambu-green hover:bg-bambu-green/10 transition-colors`,title:W(`confirmOutcome.good`),children:(0,$.jsx)(Xn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>so.mutate(),disabled:so.isPending||!J(`printers:clear_plate`),className:`mt-2 w-full inline-flex items-center justify-center gap-2 px-3 py-1.5 rounded-lg bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-300 dark:border-yellow-400/40 text-yellow-700 dark:text-yellow-400 hover:bg-yellow-500/30 transition-colors text-xs font-medium disabled:opacity-50`,title:J(`printers:clear_plate`)?W(`printers.plateStatus.markCleared`):W(`printers.permission.noControl`),children:[so.isPending?(0,$.jsx)(H,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] animate-spin`}):(0,$.jsx)(pa,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),W(`printers.plateStatus.markCleared`)]}),co&&ca&&(0,$.jsx)(cr,{archiveId:ca.id,onClose:()=>lo(!1)})]}),Co=m({mutationFn:({target:t,nozzle:n})=>i.setNozzleTemperature(e.id,t,n),onSuccess:t=>{_t(null),q(t.message),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),wo=m({mutationFn:t=>i.setBedTemperature(e.id,t),onSuccess:t=>{_t(null),q(t.message),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),To=m({mutationFn:t=>i.setChamberTemperature(e.id,t),onSuccess:t=>{_t(null),q(t.message),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),Eo=m({mutationFn:({fan:t,speed:n})=>i.setFanSpeed(e.id,t,n),onMutate:async({fan:t,speed:n})=>{await G.cancelQueries({queryKey:[`printerStatus`,e.id]});let r=G.getQueryData([`printerStatus`,e.id]),i={part:`cooling_fan_speed`,aux:`big_fan1_speed`,aux2:`left_aux_fan_speed`,chamber:`big_fan2_speed`}[t];return G.setQueryData([`printerStatus`,e.id],e=>e&&{...e,[i]:n}),{previousStatus:r}},onSuccess:t=>{_t(null),q(t.message),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:(t,n,r)=>{r?.previousStatus&&G.setQueryData([`printerStatus`,e.id],r.previousStatus),q(t.message||W(`printers.toast.failedToSendCommand`),`error`)}}),Do=m({mutationFn:t=>i.selectExtruder(e.id,t),onMutate:async t=>{await G.cancelQueries({queryKey:[`printerStatus`,e.id]});let n=G.getQueryData([`printerStatus`,e.id]);return G.setQueryData([`printerStatus`,e.id],e=>e&&{...e,active_extruder:t}),{previousStatus:n}},onSuccess:t=>{_t(null),q(t.message),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})},onError:(t,n,r)=>{r?.previousStatus&&G.setQueryData([`printerStatus`,e.id],r.previousStatus),q(t.message||W(`printers.toast.failedToSendCommand`),`error`)}}),Oo=m({mutationFn:t=>i.setChamberLight(e.id,t),onMutate:async t=>{await G.cancelQueries({queryKey:[`printerStatus`,e.id]});let n=G.getQueryData([`printerStatus`,e.id]);return G.setQueryData([`printerStatus`,e.id],e=>({...e,chamber_light:t})),{previousStatus:n}},onSuccess:(e,t)=>{q(`Chamber light ${t?`on`:`off`}`)},onError:(t,n,r)=>{r?.previousStatus&&G.setQueryData([`printerStatus`,e.id],r.previousStatus),q(t.message||W(`printers.toast.failedToControlChamberLight`),`error`)}}),ko=m({mutationFn:t=>i.setPrintSpeed(e.id,t),onMutate:async t=>{await G.cancelQueries({queryKey:[`printerStatus`,e.id]});let n=G.getQueryData([`printerStatus`,e.id]);return G.setQueryData([`printerStatus`,e.id],e=>({...e,speed_level:t})),{previousStatus:n}},onError:(t,n,r)=>{r?.previousStatus&&G.setQueryData([`printerStatus`,e.id],r.previousStatus),q(t.message||W(`printers.toast.failedToSetSpeed`),`error`)}}),Ao=m({mutationFn:t=>i.setAirductMode(e.id,t),onMutate:async t=>{await G.cancelQueries({queryKey:[`printerStatus`,e.id]});let n=G.getQueryData([`printerStatus`,e.id]);return G.setQueryData([`printerStatus`,e.id],e=>({...e,airduct_mode:t===`cooling`?0:1})),{previousStatus:n}},onError:(t,n,r)=>{r?.previousStatus&&G.setQueryData([`printerStatus`,e.id],r.previousStatus),q(t.message||W(`printers.toast.failedToSendCommand`),`error`)}}),jo=m({mutationFn:({distance:t})=>i.bedJog(e.id,t),onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),Mo=m({mutationFn:({x:t,y:n})=>i.xyJog(e.id,t,n),onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),No=m({mutationFn:t=>i.extruderJog(e.id,t),onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),Po=m({mutationFn:t=>i.homeAxes(e.id,t),onSuccess:()=>{q(W(`printers.bedJog.homingStarted`))},onError:e=>q(e.message||W(`printers.toast.failedToSendCommand`),`error`)}),Fo=m({mutationFn:t=>i.updatePrinter(e.id,{plate_detection_enabled:t}),onSuccess:()=>{G.invalidateQueries({queryKey:[`printers`]}),q(Fo.variables?W(`printers.toast.plateCheckEnabled`):W(`printers.toast.plateCheckDisabled`))},onError:e=>q(e.message||W(`printers.toast.failedToUpdateSetting`),`error`)}),Io=m({mutationFn:t=>i.updatePrinter(e.id,{is_active:t}),onSuccess:(t,n)=>{G.invalidateQueries({queryKey:[`printers`]}),G.invalidateQueries({queryKey:[`printerStatus`,e.id]}),q(W(n?`printers.maintenance.toastExited`:`printers.maintenance.toastEntered`,{name:e.name}),`success`)},onError:e=>q(e.message||W(`printers.toast.failedToUpdateSetting`),`error`)}),[Lo,Ro]=(0,X.useState)(!1),zo=()=>{Q?.state===`RUNNING`||Q?.state===`PAUSE`?Ro(!0):Io.mutate(!1)},Bo=(Q?.state===`RUNNING`||Q?.state===`PAUSE`)&&(Q?.printable_objects_count??0)>=2,{data:Vo}=p({queryKey:[`printableObjects`,e.id],queryFn:()=>i.getPrintableObjects(e.id),enabled:St||Bo,refetchInterval:St?5e3:Bo?3e4:!1}),[Ho,Uo]=(0,X.useState)(null),Wo=(0,X.useRef)(!1),Go=(0,X.useRef)(null),Ko=(0,X.useRef)(!1),qo=m({mutationFn:({amsId:t,slotId:n})=>i.refreshAmsSlot(e.id,t,n),onMutate:({amsId:e,slotId:t})=>{Go.current&&clearTimeout(Go.current),Wo.current=!1,Ko.current=!1,Uo({amsId:e,slotId:t}),setTimeout(()=>{Ko.current=!0},2e3),Go.current=setTimeout(()=>{Uo(null)},3e4)},onSuccess:e=>{q(e.message||W(`printers.toast.rfidRereadInitiated`))},onError:e=>{q(e.message||W(`printers.toast.failedToRereadRfid`),`error`),Go.current&&clearTimeout(Go.current),Uo(null)}}),Jo=m({mutationFn:({trayId:t,extruderId:n})=>i.loadAmsTray(e.id,t,n),onSuccess:e=>{Zo(null),q(e.message||W(`printers.toast.loadInitiated`))},onError:e=>{Zo(null),q(e.message||W(`printers.toast.failedToLoad`),`error`)}}),Yo=m({mutationFn:({trayId:t})=>i.unloadAms(e.id,t),onSuccess:e=>{q(e.message||W(`printers.toast.unloadInitiated`))},onError:e=>{q(e.message||W(`printers.toast.failedToUnload`),`error`)}}),[Xo,Zo]=(0,X.useState)(null),Qo=!!Q?.fila_switch?.installed,$o=(e,t,n)=>{if(!Qo||e===255||e>=128){Jo.mutate({trayId:n});return}if(!Q?.fila_switch?.ready){q(W(`printers.ams.switchNotReady`),`warning`);return}Zo({trayId:n,amsId:e,slotId:t,slotLabel:sn(e,t,!1,!1)})},[es,ts]=(0,X.useState)(null),[ns,rs]=(0,X.useState)(null),is=async()=>{try{ts(await i.getPlateReferences(e.id))}catch{}},as=()=>{Fo.mutate(!e.plate_detection_enabled)},os=async()=>{Jr(!0),Kr(null);let t=Q?.chamber_light===!1;ni(t),t&&(await i.setChamberLight(e.id,!0),await new Promise(e=>setTimeout(e,2500)));try{Kr(await i.checkPlateEmpty(e.id,{includeDebugImage:!0})),is()}catch(n){q(n instanceof Error?n.message:W(`printers.toast.failedToCheckPlate`),`error`),t&&(await i.setChamberLight(e.id,!1),ni(!1))}finally{Jr(!1)}},ss=(0,X.useCallback)(async()=>{Kr(null),ti&&(await i.setChamberLight(e.id,!1),ni(!1))},[ti,e.id]),cs=async t=>{Xr(!0);try{let n=await i.calibratePlateDetection(e.id,{label:t});n.success?(q(n.message||W(`printers.toast.calibrationSaved`),`success`),is(),Kr(await i.checkPlateEmpty(e.id,{includeDebugImage:!0}))):q(n.message||W(`printers.toast.calibrationFailed`),`error`)}catch(e){q(e instanceof Error?e.message:W(`printers.toast.calibrationFailed`),`error`)}finally{Xr(!1)}},ls=async(t,n)=>{try{await i.updatePlateReferenceLabel(e.id,t,n),rs(null),is()}catch(e){q(e instanceof Error?e.message:W(`printers.toast.failedToUpdateLabel`),`error`)}},us=async t=>{try{await i.deletePlateReference(e.id,t),q(W(`printers.toast.referenceDeleted`),`success`),is(),Kr(await i.checkPlateEmpty(e.id,{includeDebugImage:!0}))}catch(e){q(e instanceof Error?e.message:W(`printers.toast.failedToDeleteReference`),`error`)}},ds=async()=>{if(Zr){ei(!0);try{await i.updatePrinter(e.id,{plate_detection_roi:Zr}),q(W(`printers.toast.detectionAreaSaved`),`success`),Qr(null),Kr(await i.checkPlateEmpty(e.id,{includeDebugImage:!0}))}catch(e){q(e instanceof Error?e.message:W(`printers.toast.failedToSaveDetectionArea`),`error`)}finally{ei(!1)}}};(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&Z&&ss()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Z,ss]);let fs=(0,X.useRef)(null);if((0,X.useEffect)(()=>{if(!Ho)return;let e=Q?.ams_status_main??0;return e!==0&&(Wo.current=!0,fs.current&&=(clearTimeout(fs.current),null)),Wo.current&&e===0&&(Ko.current?(Go.current&&clearTimeout(Go.current),Uo(null)):fs.current||=setTimeout(()=>{Go.current&&clearTimeout(Go.current),Uo(null)},2e3)),()=>{fs.current&&clearTimeout(fs.current)}},[Q?.ams_status_main,Ho]),(0,X.useEffect)(()=>{if(!Me)return;let e=e=>{let t=e.target;Or.current?.contains(t)||Pe(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[Me]),Ea)return null;let ps=_o(o),ms=()=>{switch(o){case 1:return`w-10 h-10`;case 2:return`w-14 h-14`;case 3:return`w-16 h-16`;case 4:return`w-20 h-20`;default:return`w-14 h-14`}},hs=()=>{switch(o){case 1:return`text-base truncate`;case 2:return`text-lg`;case 3:return`text-xl`;case 4:return`text-2xl`;default:return`text-lg`}},gs=()=>{switch(o){case 1:return`mb-2`;case 2:return`mb-4`;case 3:return`mb-5`;case 4:return`mb-6`;default:return`mb-4`}},_s=J(`library:upload`)&&J(`queue:create`),vs=!Zn(Q),ys=e=>{e.preventDefault(),Nr.current++,Nr.current===1&&_r(!0)},bs=e=>{e.preventDefault(),e.dataTransfer.dropEffect=_s?`copy`:`none`},xs=e=>{e.preventDefault(),Nr.current--,Nr.current===0&&_r(!1)},Ss=async t=>{if(t.preventDefault(),Nr.current=0,_r(!1),!_s)return;let n=Array.from(t.dataTransfer.files)[0];if(!n)return;let r=n.name.toLowerCase();if(!r.endsWith(`.gcode`)&&!r.includes(`.gcode.`)){q(W(`printers.dropNotPrintable`,`Only .gcode and .gcode.3mf files can be printed`),`error`);return}wr(!0);try{let t=await i.uploadLibraryFile(n,null),r=t.metadata?.sliced_for_model,a=gr(e.model);if(r&&a&&r.toLowerCase()!==a.toLowerCase()){await i.deleteLibraryFile(t.id).catch(()=>{}),q(W(`printers.incompatibleFile`,`This file was sliced for {{slicedFor}}, but this printer is a {{printerModel}}`,{slicedFor:r,printerModel:a}),`error`);return}Bt({id:t.id,filename:t.filename})}catch{q(W(`common.uploadFailed`,`Upload failed`),`error`)}finally{wr(!1)}},Cs=t=>{r!==`compact`||z||t.target.closest(`button, a, input, select, textarea, [role="button"]`)||V?.(e.id)},ws=`!h-8 !min-h-8 !w-8 !px-0 !py-0`,Ts=t=>{t===`embedded`&&A?A(e.id,e.name):Di(e.id)},Es=[{mode:`window`,icon:(0,$.jsx)($t,{className:`w-4 h-4`}),label:W(`settings.newWindow`),title:W(`settings.cameraWindowDescription`)},{mode:`embedded`,icon:(0,$.jsx)(Dr,{className:`w-4 h-4`}),label:W(`settings.embeddedOverlay`),title:W(`settings.cameraOverlayDescription`)}].map(({mode:e,icon:t,label:n,title:r})=>({icon:t,label:e===k?`${n} ✓`:n,title:r,onClick:()=>{j?.(e),Ts(e)}})),Ds=({amsId:e,slotId:t,loadTrayId:n,isRefreshing:r,includeRfid:i=!0})=>{let a=Q?.state===`RUNNING`,o=e>=128&&e!==255?void 0:n;return(0,$.jsxs)($.Fragment,{children:[i&&(0,$.jsxs)(`button`,{className:`w-full px-2 py-1.5 text-left text-xs flex items-center gap-2 rounded transition-colors ${J(`printers:ams_rfid`)?`text-white hover:bg-bambu-dark-tertiary`:`text-bambu-gray/50 cursor-not-allowed`}`,onClick:n=>{n.stopPropagation(),!(a||!J(`printers:ams_rfid`))&&qo.mutate({amsId:e,slotId:t})},disabled:a||r||!J(`printers:ams_rfid`),title:a?W(`printers.bedJog.disabledWhilePrinting`):J(`printers:ams_rfid`)?void 0:W(`printers.permission.noAmsRfid`),children:[(0,$.jsx)(dn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] ${r?`animate-spin`:``}`}),W(`printers.rfid.reread`)]}),(0,$.jsxs)(`button`,{className:`w-full px-2 py-1.5 text-left text-xs flex items-center gap-2 rounded transition-colors ${J(`printers:control`)?`text-white hover:bg-bambu-dark-tertiary`:`text-bambu-gray/50 cursor-not-allowed`}`,onClick:r=>{r.stopPropagation(),!(a||!J(`printers:control`))&&$o(e,t,n)},disabled:a||!J(`printers:control`),title:a?W(`printers.bedJog.disabledWhilePrinting`):J(`printers:control`)?void 0:W(`printers.permission.noControl`),children:[(0,$.jsx)(me,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),W(`printers.ams.load`)]}),(0,$.jsxs)(`button`,{className:`w-full px-2 py-1.5 text-left text-xs flex items-center gap-2 rounded transition-colors ${J(`printers:control`)?`text-white hover:bg-bambu-dark-tertiary`:`text-bambu-gray/50 cursor-not-allowed`}`,onClick:e=>{e.stopPropagation(),!(a||!J(`printers:control`))&&Yo.mutate({trayId:o})},disabled:a||!J(`printers:control`),title:a?W(`printers.bedJog.disabledWhilePrinting`):J(`printers:control`)?void 0:W(`printers.permission.noControl`),children:[(0,$.jsx)(Ln,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),W(`printers.ams.unload`)]})]})},Os=(0,$.jsxs)(`div`,{ref:Or,className:`relative flex-shrink-0`,children:[(0,$.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>Pe(!Me),title:W(`common.more`,`More`),className:ws,children:(0,$.jsx)(re,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),Me&&(0,$.jsxs)(`div`,{className:`absolute left-0 bottom-full mb-2 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg z-20`,children:[(0,$.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-sm flex items-center gap-2 ${J(`printers:update`)?`hover:bg-bambu-dark-tertiary`:`opacity-50 cursor-not-allowed`}`,onClick:()=>{J(`printers:update`)&&(Be(!0),Pe(!1))},title:J(`printers:update`)?void 0:W(`printers.permission.noEdit`),children:[(0,$.jsx)(Zt,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),W(`common.edit`)]}),(0,$.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2`,onClick:()=>{Dt(!0),Pe(!1)},children:[(0,$.jsx)(ee,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),W(`printers.printerInformation`)]}),Ae&&je&&(0,$.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2`,onClick:()=>{Pe(!1),xe(`/settings?tab=users&sub=printer-access&view=printers&printer=${e.id}`)},children:[(0,$.jsx)(Er,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),W(`printerAccess.whoHasAccess`)]}),(0,$.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-sm flex items-center gap-2 ${J(`printers:update`)?`hover:bg-bambu-dark-tertiary`:`opacity-50 cursor-not-allowed`}`,disabled:Io.isPending||!J(`printers:update`),onClick:()=>{J(`printers:update`)&&(Pe(!1),e.is_active===!1?Io.mutate(!0):zo())},title:J(`printers:update`)?void 0:W(`printers.permission.noEdit`),children:[(0,$.jsx)(sr,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),e.is_active===!1?W(`printers.maintenance.menuExit`):W(`printers.maintenance.menuEnter`)]}),(0,$.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2`,onClick:()=>{ka.mutate(),Pe(!1)},children:[(0,$.jsx)(dn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),W(`printers.reconnect`)]}),(0,$.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2 disabled:opacity-50`,disabled:Aa.isPending,onClick:()=>{Aa.mutate(),Pe(!1)},children:[(0,$.jsx)(On,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] ${Aa.isPending?`animate-spin`:``}`}),W(`printers.forceRefresh`)]}),(0,$.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2`,onClick:()=>{We(!0),Pe(!1)},children:[(0,$.jsx)(gn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),W(`printers.mqttDebug`)]}),(0,$.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2`,onClick:()=>{Ft(!0),Pe(!1)},children:[(0,$.jsx)(an,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),W(`diagnostic.runButton`)]}),(0,$.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-sm flex items-center gap-2 ${J(`printers:delete`)?`text-red-700 dark:text-red-400 hover:bg-bambu-dark-tertiary`:`text-red-700/50 dark:text-red-400/50 cursor-not-allowed`}`,onClick:()=>{J(`printers:delete`)&&(Ie(!0),Pe(!1))},title:J(`printers:delete`)?void 0:W(`printers.permission.noDelete`),children:[(0,$.jsx)(Qt,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),W(`common.delete`)]})]})]});return(0,$.jsxs)(Rt,{id:`printer-card-${e.id}`,className:`relative flex h-full flex-col ${ie?`ring-2 ring-bambu-green`:``} ${z||r===`compact`?`cursor-pointer`:``}`,style:ps,onClick:Cs,onDragEnter:ys,onDragOver:bs,onDragLeave:xs,onDrop:Ss,children:[z&&(0,$.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-start p-2`,onClick:t=>{t.stopPropagation(),ae?.(e.id)},children:ie?(0,$.jsx)(xn,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)] text-bambu-green`}):(0,$.jsx)(fn,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)] text-bambu-gray`})}),(hr||Cr)&&(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 rounded-xl border-2 border-dashed flex items-center justify-center transition-colors ${Cr?`bg-bambu-green/10 border-bambu-green/50`:_s?`bg-bambu-green/10 border-bambu-green`:`bg-red-50 dark:bg-red-500/10 border-red-300 dark:border-red-500/50`}`,children:(0,$.jsx)(`div`,{className:`text-center`,children:Cr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{className:`w-8 h-8 mx-auto mb-2 text-bambu-green animate-spin`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-bambu-green`,children:W(`common.uploading`,`Uploading...`)})]}):_s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ln,{className:`w-8 h-8 mx-auto mb-2 text-bambu-green`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-bambu-green`,children:W(vs?`printers.dropToQueue`:`printers.dropToPrint`)})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pt,{className:`w-8 h-8 mx-auto mb-2 text-red-600 dark:text-red-400`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-red-700 dark:text-red-400`,children:J(`library:upload`)?W(`fileManager.noPermissionAddToQueue`):W(`fileManager.noPermissionUpload`)})]})})}),(0,$.jsxs)(Lt,{className:`${o>=3?`p-5`:``} flex flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:gs(),children:[(0,$.jsx)(`div`,{className:`flex items-start justify-between gap-2`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,$.jsx)(`img`,{src:tn(e.model),alt:e.model||W(`common.printer`),className:`object-contain rounded-lg flex-shrink-0 ${ms()}`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-white ${hs()}`,children:e.name}),r===`compact`&&(()=>{let e=Q?.connected&&Q.hms_errors?Mt(Q.hms_errors):[],t=e.some(At),n=e.length>0,r=Q?.connected?t?`bg-status-error`:n?`bg-status-warning`:`bg-status-ok`:`bg-status-error`,i=Q?.connected?n?`${e.length} HMS ${e.length===1?`error`:`errors`}`:W(`printers.connection.connected`):W(`printers.connection.offline`);return(0,$.jsx)(`div`,{className:`w-[var(--pc-i2,0.5rem)] h-[var(--pc-i2,0.5rem)] rounded-full flex-shrink-0 ${r}`,title:i})})()]}),r===`compact`&&la&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>so.mutate(),disabled:so.isPending||!J(`printers:clear_plate`),"aria-label":W(`printers.plateStatus.markCleared`),className:`inline-flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-300 dark:border-yellow-400/40 text-yellow-700 dark:text-yellow-400 hover:bg-yellow-500/30 transition-colors disabled:opacity-50`,title:J(`printers:clear_plate`)?W(`printers.plateStatus.markCleared`):W(`printers.permission.noControl`),children:so.isPending?(0,$.jsx)(H,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] animate-spin`}):(0,$.jsx)(pa,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]}),(0,$.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[e.model||`Unknown Model`,r===`expanded`&&An(Q).length>0&&(0,$.jsxs)(`span`,{className:`ml-1.5 text-bambu-gray`,title:Q?.nozzles?.[0]?.nozzle_type||`Nozzle`,children:[`• `,An(Q).join(` / `),`mm`]}),r===`expanded`&&n&&n.total_print_hours>0&&(0,$.jsxs)(`span`,{className:`ml-2 text-bambu-gray`,children:[(0,$.jsx)(vn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] inline-block mr-1`}),Math.round(n.total_print_hours),`h`]})]})]})]})}),r===`expanded`&&(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.is_active===!1?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`,title:W(`printers.maintenance.subtitle`),children:[(0,$.jsx)(sr,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),W(`printers.maintenance.pillLabel`)]}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs ${Q?.connected?`bg-status-ok/20 text-status-ok`:`bg-status-error/20 text-status-error`}`,children:[Q?.connected?(0,$.jsx)($n,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}):(0,$.jsx)(kt,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),Q?.connected?W(`printers.connection.connected`):W(`printers.connection.offline`)]}),e.is_active!==!1&&!Q?.connected&&(0,$.jsxs)(`button`,{onClick:()=>Ft(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors`,title:W(`diagnostic.runButton`),children:[(0,$.jsx)(an,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),W(`diagnostic.runButton`)]}),Q?.connected&&Q?.wired_network&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs bg-status-ok/20 text-status-ok`,title:W(`printers.connection.ethernet`,`Ethernet`),children:[(0,$.jsx)(M,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),W(`printers.connection.ethernet`,`Ethernet`)]}),Q?.connected&&!Q?.wired_network&&_i!=null&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs ${_i>=-50||_i>=-60?`bg-status-ok/20 text-status-ok`:_i>=-70?`bg-status-warning/20 text-status-warning`:_i>=-80?`bg-orange-500/20 text-orange-600`:`bg-status-error/20 text-status-error`}`,title:`WiFi: ${_i} dBm - ${W(_n(_i).labelKey)}`,children:[(0,$.jsx)(kr,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),_i,`dBm`]}),Q?.connected&&(()=>{let e=Q.hms_errors?Mt(Q.hms_errors):[];return(0,$.jsxs)(`button`,{onClick:()=>Qe(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${e.length>0?e.some(At)?`bg-status-error/20 text-status-error`:`bg-status-warning/20 text-status-warning`:`bg-status-ok/20 text-status-ok`}`,title:W(`printers.clickToViewHmsErrors`),children:[(0,$.jsx)(Ot,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),e.length>0?e.length:`OK`]})})(),he&&(()=>{let e=Xi(U),t=e===`failure`?`bg-status-error/20 text-status-error`:e===`warning`?`bg-status-warning/20 text-status-warning`:e===`safe`?`bg-status-ok/20 text-status-ok`:e===`error`?`bg-amber-500/20 text-amber-600 dark:text-amber-400`:`bg-bambu-dark-tertiary text-bambu-gray`,n=e===`error`?W(`printers.aiDetection.tooltipError`,{reason:U?.error??W(`printers.aiDetection.error`)}):e===`unknown`?W(`printers.aiDetection.tooltipUnknown`):U?W(`printers.aiDetection.tooltip`,{status:W(`printers.aiDetection.${e}`),score:U.score.toFixed(3)}):W(`printers.aiDetection.tooltipIdle`),r=e===`error`?B:K;return(0,$.jsxs)(`button`,{onClick:()=>et(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${t}`,title:n,children:[(0,$.jsx)(r,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),W(`printers.aiDetection.${e}`)]})})(),n&&(0,$.jsxs)(`button`,{onClick:()=>xe(`/maintenance`),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${n.due_count>0?`bg-status-error/20 text-status-error`:n.warning_count>0?`bg-status-warning/20 text-status-warning`:`bg-status-ok/20 text-status-ok`}`,title:n.due_count>0||n.warning_count>0?`${n.due_count>0?`${n.due_count} maintenance due`:``}${n.due_count>0&&n.warning_count>0?`, `:``}${n.warning_count>0?`${n.warning_count} due soon`:``} - Click to view`:W(`printers.maintenanceUpToDate`),children:[(0,$.jsx)(sr,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),n.due_count>0||n.warning_count>0?n.due_count+n.warning_count:`OK`]}),Ji>0&&(0,$.jsxs)(`button`,{onClick:()=>xe(`/queue`),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs bg-indigo-100 dark:bg-indigo-500/20 text-indigo-700 dark:text-indigo-400 hover:opacity-80 transition-opacity`,title:W(`printers.queue.inQueue`,{count:Ji}),children:[(0,$.jsx)(Hn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),Ji]}),P&&ri?.current_version&&ri?.latest_version?(0,$.jsxs)(`button`,{onClick:()=>Gr(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs hover:opacity-80 transition-opacity ${ri.update_available?`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`:`bg-status-ok/20 text-status-ok`}`,title:ri.update_available?W(`printers.firmwareUpdateAvailable`,{current:ri.current_version,latest:ri.latest_version}):W(`printers.firmwareUpToDate`,{version:ri.current_version}),children:[ri.update_available?(0,$.jsx)(ar,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}):(0,$.jsx)(ne,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),ri.current_version]}):Q?.firmware_version?(0,$.jsx)(`span`,{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs bg-bambu-dark-tertiary/50 text-bambu-gray`,children:Q.firmware_version}):null,Q?.connected&&[`X1C`,`X1`,`X1E`,`X2D`,`P2S`,`H2D`,`H2D Pro`,`H2C`,`H2S`].includes(e.model??``)&&(0,$.jsx)(`span`,{className:`flex items-center px-2 py-1 rounded-full text-xs ${Q.door_open?`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`:`bg-status-ok/20 text-status-ok`}`,title:Q.door_open?W(`printers.door.open`):W(`printers.door.closed`),children:Q.door_open?(0,$.jsx)(x,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}):(0,$.jsx)(g,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]})})]}),Fe&&(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,$.jsx)(Rt,{className:`w-full max-w-md mx-4`,children:(0,$.jsxs)(Lt,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-full bg-red-100 dark:bg-red-500/20`,children:(0,$.jsx)(Ot,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)] text-red-600 dark:text-red-400`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:W(`printers.confirm.deleteTitle`)}),(0,$.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:W(`printers.confirm.deleteMessage`,{name:e.name})})]})]}),(0,$.jsx)(`div`,{className:`bg-bambu-dark rounded-lg p-3 mb-4`,children:(0,$.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:Le,onChange:e=>Re(e.target.checked),className:`mt-0.5 w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] rounded border-bambu-gray bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green focus:ring-offset-0`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-sm text-white`,children:W(`printers.deleteArchives`)}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:W(Le?`printers.confirm.deleteArchivesNote`:`printers.confirm.keepArchivesNote`)})]})]})}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(Y,{variant:`secondary`,onClick:()=>{Ie(!1),Re(!0)},children:W(`common.cancel`)}),(0,$.jsx)(Y,{variant:`danger`,onClick:()=>{Da.mutate({deleteArchives:Le}),Ie(!1),Re(!0)},children:`Delete`})]})]})})}),e.is_active===!1?(0,$.jsx)($.Fragment,{children:r===`compact`?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 px-2 py-1.5 rounded-full bg-amber-50 dark:bg-amber-500/15 border border-amber-300 dark:border-amber-500/30`,children:[(0,$.jsx)(sr,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] text-amber-600 dark:text-amber-400 shrink-0`}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t11,11px)] text-amber-700 dark:text-amber-400 font-medium truncate`,children:W(`printers.maintenance.pillLabel`)})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:W(`printers.status.title`,`Status`)}),(0,$.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`})]}),(0,$.jsxs)(`div`,{className:`p-3 bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 rounded-[10px] flex items-center gap-3`,children:[(0,$.jsx)(sr,{className:`w-6 h-6 text-amber-600 dark:text-amber-400 shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm text-amber-700 dark:text-amber-400 font-medium`,children:W(`printers.maintenance.title`)}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:W(`printers.maintenance.subtitle`)})]}),(0,$.jsx)(Y,{variant:`secondary`,size:`sm`,disabled:Io.isPending||!J(`printers:update`),onClick:()=>Io.mutate(!0),title:J(`printers:update`)?void 0:W(`printers.permission.noEdit`),children:W(`printers.maintenance.exitButton`)})]})]})}):Q?.connected&&(0,$.jsxs)($.Fragment,{children:[r===`compact`?(()=>{let e=Q.hms_errors?Mt(Q.hms_errors):[],t=Q.state===`FAILED`||e.length>0,n=Q.state===`RUNNING`||Q.state===`PAUSE`?Math.max(0,Math.min(100,Q.progress||0)):la||t?100:0,r=Q.state===`RUNNING`||Q.state===`PAUSE`,i=t?`bg-status-error`:Q.state===`PAUSE`?`bg-status-warning`:`bg-bambu-green`,a=r&&Q.remaining_time!=null&&Q.remaining_time>0,o=r&&Q.layer_num!=null&&Q.total_layers!=null&&Q.total_layers>0;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`relative mt-2 flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-bambu-dark-tertiary`,children:(0,$.jsx)(`div`,{className:`${i} h-1.5 rounded-full transition-all`,style:{width:`${n}%`}})}),(0,$.jsx)(`span`,{className:`w-9 shrink-0 text-right text-[length:var(--pc-t11,11px)] leading-none ${r?`text-white`:`text-bambu-gray`}`,children:r?`${Math.round(n)}%`:`---%`})]}),(0,$.jsxs)(`div`,{className:`mt-1 flex min-h-[14px] items-center gap-2 overflow-hidden text-[length:var(--pc-t11,11px)] leading-none text-bambu-gray`,children:[a&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(vn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),Ut(Q.remaining_time*60)]}),(0,$.jsxs)(`span`,{className:`shrink-0 font-medium text-bambu-green`,title:W(`printers.estimatedCompletion`),children:[`ETA `,Vt(Q.remaining_time,O,W)]})]}),o&&(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 truncate`,children:[(0,$.jsx)(Hn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] shrink-0`}),Q.layer_num,`/`,Q.total_layers]})]})]})})():(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:W(`printers.status.title`,`Status`)}),(0,$.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`})]}),(()=>{let t=!!(Q.current_print&&(Q.state===`RUNNING`||Q.state===`PAUSE`)),n=!t&&sa&&ga,r=t?ha:n?ga.name:null,i=t?Q.cover_url:n?ga.coverUrl:null,a=t?Q.progress||0:n?100:0,o=Q.printable_objects_count??0,s=t&&o!==1&&J(`printers:control`);return(0,$.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded-[10px] relative overflow-hidden`,children:[(0,$.jsxs)(`button`,{onClick:()=>Ct(!0),disabled:!s,className:`absolute top-2 right-2 p-1.5 rounded transition-colors z-10 ${s?`text-bambu-gray hover:text-white hover:bg-white/10`:`text-bambu-gray/30 cursor-not-allowed`}`,title:J(`printers:control`)?W(t?o===1?`printers.skipObjects.requiresMultiple`:`printers.skipObjects.tooltip`:`printers.skipObjects.onlyWhilePrinting`):W(`printers.permission.noControl`),children:[(0,$.jsx)(ve,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),Vo&&Vo.skipped_count>0&&(0,$.jsx)(`span`,{className:`absolute -top-1 -right-1 min-w-[16px] h-4 px-1 flex items-center justify-center text-[length:var(--pc-t10,10px)] font-bold bg-red-500 text-white rounded-full`,children:Vo.skipped_count})]}),(0,$.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,$.jsx)(eo,{url:i,printName:r||void 0,className:`w-24 h-24 max-[520px]:w-20 max-[520px]:h-20`}),(0,$.jsxs)(`div`,{className:`flex h-24 max-[520px]:h-20 min-w-0 flex-1 flex-col justify-between pt-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-[18px] items-center gap-2 pr-8`,children:[(0,$.jsx)(`p`,{className:`min-w-0 truncate text-sm text-bambu-gray`,children:uo(Q.state,Q.stg_cur_name)}),Ta]}),(0,$.jsx)(`p`,{className:`min-h-[18px] truncate pr-8 text-sm ${r?`text-white`:`text-bambu-gray/70`}`,children:r||W(`printers.noActiveJob`,`No active job`)}),(0,$.jsxs)(`div`,{className:`flex h-3 items-center gap-2 text-sm`,children:[(0,$.jsx)(`div`,{className:`h-1.5 min-w-0 flex-1 rounded-full bg-bambu-dark-tertiary`,children:(0,$.jsx)(`div`,{className:`${t?Q.state===`PAUSE`?`bg-status-warning`:`bg-bambu-green`:n?`bg-bambu-green`:`bg-bambu-dark-tertiary`} h-1.5 rounded-full transition-all`,style:{width:`${a}%`}})}),(0,$.jsx)(`span`,{className:`w-9 shrink-0 pr-1 text-right text-[length:var(--pc-t11,11px)] leading-none ${t||n?`text-white`:`text-bambu-gray`}`,children:t||n?`${Math.round(a)}%`:`---%`})]}),(0,$.jsx)(`div`,{className:`flex min-h-[16px] items-center gap-2 text-xs text-bambu-gray`,children:t?(0,$.jsxs)($.Fragment,{children:[Q.remaining_time!=null&&Q.remaining_time>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(vn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),Ut(Q.remaining_time*60)]}),(0,$.jsxs)(`span`,{className:`text-bambu-green font-medium`,title:W(`printers.estimatedCompletion`),children:[`ETA `,Vt(Q.remaining_time,O,W)]})]}),Q.layer_num!=null&&Q.total_layers!=null&&Q.total_layers>0&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(Hn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),Q.layer_num,`/`,Q.total_layers]}),ra&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,title:`Started by ${ra}`,children:[(0,$.jsx)(yn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),ra]})]}):ia?(0,$.jsxs)(`p`,{className:`truncate`,title:ia.print_name||ia.filename,children:[`Last: `,ia.print_name||ia.filename,ia.completed_at&&(0,$.jsxs)(`span`,{className:`ml-1 text-bambu-gray/60`,children:[`• `,Ht(ia.completed_at,{month:`short`,day:`numeric`})]})]}):(0,$.jsx)(`span`,{children:W(`printers.readyToPrint`)})})]})]}),(0,$.jsx)($i,{printerId:e.id,printerModel:e.model,loadedFilamentTypes:ai,loadedFilaments:oi,loadedVariants:si,variant:`panelExtension`})]})})()]}),Q.temperatures&&r===`expanded`&&(()=>{let t=Q.temperatures.nozzle_heating||Q.temperatures.nozzle_2_heating||!1,n=Q.temperatures.bed_heating||!1,r=Q.temperatures.chamber_heating||!1,i=e.nozzle_count===2||Q.temperatures.nozzle_2!==void 0,a=(()=>{let e=[`nozzle`];return Q.temperatures.nozzle_2!==void 0&&e.push(`nozzle_2`),e.push(`bed`),Q.temperatures.chamber!==void 0&&e.push(`chamber`),e})(),o=Q.active_extruder===1?`L`:`R`,s=Q.nozzle_rack?.find(e=>e.id===1),c=Q.nozzle_rack?.find(e=>e.id===0),l=c||s,u=Q.connected&&J(`printers:control`),d=u?void 0:W(`printers.permission.noControl`),f=`relative text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center transition-colors ${u?`cursor-pointer hover:bg-bambu-dark-tertiary`:`cursor-default opacity-80`}`,p=fo.has(e.model??``),m=po.has(e.model??``),h=W(m?`printers.fans.exhaust`:`printers.fans.chamber`),g=p&&(!m||Q.exhaust_fan_present),_=[{key:`part`,label:W(`printers.fans.partCooling`),value:Q.cooling_fan_speed??0,Icon:N,activeClass:`text-cyan-600 dark:text-cyan-400`},...Q.left_aux_fan_speed==null?[]:[{key:`aux2`,label:W(`printers.fans.leftAuxiliary`),value:Q.left_aux_fan_speed,Icon:Ne,activeClass:`text-indigo-600 dark:text-indigo-400`}],{key:`aux`,label:W(`printers.fans.auxiliary`),value:Q.big_fan1_speed??0,Icon:Ne,activeClass:`text-blue-600 dark:text-blue-400`},...g?[{key:`chamber`,label:h,value:Q.big_fan2_speed??0,Icon:xr,activeClass:`text-green-600 dark:text-green-400`}]:[]];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`mt-2 flex items-stretch gap-1.5 flex-wrap`,children:[(0,$.jsxs)(`div`,{className:f,title:d,onClick:()=>u&&_t(gt===`nozzle-temp`?null:`nozzle-temp`),children:[(0,$.jsx)(`button`,{type:`button`,className:`absolute top-0.5 right-0.5 p-0.5 rounded text-bambu-gray hover:text-white hover:bg-white/10 transition-colors`,title:W(`printers.heaterHistory.openLabel`,`View heater history`),onClick:e=>{e.stopPropagation(),Lr({initialKind:`nozzle`,availableKinds:a})},children:(0,$.jsx)(Sr,{className:`w-[var(--pc-i25,0.625rem)] h-[var(--pc-i25,0.625rem)]`})}),(0,$.jsx)(Ja,{className:`w-[var(--pc-i35,0.875rem)] h-[var(--pc-i35,0.875rem)] mb-0.5`,color:`text-orange-400`,isHeating:t}),Q.temperatures.nozzle_2===void 0?l?(0,$.jsx)(Ra,{slot:l,index:0,activeStatus:!0,filamentName:l.filament_id?ci?.[l.filament_id]?.name:void 0,children:(0,$.jsxs)(`div`,{className:`cursor-default`,children:[(0,$.jsx)(`p`,{className:`text-[length:var(--pc-t9,9px)] text-bambu-gray`,children:W(`printers.temperatures.nozzle`)}),(0,$.jsxs)(`p`,{className:`text-[length:var(--pc-t11,11px)] text-white`,children:[Math.round(Q.temperatures.nozzle||0),`°C`]})]})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-[length:var(--pc-t9,9px)] text-bambu-gray`,children:W(`printers.temperatures.nozzle`)}),(0,$.jsxs)(`p`,{className:`text-[length:var(--pc-t11,11px)] text-white`,children:[Math.round(Q.temperatures.nozzle||0),`°C`]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-[length:var(--pc-t9,9px)] text-bambu-gray`,children:`L / R`}),(0,$.jsxs)(`p`,{className:`text-[length:var(--pc-t11,11px)] text-white`,children:[Math.round(Q.temperatures.nozzle||0),`° / `,Math.round(Q.temperatures.nozzle_2||0),`°`]})]}),gt===`nozzle-temp`&&(i?(0,$.jsx)(io,{title:`Set Nozzle Temperatures`,widthClass:`w-[300px]`,popoverWidth:300,popoverHeight:260,isPending:Co.isPending,onClose:()=>_t(null),children:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 px-3 py-2.5`,children:[(0,$.jsx)(oo,{label:`Left Temp`,current:Q.temperatures.nozzle,target:Q.temperatures.nozzle_target,isActive:o===`L`,isPending:Co.isPending,onSubmit:e=>Co.mutate({target:e,nozzle:1}),options:Te(se,`C`)}),(0,$.jsx)(oo,{label:`Right Temp`,current:Q.temperatures.nozzle_2,target:Q.temperatures.nozzle_2_target,isActive:o===`R`,isPending:Co.isPending,onSubmit:e=>Co.mutate({target:e,nozzle:0}),options:Te(se,`C`)})]})}):(0,$.jsx)(io,{title:`Set Nozzle Temperature`,unit:`°C`,customMin:0,customMax:320,isPending:Co.isPending,options:Te(se,`C`),onClose:()=>_t(null),onSubmit:e=>Co.mutate({target:e,nozzle:Q.active_extruder??0})}))]}),(0,$.jsxs)(`div`,{className:f,title:d,onClick:()=>u&&_t(gt===`bed-temp`?null:`bed-temp`),children:[(0,$.jsx)(`button`,{type:`button`,className:`absolute top-0.5 right-0.5 p-0.5 rounded text-bambu-gray hover:text-white hover:bg-white/10 transition-colors`,title:W(`printers.heaterHistory.openLabel`,`View heater history`),onClick:e=>{e.stopPropagation(),Lr({initialKind:`bed`,availableKinds:a})},children:(0,$.jsx)(Sr,{className:`w-[var(--pc-i25,0.625rem)] h-[var(--pc-i25,0.625rem)]`})}),(0,$.jsx)(Ja,{className:`w-[var(--pc-i35,0.875rem)] h-[var(--pc-i35,0.875rem)] mb-0.5`,color:`text-blue-400`,isHeating:n}),(0,$.jsx)(`p`,{className:`text-[length:var(--pc-t9,9px)] text-bambu-gray`,children:W(`printers.temperatures.bed`)}),(0,$.jsxs)(`p`,{className:`text-[length:var(--pc-t11,11px)] text-white`,children:[Math.round(Q.temperatures.bed||0),`°C`]}),gt===`bed-temp`&&(0,$.jsx)(io,{title:`Set Bed Temperature`,unit:`°C`,customMin:0,customMax:140,isPending:wo.isPending,options:Te(le,`C`),onClose:()=>_t(null),onSubmit:e=>wo.mutate(e)})]}),Q.temperatures.chamber!==void 0&&(()=>{let e=Q.supports_chamber_heater===!0;return(0,$.jsxs)(`div`,{className:e?f:`relative text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center`,title:e?d:void 0,onClick:e?()=>u&&_t(gt===`chamber-temp`?null:`chamber-temp`):void 0,children:[(0,$.jsx)(`button`,{type:`button`,className:`absolute top-0.5 right-0.5 p-0.5 rounded text-bambu-gray hover:text-white hover:bg-white/10 transition-colors`,title:W(`printers.heaterHistory.openLabel`,`View heater history`),onClick:e=>{e.stopPropagation(),Lr({initialKind:`chamber`,availableKinds:a})},children:(0,$.jsx)(Sr,{className:`w-[var(--pc-i25,0.625rem)] h-[var(--pc-i25,0.625rem)]`})}),(0,$.jsx)(Ja,{className:`w-[var(--pc-i35,0.875rem)] h-[var(--pc-i35,0.875rem)] mb-0.5`,color:`text-green-400`,isHeating:r}),(0,$.jsx)(`p`,{className:`text-[length:var(--pc-t9,9px)] text-bambu-gray`,children:W(`printers.temperatures.chamber`)}),(0,$.jsxs)(`p`,{className:`text-[length:var(--pc-t11,11px)] text-white`,children:[Math.round(Q.temperatures.chamber||0),`°C`]}),e&>===`chamber-temp`&&(0,$.jsx)(io,{title:`Set Chamber Temperature`,unit:`°C`,customMin:0,customMax:65,isPending:To.isPending,options:Te(de,`C`),onClose:()=>_t(null),onSubmit:e=>To.mutate(e)})]})})(),i&&(0,$.jsx)(za,{leftSlot:s,rightSlot:c,activeNozzle:o,filamentInfo:ci,children:(0,$.jsxs)(`div`,{className:`relative text-center px-3 py-1.5 bg-bambu-dark rounded-lg h-full flex flex-col justify-center items-center transition-colors ${u?`cursor-pointer hover:bg-bambu-dark-tertiary`:`cursor-default opacity-80`}`,title:u?W(`printers.activeNozzle`,{nozzle:W(o===`L`?`common.left`:`common.right`)}):d,onClick:()=>u&&_t(gt===`nozzle-select`?null:`nozzle-select`),children:[(0,$.jsx)(qa,{className:`w-[var(--pc-i35,0.875rem)] h-[var(--pc-i35,0.875rem)] mb-0.5 text-amber-600 dark:text-amber-400`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-[length:var(--pc-t11,11px)] font-bold ${o===`L`?`text-amber-700 dark:text-amber-400`:`text-gray-500`}`,children:[`L`,s?.nozzle_diameter?` ${s.nozzle_diameter}`:``]}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t9,9px)] text-bambu-gray/40`,children:`·`}),(0,$.jsxs)(`span`,{className:`text-[length:var(--pc-t11,11px)] font-bold ${o===`R`?`text-amber-700 dark:text-amber-400`:`text-gray-500`}`,children:[`R`,c?.nozzle_diameter?` ${c.nozzle_diameter}`:``]})]}),(0,$.jsx)(`p`,{className:`text-[length:var(--pc-t9,9px)] text-bambu-gray`,children:W(`printers.temperatures.nozzle`)}),gt===`nozzle-select`&&(0,$.jsx)(io,{title:`Set Nozzle Selection`,widthClass:`w-[300px]`,popoverWidth:300,popoverHeight:140,isPending:Do.isPending,options:[{label:`Left`,value:1},{label:`Right`,value:0}],onClose:()=>_t(null),onSubmit:e=>Do.mutate(e)})]})}),Q.nozzle_rack&&Q.nozzle_rack.some(e=>e.id>=2)&&(0,$.jsx)(Ba,{slots:Q.nozzle_rack,filamentInfo:ci})]}),(0,$.jsx)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:_.map(({key:e,label:t,value:n,Icon:r,activeClass:i})=>{let a=n>0;return(0,$.jsxs)(`div`,{className:`relative px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 min-w-0 flex items-center justify-center gap-1 transition-colors ${u?`cursor-pointer hover:bg-bambu-dark-tertiary`:`cursor-default opacity-80`}`,title:u?t:d,onClick:()=>u&&_t(gt===`fan-${e}`?null:`fan-${e}`),children:[(0,$.jsx)(r,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] shrink-0 ${a?i:`text-bambu-gray/50`}`}),(0,$.jsxs)(`span`,{className:`text-[length:var(--pc-t10,10px)] leading-none ${a?`text-white`:`text-bambu-gray/50`}`,children:[n,`%`]}),gt===`fan-${e}`&&(0,$.jsx)(io,{title:`Set ${t} Speed`,unit:`%`,customMin:0,customMax:100,isPending:Eo.isPending,options:Te(pe,`%`),onClose:()=>_t(null),onSubmit:t=>Eo.mutate({fan:e,speed:t})})]},e)})})]})})(),r===`expanded`&&la&&bo,r===`expanded`&&(()=>{let t=Q.state===`RUNNING`,n=Q.state===`PAUSE`,r=t||n,i=to.isPending||ro.isPending||ao.isPending,a=`bg-bambu-dark text-bambu-gray/50 cursor-not-allowed opacity-50`,o=`flex h-8 w-8 items-center justify-center rounded-lg text-xs font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,s=`flex h-8 w-20 items-center justify-center gap-1 px-2 rounded-lg text-xs font-medium transition-colors`;return(0,$.jsxs)(`div`,{className:`mt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:W(`printers.controls`)}),(0,$.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-2 gap-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0`,children:[(0,$.jsx)(`button`,{onClick:()=>Oo.mutate(!Q.chamber_light),disabled:!Q.connected||Oo.isPending||!J(`printers:control`),className:`${o} ${Q.chamber_light?`bg-yellow-50 dark:bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 hover:bg-yellow-500/20`:`bg-bambu-dark text-bambu-gray/50 hover:bg-bambu-dark-tertiary hover:text-white`}`,title:J(`printers:control`)?Q.chamber_light?W(`printers.chamberLightOff`):W(`printers.chamberLightOn`):W(`printers.permission.noControl`),children:(0,$.jsx)(_e,{on:Q.chamber_light??!1,className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),[`P2S`,`X2D`,`H2D`,`H2C`,`H2S`].includes(e.model??``)&&(()=>{let t=Q.airduct_mode===1,n=t?Bn:jr,r=t?`text-orange-600 dark:text-orange-400`:`text-sky-600 dark:text-sky-400`,i=t?`bg-orange-50 dark:bg-orange-500/10 text-orange-700 dark:text-orange-400 hover:bg-orange-500/20`:`bg-sky-50 dark:bg-sky-500/10 text-sky-700 dark:text-sky-400 hover:bg-sky-500/20`;return(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`button`,{onClick:()=>pt(ft===e.id?null:e.id),disabled:!J(`printers:control`),className:`${o} ${i}`,title:`${W(`printers.airduct.title`)}: ${W(t?`printers.airduct.heating`:`printers.airduct.cooling`)}`,children:(0,$.jsx)(n,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] ${r}`})}),ft===e.id&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-40`,onClick:()=>pt(null)}),(0,$.jsx)(`div`,{className:`absolute bottom-full left-0 mb-1 z-50 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg py-1 min-w-[130px]`,children:[{mode:`cooling`,label:W(`printers.airduct.cooling`),modeId:0},{mode:`heating`,label:W(`printers.airduct.heating`),modeId:1}].map(({mode:e,label:t,modeId:n})=>(0,$.jsxs)(`button`,{onClick:()=>{Ao.mutate(e),pt(null)},className:`w-full text-left px-3 py-1.5 text-xs transition-colors flex items-center gap-2 ${Q.airduct_mode===n?`text-bambu-green bg-bambu-green/10`:`text-white hover:bg-bambu-dark-tertiary`}`,children:[e===`heating`?(0,$.jsx)(Bn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}):(0,$.jsx)(jr,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),t]},e))})]})]})})(),(()=>{let t=J(`printers:control`),n=r||!t,i=`flex h-8 w-8 items-center justify-center rounded bg-indigo-100 dark:bg-indigo-500/15 text-indigo-700 dark:text-indigo-300 transition-colors hover:bg-indigo-200 dark:hover:bg-indigo-500/30 disabled:cursor-not-allowed disabled:opacity-50`,a=bi(e.model),s=e=>{let t=a?e===`up`:e===`down`;jo.mutate({distance:t?vt:-vt})},c=(e,t)=>{Mo.mutate({x:e,y:t})},l=e=>{No.mutate(e)};return(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`button`,{onClick:()=>ht(mt===e.id?null:e.id),disabled:n,className:`${o} ${n?`bg-bambu-dark text-bambu-gray/50 cursor-not-allowed`:`bg-indigo-50 dark:bg-indigo-500/10 text-indigo-700 dark:text-indigo-400 hover:bg-indigo-500/20`}`,title:W(t?r?`printers.bedJog.disabledWhilePrinting`:`printers.bedJog.title`:`printers.permission.noControl`),children:(0,$.jsx)(Ee,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),mt===e.id&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-40`,onClick:()=>ht(null)}),(0,$.jsxs)(`div`,{className:`absolute bottom-full left-0 mb-1 z-50 flex w-[216px] flex-col overflow-hidden rounded-xl border border-bambu-dark-tertiary bg-bambu-dark-secondary shadow-2xl`,children:[(0,$.jsx)(`div`,{className:`shrink-0 px-3 py-2.5 text-center text-sm font-medium text-white`,children:W(`printers.bedJog.title`)}),(0,$.jsx)(`div`,{className:`h-px bg-bambu-dark-tertiary`}),(0,$.jsxs)(`div`,{className:`flex items-start gap-1.5 bg-yellow-500/10 px-3 py-2 text-[length:var(--pc-t11,11px)] leading-snug text-yellow-700 dark:text-yellow-400`,children:[(0,$.jsx)(Ot,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,$.jsx)(`span`,{children:W(`printers.bedJog.limitWarning`)})]}),(0,$.jsx)(`div`,{className:`h-px bg-bambu-dark-tertiary`}),(0,$.jsx)(`div`,{className:`flex justify-center px-3 py-2.5`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-3 gap-1`,children:[(0,$.jsx)(`div`,{}),(0,$.jsx)(`button`,{onClick:()=>c(0,vt),disabled:Mo.isPending,className:i,"aria-label":`Move Y forward`,children:(0,$.jsx)(E,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`div`,{}),(0,$.jsx)(`button`,{onClick:()=>c(-vt,0),disabled:Mo.isPending,className:i,"aria-label":`Move X left`,children:(0,$.jsx)(C,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`button`,{onClick:()=>{ht(null),Po.mutate(`all`)},disabled:Po.isPending,className:i,"aria-label":W(`printers.bedJog.homeZ`),children:(0,$.jsx)(Kn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`button`,{onClick:()=>c(vt,0),disabled:Mo.isPending,className:i,"aria-label":`Move X right`,children:(0,$.jsx)(w,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`div`,{}),(0,$.jsx)(`button`,{onClick:()=>c(0,-vt),disabled:Mo.isPending,className:i,"aria-label":`Move Y back`,children:(0,$.jsx)(S,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`div`,{})]}),(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,$.jsx)(`button`,{onClick:()=>s(`up`),disabled:jo.isPending,className:i,"aria-label":W(a?`printers.bedJog.toolheadUp`:`printers.bedJog.up`),children:(0,$.jsx)(E,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center text-bambu-gray/80`,children:(0,$.jsx)(Hn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`button`,{onClick:()=>s(`down`),disabled:jo.isPending,className:i,"aria-label":W(a?`printers.bedJog.toolheadDown`:`printers.bedJog.down`),children:(0,$.jsx)(S,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,$.jsx)(`button`,{onClick:()=>l(-vt),disabled:No.isPending,className:i,"aria-label":`Retract filament`,children:(0,$.jsx)(E,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center text-bambu-gray/80`,children:(0,$.jsx)(`span`,{className:`text-sm font-semibold leading-none`,children:`E`})}),(0,$.jsx)(`button`,{onClick:()=>l(vt),disabled:No.isPending,className:i,"aria-label":`Extrude filament`,children:(0,$.jsx)(S,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})})]})]})}),(0,$.jsx)(`div`,{className:`h-px bg-bambu-dark-tertiary`}),(0,$.jsxs)(`div`,{className:`px-3 pt-2.5 pb-3`,children:[(0,$.jsx)(`div`,{className:`mb-1 text-[length:var(--pc-t9,9px)] uppercase tracking-wider text-bambu-gray/70`,children:W(`printers.bedJog.step`)}),(0,$.jsx)(`div`,{className:`flex gap-1`,children:[1,10,50].map(e=>(0,$.jsx)(`button`,{onClick:()=>yt(e),className:`flex-1 px-1 py-1 rounded text-[length:var(--pc-t10,10px)] transition-colors ${vt===e?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:e},e))})]})]})]})]})})(),(0,$.jsxs)(`div`,{className:`inline-flex rounded-lg ${e.plate_detection_enabled?`ring-1 ring-green-500`:``}`,children:[(0,$.jsx)(`button`,{onClick:as,disabled:!Q.connected||Fo.isPending||!J(`printers:update`),className:`${o} rounded-r-none ${e.plate_detection_enabled?`bg-green-50 dark:bg-green-500/10 text-green-700 dark:text-green-400 hover:bg-green-500/20`:`bg-bambu-dark text-bambu-gray/50 hover:bg-bambu-dark-tertiary hover:text-white`}`,title:J(`printers:update`)?e.plate_detection_enabled?W(`printers.plateDetection.enabledClick`):W(`printers.plateDetection.disabledClick`):W(`printers.plateDetection.noPermission`),children:Fo.isPending?(0,$.jsx)(H,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] animate-spin`}):(0,$.jsx)(ce,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`button`,{onClick:os,disabled:!Q.connected||qr||!J(`printers:update`),className:`flex h-8 w-8 items-center justify-center rounded-r-lg border-l border-bambu-dark-tertiary transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${e.plate_detection_enabled?`bg-green-50 dark:bg-green-500/10 text-green-700 dark:text-green-400 hover:bg-green-500/20`:`bg-bambu-dark text-bambu-gray/50 hover:bg-bambu-dark-tertiary hover:text-white`}`,title:J(`printers:update`)?W(`printers.plateDetection.manageCalibration`):W(`printers.plateDetection.noPermission`),children:qr?(0,$.jsx)(H,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] animate-spin`}):(0,$.jsx)(I,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`button`,{"data-testid":`speed-control`,onClick:()=>dt(ut===e.id?null:e.id),disabled:!r||!J(`printers:control`),className:`${o} ${r?`bg-amber-50 dark:bg-amber-500/10 text-amber-700 dark:text-amber-400 hover:bg-amber-500/20`:`bg-bambu-dark text-bambu-gray/50 cursor-not-allowed`}`,title:r?W(`printers.speed.title`):void 0,children:(0,$.jsx)(ue,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),ut===e.id&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-40`,onClick:()=>dt(null)}),(0,$.jsx)(`div`,{className:`absolute bottom-full left-0 mb-1 z-50 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg py-1 min-w-[130px]`,children:[{mode:1,label:W(`printers.speed.silent`)},{mode:2,label:W(`printers.speed.standard`)},{mode:3,label:W(`printers.speed.sport`)},{mode:4,label:W(`printers.speed.ludicrous`)}].map(({mode:e,label:t})=>(0,$.jsx)(`button`,{onClick:()=>{ko.mutate(e),dt(null)},className:`w-full text-left px-3 py-1.5 text-xs transition-colors ${Q.speed_level===e?`text-bambu-green bg-bambu-green/10`:`text-white hover:bg-bambu-dark-tertiary`}`,children:t},e))})]})]})]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center justify-end gap-2 flex-shrink-0`,children:[(()=>{let e=!r||i||!J(`printers:control`);return(0,$.jsxs)(`button`,{onClick:()=>n?xt(!0):lt(!0),disabled:e,className:` + ${s} + ${e?a:n?`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30`:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 hover:bg-yellow-500/30`} + `,title:J(`printers:control`)?W(n?`printers.resume`:`printers.pause`):W(`printers.permission.noControl`),children:[n?(0,$.jsx)(ke,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}):(0,$.jsx)(Oe,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),W(n?`printers.resume`:`printers.pause`)]})})(),(()=>{let e=!r||i||!J(`printers:control`);return(0,$.jsxs)(`button`,{onClick:()=>st(!0),disabled:e,className:` + ${s} + ${e?a:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 hover:bg-red-500/30`} + `,title:J(`printers:control`)?W(`printers.stop`):W(`printers.permission.noControl`),children:[(0,$.jsx)(fn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`}),W(`printers.stop`)]})})()]})]})]})})(),(Mi?.length>0||Q.vt_tray.length>0)&&r===`expanded`&&(()=>{let t=Mi.filter(e=>e.tray.length>1),n=Mi.filter(e=>e.tray.length===1),r=Mi.length>0&&Q.vt_tray.length>0,i=!(r&&rt),a=e.nozzle_count===2||Q?.temperatures?.nozzle_2!==void 0,l=go[o]??1,f=e=>`${Math.round(e*l*1e3)/1e3}rem`,p=`3.5rem`,m={minWidth:p},g={minWidth:p,maxWidth:f(7.25)},x=e=>({gridTemplateColumns:`repeat(${e}, minmax(${p}, 1fr))`}),S=(Q.state===`RUNNING`||Q.state===`PAUSE`)&&Array.isArray(Q.ams_mapping)?Q.ams_mapping:[],C=e=>{let t=Math.max(1,e),n=`calc(${t} * ${p} + ${Math.max(0,t-1)} * 0.25rem + 1rem)`;return{flex:`1 1 ${n}`,minWidth:n}};return(0,$.jsxs)(`div`,{className:`mt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:W(`printers.filaments`)}),(0,$.jsx)(Ya,{state:Q.ams_filament_backup,onClick:()=>nt(!0)}),(0,$.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`}),r&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Xa,{hidden:rt,onClick:at}),(0,$.jsx)(`div`,{className:`w-3 h-[2px] bg-bambu-dark-tertiary`})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.map(t=>{let n=Fa(t.id,wi,Oi,Ei);return(0,$.jsxs)(`div`,{style:C(4),className:`min-w-0 p-2 bg-bambu-dark rounded-[10px] space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex w-full min-h-7 items-center justify-between gap-2 rounded-lg bg-bambu-dark-secondary px-2 py-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,$.jsx)(mo,{ams:t,printerId:e.id,label:Cn(t.id,t.tray.length),amsLabels:pi,canEdit:J(`printers:update`),onSaved:mi,children:(0,$.jsx)(`span`,{className:`block truncate text-[length:var(--pc-t10,10px)] text-white font-medium cursor-default select-none`,children:pi?.[t.id]||Cn(t.id,t.tray.length)})}),n?.kind===`inlet`?(0,$.jsx)(Pa,{inlet:n.inlet,title:W(`printers.amsSwitchInletTooltip`,{inlet:n.inlet,side:ur[n.inlet]})}):a&&n?.kind===`nozzle`?(0,$.jsx)(Na,{side:n.side}):null]}),(t.humidity!=null||t.temp!=null)&&(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[t.humidity!=null&&(0,$.jsx)(Za,{humidity:t.humidity,goodThreshold:s?.humidityGood,fairThreshold:s?.humidityFair,onClick:()=>Fr({amsId:t.id,amsLabel:Cn(t.id,t.tray.length),mode:`humidity`}),compact:!0}),t.temp!=null&&(0,$.jsx)(`div`,{className:`mr-1`,children:(0,$.jsx)(Qa,{temp:t.temp,goodThreshold:s?.tempGood,fairThreshold:s?.tempFair,onClick:()=>Fr({amsId:t.id,amsLabel:Cn(t.id,t.tray.length),mode:`temperature`}),compact:!0})}),(Q.supports_drying||Q.drying_screen_only)&&(t.module_type===`n3f`||t.module_type===`n3s`)&&J(`printers:control`)&&(0,$.jsx)(`button`,{disabled:Q.drying_screen_only||!!(t.dry_sf_reason?.length&&t.dry_time===0),onClick:e=>{t.dry_time>0?Ha.mutate(t.id):Gt===t.id?Kt(null):ir(t,e.currentTarget)},className:`ml-1 flex items-center gap-0.5 px-1 py-0.5 rounded text-[length:var(--pc-t9,9px)] transition-colors ${t.dry_time>0?`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`:Q.drying_screen_only||t.dry_sf_reason?.length?`bg-bambu-dark text-bambu-gray/50 cursor-not-allowed`:`bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark/80`}`,title:Q.drying_screen_only?W(`printers.drying.screenOnly`):t.dry_time>0?W(`printers.drying.stop`):t.dry_sf_reason?.length?W(Oa(t.dry_sf_reason)):W(`printers.drying.start`),children:(0,$.jsx)(Bn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]})]}),t.dry_time>0&&t.dry_countdown_stalled&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-slate-100 dark:bg-slate-500/10 px-2 py-1 text-[length:var(--pc-t9,9px)]`,title:W(`printers.drying.notRunningHint`),children:[(0,$.jsx)(Tr,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] text-slate-500 dark:text-slate-400 shrink-0`}),(0,$.jsx)(`span`,{className:`text-slate-600 dark:text-slate-300 font-medium`,children:W(`printers.drying.notRunning`)}),t.dry_filament&&(0,$.jsx)(`span`,{className:`text-slate-500/90 dark:text-slate-400/80`,children:t.dry_target_temp==null?t.dry_filament:W(`printers.drying.targetSummary`,{filament:t.dry_filament,temp:t.dry_target_temp})}),!Q.drying_screen_only&&(0,$.jsx)(`button`,{onClick:()=>Ha.mutate(t.id),disabled:Ha.isPending,className:`ml-auto text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200 transition-colors disabled:opacity-50`,title:W(`printers.drying.stop`),children:(0,$.jsx)(Pt,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]}),t.dry_time>0&&!t.dry_countdown_stalled&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-amber-50 dark:bg-amber-500/10 px-2 py-1 text-[length:var(--pc-t9,9px)]`,children:[(0,$.jsx)(Bn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] text-amber-600 dark:text-amber-400 shrink-0`}),(0,$.jsx)(`span`,{className:`text-amber-700 dark:text-amber-400 font-medium`,children:W(`printers.drying.active`)}),t.dry_filament&&(0,$.jsx)(`span`,{className:`text-amber-700/80 dark:text-amber-300/70`,children:t.dry_target_temp==null?t.dry_filament:W(`printers.drying.targetSummary`,{filament:t.dry_filament,temp:t.dry_target_temp})}),(0,$.jsx)(`span`,{className:`text-amber-700/80 dark:text-amber-300/70`,children:W(`printers.drying.timeRemaining`,{time:t.dry_time>=60?`${Math.floor(t.dry_time/60)}h ${t.dry_time%60}m`:`${t.dry_time}m`})}),!Q.drying_screen_only&&(0,$.jsx)(`button`,{onClick:()=>Ha.mutate(t.id),disabled:Ha.isPending,className:`ml-auto text-amber-700 dark:text-amber-400 hover:text-amber-900 dark:hover:text-amber-300 transition-colors disabled:opacity-50`,title:W(`printers.drying.stop`),children:(0,$.jsx)(Pt,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]}),(0,$.jsx)(`div`,{className:`grid w-full gap-1`,style:x(4),children:[0,1,2,3].map(n=>{let r=t.tray[n]||t.tray.find(e=>e.id===n),i=r?.tray_type&&r.remain>=0,a=!r?.tray_type,o=Dn(r),s=t.id*4+n,l=Ri===s,f=zi!==null&&zi===s,p=Bi!==null&&Bi===s,g=r?.tray_info_idx?ci?.[r.tray_info_idx]:null,x=li?.[s],C=er(x?.preset_id,r?.tray_info_idx,x?.tray_info_idx)?x?.preset_name:void 0,w=(r?.tray_uuid||r?.tag_uid||on(e.serial_number,t.id,n))?.toUpperCase(),E=w?u?.[w]:void 0,O=cn(E),k=c&&!T?b?.find(r=>r.printer_id===e.id&&r.ams_id===t.id&&r.tray_id===n):void 0,A=k?y?.find(e=>e.id===k.spoolman_spool_id):void 0,j=A&&(A.label_weight??0)>0?Math.round(Math.max(0,(A.label_weight??0)-A.weight_used)/(A.label_weight??1)*100):null,M=_?.(e.id,t.id,n),N=(()=>{let e=M?.spool;return e&&e.label_weight>0&&e.weight_used!=null?Math.round(Math.max(0,e.label_weight-e.weight_used)/e.label_weight*100):null})(),P=N===0&&i&&r.remain>0?null:N,F=O??j??P??(i?r.remain:null),I=O!==null||j!==null?`spoolman`:P===null?i?`ams`:void 0:`inventory`,L=r?.tray_type?{vendor:kn(r)?`Bambu Lab`:`Generic`,profile:C||(A?[A.brand,A.slicer_filament_name?.split(`@`)[0].trim()||A.material].filter(Boolean).join(` `).trim():null)||M?.spool?.slicer_filament_name||g?.name||r.tray_sub_brands||r.tray_type,colorName:Un(r.tray_color||``,r.tray_sub_brands),colorHex:r.tray_color||null,kFactor:ja(r.k),fillLevel:F,trayUuid:r.tray_uuid||null,tagUid:r.tag_uid||null,fillSource:I}:null,R=Ho?.amsId===t.id&&Ho?.slotId===n,ee=S.indexOf(s),te=ee>=0?`P${ee+1}`:null,ne=(0,$.jsxs)(`div`,{className:`relative w-full bg-bambu-dark-secondary rounded-lg p-1 text-center ${a?`opacity-50`:``} ${f?`ring-2 ring-amber-400 ring-offset-1 ring-offset-bambu-dark animate-pulse`:p?`ring-2 ring-red-500/60 ring-offset-1 ring-offset-bambu-dark`:l?`ring-2 ring-bambu-green ring-offset-1 ring-offset-bambu-dark`:``}`,children:[f&&(0,$.jsx)(`span`,{"aria-label":W(`printers.expectedSlot.ariaLabel`,{n:n+1}),title:W(`printers.expectedSlot.title`),className:`absolute top-0.5 left-0.5 px-1 py-px text-[length:var(--pc-t8,8px)] font-bold text-bambu-dark bg-amber-400 rounded pointer-events-none leading-none`,children:`↓`}),te&&(0,$.jsx)(`span`,{"aria-label":W(`printers.activeJobSlot.ariaLabel`,{n:ee+1}),title:W(`printers.activeJobSlot.title`,{n:ee+1}),className:`absolute top-0.5 right-0.5 px-1 py-px text-[length:var(--pc-t8,8px)] font-bold text-bambu-dark bg-bambu-green rounded pointer-events-none leading-none`,children:te}),(0,$.jsx)(ya,{trayColor:r?.tray_color,trayType:r?.tray_type,isEmpty:a,emptyKind:o,slotNumber:n+1}),(0,$.jsx)(`div`,{className:`text-[length:var(--pc-t9,9px)] text-white font-bold truncate`,children:r?.tray_type||W(o===`reset`?`ams.slotUnconfigured`:`ams.slotEmpty`)}),(0,$.jsx)(Ma,{k:L?r?.k:null,reserve:Fi}),(0,$.jsx)(`div`,{className:`mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden`,children:F!==null&&F>=0&&!a&&r&&(0,$.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${F}%`,backgroundColor:un(F)}})})]});return(0,$.jsxs)(`div`,{className:`relative group w-full`,style:m,children:[R&&(0,$.jsx)(`div`,{className:`absolute inset-0 bg-bambu-dark-tertiary/80 rounded flex items-center justify-center z-20`,children:(0,$.jsx)(dn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] text-bambu-green animate-spin`})}),L?(0,$.jsx)(da,{data:L,actions:Ds({amsId:t.id,slotId:n,loadTrayId:t.id*4+n,isRefreshing:R}),spoolman:{enabled:c,linkedSpoolId:k?.spoolman_spool_id??(w?u?.[w]?.id:void 0),spoolmanUrl:d,syncMode:h,onLinkSpool:c&&!k&&!M?()=>{let r=(L.trayUuid||L.tagUid||on(e.serial_number,t.id,n)).toUpperCase();zr({tagUid:L.tagUid||r,trayUuid:L.trayUuid||``,printerId:e.id,amsId:t.id,trayId:n})}:void 0,onUnlinkSpool:E?.id?()=>Ia.mutate(E.id):void 0},inventory:(()=>{if(c){if(T)return;let i=k,a=A;return{assignedSpool:a?{id:a.id,material:a.material,subtype:a.subtype,brand:a.brand??null,color_name:a.color_name??null,color_name_is_synthesized:a.color_name_is_synthesized,rgba:a.rgba??null,extra_colors:a.extra_colors??null,effect_type:a.effect_type??null,remainingWeightGrams:a.label_weight?Math.max(0,Math.round(a.label_weight-a.weight_used)):void 0}:null,onAssignSpool:()=>Vr({printerId:e.id,amsId:t.id,trayId:n,trayInfo:{type:r?.tray_type||L.profile,material:r?.tray_type??void 0,profile:L.profile,color:L.colorHex||``,location:`${Cn(t.id,t.tray.length)} Slot ${n+1}`}}),onUnassignSpool:a&&!kn(r)?()=>D?.(a.id):void 0,isAssigned:!!i||kn(r)}}let i=_?.(e.id,t.id,n);return{assignedSpool:i?.spool?{id:i.spool.id,material:i.spool.material,subtype:i.spool.subtype,brand:i.spool.brand,color_name:i.spool.color_name,rgba:i.spool.rgba??null,extra_colors:i.spool.extra_colors??null,effect_type:i.spool.effect_type??null,remainingWeightGrams:Math.max(0,Math.round(i.spool.label_weight-i.spool.weight_used))}:null,onAssignSpool:()=>Vr({printerId:e.id,amsId:t.id,trayId:n,trayInfo:{type:r?.tray_type||L.profile,material:r?.tray_type??void 0,profile:L.profile,color:L.colorHex||``,location:`${Cn(t.id,t.tray.length)} Slot ${n+1}`}}),onUnassignSpool:i&&!kn(r)?()=>v?.(e.id,t.id,n):void 0,isAssigned:!!i||kn(r)}})(),configureSlot:{enabled:J(`printers:control`),onConfigure:()=>Ur({amsId:t.id,trayId:n,trayCount:t.tray.length,trayType:r?.tray_type||void 0,trayColor:r?.tray_color||void 0,traySubBrands:r?.tray_sub_brands||void 0,trayInfoIdx:r?.tray_info_idx||void 0,extruderId:Xt(t.id,r?.id??0,wi,Oi),caliIdx:r?.cali_idx,savedPresetId:er(x?.preset_id,r?.tray_info_idx,x?.tray_info_idx)?x?.preset_id:void 0})},children:ne}):(0,$.jsx)(fa,{kind:o??void 0,actions:Ds({amsId:t.id,slotId:n,loadTrayId:t.id*4+n,isRefreshing:R}),configureSlot:{enabled:J(`printers:control`),onConfigure:()=>Ur({amsId:t.id,trayId:n,trayCount:t.tray.length,extruderId:Xt(t.id,r?.id??0,wi,Oi)})},onAssignSpool:()=>Vr({printerId:e.id,amsId:t.id,trayId:n,trayInfo:{type:``,material:void 0,profile:``,color:``,location:`${Cn(t.id,t.tray.length)} Slot ${n+1}`}}),children:ne})]},n)})})]},t.id)}),n.map(t=>{let n=Fa(t.id,wi,Oi,Ei),r=t.tray[0],i=r?.tray_type&&r.remain>=0,o=!r?.tray_type,l=Dn(r),m=Qn(t.id,r?.id??0,!1),x=Ri===m,C=zi!==null&&zi===m,w=Bi!==null&&Bi===m,E=r?.tray_info_idx?ci?.[r.tray_info_idx]:null,O=li?.[m],k=er(O?.preset_id,r?.tray_info_idx,O?.tray_info_idx)?O?.preset_name:void 0,A=r?.id??0,j=(r?.tray_uuid||r?.tag_uid||on(e.serial_number,t.id,A))?.toUpperCase(),M=j?u?.[j]:void 0,N=cn(M),P=_?.(e.id,t.id,A),F=(()=>{let e=P?.spool;return e&&e.label_weight>0&&e.weight_used!=null?Math.round(Math.max(0,e.label_weight-e.weight_used)/e.label_weight*100):null})(),I=F===0&&i&&r.remain>0?null:F,L=c&&!T?b?.find(n=>n.printer_id===e.id&&n.ams_id===t.id&&n.tray_id===A):void 0,R=L?y?.find(e=>e.id===L.spoolman_spool_id):void 0,ee=R&&(R.label_weight??0)>0?Math.round(Math.max(0,(R.label_weight??0)-R.weight_used)/(R.label_weight??1)*100):null,te=N??ee??I??(i?r.remain:null),ne=N!==null||ee!==null?`spoolman`:I===null?i?`ams`:void 0:`inventory`,z=r?.tray_type?{vendor:kn(r)?`Bambu Lab`:`Generic`,profile:k||(R?[R.brand,R.slicer_filament_name?.split(`@`)[0].trim()||R.material].filter(Boolean).join(` `).trim():null)||P?.spool?.slicer_filament_name||E?.name||r.tray_sub_brands||r.tray_type,colorName:Un(r.tray_color||``,r.tray_sub_brands),colorHex:r.tray_color||null,kFactor:ja(r.k),fillLevel:te,trayUuid:r.tray_uuid||null,tagUid:r.tag_uid||null,fillSource:ne}:null,re=Ho?.amsId===t.id&&Ho?.slotId===A,B=S.indexOf(m),ie=B>=0?`P${B+1}`:null,ae=(0,$.jsxs)(`div`,{className:`relative w-full bg-bambu-dark-secondary rounded-lg p-1 text-center ${o?`opacity-50`:``} ${C?`ring-2 ring-amber-400 ring-offset-1 ring-offset-bambu-dark animate-pulse`:w?`ring-2 ring-red-500/60 ring-offset-1 ring-offset-bambu-dark`:x?`ring-2 ring-bambu-green ring-offset-1 ring-offset-bambu-dark`:``}`,children:[C&&(0,$.jsx)(`span`,{"aria-label":W(`printers.expectedSlot.ariaLabel`,{n:1}),title:W(`printers.expectedSlot.title`),className:`absolute top-0.5 left-0.5 px-1 py-px text-[length:var(--pc-t8,8px)] font-bold text-bambu-dark bg-amber-400 rounded pointer-events-none leading-none`,children:`↓`}),ie&&(0,$.jsx)(`span`,{"aria-label":W(`printers.activeJobSlot.ariaLabel`,{n:B+1}),title:W(`printers.activeJobSlot.title`,{n:B+1}),className:`absolute top-0.5 right-0.5 px-1 py-px text-[length:var(--pc-t8,8px)] font-bold text-bambu-dark bg-bambu-green rounded pointer-events-none leading-none`,children:ie}),(0,$.jsx)(ya,{trayColor:r?.tray_color,trayType:r?.tray_type,isEmpty:o,emptyKind:l,slotNumber:1}),(0,$.jsx)(`div`,{className:`text-[length:var(--pc-t9,9px)] text-white font-bold truncate`,children:r?.tray_type||W(l===`reset`?`ams.slotUnconfigured`:`ams.slotEmpty`)}),(0,$.jsx)(Ma,{k:z?r?.k:null,reserve:Fi}),(0,$.jsx)(`div`,{className:`mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden`,children:te!==null&&te>=0&&!o&&(0,$.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${te}%`,backgroundColor:un(te)}})})]}),V=f(11);return(0,$.jsxs)(`div`,{style:{flex:`1 1 ${V}`,minWidth:V,maxWidth:`calc(4 * ${p} + 3 * 0.25rem + 1rem)`},className:`min-w-0 p-2 bg-bambu-dark rounded-[10px] space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex w-full min-h-7 items-center gap-1.5 rounded-lg bg-bambu-dark-secondary px-2 py-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,$.jsx)(mo,{ams:t,printerId:e.id,label:Cn(t.id,t.tray.length),amsLabels:pi,canEdit:J(`printers:update`),onSaved:mi,children:(0,$.jsx)(`span`,{className:`block truncate text-[length:var(--pc-t10,10px)] text-white font-medium cursor-default select-none`,children:pi?.[t.id]||Cn(t.id,t.tray.length)})}),n?.kind===`inlet`?(0,$.jsx)(Pa,{inlet:n.inlet,title:W(`printers.amsSwitchInletTooltip`,{inlet:n.inlet,side:ur[n.inlet]})}):a&&n?.kind===`nozzle`?(0,$.jsx)(Na,{side:n.side}):null]}),(Q.supports_drying||Q.drying_screen_only)&&(t.module_type===`n3f`||t.module_type===`n3s`)&&J(`printers:control`)&&(0,$.jsx)(`div`,{className:`relative ml-auto`,children:(0,$.jsx)(`button`,{disabled:Q.drying_screen_only,onClick:e=>{t.dry_time>0?Ha.mutate(t.id):Gt===t.id?Kt(null):ir(t,e.currentTarget)},className:`flex items-center gap-0.5 px-1 py-0.5 rounded text-[length:var(--pc-t9,9px)] transition-colors ${t.dry_time>0?`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`:Q.drying_screen_only?`bg-bambu-dark text-bambu-gray/50 cursor-not-allowed`:`bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark/80`}`,title:Q.drying_screen_only?W(`printers.drying.screenOnly`):t.dry_time>0?W(`printers.drying.stop`):W(`printers.drying.start`),children:(0,$.jsx)(Bn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})})]}),t.dry_time>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 overflow-hidden whitespace-nowrap rounded-lg px-2 py-1 text-[length:var(--pc-t9,9px)] ${t.dry_countdown_stalled?`bg-slate-100 dark:bg-slate-500/10`:`bg-amber-50 dark:bg-amber-500/10`}`,title:t.dry_countdown_stalled?W(`printers.drying.notRunningHint`):void 0,children:[t.dry_countdown_stalled?(0,$.jsx)(Tr,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] text-slate-500 dark:text-slate-400 shrink-0`}):(0,$.jsx)(Bn,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] text-amber-600 dark:text-amber-400 shrink-0`}),t.dry_countdown_stalled&&(0,$.jsx)(`span`,{className:`text-slate-600 dark:text-slate-300 text-[length:var(--pc-t8,8px)] font-medium truncate`,children:W(`printers.drying.notRunning`)}),t.dry_filament&&(0,$.jsx)(`span`,{className:`${t.dry_countdown_stalled?`text-slate-500/90 dark:text-slate-400/80`:`text-amber-700/80 dark:text-amber-300/70`} text-[length:var(--pc-t8,8px)] truncate`,children:t.dry_target_temp==null?t.dry_filament:W(`printers.drying.targetSummary`,{filament:t.dry_filament,temp:t.dry_target_temp})}),!t.dry_countdown_stalled&&(0,$.jsx)(`span`,{className:`text-amber-700/80 dark:text-amber-300/70 text-[length:var(--pc-t8,8px)] truncate`,children:t.dry_time>=60?`${Math.floor(t.dry_time/60)}h ${t.dry_time%60}m`:`${t.dry_time}m`}),!Q.drying_screen_only&&(0,$.jsx)(`button`,{onClick:()=>Ha.mutate(t.id),disabled:Ha.isPending,className:`ml-auto text-amber-700 dark:text-amber-400 hover:text-amber-900 dark:hover:text-amber-300 transition-colors disabled:opacity-50 shrink-0`,title:W(`printers.drying.stop`),children:(0,$.jsx)(Pt,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]}),(0,$.jsxs)(`div`,{className:`flex gap-1.5 max-[550px]:flex-col max-[550px]:items-start`,children:[(0,$.jsxs)(`div`,{className:`relative group flex-1`,style:g,children:[re&&(0,$.jsx)(`div`,{className:`absolute inset-0 bg-bambu-dark-tertiary/80 rounded flex items-center justify-center z-20`,children:(0,$.jsx)(dn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] text-bambu-green animate-spin`})}),z?(0,$.jsx)(da,{data:z,actions:Ds({amsId:t.id,slotId:A,loadTrayId:t.id*4+A,isRefreshing:re}),spoolman:{enabled:c,linkedSpoolId:L?.spoolman_spool_id??(j?u?.[j]?.id:void 0),spoolmanUrl:d,syncMode:h,onLinkSpool:c&&!L&&!P?()=>{let n=(z.trayUuid||z.tagUid||on(e.serial_number,t.id,A)).toUpperCase();zr({tagUid:z.tagUid||n,trayUuid:z.trayUuid||``,printerId:e.id,amsId:t.id,trayId:A})}:void 0,onUnlinkSpool:M?.id?()=>Ia.mutate(M.id):void 0},inventory:(()=>{if(c){if(T)return;let n=L,i=R;return{assignedSpool:i?{id:i.id,material:i.material,subtype:i.subtype,brand:i.brand??null,color_name:i.color_name??null,color_name_is_synthesized:i.color_name_is_synthesized,rgba:i.rgba??null,extra_colors:i.extra_colors??null,effect_type:i.effect_type??null,remainingWeightGrams:i.label_weight?Math.max(0,Math.round(i.label_weight-i.weight_used)):void 0}:null,onAssignSpool:()=>Vr({printerId:e.id,amsId:t.id,trayId:A,trayInfo:{type:r?.tray_type||z.profile,material:r?.tray_type??void 0,profile:z.profile,color:z.colorHex||``,location:Cn(t.id,t.tray.length)}}),onUnassignSpool:i&&!kn(r)?()=>D?.(i.id):void 0,isAssigned:!!n||kn(r)}}let n=_?.(e.id,t.id,A);return{assignedSpool:n?.spool?{id:n.spool.id,material:n.spool.material,subtype:n.spool.subtype,brand:n.spool.brand,color_name:n.spool.color_name,rgba:n.spool.rgba??null,extra_colors:n.spool.extra_colors??null,effect_type:n.spool.effect_type??null,remainingWeightGrams:Math.max(0,Math.round(n.spool.label_weight-n.spool.weight_used))}:null,onAssignSpool:()=>Vr({printerId:e.id,amsId:t.id,trayId:A,trayInfo:{type:r?.tray_type||z.profile,material:r?.tray_type??void 0,profile:z.profile,color:z.colorHex||``,location:Cn(t.id,t.tray.length)}}),onUnassignSpool:n&&!kn(r)?()=>v?.(e.id,t.id,A):void 0,isAssigned:!!n||kn(r)}})(),configureSlot:{enabled:J(`printers:control`),onConfigure:()=>Ur({amsId:t.id,trayId:A,trayCount:t.tray.length,trayType:r?.tray_type||void 0,trayColor:r?.tray_color||void 0,traySubBrands:r?.tray_sub_brands||void 0,trayInfoIdx:r?.tray_info_idx||void 0,extruderId:Xt(t.id,r?.id??0,wi,Oi),caliIdx:r?.cali_idx,savedPresetId:er(O?.preset_id,r?.tray_info_idx,O?.tray_info_idx)?O?.preset_id:void 0})},children:ae}):(0,$.jsx)(fa,{kind:l??void 0,actions:Ds({amsId:t.id,slotId:A,loadTrayId:t.id*4+A,isRefreshing:re}),configureSlot:{enabled:J(`printers:control`),onConfigure:()=>Ur({amsId:t.id,trayId:A,trayCount:t.tray.length,extruderId:Xt(t.id,r?.id??0,wi,Oi)})},onAssignSpool:()=>Vr({printerId:e.id,amsId:t.id,trayId:A,trayInfo:{type:``,material:void 0,profile:``,color:``,location:Cn(t.id,t.tray.length)}}),children:ae})]}),(t.humidity!=null||t.temp!=null)&&(0,$.jsxs)(`div`,{className:`flex flex-col justify-center gap-1 shrink-0 max-[550px]:w-full`,children:[t.temp!=null&&(0,$.jsx)(Qa,{temp:t.temp,goodThreshold:s?.tempGood,fairThreshold:s?.tempFair,onClick:()=>Fr({amsId:t.id,amsLabel:Cn(t.id,t.tray.length),mode:`temperature`}),compact:!0}),t.humidity!=null&&(0,$.jsx)(Za,{humidity:t.humidity,goodThreshold:s?.humidityGood,fairThreshold:s?.humidityFair,onClick:()=>Fr({amsId:t.id,amsLabel:Cn(t.id,t.tray.length),mode:`humidity`}),compact:!0})]})]})]},t.id)}),Q.vt_tray.length>0&&i&&(0,$.jsxs)(`div`,{style:C(Q.vt_tray.length),className:`min-w-0 p-2 bg-bambu-dark rounded-[10px] space-y-1`,children:[(0,$.jsx)(`div`,{className:`flex w-full min-h-7 items-center gap-1.5 rounded-lg bg-bambu-dark-secondary px-2 py-1`,children:(0,$.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-[length:var(--pc-t10,10px)] text-white font-medium`,children:W(`printers.external`)})}),(0,$.jsx)(`div`,{className:`grid w-full gap-1`,style:x(Q.vt_tray.length>1?2:1),children:[...Q.vt_tray].sort((e,t)=>(e.id??254)-(t.id??254)).map(t=>{let n=t.id??254,r=a&&Ri===254?n===254&&Q.active_extruder===1||n===255&&Q.active_extruder===0:Ri===n,i=n-254,o=a?W(n===254?`printers.extL`:`printers.extR`):``,s=t.tray_info_idx?ci?.[t.tray_info_idx]:null,l=li?.[1020+i],f=er(l?.preset_id,t.tray_info_idx,l?.tray_info_idx)?l?.preset_name:void 0,p=(t.tray_uuid||t.tag_uid||on(e.serial_number,255,i))?.toUpperCase(),g=p?u?.[p]:void 0,x=cn(g),S=_?.(e.id,255,i),C=(()=>{let e=S?.spool;return e&&e.label_weight>0&&e.weight_used!=null?Math.round(Math.max(0,e.label_weight-e.weight_used)/e.label_weight*100):null})(),w=t.tray_type&&t.remain>=0,E=C===0&&w&&t.remain>0?null:C,O=c&&!T?b?.find(t=>t.printer_id===e.id&&t.ams_id===255&&t.tray_id===i):void 0,k=O?y?.find(e=>e.id===O.spoolman_spool_id):void 0,A=k&&(k.label_weight??0)>0?Math.round(Math.max(0,(k.label_weight??0)-k.weight_used)/(k.label_weight??1)*100):null,j=x??A??E??(w?t.remain:null),M=x!==null||A!==null?`spoolman`:E===null?w?`ams`:void 0:`inventory`,N={vendor:kn(t)?`Bambu Lab`:`Generic`,profile:f||(k?[k.brand,k.slicer_filament_name?.split(`@`)[0].trim()||k.material].filter(Boolean).join(` `).trim():null)||S?.spool?.slicer_filament_name||s?.name||t.tray_sub_brands||t.tray_type||`Unknown`,colorName:Un(t.tray_color||``,t.tray_sub_brands),colorHex:t.tray_color||null,kFactor:ja(t.k),fillLevel:j,trayUuid:t.tray_uuid||null,tagUid:t.tag_uid||null,fillSource:M},P=!t.tray_type,F=Dn(t),I=(0,$.jsxs)(`div`,{className:`w-full bg-bambu-dark-secondary rounded-lg p-1 text-center ${P?`opacity-50`:``} ${r?`ring-2 ring-bambu-green ring-offset-1 ring-offset-bambu-dark`:``}`,children:[(0,$.jsx)(ya,{trayColor:t.tray_color,trayType:t.tray_type,isEmpty:P,emptyKind:F,slotNumber:a?n===254?`L`:`R`:i+1}),(0,$.jsx)(`div`,{className:`text-[length:var(--pc-t9,9px)] font-bold truncate ${P?`text-white/40`:`text-white`}`,children:t.tray_type||W(`ams.slotEmpty`)}),(0,$.jsx)(Ma,{k:P?null:t.k,reserve:Fi}),(0,$.jsx)(`div`,{className:`mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden`,children:j!==null&&j>=0&&!P&&(0,$.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${j}%`,backgroundColor:un(j)}})})]});return(0,$.jsx)(`div`,{className:`relative group w-full`,style:m,children:P?(0,$.jsx)(fa,{kind:F??void 0,actions:Ds({amsId:255,slotId:i,loadTrayId:n,includeRfid:!1}),configureSlot:{enabled:J(`printers:control`),onConfigure:()=>Ur({amsId:255,trayId:i,trayCount:1,extruderId:a?+(n===254):void 0})},onAssignSpool:()=>Vr({printerId:e.id,amsId:255,trayId:i,trayInfo:{type:``,material:void 0,profile:``,color:``,location:`External Slot ${i+1}`}}),children:I}):(0,$.jsx)(da,{data:N,actions:Ds({amsId:255,slotId:i,loadTrayId:n,includeRfid:!1}),spoolman:{enabled:c,linkedSpoolId:O?.spoolman_spool_id??(p?u?.[p]?.id:void 0),spoolmanUrl:d,syncMode:h,onLinkSpool:c&&!O&&!S?()=>{let t=(N.trayUuid||N.tagUid||on(e.serial_number,255,i)).toUpperCase();zr({tagUid:N.tagUid||t,trayUuid:N.trayUuid||``,printerId:e.id,amsId:255,trayId:i})}:void 0,onUnlinkSpool:g?.id?()=>Ia.mutate(g.id):void 0},inventory:(()=>{if(c){if(T)return;let n=O,r=k;return{assignedSpool:r?{id:r.id,material:r.material,subtype:r.subtype,brand:r.brand??null,color_name:r.color_name??null,color_name_is_synthesized:r.color_name_is_synthesized,rgba:r.rgba??null,extra_colors:r.extra_colors??null,effect_type:r.effect_type??null,remainingWeightGrams:r.label_weight?Math.max(0,Math.round(r.label_weight-r.weight_used)):void 0}:null,onAssignSpool:()=>Vr({printerId:e.id,amsId:255,trayId:i,trayInfo:{type:t.tray_type||N.profile,material:t.tray_type??void 0,profile:N.profile,color:N.colorHex||``,location:o||W(`printers.external`)}}),onUnassignSpool:r&&!kn(t)?()=>D?.(r.id):void 0,isAssigned:!!n||kn(t)}}let n=_?.(e.id,255,i);return{assignedSpool:n?.spool?{id:n.spool.id,material:n.spool.material,subtype:n.spool.subtype,brand:n.spool.brand,color_name:n.spool.color_name,rgba:n.spool.rgba??null,extra_colors:n.spool.extra_colors??null,effect_type:n.spool.effect_type??null,remainingWeightGrams:Math.max(0,Math.round(n.spool.label_weight-n.spool.weight_used))}:null,onAssignSpool:()=>Vr({printerId:e.id,amsId:255,trayId:i,trayInfo:{type:t.tray_type||N.profile,material:t.tray_type??void 0,profile:N.profile,color:N.colorHex||``,location:o||W(`printers.external`)}}),onUnassignSpool:n&&!kn(t)?()=>v?.(e.id,255,i):void 0,isAssigned:!!n||kn(t)}})(),configureSlot:{enabled:J(`printers:control`),onConfigure:()=>Ur({amsId:255,trayId:i,trayCount:1,trayType:t.tray_type||void 0,trayColor:t.tray_color||void 0,traySubBrands:t.tray_sub_brands||void 0,trayInfoIdx:t.tray_info_idx||void 0,extruderId:a?+(n===254):void 0,caliIdx:t.cali_idx,savedPresetId:er(l?.preset_id,t.tray_info_idx,l?.tray_info_idx)?l?.preset_id:void 0})},children:I})},n)})})]})]})]})})()]}),e.is_active!==!1&&!Q?.connected&&r===`expanded`&&la&&bo,r===`expanded`&&(0,$.jsxs)(`div`,{className:`mt-auto`,children:[Wi&&(0,$.jsxs)(`div`,{className:`pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:W(`printers.power`,`Power`)}),(0,$.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-[10px] bg-bambu-dark p-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0 pl-1`,children:[(0,$.jsx)(Vn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] text-bambu-gray flex-shrink-0`}),(0,$.jsx)(`span`,{className:`text-sm text-white truncate`,children:Wi.name}),(0,$.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray text-[length:var(--pc-t10,10px)] font-medium flex-shrink-0`,title:W(`smartPlugs.power`),children:Ki?.energy?.power!==null&&Ki?.energy?.power!==void 0?`${Math.round(Ki.energy.power)}W`:`--`})]}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`button`,{onClick:()=>Ga.mutate(!Wi.auto_off),disabled:Ga.isPending||Wi.auto_off_executed||!J(`smart_plugs:control`),title:J(`smart_plugs:control`)?Wi.auto_off_executed?W(`printers.autoOffExecuted`):W(`printers.autoOffAfterPrint`):W(`printers.permission.noSmartPlugControl`),className:`flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg text-xs font-bold transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${J(`smart_plugs:control`)?Wi.auto_off||Wi.auto_off_executed?`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary/80`:`bg-bambu-dark-tertiary/50 text-bambu-gray/50`}`,children:(0,$.jsx)(vn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(`button`,{onClick:()=>{Ki?.state===`ON`?Je(!0):Ke(!0)},disabled:Wa.isPending||!J(`smart_plugs:control`),className:`flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg text-xs transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${J(`smart_plugs:control`)?Ki?.state===`ON`?`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary/80`:`bg-bambu-dark-tertiary/50 text-bambu-gray/50`}`,title:J(`smart_plugs:control`)?Ki?.state===`ON`?`Turn off`:`Turn on`:W(`printers.permission.noSmartPlugControl`),children:(0,$.jsx)(Vn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})})]})]}),Gi&&Gi.length>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,$.jsx)(Kn,{className:`w-[var(--pc-i35,0.875rem)] h-[var(--pc-i35,0.875rem)] text-blue-600 dark:text-blue-400 flex-shrink-0`}),(0,$.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`HA:`}),(0,$.jsx)(`div`,{className:`h-[2px] w-5 bg-bambu-dark-tertiary/50`}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Gi.map(e=>{let t=e.ha_entity_id?.startsWith(`script.`);return(0,$.jsxs)(`button`,{onClick:()=>{t?Ka.mutate({id:e.id,action:`on`}):Xe(e)},disabled:Ka.isPending,title:`${t?`Run`:`Toggle`} ${e.ha_entity_id}`,className:`px-2 py-0.5 text-xs bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 hover:bg-blue-500/30 rounded transition-colors flex items-center gap-1`,children:[(0,$.jsx)(ke,{className:`w-[var(--pc-i25,0.625rem)] h-[var(--pc-i25,0.625rem)]`}),e.name]},e.id)})})]})]}),(0,$.jsx)(ea,{printerId:e.id}),(0,$.jsxs)(`div`,{className:`pt-4`,children:[(0,$.jsx)(`div`,{className:`mb-3 h-[2px] bg-bambu-dark-tertiary`}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[Os,(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2 flex-wrap`,children:[(0,$.jsxs)(`div`,{className:`flex items-center flex-shrink-0`,children:[(0,$.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>Ts(k),disabled:!Q?.connected||!J(`camera:view`),title:J(`camera:view`)?W(k===`embedded`?`printers.openCameraOverlay`:`printers.openCameraWindow`):W(`printers.permission.noCamera`),className:`${ws} !rounded-r-none`,children:(0,$.jsx)(rn,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();Mr({x:t.left,y:t.bottom+4})},disabled:!Q?.connected||!J(`camera:view`),title:J(`camera:view`)?W(`settings.cameraViewMode`):W(`printers.permission.noCamera`),"aria-label":W(`settings.cameraViewMode`),className:`!h-8 !min-h-8 !w-6 !px-0 !py-0 !rounded-l-none border-l border-bambu-dark`,children:(0,$.jsx)(I,{className:`w-3 h-3`})})]}),Ar&&(0,$.jsx)(oe,{x:Ar.x,y:Ar.y,items:Es,onClose:()=>Mr(null)}),(0,$.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>He(!0),disabled:!J(`printers:files`),title:J(`printers:files`)?W(`printers.browseFiles`):W(`printers.permission.noFiles`),className:ws,children:(0,$.jsx)(fe,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,$.jsxs)(Y,{size:`sm`,onClick:()=>Tt(!0),disabled:!J(`library:upload`)||!J(`queue:create`),title:J(`library:upload`)?J(`queue:create`)?W(`common.print`):W(`fileManager.noPermissionAddToQueue`):W(`fileManager.noPermissionUpload`),className:`!h-8 !min-h-8 !px-2 !py-0 !bg-bambu-green hover:!bg-bambu-green/80 !text-white`,children:[(0,$.jsx)(ln,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),W(`common.print`)]})]})]})]})]}),(0,$.jsx)(vo,{printerId:e.id,dryingActive:Mi.some(e=>(e.dry_time??0)>0),timeFormat:O})]}),Ve&&(0,$.jsx)(Vi,{printerId:e.id,printerName:e.name,onClose:()=>He(!1)}),wt&&(0,$.jsx)(fr,{folderId:null,onClose:()=>Tt(!1),onUploadComplete:()=>{},autoUpload:!0,accept:`.gcode,.3mf`,validateFile:e=>{let t=e.name.toLowerCase();if(!t.endsWith(`.gcode`)&&!t.includes(`.gcode.`))return W(`printers.dropNotPrintable`,`Only .gcode and .gcode.3mf files can be printed`)},onFileUploaded:t=>{let n=t.metadata?.sliced_for_model,r=gr(e.model);if(n&&r&&n.toLowerCase()!==r.toLowerCase())return i.deleteLibraryFile(t.id).catch(()=>{}),W(`printers.incompatibleFile`,`This file was sliced for {{slicedFor}}, but this printer is a {{printerModel}}`,{slicedFor:n,printerModel:r});Bt({id:t.id,filename:t.filename})}}),zt&&(0,$.jsx)(zn,{mode:`create`,libraryFileId:zt.id,archiveName:zt.filename,initialSelectedPrinterIds:[e.id],onClose:()=>Bt(null),onSuccess:()=>Bt(null),cleanupLibraryAfterDispatch:!0}),Ue&&(0,$.jsx)(Yi,{printerId:e.id,printerName:e.name,onClose:()=>We(!1)}),Nt&&(0,$.jsx)(Pn,{printerId:e.id,printerName:e.name,onClose:()=>Ft(!1)}),Et&&(0,$.jsx)(ma,{printer:e,status:Q,totalPrintHours:n?.total_print_hours,onClose:It}),Z&&(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:()=>ss(),children:(0,$.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-w-lg w-full`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Z.needs_calibration?(0,$.jsx)(ce,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)] text-blue-500`}):Z.is_empty?(0,$.jsx)(ne,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)] text-green-500`}):(0,$.jsx)(L,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)] text-yellow-500`}),(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`Build Plate Check`}),Z.reference_count!==void 0&&Z.max_references&&(0,$.jsxs)(`span`,{className:`text-xs text-bambu-gray bg-bambu-dark-tertiary px-2 py-1 rounded`,children:[Z.reference_count,`/`,Z.max_references,` refs`]})]}),(0,$.jsx)(`button`,{onClick:()=>ss(),className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,$.jsx)(Pt,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)]`})})]}),(0,$.jsxs)(`div`,{className:`p-4 space-y-4`,children:[Z.needs_calibration?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`p-3 rounded-lg bg-blue-100 dark:bg-blue-500/20 border border-blue-300 dark:border-blue-500/50`,children:[(0,$.jsx)(`p`,{className:`font-medium text-blue-700 dark:text-blue-400`,children:W(`printers.plateDetection.calibrationRequired`)}),(0,$.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,dangerouslySetInnerHTML:{__html:W(`printers.plateDetection.calibrationInstructions`)}})]}),(0,$.jsxs)(`div`,{className:`text-sm text-bambu-gray space-y-2`,children:[(0,$.jsx)(`p`,{children:W(`printers.plateDetection.calibrationDescription`)}),(0,$.jsx)(`p`,{dangerouslySetInnerHTML:{__html:W(`printers.plateDetection.calibrationTip`)}})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`p-3 rounded-lg ${Z.is_empty?`bg-green-100 dark:bg-green-500/20 border border-green-300 dark:border-green-500/50`:`bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-300 dark:border-yellow-500/50`}`,children:[(0,$.jsx)(`p`,{className:`font-medium ${Z.is_empty?`text-green-700 dark:text-green-400`:`text-yellow-700 dark:text-yellow-400`}`,children:Z.is_empty?W(`printers.plateDetection.plateEmpty`):W(`printers.plateDetection.objectsDetected`)}),(0,$.jsxs)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:[W(`printers.plateDetection.confidence`),`: `,Math.round(Z.confidence*100),`% | `,W(`printers.plateDetection.difference`),`: `,Z.difference_percent.toFixed(1),`%`]})]}),Z.debug_image_url&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:W(`printers.plateDetection.analysisPreview`)}),(0,$.jsx)(`img`,{src:Z.debug_image_url,alt:W(`printers.plateDetection.analysisPreview`),className:`w-full rounded-lg border border-bambu-dark-tertiary`}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:W(`printers.plateDetection.analysisLegend`)})]}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:Z.message})]}),es&&es.references.length>0&&(0,$.jsxs)(`div`,{className:`mt-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-white shrink-0`,children:W(`printers.plateDetection.savedReferences`,{count:es.references.length,max:es.max_references})}),(0,$.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`})]}),(0,$.jsx)(`div`,{className:`grid grid-cols-5 gap-2`,children:es.references.map(t=>(0,$.jsxs)(`div`,{className:`relative group`,children:[(0,$.jsx)(`img`,{src:i.getPlateReferenceThumbnailUrl(e.id,t.index),alt:t.label||`Reference ${t.index+1}`,className:`w-full aspect-video object-cover rounded border border-bambu-dark-tertiary`}),(0,$.jsx)(`button`,{onClick:()=>us(t.index),className:`absolute top-1 right-1 p-0.5 bg-red-500/80 rounded can-hover:opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity`,title:W(`printers.plateDetection.deleteReference`),children:(0,$.jsx)(Pt,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] text-white`})}),ns?.index===t.index?(0,$.jsx)(`input`,{type:`text`,value:ns.label,onChange:e=>rs({...ns,label:e.target.value}),onBlur:()=>ls(t.index,ns.label),onKeyDown:e=>{e.key===`Enter`&&ls(t.index,ns.label),e.key===`Escape`&&rs(null)},className:`w-full mt-1 px-1 py-0.5 text-xs bg-bambu-dark-tertiary border border-bambu-green rounded text-white`,autoFocus:!0,placeholder:W(`printers.plateDetection.labelPlaceholder`)}):(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1 truncate cursor-pointer hover:text-white`,onClick:()=>rs({index:t.index,label:t.label}),title:t.label?W(`printers.plateDetection.clickToEdit`,{label:t.label}):W(`printers.plateDetection.clickToAddLabel`),children:t.label||(0,$.jsx)(`span`,{className:`italic opacity-50`,children:W(`printers.noLabel`)})}),(0,$.jsx)(`p`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray/60`,children:t.timestamp?qt(t.timestamp)?.toLocaleDateString()??``:``})]},t.index))})]}),!Z.needs_calibration&&(0,$.jsxs)(`div`,{className:`mt-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-white shrink-0`,children:W(`printers.roi.title`)}),(0,$.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`})]}),Zr?(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>Qr(null),disabled:$r,children:W(`common.cancel`)}),(0,$.jsx)(Y,{size:`sm`,onClick:ds,disabled:$r,children:$r?(0,$.jsx)(H,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] animate-spin`}):W(`common.save`)})]}):(0,$.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>Qr(Z.roi||{x:.15,y:.35,w:.7,h:.55}),children:[(0,$.jsx)(Zt,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] mr-1`}),W(`common.edit`)]})]}),Zr?(0,$.jsxs)(`div`,{className:`space-y-3 bg-bambu-dark-tertiary/50 p-3 rounded-lg`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:W(`printers.roi.xStart`)}),(0,$.jsx)(`input`,{type:`range`,min:`0`,max:`0.9`,step:`0.01`,value:Zr.x,onChange:e=>Qr({...Zr,x:parseFloat(e.target.value)}),className:`w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500`}),(0,$.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[Math.round(Zr.x*100),`%`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:W(`printers.roi.yStart`)}),(0,$.jsx)(`input`,{type:`range`,min:`0`,max:`0.9`,step:`0.01`,value:Zr.y,onChange:e=>Qr({...Zr,y:parseFloat(e.target.value)}),className:`w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500`}),(0,$.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[Math.round(Zr.y*100),`%`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:W(`printers.width`)}),(0,$.jsx)(`input`,{type:`range`,min:`0.1`,max:`1`,step:`0.01`,value:Zr.w,onChange:e=>Qr({...Zr,w:parseFloat(e.target.value)}),className:`w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500`}),(0,$.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[Math.round(Zr.w*100),`%`]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:W(`printers.height`)}),(0,$.jsx)(`input`,{type:`range`,min:`0.1`,max:`1`,step:`0.01`,value:Zr.h,onChange:e=>Qr({...Zr,h:parseFloat(e.target.value)}),className:`w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500`}),(0,$.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[Math.round(Zr.h*100),`%`]})]})]}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:W(`printers.roi.instruction`)})]}):(0,$.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[`Current: X=`,Math.round((Z.roi?.x||.15)*100),`%, Y=`,Math.round((Z.roi?.y||.35)*100),`%, W=`,Math.round((Z.roi?.w||.7)*100),`%, H=`,Math.round((Z.roi?.h||.55)*100),`%`]})]})]}),(0,$.jsx)(`div`,{className:`flex justify-end gap-2 p-4`,children:Z.needs_calibration?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{variant:`ghost`,onClick:()=>ss(),children:W(`common.cancel`)}),(0,$.jsx)(Y,{onClick:()=>cs(),disabled:Yr,children:Yr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] mr-2 animate-spin`}),`Calibrating...`]}):`Calibrate Empty Plate`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{variant:`ghost`,onClick:()=>cs(),disabled:Yr,children:Yr?`Adding...`:`Add Reference (${es?.references.length||0}/${es?.max_references||5})`}),(0,$.jsx)(Y,{onClick:()=>ss(),children:`Close`})]})})]})}),Ge&&Wi&&(0,$.jsx)(In,{title:W(`printers.confirm.powerOnTitle`),message:W(`printers.confirm.powerOnMessage`,{name:e.name}),confirmText:W(`printers.confirm.powerOnButton`),variant:`default`,onConfirm:()=>{Wa.mutate(`on`),Ke(!1)},onCancel:()=>Ke(!1)}),Lo&&(0,$.jsx)(In,{title:W(`printers.maintenance.confirmMidPrintTitle`),message:W(`printers.maintenance.confirmMidPrintMessage`,{name:e.name}),confirmText:W(`printers.maintenance.menuEnter`),variant:`danger`,onConfirm:()=>{Io.mutate(!1),Ro(!1)},onCancel:()=>Ro(!1)}),qe&&Wi&&(0,$.jsx)(In,{title:W(`printers.confirm.powerOffTitle`),message:Q?.state===`RUNNING`?W(`printers.confirm.powerOffWarning`,{name:e.name}):W(`printers.confirm.powerOffMessage`,{name:e.name}),confirmText:W(`printers.confirm.powerOffButton`),variant:`danger`,onConfirm:()=>{Wa.mutate(`off`),Je(!1)},onCancel:()=>Je(!1)}),Ye&&(0,$.jsx)(In,{title:W(`printers.confirm.haToggleTitle`,{name:Ye.name}),message:Q?.state===`RUNNING`?W(`printers.confirm.haToggleWarning`,{name:e.name,entity:Ye.ha_entity_id||Ye.name}):W(`printers.confirm.haToggleMessage`,{entity:Ye.ha_entity_id||Ye.name}),confirmText:W(`printers.confirm.haToggleButton`),variant:Q?.state===`RUNNING`?`danger`:`default`,onConfirm:()=>{Ka.mutate({id:Ye.id,action:`toggle`}),Xe(null)},onCancel:()=>Xe(null)}),ot&&(0,$.jsx)(In,{title:W(`printers.confirm.stopTitle`),message:W(`printers.confirm.stopMessage`,{name:e.name}),confirmText:W(`printers.confirm.stopButton`),variant:`danger`,onConfirm:()=>{to.mutate(),st(!1)},onCancel:()=>st(!1)}),ct&&(0,$.jsx)(In,{title:W(`printers.confirm.pauseTitle`),message:W(`printers.confirm.pauseMessage`,{name:e.name}),confirmText:W(`printers.confirm.pauseButton`),variant:`default`,onConfirm:()=>{ro.mutate(),lt(!1)},onCancel:()=>lt(!1)}),bt&&(0,$.jsx)(In,{title:W(`printers.confirm.resumeTitle`),message:W(`printers.confirm.resumeMessage`,{name:e.name}),confirmText:W(`printers.confirm.resumeButton`),variant:`default`,onConfirm:()=>{ao.mutate(),xt(!1)},onCancel:()=>xt(!1)}),(0,$.jsx)(ye,{printerId:e.id,isOpen:St,onClose:()=>Ct(!1)}),Ze&&(0,$.jsx)(jt,{printerName:e.name,errors:Q?.hms_errors||[],onClose:()=>Qe(!1),printerId:e.id,hasPermission:J,runoutGuidance:Ui}),$e&&(0,$.jsx)(Qi,{printerName:e.name,detection:U,lastError:ge,onClose:()=>et(!1)}),tt&&Q&&(0,$.jsx)(oa,{isOpen:tt,state:Q.ams_filament_backup,amsUnits:Q.ams,amsExtruderMap:Q.ams_extruder_map,isDualNozzle:e.nozzle_count===2||Q?.temperatures?.nozzle_2!==void 0,canToggle:J(`printers:control`),pending:Ua.isPending,onToggle:e=>Ua.mutate(e),onClose:()=>nt(!1)}),Pr&&(0,$.jsx)(na,{isOpen:!!Pr,onClose:()=>Fr(null),printerId:e.id,printerName:e.name,amsId:Pr.amsId,amsLabel:Pr.amsLabel,initialMode:Pr.mode,thresholds:s}),Ir&&(0,$.jsx)(ua,{isOpen:!!Ir,onClose:()=>Lr(null),printerId:e.id,printerName:e.name,initialKind:Ir.initialKind,availableKinds:Ir.availableKinds}),Rr&&(0,$.jsx)(yr,{isOpen:!!Rr,onClose:()=>zr(null),tagUid:Rr.tagUid,trayUuid:Rr.trayUuid,printerId:Rr.printerId,amsId:Rr.amsId,trayId:Rr.trayId}),Br&&(0,$.jsx)(vr,{isOpen:!!Br,onClose:()=>Vr(null),printerId:Br.printerId,amsId:Br.amsId,trayId:Br.trayId,trayInfo:Br.trayInfo,spoolmanEnabled:!!c}),Hr&&(0,$.jsx)(br,{isOpen:!!Hr,onClose:()=>Ur(null),printerId:e.id,slotInfo:Hr,printerModel:gr(e.model)||void 0,nozzleDiameter:Gn(Q,Hr.amsId),onSuccess:()=>{G.invalidateQueries({queryKey:[`slotPresets`,e.id]}),G.invalidateQueries({queryKey:[`printerStatus`,e.id]})}}),Xo&&(0,$.jsx)(_a,{slotLabel:Xo.slotLabel,amsId:Xo.amsId,slotId:Xo.slotId,extruderSlots:Q?.extruder_slots??{},isLoading:Jo.isPending,onConfirm:e=>Jo.mutate({trayId:Xo.trayId,extruderId:e}),onCancel:()=>Zo(null)}),ze&&(0,$.jsx)(So,{printer:e,onClose:()=>Be(!1)}),Wr&&ri&&(0,$.jsx)(xo,{printer:e,firmwareInfo:ri,onClose:()=>Gr(!1)}),Gt!==null&&Yn&&(()=>{let e=Jt===`n3s`?85:65,t=e+10;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-[100]`,"data-testid":`drying-popover-backdrop`,onMouseDown:()=>{dr.current=or.current!==null&&document.activeElement===or.current},onClick:()=>{if(dr.current){dr.current=!1;return}Kt(null)}}),(0,$.jsxs)(`div`,{className:`fixed z-[101] flex flex-col w-[240px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl overflow-hidden`,style:{left:Yn.left,...Yn.placement===`above`?{bottom:`calc(100dvh - ${Yn.anchorY}px)`,maxHeight:`${Yn.anchorY-8}px`}:{top:Yn.top,maxHeight:`calc(100dvh - ${Yn.top}px - 8px)`}},onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`shrink-0 flex items-center justify-center gap-2 px-3 py-2.5`,children:[(0,$.jsx)(Bn,{className:`w-[var(--pc-i35,0.875rem)] h-[var(--pc-i35,0.875rem)] text-bambu-green`}),(0,$.jsx)(`span`,{className:`text-sm text-white font-medium text-center`,children:W(`printers.drying.start`)})]}),(0,$.jsx)(`div`,{className:`shrink-0 h-px bg-bambu-dark-tertiary`}),(0,$.jsxs)(`div`,{className:`px-3 py-2.5 space-y-2.5 overflow-y-auto min-h-0`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`text-[length:var(--pc-t10,10px)] text-white/70 font-medium mb-1 block`,children:W(`printers.filaments`)}),(0,$.jsx)(no,{value:en,options:Object.keys(F).map(e=>({value:e,label:e})),onChange:e=>{pn(e);let t=F[e];t&&(Sn(t[Jt===`n3s`?`n3s`:`n3f`]),En(Jt===`n3s`?t.n3s_hours:t.n3f_hours))},fullWidth:!0})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,$.jsx)(`label`,{className:`text-[length:var(--pc-t10,10px)] text-white/70 font-medium`,children:W(`printers.drying.temperature`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(hn,{min:45,max:e,value:bn,onChange:Sn,fallback:45,className:`w-12 px-1 py-0.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-[length:var(--pc-t11,11px)] text-center focus:outline-none focus:border-bambu-green [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:`°C`})]})]}),(0,$.jsx)(`input`,{type:`range`,min:35,max:t,value:bn,onChange:t=>Sn(Math.min(e,Math.max(45,Number(t.target.value)))),className:`w-full h-1 accent-bambu-green cursor-pointer`}),(0,$.jsxs)(`div`,{className:`flex justify-between text-[length:var(--pc-t9,9px)] text-bambu-gray/50 mt-0.5`,children:[(0,$.jsx)(`span`,{children:`45°C`}),(0,$.jsxs)(`span`,{children:[e,`°C`]})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,$.jsx)(`label`,{className:`text-[length:var(--pc-t10,10px)] text-white/70 font-medium`,children:W(`printers.drying.duration`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(hn,{min:1,max:24,value:wn,onChange:En,fallback:1,className:`w-10 px-1 py-0.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-[length:var(--pc-t11,11px)] text-center focus:outline-none focus:border-bambu-green [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,$.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:W(`printers.drying.hours`)})]})]}),(0,$.jsx)(`input`,{type:`range`,min:1,max:24,value:wn,onChange:e=>En(Number(e.target.value)),className:`w-full h-1 accent-bambu-green cursor-pointer`}),(0,$.jsxs)(`div`,{className:`flex justify-between text-[length:var(--pc-t9,9px)] text-bambu-gray/50 mt-0.5`,children:[(0,$.jsx)(`span`,{children:`1h`}),(0,$.jsx)(`span`,{children:`24h`})]})]}),(()=>{let e=((Gt===null?void 0:Mi.find(e=>e.id===Gt))?.tray??[]).some(e=>e.state===11),t=jn&&!e;return(0,$.jsx)(`button`,{type:`button`,onClick:()=>Mn(e=>!e),"aria-pressed":t,disabled:e,title:e?W(`printers.drying.rotateUnavailableReason`):void 0,className:`h-8 w-full rounded-lg border px-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${t?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary disabled:hover:bg-bambu-dark`}`,children:W(`printers.drying.rotateTray`)})})(),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`text-[10px] text-white/70 font-medium mb-1 block`,children:W(`printers.drying.startMode`)}),(0,$.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:[`now`,`delay`,`at_time`].map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>Fn(e),className:`py-1 rounded-lg border text-[10px] font-medium transition-colors ${Nn===e?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,children:W(e===`now`?`printers.drying.modeNow`:e===`delay`?`printers.drying.modeDelay`:`printers.drying.modeAtTime`)},e))}),Nn===`delay`&&(0,$.jsx)(`div`,{className:`mt-1.5 grid grid-cols-4 gap-1`,children:Sa.map(e=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":Rn===e,onClick:()=>Wn(e),className:`py-1 rounded-lg border text-[10px] font-medium transition-colors ${Rn===e?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,children:Wt(e/60)},e))}),Nn===`at_time`&&(0,$.jsx)(`input`,{ref:or,type:`datetime-local`,"data-testid":`drying-start-at`,value:qn,onChange:e=>Jn(e.target.value),className:`mt-1.5 w-full px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-[11px] focus:outline-none focus:border-bambu-green [color-scheme:dark]`})]})]}),(0,$.jsx)(`div`,{className:`shrink-0 h-px bg-bambu-dark-tertiary`}),(0,$.jsx)(`div`,{className:`shrink-0 px-3 pt-2.5 pb-3`,children:(0,$.jsx)(`button`,{onClick:()=>{if(Gt!==null){let e=(Mi.find(e=>e.id===Gt)?.tray??[]).some(e=>e.state===11),t=jn&&!e;if(Nn===`now`)La.mutate({amsId:Gt,temp:bn,duration:wn,filament:en,rotateTray:t});else{let e=Ai(Nn,Rn,qn);e&&Va.mutate({amsId:Gt,temp:bn,duration:wn,filament:en,rotateTray:t,startAfter:e})}}},disabled:La.isPending||Va.isPending||Nn===`at_time`&&!qn,"data-testid":`drying-start-confirm`,className:`w-full py-1.5 bg-bambu-green hover:bg-bambu-green/80 text-white text-xs font-medium rounded-lg transition-colors disabled:opacity-50`,children:Nn===`now`?La.isPending?W(`printers.drying.startingDrying`):W(`printers.drying.start`):W(`printers.drying.schedule`)})})]}),(0,$.jsx)(`div`,{className:`fixed z-[102] w-2.5 h-2.5 rotate-45 bg-bambu-dark-secondary border-bambu-dark-tertiary pointer-events-none`,style:{left:Yn.left+Yn.arrowLeft-5,top:Yn.anchorY-5,...Yn.placement===`above`?{borderRightWidth:1,borderBottomWidth:1}:{borderLeftWidth:1,borderTopWidth:1}}})]})})()]})}function bo({onClose:e,onAdd:t,existingSerials:n}){let{t:r}=l(),[a,o]=(0,X.useState)({name:``,serial_number:``,ip_address:``,access_code:``,model:``,location:``,auto_archive:!0}),[c,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)([]),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)([]),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(``),[T,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)({scanned:0,total:0}),[k,A]=(0,X.useState)(!1),[j,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)(null);(0,X.useEffect)(()=>{s.getInfo().then(e=>{v(e.is_docker),e.subnets.length>0&&(b(e.subnets),S(e.subnets[0]))}).catch(()=>{});try{let e=localStorage.getItem(`bambuddy.discovery.customSubnet`);e&&w(e)}catch{}},[]);let F=d.filter(e=>!n.includes(e.serial)),L=async e=>{e.preventDefault(),M(!0);try{let e=await i.diagnoseConnection({ip_address:a.ip_address.trim(),serial_number:a.serial_number.trim()||void 0,access_code:a.access_code||void 0});if(e.checks.some(e=>e.status===`fail`)){P(e);return}}catch{}finally{M(!1)}t(a)},R=async()=>{m(``),f([]),u(!0),g(!1),O({scanned:0,total:0});let e=T?C.trim():x,t=_||T;if(t&&T)try{localStorage.setItem(`bambuddy.discovery.customSubnet`,e)}catch{}try{if(t){await s.startSubnetScan(e);let t=setInterval(async()=>{try{let e=await s.getScanStatus();O({scanned:e.scanned,total:e.total}),f(await s.getDiscoveredPrinters()),e.running||(clearInterval(t),u(!1),g(!0))}catch(e){console.error(`Failed to get scan status:`,e)}},500)}else{await s.startDiscovery(10);let e=setInterval(async()=>{try{f(await s.getDiscoveredPrinters())}catch(e){console.error(`Failed to get discovered printers:`,e)}},1e3);setTimeout(async()=>{clearInterval(e);try{await s.stopDiscovery()}catch{}u(!1),g(!0);try{f(await s.getDiscoveredPrinters())}catch(e){console.error(`Failed to get final discovered printers:`,e)}},1e4)}}catch(e){console.error(`Failed to start discovery:`,e),m(e instanceof Error?e.message:r(`printers.discovery.failedToStart`)),u(!1),g(!0)}},ee=e=>{let t=e.serial.startsWith(`unknown-`)?``:e.serial;o({...a,name:e.name||``,serial_number:t,ip_address:e.ip_address,model:gr(e.model)}),f([])};return(0,X.useEffect)(()=>()=>{s.stopDiscovery().catch(()=>{}),s.stopSubnetScan().catch(()=>{})},[]),(0,X.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-start sm:items-center justify-center z-50 p-4 overflow-y-auto`,onClick:e,children:(0,$.jsx)(Rt,{className:`w-full max-w-md my-auto max-h-[calc(100vh-2rem)] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(Lt,{children:[(0,$.jsx)(`h2`,{className:`text-xl font-semibold mb-4`,children:r(`printers.addPrinter`)}),(0,$.jsxs)(`div`,{className:`mb-4 pb-4 border-b border-bambu-dark-tertiary`,children:[(0,$.jsxs)(`div`,{className:`mb-3`,children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.discovery.subnetToScan`)}),y.length>0?(0,$.jsxs)(`select`,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:T?`__custom__`:x,onChange:e=>{e.target.value===`__custom__`?E(!0):(E(!1),S(e.target.value))},disabled:c,children:[y.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e)),(0,$.jsx)(`option`,{value:`__custom__`,children:r(`printers.discovery.customSubnetOption`)})]}):(0,$.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:x,onChange:e=>S(e.target.value),placeholder:`192.168.1.0/24`,disabled:c}),T&&(0,$.jsx)(`input`,{type:`text`,"aria-label":r(`printers.discovery.customSubnetLabel`),className:`mt-2 w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:C,onChange:e=>w(e.target.value),placeholder:`10.1.1.0/24`,disabled:c}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-bambu-gray`,children:r(_?`printers.discovery.dockerNote`:`printers.discovery.customSubnetNote`)})]}),(0,$.jsx)(Y,{type:`button`,variant:`secondary`,onClick:R,disabled:c,className:`w-full`,children:c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{className:`w-4 h-4 animate-spin`}),(_||T)&&D.total>0?r(`printers.discovery.scanProgress`,{scanned:D.scanned,total:D.total}):r(`printers.discovery.scanning`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ae,{className:`w-4 h-4`}),r(_||T?`printers.discovery.scanSubnet`:`printers.discovery.discoverNetwork`)]})}),p&&(0,$.jsx)(`div`,{className:`mt-2 text-sm text-red-700 dark:text-red-400`,children:p}),F.length>0&&(0,$.jsx)(`div`,{className:`mt-3 space-y-2 max-h-40 overflow-y-auto`,children:F.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-2 bg-bambu-dark rounded-lg hover:bg-bambu-dark-secondary cursor-pointer transition-colors`,onClick:()=>ee(e),children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`font-medium text-white text-sm truncate`,children:e.name||e.serial}),(0,$.jsxs)(`p`,{className:`text-xs text-bambu-gray truncate`,children:[gr(e.model)||r(`printers.discovery.unknown`),` • `,e.ip_address,e.serial.startsWith(`unknown-`)&&(0,$.jsxs)(`span`,{className:`text-yellow-500`,children:[` • `,r(`printers.discovery.serialRequired`)]})]})]}),(0,$.jsx)(I,{className:`w-4 h-4 text-bambu-gray -rotate-90 flex-shrink-0 ml-2`})]},e.serial))}),c&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray text-center`,children:r(_||T?`printers.discovery.scanningSubnet`:`printers.discovery.scanningNetwork`)}),h&&!c&&d.length===0&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray text-center`,children:r(_||T?`printers.discovery.noPrintersFoundSubnet`:`printers.discovery.noPrintersFoundNetwork`)}),h&&!c&&d.length>0&&F.length===0&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray text-center`,children:r(`printers.discovery.allConfigured`)})]}),(0,$.jsxs)(`form`,{onSubmit:L,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.name`)}),(0,$.jsx)(`input`,{type:`text`,required:!0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:a.name,onChange:e=>o({...a,name:e.target.value}),placeholder:r(`printers.modal.myPrinter`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.ipAddress`)}),(0,$.jsx)(`input`,{type:`text`,required:!0,pattern:`(\\d{1,3}(\\.\\d{1,3}){3}|[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)*)`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:a.ip_address,onChange:e=>o({...a,ip_address:e.target.value}),placeholder:`192.168.1.100 or printer.local`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.serialNumber`)}),(0,$.jsx)(`input`,{type:`text`,required:!0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:a.serial_number,onChange:e=>o({...a,serial_number:e.target.value}),placeholder:`01P00A000000000`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.accessCode`)}),(0,$.jsx)(`input`,{type:`password`,required:!0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:a.access_code,onChange:e=>o({...a,access_code:e.target.value}),placeholder:r(`printers.modal.fromPrinterSettings`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.modal.modelOptional`)}),(0,$.jsxs)(`select`,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:a.model||``,onChange:e=>o({...a,model:e.target.value}),children:[(0,$.jsx)(`option`,{value:``,children:r(`printers.modal.selectModel`)}),(0,$.jsxs)(`optgroup`,{label:`A1 Series`,children:[(0,$.jsx)(`option`,{value:`A1`,children:`A1`}),(0,$.jsx)(`option`,{value:`A1 Mini`,children:`A1 Mini`})]}),(0,$.jsx)(`optgroup`,{label:`A2 Series`,children:(0,$.jsx)(`option`,{value:`A2L`,children:`A2L`})}),(0,$.jsxs)(`optgroup`,{label:`H2 Series`,children:[(0,$.jsx)(`option`,{value:`H2C`,children:`H2C`}),(0,$.jsx)(`option`,{value:`H2D`,children:`H2D`}),(0,$.jsx)(`option`,{value:`H2D Pro`,children:`H2D Pro`}),(0,$.jsx)(`option`,{value:`H2S`,children:`H2S`})]}),(0,$.jsxs)(`optgroup`,{label:`P Series`,children:[(0,$.jsx)(`option`,{value:`P1P`,children:`P1P`}),(0,$.jsx)(`option`,{value:`P1S`,children:`P1S`}),(0,$.jsx)(`option`,{value:`P2S`,children:`P2S`})]}),(0,$.jsxs)(`optgroup`,{label:`X1 Series`,children:[(0,$.jsx)(`option`,{value:`X1`,children:`X1`}),(0,$.jsx)(`option`,{value:`X1C`,children:`X1 Carbon`}),(0,$.jsx)(`option`,{value:`X1E`,children:`X1E`})]}),(0,$.jsx)(`optgroup`,{label:`X2 Series`,children:(0,$.jsx)(`option`,{value:`X2D`,children:`X2D`})})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.modal.locationGroup`)}),(0,$.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:a.location||``,onChange:e=>o({...a,location:e.target.value}),placeholder:r(`printers.modal.locationPlaceholder`),maxLength:100}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:r(`printers.locationHelp`)})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`auto_archive`,checked:a.auto_archive,onChange:e=>o({...a,auto_archive:e.target.checked}),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,$.jsx)(`label`,{htmlFor:`auto_archive`,className:`text-sm text-bambu-gray`,children:r(`printers.modal.autoArchiveLabel`)})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),disabled:!a.ip_address.trim(),className:`w-full flex items-center justify-center gap-2 px-3 py-2 text-sm text-bambu-gray hover:text-white disabled:opacity-40 disabled:cursor-not-allowed border border-bambu-dark-tertiary rounded-lg transition-colors`,children:[(0,$.jsx)(an,{className:`w-4 h-4`}),r(`diagnostic.runButton`)]}),N?(0,$.jsxs)(`div`,{className:`rounded-lg bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 p-3 space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(Ot,{className:`w-4 h-4 mt-0.5 flex-shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{className:`text-sm text-amber-700 dark:text-amber-300`,children:r(`printers.addPreflight.warning`)})]}),(0,$.jsx)(rr,{result:N}),(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>P(null),className:`flex-1`,children:r(`printers.addPreflight.back`)}),(0,$.jsx)(Y,{type:`button`,onClick:()=>t(a),className:`flex-1`,children:r(`printers.addPreflight.saveAnyway`)})]})]}):(0,$.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`secondary`,onClick:e,className:`flex-1`,children:r(`common.cancel`)}),(0,$.jsx)(Y,{type:`submit`,disabled:j,className:`flex-1`,children:r(j?`printers.addPreflight.checking`:`printers.addPrinter`)})]})]})]})})}),k&&(0,$.jsx)(Pn,{connection:{ip_address:a.ip_address.trim(),serial_number:a.serial_number.trim()||void 0,access_code:a.access_code||void 0},printerName:a.name||null,onClose:()=>A(!1)})]})}function xo({printer:e,firmwareInfo:t,onClose:n}){let{t:r}=l(),i=f(),{showToast:o}=te(),{hasPermission:s}=lr(),c=s(`firmware:update`),[u,d]=(0,X.useState)(null),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(t.update_available?t.latest_version:null),{data:x,isLoading:S}=p({queryKey:[`firmwarePrepare`,e.id,y],queryFn:()=>a.prepareUpload(e.id,y??void 0),staleTime:3e4,enabled:!!y&&c&&!h}),C=m({mutationFn:()=>a.startUpload(e.id,y??void 0),onSuccess:()=>{g(!0);let t=setInterval(async()=>{try{let n=await a.getUploadStatus(e.id);d(n),(n.status===`complete`||n.status===`error`)&&(clearInterval(t),v(null),g(!1),n.status===`complete`&&(o(r(`printers.firmwareModal.uploadedToast`),`success`),i.invalidateQueries({queryKey:[`firmwareUpdate`,e.id]})))}catch{}},2e3);v(t)},onError:e=>{o(r(`printers.firmwareModal.uploadFailed`,{error:e.message}),`error`),g(!1)}});return(0,X.useEffect)(()=>()=>{_&&clearInterval(_)},[_]),(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,$.jsx)(Rt,{className:`w-full max-w-md mx-4`,children:(0,$.jsxs)(Lt,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-full ${t.update_available?`bg-orange-100 dark:bg-orange-500/20`:`bg-status-ok/20`}`,children:t.update_available?(0,$.jsx)(ar,{className:`w-5 h-5 text-orange-600 dark:text-orange-400`}):(0,$.jsx)(ne,{className:`w-5 h-5 text-status-ok`})}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:t.update_available?r(`printers.firmwareModal.title`):r(`printers.firmwareModal.titleUpToDate`)}),(0,$.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e.name})]})]}),(()=>{let e=y?t.available_versions?.find(e=>e.version===y):null,n=y??t.latest_version,i=e?.release_notes??t.release_notes,a=!!n&&n!==t.current_version;return(0,$.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3 mb-4`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center text-sm`,children:[(0,$.jsx)(`span`,{className:`text-bambu-gray`,children:r(`printers.firmwareModal.currentVersion`)}),(0,$.jsx)(`span`,{className:`font-mono ${a?`text-white`:`text-status-ok`}`,children:t.current_version||r(`common.unknown`)})]}),a&&(0,$.jsxs)(`div`,{className:`flex justify-between items-center text-sm mt-1`,children:[(0,$.jsx)(`span`,{className:`text-bambu-gray`,children:r(`printers.firmwareModal.latestVersion`)}),(0,$.jsx)(`span`,{className:`text-orange-700 dark:text-orange-400 font-mono`,children:n})]}),i&&(0,$.jsxs)(`details`,{className:`mt-3 text-sm`,open:!a,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer hover:underline ${a?`text-orange-700 dark:text-orange-400`:`text-status-ok`}`,children:r(`printers.firmwareModal.releaseNotes`)}),(0,$.jsx)(`div`,{className:`mt-2 text-bambu-gray text-xs max-h-40 overflow-y-auto whitespace-pre-wrap`,children:i})]},n??`none`)]})})(),t.available_versions&&t.available_versions.length>0&&!h&&u?.status!==`complete`&&(0,$.jsxs)(`div`,{className:`mb-4`,children:[(0,$.jsx)(`div`,{className:`text-xs text-bambu-gray mb-2`,children:r(`printers.firmwareModal.availableVersions`)}),(0,$.jsx)(`div`,{className:`max-h-56 overflow-y-auto border border-bambu-dark-tertiary rounded-lg divide-y divide-bambu-dark-tertiary`,children:t.available_versions.map(e=>{let n=t.current_version===e.version,i=y===e.version,a=t.current_version?_i(e.version,t.current_version):0,o=r(n?`printers.firmwareModal.currentBadge`:a>0?`printers.firmwareModal.newerBadge`:`printers.firmwareModal.olderBadge`),s=n?`text-bambu-gray`:a>0?`text-orange-700 dark:text-orange-400`:`text-blue-700 dark:text-blue-400`;return(0,$.jsxs)(`button`,{type:`button`,disabled:!e.file_available||!c||n,onClick:()=>b(e.version),className:`w-full text-left px-3 py-2 text-sm flex items-center justify-between gap-2 transition-colors ${i?`bg-orange-50 dark:bg-orange-500/10`:`hover:bg-bambu-dark`} ${!e.file_available||!c||n?`opacity-60 cursor-not-allowed`:`cursor-pointer`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-mono text-white`,children:e.version}),(0,$.jsx)(`span`,{className:`text-xs ${s}`,children:o})]}),(0,$.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${n?`bg-blue-50 dark:bg-blue-500/15 text-blue-700 dark:text-blue-400 border border-blue-300 dark:border-blue-500/30`:e.file_available?`bg-bambu-green/15 text-bambu-green border border-bambu-green/30`:`bg-bambu-gray/10 text-bambu-gray border border-bambu-gray/30`}`,children:n?r(`printers.firmwareModal.installed`):e.file_available?r(`printers.firmwareModal.usable`):r(`printers.firmwareModal.unavailable`)})]},e.version)})})]}),y?S?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-sm mb-4`,children:[(0,$.jsx)(H,{className:`w-4 h-4 animate-spin`}),r(`printers.firmwareModal.checkingPrereqs`)]}):x&&!h&&!u?(0,$.jsx)(`div`,{className:`mb-4`,children:x.can_proceed?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-green text-sm`,children:[(0,$.jsx)(j,{className:`w-4 h-4`}),r(`printers.firmwareModal.sdCardReady`)]}):(0,$.jsx)(`div`,{className:`space-y-1`,children:x.errors.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-red-700 dark:text-red-400 text-sm`,children:[(0,$.jsx)(R,{className:`w-4 h-4 flex-shrink-0`}),e]},t))})}):null:null,(h||u)&&u&&(0,$.jsxs)(`div`,{className:`mb-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-sm mb-1`,children:[(0,$.jsx)(`span`,{className:`text-bambu-gray capitalize`,children:u.status}),(0,$.jsxs)(`span`,{className:`text-white`,children:[u.progress,`%`]})]}),(0,$.jsx)(`div`,{className:`w-full bg-bambu-dark-tertiary rounded-full h-2`,children:(0,$.jsx)(`div`,{className:`h-2 rounded-full transition-all ${u.status===`error`?`bg-status-error`:u.status===`complete`?`bg-status-ok`:`bg-orange-500`} ${u.status===`uploading`?`animate-pulse`:``}`,style:{width:`${u.progress}%`}})}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:u.message}),u.error&&(0,$.jsx)(`p`,{className:`text-xs text-red-700 dark:text-red-400 mt-1`,children:u.error})]}),u?.status===`complete`&&(0,$.jsxs)(`div`,{className:`bg-bambu-green/10 border border-bambu-green/30 rounded-lg p-3 mb-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-bambu-green font-medium mb-2`,children:r(`printers.firmwareModal.uploadedSuccess`)}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:r(`printers.firmwareModal.applyInstructions`)}),(0,$.jsxs)(`ol`,{className:`text-xs text-bambu-gray mt-1 list-decimal list-inside space-y-1`,children:[(0,$.jsx)(`li`,{dangerouslySetInnerHTML:{__html:r(`printers.firmwareModal.step1`)}}),(0,$.jsx)(`li`,{dangerouslySetInnerHTML:{__html:r(`printers.firmwareModal.step2`)}}),(0,$.jsx)(`li`,{dangerouslySetInnerHTML:{__html:r(`printers.firmwareModal.step3`)}}),(0,$.jsx)(`li`,{children:r(`printers.firmwareModal.step4`)})]})]}),(0,$.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,$.jsx)(Y,{variant:`secondary`,onClick:n,children:u?.status===`complete`?r(`printers.firmwareModal.done`):r(`common.cancel`)}),x?.can_proceed&&!h&&u?.status!==`complete`&&c&&(0,$.jsx)(Y,{onClick:()=>{d(null),C.mutate()},disabled:C.isPending,children:C.isPending?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{className:`w-4 h-4 animate-spin mr-2`}),r(`printers.firmwareModal.starting`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ar,{className:`w-4 h-4 mr-2`}),r(`printers.firmwareModal.uploadFirmware`)]})})]})]})})})}function So({printer:e,onClose:t}){let{t:n}=l(),r=f(),{showToast:a}=te(),{authEnabled:o,isAdmin:s}=lr(),[c,u]=(0,X.useState)({name:e.name,ip_address:e.ip_address,access_code:``,model:e.model||``,location:e.location||``,auto_archive:e.auto_archive,is_active:e.is_active,wear_cost_per_hour:e.wear_cost_per_hour?String(e.wear_cost_per_hour):``}),{data:d}=p({queryKey:[`settings`],queryFn:i.getSettings}),h=Rn(d?.currency||`USD`),{data:g}=p({queryKey:[`groups`],queryFn:()=>i.getGroups(),enabled:o&&s}),_=c.location.trim(),v=_===(e.location||``)?[]:(g??[]).filter(t=>t.restrict_printers&&(t.locations??[]).some(t=>t===e.location||t===_)).map(e=>e.name),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(null),C=m({mutationFn:t=>i.updatePrinter(e.id,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`printers`]}),r.invalidateQueries({queryKey:[`printerStatus`,e.id]}),t()},onError:e=>a(e.message||n(`printers.toast.failedToUpdate`),`error`)});(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let w=()=>{let e={name:c.name,ip_address:c.ip_address,model:c.model||void 0,location:c.location.trim()||null,auto_archive:c.auto_archive,is_active:c.is_active,wear_cost_per_hour:Number(c.wear_cost_per_hour)>0?Number(c.wear_cost_per_hour):null};c.access_code&&(e.access_code=c.access_code),C.mutate(e)};return(0,$.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-start sm:items-center justify-center z-50 p-4 overflow-y-auto`,onClick:t,children:(0,$.jsx)(Rt,{className:`w-full max-w-md my-auto max-h-[calc(100vh-2rem)] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(Lt,{children:[(0,$.jsx)(`h2`,{className:`text-xl font-semibold mb-4`,children:n(`printers.editPrinter`)}),(0,$.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),b(!0);try{let t=await i.diagnoseConnection({ip_address:c.ip_address.trim(),serial_number:e.serial_number,access_code:c.access_code||void 0});if(t.checks.some(e=>e.status===`fail`)){S(t);return}}catch{}finally{b(!1)}w()},className:`space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.name`)}),(0,$.jsx)(`input`,{type:`text`,required:!0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:n(`printers.modal.myPrinter`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.ipAddress`)}),(0,$.jsx)(`input`,{type:`text`,required:!0,pattern:`(\\d{1,3}(\\.\\d{1,3}){3}|[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)*)`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:c.ip_address,onChange:e=>u({...c,ip_address:e.target.value}),placeholder:`192.168.1.100 or printer.local`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.serialNumber`)}),(0,$.jsx)(`input`,{type:`text`,disabled:!0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray cursor-not-allowed`,value:e.serial_number}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`printers.serialCannotBeChanged`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.accessCode`)}),(0,$.jsx)(`input`,{type:`password`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:c.access_code,onChange:e=>u({...c,access_code:e.target.value}),placeholder:n(`printers.accessCodePlaceholder`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.model`)}),(0,$.jsxs)(`select`,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:c.model,onChange:e=>u({...c,model:e.target.value}),children:[(0,$.jsx)(`option`,{value:``,children:n(`printers.modal.selectModel`)}),(0,$.jsxs)(`optgroup`,{label:`A1 Series`,children:[(0,$.jsx)(`option`,{value:`A1`,children:`A1`}),(0,$.jsx)(`option`,{value:`A1 Mini`,children:`A1 Mini`})]}),(0,$.jsx)(`optgroup`,{label:`A2 Series`,children:(0,$.jsx)(`option`,{value:`A2L`,children:`A2L`})}),(0,$.jsxs)(`optgroup`,{label:`H2 Series`,children:[(0,$.jsx)(`option`,{value:`H2C`,children:`H2C`}),(0,$.jsx)(`option`,{value:`H2D`,children:`H2D`}),(0,$.jsx)(`option`,{value:`H2D Pro`,children:`H2D Pro`}),(0,$.jsx)(`option`,{value:`H2S`,children:`H2S`})]}),(0,$.jsxs)(`optgroup`,{label:`P Series`,children:[(0,$.jsx)(`option`,{value:`P1P`,children:`P1P`}),(0,$.jsx)(`option`,{value:`P1S`,children:`P1S`}),(0,$.jsx)(`option`,{value:`P2S`,children:`P2S`})]}),(0,$.jsxs)(`optgroup`,{label:`X1 Series`,children:[(0,$.jsx)(`option`,{value:`X1`,children:`X1`}),(0,$.jsx)(`option`,{value:`X1C`,children:`X1 Carbon`}),(0,$.jsx)(`option`,{value:`X1E`,children:`X1E`})]}),(0,$.jsx)(`optgroup`,{label:`X2 Series`,children:(0,$.jsx)(`option`,{value:`X2D`,children:`X2D`})})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Location / Group`}),(0,$.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:c.location,onChange:e=>u({...c,location:e.target.value}),placeholder:n(`printers.modal.locationPlaceholder`),maxLength:100}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`printers.locationHelp`)}),v.length>0&&(0,$.jsxs)(`p`,{className:`flex items-start gap-1.5 text-xs text-yellow-700 dark:text-yellow-400 mt-1`,children:[(0,$.jsx)(Ot,{className:`w-3.5 h-3.5 shrink-0 mt-px`}),n(`printerAccess.moveWarning`,{groups:v.join(`, `)})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`edit_auto_archive`,checked:c.auto_archive,onChange:e=>u({...c,auto_archive:e.target.checked}),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,$.jsx)(`label`,{htmlFor:`edit_auto_archive`,className:`text-sm text-bambu-gray`,children:n(`printers.modal.autoArchiveLabel`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`edit_wear_cost`,className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.modal.wearCostLabel`,{currency:h})}),(0,$.jsx)(`input`,{id:`edit_wear_cost`,type:`number`,min:0,step:`0.01`,inputMode:`decimal`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:c.wear_cost_per_hour,onChange:e=>u({...c,wear_cost_per_hour:e.target.value}),placeholder:`0.00`}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`printers.modal.wearCostHelp`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`edit_maintenance_mode`,checked:!c.is_active,onChange:e=>u({...c,is_active:!e.target.checked}),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-amber-400 focus:ring-amber-400`}),(0,$.jsxs)(`label`,{htmlFor:`edit_maintenance_mode`,className:`text-sm text-bambu-gray flex items-center gap-1.5`,children:[(0,$.jsx)(sr,{className:`w-3.5 h-3.5 text-amber-600 dark:text-amber-400`}),n(`printers.maintenance.editFieldLabel`)]})]}),(0,$.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1 ml-6`,children:n(`printers.maintenance.editFieldHelp`)})]}),x?(0,$.jsxs)(`div`,{className:`rounded-lg bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 p-3 space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(Ot,{className:`w-4 h-4 mt-0.5 flex-shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{className:`text-sm text-amber-700 dark:text-amber-300`,children:n(`printers.addPreflight.warning`)})]}),(0,$.jsx)(rr,{result:x}),(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>S(null),className:`flex-1`,children:n(`printers.addPreflight.back`)}),(0,$.jsx)(Y,{type:`button`,onClick:w,className:`flex-1`,disabled:C.isPending,children:n(`printers.addPreflight.saveAnyway`)})]})]}):(0,$.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[(0,$.jsx)(Y,{type:`button`,variant:`secondary`,onClick:t,className:`flex-1`,children:n(`common.cancel`)}),(0,$.jsx)(Y,{type:`submit`,className:`flex-1`,disabled:C.isPending||y,children:y?n(`printers.addPreflight.checking`):C.isPending?n(`common.saving`):n(`printers.modal.saveChanges`)})]})]})]})})})}function Co(e){let{data:t}=p({queryKey:[`printerStatus`,e],queryFn:()=>i.getPrinterStatus(e),refetchInterval:3e4});return!t?.connected}function wo({printer:e,plug:t,onPowerOn:n,isPowering:r}){let a=Co(e.id),{data:o}=p({queryKey:[`smartPlugStatus`,t.id],queryFn:()=>i.getSmartPlugStatus(t.id),refetchInterval:1e4});return a?(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 hover:bg-gray-100 dark:hover:bg-bambu-dark-tertiary`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),o&&(0,$.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded ${o.state===`ON`?`bg-bambu-green/20 text-bambu-green`:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`}`,children:o.state||`?`})]}),(0,$.jsxs)(`button`,{onClick:()=>n(t.id),disabled:r||o?.state===`ON`,className:`px-2 py-1 text-xs rounded transition-colors flex items-center gap-1 ${o?.state===`ON`?`bg-bambu-green/20 text-bambu-green cursor-default`:`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green hover:text-white`}`,children:[(0,$.jsx)(jn,{className:`w-3 h-3`}),r?`...`:`On`]})]}):null}function To(){let{t:e}=l(),{resolvedMode:t,darkAccent:n,lightAccent:r}=ir(),a={green:`bg-green-500 text-white hover:bg-green-400 border-green-400/60`,teal:`bg-teal-500 text-white hover:bg-teal-400 border-teal-400/60`,blue:`bg-blue-500 text-white hover:bg-blue-400 border-blue-400/60`,orange:`bg-orange-500 text-white hover:bg-orange-400 border-orange-400/60`,purple:`bg-purple-500 text-white hover:bg-purple-400 border-purple-400/60`,red:`bg-red-500 text-white hover:bg-red-400 border-red-400/60`}[t===`dark`?n:r],[o,s]=(0,X.useState)(!1),[u,d]=(0,X.useState)(()=>localStorage.getItem(`hideDisconnectedPrinters`)===`true`),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(()=>localStorage.getItem(`printerSortBy`)||`name`),[x,w]=(0,X.useState)(()=>localStorage.getItem(`printerSortAsc`)!==`false`),[T,D]=(0,X.useState)(()=>{let e=localStorage.getItem(`printerCardSize`);return e?parseInt(e,10):2}),[O,k]=(0,X.useState)(()=>localStorage.getItem(`printerPageView`)===`camwall`?`camwall`:`cards`),[A,M]=(0,X.useState)(()=>{let e=parseInt(localStorage.getItem(`camWallMaxLive`)||``,10);return Number.isFinite(e)&&e>0?e:4}),[N,P]=(0,X.useState)(()=>{let e=parseInt(localStorage.getItem(`camWallSnapshotSec`)||``,10);return Number.isFinite(e)&&e>0?e:8}),[F,L]=(0,X.useState)(()=>{let e=parseInt(localStorage.getItem(`camWallTileSize`)||``,10);return e>=1&&e<=4?e:2}),[R,ee]=(0,X.useState)(()=>{let e=localStorage.getItem(`camWallStatusMode`);return e===`off`||e===`compact`||e===`full`?e:`full`}),ne=T===1?`compact`:`expanded`,[z,re]=(0,X.useState)(null),B=(0,X.useCallback)(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(`printer-card-${e}`);if(!t)return;let n=document.querySelector(`header`)?.getBoundingClientRect().height??56,r=t.getBoundingClientRect().top+window.scrollY-n-16;window.scrollTo({top:Math.max(0,r),behavior:`smooth`})})})},[]),ie=(0,X.useCallback)(e=>{re(e),D(2),localStorage.setItem(`printerCardSize`,`2`),B(e)},[B]),ae=(0,X.useCallback)(()=>{let e=z;re(null),D(1),localStorage.setItem(`printerCardSize`,`1`),e!=null&&B(e)},[z,B]),[V,oe]=(0,X.useState)(``),[se,ce]=(0,X.useState)(()=>{let e=localStorage.getItem(`printerStatusFilter`);return Aa(e)?e:`all`}),[ue,de]=(0,X.useState)(()=>localStorage.getItem(`printerLocationFilter`)||`all`),[fe,H]=(0,X.useState)(0),[me,he]=(0,X.useState)(()=>{try{let e=localStorage.getItem(`printerCollapsedSections`);return e?JSON.parse(e):{}}catch{return{}}}),U=f(),{showToast:ge}=te(),{hasPermission:_e}=lr(),[ve,ye]=(0,X.useState)(()=>Ti()),[W,G]=(0,X.useState)(()=>{let e=localStorage.getItem(`openEmbeddedCameras`);if(e)try{let t=JSON.parse(e);return new Map(t.map(e=>[e.id,e]))}catch{return new Map}return new Map});(0,X.useEffect)(()=>{let e=Array.from(W.values());e.length>0?localStorage.setItem(`openEmbeddedCameras`,JSON.stringify(e)):localStorage.removeItem(`openEmbeddedCameras`)},[W]);let{data:K,isLoading:Te}=p({queryKey:[`printers`],queryFn:i.getPrinters}),{data:q}=p({queryKey:[`ui-preferences`],queryFn:i.getUiPreferences}),Ee=q!==void 0&&q.check_printer_firmware!==!1,De=(0,X.useMemo)(()=>xe(q?.nozzle_temp_presets,be,0,320),[q?.nozzle_temp_presets]),Oe=(0,X.useMemo)(()=>xe(q?.bed_temp_presets,Ce,0,140),[q?.bed_temp_presets]),ke=(0,X.useMemo)(()=>xe(q?.chamber_temp_presets,we,0,65),[q?.chamber_temp_presets]),je=(0,X.useMemo)(()=>xe(q?.fan_speed_presets,Se,0,100),[q?.fan_speed_presets]),Me=(0,X.useMemo)(()=>{if(q?.drying_presets)try{let e=JSON.parse(q.drying_presets);if(typeof e==`object`&&e&&Object.keys(e).length>0)return{...ho,...e}}catch{}return ho},[q?.drying_presets]),Ne=ve??(q?.camera_view_mode===`embedded`?`embedded`:`window`),Pe=(0,X.useCallback)(e=>{Ei(e),ye(e),_e(`settings:update`)&&i.updateSettings({camera_view_mode:e}).then(()=>U.invalidateQueries({queryKey:[`ui-preferences`]})).catch(e=>console.warn(`Could not save camera view mode as the default:`,e))},[_e,U]),{data:Fe}=p({queryKey:[`smart-plugs`],queryFn:i.getSmartPlugs}),{data:Ie}=p({queryKey:[`maintenanceOverview`],queryFn:i.getMaintenanceOverview,staleTime:60*1e3}),{data:Le}=p({queryKey:[`obico-printer-status`],queryFn:i.getObicoPrinterStatus,refetchInterval:1e4}),Re=(0,X.useCallback)(e=>Le?.enabled===!0&&(Le.monitored_printers===null||Le.monitored_printers.includes(e)),[Le]),{data:ze}=p({queryKey:[`spoolman-status`],queryFn:i.getSpoolmanStatus,staleTime:60*1e3}),Be=ze?.enabled&&ze?.connected,{data:Ve}=p({queryKey:[`spoolman-settings`],queryFn:i.getSpoolmanSettings,enabled:!!Be,staleTime:60*1e3}),He=Ve?.spoolman_sync_mode,{data:Ue}=p({queryKey:[`unlinked-spools`],queryFn:i.getUnlinkedSpools,enabled:!!Be,staleTime:30*1e3}),We=Ue&&Ue.length>0,{data:Ge}=p({queryKey:[`linked-spools`],queryFn:i.getLinkedSpools,enabled:!!Be,staleTime:30*1e3}),Ke=Ge?.linked,{data:qe}=p({queryKey:[`spool-assignments`],queryFn:()=>i.getAssignments(),enabled:_e(`inventory:view_assignments`),staleTime:30*1e3}),Je=m({mutationFn:({printerId:e,amsId:t,trayId:n})=>i.unassignSpool(e,t,n),onSuccess:()=>{U.invalidateQueries({queryKey:[`spool-assignments`]})}}),{data:Ye,isLoading:Xe}=p({queryKey:[`spoolman-inventory-spools`],queryFn:()=>i.getSpoolmanInventorySpools(!1),enabled:!!Be,staleTime:30*1e3}),{data:Ze,isLoading:Qe}=p({queryKey:[`spoolman-slot-assignments`],queryFn:()=>i.getSpoolmanSlotAssignments(),enabled:!!Be,staleTime:30*1e3}),$e=m({mutationFn:e=>i.unassignSpoolmanSlot(e),onSuccess:()=>{U.invalidateQueries({queryKey:[`spoolman-inventory-spools`]}),U.invalidateQueries({queryKey:[`spoolman-slot-assignments`]})}}),et=(e,t,n)=>qe?.find(r=>r.printer_id===e&&r.ams_id===Number(t)&&r.tray_id===Number(n)),tt=Ie?.reduce((e,t)=>(e[t.printer_id]={due_count:t.due_count,warning_count:t.warning_count,total_print_hours:t.total_print_hours},e),{})||{},nt=Fe?.reduce((e,t)=>(t.printer_id&&(e[t.printer_id]=t),e),{})||{},rt=m({mutationFn:i.createPrinter,onSuccess:()=>{U.invalidateQueries({queryKey:[`printers`]}),U.invalidateQueries({queryKey:[`maintenanceOverview`]}),s(!1)},onError:t=>{if(t instanceof c&&t.code===`printer_connection_failed`){ge(e(`printers.toast.connectionFailedNotAdded`),`error`);return}ge(t.message||e(`printers.toast.failedToAdd`),`error`)}}),it=m({mutationFn:e=>i.controlSmartPlug(e,`on`),onSuccess:()=>{U.invalidateQueries({queryKey:[`smart-plugs`]}),v(null)},onError:()=>{v(null)}}),[at,ot]=(0,X.useState)(new Set),[st,ct]=(0,X.useState)(!1),[lt,ut]=(0,X.useState)(null),[dt,ft]=(0,X.useState)(!1),pt=st||at.size>0,mt=(0,X.useCallback)(e=>{ot(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),ht=(0,X.useCallback)(()=>{ot(new Set),ct(!1)},[]);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&pt&&ht()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[pt,ht]);let gt=(0,X.useCallback)(async t=>{ft(!0);let n=Array.from(at).filter(e=>{let n=U.getQueryData([`printerStatus`,e]);if(t===`clearPlate`)return!!n?.awaiting_plate_clear;if(!n?.connected)return!1;switch(t){case`stop`:return n.state===`RUNNING`||n.state===`PAUSE`;case`pause`:return n.state===`RUNNING`;case`resume`:return n.state===`PAUSE`;case`clearHMS`:return n.hms_errors&&Mt(n.hms_errors).length>0;default:return!1}});if(n.length===0){ge(e(`printers.bulk.noneApplicable`),`error`),ft(!1),ut(null);return}let r={stop:i.stopPrint,pause:i.pausePrint,resume:i.resumePrint,clearPlate:i.clearPlate,clearHMS:i.clearHMSErrors}[t],a=await Promise.allSettled(n.map(e=>r(e))),o=a.filter(e=>e.status===`fulfilled`).length,s=a.filter(e=>e.status===`rejected`).length;s===0?ge(e(`printers.bulk.success`,{action:e(`printers.bulk.actions.${t}`),count:o})):ge(e(`printers.bulk.partial`,{succeeded:o,failed:s}),`error`),n.forEach(e=>{U.invalidateQueries({queryKey:[`printerStatus`,e]})}),ft(!1),ut(null)},[at,U,ge,e]),_t=(0,X.useCallback)(e=>{e===`stop`||e===`pause`||e===`clearPlate`?ut(e):gt(e)},[gt]),vt=()=>{let e=!u;d(e),localStorage.setItem(`hideDisconnectedPrinters`,String(e))},yt=e=>{b(e),localStorage.setItem(`printerSortBy`,e)},bt=e=>{ce(e),localStorage.setItem(`printerStatusFilter`,e)},xt=e=>{de(e),localStorage.setItem(`printerLocationFilter`,e)},St=()=>{let e=!x;w(e),localStorage.setItem(`printerSortAsc`,String(e))},Ct=()=>{switch(T){case 1:return`grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5`;case 2:return`grid-cols-1 md:grid-cols-2 xl:grid-cols-3`;case 3:return`grid-cols-1 lg:grid-cols-2`;case 4:return`grid-cols-1`;default:return`grid-cols-1 md:grid-cols-2 xl:grid-cols-3`}},wt=[`S`,`M`,`L`,`XL`];(0,X.useEffect)(()=>U.getQueryCache().subscribe(e=>{e.type===`updated`&&Array.isArray(e.query.queryKey)&&e.query.queryKey[0]===`printerStatus`&&H(e=>e+1)}),[U]);let Tt=(0,X.useMemo)(()=>{if(!K)return[];let e=K;if(V.trim()){let t=V.trim().toLowerCase();e=e.filter(e=>e.name.toLowerCase().includes(t)||(e.model||``).toLowerCase().includes(t)||(e.location||``).toLowerCase().includes(t)||(e.serial_number||``).toLowerCase().includes(t))}return ue!==`all`&&(e=e.filter(e=>(e.location||``)===ue)),se!==`all`&&(e=e.filter(e=>{let t=U.getQueryData([`printerStatus`,e.id]);if(!t?.connected)return se===`offline`;let n=t.hms_errors?Mt(t.hms_errors):[];switch(se){case`printing`:return t.state===`RUNNING`;case`paused`:return t.state===`PAUSE`;case`finished`:return t.state===`FINISH`;case`error`:return t.state===`FAILED`||n.length>0;case`idle`:return t.state!==`RUNNING`&&t.state!==`PAUSE`&&t.state!==`FINISH`&&t.state!==`FAILED`&&n.length===0;case`offline`:return!1;default:return!0}})),e},[K,V,se,ue,U,fe]),Et=(0,X.useMemo)(()=>K?[...new Set(K.map(e=>e.location||``).filter(Boolean))].sort():[],[K]);(0,X.useEffect)(()=>{!K||ue===`all`||Et.includes(ue)||(de(`all`),localStorage.setItem(`printerLocationFilter`,`all`))},[K,Et,ue]);let Dt=(0,X.useMemo)(()=>{let e=[...Tt];switch(y){case`name`:e.sort((e,t)=>e.name.localeCompare(t.name));break;case`model`:e.sort((e,t)=>(e.model||``).localeCompare(t.model||``));break;case`location`:e.sort((e,t)=>{let n=e.location||``,r=t.location||``;return!n&&r?1:n&&!r?-1:n.localeCompare(r)||e.name.localeCompare(t.name)});break;case`status`:e.sort((e,t)=>{let n=U.getQueryData([`printerStatus`,e.id]),r=U.getQueryData([`printerStatus`,t.id]),i=e=>e?.connected?(e.hms_errors?Mt(e.hms_errors):[]).length>0?0:e.state===`RUNNING`?1:2:3;return i(n)-i(r)});break;case`eta`:e.sort((e,t)=>{let n=U.getQueryData([`printerStatus`,e.id]),r=U.getQueryData([`printerStatus`,t.id]),i=e=>e?.connected?e.state===`RUNNING`&&e.remaining_time!=null&&e.remaining_time>0?0:e.state===`RUNNING`?1:2:3,a=i(n),o=i(r);if(a!==o)return a-o;if(a===0){let e=(n.remaining_time??0)-(r.remaining_time??0);if(e!==0)return e}return e.name.localeCompare(t.name)});break}return x||e.reverse(),e},[Tt,y,x,U]),Ot=(0,X.useCallback)(()=>{ot(new Set(Dt.map(e=>e.id))),ct(!0)},[Dt]),kt=(0,X.useCallback)(e=>{ot(t=>{let n=new Set(t);return Dt.forEach(t=>{lo(U.getQueryData([`printerStatus`,t.id]))===e&&n.add(t.id)}),n}),ct(!0)},[Dt,U]),At=(0,X.useCallback)(e=>{ot(t=>{let n=new Set(t);return Dt.filter(t=>(t.location||``)===e).forEach(e=>n.add(e.id)),n}),ct(!0)},[Dt]),jt=(0,X.useCallback)(e=>{ot(t=>{let n=new Set(t);return Dt.filter(t=>(t.model||`Unknown`)===e).forEach(e=>n.add(e.id)),n}),ct(!0)},[Dt]),Ft=(0,X.useCallback)(e=>{he(t=>{let n={...t,[e]:!t[e]};try{localStorage.setItem(`printerCollapsedSections`,JSON.stringify(n))}catch{}return n})},[]),It=(0,X.useMemo)(()=>{if(y===`name`||y===`eta`)return null;let e={};return y===`location`?Dt.forEach(t=>{let n=t.location||`Ungrouped`;e[n]||(e[n]=[]),e[n].push(t)}):y===`model`?Dt.forEach(t=>{let n=t.model||`Unknown`;e[n]||(e[n]=[]),e[n].push(t)}):y===`status`&&Dt.forEach(t=>{let n=lo(U.getQueryData([`printerStatus`,t.id]));e[n]||(e[n]=[]),e[n].push(t)}),e},[y,Dt,U,fe]),zt=(0,X.useRef)(null),Bt=(0,X.useRef)(null),Vt=(0,X.useRef)(0),[Ht,Ut]=(0,X.useState)(!1),Wt=(0,X.useCallback)(()=>{let e=zt.current;if(!e)return;let t=Bt.current?.offsetWidth;t&&(Vt.current=t);let n=Vt.current>0&&e.clientWidthe===n?e:n)},[]),Gt=Object.keys(nt).length;(0,X.useLayoutEffect)(()=>{Wt();let e=zt.current;if(!e)return;if(typeof ResizeObserver>`u`)return window.addEventListener(`resize`,Wt),()=>window.removeEventListener(`resize`,Wt);let t=new ResizeObserver(()=>Wt());return t.observe(e),window.addEventListener(`resize`,Wt),()=>{t.disconnect(),window.removeEventListener(`resize`,Wt)}},[Wt,K?.length,Et.length,u,Gt]);let Kt=(t=!1)=>(0,$.jsxs)($.Fragment,{children:[K&&K.length>0&&(0,$.jsx)(no,{value:se,onChange:bt,fullWidth:t,options:ka.map(t=>({value:t.value,label:e(t.labelKey)}))}),K&&K.length>0&&Et.length>0&&(0,$.jsx)(no,{value:ue,onChange:xt,fullWidth:t,options:[{value:`all`,label:e(`printers.filter.allLocations`)},...Et.map(e=>({value:e,label:e}))]}),(0,$.jsx)(`button`,{type:`button`,onClick:vt,"aria-pressed":u,className:`h-8 px-2 rounded-lg border text-sm font-medium transition-colors ${t?`w-full`:``} ${u?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,children:e(`printers.hideOffline`)})]}),qt=(t=!1)=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 ${t?`w-full`:``}`,children:[(0,$.jsx)(no,{value:y,onChange:yt,fullWidth:t,options:[{value:`name`,label:e(`printers.sort.name`)},{value:`status`,label:e(`printers.sort.status`)},{value:`model`,label:e(`printers.sort.model`)},{value:`location`,label:e(`printers.sort.location`)},{value:`eta`,label:e(`printers.sort.eta`)}]}),(0,$.jsx)(`button`,{onClick:St,className:`h-8 shrink-0 px-2 rounded-lg border bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center justify-center`,title:e(x?`printers.sort.descending`:`printers.sort.ascending`),children:x?(0,$.jsx)(E,{className:`w-4 h-4 text-white`}):(0,$.jsx)(S,{className:`w-4 h-4 text-white`})}),(0,$.jsx)(bn,{to:`/printer-locations`,className:`h-8 shrink-0 px-2 rounded-lg border bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center justify-center`,title:e(`printers.locations.title`),"aria-label":e(`printers.locations.title`),children:(0,$.jsx)(j,{className:`w-4 h-4 text-bambu-green`})})]}),(0,$.jsxs)(`div`,{className:`flex h-8 items-center bg-bambu-dark rounded-lg border border-bambu-dark-tertiary ${t?`w-full`:``}`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{k(`cards`),localStorage.setItem(`printerPageView`,`cards`)},className:`flex h-full items-center gap-1 rounded-l-lg px-2 text-xs font-medium transition-colors ${t?`flex-1 justify-center`:``} ${O===`cards`?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,title:e(`printers.pageView.cards`),"aria-pressed":O===`cards`,children:[(0,$.jsx)(pe,{className:`w-3.5 h-3.5`}),t&&(0,$.jsx)(`span`,{children:e(`printers.pageView.cards`)})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{k(`camwall`),localStorage.setItem(`printerPageView`,`camwall`)},className:`flex h-full items-center gap-1 rounded-r-lg px-2 text-xs font-medium transition-colors ${t?`flex-1 justify-center`:``} ${O===`camwall`?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,title:e(`printers.pageView.camWall`),"aria-pressed":O===`camwall`,disabled:!_e(`camera:view`),children:[(0,$.jsx)(J,{className:`w-3.5 h-3.5`}),t&&(0,$.jsx)(`span`,{children:e(`printers.pageView.camWall`)})]})]}),O===`camwall`&&_e(`camera:view`)&&(0,$.jsxs)(bn,{to:`/camwall`,className:`flex h-8 items-center gap-1 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark px-2 text-xs font-medium text-white transition-colors hover:bg-bambu-dark-tertiary ${t?`w-full justify-center`:``}`,title:e(`printers.pageView.openCamWallPage`),children:[(0,$.jsx)($t,{className:`w-3.5 h-3.5`}),t&&(0,$.jsx)(`span`,{children:e(`printers.pageView.openCamWallPage`)})]}),(0,$.jsx)(`div`,{className:`flex h-8 items-center bg-bambu-dark rounded-lg border border-bambu-dark-tertiary ${t?`w-full`:``}`,children:wt.map((n,r)=>{let i=r+1,a=(O===`camwall`?F:T)===i;return(0,$.jsx)(`button`,{onClick:()=>{if(O===`camwall`){L(i),localStorage.setItem(`camWallTileSize`,String(i));return}re(null),D(i),localStorage.setItem(`printerCardSize`,String(i))},className:`h-full px-2 text-xs font-medium transition-colors ${t?`flex-1`:``} ${r===0?`rounded-l-lg`:``} ${r===wt.length-1?`rounded-r-lg`:``} ${a?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,title:e(`printers.${O===`camwall`?`camWall.tileSize`:`cardSize`}.${[`small`,`medium`,`large`,`extraLarge`][r]}`),children:n},n)})})]}),Jt=(t=!1)=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{onClick:()=>{pt?ht():ct(!0)},className:`h-8 px-2 rounded-lg border transition-colors ${t?`w-full justify-center gap-1.5 text-sm font-medium flex items-center`:``} ${pt?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,title:e(`printers.bulk.select`),disabled:!_e(`printers:control`),children:[(0,$.jsx)(xn,{className:`w-4 h-4`}),t&&(0,$.jsx)(`span`,{children:e(`printers.bulk.select`)})]}),u&&Object.keys(nt).length>0&&(0,$.jsxs)(`div`,{className:`relative ${t?`w-full`:``}`,children:[(0,$.jsxs)(`button`,{onClick:()=>g(!h),className:`h-8 flex items-center gap-1.5 px-2 text-sm rounded-lg border transition-colors ${t?`w-full justify-between bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary hover:text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(jn,{className:`w-4 h-4`}),e(`printers.powerOn`)]}),(0,$.jsx)(I,{className:`w-3 h-3 transition-transform ${h?`rotate-180`:``}`})]}),h&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>g(!1)}),(0,$.jsxs)(`div`,{className:`absolute right-0 mt-2 w-56 bg-white dark:bg-bambu-dark-secondary border border-gray-200 dark:border-bambu-dark-tertiary rounded-lg shadow-lg z-20 py-1`,children:[(0,$.jsx)(`div`,{className:`px-3 py-2 text-xs text-gray-500 dark:text-bambu-gray border-b border-gray-200 dark:border-bambu-dark-tertiary`,children:e(`printers.offlinePrintersWithPlugs`)}),K?.filter(e=>nt[e.id]).map(e=>(0,$.jsx)(wo,{printer:e,plug:nt[e.id],onPowerOn:e=>{v(e),it.mutate(e)},isPowering:_===nt[e.id]?.id},e.id)),K?.filter(e=>nt[e.id]).length===0&&(0,$.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:`No printers with smart plugs`})]})]})]}),(0,$.jsxs)(Y,{onClick:()=>s(!0),disabled:!_e(`printers:create`),title:_e(`printers:create`)?void 0:e(`printers.permission.noAdd`),className:`!h-8 !min-h-8 px-2 py-0 ${t?`w-full`:``}`,children:[(0,$.jsx)(Nn,{className:`w-4 h-4`}),e(`printers.addPrinter`)]})]});return(0,$.jsxs)(`div`,{className:`p-4 md:p-8`,children:[(0,$.jsxs)(`div`,{className:`space-y-3 mb-6`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,$.jsx)(ln,{className:`w-7 h-7 text-bambu-green`}),e(`printers.title`)]}),(0,$.jsx)(to,{printers:K})]}),(0,$.jsxs)(`div`,{ref:zt,className:`relative flex items-center gap-2`,children:[K&&K.length>0&&(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,$.jsx)(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50`}),(0,$.jsx)(`input`,{type:`search`,name:`printer-search`,autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,value:V,onChange:e=>oe(e.target.value),placeholder:e(`printers.search`),"aria-label":e(`printers.search`),className:`w-full h-8 pl-9 pr-8 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`}),V&&(0,$.jsx)(`button`,{type:`button`,"aria-label":e(`common.clear`),onClick:()=>oe(``),className:`absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,$.jsx)(Pt,{className:`w-4 h-4`})})]}),(0,$.jsxs)(`div`,{ref:Bt,"aria-hidden":Ht,inert:Ht,className:`${Ht?`absolute -left-[9999px] top-0 flex w-max pointer-events-none opacity-0`:`flex`} ml-auto items-center justify-end gap-2 flex-nowrap [&>*]:shrink-0`,children:[(0,$.jsx)(`div`,{className:`h-6 w-px bg-bambu-dark-tertiary`}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:Kt()}),(0,$.jsx)(`div`,{className:`h-6 w-px bg-bambu-dark-tertiary`}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:qt()}),(0,$.jsx)(`div`,{className:`h-6 w-px bg-bambu-dark-tertiary`}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:Jt()})]}),Ht&&(0,$.jsxs)(`div`,{className:`ml-auto flex items-center justify-end gap-1`,children:[(0,$.jsx)(ro,{label:e(`printers.toolbar.filters`,`Filters`),icon:(0,$.jsx)(le,{className:`w-4 h-4`}),children:(0,$.jsx)(`div`,{className:`flex w-48 flex-col gap-2`,children:Kt(!0)})}),(0,$.jsx)(ro,{label:e(`printers.toolbar.view`,`View`),icon:(0,$.jsx)(Ar,{className:`w-4 h-4`}),children:(0,$.jsx)(`div`,{className:`flex w-48 flex-col gap-2`,children:qt(!0)})}),(0,$.jsx)(ro,{label:e(`printers.toolbar.actions`,`Actions`),icon:(0,$.jsx)(Cr,{className:`w-4 h-4`}),children:(0,$.jsx)(`div`,{className:`flex w-48 flex-col gap-2`,children:Jt(!0)})})]})]})]}),Te?(0,$.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`common.loading`)}):K?.length===0?(0,$.jsx)(Rt,{children:(0,$.jsxs)(Lt,{className:`text-center py-12`,children:[(0,$.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`printers.noPrintersConfigured`)}),(0,$.jsxs)(Y,{onClick:()=>s(!0),disabled:!_e(`printers:create`),title:_e(`printers:create`)?void 0:e(`printers.permission.noAdd`),children:[(0,$.jsx)(Nn,{className:`w-4 h-4`}),e(`printers.addPrinter`)]})]})}):Dt.length===0&&(V.trim()||se!==`all`||ue!==`all`)?(0,$.jsx)(Rt,{children:(0,$.jsx)(Lt,{className:`text-center py-12`,children:(0,$.jsx)(`p`,{className:`text-bambu-gray`,children:e(`printers.noSearchResults`)})})}):O===`camwall`?(0,$.jsx)(Nt,{printers:Dt,maxLive:A,snapshotIntervalSec:N,tileSize:F,onTileClick:(e,t)=>{Ne===`embedded`?G(n=>new Map(n).set(e,{id:e,name:t})):Di(e)},statusMode:R,onChangeMaxLive:e=>{M(e),localStorage.setItem(`camWallMaxLive`,String(e))},onChangeSnapshotIntervalSec:e=>{P(e),localStorage.setItem(`camWallSnapshotSec`,String(e))},onChangeStatusMode:e=>{ee(e),localStorage.setItem(`camWallStatusMode`,e)}}):It?(0,$.jsx)(`div`,{className:`space-y-6`,children:(()=>{let e=y===`status`?so.filter(e=>It[e]?.length>0):Object.keys(It);return x?e:[...e].reverse()})().map(t=>{let n=It[t],r=`${y}:${t}`,i=!me[r],a=y===`status`&&co[t]?.dot||`bg-bambu-green`,o=y===`status`?e(co[t]?.labelKey||t):t;return(0,$.jsx)(Jn,{open:i,onToggle:()=>Ft(r),summaryClassName:`py-1`,summary:(0,$.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`w-2 h-2 rounded-full ${a}`}),o,(0,$.jsxs)(`span`,{className:`text-sm font-normal text-bambu-gray`,children:[`(`,n.length,`)`]}),pt&&(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),y===`location`?At(t===`Ungrouped`?``:t):y===`status`?kt(t):y===`model`&&jt(t)},className:`text-xs text-bambu-green hover:text-bambu-green-light transition-colors ml-1`,children:e(`printers.bulk.selectAll`)})]}),children:(0,$.jsx)(`div`,{className:`grid gap-4 ${T>=3?`gap-6`:``} ${Ct()}`,children:n.map(e=>(0,$.jsx)(yo,{printer:e,hideIfDisconnected:u,maintenanceInfo:tt[e.id],viewMode:ne,cardSize:T,amsThresholds:q?{humidityGood:Number(q.ams_humidity_good)||40,humidityFair:Number(q.ams_humidity_fair)||60,tempGood:Number(q.ams_temp_good)||28,tempFair:Number(q.ams_temp_fair)||35}:void 0,spoolmanEnabled:Be,hasUnlinkedSpools:We,linkedSpools:Ke,spoolmanUrl:ze?.url,spoolmanSyncMode:He,onGetAssignment:et,onUnassignSpool:(e,t,n)=>Je.mutate({printerId:e,amsId:t,trayId:n}),spoolmanSpools:Ye,spoolmanSlotAssignments:Ze,spoolmanLoading:Xe||Qe,onUnassignSpoolmanSpool:e=>$e.mutate(e),timeFormat:q?.time_format||`system`,cameraViewMode:Ne,onOpenEmbeddedCamera:(e,t)=>G(n=>new Map(n).set(e,{id:e,name:t})),onSelectCameraViewMode:Pe,checkPrinterFirmware:Ee,dryingPresets:Me,nozzleTempPresets:De,bedTempPresets:Oe,chamberTempPresets:ke,fanSpeedPresets:je,requirePlateClear:q?.require_plate_clear===!0,selectionMode:pt,isSelected:at.has(e.id),onToggleSelect:mt,onOpenCompactCard:ie,aiDetectionEnabled:Re(e.id),aiDetection:Le?.enabled?Le.per_printer[String(e.id)]:void 0,aiLastError:Le?.last_error??null},e.id))})},t)})}):(0,$.jsx)(`div`,{className:`grid gap-4 ${T>=3?`gap-6`:``} ${Ct()}`,children:Dt.map(e=>(0,$.jsx)(yo,{printer:e,hideIfDisconnected:u,maintenanceInfo:tt[e.id],viewMode:ne,cardSize:T,spoolmanEnabled:Be,hasUnlinkedSpools:We,linkedSpools:Ke,spoolmanUrl:ze?.url,spoolmanSyncMode:He,onGetAssignment:et,onUnassignSpool:(e,t,n)=>Je.mutate({printerId:e,amsId:t,trayId:n}),spoolmanSpools:Ye,spoolmanSlotAssignments:Ze,spoolmanLoading:Xe||Qe,onUnassignSpoolmanSpool:e=>$e.mutate(e),amsThresholds:q?{humidityGood:Number(q.ams_humidity_good)||40,humidityFair:Number(q.ams_humidity_fair)||60,tempGood:Number(q.ams_temp_good)||28,tempFair:Number(q.ams_temp_fair)||35}:void 0,timeFormat:q?.time_format||`system`,cameraViewMode:Ne,onOpenEmbeddedCamera:(e,t)=>G(n=>new Map(n).set(e,{id:e,name:t})),onSelectCameraViewMode:Pe,checkPrinterFirmware:Ee,dryingPresets:Me,nozzleTempPresets:De,bedTempPresets:Oe,chamberTempPresets:ke,fanSpeedPresets:je,requirePlateClear:q?.require_plate_clear===!0,selectionMode:pt,isSelected:at.has(e.id),onToggleSelect:mt,onOpenCompactCard:ie,aiDetectionEnabled:Re(e.id),aiDetection:Le?.enabled?Le.per_printer[String(e.id)]:void 0,aiLastError:Le?.last_error??null},e.id))}),T===2&&z!=null&&(0,$.jsxs)(`button`,{type:`button`,onClick:ae,className:`fixed bottom-5 left-1/2 z-40 inline-flex -translate-x-1/2 items-center gap-2 rounded-full border px-4 py-2 text-sm font-medium shadow-xl transition-colors ${a}`,title:e(`common.back`,`Back`),children:[(0,$.jsx)(C,{className:`w-4 h-4`}),e(`common.back`,`Back`)]}),o&&(0,$.jsx)(bo,{onClose:()=>s(!1),onAdd:e=>rt.mutate(e),existingSerials:K?.map(e=>e.serial_number)||[]}),pt&&K&&(0,$.jsx)(Ii,{selectedIds:at,printers:K,onClose:ht,onSelectAll:Ot,onSelectByLocation:At,onSelectByState:kt,onAction:_t,actionPending:dt}),lt===`stop`&&(0,$.jsx)(In,{title:e(`printers.bulk.confirm.stopTitle`,{count:at.size}),message:e(`printers.bulk.confirm.stopMessage`,{count:at.size}),confirmText:e(`printers.bulk.confirm.stopButton`),variant:`danger`,isLoading:dt,onConfirm:()=>gt(`stop`),onCancel:()=>ut(null)}),lt===`pause`&&(0,$.jsx)(In,{title:e(`printers.bulk.confirm.pauseTitle`,{count:at.size}),message:e(`printers.bulk.confirm.pauseMessage`,{count:at.size}),confirmText:e(`printers.bulk.confirm.pauseButton`),isLoading:dt,onConfirm:()=>gt(`pause`),onCancel:()=>ut(null)}),lt===`clearPlate`&&(0,$.jsx)(In,{title:e(`printers.bulk.confirm.clearPlateTitle`,{count:at.size}),message:e(`printers.bulk.confirm.clearPlateMessage`,{count:at.size}),confirmText:e(`printers.bulk.confirm.clearPlateButton`),isLoading:dt,onConfirm:()=>gt(`clearPlate`),onCancel:()=>ut(null)}),Array.from(W.values()).map((e,t)=>(0,$.jsx)(Ji,{printerId:e.id,printerName:e.name,viewerIndex:t,onClose:()=>G(t=>{let n=new Map(t);return n.delete(e.id),n})},e.id))]})}export{bo as AddPrinterModal,mo as AmsNameHoverCard,eo as CoverImage,To as PrintersPage}; \ No newline at end of file diff --git a/static/assets/ProfilesPage-B8UohL29.js b/static/assets/ProfilesPage-B8UohL29.js new file mode 100644 index 000000000..47a4a0fc9 --- /dev/null +++ b/static/assets/ProfilesPage-B8UohL29.js @@ -0,0 +1,13 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{t as c}from"./createLucideIcon-DvBYJlWL.js";import{t as l}from"./arrow-right-DedpIMhP.js";import{t as u}from"./arrow-up-D-pfJ3WZ.js";import{t as d}from"./check-Ck0cMLU4.js";import{a as f,i as p,r as m}from"./info-ROUoQhJR.js";import{n as h}from"./ToastContext-BRX0SW3C.js";import{t as g}from"./copy-Cu_0GKCU.js";import{t as _}from"./droplet-CqYXMF2u.js";import{t as v}from"./eye-off-6CkaxYwP.js";import{t as y}from"./funnel-C3dyAMK9.js";import{t as b}from"./gauge-D21zgWMb.js";import{t as x}from"./git-compare-J4KX0xAJ.js";import{t as S}from"./hard-drive-CgXAHN37.js";import{t as C}from"./list-CLcpeoSz.js";import{t as w}from"./loader-circle-BEmFtawu.js";import{t as T}from"./log-in-n0ckHxnD.js";import{t as E}from"./minus-DypeGjGR.js";import{t as ee}from"./search-0n0CBc74.js";import{t as te}from"./settings-2-Cvn837lh.js";import{t as D}from"./sparkles-DRqKNlhr.js";import{t as O}from"./sticky-note-BH0LPqRx.js";import{t as k}from"./triangle-alert-Dt_1FcBy.js";import{t as A}from"./x-DR-Trv6U.js";import{n as j,t as M}from"./Card-Bzc64K35.js";import{t as N}from"./Button-DDr6eAFy.js";import{u as P}from"./date-G9KUauqz.js";import{$t as F,At as I,Bt as L,Cn as R,Ct as ne,Dn as z,En as B,Jt as re,Kt as ie,Lt as V,On as ae,Rt as oe,Sn as H,Ut as U,Zt as se,an as W,cn as ce,kt as le,ln as G,wn as ue,yt as de}from"./index-CovRLYqQ.js";import{p as K,u as q}from"./utils-dMg0ogiz.js";import{t as fe}from"./useCancellableTimeout-3XQzNJkJ.js";var J=c(`equal`,[[`line`,{x1:`5`,x2:`19`,y1:`9`,y2:`9`,key:`1nwqeh`}],[`line`,{x1:`5`,x2:`19`,y1:`15`,y2:`15`,key:`g8yjpy`}]]),pe=c(`sliders-vertical`,[[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M12 21v-9`,key:`17s77i`}],[`path`,{d:`M12 8V3`,key:`13r4qs`}],[`path`,{d:`M17 16h4`,key:`h1uq16`}],[`path`,{d:`M19 12V3`,key:`o1uvq1`}],[`path`,{d:`M19 21v-5`,key:`qua636`}],[`path`,{d:`M3 14h4`,key:`bcjad9`}],[`path`,{d:`M5 10V3`,key:`cb8scm`}],[`path`,{d:`M5 21v-7`,key:`1w1uti`}]]),Y=e(n(),1),X={PLA:`GFL99`,"PLA-CF":`GFL98`,"PLA SILK":`GFL96`,"PLA HIGH SPEED":`GFL95`,PETG:`GFG99`,"PETG HF":`GFG96`,"PETG-CF":`GFG98`,PCTG:`GFG97`,ABS:`GFB99`,ASA:`GFB98`,PC:`GFC99`,PA:`GFN99`,"PA-CF":`GFN98`,NYLON:`GFN99`,TPU:`GFU99`,PVA:`GFS99`,HIPS:`GFS98`,PE:`GFP99`,PP:`GFP97`};function me(e){let t=(e||``).toUpperCase().trim();return t&&(X[t]||X[t.replace(/[-\s]?CF$/,``)]||X[t.replace(/\+$/,``)]||X[t.split(/[-\s]/)[0]])||``}function he(e){let t=e.replace(/@.+$/,``).trim();return t.startsWith(`# `)?t.slice(2).trim():t}var ge={local:0,orca_cloud:1,cloud:2,builtin:3};function _e(e){let{localPresets:t,orcaProfiles:n,cloudSettings:r,builtinFilaments:i}=e,a=[],o=e=>e.trim().toLowerCase(),s=new Set,c=new Set,l=new Set,u=(e,t,...n)=>{let r=n.filter(e=>!!e);if(r.some(e=>s.has(e)))return!1;let i=`${e}|${o(t)}`;return c.has(i)?!1:(r.forEach(e=>s.add(e)),c.add(i),l.add(o(t)),!0)};for(let e of t??[]){let t=he(e.name),n=e.filament_type||q(t).material;u(`local`,t)&&a.push({id:`local_${e.id}`,name:t,source:`local`,filamentId:me(n),filamentType:n||``})}for(let e of n??[]){let t=he(e.name),n=q(t).material;u(`orca_cloud`,t,e.setting_id)&&a.push({id:`orca_${e.setting_id}`,name:t,source:`orca_cloud`,filamentId:me(n),filamentType:n})}for(let e of r??[]){let t=he(e.name),n=e.setting_id.startsWith(`GFS`)?K(e.setting_id):``;u(`cloud`,t,e.setting_id,n||void 0)&&a.push({id:e.setting_id,name:t,source:`cloud`,filamentId:n,filamentType:q(t).material})}for(let e of i??[]){let t=e.filament_id.startsWith(`GF`)?`GFS${e.filament_id.slice(2)}`:e.filament_id;l.has(o(e.name))||u(`builtin`,e.name,e.filament_id,t)&&a.push({id:`builtin_${e.filament_id}`,name:e.name,source:`builtin`,filamentId:e.filament_id,filamentType:q(e.name).material})}return a.sort((e,t)=>e.source===t.source?e.name.localeCompare(t.name):ge[e.source]-ge[t.source])}async function ve(e,t){if(e.filamentId)return e.filamentId;if(e.source!==`cloud`||!t)return``;try{return(await t(e.id)).filament_id||``}catch{return``}}var Z=t(),ye=e=>(Math.trunc(parseFloat(e)*1e3)/1e3).toFixed(3),be=`HS00`,xe=`HH00`,Se=e=>{let t=e.match(/^([A-Z]{2}\d{2})/);return t?t[1]:be},Q=e=>Se(e)===xe?`HF`:`S`,Ce=e=>{for(let t of[`High Flow_`,`High Flow `,`Standard_`,`Standard `,`HF_`,`HF `,`S_`,`S `])if(e.startsWith(t))return e.slice(t.length);let t=e.indexOf(`_`);return t>0?e.slice(t+1):e};function we({profile:e,onEdit:t,onCopy:n,selectionMode:r,isSelected:i,onToggleSelect:a,note:o}){let s=Q(e.nozzle_id),c=e.nozzle_diameter;return(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,Z.jsx)(`button`,{onClick:a,className:`text-bambu-gray hover:text-white transition-colors p-1`,children:i?(0,Z.jsx)(oe,{className:`w-4 h-4 text-bambu-green`}):(0,Z.jsx)(V,{className:`w-4 h-4`})}),(0,Z.jsxs)(`button`,{onClick:()=>{r&&a?a():t()},className:`flex-1 text-left px-3 py-2 bg-bambu-dark rounded hover:bg-bambu-dark-tertiary transition-colors ${i?`ring-1 ring-bambu-green`:``}`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-green font-mono text-sm font-bold whitespace-nowrap`,children:ye(e.k_value)}),(0,Z.jsx)(`span`,{className:`text-white text-sm truncate flex-1`,title:e.name,children:e.name||`Unnamed`}),o&&(0,Z.jsx)(`span`,{title:`Has note`,children:(0,Z.jsx)(O,{className:`w-3 h-3 text-yellow-500`})}),(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:[s,` `,c]})]}),o&&(0,Z.jsxs)(`div`,{className:`text-xs mt-0.5 truncate text-yellow-500/70`,title:o,children:[`Note: `,o.length>50?o.substring(0,50)+`...`:o]})]}),!r&&n&&(0,Z.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n()},className:`text-bambu-gray hover:text-white transition-colors p-1`,title:`Copy profile`,children:(0,Z.jsx)(g,{className:`w-4 h-4`})})]})}function Te({profile:e,printerId:t,nozzleDiameter:n,existingProfiles:a=[],builtinFilaments:o=[],filamentPresets:c=[],isDualNozzle:l=!1,supportsFlowType:u=!0,initialNote:d=``,initialNoteKey:f=null,onClose:p,onSave:m,onSaveNote:g,hasPermission:_}){let{t:v}=i(),{showToast:y}=h(),[x,S]=(0,Y.useState)(e?.name||``),[C,T]=(0,Y.useState)(e?.k_value?ye(e.k_value):`0.020`),[E,te]=(0,Y.useState)(e?.filament_id||``),[D,O]=(0,Y.useState)(e?Se(e.nozzle_id):be),[k,P]=(0,Y.useState)(e?.nozzle_diameter||n),[F,L]=(0,Y.useState)(e?[e.extruder_id]:l?[0,1]:[0]),[R,ne]=(0,Y.useState)(!1),[z,B]=(0,Y.useState)({current:0,total:0}),[re,ie]=(0,Y.useState)(d),[V,ae]=(0,Y.useState)(``),{schedule:oe}=fe(),H=Y.useMemo(()=>e?.filament_id?o.find(t=>t.filament_id===e.filament_id)?.name||Ce(a.find(t=>t.filament_id===e.filament_id)?.name||e.name||``)||e.filament_id:``,[e,a,o]),U=Y.useMemo(()=>{let e=[[`local`,v(`kProfiles.modal.source.local`)],[`orca_cloud`,v(`kProfiles.modal.source.orcaCloud`)],[`cloud`,v(`kProfiles.modal.source.bambuCloud`)],[`builtin`,v(`kProfiles.modal.source.builtin`)]],t=V.trim().toLowerCase(),n=t?c.filter(e=>e.name.toLowerCase().includes(t)):c;return e.map(([e,t])=>({source:e,label:t,items:n.filter(t=>t.source===e)})).filter(e=>e.items.length>0)},[c,V,v]),se=s({mutationFn:e=>(console.log(`[KProfile] Calling API...`),r.setKProfile(t,e)),onSuccess:(t,n)=>{if(console.log(`[KProfile] Save success:`,t),y(v(`kProfiles.toast.profileSaved`)),g&&re!==d){let t;t=re===``&&f?f:e&&e.slot_id>0?e.setting_id||`slot_${e.slot_id}_${e.filament_id}_${e.extruder_id}`:`name_${x}_${n.filament_id}`,g(t,re)}ne(!0),oe(()=>{ne(!1),m()},2500)},onError:e=>{console.error(`[KProfile] Save error:`,e),y(e.message,`error`),ne(!1)}}),W=s({mutationFn:e=>(console.log(`[KProfile] Deleting profile...`),r.deleteKProfile(t,e)),onSuccess:e=>{console.log(`[KProfile] Delete success:`,e),y(v(`kProfiles.toast.profileDeleted`)),ne(!0),oe(()=>{ne(!1),p()},4e3)},onError:e=>{console.error(`[KProfile] Delete error:`,e),y(e.message,`error`),ne(!1)}}),[ce,le]=(0,Y.useState)(!1),G=()=>{e&&W.mutate({slot_id:e.slot_id,extruder_id:e.extruder_id,nozzle_id:e.nozzle_id,nozzle_diameter:e.nozzle_diameter,filament_id:e.filament_id,setting_id:e.setting_id})};return(0,Z.jsxs)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:[(0,Z.jsxs)(M,{className:`w-full max-w-md relative`,children:[R&&(0,Z.jsxs)(`div`,{className:`absolute inset-0 bg-bambu-dark-secondary/90 flex flex-col items-center justify-center z-10 rounded-lg`,children:[(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin mb-3`}),(0,Z.jsx)(`p`,{className:`text-white font-medium`,children:z.total>1?v(`kProfiles.modal.savingExtruder`,{current:z.current,total:z.total}):v(`kProfiles.modal.syncing`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray text-sm mt-1`,children:v(`kProfiles.modal.pleaseWait`)})]}),(0,Z.jsxs)(j,{className:`p-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:v(e?`kProfiles.modal.editTitle`:`kProfiles.modal.addTitle`)}),(0,Z.jsx)(`button`,{onClick:p,className:`text-bambu-gray hover:text-white transition-colors`,disabled:R,children:(0,Z.jsx)(A,{className:`w-5 h-5`})})]}),(0,Z.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),l&&!e&&F.length===0){y(v(`kProfiles.toast.selectAtLeastOneExtruder`),`error`);return}let i=parseFloat(C).toFixed(6),a=`${D}-${k}`,o=e&&e.nozzle_id||a,s=e?e.nozzle_diameter:k,u=e?.filament_id||``;if(!e){let e=c.find(e=>e.id===E);if(!e){y(v(`kProfiles.toast.selectFilament`),`error`);return}if(u=await ve(e,r.getCloudSettingDetail),!u){y(v(`kProfiles.toast.filamentNotResolvable`,{name:e.name}),`error`);return}}if(e||F.length===1){let t={name:x,k_value:i,filament_id:u,nozzle_id:o,nozzle_diameter:s,extruder_id:e?e.extruder_id:F[0],setting_id:e?.setting_id,slot_id:e?.slot_id??0};console.log(`[KProfile] Saving profile:`,t),se.mutate(t);return}ne(!0),B({current:1,total:F.length});let d=F.map(e=>({name:x,k_value:i,filament_id:u,nozzle_id:a,nozzle_diameter:k,extruder_id:e,setting_id:void 0,slot_id:0}));console.log(`[KProfile] Saving ${d.length} profiles in batch:`,d);try{await r.setKProfilesBatch(t,d),y(v(`kProfiles.toast.profilesSaved`,{count:F.length})),g&&re&&g(`name_${x}_${u}`,re)}catch(e){console.error(`[KProfile] Failed to save batch:`,e),y(v(`kProfiles.toast.failedToSaveBatch`),`error`),ne(!1),B({current:0,total:0});return}B({current:F.length,total:F.length}),oe(()=>{ne(!1),B({current:0,total:0}),m()},3e3)},className:`p-4 space-y-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:v(`kProfiles.modal.profileName`)}),(0,Z.jsx)(`input`,{type:`text`,value:x,onChange:e=>S(e.target.value),disabled:!!e,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${e?`opacity-60 cursor-not-allowed`:``}`,placeholder:v(`kProfiles.modal.profileNamePlaceholder`),required:!e})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:v(`kProfiles.modal.kValue`)}),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:C,onChange:e=>{let t=e.target.value;(t===``||/^\d*\.?\d*$/.test(t))&&T(t)},onBlur:e=>{let t=parseFloat(e.target.value);isNaN(t)||T((Math.trunc(t*1e3)/1e3).toFixed(3))},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none font-mono`,placeholder:v(`kProfiles.modal.kValuePlaceholder`),required:!0}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:v(`kProfiles.modal.kValueHelp`)})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:v(`kProfiles.modal.filament`)}),e?(0,Z.jsx)(`div`,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white opacity-60`,children:H||e.filament_id}):(0,Z.jsxs)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,Z.jsxs)(`div`,{className:`relative border-b border-bambu-dark-tertiary`,children:[(0,Z.jsx)(ee,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,value:V,onChange:e=>ae(e.target.value),placeholder:v(`kProfiles.modal.searchFilaments`),className:`w-full pl-10 pr-3 py-2 bg-bambu-dark text-white placeholder-bambu-gray focus:outline-none`})]}),(0,Z.jsx)(`div`,{className:`max-h-56 overflow-y-auto bg-bambu-dark`,children:U.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-3 text-xs text-bambu-gray`,children:c.length===0?v(`kProfiles.modal.noFilamentsHelp`):v(`kProfiles.modal.noFilamentMatches`)}):U.map(e=>(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 px-3 py-1.5 bg-bambu-dark-secondary border-y border-bambu-dark-tertiary`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-bold uppercase tracking-wider text-bambu-green`,children:e.label}),(0,Z.jsx)(`span`,{className:`text-[10px] text-bambu-gray`,children:e.items.length})]}),e.items.map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{te(e.id),x||S(`${D===xe?`HF`:`S`} ${e.name}`)},className:`w-full text-left px-3 py-1.5 text-sm transition-colors ${E===e.id?`bg-bambu-green/20 text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,children:e.name},e.id))]},e.source))})]})]}),(0,Z.jsxs)(`div`,{className:u?`grid grid-cols-2 gap-4`:``,children:[(0,Z.jsxs)(`div`,{className:u?``:`hidden`,children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:v(`kProfiles.modal.flowType`)}),(0,Z.jsxs)(`select`,{value:D,onChange:t=>{let n=t.target.value;if(O(n),!e&&E&&!x){let e=c.find(e=>e.id===E);e&&S(`${n===xe?`HF`:`S`} ${e.name}`)}},disabled:!!e,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${e?`opacity-60 cursor-not-allowed`:``}`,children:[(0,Z.jsx)(`option`,{value:xe,children:v(`kProfiles.modal.highFlow`)}),(0,Z.jsx)(`option`,{value:be,children:v(`kProfiles.modal.standard`)})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:v(`kProfiles.modal.nozzleSize`)}),(0,Z.jsxs)(`select`,{value:k,onChange:e=>P(e.target.value),disabled:!!e,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${e?`opacity-60 cursor-not-allowed`:``}`,children:[(0,Z.jsx)(`option`,{value:`0.2`,children:`0.2mm`}),(0,Z.jsx)(`option`,{value:`0.4`,children:`0.4mm`}),(0,Z.jsx)(`option`,{value:`0.6`,children:`0.6mm`}),(0,Z.jsx)(`option`,{value:`0.8`,children:`0.8mm`})]})]})]}),l&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:v(e?`kProfiles.modal.extruder`:`kProfiles.modal.extruders`)}),e?(0,Z.jsx)(`div`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white opacity-60`,children:e.extruder_id===1?v(`kProfiles.modal.left`):v(`kProfiles.modal.right`)}):(0,Z.jsxs)(`div`,{className:`flex gap-4`,children:[(0,Z.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:F.includes(1),onChange:e=>{e.target.checked?L([...F,1]):L(F.filter(e=>e!==1))},className:`w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green`}),(0,Z.jsx)(`span`,{className:`text-white`,children:v(`kProfiles.modal.left`)})]}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:F.includes(0),onChange:e=>{e.target.checked?L([...F,0]):L(F.filter(e=>e!==0))},className:`w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green`}),(0,Z.jsx)(`span`,{className:`text-white`,children:v(`kProfiles.modal.right`)})]})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:v(`kProfiles.modal.notes`)}),(0,Z.jsx)(`textarea`,{value:re,onChange:e=>ie(e.target.value),placeholder:v(`kProfiles.modal.notesPlaceholder`),rows:2,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none resize-none`}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:v(`kProfiles.modal.notesHelp`)})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2 pt-4`,children:[e&&(0,Z.jsx)(N,{type:`button`,variant:`secondary`,onClick:()=>le(!0),disabled:W.isPending||R||!_(`kprofiles:delete`),title:_(`kprofiles:delete`)?void 0:v(`kProfiles.permission.noDelete`),className:`text-red-500 hover:bg-red-500/10`,children:W.isPending?(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(I,{className:`w-4 h-4`})}),(0,Z.jsx)(N,{type:`button`,variant:`secondary`,onClick:p,disabled:R,className:`flex-1`,children:v(`common.cancel`)}),(0,Z.jsxs)(N,{type:`submit`,disabled:se.isPending||R||!_(e?`kprofiles:update`:`kprofiles:create`),title:_(e?`kprofiles:update`:`kprofiles:create`)?void 0:v(e?`kProfiles.permission.noUpdate`:`kProfiles.permission.noCreate`),className:`flex-1`,children:[se.isPending?(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(b,{className:`w-4 h-4`}),v(`common.save`)]})]})]})]})]}),ce&&(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-[60]`,children:(0,Z.jsx)(M,{className:`w-full max-w-sm`,children:(0,Z.jsxs)(j,{className:`p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,Z.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center`,children:(0,Z.jsx)(I,{className:`w-5 h-5 text-red-500`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:v(`kProfiles.deleteConfirm.title`)}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:v(`kProfiles.deleteConfirm.cannotUndo`)})]})]}),(0,Z.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:v(`kProfiles.deleteConfirm.message`,{name:e?.name})}),(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsx)(N,{variant:`secondary`,onClick:()=>le(!1),className:`flex-1`,children:v(`common.cancel`)}),(0,Z.jsxs)(N,{onClick:()=>{le(!1),G()},disabled:W.isPending,className:`flex-1 bg-red-500 hover:bg-red-600 text-white`,children:[W.isPending?(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(I,{className:`w-4 h-4`}),v(`common.delete`)]})]})]})})})]})}var Ee={NOZZLE_DIAMETER:`bambusy_kprofiles_nozzle`,SORT_OPTION:`bambusy_kprofiles_sort`};function De(){let{t:e}=i(),{showToast:t}=h(),{hasPermission:n}=de(),[a,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(()=>localStorage.getItem(Ee.NOZZLE_DIAMETER)||`0.4`),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(``),[x,S]=(0,Y.useState)(`all`),[C,T]=(0,Y.useState)(`all`),[E,te]=(0,Y.useState)(()=>localStorage.getItem(Ee.SORT_OPTION)||`name`),[D,O]=(0,Y.useState)(!1),[k,P]=(0,Y.useState)(new Set),[F,L]=(0,Y.useState)(!1),[R,z]=(0,Y.useState)(!1),B=(0,Y.useCallback)(e=>`${e.slot_id}_${e.extruder_id}`,[]);(0,Y.useEffect)(()=>{localStorage.setItem(Ee.NOZZLE_DIAMETER,c)},[c]),(0,Y.useEffect)(()=>{localStorage.setItem(Ee.SORT_OPTION,E)},[E]);let{data:V,isLoading:ae}=o({queryKey:[`printers`],queryFn:r.getPrinters}),{data:H,isLoading:U,isFetching:W,error:ce,refetch:G}=o({queryKey:[`kprofiles`,a,c],queryFn:async()=>{console.log(`[KProfiles] Fetching profiles for printer`,a,`nozzle`,c);let e=await r.getKProfiles(a,c);return console.log(`[KProfiles] Received profiles:`,e?.profiles?.length||0,`profiles`),e},enabled:!!a,retry:!1,staleTime:0,gcTime:0,refetchOnMount:`always`}),{data:K}=o({queryKey:[`builtinFilaments`],queryFn:()=>r.getBuiltinFilaments(),staleTime:3e5}),{data:q}=o({queryKey:[`filamentIdMap`],queryFn:()=>r.getFilamentIdMap(),staleTime:3e5}),{data:fe}=o({queryKey:[`localPresets`],queryFn:()=>r.getLocalPresets(),retry:!1}),{data:J}=o({queryKey:[`orcaCloudProfilesForKProfiles`],queryFn:()=>r.orcaCloudListProfiles(),retry:!1}),{data:pe}=o({queryKey:[`cloudSettings`],queryFn:()=>r.getCloudSettings(),retry:!1}),{data:X,refetch:me}=o({queryKey:[`kprofile-notes`,a],queryFn:()=>r.getKProfileNotes(a),enabled:!!a,staleTime:3e4}),he=ce?.message?.includes(`not connected`);(0,Y.useEffect)(()=>{if(!a&&V&&V.length>0){let e=V.find(e=>e.is_active);e&&s(e.id)}},[a,V]),(0,Y.useEffect)(()=>{if(a){let e=setTimeout(()=>{G()},150);return()=>clearTimeout(e)}},[a,c]);let ge=V?.filter(e=>e.is_active)||[],ve=Y.useMemo(()=>{let e=new Map;if(K)for(let t of K)e.set(t.filament_id,t.name);if(q)for(let[t,n]of Object.entries(q))e.has(t)||e.set(t,n);return e},[K,q]),ye=Y.useMemo(()=>Array.from(ve.entries()).map(([e,t])=>({filament_id:e,name:t})),[ve]),xe=Y.useMemo(()=>_e({localPresets:fe?.filament,orcaProfiles:J?.filament,cloudSettings:pe?.filament,builtinFilaments:K}),[fe?.filament,J?.filament,pe?.filament,K]),Se=Y.useCallback(e=>ve.get(e.filament_id)||Ce(e.name),[ve]),Q=Y.useMemo(()=>H?.profiles?H.profiles.filter(e=>{let t=v.toLowerCase(),n=!t||e.name.toLowerCase().includes(t)||e.filament_id.toLowerCase().includes(t),r=x===`all`||x===`left`&&e.extruder_id===1||x===`right`&&e.extruder_id===0,i=C===`all`||C===`hf`&&e.nozzle_id.startsWith(`HH`)||C===`s`&&e.nozzle_id.startsWith(`HS`);return n&&r&&i}).sort((e,t)=>{switch(E){case`k_value`:return parseFloat(e.k_value)-parseFloat(t.k_value);case`filament`:return Se(e).localeCompare(Se(t));default:return e.name.localeCompare(t.name)}}):[],[H?.profiles,v,x,C,E,Se]),De=V?.find(e=>e.id===a),$=De?.nozzle_count===2,Oe=De?.supports_nozzle_flow_type??!0;(0,Y.useEffect)(()=>{Oe||T(`all`)},[Oe]),(0,Y.useEffect)(()=>{let e=e=>{e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement||u||f||g||(e.key===`r`||e.key===`R`?(e.preventDefault(),G()):e.key===`n`||e.key===`N`?(e.preventDefault(),p(!0)):e.key===`Escape`&&D&&(e.preventDefault(),O(!1),P(new Set)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u,f,g,D,G]);let ke=(0,Y.useCallback)(()=>{if(!H?.profiles||H.profiles.length===0){t(e(`kProfiles.toast.noProfilesToExport`),`error`);return}let n={version:1,exported_at:new Date().toISOString(),printer:De?.name||`Unknown`,nozzle_diameter:c,profiles:H.profiles.map(e=>({name:e.name,k_value:e.k_value,filament_id:e.filament_id,nozzle_id:e.nozzle_id,nozzle_diameter:e.nozzle_diameter,extruder_id:e.extruder_id}))},r=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`kprofiles_${De?.name||`printer`}_${c}mm_${new Date().toISOString().split(`T`)[0]}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i),t(e(`kProfiles.toast.exportedProfiles`,{count:H.profiles.length}))},[H?.profiles,De,c,t,e]),Ae=(0,Y.useCallback)(()=>{let n=document.createElement(`input`);n.type=`file`,n.accept=`.json`,n.onchange=async n=>{let i=n.target.files?.[0];if(i)try{let n=await i.text(),o=JSON.parse(n);if(!o.profiles||!Array.isArray(o.profiles)){t(e(`kProfiles.toast.invalidFileFormat`),`error`);return}let s=0;for(let e of o.profiles)if(!(!e.name||!e.k_value||!e.filament_id))try{await r.setKProfile(a,{name:e.name,k_value:parseFloat(e.k_value).toFixed(6),filament_id:e.filament_id,nozzle_id:e.nozzle_id||`${be}-${c}`,nozzle_diameter:e.nozzle_diameter||c,extruder_id:e.extruder_id??0,slot_id:0}),s++,await new Promise(e=>setTimeout(e,500))}catch(t){console.error(`Failed to import profile:`,e.name,t)}t(e(`kProfiles.toast.importedProfiles`,{count:s,total:o.profiles.length})),G()}catch(n){console.error(`Import error:`,n),t(e(`kProfiles.toast.failedToParseImport`),`error`)}},n.click()},[a,c,t,G,e]),je=(0,Y.useCallback)(e=>{P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Me=(0,Y.useCallback)(()=>{P(new Set(Q.map(e=>B(e))))},[Q,B]),Ne=(0,Y.useCallback)(()=>{k.size!==0&&L(!0)},[k.size]),Pe=(0,Y.useCallback)(async()=>{let n=Q.filter(e=>k.has(B(e)));z(!0);let i=0;for(let e of n)try{await r.deleteKProfile(a,{slot_id:e.slot_id,extruder_id:e.extruder_id,nozzle_id:e.nozzle_id,nozzle_diameter:e.nozzle_diameter,filament_id:e.filament_id,setting_id:e.setting_id}),i++,await new Promise(e=>setTimeout(e,300))}catch(t){console.error(`Failed to delete profile:`,e.name,t)}t(e(`kProfiles.toast.profilesDeleted`,{count:i})),z(!1),L(!1),O(!1),P(new Set),G()},[a,k,Q,t,G,B,e]),Fe=(0,Y.useCallback)(e=>{let t=[];return e.setting_id&&t.push(e.setting_id),t.push(`slot_${e.slot_id}_${e.filament_id}_${e.extruder_id}`),t.push(`name_${e.name}_${e.filament_id}`),t},[]),Ie=(0,Y.useCallback)(async(n,i)=>{if(a)try{await r.setKProfileNote(a,n,i),me()}catch(n){console.error(`Failed to save note:`,n),t(e(`kProfiles.toast.failedToSaveNote`),`error`)}},[a,me,t,e]),Le=(0,Y.useCallback)(e=>{if(!X?.notes)return{note:``,key:null};let t=Fe(e);for(let e of t)if(X.notes[e])return{note:X.notes[e],key:e};return{note:``,key:null}},[X,Fe]),Re=(0,Y.useCallback)(e=>Le(e).note,[Le]);return ae?(0,Z.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin`})}):!V||V.length===0?(0,Z.jsx)(M,{children:(0,Z.jsxs)(j,{className:`py-12 text-center`,children:[(0,Z.jsx)(m,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noPrintersConfigured`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:e(`kProfiles.addPrinterInSettings`)})]})}):ge.length===0?(0,Z.jsx)(M,{children:(0,Z.jsxs)(j,{className:`py-12 text-center`,children:[(0,Z.jsx)(re,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noActivePrinters`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:e(`kProfiles.enablePrinterConnection`)})]})}):(0,Z.jsxs)(Z.Fragment,{children:[W&&!U&&(0,Z.jsxs)(`div`,{className:`fixed inset-0 bg-black/50 flex flex-col items-center justify-center z-40`,children:[(0,Z.jsx)(w,{className:`w-10 h-10 text-bambu-green animate-spin mb-3`}),(0,Z.jsx)(`p`,{className:`text-white font-medium`,children:e(`kProfiles.loadingProfiles`)})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-4 mb-6`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 min-w-48`,children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`kProfiles.printer`)}),(0,Z.jsx)(`select`,{value:a||``,onChange:e=>s(parseInt(e.target.value)),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:ge.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,Z.jsxs)(`div`,{className:`w-32`,children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`kProfiles.nozzle`)}),(0,Z.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:`0.2`,children:`0.2mm`}),(0,Z.jsx)(`option`,{value:`0.4`,children:`0.4mm`}),(0,Z.jsx)(`option`,{value:`0.6`,children:`0.6mm`}),(0,Z.jsx)(`option`,{value:`0.8`,children:`0.8mm`})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsxs)(N,{variant:`secondary`,onClick:()=>G(),disabled:W||!n(`kprofiles:read`),title:n(`kprofiles:read`)?void 0:e(`kProfiles.permission.noRead`),children:[(0,Z.jsx)(ie,{className:`w-4 h-4 ${W?`animate-spin`:``}`}),e(`kProfiles.refresh`)]}),(0,Z.jsxs)(N,{onClick:()=>p(!0),disabled:!n(`kprofiles:create`),title:n(`kprofiles:create`)?void 0:e(`kProfiles.permission.noCreate`),children:[(0,Z.jsx)(se,{className:`w-4 h-4`}),e(`kProfiles.addProfile`)]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-4 mb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 min-w-48 relative`,children:[(0,Z.jsx)(ee,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:e(`kProfiles.searchPlaceholder`),className:`w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),$&&(0,Z.jsx)(`div`,{className:`w-36`,children:(0,Z.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:`all`,children:e(`kProfiles.allExtruders`)}),(0,Z.jsx)(`option`,{value:`left`,children:e(`kProfiles.leftOnly`)}),(0,Z.jsx)(`option`,{value:`right`,children:e(`kProfiles.rightOnly`)})]})}),Oe&&(0,Z.jsx)(`div`,{className:`w-32`,children:(0,Z.jsxs)(`select`,{value:C,onChange:e=>T(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:`all`,children:e(`kProfiles.allFlow`)}),(0,Z.jsx)(`option`,{value:`hf`,children:e(`kProfiles.hfOnly`)}),(0,Z.jsx)(`option`,{value:`s`,children:e(`kProfiles.sOnly`)})]})}),(0,Z.jsx)(`div`,{className:`w-32`,children:(0,Z.jsxs)(`select`,{value:E,onChange:e=>te(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:`name`,children:e(`kProfiles.sortName`)}),(0,Z.jsx)(`option`,{value:`k_value`,children:e(`kProfiles.sortKValue`)}),(0,Z.jsx)(`option`,{value:`filament`,children:e(`kProfiles.sortFilament`)})]})})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,Z.jsxs)(N,{variant:`secondary`,onClick:ke,disabled:!H?.profiles?.length||!n(`kprofiles:read`),title:n(`kprofiles:read`)?void 0:e(`kProfiles.permission.noExport`),children:[(0,Z.jsx)(ue,{className:`w-4 h-4`}),e(`kProfiles.export`)]}),(0,Z.jsxs)(N,{variant:`secondary`,onClick:Ae,disabled:!n(`kprofiles:create`),title:n(`kprofiles:create`)?void 0:e(`kProfiles.permission.noImport`),children:[(0,Z.jsx)(le,{className:`w-4 h-4`}),e(`kProfiles.import`)]}),(0,Z.jsx)(`div`,{className:`flex-1`}),D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`secondary`,onClick:Me,children:[(0,Z.jsx)(oe,{className:`w-4 h-4`}),e(`kProfiles.selectAll`)]}),(0,Z.jsxs)(N,{variant:`secondary`,onClick:Ne,disabled:k.size===0||!n(`kprofiles:delete`),className:`text-red-500 hover:bg-red-500/10`,title:n(`kprofiles:delete`)?void 0:e(`kProfiles.permission.noDelete`),children:[(0,Z.jsx)(I,{className:`w-4 h-4`}),e(`kProfiles.delete`),` (`,k.size,`)`]}),(0,Z.jsxs)(N,{variant:`secondary`,onClick:()=>{O(!1),P(new Set)},children:[(0,Z.jsx)(A,{className:`w-4 h-4`}),e(`common.cancel`)]})]}):(0,Z.jsxs)(N,{variant:`secondary`,onClick:()=>O(!0),disabled:!Q.length||!n(`kprofiles:delete`),title:n(`kprofiles:delete`)?void 0:e(`kProfiles.permission.noDelete`),children:[(0,Z.jsx)(oe,{className:`w-4 h-4`}),e(`kProfiles.select`)]})]}),U?(0,Z.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin`})}):he?(0,Z.jsx)(M,{children:(0,Z.jsxs)(j,{className:`py-12 text-center`,children:[(0,Z.jsx)(ne,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.printerOffline`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`kProfiles.printerOfflineDesc`)}),(0,Z.jsxs)(N,{variant:`secondary`,onClick:()=>G(),children:[(0,Z.jsx)(ie,{className:`w-4 h-4`}),e(`common.refresh`)]})]})}):Q.length>0?$?(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray mb-2 px-1`,children:e(`kProfiles.leftExtruder`)}),(0,Z.jsx)(`div`,{className:`space-y-1`,children:Q.filter(e=>e.extruder_id===1).map(e=>(0,Z.jsx)(we,{profile:e,onEdit:()=>d(e),onCopy:()=>_(e),selectionMode:D,isSelected:k.has(B(e)),onToggleSelect:()=>je(B(e)),note:Re(e)},B(e)))})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray mb-2 px-1`,children:e(`kProfiles.rightExtruder`)}),(0,Z.jsx)(`div`,{className:`space-y-1`,children:Q.filter(e=>e.extruder_id===0).map(e=>(0,Z.jsx)(we,{profile:e,onEdit:()=>d(e),onCopy:()=>_(e),selectionMode:D,isSelected:k.has(B(e)),onToggleSelect:()=>je(B(e)),note:Re(e)},B(e)))})]})]}):(0,Z.jsx)(`div`,{className:`space-y-1`,children:Q.map(e=>(0,Z.jsx)(we,{profile:e,onEdit:()=>d(e),onCopy:()=>_(e),selectionMode:D,isSelected:k.has(B(e)),onToggleSelect:()=>je(B(e)),note:Re(e)},B(e)))}):v||x!==`all`||C!==`all`?(0,Z.jsx)(M,{children:(0,Z.jsxs)(j,{className:`py-12 text-center`,children:[(0,Z.jsx)(ee,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noMatchingProfiles`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:e(`kProfiles.noMatchingProfilesDesc`)})]})}):(0,Z.jsx)(M,{children:(0,Z.jsxs)(j,{className:`py-12 text-center`,children:[(0,Z.jsx)(b,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noKProfiles`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`kProfiles.noKProfilesDesc`,{diameter:c})}),(0,Z.jsxs)(N,{onClick:()=>p(!0),children:[(0,Z.jsx)(se,{className:`w-4 h-4`}),e(`kProfiles.createFirstProfile`)]})]})}),u&&a&&(()=>{let{note:e,key:t}=Le(u);return(0,Z.jsx)(Te,{profile:u,printerId:a,nozzleDiameter:c,existingProfiles:H?.profiles,builtinFilaments:ye,filamentPresets:xe,isDualNozzle:$,supportsFlowType:Oe,initialNote:e,initialNoteKey:t,onSaveNote:Ie,hasPermission:n,onClose:()=>{console.log(`[KProfiles] Edit modal onClose - refetching profiles...`),d(null),G()},onSave:()=>{d(null),G()}})})(),f&&a&&(0,Z.jsx)(Te,{printerId:a,nozzleDiameter:c,existingProfiles:H?.profiles,builtinFilaments:ye,filamentPresets:xe,isDualNozzle:$,supportsFlowType:Oe,onSaveNote:Ie,hasPermission:n,onClose:()=>{p(!1),G()},onSave:()=>{p(!1),G()}}),g&&a&&(0,Z.jsx)(Te,{printerId:a,nozzleDiameter:c,existingProfiles:H?.profiles,builtinFilaments:ye,filamentPresets:xe,isDualNozzle:$,supportsFlowType:Oe,onSaveNote:Ie,hasPermission:n,profile:{...g,slot_id:0,name:`${g.name} (Copy)`},onClose:()=>{_(null),G()},onSave:()=>{_(null),G()}}),F&&(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,Z.jsx)(M,{className:`w-full max-w-sm`,children:(0,Z.jsxs)(j,{className:`p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,Z.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center`,children:(0,Z.jsx)(I,{className:`w-5 h-5 text-red-500`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:e(`kProfiles.bulkDelete.title`)}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`kProfiles.bulkDelete.cannotUndo`)})]})]}),(0,Z.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:e(`kProfiles.bulkDelete.message`,{count:k.size})}),(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsx)(N,{variant:`secondary`,onClick:()=>L(!1),disabled:R,className:`flex-1`,children:e(`common.cancel`)}),(0,Z.jsxs)(N,{onClick:Pe,disabled:R,className:`flex-1 bg-red-500 hover:bg-red-600 text-white`,children:[R?(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(I,{className:`w-4 h-4`}),e(`common.delete`)]})]})]})})})]})}var $=[`PLA`,`PETG`,`PCTG`,`ABS`,`ASA`,`TPU`,`PC`,`PA`,`PVA`,`HIPS`,`PP`,`PET`,`NYLON`],Oe={PLA:`E8E8E8`,PETG:`4A90D9`,ABS:`E67E22`,ASA:`D35400`,TPU:`9B59B6`,PC:`BDC3C7`,PA:`2ECC71`,NYLON:`2ECC71`,PVA:`F1C40F`,HIPS:`95A5A6`,PP:`ECF0F1`,PET:`3498DB`};function ke(e){let t=e.toUpperCase();for(let e of $)if(RegExp(`\\b${e}\\b`).test(t))return e;return null}function Ae(e){let t=e.replace(/@.+$/,``).trim(),n=t.toUpperCase();for(let e of $){let r=n.indexOf(e);if(r>0){let e=t.slice(0,r).trim();if(e&&e.length>1)return e}}return null}function je({preset:e,onDelete:t,onExpand:n,isExpanded:r}){let{t:a}=i(),{hasPermission:o}=de(),s=e.filament_type||ke(e.name),c=e.filament_vendor||Ae(e.name),l=null,u=!1;if(e.default_filament_colour)try{let t=JSON.parse(e.default_filament_colour),n=Array.isArray(t)?t[0]:t;typeof n==`string`&&/^#?[0-9a-fA-F]{6,8}$/.test(n.replace(`#`,``))&&(l=n.replace(`#`,``).slice(0,6),u=!0)}catch{let t=e.default_filament_colour;/^#?[0-9a-fA-F]{6,8}$/.test(t.replace(`#`,``))&&(l=t.replace(`#`,``).slice(0,6),u=!0)}return!l&&s&&(l=Oe[s.toUpperCase()]||null),(0,Z.jsx)(M,{className:`bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-dark-tertiary/80 transition-colors`,children:(0,Z.jsxs)(j,{className:`p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[e.preset_type===`filament`&&(0,Z.jsx)(`div`,{className:`w-4 h-4 rounded-full border border-black/20 flex-shrink-0 ${!u&&!l?`opacity-25`:u?``:`opacity-50`}`,style:{backgroundColor:l?`#${l}`:`#666`}}),(0,Z.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:e.name})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[s&&(0,Z.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bambu-green/20 text-bambu-green`,children:s}),c&&(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:c}),(0,Z.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:a(`profiles.localProfiles.badge`)})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[o(`settings:update`)&&(0,Z.jsx)(`button`,{onClick:()=>t(e.id),className:`p-1 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors`,title:a(`profiles.localProfiles.delete`),children:(0,Z.jsx)(I,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{onClick:()=>n(r?null:e.id),className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:r?(0,Z.jsx)(p,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(f,{className:`w-3.5 h-3.5`})})]})]}),r&&(0,Z.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-bambu-dark-tertiary text-xs space-y-1.5`,children:[s&&(0,Z.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:a(`profiles.localProfiles.filamentType`)}),(0,Z.jsx)(`span`,{className:`text-white`,children:s})]}),c&&(0,Z.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:a(`profiles.localProfiles.vendor`)}),(0,Z.jsx)(`span`,{className:`text-white`,children:c})]}),e.nozzle_temp_min!=null&&e.nozzle_temp_max!=null&&(0,Z.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:a(`profiles.localProfiles.nozzleTemp`)}),(0,Z.jsxs)(`span`,{className:`text-white`,children:[e.nozzle_temp_min,`–`,e.nozzle_temp_max,`°C`]})]}),e.filament_cost&&(0,Z.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:a(`profiles.localProfiles.cost`)}),(0,Z.jsx)(`span`,{className:`text-white`,children:e.filament_cost})]}),e.filament_density&&(0,Z.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:a(`profiles.localProfiles.density`)}),(0,Z.jsxs)(`span`,{className:`text-white`,children:[e.filament_density,` g/cm³`]})]}),e.pressure_advance&&(0,Z.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:a(`profiles.localProfiles.pressureAdvance`)}),(0,Z.jsx)(`span`,{className:`text-white`,children:e.pressure_advance})]}),e.compatible_printers&&(0,Z.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:a(`profiles.localProfiles.compatiblePrinters`)}),(0,Z.jsx)(`span`,{className:`text-white truncate ml-2`,children:(()=>{try{return JSON.parse(e.compatible_printers).join(`, `)}catch{return e.compatible_printers}})()})]}),e.inherits&&e.inherits!==e.name&&(0,Z.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:a(`profiles.localProfiles.inheritsFrom`)}),(0,Z.jsx)(`span`,{className:`text-white truncate ml-2`,children:e.inherits})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:a(`profiles.localProfiles.source`)}),(0,Z.jsx)(`span`,{className:`text-white capitalize`,children:e.source})]})]})]})})}function Me(){let{t:e}=i(),{hasPermission:t}=de(),n=a(),{showToast:c}=h(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(null),[p,g]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null),{data:b,isLoading:x}=o({queryKey:[`localPresets`],queryFn:()=>r.getLocalPresets()}),C=s({mutationFn:async e=>{let t=[];for(let n of Array.from(e)){let e=new FormData;e.append(`file`,n),t.push(await r.importLocalPresets(e))}return t},onSuccess:t=>{n.invalidateQueries({queryKey:[`localPresets`]}),n.invalidateQueries({queryKey:[`slicerPresets`]});let r=0,i=0,a=0;for(let e of t)r+=e.imported,i+=e.skipped,a+=e.errors.length;r>0&&c(e(`profiles.localProfiles.toast.importSuccess`,{count:r})),i>0&&c(e(`profiles.localProfiles.toast.importSkipped`,{count:i}),`warning`),a>0&&c(e(`profiles.localProfiles.toast.importError`,{count:a}),`error`)},onError:e=>{c(e.message,`error`)}}),T=s({mutationFn:e=>r.deleteLocalPreset(e),onSuccess:(t,r)=>{n.setQueryData([`localPresets`],e=>e&&{filament:e.filament.filter(e=>e.id!==r),printer:e.printer.filter(e=>e.id!==r),process:e.process.filter(e=>e.id!==r)}),n.invalidateQueries({queryKey:[`localPresets`]}),n.invalidateQueries({queryKey:[`slicerPresets`]}),y(null),c(e(`profiles.localProfiles.toast.deleted`))}}),E=(0,Y.useCallback)(e=>{!e||e.length===0||C.mutate(e)},[C]),D=(0,Y.useCallback)(e=>{e.preventDefault(),g(!1),E(e.dataTransfer.files)},[E]),O=(0,Y.useCallback)(e=>{if(!l)return e;let t=l.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||e.filament_type?.toLowerCase().includes(t)||e.filament_vendor?.toLowerCase().includes(t))},[l]),k=(0,Y.useMemo)(()=>O(b?.filament||[]),[b?.filament,O]),A=(0,Y.useMemo)(()=>O(b?.printer||[]),[b?.printer,O]),j=(0,Y.useMemo)(()=>O(b?.process||[]),[b?.process,O]),M=k.length+A.length+j.length,P=(b?.filament?.length??0)+(b?.printer?.length??0)+(b?.process?.length??0)>0;return x?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[t(`settings:update`)&&(0,Z.jsxs)(`div`,{onDragOver:e=>{e.preventDefault(),g(!0)},onDragLeave:()=>g(!1),onDrop:D,className:`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ${p?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:[(0,Z.jsx)(`input`,{type:`file`,accept:`.json,.zip,.orca_filament,.bbscfg,.bbsflmt`,multiple:!0,className:`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,onChange:e=>E(e.target.files)}),C.isPending?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,Z.jsx)(w,{className:`w-5 h-5 text-bambu-green animate-spin`}),(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:e(`profiles.localProfiles.importing`)})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(le,{className:`w-8 h-8 text-bambu-gray mx-auto mb-2`}),(0,Z.jsx)(`p`,{className:`text-sm text-white font-medium`,children:e(`profiles.localProfiles.import`)}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`profiles.localProfiles.importDesc`)})]})]}),P&&(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(ee,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:e(`profiles.localProfiles.search`),className:`w-full pl-9 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`})]}),!P&&!x&&(0,Z.jsxs)(`div`,{className:`text-center py-12`,children:[(0,Z.jsx)(S,{className:`w-12 h-12 text-bambu-gray mx-auto mb-3 opacity-50`}),(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:e(`profiles.localProfiles.noPresets`)}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray/60 mt-1`,children:e(`profiles.localProfiles.importDesc`)})]}),P&&M===0&&!x&&(0,Z.jsxs)(`div`,{className:`text-center py-12`,children:[(0,Z.jsx)(ee,{className:`w-12 h-12 text-bambu-gray mx-auto mb-3 opacity-50`}),(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:e(`profiles.localProfiles.noSearchResults`)})]}),M>0&&(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6`,children:[k.length>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,Z.jsx)(_,{className:`w-4 h-4 text-bambu-green`}),(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:e(`profiles.localProfiles.filament`)}),(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,k.length,`)`]})]}),(0,Z.jsx)(`div`,{className:`space-y-2`,children:k.map(e=>(0,Z.jsx)(je,{preset:e,onDelete:e=>y(e),onExpand:f,isExpanded:d===e.id},e.id))})]}),j.length>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,Z.jsx)(ce,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:e(`profiles.localProfiles.process`)}),(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,j.length,`)`]})]}),(0,Z.jsx)(`div`,{className:`space-y-2`,children:j.map(e=>(0,Z.jsx)(je,{preset:e,onDelete:e=>y(e),onExpand:f,isExpanded:d===e.id},e.id))})]}),A.length>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,Z.jsx)(te,{className:`w-4 h-4 text-orange-600 dark:text-orange-400`}),(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:e(`profiles.localProfiles.printer`)}),(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,A.length,`)`]})]}),(0,Z.jsx)(`div`,{className:`space-y-2`,children:A.map(e=>(0,Z.jsx)(je,{preset:e,onDelete:e=>y(e),onExpand:f,isExpanded:d===e.id},e.id))})]})]}),v!==null&&(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,Z.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg p-6 max-w-sm mx-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,Z.jsx)(m,{className:`w-5 h-5 text-red-600 dark:text-red-400`}),(0,Z.jsx)(`h3`,{className:`text-white font-medium`,children:e(`profiles.localProfiles.deleteConfirmTitle`)})]}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:e(`profiles.localProfiles.deleteConfirm`)}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(N,{variant:`secondary`,size:`sm`,onClick:()=>y(null),children:e(`profiles.localProfiles.cancel`)}),(0,Z.jsxs)(N,{variant:`danger`,size:`sm`,onClick:()=>T.mutate(v),disabled:T.isPending,children:[T.isPending?(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(I,{className:`w-4 h-4`}),e(`profiles.localProfiles.delete`)]})]})]})})]})}function Ne(e){let t=e.match(/@?\s*(?:BBL\s+)?(?:Bambu\s+Lab\s+)?([XPAH][1-9][A-Z]?(?:\s*(?:Carbon|mini))?|H2D)/i),n=e.match(/(\d+\.?\d*)\s*(?:mm\s*)?nozzle|nozzle\s*(\d+\.?\d*)/i),r=e.match(/(\d+\.?\d*)mm\s*(?:Standard|Fine|Extra Fine|Draft|Quality)?/i),i=e.match(/\b(PLA|PETG|ABS|ASA|TPU|PC|PA|PVA|HIPS|PP|PET(?:-?CF)?|PA(?:-?CF)?|PLA(?:-?CF)?)\b/i);return{printer:t?t[1].trim():null,nozzle:n?(n[1]||n[2])+`mm`:null,layerHeight:r?r[1]+`mm`:null,filamentType:i?i[1].toUpperCase():null}}function Pe({settings:e,lastSyncTime:t,onRefresh:n,isRefreshing:r,printers:i,t:a}){let[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(`all`),[u,d]=(0,Y.useState)(`all`),[f,p]=(0,Y.useState)(`all`),[m,h]=(0,Y.useState)(`all`),[g,v]=(0,Y.useState)(`all`),[b,x]=(0,Y.useState)(null),S=(0,Y.useMemo)(()=>[...e.filament.map(e=>({...e,type:`filament`})),...e.printer.map(e=>({...e,type:`printer`})),...e.process.map(e=>({...e,type:`process`}))].map(e=>({...e,meta:Ne(e.name)})),[e]),C=(0,Y.useMemo)(()=>{let e=new Set,t=new Set,n=new Set;return S.forEach(r=>{r.meta.nozzle&&e.add(r.meta.nozzle),r.meta.filamentType&&t.add(r.meta.filamentType),r.meta.layerHeight&&n.add(r.meta.layerHeight)}),{printers:i.map(e=>({id:e.id.toString(),name:e.name})),nozzles:Array.from(e).sort((e,t)=>parseFloat(e)-parseFloat(t)),filaments:Array.from(t).sort(),layerHeights:Array.from(n).sort((e,t)=>parseFloat(e)-parseFloat(t))}},[S,i]),w=(0,Y.useMemo)(()=>u===`all`?null:i.find(e=>e.id.toString()===u)?.model||null,[u,i]),T=(0,Y.useMemo)(()=>S.filter(e=>c===`all`||e.type===c).filter(e=>{if(u===`all`||!w)return!0;let t=e.meta.printer?.toLowerCase()||``,n=w.toLowerCase();return t.includes(n)||n.includes(t)}).filter(e=>f===`all`||e.meta.nozzle===f).filter(e=>m===`all`||e.meta.filamentType===m).filter(e=>g===`all`||e.meta.layerHeight===g).filter(e=>o===``||e.name.toLowerCase().includes(o.toLowerCase())).sort((e,t)=>e.name.localeCompare(t.name)),[S,c,u,w,f,m,g,o]),E=()=>{l(`all`),d(`all`),p(`all`),h(`all`),v(`all`),s(``)},D=c!==`all`||u!==`all`||f!==`all`||m!==`all`||g!==`all`||o!==``,O=e.filament.length+e.printer.length+e.process.length,k=e=>T.filter(t=>t.type===e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-4 mb-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(ee,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:a(`profiles.cloudView.searchPlaceholder`),className:`w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`})]}),(0,Z.jsx)(`div`,{className:`flex gap-2`,children:(0,Z.jsxs)(N,{variant:`secondary`,onClick:n,disabled:r,children:[(0,Z.jsx)(ie,{className:`w-4 h-4 ${r?`animate-spin`:``}`}),a(`profiles.cloudView.refresh`)]})})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(y,{className:`w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(Ue,{label:a(`profiles.cloudView.filters.type`),value:c,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`),count:O},{value:`filament`,label:a(`profiles.cloudView.filters.filament`),count:e.filament.length},{value:`printer`,label:a(`profiles.cloudView.filters.printer`),count:e.printer.length},{value:`process`,label:a(`profiles.cloudView.filters.process`),count:e.process.length}],onChange:e=>l(e)}),C.printers.length>0&&(0,Z.jsx)(Ue,{label:a(`profiles.cloudView.filters.printer`),value:u,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...C.printers.map(e=>({value:e.id,label:e.name}))],onChange:d}),C.nozzles.length>0&&(0,Z.jsx)(Ue,{label:a(`profiles.cloudView.filters.nozzle`),value:f,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...C.nozzles.map(e=>({value:e,label:e}))],onChange:p}),C.filaments.length>0&&(c===`all`||c===`filament`)&&(0,Z.jsx)(Ue,{label:a(`profiles.cloudView.filters.filament`),value:m,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...C.filaments.map(e=>({value:e,label:e}))],onChange:h}),C.layerHeights.length>0&&(c===`all`||c===`process`)&&(0,Z.jsx)(Ue,{label:a(`profiles.cloudView.filters.layer`),value:g,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...C.layerHeights.map(e=>({value:e,label:e}))],onChange:v}),D&&(0,Z.jsx)(`button`,{onClick:E,className:`px-3 py-2 text-sm text-bambu-gray hover:text-white transition-colors`,children:a(`profiles.cloudView.clearFilters`)})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 mb-4 text-sm text-bambu-gray`,children:[t&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(ae,{className:`w-3 h-3`}),a(`profiles.cloudView.lastSynced`),` `,P(t.toISOString(),`system`,a)]}),(0,Z.jsx)(`span`,{children:a(`profiles.cloudView.showingCount`,{showing:T.length,total:O})})]}),T.length===0?(0,Z.jsxs)(`div`,{className:`text-center py-16`,children:[(0,Z.jsx)(ce,{className:`w-12 h-12 text-bambu-gray-dark mx-auto mb-4`}),(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:a(`profiles.cloudView.noPresetsFound`)}),D&&(0,Z.jsx)(`button`,{onClick:E,className:`mt-2 text-sm text-bambu-green hover:text-bambu-green-light`,children:a(`profiles.cloudView.clearFilters`)})]}):(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-6`,children:[(0,Z.jsx)(Fe,{icon:(0,Z.jsx)(_,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),title:a(`profiles.cloudView.columns.filament`),presets:k(`filament`),emptyText:a(`profiles.cloudView.noFilamentPresets`),onSelect:x}),(0,Z.jsx)(Fe,{icon:(0,Z.jsx)(te,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),title:a(`profiles.cloudView.columns.process`),presets:k(`process`),emptyText:a(`profiles.cloudView.noProcessPresets`),onSelect:x}),(0,Z.jsx)(Fe,{icon:(0,Z.jsx)(re,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),title:a(`profiles.cloudView.columns.printer`),presets:k(`printer`),emptyText:a(`profiles.cloudView.noPrinterPresets`),onSelect:x})]}),b&&(0,Z.jsx)(Le,{setting:b,onClose:()=>x(null),t:a})]})}function Fe({icon:e,title:t,presets:n,emptyText:r,onSelect:i}){return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 px-1`,children:[e,(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray`,children:t}),(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray-dark`,children:[`(`,n.length,`)`]})]}),(0,Z.jsx)(`div`,{className:`space-y-1 max-h-[calc(100vh-320px)] overflow-y-auto pr-1`,children:n.length===0?(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray-dark px-3 py-2`,children:r}):n.map(e=>(0,Z.jsx)(Ie,{preset:e,onClick:()=>i(e)},e.setting_id))})]})}function Ie({preset:e,onClick:t}){return(0,Z.jsx)(`button`,{onClick:t,className:`w-full text-left px-3 py-2 rounded bg-bambu-dark hover:bg-bambu-dark-tertiary transition-colors`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-white text-sm truncate flex-1`,title:e.name,children:e.name}),e.meta.filamentType&&e.type===`filament`&&(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.meta.filamentType}),e.meta.layerHeight&&e.type===`process`&&(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.meta.layerHeight}),e.meta.printer&&(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.meta.printer})]})})}function Le({setting:e,onClose:t,t:n}){let{data:i,isLoading:a,error:s}=o({queryKey:[`orcaCloudProfileDetail`,e.setting_id],queryFn:()=>r.orcaCloudGetProfile(e.setting_id),retry:!1});return(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4`,onClick:t,children:(0,Z.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-2xl max-w-4xl w-full max-h-[90vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-lg font-bold text-white`,children:e.name}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:e.type})]}),(0,Z.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white p-1`,children:(0,Z.jsx)(A,{className:`w-5 h-5`})})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:a?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin`})}):s?(0,Z.jsx)(`p`,{className:`text-center text-bambu-gray py-16`,children:s.message}):i?(0,Z.jsx)(`pre`,{className:`text-xs font-mono text-bambu-gray bg-bambu-dark p-3 rounded overflow-x-auto whitespace-pre`,children:JSON.stringify(i.setting,null,2)}):(0,Z.jsx)(`p`,{className:`text-center text-bambu-gray py-16`,children:n(`profiles.cloudView.noPresetsFound`)})})]})})}function Re(){let{t:e}=i(),t=a(),{showToast:n}=h(),{hasPermission:c}=de(),l=c(`orca_cloud:auth`),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(5e3),[m,g]=(0,Y.useState)(null),{data:_,isLoading:v}=o({queryKey:[`orcaCloudStatus`],queryFn:r.orcaCloudStatus}),y=!!_?.connected,{data:b,isLoading:x,refetch:S,isRefetching:C,error:T,dataUpdatedAt:E}=o({queryKey:[`orcaCloudProfiles`],queryFn:r.orcaCloudListProfiles,enabled:y,retry:!1,staleTime:1e3*60*5}),{data:ee=[]}=o({queryKey:[`printers`],queryFn:r.getPrinters,enabled:y}),[te,D]=(0,Y.useState)();(0,Y.useEffect)(()=>{E&&D(new Date(E))},[E]);let O=()=>{d(null),p(5e3)},k=t=>{t===`access_denied`?g(e(`profiles.orcaCloud.errors.denied`)):t===`expired_token`&&g(e(`profiles.orcaCloud.errors.expired`)),O()},A=s({mutationFn:r.orcaCloudDeviceStart,onSuccess:e=>{g(null),p(Math.max(1,e.interval)*1e3),d(e)},onError:t=>{g(t.message||e(`profiles.orcaCloud.errors.startFailed`))}}),j=s({mutationFn:r.orcaCloudLogout,onSuccess:()=>{t.invalidateQueries({queryKey:[`orcaCloudStatus`]}),t.removeQueries({queryKey:[`orcaCloudProfiles`]}),n(e(`profiles.orcaCloud.toast.disconnected`))}}),{data:M,error:P}=o({queryKey:[`orcaCloudDevicePoll`,u?.user_code??`none`],queryFn:r.orcaCloudDevicePoll,enabled:u!==null,gcTime:0,retry:!1,refetchOnWindowFocus:!1,refetchInterval:u===null?!1:f}),F=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(!u||!M)return;let r=M.status;if(r===`slow_down`){p(e=>e+5e3);return}r!==`authorization_pending`&&F.current!==r&&(F.current=r,r===`complete`?(O(),t.invalidateQueries({queryKey:[`orcaCloudStatus`]}),t.invalidateQueries({queryKey:[`orcaCloudProfiles`]}),n(e(`profiles.orcaCloud.connectedShort`))):k(r))},[M,u]),(0,Y.useEffect)(()=>{u&&P&&(g(e(`profiles.orcaCloud.errors.pollFailed`)),O())},[P,u]),(0,Y.useEffect)(()=>{u&&(F.current=null)},[u]),v?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,Z.jsxs)(`div`,{children:[y&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-3 mb-6 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-bambu-green animate-pulse`}),(0,Z.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:_?.email?(0,Z.jsxs)(Z.Fragment,{children:[e(`profiles.orcaCloud.connectedAs`),` `,(0,Z.jsx)(`span`,{className:`text-white`,children:_.email})]}):(0,Z.jsx)(`span`,{className:`text-white`,children:e(`profiles.orcaCloud.connectedShort`)})})]}),(0,Z.jsxs)(N,{variant:`secondary`,size:`sm`,onClick:()=>j.mutate(),disabled:j.isPending||!l,title:l?void 0:e(`profiles.orcaCloud.noLogoutPermission`),children:[(0,Z.jsx)(W,{className:`w-4 h-4`}),e(`profiles.orcaCloud.logout`)]})]}),y?x?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin`})}):T?(0,Z.jsxs)(`div`,{className:`text-center py-16`,children:[(0,Z.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:T.message}),(0,Z.jsx)(N,{onClick:()=>S(),children:e(`profiles.orcaCloud.retry`)})]}):b?(0,Z.jsx)(Pe,{settings:b,lastSyncTime:te,onRefresh:()=>S(),isRefreshing:C,printers:ee,t:e}):null:(0,Z.jsx)(ze,{pairing:u,connectError:m,onConnect:()=>A.mutate(),onCancel:O,isStarting:A.isPending,canManage:l,t:e})]})}function ze({pairing:e,connectError:t,onConnect:n,onCancel:r,isStarting:i,canManage:a,t:o}){return e?(0,Z.jsx)(M,{children:(0,Z.jsxs)(j,{className:`p-8 text-center max-w-md mx-auto`,children:[(0,Z.jsx)(z,{className:`w-12 h-12 text-bambu-green mx-auto mb-4`}),(0,Z.jsx)(`h2`,{className:`text-xl font-bold text-white mb-2`,children:o(`profiles.orcaCloud.device.title`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:o(`profiles.orcaCloud.device.instruction`)}),(0,Z.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-bambu-gray mb-2`,children:o(`profiles.orcaCloud.device.codeLabel`)}),(0,Z.jsx)(`div`,{className:`mb-6 py-3 px-4 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg`,children:(0,Z.jsx)(`span`,{className:`text-2xl font-mono font-bold tracking-[0.3em] text-white select-all`,children:e.user_code})}),(0,Z.jsx)(`a`,{href:e.verification_uri_complete,target:`_blank`,rel:`noopener noreferrer`,children:(0,Z.jsxs)(N,{className:`w-full mb-3`,children:[(0,Z.jsx)(R,{className:`w-4 h-4`}),o(`profiles.orcaCloud.device.openButton`)]})}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray break-all mb-6`,children:o(`profiles.orcaCloud.device.manualHint`,{url:e.verification_uri})}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-bambu-gray mb-4`,children:[(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin text-bambu-green`}),o(`profiles.orcaCloud.device.waiting`)]}),(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`text-bambu-gray hover:text-white text-sm`,children:o(`profiles.orcaCloud.device.cancel`)})]})}):(0,Z.jsx)(M,{children:(0,Z.jsxs)(j,{className:`p-8 text-center`,children:[(0,Z.jsx)(z,{className:`w-12 h-12 text-bambu-green mx-auto mb-4`}),(0,Z.jsx)(`h2`,{className:`text-xl font-bold text-white mb-2`,children:o(`profiles.orcaCloud.connect.title`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray mb-6 max-w-xl mx-auto`,children:o(`profiles.orcaCloud.connect.description`)}),(0,Z.jsxs)(`div`,{className:`max-w-sm mx-auto`,children:[(0,Z.jsxs)(N,{onClick:n,disabled:i||!a,title:a?void 0:o(`profiles.orcaCloud.noConnectPermission`),className:`w-full`,children:[i?(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(d,{className:`w-4 h-4`}),o(`profiles.orcaCloud.connectButton`)]}),t&&(0,Z.jsxs)(`p`,{className:`mt-3 text-sm text-red-700 dark:text-red-400 flex items-center justify-center gap-2`,children:[(0,Z.jsx)(m,{className:`w-4 h-4 flex-shrink-0`}),t]})]})]})})}function Be(e,t){let n=`${e} ${t||``}`,r=n.match(/@?\s*(?:BBL\s+)?(?:Bambu\s+Lab\s+)?([XPAH][1-9][A-Z]?(?:\s*(?:Carbon|mini))?|H2D)/i),i=r?r[1].trim():null,a=n.match(/(\d+\.?\d*)\s*(?:mm\s*)?nozzle|nozzle\s*(\d+\.?\d*)/i),o=a?(a[1]||a[2])+`mm`:null,s=n.match(/(\d+\.?\d*)mm\s*(?:Standard|Fine|Extra Fine|Draft|Quality)?/i),c=s?s[1]+`mm`:null,l=n.match(/\b(PLA|PETG|ABS|ASA|TPU|PC|PA|PVA|HIPS|PP|PET(?:-?CF)?|PA(?:-?CF)?|PLA(?:-?CF)?)\b/i);return{printer:i,nozzle:o,layerHeight:c,filamentType:l?l[1].toUpperCase():null}}function Ve(e){return/^(P[FPM]US|PF\d|PP\d)/.test(e)}function He({onSuccess:e,t}){let{showToast:n}=h(),[i,a]=(0,Y.useState)(`email`),[o,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(`global`),[v,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(!1),E=s({mutationFn:()=>r.cloudLogin(o,l,g),onSuccess:r=>{if(C(r.reason===`captcha`),r.success)n(t(`profiles.login.toast.loggedIn`)),e();else if(r.reason===`captcha`)return;else r.needs_verification?(y(r.verification_type||`email`),x(r.tfa_key||null),r.verification_type===`totp`?n(t(`profiles.login.toast.enterTotp`)):n(t(`profiles.login.toast.codeSent`)),a(`code`)):n(r.message,`error`)},onError:e=>{C(!1),n(e.message,`error`)}}),ee=s({mutationFn:()=>r.cloudVerify(o,d,b||void 0,g),onSuccess:r=>{C(r.reason===`captcha`),r.success?(n(t(`profiles.login.toast.loggedIn`)),e()):r.reason!==`captcha`&&n(r.message,`error`)},onError:e=>{C(!1),n(e.message,`error`)}}),te=s({mutationFn:()=>r.cloudSetToken(p,g),onSuccess:()=>{n(t(`profiles.login.toast.tokenSet`)),e()},onError:e=>n(e.message,`error`)}),D=e=>{e.preventDefault(),i===`email`?E.mutate():i===`code`?ee.mutate():i===`token`&&te.mutate()},O=E.isPending||ee.isPending||te.isPending;return(0,Z.jsx)(M,{className:`max-w-md mx-auto`,children:(0,Z.jsxs)(j,{children:[(0,Z.jsxs)(`div`,{className:`text-center mb-6`,children:[(0,Z.jsx)(`div`,{className:`inline-flex items-center justify-center w-12 h-12 rounded-xl bg-bambu-green/20 mb-3`,children:(0,Z.jsx)(z,{className:`w-6 h-6 text-bambu-green`})}),(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:t(`profiles.login.title`)}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:t(`profiles.login.subtitle`)})]}),S&&i!==`token`&&(0,Z.jsx)(`div`,{role:`alert`,className:`mb-4 p-3 rounded-lg border border-amber-500/40 bg-amber-500/10`,children:(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(L,{className:`w-4 h-4 text-amber-400 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-amber-300`,children:t(`profiles.login.captchaTitle`)}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:t(`profiles.login.captchaBody`)}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{C(!1),a(`token`)},className:`mt-2 text-xs text-bambu-green hover:underline flex items-center gap-1`,children:[(0,Z.jsx)(G,{className:`w-3 h-3`}),t(`profiles.login.useToken`)]})]})]})}),(0,Z.jsxs)(`form`,{onSubmit:D,className:`space-y-4`,children:[i===`email`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.email`)}),(0,Z.jsx)(`input`,{type:`email`,value:o,onChange:e=>c(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`,placeholder:`your@email.com`,required:!0})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.password`)}),(0,Z.jsx)(`input`,{type:`password`,value:l,onChange:e=>u(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`,placeholder:`••••••••`,required:!0})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.region`)}),(0,Z.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:`global`,children:t(`profiles.login.regionGlobal`)}),(0,Z.jsx)(`option`,{value:`china`,children:t(`profiles.login.regionChina`)})]})]})]}),i===`code`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(v===`totp`?`profiles.login.totpCode`:`profiles.login.verificationCode`)}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:v===`totp`?t(`profiles.login.enterTotpHint`):t(`profiles.login.checkEmail`,{email:o})}),(0,Z.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value.replace(/\D/g,``).slice(0,6)),className:`w-full px-3 py-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-center text-2xl tracking-widest font-mono focus:border-bambu-green focus:outline-none`,placeholder:`000000`,maxLength:6,required:!0})]}),i===`token`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.accessToken`)}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:t(`profiles.login.accessTokenHint`)}),(0,Z.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none resize-none`,placeholder:`eyJ...`,rows:4,required:!0})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.region`)}),(0,Z.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:`global`,children:t(`profiles.login.regionGlobal`)}),(0,Z.jsx)(`option`,{value:`china`,children:t(`profiles.login.regionChina`)})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2 max-[550px]:flex-wrap max-[550px]:items-center`,children:[i===`code`&&(0,Z.jsx)(N,{type:`button`,variant:`secondary`,onClick:()=>a(`email`),className:`flex-1`,children:t(`profiles.login.back`)}),(0,Z.jsxs)(N,{type:`submit`,disabled:O,className:`flex-1`,children:[O?(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(T,{className:`w-4 h-4`}),t(i===`email`?`profiles.login.loginButton`:i===`code`?`profiles.login.verifyButton`:`profiles.login.setTokenButton`)]})]}),i===`email`&&(0,Z.jsx)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>a(`token`),className:`text-sm text-bambu-gray hover:text-white flex items-center gap-2 transition-colors`,children:[(0,Z.jsx)(G,{className:`w-4 h-4`}),t(`profiles.login.useToken`)]})}),i===`token`&&(0,Z.jsx)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>a(`email`),className:`text-sm text-bambu-gray hover:text-white flex items-center gap-2 transition-colors`,children:[(0,Z.jsx)(T,{className:`w-4 h-4`}),t(`profiles.login.useEmail`)]})})]})]})})}function Ue({label:e,value:t,options:n,onChange:r}){let[i,a]=(0,Y.useState)(!1),o=n.find(e=>e.value===t);return(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsxs)(`button`,{onClick:()=>a(!i),className:`flex items-center gap-2 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-white hover:border-bambu-gray-dark transition-colors`,children:[(0,Z.jsxs)(`span`,{className:`text-bambu-gray`,children:[e,`:`]}),(0,Z.jsx)(`span`,{children:o?.label||`All`}),(0,Z.jsx)(f,{className:`w-4 h-4 text-bambu-gray transition-transform ${i?`rotate-180`:``}`})]}),i&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>a(!1)}),(0,Z.jsx)(`div`,{className:`absolute top-full left-0 mt-1 min-w-[160px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20 py-1 max-h-60 overflow-y-auto`,children:n.map(e=>(0,Z.jsxs)(`button`,{onClick:()=>{r(e.value),a(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-bambu-dark-tertiary transition-colors ${t===e.value?`text-bambu-green`:`text-white`}`,children:[(0,Z.jsx)(`span`,{children:e.label}),e.count!==void 0&&(0,Z.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:e.count})]},e.value))})]})]})}function We(){let[e,t]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{let e=()=>{t(window.scrollY>300)};return window.addEventListener(`scroll`,e),()=>window.removeEventListener(`scroll`,e)},[]),e?(0,Z.jsx)(`button`,{onClick:()=>{window.scrollTo({top:0,behavior:`smooth`})},className:`fixed bottom-24 right-6 p-3 bg-bambu-green hover:bg-bambu-green-light text-white rounded-full shadow-lg shadow-bambu-green/25 transition-all z-40`,"aria-label":`Scroll to top`,children:(0,Z.jsx)(u,{className:`w-5 h-5`})}):null}function Ge({setting:e,onClick:t,onDuplicate:n,compareMode:r,isCompareSelected:i,compareIndex:a,compareDisabled:o,t:s}){let c=Be(e.name),l=Ve(e.setting_id);return(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,Z.jsx)(`button`,{onClick:t,disabled:o,className:`flex-1 text-left px-3 py-2 rounded transition-colors ${i?`bg-blue-500/20 border border-blue-500/50`:o?`bg-bambu-dark/50 opacity-40 cursor-not-allowed`:`bg-bambu-dark hover:bg-bambu-dark-tertiary`} ${r&&!o?`cursor-pointer`:``}`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&a!==void 0&&(0,Z.jsx)(`span`,{className:`flex-shrink-0 w-5 h-5 rounded-full bg-blue-500 text-white text-xs flex items-center justify-center font-medium`,children:a+1}),!i&&l&&(0,Z.jsx)(`span`,{className:`flex-shrink-0 w-1.5 h-1.5 rounded-full bg-bambu-green`,title:s(`profiles.presets.myPreset`)}),(0,Z.jsx)(`span`,{className:`text-white text-sm truncate flex-1`,title:e.name,children:e.name}),c.filamentType&&e.type===`filament`&&(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:c.filamentType}),c.layerHeight&&e.type===`process`&&(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:c.layerHeight}),c.printer&&(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:c.printer})]})}),(0,Z.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n()},className:`can-hover:opacity-0 group-hover:opacity-100 focus-visible:opacity-100 text-bambu-gray hover:text-white transition-all p-1`,title:s(`profiles.presets.duplicate`),children:(0,Z.jsx)(g,{className:`w-4 h-4`})})]})}function Ke(e,t=0){let n=` `.repeat(t);if(e===null)return`null`;if(e===void 0)return`undefined`;if(typeof e==`string`){if(e.includes(`\\n`)||e.includes(` +`)){let t=e.replace(/\\n/g,` +`).replace(/\\"/g,`"`).replace(/\\t/g,` `).split(` +`);if(t.length>1)return`""" +`+t.map(e=>n+` `+e).join(` +`)+` +`+n+`"""`}return JSON.stringify(e)}if(typeof e==`number`||typeof e==`boolean`)return String(e);if(Array.isArray(e))return e.length===0?`[]`:`[ +`+e.map(e=>n+` `+Ke(e,t+1)).join(`, +`)+` +`+n+`]`;if(typeof e==`object`){let r=Object.entries(e);return r.length===0?`{}`:`{ +`+r.map(([e,r])=>n+` `+JSON.stringify(e)+`: `+Ke(r,t+1)).join(`, +`)+` +`+n+`}`}return String(e)}function qe({setting:e,onClose:t,onDeleted:n,onDuplicate:i,onEdit:c,hasPermission:l,t:u}){let{showToast:d}=h(),f=a(),[p,m]=(0,Y.useState)(!1),{data:_,isLoading:v}=o({queryKey:[`cloudSettingDetail`,e.setting_id],queryFn:()=>r.getCloudSettingDetail(e.setting_id)}),y=s({mutationFn:()=>r.deleteCloudSetting(e.setting_id),onSuccess:()=>{d(u(`profiles.presets.toast.deleted`)),f.invalidateQueries({queryKey:[`cloudSettings`]}),n()},onError:e=>d(e.message,`error`)}),b=Ve(e.setting_id),x=Be(e.name,_?.setting?.inherits);return(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,Z.jsx)(M,{className:`w-full max-w-3xl max-h-[90vh] flex flex-col overflow-hidden`,children:(0,Z.jsxs)(j,{className:`p-0 flex flex-col min-h-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex-shrink-0 flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-white truncate`,children:e.name}),b&&(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-xs font-medium bg-bambu-green/20 text-bambu-green rounded-full`,children:u(`profiles.presets.editable`)})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-sm text-bambu-gray`,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:u(`profiles.presets.types.${e.type}`)}),x.printer&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{children:`•`}),(0,Z.jsx)(`span`,{children:x.printer})]})]})]}),(0,Z.jsx)(`button`,{onClick:t,className:`p-2 text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,Z.jsx)(A,{className:`w-5 h-5`})})]}),(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4`,children:v?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin`})}):_?(0,Z.jsx)(`pre`,{className:`text-xs text-bambu-gray font-mono whitespace-pre-wrap break-all bg-bambu-dark p-4 rounded-lg border border-bambu-dark-tertiary overflow-x-auto max-w-full`,children:Ke(_)}):(0,Z.jsx)(`div`,{className:`text-center py-16 text-bambu-gray`,children:u(`profiles.presets.failedToLoadDetails`)})}),p?(0,Z.jsxs)(`div`,{className:`flex-shrink-0 p-4 border-t border-bambu-dark-tertiary bg-red-500/5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 text-red-700 dark:text-red-400`,children:[(0,Z.jsx)(k,{className:`w-5 h-5`}),(0,Z.jsx)(`span`,{className:`font-medium`,children:u(`profiles.presets.deleteConfirm`)})]}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:u(`profiles.presets.deleteWarning`,{name:e.name})}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(N,{variant:`secondary`,onClick:()=>m(!1),disabled:y.isPending,className:`flex-1`,children:u(`common.cancel`)}),(0,Z.jsxs)(N,{variant:`danger`,onClick:()=>y.mutate(),disabled:y.isPending,className:`flex-1`,children:[y.isPending?(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin`}):(0,Z.jsx)(I,{className:`w-4 h-4`}),u(`common.delete`)]})]})]}):(0,Z.jsx)(`div`,{className:`flex-shrink-0 p-4 border-t border-bambu-dark-tertiary`,children:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(N,{variant:`secondary`,onClick:t,className:`flex-1`,children:u(`common.close`)}),(0,Z.jsxs)(N,{variant:`secondary`,onClick:i,disabled:!l(`cloud:auth`),title:l(`cloud:auth`)?void 0:u(`profiles.presets.noDuplicatePermission`),children:[(0,Z.jsx)(g,{className:`w-4 h-4`}),u(`profiles.presets.duplicate`)]}),b&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`secondary`,onClick:c,disabled:v||!_||!l(`cloud:auth`),title:l(`cloud:auth`)?void 0:u(`profiles.presets.noEditPermission`),children:[(0,Z.jsx)(F,{className:`w-4 h-4`}),u(`common.edit`)]}),(0,Z.jsx)(N,{variant:`danger`,onClick:()=>m(!0),disabled:!l(`cloud:auth`),title:l(`cloud:auth`)?void 0:u(`profiles.presets.noDeletePermission`),children:(0,Z.jsx)(I,{className:`w-4 h-4`})})]})]})})]})})})}function Je(){try{let e=localStorage.getItem(`bambusy_preset_templates`);return e?JSON.parse(e):[]}catch{return[]}}function Ye(e){localStorage.setItem(`bambusy_preset_templates`,JSON.stringify(e))}function Xe({onClose:e,onApply:t,t:n}){let{showToast:r}=h(),[i,a]=(0,Y.useState)(Je),[o,s]=(0,Y.useState)(`all`),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[m,g]=(0,Y.useState)(`{}`),[y,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null),C=o===`all`?i:i.filter(e=>e.type===o),w=e=>{a(e),Ye(e)},T=e=>{w(i.filter(t=>t.id!==e)),S(null),r(n(`profiles.templates.toast.deleted`))},E=e=>{l(e.id),d(e.name),p(e.description),g(JSON.stringify(e.settings,null,2)),b(null)},ee=()=>{if(!(!c||!u.trim()))try{let e=JSON.parse(m);w(i.map(t=>t.id===c?{...t,name:u.trim(),description:f.trim(),settings:e}:t)),l(null),r(n(`profiles.templates.toast.updated`))}catch(e){b(e.message)}},O=()=>{l(null),d(``),p(``),g(`{}`),b(null)},P=e=>{w(i.map(t=>t.id===e?{...t,showInModal:!t.showInModal}:t))},L={filament:{label:n(`profiles.presets.types.filament`),icon:_,color:`text-amber-600 dark:text-amber-400`},print:{label:n(`profiles.presets.types.process`),icon:te,color:`text-blue-600 dark:text-blue-400`},printer:{label:n(`profiles.presets.types.printer`),icon:re,color:`text-purple-600 dark:text-purple-400`}},R=x?i.find(e=>e.id===x):null;return(0,Y.useEffect)(()=>{let t=t=>{t.key===`Escape`&&(x?S(null):c?O():e())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[x,c,e]),(0,Z.jsxs)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:[R&&(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-60`,children:(0,Z.jsx)(M,{className:`w-full max-w-md`,children:(0,Z.jsxs)(j,{className:`p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,Z.jsx)(`div`,{className:`p-2 bg-red-500/20 rounded-lg`,children:(0,Z.jsx)(k,{className:`w-6 h-6 text-red-600 dark:text-red-400`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:n(`profiles.templates.deleteTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`profiles.templates.deleteWarning`)})]})]}),(0,Z.jsx)(`p`,{className:`text-white mb-6`,children:n(`profiles.templates.deleteConfirm`,{name:R.name})}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(N,{variant:`secondary`,onClick:()=>S(null),className:`flex-1`,children:n(`common.cancel`)}),(0,Z.jsxs)(N,{onClick:()=>T(x),className:`flex-1 bg-red-500 hover:bg-red-600`,children:[(0,Z.jsx)(I,{className:`w-4 h-4`}),n(`common.delete`)]})]})]})})}),(0,Z.jsx)(M,{className:`w-full max-w-2xl max-h-[80vh] flex flex-col`,children:(0,Z.jsxs)(j,{className:`p-0 flex flex-col h-full`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Z.jsx)(D,{className:`w-5 h-5 text-amber-600 dark:text-amber-400`}),n(`profiles.templates.title`)]}),(0,Z.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white`,children:(0,Z.jsx)(A,{className:`w-5 h-5`})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:n(`profiles.templates.typeFilter`)}),[`all`,`filament`,`print`,`printer`].map(e=>(0,Z.jsx)(`button`,{onClick:()=>s(e),className:`px-3 py-1 text-sm rounded-lg transition-colors ${o===e?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,children:e===`all`?n(`common.all`):L[e].label},e))]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:C.length===0?(0,Z.jsxs)(`div`,{className:`text-center py-12 text-bambu-gray`,children:[(0,Z.jsx)(D,{className:`w-12 h-12 mx-auto mb-4 opacity-30`}),(0,Z.jsx)(`p`,{children:n(`profiles.templates.noTemplates`)}),(0,Z.jsx)(`p`,{className:`text-sm mt-1`,children:n(`profiles.templates.createFirst`)})]}):(0,Z.jsx)(`div`,{className:`space-y-2`,children:C.map(e=>{let r=L[e.type],i=r.icon;return c===e.id?(0,Z.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg border border-bambu-green`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mb-3`,children:[(0,Z.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:n(`profiles.templates.namePlaceholder`),className:`px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,autoFocus:!0}),(0,Z.jsx)(`input`,{type:`text`,value:f,onChange:e=>p(e.target.value),placeholder:n(`profiles.templates.descriptionPlaceholder`),className:`px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`})]}),(0,Z.jsxs)(`div`,{className:`mb-3`,children:[(0,Z.jsx)(`label`,{className:`text-xs text-bambu-gray mb-1 block`,children:n(`profiles.templates.settingsJson`)}),(0,Z.jsx)(`textarea`,{value:m,onChange:e=>{g(e.target.value),b(null)},rows:6,className:`w-full px-3 py-2 bg-bambu-dark-secondary border rounded text-white text-sm font-mono focus:outline-none ${y?`border-red-500`:`border-bambu-dark-tertiary focus:border-bambu-green`}`}),y&&(0,Z.jsx)(`p`,{className:`text-xs text-red-700 dark:text-red-400 mt-1`,children:y})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(N,{size:`sm`,onClick:ee,disabled:!u.trim(),children:[(0,Z.jsx)(U,{className:`w-4 h-4`}),`Save`]}),(0,Z.jsx)(N,{size:`sm`,variant:`secondary`,onClick:O,children:`Cancel`})]})]},e.id):(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary hover:border-bambu-gray-dark transition-colors`,children:[(0,Z.jsx)(i,{className:`w-5 h-5 ${r.color} flex-shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-white`,children:e.name}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray truncate`,children:e.description})]}),(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray-dark px-2 py-1 bg-bambu-dark-secondary rounded`,children:n(`profiles.templates.fieldsCount`,{count:Object.keys(e.settings).length})}),(0,Z.jsx)(`button`,{onClick:()=>P(e.id),className:`p-1 transition-colors ${e.showInModal?`text-bambu-green hover:text-bambu-green/70`:`text-bambu-gray hover:text-white`}`,title:e.showInModal?n(`profiles.templates.shownInModals`):n(`profiles.templates.hiddenInModals`),children:e.showInModal?(0,Z.jsx)(H,{className:`w-4 h-4`}):(0,Z.jsx)(v,{className:`w-4 h-4`})}),(0,Z.jsx)(`button`,{onClick:()=>t(e),className:`px-3 py-1 text-xs bg-bambu-green/20 text-bambu-green rounded hover:bg-bambu-green/30 transition-colors`,children:n(`profiles.templates.apply`)}),(0,Z.jsx)(`button`,{onClick:()=>E(e),className:`p-1 text-bambu-gray hover:text-white`,title:n(`common.edit`),children:(0,Z.jsx)(F,{className:`w-4 h-4`})}),(0,Z.jsx)(`button`,{onClick:()=>S(e.id),className:`p-1 text-bambu-gray hover:text-red-600 dark:hover:text-red-400`,title:n(`common.delete`),children:(0,Z.jsx)(I,{className:`w-4 h-4`})})]},e.id)})})})]})})]})}function Ze({onClose:e,leftPreset:t,rightPreset:n,leftLabel:r,rightLabel:i,t:a}){let[o,s]=(0,Y.useState)(`changes`),[c,u]=(0,Y.useState)(``),d=(0,Y.useMemo)(()=>{let e=new Set([...Object.keys(t),...Object.keys(n)]),r=[];for(let i of e){if(i===`inherits`||i===`version`)continue;let e=t[i],a=n[i],o=i in t,s=i in n,c;c=!o&&s?`added`:o&&!s?`removed`:JSON.stringify(e)===JSON.stringify(a)?`same`:`changed`,r.push({key:i,left:e,right:a,status:c})}return r.sort((e,t)=>{let n={changed:0,added:1,removed:2,same:3};return n[e.status]===n[t.status]?e.key.localeCompare(t.key):n[e.status]-n[t.status]})},[t,n]),f=(0,Y.useMemo)(()=>{let e=[...d];if(o===`changes`&&(e=e.filter(e=>e.status!==`same`)),c){let t=c.toLowerCase();e=e.filter(e=>e.key.toLowerCase().includes(t)||String(e.left).toLowerCase().includes(t)||String(e.right).toLowerCase().includes(t))}return e},[d,o,c]),p=(0,Y.useMemo)(()=>({added:d.filter(e=>e.status===`added`).length,removed:d.filter(e=>e.status===`removed`).length,changed:d.filter(e=>e.status===`changed`).length,same:d.filter(e=>e.status===`same`).length}),[d]),m=e=>{if(e===void 0)return`—`;if(e===null)return`null`;if(Array.isArray(e))return e.length===0?`[]`:e.length===1?String(e[0]):e.join(`, `);if(typeof e==`object`)return JSON.stringify(e);let t=String(e);if(t.includes(`\\n`)||t.length>100){let e=t.split(`\\n`).length;if(e>1)return`[${e} lines of G-code/script]`;if(t.length>100)return t.substring(0,100)+`…`}return t};return(0,Y.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,Z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,Z.jsx)(M,{className:`w-full max-w-4xl max-h-[85vh] flex flex-col overflow-hidden`,children:(0,Z.jsxs)(j,{className:`p-0 flex flex-col min-h-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex-shrink-0 flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Z.jsx)(x,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),a(`profiles.diff.title`)]}),(0,Z.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white`,children:(0,Z.jsx)(A,{className:`w-5 h-5`})})]}),(0,Z.jsxs)(`div`,{className:`flex-shrink-0 grid grid-cols-2 gap-4 p-4 border-b border-bambu-dark-tertiary bg-bambu-dark`,children:[(0,Z.jsxs)(`div`,{className:`text-center`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:a(`profiles.diff.left`)}),(0,Z.jsx)(`p`,{className:`text-white font-medium truncate`,children:r})]}),(0,Z.jsxs)(`div`,{className:`text-center`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:a(`profiles.diff.right`)}),(0,Z.jsx)(`p`,{className:`text-white font-medium truncate`,children:i})]})]}),(0,Z.jsxs)(`div`,{className:`flex-shrink-0 flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-green-700 dark:text-green-400`,children:[(0,Z.jsx)(se,{className:`w-3.5 h-3.5`}),p.added,` `,a(`profiles.diff.added`)]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-red-700 dark:text-red-400`,children:[(0,Z.jsx)(E,{className:`w-3.5 h-3.5`}),p.removed,` `,a(`profiles.diff.removed`)]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(l,{className:`w-3.5 h-3.5`}),p.changed,` `,a(`profiles.diff.changed`)]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-gray`,children:[(0,Z.jsx)(J,{className:`w-3.5 h-3.5`}),p.same,` `,a(`profiles.diff.same`)]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(ee,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,value:c,onChange:e=>u(e.target.value),placeholder:a(`profiles.diff.searchFields`),className:`pl-8 pr-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none w-48`})]}),p.same>0&&(0,Z.jsxs)(`div`,{className:`flex rounded overflow-hidden border border-bambu-dark-tertiary`,children:[(0,Z.jsx)(`button`,{onClick:()=>s(`changes`),className:`px-3 py-1.5 text-sm transition-colors ${o===`changes`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,children:a(`profiles.diff.changes`)}),(0,Z.jsx)(`button`,{onClick:()=>s(`all`),className:`px-3 py-1.5 text-sm transition-colors ${o===`all`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,children:a(`common.all`)})]})]})]}),(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:f.length===0?(0,Z.jsxs)(`div`,{className:`text-center py-12 text-bambu-gray`,children:[(0,Z.jsx)(J,{className:`w-12 h-12 mx-auto mb-4 opacity-30`}),(0,Z.jsx)(`p`,{children:a(o===`changes`?`profiles.diff.noDifferences`:`profiles.diff.noFieldsMatch`)})]}):(0,Z.jsxs)(`table`,{className:`w-full`,children:[(0,Z.jsx)(`thead`,{className:`sticky top-0 bg-bambu-dark-secondary`,children:(0,Z.jsxs)(`tr`,{className:`text-sm text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,Z.jsx)(`th`,{className:`text-left p-3 w-1/3`,children:a(`profiles.diff.field`)}),(0,Z.jsx)(`th`,{className:`text-left p-3 w-1/3`,children:r}),(0,Z.jsx)(`th`,{className:`text-left p-3 w-1/3`,children:i})]})}),(0,Z.jsx)(`tbody`,{children:f.map(e=>{let t={added:`bg-green-500/10`,removed:`bg-red-500/10`,changed:`bg-amber-500/10`,same:``}[e.status],n={added:(0,Z.jsx)(se,{className:`w-3.5 h-3.5 text-green-600 dark:text-green-400`}),removed:(0,Z.jsx)(E,{className:`w-3.5 h-3.5 text-red-600 dark:text-red-400`}),changed:(0,Z.jsx)(l,{className:`w-3.5 h-3.5 text-amber-600 dark:text-amber-400`}),same:(0,Z.jsx)(J,{className:`w-3.5 h-3.5 text-bambu-gray-dark`})}[e.status];return(0,Z.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary ${t}`,children:[(0,Z.jsx)(`td`,{className:`p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n,(0,Z.jsx)(`span`,{className:`text-sm text-white font-mono`,children:e.key})]})}),(0,Z.jsx)(`td`,{className:`p-3`,children:(0,Z.jsx)(`span`,{className:`text-sm font-mono break-all ${e.status===`removed`?`text-red-700 dark:text-red-300`:e.status===`changed`?`text-white`:`text-bambu-gray`}`,children:m(e.left)})}),(0,Z.jsx)(`td`,{className:`p-3`,children:(0,Z.jsx)(`span`,{className:`text-sm font-mono break-all ${e.status===`added`?`text-green-700 dark:text-green-300`:e.status===`changed`?`text-white`:`text-bambu-gray`}`,children:m(e.right)})})]},e.key)})})]})})]})})})}function Qe({onClose:e,initialData:t,allPresets:n,t:i}){let{showToast:c}=h(),l=a(),u=!!t?.setting_id,[f,p]=(0,Y.useState)(`common`),[g,_]=(0,Y.useState)(t?.type||`filament`),[y,b]=(0,Y.useState)(t?.name?u?t.name:`${t.name} (Copy)`:``),[S,T]=(0,Y.useState)(t?.base_id||``),[E,te]=(0,Y.useState)(``),[O,k]=(0,Y.useState)(t?.setting||{inherits:``}),[P,F]=(0,Y.useState)(JSON.stringify(t?.setting||{inherits:``},null,2)),[I,L]=(0,Y.useState)(null),[R,ne]=(0,Y.useState)(``),[z,re]=(0,Y.useState)(!1),[ie,V]=(0,Y.useState)(``),[ae,oe]=(0,Y.useState)(!1),[W,ce]=(0,Y.useState)(Je),[G,de]=(0,Y.useState)(!1),[K,q]=(0,Y.useState)(``),[fe,J]=(0,Y.useState)(``),[X,me]=(0,Y.useState)(!0),[he,ge]=(0,Y.useState)(null),[_e,ve]=(0,Y.useState)(!1),ye=(0,Y.useMemo)(()=>({filament:n.filament,print:n.process,printer:n.printer})[g]||[],[n,g]),be=(0,Y.useMemo)(()=>ye.filter(e=>Ve(e.setting_id)),[ye]),{data:xe}=o({queryKey:[`cloudFields`,g],queryFn:()=>r.getCloudFields(g===`print`?`process`:g),staleTime:1e3*60*60}),{data:Se}=o({queryKey:[`allPresetDetails`,g,be.map(e=>e.setting_id).join(`,`)],queryFn:async()=>{let e={};for(let t=0;t{try{let t=await r.getCloudSettingDetail(e.setting_id);return{id:e.setting_id,detail:t}}catch{return null}}))).forEach(t=>{t&&(e[t.id]=t.detail)})}return e},enabled:be.length>0,staleTime:1e3*60*10}),{data:Q,isLoading:Ce}=o({queryKey:[`cloudSettingDetail`,S],queryFn:()=>r.getCloudSettingDetail(S),enabled:!!S});(0,Y.useEffect)(()=>{f!==`json`&&F(JSON.stringify(O,null,2))},[O,f]);let we=(0,Y.useMemo)(()=>({filament:n.filament,print:n.process,printer:n.printer}[g]||[]).filter(e=>!Ve(e.setting_id)).sort((e,t)=>e.name.localeCompare(t.name)),[n,g]);(0,Y.useEffect)(()=>{if(!S)return;let e=we.find(e=>e.setting_id===S);e&&(te(e.name),u||(k({inherits:e.name}),F(JSON.stringify({inherits:e.name},null,2))))},[S,we,u]);let Te=(0,Y.useMemo)(()=>{let e=xe?.fields||[],t=new Set(e.map(e=>e.key)),n=new Set,r=new Set([`inherits`,`updated_time`,`compatible_printers`,`compatible_prints`]);Se&&Object.values(Se).forEach(e=>{e?.setting&&Object.keys(e.setting).forEach(e=>{!t.has(e)&&!r.has(e)&&n.add(e)})}),Object.keys(O).forEach(e=>{!t.has(e)&&!r.has(e)&&n.add(e)});let a=Array.from(n).sort().map(e=>({key:e,label:e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase()),type:`text`,category:`discovered`,description:i(`profiles.presets.discoveredFromPresets`)}));return[...e,...a]},[xe,Se,O,i]),Ee=Te.filter(e=>e.label.toLowerCase().includes(R.toLowerCase())||e.key.toLowerCase().includes(R.toLowerCase())),De=()=>{if(ie.trim()){let e=ie.trim().toLowerCase().replace(/\s+/g,`_`);$(e,``),V(``),oe(!1),c(i(`profiles.presets.toast.fieldAdded`,{key:e}))}},$=(e,t)=>{k(n=>{let r={...n};return t===``||t===void 0?delete r[e]:r[e]=t,r})},Oe=e=>{k(t=>({...t,...e.settings})),ge(e.name),c(i(`profiles.templates.toast.applied`))},ke=()=>{if(!K.trim())return;let e={...O};if(delete e.inherits,Object.keys(e).length===0){c(i(`profiles.presets.noOverridesToSave`),`error`);return}let t={id:Date.now().toString(),name:K.trim(),description:fe.trim()||i(`profiles.presets.customTemplate`),type:g,settings:e,showInModal:X},n=[...W,t];ce(n),Ye(n),de(!1),q(``),J(``),me(!0),c(i(`profiles.templates.toast.created`))},Ae=(0,Y.useMemo)(()=>W.filter(e=>e.type===g&&e.showInModal),[g,W]),je=e=>{F(e);try{k(JSON.parse(e)),L(null)}catch(e){L(e.message)}},Me=e=>{e.preventDefault(),re(!1);let t=e.dataTransfer.files[0];if(t&&t.name.endsWith(`.json`)){let e=new FileReader;e.onload=e=>{try{let t=e.target?.result,n=JSON.parse(t),r=n.setting||n;k(e=>({...e,...r})),F(JSON.stringify({...O,...r},null,2)),c(i(`profiles.presets.fileImported`))}catch{c(i(`profiles.presets.invalidJsonFile`),`error`)}},e.readAsText(t)}},Ne=s({mutationFn:()=>{let e={...O},t=g===`filament`?`filament_settings_id`:g===`print`?`print_settings_id`:`printer_settings_id`;e[t]=`"${y}"`;let n={type:g,name:y,base_id:S,setting:e};return r.createCloudSetting(n)},onSuccess:async()=>{c(i(`profiles.presets.toast.created`)),await l.refetchQueries({queryKey:[`cloudSettings`]}),e()},onError:e=>c(e.message,`error`)}),Pe=s({mutationFn:()=>{if(!t?.setting_id)throw Error(i(`profiles.presets.noSettingId`));return r.updateCloudSetting(t.setting_id,{name:y,setting:O})},onSuccess:async()=>{c(i(`profiles.presets.toast.updated`)),l.removeQueries({queryKey:[`cloudSettingDetail`]}),await l.refetchQueries({queryKey:[`cloudSettings`]}),e()},onError:e=>c(e.message,`error`)}),Fe=u?Pe:Ne,Ie=Q?.setting?.inherits,Le=Ie?we.find(e=>e.name===Ie):void 0,{data:Re}=o({queryKey:[`cloudSettingDetail`,Le?.setting_id],queryFn:()=>r.getCloudSettingDetail(Le.setting_id),enabled:!!Le?.setting_id}),ze=(0,Y.useMemo)(()=>{let e=Re?.setting||{},t=Q?.setting||{},n=S&&Se?.[S]?.setting?Se[S].setting:{};return{...e,...t,...n}},[S,Q,Re,Se]),Be=e=>{if(e==null)return``;if(Array.isArray(e)){let t=[...new Set(e.map(e=>String(e)))];return t.length===1?t[0]:e.join(`, `)}return String(e)},He=e=>{let t=O[e.key],n=ze[e.key],r=Be(n),a=Ce?i(`common.loading`):r||``,o=`w-full px-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`;if(e.type===`boolean`){let r=t===`1`||t===void 0&&n===`1`;return(0,Z.jsx)(`button`,{type:`button`,onClick:()=>$(e.key,t===`1`?`0`:`1`),className:`w-8 h-5 rounded-full transition-colors ${r?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,children:(0,Z.jsx)(`div`,{className:`w-4 h-4 rounded-full bg-white shadow transition-transform ${r?`translate-x-3.5`:`translate-x-0.5`}`})})}return e.type===`select`?(0,Z.jsxs)(`select`,{value:t||``,onChange:t=>$(e.key,t.target.value),className:o,children:[(0,Z.jsx)(`option`,{value:``,children:a}),e.options?.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))]}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{type:e.type===`number`?`number`:`text`,value:t===void 0?``:String(t),onChange:t=>$(e.key,t.target.value),step:e.step,min:e.min,max:e.max,placeholder:a,className:o}),e.unit&&(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.unit})]})},Ue=(0,Y.useMemo)(()=>Q?.setting?Q.setting:{},[Q]);return(0,Z.jsxs)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onDragOver:e=>{e.preventDefault(),re(!0)},onDragLeave:()=>re(!1),onDrop:Me,children:[_e&&S&&(0,Z.jsx)(Ze,{onClose:()=>ve(!1),leftPreset:Ue,rightPreset:O,leftLabel:i(`profiles.presets.baseLabel`,{name:E||S}),rightLabel:i(`profiles.presets.currentLabel`,{name:y||i(`profiles.presets.newPreset`)}),t:i}),(0,Z.jsx)(M,{className:`w-full max-w-6xl max-h-[90vh] flex flex-col overflow-y-auto`,children:(0,Z.jsxs)(j,{className:`p-0 flex flex-col h-full`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:i(u?`profiles.presets.editPreset`:t?`profiles.presets.duplicatePreset`:`profiles.presets.createNewPreset`)}),(0,Z.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`profiles.presets.customizeSettings`)})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[S&&(0,Z.jsxs)(`button`,{onClick:()=>ve(!0),className:`flex items-center gap-2 px-3 py-2 text-sm text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,title:i(`profiles.presets.compareWithBase`),children:[(0,Z.jsx)(x,{className:`w-4 h-4`}),i(`profiles.presets.compare`)]}),(0,Z.jsx)(`button`,{onClick:e,className:`p-2 text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,Z.jsx)(A,{className:`w-5 h-5`})})]})]}),z&&(0,Z.jsx)(`div`,{className:`absolute inset-0 bg-bambu-green/10 border-2 border-dashed border-bambu-green rounded-lg flex items-center justify-center z-10`,children:(0,Z.jsxs)(`div`,{className:`text-center`,children:[(0,Z.jsx)(le,{className:`w-12 h-12 text-bambu-green mx-auto mb-2`}),(0,Z.jsx)(`p`,{className:`text-bambu-green font-medium`,children:i(`profiles.presets.dropJsonToImport`)})]})}),(0,Z.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 max-[640px]:grid-cols-1`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`common.type`)}),(0,Z.jsxs)(`select`,{value:g,onChange:e=>{_(e.target.value),T(``)},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:`filament`,children:i(`profiles.presets.types.filament`)}),(0,Z.jsx)(`option`,{value:`print`,children:i(`profiles.presets.types.process`)}),(0,Z.jsx)(`option`,{value:`printer`,children:i(`profiles.presets.types.printer`)})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`profiles.presets.basePreset`)}),(0,Z.jsxs)(`select`,{value:S,onChange:e=>T(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,Z.jsx)(`option`,{value:``,children:i(`profiles.presets.selectBasePreset`)}),we.map(e=>(0,Z.jsx)(`option`,{value:e.setting_id,children:e.name},e.setting_id))]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`profiles.presets.presetName`)}),(0,Z.jsx)(`input`,{type:`text`,value:y,onChange:e=>b(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,placeholder:i(`profiles.presets.myCustomPreset`)})]})]}),E&&(0,Z.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:(0,Z.jsxs)(`p`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(d,{className:`w-3 h-3 text-bambu-green`}),i(`profiles.presets.inheritsFrom`),` `,(0,Z.jsx)(`span`,{className:`text-white`,children:E}),Ce&&(0,Z.jsx)(w,{className:`w-3 h-3 animate-spin ml-1`})]})})]}),(0,Z.jsxs)(`div`,{className:`flex border-b border-bambu-dark-tertiary max-[640px]:flex-wrap max-[640px]:items-center`,children:[(0,Z.jsxs)(`button`,{onClick:()=>p(`common`),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${f===`common`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-white border-transparent`}`,children:[(0,Z.jsx)(pe,{className:`w-4 h-4`}),i(`profiles.presets.tabs.common`)]}),(0,Z.jsxs)(`button`,{onClick:()=>p(`fields`),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${f===`fields`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-white border-transparent`}`,children:[(0,Z.jsx)(C,{className:`w-4 h-4`}),i(`profiles.presets.tabs.allFields`)]}),(0,Z.jsxs)(`button`,{onClick:()=>p(`json`),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${f===`json`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-white border-transparent`}`,children:[(0,Z.jsx)(B,{className:`w-4 h-4`}),`JSON`,I&&(0,Z.jsx)(m,{className:`w-3 h-3 text-red-600 dark:text-red-400`})]}),(0,Z.jsx)(`div`,{className:`flex-1 max-[640px]:hidden`}),(0,Z.jsxs)(`button`,{onClick:()=>{let e=new Blob([JSON.stringify({name:y,type:g,base_id:S,setting:O},null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${y||`preset`}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t),c(i(`profiles.presets.toast.exported`))},className:`flex items-center gap-2 px-4 py-3 text-sm text-bambu-gray hover:text-white transition-colors`,title:i(`profiles.presets.exportToJson`),children:[(0,Z.jsx)(ue,{className:`w-4 h-4`}),i(`common.download`)]}),(0,Z.jsxs)(`button`,{onClick:()=>document.getElementById(`file-import`)?.click(),className:`flex items-center gap-2 px-4 py-3 text-sm text-bambu-gray hover:text-white transition-colors`,title:i(`profiles.presets.importFromJson`),children:[(0,Z.jsx)(le,{className:`w-4 h-4`}),i(`common.upload`)]}),(0,Z.jsx)(`input`,{id:`file-import`,type:`file`,accept:`.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];if(t){let e=new FileReader;e.onload=e=>{try{let t=JSON.parse(e.target?.result),n=t.setting||t;k(e=>({...e,...n})),c(i(`profiles.presets.fileImported`))}catch{c(i(`profiles.presets.invalidJson`),`error`)}},e.readAsText(t)}}})]}),(0,Z.jsxs)(`div`,{className:`flex-1 p-4`,children:[f===`common`&&(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Z.jsxs)(`h3`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[(0,Z.jsx)(D,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),i(`profiles.templates.title`)]}),Object.keys(O).filter(e=>e!==`inherits`).length>0&&(0,Z.jsxs)(`button`,{onClick:()=>de(!G),className:`text-xs text-bambu-gray hover:text-white flex items-center gap-1 transition-colors`,children:[(0,Z.jsx)(U,{className:`w-3 h-3`}),i(`profiles.presets.saveAsTemplate`)]})]}),G&&(0,Z.jsxs)(`div`,{className:`mb-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 mb-2`,children:[(0,Z.jsx)(`input`,{type:`text`,value:K,onChange:e=>q(e.target.value),placeholder:i(`profiles.templates.namePlaceholder`),className:`px-3 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,autoFocus:!0}),(0,Z.jsx)(`input`,{type:`text`,value:fe,onChange:e=>J(e.target.value),placeholder:i(`profiles.templates.descriptionPlaceholder`),className:`px-3 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(N,{size:`sm`,onClick:ke,disabled:!K.trim(),children:[(0,Z.jsx)(U,{className:`w-3 h-3`}),i(`common.save`)]}),(0,Z.jsx)(N,{size:`sm`,variant:`secondary`,onClick:()=>de(!1),children:i(`common.cancel`)})]}),(0,Z.jsxs)(`button`,{onClick:()=>me(!X),className:`flex items-center gap-1.5 text-xs transition-colors ${X?`text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:[X?(0,Z.jsx)(H,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(v,{className:`w-3.5 h-3.5`}),i(X?`profiles.templates.shownInModals`:`profiles.templates.hiddenInModals`)]})]})]}),he&&(0,Z.jsxs)(`div`,{className:`mb-3 px-3 py-2 bg-bambu-green/10 border border-bambu-green/30 rounded-lg flex items-center gap-2`,children:[(0,Z.jsx)(d,{className:`w-4 h-4 text-bambu-green`}),(0,Z.jsxs)(`span`,{className:`text-sm text-bambu-green`,children:[i(`profiles.presets.templateApplied`),` `,(0,Z.jsx)(`span`,{className:`font-medium`,children:he})]}),(0,Z.jsx)(`button`,{onClick:()=>ge(null),className:`ml-auto text-bambu-green/70 hover:text-bambu-green`,children:(0,Z.jsx)(A,{className:`w-4 h-4`})})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[Ae.map(e=>(0,Z.jsxs)(`button`,{onClick:()=>Oe(e),className:`p-3 text-left bg-bambu-dark border border-bambu-dark-tertiary rounded-lg hover:border-bambu-gray-dark transition-colors`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-white`,children:e.name}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e.description})]},e.id)),Ae.length===0&&(0,Z.jsx)(`p`,{className:`col-span-3 text-center text-bambu-gray text-sm py-4`,children:i(`profiles.presets.noTemplatesSelected`)})]}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray-dark mt-2 text-center`,children:i(`profiles.presets.manageTemplatesHint`)})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-white mb-3`,children:i(`profiles.presets.commonSettings`)}),(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-3`,children:Te.slice(0,10).map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 max-[640px]:flex-col max-[640px]:items-start`,children:[(0,Z.jsx)(`label`,{className:`text-sm text-bambu-gray flex-shrink-0`,children:e.label}),(0,Z.jsx)(`div`,{className:`w-48 max-[640px]:w-full`,children:He(e)})]},e.key))})]}),Object.keys(O).length>1&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-white mb-3`,children:i(`profiles.presets.currentOverrides`)}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Object.entries(O).filter(([e])=>e!==`inherits`).map(([e,t])=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 bg-bambu-green/10 text-bambu-green text-xs rounded`,children:[e,`: `,String(t).slice(0,20),(0,Z.jsx)(`button`,{onClick:()=>$(e,void 0),className:`hover:text-white`,children:(0,Z.jsx)(A,{className:`w-3 h-3`})})]},e))})]})]}),f===`fields`&&(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,style:{height:`400px`},children:[(0,Z.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-3 flex-shrink-0`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:i(`profiles.presets.availableFields`)}),(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:Se?i(`profiles.templates.fieldsCount`,{count:Te.length}):i(`common.loading`)})]}),(0,Z.jsxs)(`div`,{className:`relative mb-3 flex-shrink-0`,children:[(0,Z.jsx)(ee,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,value:R,onChange:e=>ne(e.target.value),placeholder:i(`profiles.presets.searchFieldsPlaceholder`),className:`w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`})]}),(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto space-y-1 pr-2 min-h-0`,children:[Ee.filter(e=>!(e.key in O)).map(e=>{let t=ze[e.key],n=Be(t);return(0,Z.jsxs)(`div`,{onClick:()=>{k(t=>({...t,[e.key]:n||``}))},className:`flex items-center justify-between gap-2 p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors cursor-pointer group`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-white truncate`,children:e.label}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray-dark truncate`,children:e.key})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[n&&(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray bg-bambu-dark px-2 py-0.5 rounded max-w-32 truncate`,title:n,children:[n.slice(0,20),n.length>20?`...`:``]}),(0,Z.jsx)(`div`,{className:`w-6 h-6 flex items-center justify-center rounded bg-bambu-dark-tertiary group-hover:bg-bambu-green/20 transition-colors`,children:(0,Z.jsx)(se,{className:`w-4 h-4 text-bambu-gray group-hover:text-bambu-green transition-colors`})})]})]},e.key)}),Ee.filter(e=>!(e.key in O)).length===0&&(0,Z.jsx)(`p`,{className:`text-center text-bambu-gray py-4 text-sm`,children:i(R?`profiles.presets.noMatchingFields`:`profiles.presets.allFieldsAdded`)})]}),(0,Z.jsx)(`div`,{className:`pt-3 mt-3 border-t border-bambu-dark-tertiary flex-shrink-0`,children:ae?(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`input`,{type:`text`,value:ie,onChange:e=>V(e.target.value),onKeyDown:e=>e.key===`Enter`&&De(),placeholder:`custom_field_name`,className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white font-mono text-sm placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`,autoFocus:!0}),(0,Z.jsx)(N,{size:`sm`,onClick:De,disabled:!ie.trim(),children:(0,Z.jsx)(se,{className:`w-4 h-4`})}),(0,Z.jsx)(N,{size:`sm`,variant:`secondary`,onClick:()=>{oe(!1),V(``)},children:(0,Z.jsx)(A,{className:`w-4 h-4`})})]}):(0,Z.jsxs)(`button`,{onClick:()=>oe(!0),className:`w-full flex items-center justify-center gap-2 p-2 text-sm text-bambu-gray hover:text-white border border-dashed border-bambu-dark-tertiary hover:border-bambu-gray-dark rounded-lg transition-colors`,children:[(0,Z.jsx)(se,{className:`w-4 h-4`}),i(`profiles.presets.addCustomField`)]})})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-3 flex-shrink-0`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:i(`profiles.presets.yourOverrides`)}),(0,Z.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:i(`profiles.templates.fieldsCount`,{count:Object.keys(O).filter(e=>e!==`inherits`).length})})]}),(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto space-y-2 pr-2 min-h-0`,children:[Object.entries(O).filter(([e])=>e!==`inherits`).map(([e,t])=>{let n=Te.find(t=>t.key===e);return(0,Z.jsxs)(`div`,{className:`p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-white`,children:n?.label||e}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray-dark`,children:e})]}),(0,Z.jsx)(`button`,{onClick:()=>$(e,void 0),className:`p-1 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors`,children:(0,Z.jsx)(A,{className:`w-4 h-4`})})]}),n?He(n):(0,Z.jsx)(`input`,{type:`text`,value:String(t),onChange:t=>$(e,t.target.value),className:`w-full px-3 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`})]},e)}),Object.keys(O).filter(e=>e!==`inherits`).length===0&&(0,Z.jsxs)(`div`,{className:`text-center py-8 text-bambu-gray`,children:[(0,Z.jsx)(pe,{className:`w-8 h-8 mx-auto mb-2 opacity-50`}),(0,Z.jsx)(`p`,{className:`text-sm`,children:i(`profiles.presets.noOverridesYet`)}),(0,Z.jsx)(`p`,{className:`text-xs mt-1`,children:i(`profiles.presets.clickFieldsToAdd`)})]})]}),Object.keys(O).filter(e=>e!==`inherits`).length>0&&(0,Z.jsx)(`div`,{className:`pt-3 mt-3 border-t border-bambu-dark-tertiary flex-shrink-0`,children:(0,Z.jsxs)(`button`,{onClick:()=>{de(!0),p(`common`)},className:`w-full flex items-center justify-center gap-2 p-2 text-sm text-bambu-gray hover:text-white border border-dashed border-bambu-dark-tertiary hover:border-bambu-gray-dark rounded-lg transition-colors`,children:[(0,Z.jsx)(U,{className:`w-4 h-4`}),i(`profiles.presets.saveAsTemplate`)]})})]})]}),f===`json`&&(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[I&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-red-700 dark:text-red-400 text-sm`,children:[(0,Z.jsx)(m,{className:`w-4 h-4`}),I]}),(0,Z.jsx)(`textarea`,{value:P,onChange:e=>je(e.target.value),className:`w-full h-80 px-3 py-2 bg-bambu-dark border rounded-lg text-white text-xs font-mono focus:outline-none resize-none ${I?`border-red-500 focus:border-red-500`:`border-bambu-dark-tertiary focus:border-bambu-green`}`,spellCheck:!1}),(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`profiles.presets.jsonTip`)})]})]}),(0,Z.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary flex gap-2`,children:[(0,Z.jsx)(N,{variant:`secondary`,onClick:e,className:`flex-1`,children:i(`common.cancel`)}),(0,Z.jsxs)(N,{onClick:()=>Fe.mutate(),disabled:Fe.isPending||!y.trim()||!u&&!S||!!I,className:`flex-1`,children:[Fe.isPending?(0,Z.jsx)(w,{className:`w-4 h-4 animate-spin`}):u?(0,Z.jsx)(U,{className:`w-4 h-4`}):(0,Z.jsx)(se,{className:`w-4 h-4`}),i(u?`common.save`:t?`common.duplicate`:`common.create`)]})]})]})})]})}function $e({settings:e,lastSyncTime:t,onRefresh:n,isRefreshing:i,printers:o,hasPermission:s,t:c}){let[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(`all`),[m,h]=(0,Y.useState)(`all`),[g,v]=(0,Y.useState)(`all`),[b,S]=(0,Y.useState)(`all`),[C,w]=(0,Y.useState)(`all`),[T,E]=(0,Y.useState)(`all`),[O,k]=(0,Y.useState)(null),[A,j]=(0,Y.useState)(!1),[M,F]=(0,Y.useState)(!1),[I,L]=(0,Y.useState)(null),[R,ne]=(0,Y.useState)(null),[z,B]=(0,Y.useState)(null),[V,oe]=(0,Y.useState)(!1),[H,U]=(0,Y.useState)([null,null]),[W,le]=(0,Y.useState)(!1),[G,ue]=(0,Y.useState)(null),de=a(),K=(0,Y.useMemo)(()=>[...e.filament.map(e=>({...e,type:`filament`})),...e.printer.map(e=>({...e,type:`printer`})),...e.process.map(e=>({...e,type:`process`}))].map(e=>({...e,meta:Be(e.name)})),[e]),q=(0,Y.useMemo)(()=>{let e=new Set,t=new Set,n=new Set;return K.forEach(r=>{r.meta.nozzle&&e.add(r.meta.nozzle),r.meta.filamentType&&t.add(r.meta.filamentType),r.meta.layerHeight&&n.add(r.meta.layerHeight)}),{printers:o.map(e=>({id:e.id.toString(),name:e.name})),nozzles:Array.from(e).sort((e,t)=>parseFloat(e)-parseFloat(t)),filaments:Array.from(t).sort(),layerHeights:Array.from(n).sort((e,t)=>parseFloat(e)-parseFloat(t))}},[K,o]),fe=(0,Y.useMemo)(()=>g===`all`?null:o.find(e=>e.id.toString()===g)?.model||null,[g,o]),J=(0,Y.useMemo)(()=>K.filter(e=>f===`all`||e.type===f).filter(e=>{if(m===`all`)return!0;let t=Ve(e.setting_id);return m===`custom`?t:!t}).filter(e=>{if(g===`all`||!fe)return!0;let t=e.meta.printer?.toLowerCase()||``,n=fe.toLowerCase();return t.includes(n)||n.includes(t)}).filter(e=>b===`all`||e.meta.nozzle===b).filter(e=>C===`all`||e.meta.filamentType===C).filter(e=>T===`all`||e.meta.layerHeight===T).filter(e=>u===``||e.name.toLowerCase().includes(u.toLowerCase())).sort((e,t)=>e.name.localeCompare(t.name)),[K,f,m,g,fe,b,C,T,u]),pe=e=>{if(V){let t=H[0]?.setting_id===e.setting_id,n=H[1]?.setting_id===e.setting_id;if(t)U([H[1],null]);else if(n)U([H[0],null]);else if(!H[0])U([e,null]);else if(H[1]){if(H[0].type!==e.type)return;U([H[0],e])}else{if(H[0].type!==e.type)return;U([H[0],e])}}else k(e)},X=e=>{if(H[0]?.setting_id===e.setting_id)return 0;if(H[1]?.setting_id===e.setting_id)return 1},me=async e=>{try{let t=await r.getCloudSettingDetail(e.setting_id);L({type:e.type===`process`?`print`:e.type,name:e.name,base_id:t.base_id||`GFSA00`,setting:t.setting||{}}),k(null)}catch(e){console.error(`Failed to fetch preset details for duplication:`,e)}},he=async e=>{try{de.removeQueries({queryKey:[`cloudSettingDetail`,e.setting_id]});let t=await r.getCloudSettingDetail(e.setting_id);ne({type:e.type===`process`?`print`:e.type,name:e.name,base_id:t.base_id||`GFSA00`,setting:t.setting||{},setting_id:e.setting_id}),k(null)}catch(e){console.error(`Failed to fetch preset details for editing:`,e)}},ge=()=>{p(`all`),h(`all`),v(`all`),S(`all`),w(`all`),E(`all`),d(``)},_e=f!==`all`||m!==`all`||g!==`all`||b!==`all`||C!==`all`||T!==`all`||u!==``,ve=e.filament.length+e.printer.length+e.process.length;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-4 mb-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(ee,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:c(`profiles.cloudView.searchPlaceholder`),className:`w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2 max-[550px]:flex-wrap max-[550px]:items-center`,children:[(0,Z.jsxs)(N,{variant:V?`primary`:`secondary`,onClick:()=>{V?(oe(!1),U([null,null])):oe(!0)},children:[(0,Z.jsx)(x,{className:`w-4 h-4`}),c(V?`common.cancel`:`profiles.presets.compare`)]}),(0,Z.jsxs)(N,{variant:`secondary`,onClick:()=>F(!0),disabled:!s(`cloud:auth`),title:s(`cloud:auth`)?void 0:c(`profiles.cloudView.noTemplatesPermission`),children:[(0,Z.jsx)(D,{className:`w-4 h-4`}),c(`profiles.cloudView.templates`)]}),(0,Z.jsxs)(N,{variant:`secondary`,onClick:n,disabled:i||!s(`cloud:auth`),title:s(`cloud:auth`)?void 0:c(`profiles.cloudView.noRefreshPermission`),children:[(0,Z.jsx)(ie,{className:`w-4 h-4 ${i?`animate-spin`:``}`}),c(`profiles.cloudView.refresh`)]}),(0,Z.jsxs)(N,{onClick:()=>j(!0),disabled:!s(`cloud:auth`),title:s(`cloud:auth`)?void 0:c(`profiles.cloudView.noCreatePermission`),children:[(0,Z.jsx)(se,{className:`w-4 h-4`}),c(`profiles.cloudView.newPreset`)]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(y,{className:`w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(Ue,{label:c(`profiles.cloudView.filters.type`),value:f,options:[{value:`all`,label:c(`profiles.cloudView.filters.all`),count:ve},{value:`filament`,label:c(`profiles.cloudView.filters.filament`),count:e.filament.length},{value:`printer`,label:c(`profiles.cloudView.filters.printer`),count:e.printer.length},{value:`process`,label:c(`profiles.cloudView.filters.process`),count:e.process.length}],onChange:e=>p(e)}),(0,Z.jsx)(Ue,{label:c(`profiles.cloudView.filters.owner`),value:m,options:[{value:`all`,label:c(`profiles.cloudView.filters.all`)},{value:`custom`,label:c(`profiles.cloudView.filters.myPresets`)},{value:`builtin`,label:c(`profiles.cloudView.filters.builtIn`)}],onChange:e=>h(e)}),q.printers.length>0&&(0,Z.jsx)(Ue,{label:c(`profiles.cloudView.filters.printer`),value:g,options:[{value:`all`,label:c(`profiles.cloudView.filters.all`)},...q.printers.map(e=>({value:e.id,label:e.name}))],onChange:v}),q.nozzles.length>0&&(0,Z.jsx)(Ue,{label:c(`profiles.cloudView.filters.nozzle`),value:b,options:[{value:`all`,label:c(`profiles.cloudView.filters.all`)},...q.nozzles.map(e=>({value:e,label:e}))],onChange:S}),q.filaments.length>0&&(f===`all`||f===`filament`)&&(0,Z.jsx)(Ue,{label:c(`profiles.cloudView.filters.filament`),value:C,options:[{value:`all`,label:c(`profiles.cloudView.filters.all`)},...q.filaments.map(e=>({value:e,label:e}))],onChange:w}),q.layerHeights.length>0&&(f===`all`||f===`process`)&&(0,Z.jsx)(Ue,{label:c(`profiles.cloudView.filters.layer`),value:T,options:[{value:`all`,label:c(`profiles.cloudView.filters.all`)},...q.layerHeights.map(e=>({value:e,label:e}))],onChange:E}),_e&&(0,Z.jsx)(`button`,{onClick:ge,className:`px-3 py-2 text-sm text-bambu-gray hover:text-white transition-colors`,children:c(`profiles.cloudView.clearFilters`)})]})]}),V&&(0,Z.jsx)(`div`,{className:`mb-4 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg`,children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Z.jsx)(x,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),(0,Z.jsx)(`span`,{className:`text-white font-medium`,children:c(`profiles.cloudView.compareMode`)}),(0,Z.jsx)(`span`,{className:`text-bambu-gray`,children:H[0]?c(`profiles.cloudView.selectAnotherPreset`,{type:H[0].type}):c(`profiles.cloudView.clickTwoPresets`)})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`px-2 py-1 text-sm rounded truncate max-w-[200px] ${H[0]?`bg-blue-500/30 text-blue-700 dark:text-blue-300`:`bg-bambu-dark text-bambu-gray`}`,children:H[0]?H[0].name:c(`profiles.cloudView.selectFirst`)}),(0,Z.jsx)(l,{className:`w-4 h-4 text-bambu-gray`}),(0,Z.jsx)(`span`,{className:`px-2 py-1 text-sm rounded truncate max-w-[200px] ${H[1]?`bg-blue-500/30 text-blue-700 dark:text-blue-300`:`bg-bambu-dark text-bambu-gray`}`,children:H[1]?H[1].name:c(`profiles.cloudView.selectSecond`)})]}),H[0]&&H[1]&&(0,Z.jsxs)(N,{size:`sm`,onClick:async()=>{try{let[e,t]=await Promise.all([r.getCloudSettingDetail(H[0].setting_id),r.getCloudSettingDetail(H[1].setting_id)]);ue([e.setting||{},t.setting||{}]),le(!0)}catch{}},children:[(0,Z.jsx)(x,{className:`w-4 h-4`}),c(`profiles.cloudView.compareNow`)]})]})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 mb-4 text-sm text-bambu-gray`,children:[t&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(ae,{className:`w-3 h-3`}),c(`profiles.cloudView.lastSynced`),` `,P(t.toISOString(),`system`,c)]}),(0,Z.jsx)(`span`,{children:c(`profiles.cloudView.showingCount`,{showing:J.length,total:ve})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-bambu-green`}),(0,Z.jsxs)(`span`,{children:[`= `,c(`profiles.presets.myPreset`)]})]})]}),J.length===0?(0,Z.jsxs)(`div`,{className:`text-center py-16`,children:[(0,Z.jsx)(ce,{className:`w-12 h-12 text-bambu-gray-dark mx-auto mb-4`}),(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:c(`profiles.cloudView.noPresetsFound`)}),_e&&(0,Z.jsx)(`button`,{onClick:ge,className:`mt-2 text-sm text-bambu-green hover:text-bambu-green-light`,children:c(`profiles.cloudView.clearFilters`)})]}):(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-6`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 px-1`,children:[(0,Z.jsx)(_,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray`,children:c(`profiles.cloudView.columns.filament`)}),(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray-dark`,children:[`(`,J.filter(e=>e.type===`filament`).length,`)`]})]}),(0,Z.jsxs)(`div`,{className:`space-y-1 max-h-[calc(100vh-320px)] overflow-y-auto pr-1`,children:[J.filter(e=>e.type===`filament`).map(e=>(0,Z.jsx)(Ge,{setting:e,onClick:()=>pe(e),onDuplicate:()=>me(e),compareMode:V,isCompareSelected:X(e)!==void 0,compareIndex:X(e),compareDisabled:V&&!!H[0]&&H[0].type!==e.type,t:c},e.setting_id)),J.filter(e=>e.type===`filament`).length===0&&(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray-dark px-3 py-2`,children:c(`profiles.cloudView.noFilamentPresets`)})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 px-1`,children:[(0,Z.jsx)(te,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray`,children:c(`profiles.cloudView.columns.process`)}),(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray-dark`,children:[`(`,J.filter(e=>e.type===`process`).length,`)`]})]}),(0,Z.jsxs)(`div`,{className:`space-y-1 max-h-[calc(100vh-320px)] overflow-y-auto pr-1`,children:[J.filter(e=>e.type===`process`).map(e=>(0,Z.jsx)(Ge,{setting:e,onClick:()=>pe(e),onDuplicate:()=>me(e),compareMode:V,isCompareSelected:X(e)!==void 0,compareIndex:X(e),compareDisabled:V&&!!H[0]&&H[0].type!==e.type,t:c},e.setting_id)),J.filter(e=>e.type===`process`).length===0&&(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray-dark px-3 py-2`,children:c(`profiles.cloudView.noProcessPresets`)})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 px-1`,children:[(0,Z.jsx)(re,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray`,children:c(`profiles.cloudView.columns.printer`)}),(0,Z.jsxs)(`span`,{className:`text-xs text-bambu-gray-dark`,children:[`(`,J.filter(e=>e.type===`printer`).length,`)`]})]}),(0,Z.jsxs)(`div`,{className:`space-y-1 max-h-[calc(100vh-320px)] overflow-y-auto pr-1`,children:[J.filter(e=>e.type===`printer`).map(e=>(0,Z.jsx)(Ge,{setting:e,onClick:()=>pe(e),onDuplicate:()=>me(e),compareMode:V,isCompareSelected:X(e)!==void 0,compareIndex:X(e),compareDisabled:V&&!!H[0]&&H[0].type!==e.type,t:c},e.setting_id)),J.filter(e=>e.type===`printer`).length===0&&(0,Z.jsx)(`p`,{className:`text-xs text-bambu-gray-dark px-3 py-2`,children:c(`profiles.cloudView.noPrinterPresets`)})]})]})]}),O&&(0,Z.jsx)(qe,{setting:O,onClose:()=>k(null),onDeleted:()=>k(null),onDuplicate:()=>me(O),onEdit:()=>he(O),hasPermission:s,t:c}),(A||I||R||z)&&(0,Z.jsx)(Qe,{onClose:()=>{j(!1),L(null),ne(null),B(null)},initialData:R||I||(z?{type:z.type,name:``,base_id:``,setting:z.setting}:void 0),allPresets:e,t:c}),M&&(0,Z.jsx)(Xe,{onClose:()=>F(!1),onApply:e=>{B({type:e.type,setting:e.settings}),F(!1)},t:c}),W&&G&&H[0]&&H[1]&&(0,Z.jsx)(Ze,{onClose:()=>{le(!1),ue(null)},leftPreset:G[0],rightPreset:G[1],leftLabel:H[0].name,rightLabel:H[1].name,t:c})]})}function et(){let{t:e}=i(),t=a(),{showToast:n}=h(),{hasPermission:c}=de(),[l,u]=(0,Y.useState)(`cloud`),[d,f]=(0,Y.useState)(),{data:p,isLoading:m}=o({queryKey:[`cloudStatus`],queryFn:r.getCloudStatus}),{data:g=[]}=o({queryKey:[`printers`],queryFn:r.getPrinters}),{data:_,isLoading:v,refetch:y,dataUpdatedAt:x}=o({queryKey:[`cloudSettings`],queryFn:()=>r.getCloudSettings(),enabled:!!p?.is_authenticated,retry:!1,staleTime:1e3*60*5});(0,Y.useEffect)(()=>{x&&f(new Date(x))},[x]);let C=s({mutationFn:r.cloudLogout,onSuccess:()=>{t.invalidateQueries({queryKey:[`cloudStatus`]}),t.removeQueries({queryKey:[`cloudSettings`]}),n(e(`profiles.toast.loggedOut`))}});return m?(0,Z.jsx)(`div`,{className:`p-4 md:p-8 flex items-center justify-center min-h-[400px]`,children:(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,Z.jsxs)(`div`,{className:`p-4 md:p-8`,children:[(0,Z.jsxs)(`div`,{className:`mb-6`,children:[(0,Z.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,Z.jsx)(z,{className:`w-7 h-7 text-bambu-green`}),e(`profiles.title`)]}),(0,Z.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`profiles.subtitle`)})]}),(0,Z.jsxs)(`div`,{className:`flex border-b border-bambu-dark-tertiary mb-6`,children:[(0,Z.jsxs)(`button`,{onClick:()=>u(`cloud`),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${l===`cloud`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-white border-transparent`}`,children:[(0,Z.jsx)(z,{className:`w-4 h-4`}),e(`profiles.tabs.bambuCloud`)]}),(0,Z.jsxs)(`button`,{onClick:()=>u(`orca_cloud`),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${l===`orca_cloud`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-white border-transparent`}`,children:[(0,Z.jsx)(z,{className:`w-4 h-4`}),e(`profiles.tabs.orcaCloud`)]}),(0,Z.jsxs)(`button`,{onClick:()=>u(`local`),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${l===`local`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-white border-transparent`}`,children:[(0,Z.jsx)(S,{className:`w-4 h-4`}),e(`profiles.tabs.local`)]}),(0,Z.jsxs)(`button`,{onClick:()=>u(`kprofiles`),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${l===`kprofiles`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-white border-transparent`}`,children:[(0,Z.jsx)(b,{className:`w-4 h-4`}),e(`profiles.tabs.kprofiles`)]})]}),l===`cloud`&&(0,Z.jsxs)(Z.Fragment,{children:[p?.is_authenticated&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between p-3 mb-6 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-bambu-green animate-pulse`}),(0,Z.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[e(`profiles.connectedAs`),` `,(0,Z.jsx)(`span`,{className:`text-white`,children:p.email}),p.region&&(0,Z.jsx)(`span`,{className:`ml-2 px-2 py-0.5 text-xs rounded bg-bambu-dark-tertiary text-bambu-gray`,children:p.region===`china`?e(`profiles.login.regionChina`):e(`profiles.login.regionGlobal`)})]})]}),(0,Z.jsxs)(N,{variant:`secondary`,size:`sm`,onClick:()=>C.mutate(),disabled:C.isPending||!c(`cloud:auth`),title:c(`cloud:auth`)?void 0:e(`profiles.noLogoutPermission`),children:[(0,Z.jsx)(W,{className:`w-4 h-4`}),e(`profiles.logout`)]})]}),p?.sign_in_expired&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 p-3 mb-6 rounded-lg border border-yellow-500/40 bg-yellow-500/10`,children:[(0,Z.jsx)(k,{className:`w-5 h-5 shrink-0 text-yellow-400 mt-0.5`}),(0,Z.jsxs)(`div`,{className:`text-sm`,children:[(0,Z.jsx)(`p`,{className:`text-white font-medium`,children:e(`profiles.signInExpiredTitle`)}),(0,Z.jsx)(`p`,{className:`text-bambu-gray`,children:e(`profiles.signInExpiredBody`)})]})]}),p?.is_authenticated?v?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,Z.jsx)(w,{className:`w-8 h-8 text-bambu-green animate-spin`})}):_?(0,Z.jsx)($e,{settings:_,lastSyncTime:d,onRefresh:()=>y(),isRefreshing:v,printers:g,hasPermission:c,t:e}):(0,Z.jsxs)(`div`,{className:`text-center py-16`,children:[(0,Z.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`profiles.failedToLoad`)}),(0,Z.jsx)(N,{onClick:()=>y(),children:e(`profiles.retry`)})]}):(0,Z.jsx)(He,{onSuccess:()=>{t.invalidateQueries({queryKey:[`cloudStatus`]})},t:e})]}),l===`orca_cloud`&&(0,Z.jsx)(Re,{}),l===`local`&&(0,Z.jsx)(Me,{}),l===`kprofiles`&&(0,Z.jsx)(De,{}),(0,Z.jsx)(We,{})]})}export{Ue as FilterDropdown,He as LoginForm,et as ProfilesPage}; \ No newline at end of file diff --git a/static/assets/ProjectDetailPage-x9_vyzmk.js b/static/assets/ProjectDetailPage-x9_vyzmk.js new file mode 100644 index 000000000..5b4f88216 --- /dev/null +++ b/static/assets/ProjectDetailPage-x9_vyzmk.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{t as ee}from"./arrow-left-0Q6F2rjC.js";import{t as te}from"./RichTextEditor-CuGcRbGW.js";import{t as ne}from"./calendar-BLKPnWqV.js";import{n as re}from"./info-ROUoQhJR.js";import{n as ie,r as c}from"./ToastContext-BRX0SW3C.js";import{t as ae}from"./copy-Cu_0GKCU.js";import{t as oe}from"./file-box-04V4jZ9_.js";import{t as se}from"./history-B4lOLL01.js";import{t as l}from"./loader-circle-BEmFtawu.js";import{t as u}from"./package-BGUevlqS.js";import{t as ce}from"./pen-line-BWR04BX-.js";import{t as d}from"./triangle-alert-Dt_1FcBy.js";import{t as le}from"./x-DR-Trv6U.js";import{n as f,t as p}from"./Card-Bzc64K35.js";import{t as m}from"./Button-DDr6eAFy.js";import{a as ue,i as de,s as fe,v as h}from"./date-G9KUauqz.js";import{$t as pe,At as me,Cn as he,Jt as g,Mn as ge,N as _e,On as ve,Pt as ye,Rn as _,Un as be,Ut as xe,Vn as Se,Zt as Ce,_t as we,at as Te,b as Ee,cn as De,vn as Oe,wn as ke,xn as Ae,yt as je,zt as Me}from"./index-CovRLYqQ.js";import{t as Ne}from"./purify.es-F_7NWVtX.js";import{n as Pe}from"./libraryFiles-B0B1SFfn.js";import{ProjectModal as Fe,n as v,t as Ie}from"./ProjectsPage-thNs0J44.js";var y=e(n(),1),b=t();function x(e){return e>=1e3?`${(e/1e3).toFixed(2)}kg`:`${Math.round(e)}g`}function Le({status:e,t}){let n={active:`bg-bambu-green/20 text-bambu-green`,completed:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,archived:`bg-bambu-gray/20 text-bambu-gray`},r=n[e]||n.active,i={active:t(`projectDetail.status.active`),completed:t(`projectDetail.status.completed`),archived:t(`projectDetail.status.archived`)};return(0,b.jsx)(`span`,{className:`px-2 py-1 rounded text-sm font-medium ${r}`,children:i[e]||e.charAt(0).toUpperCase()+e.slice(1)})}function Re({icon:e,label:t,value:n,subValue:r,hint:i,color:a=`text-bambu-gray`}){return(0,b.jsx)(p,{children:(0,b.jsx)(f,{className:`p-4`,children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,title:i,children:[(0,b.jsx)(`div`,{className:`p-2 rounded-lg bg-bambu-dark ${a}`,children:(0,b.jsx)(e,{className:`w-5 h-5`})}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t}),(0,b.jsx)(`p`,{className:`text-xl font-semibold text-white`,children:n}),r&&(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray/70`,children:r})]})]})})})}function ze({archives:e,t}){return e.length===0?(0,b.jsxs)(`div`,{className:`text-center py-8 text-bambu-gray`,children:[(0,b.jsx)(u,{className:`w-12 h-12 mx-auto mb-2 opacity-50`}),(0,b.jsx)(`p`,{children:t(`projectDetail.noPrints`)})]}):(0,b.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3`,children:e.map(e=>(0,b.jsxs)(_,{to:`/archives?search=${encodeURIComponent(e.print_name||``)}`,className:`group relative aspect-square rounded-lg bg-bambu-dark border border-bambu-dark-tertiary overflow-hidden hover:border-bambu-green transition-colors`,children:[e.thumbnail_path?(0,b.jsx)(`img`,{src:r.getArchiveThumbnail(e.id),alt:e.print_name||`Print`,className:`w-full h-full object-cover`}):(0,b.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-bambu-gray`,children:(0,b.jsx)(u,{className:`w-8 h-8`})}),e.status===`failed`&&(0,b.jsx)(`div`,{className:`absolute inset-0 bg-red-500/30 flex items-center justify-center`,children:(0,b.jsx)(re,{className:`w-8 h-8 text-white`})}),e.status===`completed`&&(0,b.jsx)(`div`,{className:`absolute top-1 right-1`,children:(0,b.jsx)(c,{className:`w-4 h-4 text-bambu-green`})}),(0,b.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 to-transparent p-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,b.jsx)(`p`,{className:`text-xs text-white truncate`,children:e.print_name||`Unknown`})})]},e.id))})}function Be({priority:e,t}){let n={low:{color:`bg-gray-500/20 text-gray-400`,label:t(`projectDetail.priority.low`)},normal:{color:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,label:t(`projectDetail.priority.normal`)},high:{color:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`,label:t(`projectDetail.priority.high`)},urgent:{color:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`,label:t(`projectDetail.priority.urgent`)}},{color:r,label:i}=n[e]||n.normal;return(0,b.jsxs)(`span`,{className:`px-2 py-1 rounded text-xs font-medium flex items-center gap-1 ${r}`,children:[e===`urgent`&&(0,b.jsx)(d,{className:`w-3 h-3`}),i]})}function S(e,t){if(!e)return null;let n=h(e);if(!n)return null;let r=new Date,i=Math.ceil((n.getTime()-r.getTime())/(1e3*60*60*24));return i<0?{color:`text-red-700 dark:text-red-400`,label:t(`projectDetail.dueDate.overdue`)}:i===0?{color:`text-orange-700 dark:text-orange-400`,label:t(`projectDetail.dueDate.today`)}:i<=3?{color:`text-yellow-700 dark:text-yellow-400`,label:t(`projectDetail.dueDate.daysLeft`,{count:i})}:{color:`text-bambu-gray`,label:t(`projectDetail.dueDate.daysLeft`,{count:i})}}function C(){let{id:e}=be(),t=Se(),{t:n}=i(),d=a(),{showToast:h}=ie(),{hasPermission:C}=je(),[Ve,w]=(0,y.useState)(!1),[He,T]=(0,y.useState)(!1),[Ue,E]=(0,y.useState)(``),[D,O]=(0,y.useState)(null),k=parseInt(e||`0`,10),{data:A,isLoading:We,error:j}=o({queryKey:[`project`,k],queryFn:()=>r.getProject(k),enabled:k>0}),{data:Ge,isLoading:Ke}=o({queryKey:[`project-archives`,k],queryFn:()=>r.getProjectArchives(k),enabled:k>0}),{data:M,isLoading:qe}=o({queryKey:[`project-bom`,k],queryFn:()=>r.getProjectBOM(k),enabled:k>0}),{data:N,isLoading:Je}=o({queryKey:[`project-timeline`,k],queryFn:()=>r.getProjectTimeline(k,20),enabled:k>0}),{data:Ye}=o({queryKey:[`settings`],queryFn:r.getSettings}),{data:P}=o({queryKey:[`project-folders`,k],queryFn:()=>r.getLibraryFoldersByProject(k),enabled:k>0}),{data:F,isLoading:Xe}=o({queryKey:[`project-files`,k],queryFn:()=>r.getLibraryFiles(null,!1,k),enabled:k>0}),Ze=(0,y.useMemo)(()=>{let e=new Map;for(let t of F??[])if(t.folder_id!=null){let n=e.get(t.folder_id)??[];n.push(t),e.set(t.folder_id,n)}return e},[F]),{data:Qe}=o({queryKey:[`project-file-progress`,k],queryFn:()=>r.getProjectFileProgress(k),enabled:k>0}),I=(0,y.useMemo)(()=>{let e=new Map;for(let t of Qe??[])e.set(t.file_id,t.completed_count);return e},[Qe]),L=(0,y.useMemo)(()=>{let e=A?.target_sets;if(!e||!F)return null;let t=F.filter(e=>Pe(e));return t.length===0?null:Math.min(...t.map(t=>Math.min(I.get(t.id)??0,e)))},[A?.target_sets,F,I]),R=Te(Ye?.currency||`USD`),$e=Ye?.time_format||`system`,z=s({mutationFn:e=>r.updateProject(k,e),onSuccess:()=>{d.invalidateQueries({queryKey:[`project`,k]}),d.invalidateQueries({queryKey:[`projects`]}),w(!1),T(!1),h(n(`projectDetail.toast.projectUpdated`),`success`)},onError:e=>{h(e.message,`error`)}}),et=()=>{E(A?.notes||``),T(!0)},tt=()=>{z.mutate({notes:Ue})},nt=()=>{T(!1),E(``)},[B,rt]=(0,y.useState)(``),[it,at]=(0,y.useState)(1),[V,ot]=(0,y.useState)(``),[st,ct]=(0,y.useState)(``),[lt,ut]=(0,y.useState)(``),[dt,H]=(0,y.useState)(!1),[U,ft]=(0,y.useState)(!1),[W,G]=(0,y.useState)(null),[K,pt]=(0,y.useState)(``),[mt,ht]=(0,y.useState)(1),[q,gt]=(0,y.useState)(``),[_t,vt]=(0,y.useState)(``),[yt,bt]=(0,y.useState)(``),[J,Y]=(0,y.useState)({isOpen:!1,title:``,message:``,onConfirm:()=>{}}),X=s({mutationFn:e=>r.createBOMItem(k,e),onSuccess:()=>{d.invalidateQueries({queryKey:[`project-bom`,k]}),d.invalidateQueries({queryKey:[`project`,k]}),rt(``),at(1),ot(``),ct(``),ut(``),H(!1),h(n(`projectDetail.toast.partAdded`),`success`)},onError:e=>h(e.message,`error`)}),Z=s({mutationFn:({itemId:e,data:t})=>r.updateBOMItem(k,e,t),onSuccess:()=>{d.invalidateQueries({queryKey:[`project-bom`,k]}),d.invalidateQueries({queryKey:[`project`,k]}),G(null)},onError:e=>h(e.message,`error`)}),xt=s({mutationFn:e=>r.deleteBOMItem(k,e),onSuccess:()=>{d.invalidateQueries({queryKey:[`project-bom`,k]}),d.invalidateQueries({queryKey:[`project`,k]}),h(n(`projectDetail.toast.partRemoved`),`success`)},onError:e=>h(e.message,`error`)}),St=e=>{e.preventDefault(),B.trim()&&X.mutate({name:B.trim(),quantity_needed:it,unit_price:V?parseFloat(V):void 0,sourcing_url:st.trim()||void 0,remarks:lt.trim()||void 0})},Ct=e=>{let t=e.is_complete?0:e.quantity_needed;Z.mutate({itemId:e.id,data:{quantity_acquired:t}})},wt=(e,t)=>{Y({isOpen:!0,title:n(`projectDetail.bom.deletePart`),message:n(`projectDetail.bom.deleteConfirm`,{name:t}),onConfirm:()=>{Y(e=>({...e,isOpen:!1})),xt.mutate(e)}})},Tt=e=>{G(e),pt(e.name),ht(e.quantity_needed),gt(e.unit_price?.toString()||``),vt(e.sourcing_url||``),bt(e.remarks||``)},Et=e=>{e.preventDefault(),!(!W||!K.trim())&&Z.mutate({itemId:W.id,data:{name:K.trim(),quantity_needed:mt,unit_price:q?parseFloat(q):void 0,sourcing_url:_t.trim()||void 0,remarks:yt.trim()||void 0}})},Dt=()=>{G(null)},Ot=async()=>{try{let{blob:e,filename:t}=await r.exportProjectZip(Number(k)),i=URL.createObjectURL(e),a=document.createElement(`a`);a.href=i,a.download=t||`${A?.name||`project`}_${new Date().toISOString().split(`T`)[0]}.zip`,a.click(),URL.revokeObjectURL(i),h(n(`projectDetail.toast.projectExported`),`success`)}catch(e){h(e.message,`error`)}},kt=s({mutationFn:()=>r.createTemplateFromProject(k),onSuccess:()=>{d.invalidateQueries({queryKey:[`projects`]}),h(n(`projectDetail.toast.templateCreated`),`success`)},onError:e=>h(e.message,`error`)}),At=e=>ue(e,$e,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`});if(We)return(0,b.jsx)(`div`,{className:`flex items-center justify-center py-24`,children:(0,b.jsx)(l,{className:`w-8 h-8 animate-spin text-bambu-green`})});if(j||!A)return(0,b.jsxs)(`div`,{className:`text-center py-24`,children:[(0,b.jsx)(`p`,{className:`text-bambu-gray`,children:j?`${n(`common.error`)}: ${j.message}`:n(`projectDetail.notFound`)}),(0,b.jsx)(m,{variant:`secondary`,className:`mt-4`,onClick:()=>t(`/projects`),children:n(`projectDetail.backToProjects`)})]});let Q=A.stats,jt=Q?.progress_percent??0,$=Q?.parts_progress_percent??0;return(0,b.jsxs)(`div`,{className:`p-4 md:p-8 space-y-8`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,b.jsx)(_,{to:`/projects`,className:`hover:text-white transition-colors`,children:n(`nav.projects`)}),(0,b.jsx)(ge,{className:`w-4 h-4`}),(0,b.jsx)(`span`,{className:`text-white`,children:A.name})]}),(0,b.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,b.jsx)(`button`,{onClick:()=>t(`/projects`),className:`p-2 rounded-lg bg-bambu-card hover:bg-bambu-dark-tertiary transition-colors`,children:(0,b.jsx)(ee,{className:`w-5 h-5 text-bambu-gray`})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(`div`,{className:`w-4 h-4 rounded-full shrink-0`,style:{backgroundColor:A.color||`#6b7280`}}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:A.name}),A.description&&(0,b.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:A.description})]})]}),(0,b.jsx)(Le,{status:A.status,t:n})]}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsxs)(m,{variant:`secondary`,onClick:Ot,disabled:!C(`projects:read`),title:C(`projects:read`)?n(`projectDetail.exportProject`):n(`projectDetail.noExportPermission`),children:[(0,b.jsx)(ke,{className:`w-4 h-4 mr-2`}),n(`projectDetail.export`)]}),(0,b.jsxs)(m,{onClick:()=>w(!0),disabled:!C(`projects:update`),title:C(`projects:update`)?void 0:n(`projectDetail.noEditPermission`),children:[(0,b.jsx)(ce,{className:`w-4 h-4 mr-2`}),n(`common.edit`)]})]})]}),(A.target_count||A.target_parts_count||A.target_sets)&&(0,b.jsx)(p,{children:(0,b.jsxs)(f,{className:`p-4 space-y-4`,children:[A.target_count&&(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,b.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:n(`projectDetail.progress.platesProgress`)}),(0,b.jsxs)(`span`,{className:`text-sm font-medium text-white`,children:[Q?.total_archives||0,` / `,A.target_count,` `,n(`projectDetail.progress.printJobs`)]})]}),(0,b.jsx)(`div`,{className:`h-3 bg-bambu-dark rounded-full overflow-hidden`,children:(0,b.jsx)(`div`,{className:`h-full transition-all duration-500`,style:{width:`${Math.min(jt,100)}%`,backgroundColor:jt>=100?`#22c55e`:A.color||`#6b7280`}})}),(0,b.jsxs)(`div`,{className:`flex justify-between mt-1`,children:[(0,b.jsx)(`span`,{className:`text-xs text-bambu-gray/70`,children:n(`projectDetail.progress.percentComplete`,{percent:jt.toFixed(0)})}),Q?.remaining_prints!=null&&Q.remaining_prints>0&&(0,b.jsx)(`span`,{className:`text-xs text-bambu-gray/70`,children:n(`projectDetail.progress.remaining`,{count:Q.remaining_prints})})]})]}),A.target_parts_count&&(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,b.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:n(`projectDetail.progress.partsProgress`)}),(0,b.jsxs)(`span`,{className:`text-sm font-medium text-white`,children:[Q?.completed_prints||0,` / `,A.target_parts_count,` `,n(`projectDetail.progress.parts`)]})]}),(0,b.jsx)(`div`,{className:`h-3 bg-bambu-dark rounded-full overflow-hidden`,children:(0,b.jsx)(`div`,{className:`h-full transition-all duration-500`,style:{width:`${Math.min($,100)}%`,backgroundColor:$>=100?`#22c55e`:A.color||`#6b7280`}})}),(0,b.jsxs)(`div`,{className:`flex justify-between mt-1`,children:[(0,b.jsx)(`span`,{className:`text-xs text-bambu-gray/70`,children:n(`projectDetail.progress.percentComplete`,{percent:$.toFixed(0)})}),Q?.remaining_parts!=null&&Q.remaining_parts>0&&(0,b.jsx)(`span`,{className:`text-xs text-bambu-gray/70`,children:n(`projectDetail.progress.remaining`,{count:Q.remaining_parts})})]})]}),A.target_sets?(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,b.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:n(`projectDetail.progress.setsProgress`)}),(0,b.jsxs)(`span`,{className:`text-sm font-medium text-white`,children:[L??0,` / `,A.target_sets,` `,n(`projectDetail.progress.sets`)]})]}),(0,b.jsx)(`div`,{className:`h-3 bg-bambu-dark rounded-full overflow-hidden`,children:(0,b.jsx)(`div`,{className:`h-full transition-all duration-500`,style:{width:`${Math.min((L??0)/A.target_sets*100,100)}%`,backgroundColor:(L??0)>=A.target_sets?`#22c55e`:A.color||`#6b7280`}})}),(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1`,children:n(`projectDetail.progress.setsHint`)})]}):null]})}),Q&&(0,b.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,b.jsx)(p,{children:(0,b.jsx)(f,{className:`p-4`,children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(`div`,{className:`p-2 rounded-lg bg-bambu-dark text-bambu-green`,children:(0,b.jsx)(u,{className:`w-5 h-5`})}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`projectDetail.stats.printJobs`)}),(0,b.jsxs)(`p`,{className:`text-xl font-semibold text-white`,children:[Q.total_archives,` `,(0,b.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray`,children:n(`projectDetail.stats.total`)})]}),Q.failed_prints>0&&(0,b.jsx)(`p`,{className:`text-sm text-status-error`,children:n(`projectDetail.stats.failed`,{count:Q.failed_prints})}),(0,b.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`projectDetail.stats.partsPrinted`,{count:Q.completed_prints})})]})]})})}),(0,b.jsx)(Re,{icon:ve,label:n(`projectDetail.stats.printTime`),value:fe(Q.total_print_time_hours),color:`text-yellow-600 dark:text-yellow-400`}),(0,b.jsx)(Re,{icon:g,label:n(`projectDetail.stats.filamentUsed`),value:x(Q.total_filament_grams),color:`text-purple-600 dark:text-purple-400`})]}),A.rollup_stats&&(0,b.jsx)(p,{children:(0,b.jsxs)(f,{className:`p-4`,children:[(0,b.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2 mb-3`,children:[(0,b.jsx)(v,{className:`w-5 h-5`}),n(`projectDetail.rollup.title`,{count:A.descendant_count})]}),(0,b.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.stats.printJobs`)}),(0,b.jsx)(`p`,{className:`text-lg font-semibold text-white`,children:A.rollup_stats.total_archives}),(0,b.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`projectDetail.stats.partsPrinted`,{count:A.rollup_stats.completed_prints})})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.stats.printTime`)}),(0,b.jsx)(`p`,{className:`text-lg font-semibold text-white`,children:fe(A.rollup_stats.total_print_time_hours)})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.stats.filamentUsed`)}),(0,b.jsx)(`p`,{className:`text-lg font-semibold text-white`,children:x(A.rollup_stats.total_filament_grams)})]}),(()=>{let e=A.rollup_stats.estimated_cost+A.rollup_stats.total_energy_cost+(A.rollup_stats.total_wear_cost??0)+A.rollup_stats.bom_cost;return e<=0?null:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.cost.totalCost`)}),(0,b.jsxs)(`p`,{className:`text-lg font-semibold text-bambu-green`,children:[R,e.toFixed(2)]})]})})()]}),A.rollup_stats.progress_percent!==null&&(0,b.jsxs)(`div`,{className:`mt-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,b.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:n(`projectDetail.rollup.progress`)}),(0,b.jsx)(`span`,{className:`text-sm font-medium text-white`,children:n(`projectDetail.rollup.percentComplete`,{percent:A.rollup_stats.progress_percent.toFixed(0)})})]}),(0,b.jsx)(`div`,{className:`h-3 bg-bambu-dark rounded-full overflow-hidden`,children:(0,b.jsx)(`div`,{className:`h-full transition-all duration-500`,style:{width:`${Math.min(A.rollup_stats.progress_percent,100)}%`,backgroundColor:A.rollup_stats.progress_percent>=100?`#22c55e`:A.color||`#6b7280`}})})]})]})}),Q&&(()=>{let e=Q.estimated_cost+Q.total_energy_cost+(Q.total_wear_cost??0)+Q.bom_cost;return Q.estimated_cost>0||e>0||A.budget!==null})()&&(0,b.jsx)(p,{children:(0,b.jsxs)(f,{className:`p-4`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold text-white mb-3`,children:n(`projectDetail.cost.title`)}),(0,b.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.cost.filamentCost`)}),(0,b.jsxs)(`p`,{className:`text-lg font-semibold text-white`,children:[R,Q.estimated_cost.toFixed(2)]})]}),Q.total_energy_kwh>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.cost.energy`)}),(0,b.jsxs)(`p`,{className:`text-lg font-semibold text-white`,children:[Q.total_energy_kwh.toFixed(3),` kWh`,Q.total_energy_cost>0&&(0,b.jsxs)(`span`,{className:`text-sm text-bambu-gray ml-1`,children:[`(`,R,Q.total_energy_cost.toFixed(2),`)`]})]})]}),(Q.total_wear_cost??0)>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.cost.wear`)}),(0,b.jsxs)(`p`,{className:`text-lg font-semibold text-white`,children:[R,Q.total_wear_cost.toFixed(2)]})]}),(()=>{let e=Q.estimated_cost+Q.total_energy_cost+(Q.total_wear_cost??0)+Q.bom_cost;return e<=0?null:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.cost.totalCost`)}),(0,b.jsxs)(`p`,{className:`text-lg font-semibold text-bambu-green`,children:[R,e.toFixed(2)]}),Q.bom_cost>0&&(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray/70`,children:n(`projectDetail.cost.includesBom`)})]})})(),A.budget!==null&&(()=>{let e=Q.estimated_cost+Q.total_energy_cost+(Q.total_wear_cost??0)+Q.bom_cost,t=A.budget-e;return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.cost.budget`)}),(0,b.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[n(`projectDetail.cost.total`),`: `,(0,b.jsxs)(`span`,{className:`text-white font-semibold`,children:[R,A.budget.toFixed(2)]})]}),(0,b.jsxs)(`p`,{className:`text-sm ${t>=0?`text-bambu-green`:`text-red-700 dark:text-red-400`}`,children:[n(`projectDetail.cost.remaining`),`: `,(0,b.jsxs)(`span`,{className:`font-semibold`,children:[R,t.toFixed(2)]})]})]})})()]})]})}),A.children&&A.children.length>0&&(0,b.jsx)(p,{children:(0,b.jsxs)(f,{className:`p-4`,children:[(0,b.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2 mb-3`,children:[(0,b.jsx)(v,{className:`w-5 h-5`}),n(`projectDetail.subProjects.title`,{count:A.children.length})]}),(0,b.jsx)(`div`,{className:`space-y-2`,children:A.children.map(e=>(0,b.jsxs)(_,{to:`/projects/${e.id}`,className:`flex items-center justify-between gap-4 p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,b.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:e.color||`#6b7280`}}),(0,b.jsx)(`span`,{className:`text-white truncate`,children:e.name}),(0,b.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded flex-shrink-0 ${e.status===`completed`?`bg-status-ok/20 text-status-ok`:e.status===`archived`?`bg-bambu-gray/20 text-bambu-gray`:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`}`,children:e.status}),e.descendant_count>0&&(0,b.jsxs)(`span`,{className:`text-xs text-bambu-gray flex-shrink-0 inline-flex items-center gap-1`,children:[(0,b.jsx)(v,{className:`w-3 h-3`}),e.descendant_count]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-bambu-gray flex-shrink-0`,children:[e.total_archives>0&&(0,b.jsx)(`span`,{className:`hidden sm:inline`,children:n(`projectDetail.subProjects.jobs`,{count:e.total_archives})}),e.total_filament_grams>0&&(0,b.jsx)(`span`,{className:`hidden md:inline`,children:x(e.total_filament_grams)}),e.total_cost>0&&(0,b.jsxs)(`span`,{className:`hidden md:inline`,children:[R,e.total_cost.toFixed(2)]}),e.progress_percent!==null&&(0,b.jsxs)(`span`,{children:[e.progress_percent.toFixed(0),`%`]})]})]},e.id))})]})}),A.parent_id&&A.parent_name&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(De,{className:`w-4 h-4 text-bambu-gray`}),(0,b.jsx)(`span`,{className:`text-bambu-gray`,children:n(`projectDetail.partOf`)}),(0,b.jsx)(_,{to:`/projects/${A.parent_id}`,className:`text-bambu-green hover:underline`,children:A.parent_name})]}),(A.tags||A.due_date||A.priority!==`normal`)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[A.priority&&A.priority!==`normal`&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-bambu-gray uppercase`,children:n(`projectDetail.priorityLabel`)}),(0,b.jsx)(Be,{priority:A.priority,t:n})]}),A.due_date&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(ne,{className:`w-4 h-4 text-bambu-gray`}),(0,b.jsx)(`span`,{className:`text-sm text-white`,children:de(A.due_date,{year:`numeric`,month:`short`,day:`numeric`})}),S(A.due_date,n)&&(0,b.jsxs)(`span`,{className:`text-xs ${S(A.due_date,n).color}`,children:[`(`,S(A.due_date,n).label,`)`]})]}),A.tags&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(ye,{className:`w-4 h-4 text-bambu-gray`}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:A.tags.split(`,`).map((e,t)=>(0,b.jsx)(`span`,{className:`px-2 py-0.5 bg-bambu-dark-tertiary text-bambu-gray text-xs rounded`,children:e.trim()},t))})]})]}),(0,b.jsx)(p,{children:(0,b.jsxs)(f,{className:`p-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,b.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,b.jsx)(Ae,{className:`w-5 h-5`}),n(`projectDetail.notes.title`)]}),He?(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsxs)(m,{variant:`secondary`,size:`sm`,onClick:nt,disabled:z.isPending,children:[(0,b.jsx)(le,{className:`w-4 h-4 mr-1`}),n(`common.cancel`)]}),(0,b.jsxs)(m,{size:`sm`,onClick:tt,disabled:z.isPending,children:[z.isPending?(0,b.jsx)(l,{className:`w-4 h-4 animate-spin mr-1`}):(0,b.jsx)(xe,{className:`w-4 h-4 mr-1`}),n(`common.save`)]})]}):(0,b.jsxs)(m,{variant:`secondary`,size:`sm`,onClick:et,disabled:!C(`projects:update`),title:C(`projects:update`)?void 0:n(`projectDetail.notes.noEditPermission`),children:[(0,b.jsx)(ce,{className:`w-4 h-4 mr-1`}),n(`common.edit`)]})]}),He?(0,b.jsx)(te,{content:Ue,onChange:E,placeholder:n(`projectDetail.notes.placeholder`)}):A.notes?(0,b.jsx)(`div`,{className:`prose prose-invert prose-sm max-w-none`,dangerouslySetInnerHTML:{__html:Ne.sanitize(A.notes)}}):(0,b.jsx)(`p`,{className:`text-bambu-gray/70 text-sm italic`,children:n(`projectDetail.notes.empty`)})]})}),(0,b.jsx)(p,{children:(0,b.jsxs)(f,{className:`p-4`,children:[(0,b.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,b.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,b.jsx)(Oe,{className:`w-5 h-5`}),n(`projectDetail.files.title`)]})}),(0,b.jsxs)(`p`,{className:`text-xs text-bambu-gray mb-3`,children:[(0,b.jsx)(_,{to:`/files`,className:`text-bambu-green hover:underline`,children:n(`projectDetail.files.linkFolders`)}),` `,n(`projectDetail.files.forQuickAccess`)]}),P&&P.length>0?(0,b.jsx)(`div`,{className:`space-y-4`,children:P.map(e=>{let t=Ze.get(e.id)??[],i=Xe;return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(_,{to:`/files?folder=${e.id}`,className:`flex items-center justify-between p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors mb-2`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,b.jsx)(Oe,{className:`w-5 h-5 text-bambu-green shrink-0`}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm text-white truncate`,children:e.name}),(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`projectDetail.files.fileCount`,{count:e.file_count})})]})]}),(0,b.jsx)(ge,{className:`w-4 h-4 text-bambu-gray shrink-0`})]}),i?(0,b.jsx)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-bambu-gray text-sm`,children:(0,b.jsx)(l,{className:`w-4 h-4 animate-spin`})}):t.length===0?(0,b.jsx)(`p`,{className:`text-bambu-gray/60 text-xs italic px-3`,children:n(`projectDetail.files.noFiles`)}):(0,b.jsx)(`div`,{className:`space-y-1 pl-3`,children:t.map(e=>{let t=Pe(e);return(0,b.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors`,children:[(0,b.jsx)(`div`,{className:`w-10 h-10 shrink-0 rounded bg-bambu-dark overflow-hidden flex items-center justify-center`,children:e.thumbnail_path?(0,b.jsx)(`img`,{src:r.getLibraryFileThumbnailUrl(e.id),alt:e.print_name||e.filename,className:`w-full h-full object-cover`}):(0,b.jsx)(oe,{className:`w-5 h-5 text-bambu-gray/40`})}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm text-white truncate`,title:e.print_name||e.filename,children:e.print_name||e.filename}),(0,b.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded font-medium ${e.file_type===`3mf`?`bg-bambu-green/20 text-bambu-green`:e.file_type===`gcode`||e.file_type===`gcode.3mf`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:`bg-bambu-gray/20 text-bambu-gray`}`,children:e.file_type.toUpperCase()})]}),t&&(()=>{let t=I.get(e.id)??0,r=A.target_sets;if(!r)return t>0?(0,b.jsxs)(`span`,{className:`shrink-0 text-xs px-1.5 py-0.5 rounded-full bg-bambu-dark text-bambu-gray`,title:n(`projectDetail.files.printedCount`,{count:t}),children:[t,`×`]}):null;let i=Math.min(t/r*100,100),a=t>=r?`text-status-ok`:t>0?`text-status-warning`:`text-bambu-gray`,o=t>=r?`bg-status-ok`:t>0?`bg-status-warning`:`bg-bambu-gray`;return(0,b.jsxs)(`div`,{className:`shrink-0 w-20`,title:n(`projectDetail.files.progressTooltip`,{done:t,target:r}),children:[(0,b.jsxs)(`p`,{className:`text-xs font-medium text-right ${a}`,children:[t,` / `,r]}),(0,b.jsx)(`div`,{className:`h-1 bg-bambu-dark rounded-full overflow-hidden mt-1`,children:(0,b.jsx)(`div`,{className:`h-full ${o}`,style:{width:`${i}%`}})})]})})(),t&&(0,b.jsx)(`div`,{className:`flex items-center gap-1 shrink-0`,children:(0,b.jsx)(`button`,{onClick:()=>O(e),title:n(`common.print`),className:`p-1.5 rounded hover:bg-bambu-green/20 text-bambu-green transition-colors`,children:(0,b.jsx)(g,{className:`w-4 h-4`})})})]},e.id)})})]},e.id)})}):(0,b.jsx)(`p`,{className:`text-bambu-gray/70 text-sm italic`,children:n(`projectDetail.files.empty`)})]})}),(0,b.jsx)(p,{children:(0,b.jsxs)(f,{className:`p-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,b.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,b.jsx)(Me,{className:`w-5 h-5`}),n(`projectDetail.bom.title`),Q&&Q.bom_total_items>0&&(0,b.jsxs)(`span`,{className:`text-sm font-normal text-bambu-gray`,children:[`(`,n(`projectDetail.bom.acquired`,{completed:Q.bom_completed_items,total:Q.bom_total_items}),`)`]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M&&M.some(e=>e.is_complete)&&(0,b.jsx)(`button`,{onClick:()=>ft(!U),className:`text-xs px-2 py-1 rounded transition-colors ${U?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,children:n(U?`projectDetail.bom.showAll`:`projectDetail.bom.hideDone`)}),!dt&&(0,b.jsxs)(m,{variant:`secondary`,size:`sm`,onClick:()=>H(!0),disabled:!C(`projects:update`),title:C(`projects:update`)?void 0:n(`projectDetail.bom.noAddPermission`),children:[(0,b.jsx)(Ce,{className:`w-4 h-4 mr-1`}),n(`projectDetail.bom.addPart`)]})]})]}),dt&&(0,b.jsxs)(`form`,{onSubmit:St,className:`bg-bambu-dark rounded-lg p-4 mb-4 space-y-3`,children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,b.jsx)(`input`,{type:`text`,value:B,onChange:e=>rt(e.target.value),className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:n(`projectDetail.bom.partNamePlaceholder`),autoFocus:!0}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(_e,{value:it,onChange:at,fallback:1,className:`w-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white focus:outline-none focus:border-bambu-green`,min:1,placeholder:n(`projectDetail.bom.qty`)}),(0,b.jsx)(`input`,{type:`number`,step:`0.01`,value:V,onChange:e=>ot(e.target.value),className:`flex-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:n(`projectDetail.bom.price`,{currency:R})})]})]}),(0,b.jsx)(`input`,{type:`url`,value:st,onChange:e=>ct(e.target.value),className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:n(`projectDetail.bom.sourcingUrlPlaceholder`)}),(0,b.jsx)(`input`,{type:`text`,value:lt,onChange:e=>ut(e.target.value),className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:n(`projectDetail.bom.remarksPlaceholder`)}),(0,b.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,b.jsx)(m,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>H(!1),children:n(`common.cancel`)}),(0,b.jsx)(m,{type:`submit`,size:`sm`,disabled:!B.trim()||X.isPending,children:X.isPending?(0,b.jsx)(l,{className:`w-4 h-4 animate-spin`}):n(`projectDetail.bom.addPart`)})]})]}),qe?(0,b.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,b.jsx)(l,{className:`w-6 h-6 animate-spin text-bambu-green`})}):M&&M.length>0?(0,b.jsxs)(`div`,{className:`space-y-2`,children:[M.filter(e=>!U||!e.is_complete).map(e=>(0,b.jsx)(`div`,{className:`p-3 rounded-lg transition-colors ${e.is_complete?`bg-status-ok/10`:`bg-bambu-dark`}`,children:W?.id===e.id?(0,b.jsxs)(`form`,{onSubmit:Et,className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,b.jsx)(`input`,{type:`text`,value:K,onChange:e=>pt(e.target.value),className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:n(`projectDetail.bom.partName`),autoFocus:!0}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(_e,{value:mt,onChange:ht,fallback:1,className:`w-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white focus:outline-none focus:border-bambu-green`,min:1,placeholder:n(`projectDetail.bom.qty`)}),(0,b.jsx)(`input`,{type:`number`,step:`0.01`,value:q,onChange:e=>gt(e.target.value),className:`flex-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:n(`projectDetail.bom.price`,{currency:R})})]})]}),(0,b.jsx)(`input`,{type:`url`,value:_t,onChange:e=>vt(e.target.value),className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:n(`projectDetail.bom.sourcingUrlPlaceholder`)}),(0,b.jsx)(`input`,{type:`text`,value:yt,onChange:e=>bt(e.target.value),className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:n(`projectDetail.bom.remarksPlaceholder`)}),(0,b.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,b.jsx)(m,{type:`button`,variant:`secondary`,size:`sm`,onClick:Dt,children:n(`common.cancel`)}),(0,b.jsx)(m,{type:`submit`,size:`sm`,disabled:!K.trim()||Z.isPending,children:Z.isPending?(0,b.jsx)(l,{className:`w-4 h-4 animate-spin`}):n(`common.save`)})]})]}):(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`button`,{onClick:()=>C(`projects:update`)&&Ct(e),disabled:Z.isPending||!C(`projects:update`),title:C(`projects:update`)?void 0:n(`projectDetail.bom.noUpdatePermission`),className:`w-5 h-5 mt-0.5 rounded border-2 flex items-center justify-center transition-colors shrink-0 ${e.is_complete?`bg-status-ok border-status-ok text-white`:C(`projects:update`)?`border-bambu-gray hover:border-bambu-green`:`border-bambu-gray/50 cursor-not-allowed`}`,children:e.is_complete&&(0,b.jsx)(c,{className:`w-3 h-3`})}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,b.jsxs)(`p`,{className:`text-sm font-medium ${e.is_complete?`text-bambu-gray line-through`:`text-white`}`,children:[e.name,(0,b.jsxs)(`span`,{className:`text-bambu-gray font-normal ml-2`,children:[`x`,e.quantity_needed]})]}),e.unit_price!==null&&(0,b.jsxs)(`span`,{className:`text-xs text-bambu-green whitespace-nowrap`,children:[R,(e.unit_price*e.quantity_needed).toFixed(2)]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,b.jsx)(`button`,{onClick:()=>C(`projects:update`)&&Tt(e),disabled:!C(`projects:update`),className:`p-1 rounded transition-colors shrink-0 ${C(`projects:update`)?`hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:C(`projects:update`)?n(`common.edit`):n(`projectDetail.bom.noEditPermission`),children:(0,b.jsx)(pe,{className:`w-4 h-4`})}),(0,b.jsx)(`button`,{onClick:()=>C(`projects:update`)&&wt(e.id,e.name),disabled:!C(`projects:update`),className:`p-1 rounded transition-colors shrink-0 ${C(`projects:update`)?`hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-red-400`:`text-bambu-gray/50 cursor-not-allowed`}`,title:C(`projects:update`)?n(`common.delete`):n(`projectDetail.bom.noDeletePermission`),children:(0,b.jsx)(me,{className:`w-4 h-4`})})]})]}),e.sourcing_url&&(0,b.jsxs)(`a`,{href:e.sourcing_url,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 mt-1 text-xs text-blue-700 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 transition-colors`,onClick:e=>e.stopPropagation(),children:[(0,b.jsx)(he,{className:`w-3 h-3 shrink-0`}),(0,b.jsx)(`span`,{className:`truncate`,children:(()=>{try{return new URL(e.sourcing_url).hostname.replace(`www.`,``)}catch{return e.sourcing_url}})()})]}),e.remarks&&(0,b.jsx)(`p`,{className:`mt-1 text-xs text-bambu-gray/80 italic`,children:e.remarks})]})]})},e.id)),Q&&Q.bom_cost>0&&(0,b.jsxs)(`div`,{className:`pt-2 mt-2 border-t border-bambu-dark-tertiary flex justify-between text-sm`,children:[(0,b.jsx)(`span`,{className:`text-bambu-gray`,children:n(`projectDetail.bom.totalCost`)}),(0,b.jsxs)(`span`,{className:`text-white font-medium`,children:[R,Q.bom_cost.toFixed(2)]})]})]}):(0,b.jsx)(`p`,{className:`text-bambu-gray/70 text-sm italic`,children:n(`projectDetail.bom.empty`)})]})}),(0,b.jsx)(p,{children:(0,b.jsxs)(f,{className:`p-4`,children:[(0,b.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,b.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,b.jsx)(se,{className:`w-5 h-5`}),n(`projectDetail.timeline.title`)]})}),Je?(0,b.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,b.jsx)(l,{className:`w-6 h-6 animate-spin text-bambu-green`})}):N&&N.length>0?(0,b.jsx)(`div`,{className:`space-y-3`,children:N.slice(0,10).map((e,t)=>(0,b.jsxs)(`div`,{className:`flex gap-3`,children:[(0,b.jsxs)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0 ${e.event_type===`print_completed`?`bg-status-ok/20 text-status-ok`:e.event_type===`print_failed`?`bg-status-error/20 text-status-error`:e.event_type===`print_started`?`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:[e.event_type===`print_completed`&&(0,b.jsx)(c,{className:`w-4 h-4`}),e.event_type===`print_failed`&&(0,b.jsx)(re,{className:`w-4 h-4`}),e.event_type===`print_started`&&(0,b.jsx)(g,{className:`w-4 h-4`}),e.event_type===`queued`&&(0,b.jsx)(Ie,{className:`w-4 h-4`}),e.event_type===`project_created`&&(0,b.jsx)(Ce,{className:`w-4 h-4`})]}),(0,b.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm text-white`,children:e.title}),e.description&&(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray truncate`,children:e.description}),(0,b.jsx)(`p`,{className:`text-xs text-bambu-gray/70`,children:At(e.timestamp)})]})]},t))}):(0,b.jsx)(`p`,{className:`text-bambu-gray/70 text-sm italic`,children:n(`projectDetail.timeline.empty`)})]})}),!A.is_template&&(0,b.jsx)(`div`,{className:`flex justify-end`,children:(0,b.jsxs)(m,{variant:`secondary`,size:`sm`,onClick:()=>kt.mutate(),disabled:kt.isPending||!C(`projects:create`),title:C(`projects:create`)?void 0:n(`projectDetail.template.noCreatePermission`),children:[kt.isPending?(0,b.jsx)(l,{className:`w-4 h-4 animate-spin mr-2`}):(0,b.jsx)(ae,{className:`w-4 h-4 mr-2`}),n(`projectDetail.template.saveAsTemplate`)]})}),Q&&(Q.queued_prints>0||Q.in_progress_prints>0)&&(0,b.jsx)(p,{children:(0,b.jsxs)(f,{className:`p-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,b.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,b.jsx)(Ie,{className:`w-5 h-5`}),n(`projectDetail.queue.title`)]}),(0,b.jsx)(_,{to:`/queue?project=${k}`,className:`text-sm text-bambu-green hover:underline`,children:n(`projectDetail.queue.viewAll`)})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[Q.in_progress_prints>0&&(0,b.jsx)(`span`,{className:`text-yellow-700 dark:text-yellow-400`,children:n(`projectDetail.queue.printing`,{count:Q.in_progress_prints})}),Q.queued_prints>0&&(0,b.jsx)(`span`,{className:`text-bambu-gray`,children:n(`projectDetail.queue.queued`,{count:Q.queued_prints})})]})]})}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,b.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,b.jsx)(u,{className:`w-5 h-5`}),n(`projectDetail.prints.title`,{count:Ge?.length||0})]})}),Ke?(0,b.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,b.jsx)(l,{className:`w-6 h-6 animate-spin text-bambu-green`})}):(0,b.jsx)(ze,{archives:Ge||[],t:n})]}),Ve&&(0,b.jsx)(Fe,{t:n,currencySymbol:R,project:{...A,archive_count:Q?.total_archives||0,total_items:Q?.total_items||0,completed_count:Q?.completed_prints||0,failed_count:Q?.failed_prints||0,queue_count:Q?.queued_prints||0,progress_percent:Q?.progress_percent||null,child_count:A.children?.length??0,archives:[]},onClose:()=>w(!1),onSave:e=>z.mutate(e),isLoading:z.isPending}),J.isOpen&&(0,b.jsx)(we,{title:J.title,message:J.message,confirmText:n(`common.delete`),variant:`danger`,onConfirm:J.onConfirm,onCancel:()=>Y(e=>({...e,isOpen:!1}))}),D&&(0,b.jsx)(Ee,{mode:`create`,libraryFileId:D.id,archiveName:D.print_name||D.filename,projectId:k,onClose:()=>O(null),onSuccess:()=>{O(null),d.invalidateQueries({queryKey:[`archives`]}),d.invalidateQueries({queryKey:[`queue`]})}})]})}export{C as ProjectDetailPage}; \ No newline at end of file diff --git a/static/assets/ProjectsPage-thNs0J44.js b/static/assets/ProjectsPage-thNs0J44.js new file mode 100644 index 000000000..39e43d9f7 --- /dev/null +++ b/static/assets/ProjectsPage-thNs0J44.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{t as a}from"./react-dom-B8Dg6xzp.js";import{n as o}from"./QueryClientProvider-Ce8_sN3w.js";import{t as s}from"./useQuery-BBCjCezC.js";import{t as c}from"./useMutation-B-Tr2hIP.js";import{t as l}from"./createLucideIcon-DvBYJlWL.js";import{a as u}from"./info-ROUoQhJR.js";import{n as d}from"./ToastContext-BRX0SW3C.js";import{t as f}from"./ellipsis-vertical-t2D7cYyp.js";import{t as p}from"./loader-circle-BEmFtawu.js";import{t as m}from"./package-BGUevlqS.js";import{t as h}from"./pen-line-BWR04BX-.js";import{t as g}from"./triangle-alert-Dt_1FcBy.js";import{t as _}from"./x-DR-Trv6U.js";import{t as v}from"./Button-DDr6eAFy.js";import{An as y,At as b,Cn as x,I as S,Ln as C,Mn as w,On as T,Vn as E,Zt as D,_t as O,at as k,cn as A,kt as j,un as ee,wn as M,yn as N,yt as P}from"./index-CovRLYqQ.js";var F=l(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),I=l(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),L=e(n(),1),R=e(a(),1),z=t(),B=[`#ef4444`,`#f97316`,`#eab308`,`#22c55e`,`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#ec4899`,`#6b7280`];function V({project:e,onClose:t,onSave:n,isLoading:i,currencySymbol:a,t:c}){let[l,u]=(0,L.useState)(e?.name||``),[d,f]=(0,L.useState)(e?.description||``),[m,h]=(0,L.useState)(e?.color||B[0]),[g,y]=(0,L.useState)(e?.target_count?.toString()||``),[b,x]=(0,L.useState)(e?.target_parts_count?.toString()||``),[C,w]=(0,L.useState)(e?.target_sets?.toString()||``),[T,E]=(0,L.useState)(e?.status||`active`),[D,O]=(0,L.useState)(e?.tags||``),[k,A]=(0,L.useState)(e?.due_date?.split(`T`)[0]||``),[M,N]=(0,L.useState)(e?.priority||`normal`),[P,F]=(0,L.useState)(e?.budget?.toString()||``),[I,R]=(0,L.useState)(e?.url||``),[V,H]=(0,L.useState)(null),[U,W]=(0,L.useState)(e?.parent_id??null),G=o(),{data:te}=s({queryKey:[`projects`,void 0],queryFn:()=>r.getProjects()}),K=S(te||[],e?.id),[q,J]=(0,L.useState)(e?.cover_image_filename||null),Y=(0,L.useRef)(null),[X,Z]=(0,L.useState)(!1),[Q,$]=(0,L.useState)(0);return(0,z.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,z.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-md border border-bambu-dark-tertiary flex flex-col max-h-[calc(100vh-2rem)]`,children:[(0,z.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex-shrink-0`,children:(0,z.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:c(e?`projects.editProject`:`projects.newProject`)})}),(0,z.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let r=I.trim();if(r&&!/^https?:\/\//i.test(r)){H(c(`projects.urlInvalid`));return}H(null),n({name:l.trim(),description:d.trim()||void 0,color:m,target_count:g?parseInt(g,10):void 0,target_parts_count:b?parseInt(b,10):void 0,target_sets:e?C?parseInt(C,10):null:C?parseInt(C,10):void 0,tags:e?D.trim()||null:D.trim()||void 0,due_date:e?k||null:k||void 0,priority:M,budget:P.trim()?parseFloat(P):null,url:e?r||null:r||void 0,parent_id:e?U??0:U??void 0,...e&&{status:T}})},className:`flex flex-col flex-1 min-h-0`,children:[(0,z.jsxs)(`div`,{className:`p-4 space-y-4 overflow-y-auto flex-1`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`common.name`)}),(0,z.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:c(`projects.namePlaceholder`),required:!0})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`common.description`)}),(0,z.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green resize-none`,placeholder:c(`projects.descriptionPlaceholder`),rows:2})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.urlLabel`)}),(0,z.jsx)(`input`,{type:`url`,value:I,onChange:e=>{R(e.target.value),V&&H(null)},className:`w-full bg-bambu-dark border rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none ${V?`border-red-500 focus:border-red-500`:`border-bambu-dark-tertiary focus:border-bambu-green`}`,placeholder:c(`projects.urlPlaceholder`),maxLength:2048}),V&&(0,z.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400 mt-1`,children:V})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.parentLabel`)}),(0,z.jsxs)(`select`,{value:U??``,onChange:e=>W(e.target.value?parseInt(e.target.value,10):null),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white focus:outline-none focus:border-bambu-green`,children:[(0,z.jsx)(`option`,{value:``,children:c(`projects.parentNone`)}),K.map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:c(`projects.parentHint`)})]}),e&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.coverImageLabel`)}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`div`,{className:`w-20 h-20 rounded bg-bambu-dark border border-bambu-dark-tertiary overflow-hidden flex items-center justify-center flex-shrink-0`,children:q?(0,z.jsx)(`img`,{src:r.getProjectCoverImageUrl(e.id,Q),alt:c(`projects.coverImageAlt`),className:`w-full h-full object-cover`}):(0,z.jsx)(ee,{className:`w-6 h-6 text-bambu-gray`})}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(`input`,{ref:Y,type:`file`,accept:`image/jpeg,image/png,image/gif,image/webp`,onChange:async t=>{let n=t.target.files?.[0];if(!(!n||!e)){Z(!0);try{J((await r.uploadProjectCoverImage(e.id,n)).filename),$(e=>e+1),G.invalidateQueries({queryKey:[`projects`]})}catch{}finally{Z(!1),Y.current&&(Y.current.value=``)}}},className:`hidden`}),(0,z.jsxs)(v,{type:`button`,variant:`secondary`,onClick:()=>Y.current?.click(),disabled:X,children:[X?(0,z.jsx)(p,{className:`w-4 h-4 animate-spin`}):(0,z.jsx)(j,{className:`w-4 h-4 mr-1`}),c(q?`projects.coverImageReplace`:`projects.coverImageUpload`)]}),q&&(0,z.jsxs)(v,{type:`button`,variant:`secondary`,onClick:async()=>{if(e){Z(!0);try{await r.deleteProjectCoverImage(e.id),J(null),$(e=>e+1),G.invalidateQueries({queryKey:[`projects`]})}finally{Z(!1)}}},disabled:X,children:[(0,z.jsx)(_,{className:`w-4 h-4 mr-1`}),c(`projects.coverImageRemove`)]})]})]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.color`)}),(0,z.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:B.map(e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>h(e),className:`w-8 h-8 rounded-full transition-transform ${m===e?`ring-2 ring-white ring-offset-2 ring-offset-bambu-dark-secondary scale-110`:``}`,style:{backgroundColor:e}},e))})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.targetPlates`)}),(0,z.jsx)(`input`,{type:`number`,value:g,onChange:e=>y(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:c(`projects.targetPlatesPlaceholder`),min:`1`}),(0,z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:c(`projects.targetPlatesHelp`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.targetParts`)}),(0,z.jsx)(`input`,{type:`number`,value:b,onChange:e=>x(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:c(`projects.targetPartsPlaceholder`),min:`1`}),(0,z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:c(`projects.targetPartsHelp`)})]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.targetSets`)}),(0,z.jsx)(`input`,{type:`number`,value:C,onChange:e=>w(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:c(`projects.targetSetsPlaceholder`),min:`1`}),(0,z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:c(`projects.targetSetsHelp`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.tagsLabel`)}),(0,z.jsx)(`input`,{type:`text`,value:D,onChange:e=>O(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:c(`projects.tagsPlaceholder`)})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.dueDate`)}),(0,z.jsx)(`input`,{type:`date`,value:k,onChange:e=>A(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white focus:outline-none focus:border-bambu-green`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projects.priority`)}),(0,z.jsxs)(`select`,{value:M,onChange:e=>N(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white focus:outline-none focus:border-bambu-green`,children:[(0,z.jsx)(`option`,{value:`low`,children:c(`projects.priorityLow`)}),(0,z.jsx)(`option`,{value:`normal`,children:c(`projects.priorityNormal`)}),(0,z.jsx)(`option`,{value:`high`,children:c(`projects.priorityHigh`)}),(0,z.jsx)(`option`,{value:`urgent`,children:c(`projects.priorityUrgent`)})]})]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`projectDetail.cost.budget`)}),(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray pointer-events-none`,children:a}),(0,z.jsx)(`input`,{type:`number`,step:`0.01`,min:`0`,value:P,onChange:e=>F(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded pl-8 pr-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:`0.00`})]})]}),e&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:c(`common.status`)}),(0,z.jsxs)(`select`,{value:T,onChange:e=>E(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white focus:outline-none focus:border-bambu-green`,children:[(0,z.jsx)(`option`,{value:`active`,children:c(`projects.statusActive`)}),(0,z.jsx)(`option`,{value:`completed`,children:c(`projects.statusCompleted`)}),(0,z.jsx)(`option`,{value:`archived`,children:c(`projects.statusArchived`)})]})]})]}),(0,z.jsxs)(`div`,{className:`flex justify-end gap-2 p-4 border-t border-bambu-dark-tertiary flex-shrink-0`,children:[(0,z.jsx)(v,{type:`button`,variant:`secondary`,onClick:t,children:c(`common.cancel`)}),(0,z.jsx)(v,{type:`submit`,disabled:!l.trim()||i,children:i?(0,z.jsx)(p,{className:`w-4 h-4 animate-spin`}):c(e?`common.save`:`projects.create`)})]})]})]})})}function H({projectId:e,altText:t}){let n=(0,L.useRef)(null),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null);return(0,z.jsxs)(`div`,{ref:n,className:`relative flex-shrink-0`,onMouseEnter:()=>{if(!n.current)return;let e=n.current.getBoundingClientRect(),t=window.innerWidth,r=window.innerHeight,i=e.right+8;i+384>t-8&&(i=e.left-384-8);let o=e.top;o+384>r-8&&(o=r-384-8),o<8&&(o=8),s({left:i,top:o}),a(!0)},onMouseLeave:()=>a(!1),onClick:e=>e.stopPropagation(),children:[(0,z.jsx)(`div`,{className:`w-10 h-10 rounded-lg overflow-hidden bg-bambu-dark border border-bambu-dark-tertiary`,children:(0,z.jsx)(`img`,{src:r.getProjectCoverImageUrl(e),alt:t,className:`w-full h-full object-cover`,loading:`lazy`})}),i&&o&&(0,R.createPortal)((0,z.jsx)(`div`,{className:`fixed z-[100] w-96 h-96 rounded-lg overflow-hidden border border-bambu-dark-tertiary shadow-2xl bg-bambu-dark pointer-events-none`,style:{left:o.left,top:o.top},"aria-hidden":`true`,children:(0,z.jsx)(`img`,{src:r.getProjectCoverImageUrl(e),alt:``,className:`w-full h-full object-contain`,loading:`lazy`})}),document.body)]})}function U({project:e,parentName:t,onClick:n,onEdit:i,onDelete:a,hasPermission:o,t:s}){let c=e.target_count?Math.round(e.archive_count/e.target_count*100):0,l=e.target_parts_count?Math.round(e.completed_count/e.target_parts_count*100):0,u=e.status===`completed`,d=e.status===`archived`,[p,_]=(0,L.useState)(!1),v=u?{icon:y,color:`text-bambu-green`,bg:`bg-bambu-green/10`}:d?{icon:C,color:`text-bambu-gray`,bg:`bg-bambu-gray/10`}:e.queue_count>0?{icon:T,color:`text-blue-600 dark:text-blue-400`,bg:`bg-blue-50 dark:bg-blue-400/10`}:{icon:N,color:`text-bambu-gray`,bg:`bg-bambu-gray/10`};return(0,z.jsxs)(`div`,{className:`group relative bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary hover:border-bambu-green/50 hover:shadow-lg hover:shadow-bambu-green/5 transition-all duration-300 cursor-pointer overflow-hidden`,onClick:n,children:[(0,z.jsx)(`div`,{className:`absolute top-0 left-0 w-1.5 h-full`,style:{backgroundColor:e.color||`#6b7280`,boxShadow:`0 0 12px ${e.color||`#6b7280`}40`}}),(0,z.jsxs)(`div`,{className:`p-5 pl-6`,children:[(0,z.jsxs)(`div`,{className:`flex items-start justify-between mb-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[e.cover_image_filename?(0,z.jsx)(H,{projectId:e.id,altText:s(`projects.coverImageAlt`)}):(0,z.jsx)(`div`,{className:`p-2 rounded-lg ${v.bg} flex-shrink-0`,children:(0,z.jsx)(v.icon,{className:`w-5 h-5 ${v.color}`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,z.jsx)(`h3`,{className:`font-semibold text-white truncate`,children:e.name}),e.url&&(0,z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),title:e.url,"aria-label":s(`projects.openExternalUrl`),className:`inline-flex items-center justify-center w-6 h-6 rounded bg-bambu-dark border border-bambu-dark-tertiary text-bambu-green hover:bg-bambu-green/10 hover:border-bambu-green transition-colors flex-shrink-0`,children:(0,z.jsx)(x,{className:`w-3.5 h-3.5`})}),e.target_parts_count?(0,z.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded-full whitespace-nowrap font-medium ${l>=100?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark text-bambu-gray`}`,children:[e.completed_count,`/`,e.target_parts_count,` `,s(`projects.parts`)]}):e.target_count?(0,z.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded-full whitespace-nowrap font-medium ${c>=100?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark text-bambu-gray`}`,children:[e.archive_count,`/`,e.target_count,` `,s(`projects.plates`)]}):e.completed_count>0?(0,z.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded-full whitespace-nowrap font-medium bg-bambu-dark text-bambu-gray`,children:[e.completed_count,` `,s(`projects.parts`)]}):null,u&&(0,z.jsx)(`span`,{className:`text-xs bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full whitespace-nowrap`,children:s(`projects.done`)}),d&&(0,z.jsx)(`span`,{className:`text-xs bg-bambu-gray/20 text-bambu-gray px-2 py-0.5 rounded-full whitespace-nowrap`,children:s(`projects.statusArchived`)}),e.child_count>0&&(0,z.jsxs)(`span`,{className:`text-xs bg-bambu-dark text-bambu-gray px-2 py-0.5 rounded-full whitespace-nowrap inline-flex items-center gap-1`,title:s(`projects.subProjectCount`,{count:e.child_count}),children:[(0,z.jsx)(F,{className:`w-3 h-3`}),e.child_count]})]}),t&&(0,z.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1 flex items-center gap-1`,children:[(0,z.jsx)(A,{className:`w-3 h-3 flex-shrink-0`}),(0,z.jsx)(`span`,{className:`truncate`,children:s(`projects.partOf`,{name:t})})]}),e.description&&(0,z.jsx)(`p`,{className:`text-sm text-bambu-gray/70 mt-1 line-clamp-1`,children:e.description}),e.archives&&e.archives.length>0&&(()=>{let t=e.archives.map(e=>e.filament_type).filter(Boolean).flatMap(e=>e.split(`,`).map(e=>e.trim())).filter(Boolean),n=[...new Set(t)],r=e.archives.map(e=>e.filament_color).filter(Boolean).flatMap(e=>e.split(`,`).map(e=>e.trim())).filter(e=>e.startsWith(`#`)||/^[0-9A-Fa-f]{6}$/.test(e)),i=[...new Set(r)];return n.length===0&&i.length===0?null:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[n.slice(0,3).map(e=>(0,z.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 bg-bambu-dark text-bambu-gray rounded`,children:e},e)),i.length>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[i.slice(0,5).map(e=>(0,z.jsx)(`div`,{className:`w-3 h-3 rounded-full border border-black/20`,style:{backgroundColor:e.startsWith(`#`)?e:`#${e}`},title:e},e)),i.length>5&&(0,z.jsxs)(`span`,{className:`text-[10px] text-bambu-gray ml-0.5`,children:[`+`,i.length-5]})]})]})})()]})]}),(0,z.jsxs)(`div`,{className:`relative`,onClick:e=>e.stopPropagation(),children:[(0,z.jsx)(`button`,{className:`p-1.5 rounded-lg hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors can-hover:opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:()=>_(!p),children:(0,z.jsx)(f,{className:`w-4 h-4`})}),p&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>_(!1)}),(0,z.jsxs)(`div`,{className:`absolute right-0 top-8 z-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[120px]`,children:[(0,z.jsxs)(`button`,{className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 ${o(`projects:update`)?`text-white hover:bg-bambu-dark`:`text-bambu-gray cursor-not-allowed`}`,onClick:()=>{o(`projects:update`)&&(i(),_(!1))},disabled:!o(`projects:update`),title:o(`projects:update`)?void 0:s(`projects.noEditPermission`),children:[(0,z.jsx)(h,{className:`w-4 h-4`}),s(`common.edit`)]}),(0,z.jsxs)(`button`,{className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 ${o(`projects:delete`)?`text-red-600 dark:text-red-400 hover:bg-bambu-dark`:`text-bambu-gray cursor-not-allowed`}`,onClick:()=>{o(`projects:delete`)&&(a(),_(!1))},disabled:!o(`projects:delete`),title:o(`projects:delete`)?void 0:s(`projects.noDeletePermission`),children:[(0,z.jsx)(b,{className:`w-4 h-4`}),s(`common.delete`)]})]})]})]})]}),(0,z.jsx)(`div`,{className:`mb-4`,children:e.target_count||e.target_parts_count?(0,z.jsxs)(`div`,{className:`space-y-3`,children:[e.target_count&&(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,z.jsx)(`span`,{className:`text-bambu-gray`,children:s(`projects.plates`)}),(0,z.jsxs)(`span`,{className:c>=100?`text-bambu-green font-medium`:`text-white`,children:[e.archive_count,` / `,e.target_count]})]}),(0,z.jsx)(`div`,{className:`h-2 bg-bambu-dark/80 rounded-full overflow-hidden backdrop-blur-sm`,children:(0,z.jsx)(`div`,{className:`h-full transition-all duration-500 ease-out rounded-full relative`,style:{width:`${Math.min(c,100)}%`,background:c>=100?`linear-gradient(90deg, #22c55e, #4ade80)`:`linear-gradient(90deg, ${e.color||`#6b7280`}, ${e.color||`#6b7280`}cc)`,boxShadow:`0 0 8px ${c>=100?`#22c55e`:e.color||`#6b7280`}60`}})})]}),e.target_parts_count&&(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,z.jsx)(`span`,{className:`text-bambu-gray`,children:s(`projects.parts`)}),(0,z.jsxs)(`span`,{className:l>=100?`text-bambu-green font-medium`:`text-white`,children:[e.completed_count,` / `,e.target_parts_count]})]}),(0,z.jsx)(`div`,{className:`h-2 bg-bambu-dark/80 rounded-full overflow-hidden backdrop-blur-sm`,children:(0,z.jsx)(`div`,{className:`h-full transition-all duration-500 ease-out rounded-full relative`,style:{width:`${Math.min(l,100)}%`,background:l>=100?`linear-gradient(90deg, #22c55e, #4ade80)`:`linear-gradient(90deg, ${e.color||`#6b7280`}, ${e.color||`#6b7280`}cc)`,boxShadow:`0 0 8px ${l>=100?`#22c55e`:e.color||`#6b7280`}60`}})})]}),e.failed_count>0&&(0,z.jsxs)(`div`,{className:`text-xs text-red-600 dark:text-red-400`,children:[e.failed_count,` `,s(`projects.failed`)]})]}):e.completed_count>0||e.failed_count>0?(0,z.jsxs)(`div`,{className:`flex items-center gap-4 text-xs`,children:[e.completed_count>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,children:[(0,z.jsx)(C,{className:`w-3.5 h-3.5`}),(0,z.jsxs)(`span`,{children:[e.completed_count,` `,s(`projects.completed`)]})]}),e.failed_count>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-red-600 dark:text-red-400`,children:[(0,z.jsx)(g,{className:`w-3.5 h-3.5`}),(0,z.jsxs)(`span`,{children:[e.failed_count,` `,s(`projects.failed`)]})]}),e.queue_count>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-blue-600 dark:text-blue-400`,children:[(0,z.jsx)(T,{className:`w-3.5 h-3.5`}),(0,z.jsxs)(`span`,{children:[e.queue_count,` `,s(`projects.inQueue`)]})]})]}):(0,z.jsx)(`div`,{className:`text-xs text-bambu-gray/60 italic`,children:s(`projects.noPrintsYet`)})}),e.archives&&e.archives.length>0&&(0,z.jsxs)(`div`,{className:`mb-4`,children:[(0,z.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:e.archives.slice(0,4).map(e=>(0,z.jsxs)(`div`,{className:`relative aspect-square rounded-lg bg-bambu-dark overflow-hidden border border-bambu-dark-tertiary`,title:e.print_name||`Unknown`,children:[e.thumbnail_path?(0,z.jsx)(`img`,{src:r.getArchiveThumbnail(e.id),alt:e.print_name||``,className:`w-full h-full object-cover`}):(0,z.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-bambu-gray/50`,children:(0,z.jsx)(m,{className:`w-6 h-6`})}),e.status===`failed`&&(0,z.jsx)(`div`,{className:`absolute inset-0 bg-red-500/40 flex items-center justify-center`,children:(0,z.jsx)(g,{className:`w-4 h-4 text-white`})})]},e.id))}),e.archive_count>4&&(0,z.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1.5 text-center`,children:s(`common.more`,{count:e.archive_count-4})})]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-between pt-3 border-t border-bambu-dark-tertiary`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-4 text-xs text-bambu-gray`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:s(`projects.printJobs`),children:[(0,z.jsx)(A,{className:`w-3.5 h-3.5 text-blue-600 dark:text-blue-400`}),(0,z.jsxs)(`span`,{children:[e.archive_count,` `,s(`projects.plates`)]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:s(`projects.partsPrinted`),children:[(0,z.jsx)(m,{className:`w-3.5 h-3.5 text-bambu-green`}),(0,z.jsxs)(`span`,{children:[e.completed_count,` `,s(`projects.parts`)]})]}),e.failed_count>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-red-600 dark:text-red-400`,title:s(`projects.failedParts`),children:[(0,z.jsx)(g,{className:`w-3.5 h-3.5`}),(0,z.jsx)(`span`,{children:e.failed_count})]}),e.queue_count>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-yellow-600 dark:text-yellow-400`,title:s(`projects.inQueue`),children:[(0,z.jsx)(I,{className:`w-3.5 h-3.5`}),(0,z.jsx)(`span`,{children:e.queue_count})]})]}),(0,z.jsx)(w,{className:`w-4 h-4 text-bambu-gray/50 group-hover:text-bambu-gray transition-colors`})]})]})]})}function W(){let{t:e}=i(),t=E(),n=o(),{showToast:a}=d(),{hasPermission:l}=P(),[f,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(),[_,b]=(0,L.useState)(`active`),[x,S]=(0,L.useState)(null),[A,ee]=(0,L.useState)(()=>localStorage.getItem(`projects-collapse-subprojects`)===`true`),[I,R]=(0,L.useState)({}),B=()=>{let e=!A;ee(e),R({}),localStorage.setItem(`projects-collapse-subprojects`,String(e))},{data:H}=s({queryKey:[`settings`],queryFn:r.getSettings}),W=k(H?.currency||`USD`),{data:G,isLoading:te}=s({queryKey:[`projects`,_===`all`?void 0:_],queryFn:()=>r.getProjects(_===`all`?void 0:_)}),{data:K}=s({queryKey:[`projects`,void 0],queryFn:()=>r.getProjects()}),q=new Map((K||[]).map(e=>[e.id,e.name])),J=G||[],Y=new Set(J.map(e=>e.id)),X=new Map;for(let e of J)if(e.parent_id!==null&&Y.has(e.parent_id)){let t=X.get(e.parent_id)||[];t.push(e),X.set(e.parent_id,t)}let Z=new Set,Q=e=>{if(!Z.has(e)){Z.add(e);for(let t of X.get(e)||[])Q(t.id)}},$=[];for(let e of J)e.parent_id!==null&&Y.has(e.parent_id)||($.push(e),Q(e.id));for(let e of J)Z.has(e.id)||($.push(e),Q(e.id));let ne=(t,n,r)=>{let i=(0,z.jsx)(U,{project:t,parentName:n===0&&t.parent_id!==null?q.get(t.parent_id):void 0,onClick:()=>pe(t),onEdit:()=>fe(t),onDelete:()=>me(t.id),hasPermission:l,t:e}),a=new Set(r).add(t.id),o=(X.get(t.id)||[]).filter(e=>!a.has(e.id));if(o.length===0)return(0,z.jsx)(`div`,{children:i},t.id);let s=I[t.id]??!A;return(0,z.jsxs)(`div`,{className:s?`col-span-full space-y-4`:`space-y-4`,children:[i,(0,z.jsxs)(`div`,{className:`ml-4 md:ml-8 pl-4 md:pl-6 border-l-2 rounded-l space-y-4`,style:{borderColor:t.color||`#6b7280`},children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>R(e=>({...e,[t.id]:!s})),"aria-expanded":s,title:e(s?`projects.collapseSubProjects`:`projects.expandSubProjects`),className:`text-xs uppercase tracking-wide text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5 max-w-full min-w-0`,children:[s?(0,z.jsx)(u,{className:`w-3.5 h-3.5 flex-shrink-0`}):(0,z.jsx)(w,{className:`w-3.5 h-3.5 flex-shrink-0`}),(0,z.jsx)(F,{className:`w-3.5 h-3.5 flex-shrink-0`}),(0,z.jsx)(`span`,{className:`truncate`,children:e(`projects.subProjectsOf`,{name:t.name})}),(0,z.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-full bg-bambu-dark normal-case tracking-normal flex-shrink-0`,children:o.length})]}),s&&(0,z.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:o.map(e=>ne(e,n+1,a))})]})]},t.id)},re=c({mutationFn:e=>r.createProject(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`projects`]}),m(!1),a(e(`projects.toast.created`),`success`)},onError:e=>{a(e.message,`error`)}}),ie=c({mutationFn:({id:e,data:t})=>r.updateProject(e,t),onSuccess:()=>{n.invalidateQueries({queryKey:[`projects`]}),m(!1),g(void 0),a(e(`projects.toast.updated`),`success`)},onError:e=>{a(e.message,`error`)}}),ae=c({mutationFn:e=>r.deleteProject(e),onSuccess:()=>{S(null),a(e(`projects.toast.deleted`),`success`),setTimeout(()=>window.location.reload(),100)},onError:e=>{S(null),a(e.message,`error`)}}),oe=c({mutationFn:e=>r.importProject(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`projects`]}),a(e(`projects.toast.imported`),`success`)},onError:e=>{a(e.message,`error`)}}),se=(0,L.useRef)(null),ce=async()=>{try{let t=await r.getProjects(),n=await Promise.all(t.map(async e=>await r.exportProjectJson(e.id))),i=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),o=URL.createObjectURL(i),s=document.createElement(`a`);s.href=o,s.download=`bambuddy_projects_${new Date().toISOString().split(`T`)[0]}.json`,s.click(),URL.revokeObjectURL(o),a(e(`projects.toast.exported`),`success`)}catch(e){a(e.message,`error`)}},le=()=>{se.current?.click()},ue=async t=>{let i=t.target.files?.[0];if(i){try{if(i.name.toLowerCase().endsWith(`.zip`))await r.importProjectFile(i),n.invalidateQueries({queryKey:[`projects`]}),a(e(`projects.toast.imported`),`success`);else{let t=await i.text(),n=JSON.parse(t),r=Array.isArray(n)?n:[n];for(let e of r)await oe.mutateAsync(e);r.length>1&&a(e(`projects.toast.multipleImported`,{count:r.length}),`success`)}}catch(t){a(`${e(`projects.toast.importFailed`)}: ${t.message}`,`error`)}t.target.value=``}},de=e=>{h?ie.mutate({id:h.id,data:e}):re.mutate(e)},fe=e=>{g(e),m(!0)},pe=e=>{t(`/projects/${e.id}`)},me=e=>{S(e)},he=()=>{x!==null&&ae.mutate(x)},ge=K?.reduce((e,t)=>(e[t.status]=(e[t.status]||0)+1,e.all=(e.all||0)+1,e),{})||{};return(0,z.jsxs)(`div`,{className:`p-4 md:p-8 space-y-8`,children:[(0,z.jsx)(`input`,{ref:se,type:`file`,accept:`.json,.zip`,onChange:ue,className:`hidden`}),(0,z.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,z.jsx)(N,{className:`w-7 h-7 text-bambu-green`}),e(`projects.title`)]}),(0,z.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`projects.subtitle`)})]}),(0,z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,z.jsxs)(v,{variant:`secondary`,onClick:le,disabled:!l(`projects:create`),title:l(`projects:create`)?e(`projects.importProject`):e(`projects.noImportPermission`),children:[(0,z.jsx)(j,{className:`w-4 h-4 mr-2`}),e(`projects.import`)]}),(0,z.jsxs)(v,{variant:`secondary`,onClick:ce,disabled:!l(`projects:read`),title:l(`projects:read`)?e(`projects.exportAll`):e(`projects.noExportPermission`),children:[(0,z.jsx)(M,{className:`w-4 h-4 mr-2`}),e(`projects.export`)]}),(0,z.jsxs)(v,{onClick:()=>m(!0),className:`sm:w-auto w-full`,disabled:!l(`projects:create`),title:l(`projects:create`)?void 0:e(`projects.noCreatePermission`),children:[(0,z.jsx)(D,{className:`w-4 h-4 mr-2`}),e(`projects.newProject`)]})]})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsx)(`div`,{className:`flex gap-1 p-1 bg-bambu-dark rounded-xl w-fit`,children:[{key:`active`,label:e(`projects.statusActive`),icon:T},{key:`completed`,label:e(`projects.statusCompleted`),icon:y},{key:`archived`,label:e(`projects.statusArchived`),icon:C},{key:`all`,label:e(`common.all`),icon:N}].map(({key:e,label:t,icon:n})=>(0,z.jsxs)(`button`,{onClick:()=>b(e),className:`flex items-center gap-2 px-4 py-2 text-sm rounded-lg transition-all ${_===e?`bg-bambu-card text-white shadow-sm`:`text-bambu-gray hover:text-white`}`,children:[(0,z.jsx)(n,{className:`w-4 h-4`}),(0,z.jsx)(`span`,{children:t}),ge[e]>0&&(0,z.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded-full ${_===e?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark-tertiary`}`,children:ge[e]})]},e))}),X.size>0&&(0,z.jsxs)(`button`,{type:`button`,onClick:B,"aria-pressed":A,title:e(A?`projects.expandSubProjects`:`projects.collapseSubProjects`),className:`flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg transition-colors ${A?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark`}`,children:[(0,z.jsx)(F,{className:`w-4 h-4`}),e(`common.collapse`)]})]}),te?(0,z.jsx)(`div`,{className:`flex items-center justify-center py-20`,children:(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,z.jsx)(p,{className:`w-8 h-8 animate-spin text-bambu-green`}),(0,z.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`projects.loading`)})]})}):G?.length===0?(0,z.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 px-4`,children:[(0,z.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-2xl mb-4`,children:(0,z.jsx)(N,{className:`w-12 h-12 text-bambu-gray/50`})}),(0,z.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:_===`all`?e(`projects.noProjects`):e(`projects.noProjectsFiltered`,{status:_})}),(0,z.jsx)(`p`,{className:`text-bambu-gray text-center max-w-md mb-6`,children:_===`all`?e(`projects.createFirst`):e(`projects.noProjectsFilteredHelp`,{status:_})}),_===`all`&&(0,z.jsxs)(v,{onClick:()=>m(!0),disabled:!l(`projects:create`),title:l(`projects:create`)?void 0:e(`projects.noCreatePermission`),children:[(0,z.jsx)(D,{className:`w-4 h-4 mr-2`}),e(`projects.createFirstButton`)]})]}):(0,z.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-8`,children:$.map(e=>ne(e,0,new Set))}),x!==null&&(0,z.jsx)(O,{title:e(`projects.deleteProject`),message:e(`projects.deleteConfirm`),confirmText:e(`projects.deleteProject`),variant:`danger`,onConfirm:he,onCancel:()=>S(null)}),f&&(0,z.jsx)(V,{project:h,onClose:()=>{m(!1),g(void 0)},onSave:de,isLoading:re.isPending||ie.isPending,currencySymbol:W,t:e})]})}export{V as ProjectModal,W as ProjectsPage,F as n,I as t}; \ No newline at end of file diff --git a/static/assets/QueryClientProvider-Ce8_sN3w.js b/static/assets/QueryClientProvider-Ce8_sN3w.js new file mode 100644 index 000000000..9caf4a370 --- /dev/null +++ b/static/assets/QueryClientProvider-Ce8_sN3w.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n}from"./client-DnySrlFv.js";var r=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},i={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},a=new class{#e=i;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function o(e){setTimeout(e,0)}var s=typeof window>`u`||`Deno`in globalThis;function c(){}function l(e,t){return typeof e==`function`?e(t):e}function u(e){return typeof e==`number`&&e>=0&&e!==1/0}function d(e,t){return Math.max(e+(t||0)-Date.now(),0)}function f(e,t){return typeof e==`function`?e(t):e}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==g(o,t.options))return!1}else if(!v(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function h(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(_(t.options.mutationKey)!==_(a))return!1}else if(!v(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function g(e,t){return(t?.queryKeyHashFn||_)(e)}function _(e){return JSON.stringify(e,(e,t)=>C(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function v(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>v(e[n],t[n])):!1}var y=Object.prototype.hasOwnProperty;function b(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=S(e)&&S(t);if(!r&&!(C(e)&&C(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{a.setTimeout(t,e)})}function E(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:b(e,t)}function D(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function O(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var k=Symbol();function A(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===k?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function j(e,t){return typeof e==`function`?e(...t):!!e}function M(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var N=new class extends r{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!s&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}};function P(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var F=o;function I(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=F,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var L=I(),R=new class extends r{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!s&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function z(e){return Math.min(1e3*2**e,3e4)}function B(e){return(e??`online`)===`online`?R.isOnline():!0}var V=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function H(e){let t=!1,n=0,r,i=P(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new V(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>N.isFocused()&&(e.networkMode===`always`||R.isOnline())&&e.canRun(),d=()=>B(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(s?0:3),o=e.retryDelay??z,c=typeof o==`function`?o(n,r):o,l=i===!0||typeof i==`number`&&nu()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var U=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),u(this.gcTime)&&(this.#e=a.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(s?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(a.clearTimeout(this.#e),void 0)}},W=e(n(),1),G=t(),K=W.createContext(void 0),q=e=>{let t=W.useContext(K);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},J=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,G.jsx)(K.Provider,{value:e,children:t}));export{k as A,v as C,f as D,p as E,a as M,r as N,x as O,c as S,b as T,g as _,B as a,h as b,L as c,M as d,D as f,_ as g,l as h,V as i,d as j,j as k,P as l,A as m,q as n,H as o,O as p,U as r,R as s,J as t,N as u,s as v,E as w,m as x,u as y}; \ No newline at end of file diff --git a/static/assets/QueuePage-Cx8xPABc.js b/static/assets/QueuePage-Cx8xPABc.js new file mode 100644 index 000000000..ae0f35d31 --- /dev/null +++ b/static/assets/QueuePage-Cx8xPABc.js @@ -0,0 +1,16 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,t as i,w as a}from"./client-DnySrlFv.js";import{n as o}from"./QueryClientProvider-Ce8_sN3w.js";import{t as s}from"./useQuery-BBCjCezC.js";import{t as c}from"./useMutation-B-Tr2hIP.js";import{t as l}from"./useQueries-Be6PMvSC.js";import{t as u}from"./createLucideIcon-DvBYJlWL.js";import{t as d}from"./arrow-down-Cj0DZhNf.js";import{t as f}from"./arrow-up-D-pfJ3WZ.js";import{a as p,c as m,d as h,f as g,h as _,i as v,l as y,m as b,o as x,p as S,s as ee,t as C,u as te}from"./sortable.esm-D2bGix-3.js";import{t as w}from"./calendar-BLKPnWqV.js";import{t as ne}from"./check-Ck0cMLU4.js";import{a as T,i as re,n as E,r as D}from"./info-ROUoQhJR.js";import{n as O,r as k}from"./ToastContext-BRX0SW3C.js";import{t as A}from"./coins-4u6IPkR-.js";import{t as j}from"./funnel-C3dyAMK9.js";import{t as M}from"./grip-vertical-C_1RDxRw.js";import{t as ie}from"./list-CLcpeoSz.js";import{t as ae}from"./loader-circle-BEmFtawu.js";import{t as N}from"./package-BGUevlqS.js";import{t as P}from"./pause-DFb6GX_6.js";import{t as oe}from"./play-DIDYtk2S.js";import{t as F}from"./skip-forward-BsuMfFkw.js";import{t as I}from"./timer-GUTR9dAu.js";import{t as L}from"./triangle-alert-Dt_1FcBy.js";import{t as se}from"./workflow-BgT0wW83.js";import{t as ce}from"./x-DR-Trv6U.js";import{t as le}from"./Card-Bzc64K35.js";import{t as R}from"./Button-DDr6eAFy.js";import{c as ue,o as de,u as fe,v as z}from"./date-G9KUauqz.js";import{$t as pe,A as me,At as he,Cn as ge,En as _e,Gt as B,H as ve,Jt as ye,Kt as V,Lt as be,Mn as xe,On as H,Ot as Se,Rn as Ce,Rt as we,T as U,W,Yt as Te,_t as Ee,at as De,b as Oe,cn as ke,ct as G,jn as Ae,jt as je,mn as Me,on as Ne,w as K,wt as Pe,xn as Fe,yt as Ie}from"./index-CovRLYqQ.js";import{t as Le}from"./queueItemName-UFY7kpjG.js";var Re=u(`chart-no-axes-gantt`,[[`path`,{d:`M6 5h12`,key:`fvfigv`}],[`path`,{d:`M4 12h10`,key:`oujl3d`}],[`path`,{d:`M12 19h8`,key:`baeox8`}]]),ze=u(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Be=u(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),Ve=u(`package-open`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),He=u(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),Ue=u(`ungroup`,[[`rect`,{width:`8`,height:`6`,x:`5`,y:`4`,rx:`1`,key:`nzclkv`}],[`rect`,{width:`8`,height:`6`,x:`11`,y:`14`,rx:`1`,key:`4tytwb`}]]),q=e(n(),1),J=t(),We=[``,`queued`,`slicing`,`dispatching`,`in_progress`,`completed`,`partial_failure`,`failed`,`cancelled`],Y=25;function Ge(){let{t:e}=a(),t=o(),{showToast:n}=O(),[i,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(0),[g,_]=(0,q.useState)(new Set),[v,y]=(0,q.useState)(!1),{data:b}=s({queryKey:[`slicer-pipelines`],queryFn:()=>r.listSlicerPipelines()}),{data:x}=s({queryKey:[`printers`],queryFn:()=>r.getPrinters()}),S=(x??[]).reduce((e,t)=>(e[t.id]=t,e),{}),ee=f.startsWith(`p:`)?parseInt(f.slice(2),10):void 0,C=f.startsWith(`c:`)?f.slice(2):void 0,{data:te,isLoading:w}=s({queryKey:[`pipeline-runs-all`,i,u,m,f],queryFn:()=>r.listAllPipelineRuns({limit:Y,offset:m,pipelineId:u??void 0,status:i||void 0,targetPrinterId:ee,targetModelClass:C}),refetchInterval:15e3}),ne=c({mutationFn:e=>r.cancelPipelineRun(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`pipeline-runs-all`]}),n(e(`pipelineRuns.toast.cancelled`,`Run cancelled`),`success`)},onError:t=>n(t.message||e(`pipelineRuns.toast.cancelFailed`,`Cancel failed`),`error`)}),T=c({mutationFn:e=>r.retryFailedPipelineRun(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`pipeline-runs-all`]}),n(e(`pipelineRuns.toast.retryStarted`,`Retry started`),`success`)},onError:t=>n(t.message||e(`pipelineRuns.toast.retryFailed`,`Retry failed`),`error`)}),re=c({mutationFn:()=>r.clearTerminalPipelineRuns(),onSuccess:r=>{t.invalidateQueries({queryKey:[`pipeline-runs-all`]}),y(!1),h(0),n(e(`pipelineRuns.toast.cleared`,`{{n}} runs cleared`,{n:r.deleted}),`success`)},onError:t=>n(t.message||e(`pipelineRuns.toast.clearFailed`,`Clear failed`),`error`)}),E=te?.runs??[],D=te?.total??0,k=(b?.pipelines??[]).reduce((e,t)=>(e[t.id]=t,e),{}),A=e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},M=!!(i||u!==null||f),ie=(()=>{let e=new Set,t=new Set;for(let n of b?.pipelines??[])n.target_kind===`printer_class`&&n.target_model_class?t.add(n.target_model_class):n.target_printer_id&&e.add(n.target_printer_id);return{printers:(x??[]).filter(t=>e.has(t.id)),classes:Array.from(t).sort()}})();return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-4 text-sm`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>t.invalidateQueries({queryKey:[`pipeline-runs-all`]}),"aria-label":e(`common.refresh`,`Refresh`),title:e(`common.refresh`,`Refresh`),className:`p-1.5 text-bambu-gray hover:text-white border border-bambu-dark-tertiary rounded`,children:(0,J.jsx)(V,{className:`w-3.5 h-3.5`})}),(0,J.jsx)(qe,{icon:(0,J.jsx)(se,{className:`w-3.5 h-3.5 text-bambu-gray`}),ariaLabel:e(`pipelineRuns.filter.pipeline`,`Pipeline`),value:u===null?``:String(u),onChange:e=>{h(0),d(e?parseInt(e,10):null)},options:[{value:``,label:e(`pipelineRuns.filter.allPipelines`,`All pipelines`)},...(b?.pipelines??[]).map(e=>({value:String(e.id),label:e.name}))]}),(0,J.jsx)(qe,{icon:(0,J.jsx)(j,{className:`w-3.5 h-3.5 text-bambu-gray`}),ariaLabel:e(`pipelineRuns.filter.status`,`Status`),value:i,onChange:e=>{h(0),l(e)},options:We.map(t=>({value:t,label:t===``?e(`pipelineRuns.filter.allStatus`,`All statuses`):e(`settings.pipelines.runs.status.${t}`,t)}))}),(ie.printers.length>0||ie.classes.length>0)&&(0,J.jsx)(qe,{icon:(0,J.jsx)(ye,{className:`w-3.5 h-3.5 text-bambu-gray`}),ariaLabel:e(`pipelineRuns.filter.target`,`Target`),value:f,onChange:e=>{h(0),p(e)},options:[{value:``,label:e(`pipelineRuns.filter.allTargets`,`All targets`)},...ie.printers.map(t=>({value:`p:${t.id}`,label:t.name,group:e(`settings.pipelines.field.targetKindSpecific`,`Specific printer`)})),...ie.classes.map(t=>({value:`c:${t}`,label:e(`library.runWithPipeline.classTarget`,`Any {{model}}`,{model:t}),group:e(`settings.pipelines.field.targetKindClass`,`Printer class`)}))]}),M&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>{l(``),d(null),p(``),h(0)},className:`text-xs text-bambu-gray hover:text-white`,children:e(`pipelineRuns.filter.clear`,`Clear filters`)}),(0,J.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 text-xs text-bambu-gray`,children:[!w&&D>0&&(0,J.jsx)(`span`,{children:e(`pipelineRuns.totalCount`,`{{n}} run`,{n:D,count:D})}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>y(!0),disabled:D===0,className:`flex items-center gap-1 px-2 py-1 text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-500/10 rounded disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,J.jsx)(he,{className:`w-3 h-3`}),e(`pipelineRuns.clearLog`,`Clear log`)]})]})]}),v&&(0,J.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4`,onClick:()=>y(!1),role:`dialog`,"aria-modal":`true`,children:(0,J.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-2xl w-full max-w-md p-4`,onClick:e=>e.stopPropagation(),children:[(0,J.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,J.jsx)(he,{className:`w-4 h-4 text-red-600 dark:text-red-400`}),e(`pipelineRuns.clearConfirmTitle`,`Clear log?`)]}),(0,J.jsx)(`p`,{className:`text-sm text-bambu-gray mt-2`,children:e(`pipelineRuns.clearConfirmBody`,`Delete every completed, failed, cancelled, and partial-failure pipeline run? In-flight runs are kept. This cannot be undone.`)}),(0,J.jsxs)(`div`,{className:`flex items-center justify-end gap-2 mt-4`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>y(!1),disabled:re.isPending,className:`px-3 py-1.5 text-sm text-bambu-gray hover:text-white`,children:e(`common.cancel`,`Cancel`)}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>re.mutate(),disabled:re.isPending,className:`px-3 py-1.5 text-sm bg-red-500 hover:bg-red-600 text-white rounded disabled:opacity-50 flex items-center gap-1`,children:[re.isPending?(0,J.jsx)(ae,{className:`w-3.5 h-3.5 animate-spin`}):(0,J.jsx)(he,{className:`w-3.5 h-3.5`}),e(`pipelineRuns.clearConfirmAction`,`Clear`)]})]})]})}),w&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,J.jsx)(ae,{className:`w-4 h-4 animate-spin`}),e(`pipelineRuns.loading`,`Loading…`)]}),!w&&E.length===0&&(0,J.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:M?e(`pipelineRuns.filter.noMatches`,`No runs match the current filters.`):e(`pipelineRuns.empty`,`No pipeline runs yet.`)}),!w&&E.length>0&&(0,J.jsx)(`div`,{className:`space-y-1.5`,children:E.map(e=>(0,J.jsx)(Ke,{run:e,pipeline:e.pipeline_id?k[e.pipeline_id]:void 0,printersById:S,expanded:g.has(e.id),onToggle:()=>A(e.id),onCancel:()=>ne.mutate(e.id),onRetry:()=>T.mutate(e.id),cancelling:ne.isPending,retrying:T.isPending},e.id))}),!w&&D>Y&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between mt-4 text-sm`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(Math.max(0,m-Y)),disabled:m===0,className:`px-3 py-1.5 rounded border border-bambu-dark-tertiary disabled:opacity-50 text-bambu-gray hover:text-white`,children:e(`common.previous`,`Previous`)}),(0,J.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:e(`pipelineRuns.pagination`,`{{start}}–{{end}} of {{total}}`,{start:m+1,end:Math.min(m+Y,D),total:D})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(m+Y),disabled:m+Y>=D,className:`px-3 py-1.5 rounded border border-bambu-dark-tertiary disabled:opacity-50 text-bambu-gray hover:text-white`,children:e(`common.next`,`Next`)})]})]})}function Ke({run:e,pipeline:t,printersById:n,expanded:r,onToggle:i,onCancel:o,onRetry:s,cancelling:c,retrying:l}){let{t:u}=a(),d=[`queued`,`slicing`,`dispatching`,`in_progress`].includes(e.status),f=e.status===`partial_failure`||e.status===`failed`,p=e.status===`cancelled`&&e.error_message===`Cancelled by user`,m=e.target_kind===`printer_class`&&e.target_model_class?u(`library.runWithPipeline.classTarget`,`Any {{model}}`,{model:e.target_model_class}):e.target_printer_id&&n[e.target_printer_id]?n[e.target_printer_id].name:null;return(0,J.jsxs)(`div`,{className:`rounded-md border border-bambu-dark-tertiary bg-bambu-dark/40 overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:i,"aria-label":r?u(`common.collapse`,`Collapse`):u(`common.expand`,`Expand`),"aria-expanded":r,className:`text-bambu-gray hover:text-white flex-shrink-0`,children:r?(0,J.jsx)(T,{className:`w-4 h-4`}):(0,J.jsx)(xe,{className:`w-4 h-4`})}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,J.jsxs)(`span`,{className:`font-medium text-white`,children:[`#`,e.id]}),(0,J.jsx)(`span`,{className:`text-white truncate`,children:t?.name??e.pipeline_name??`—`}),(0,J.jsx)(X,{status:e.status}),m&&(0,J.jsxs)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bambu-dark-tertiary text-bambu-gray flex items-center gap-1`,children:[(0,J.jsx)(ye,{className:`w-3 h-3`}),m]}),e.parent_run_id&&(0,J.jsx)(`span`,{className:`text-xs text-bambu-gray/70 italic`,children:u(`pipelineRuns.retryOf`,`retry of #{{n}}`,{n:e.parent_run_id})})]}),e.source_filename&&(0,J.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-xs text-bambu-gray min-w-0`,children:[(0,J.jsx)(Fe,{className:`w-3 h-3 flex-shrink-0`}),(0,J.jsx)(`span`,{className:`truncate`,title:e.source_filename,children:e.source_filename})]}),(0,J.jsxs)(`div`,{className:`mt-0.5 text-xs text-bambu-gray/70 flex flex-wrap items-center gap-x-2`,children:[(0,J.jsx)(`span`,{children:new Date(e.created_at).toLocaleString()}),e.copies>1&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-bambu-gray/40`,children:`·`}),(0,J.jsx)(`span`,{children:u(`pipelineRuns.copies`,`{{n}} copies`,{n:e.copies})})]}),(e.copies_completed>0||e.copies_failed>0||e.copies_cancelled>0)&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-bambu-gray/40`,children:`·`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`text-bambu-green`,children:e.copies_completed}),`/`,e.copies]}),e.copies_failed>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-bambu-gray/40`,children:`·`}),(0,J.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:u(`pipelineRuns.failedCount`,`{{n}} failed`,{n:e.copies_failed})})]})]})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[d&&(0,J.jsxs)(`button`,{type:`button`,onClick:o,disabled:c,"aria-label":u(`common.cancel`,`Cancel`),className:`text-xs px-2 py-1 text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-500/10 rounded disabled:opacity-50 flex items-center gap-1`,children:[(0,J.jsx)(ce,{className:`w-3 h-3`}),u(`common.cancel`,`Cancel`)]}),f&&(0,J.jsxs)(`button`,{type:`button`,onClick:s,disabled:l,"aria-label":u(`pipelineRuns.retryFailed`,`Retry failed`),className:`text-xs px-2 py-1 text-bambu-green hover:bg-bambu-green/10 rounded disabled:opacity-50 flex items-center gap-1`,children:[(0,J.jsx)(B,{className:`w-3 h-3`}),u(`pipelineRuns.retryFailed`,`Retry failed`)]})]})]}),r&&(0,J.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary px-3 py-2 bg-bambu-dark/30`,children:[(0,J.jsx)(`div`,{className:`space-y-1.5`,children:e.jobs.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-bambu-gray/60 w-14 flex-shrink-0`,children:u(`pipelineRuns.copyN`,`Copy {{n}}`,{n:e.copy_index+1})}),(0,J.jsx)(Je,{status:e.status}),e.assigned_printer_name&&(0,J.jsxs)(`span`,{className:`text-bambu-gray flex items-center gap-1 truncate`,children:[(0,J.jsx)(ye,{className:`w-3 h-3 text-bambu-gray/60`}),(0,J.jsx)(`span`,{className:`text-white truncate`,children:e.assigned_printer_name})]}),e.error_message&&(0,J.jsx)(`span`,{className:`text-red-700 dark:text-red-400 truncate`,title:e.error_message,children:e.error_message})]},e.id))}),e.error_message&&!p&&(0,J.jsx)(`div`,{className:`text-xs text-red-700 dark:text-red-400 mt-2 pt-2 border-t border-bambu-dark-tertiary`,children:e.error_message}),p&&(0,J.jsx)(`div`,{className:`text-xs text-bambu-gray/70 mt-2 pt-2 border-t border-bambu-dark-tertiary italic`,children:u(`pipelineRuns.cancelledByUser`,`Cancelled by user`)})]})]})}function X({status:e}){let{t}=a();return(0,J.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] uppercase font-semibold tracking-wide whitespace-nowrap ${{queued:`bg-slate-700 text-slate-200`,slicing:`bg-sky-700 text-sky-100`,dispatching:`bg-sky-700 text-sky-100`,in_progress:`bg-emerald-700 text-emerald-100`,completed:`bg-emerald-700 text-emerald-100`,failed:`bg-red-700 text-red-100`,partial_failure:`bg-amber-700 text-amber-100`,cancelled:`bg-rose-900 text-rose-200`}[e]}`,children:t(`settings.pipelines.runs.status.${e}`,e)})}function qe({value:e,onChange:t,options:n,icon:r,ariaLabel:i}){let[a,o]=(0,q.useState)(!1),s=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[a]);let c=n.find(t=>t.value===e),l=[];for(let e of n){let t=l[l.length-1];t&&t.group===e.group?t.options.push(e):l.push({group:e.group,options:[e]})}return(0,J.jsxs)(`div`,{ref:s,className:`relative`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-label":i,"aria-haspopup":`listbox`,"aria-expanded":a,className:`flex items-center gap-1.5 px-2 py-1 border border-bambu-dark-tertiary rounded bg-bambu-dark/40 text-xs text-white hover:border-bambu-gray/60 focus:outline-none focus:ring-1 focus:ring-bambu-green/40`,children:[r,(0,J.jsx)(`span`,{className:`truncate max-w-[14rem]`,children:c?.label??``}),(0,J.jsx)(T,{className:`w-3 h-3 text-bambu-gray transition-transform ${a?`rotate-180`:``}`})]}),a&&(0,J.jsx)(`div`,{role:`listbox`,className:`absolute left-0 top-full mt-1 z-30 min-w-full max-h-72 overflow-auto rounded border border-bambu-dark-tertiary bg-bambu-dark-secondary shadow-xl py-1`,children:l.map((n,r)=>(0,J.jsxs)(`div`,{children:[n.group&&(0,J.jsx)(`div`,{className:`px-2 pt-1.5 pb-0.5 text-[10px] uppercase tracking-wider text-bambu-gray/60`,children:n.group}),n.options.map(n=>{let r=n.value===e;return(0,J.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":r,onClick:()=>{t(n.value),o(!1)},className:`flex w-full items-center gap-1.5 text-left px-2 py-1 text-xs whitespace-nowrap ${r?`bg-bambu-dark-tertiary text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary/60 hover:text-white`}`,children:[(0,J.jsx)(ne,{className:`w-3 h-3 flex-shrink-0 ${r?`opacity-100`:`opacity-0`}`}),(0,J.jsx)(`span`,{className:`truncate`,children:n.label})]},n.value)})]},r))})]})}function Je({status:e}){let{t}=a();return(0,J.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] uppercase font-semibold tracking-wide ${{pending:`bg-slate-700 text-slate-200`,awaiting_printer:`bg-sky-700 text-sky-100`,queued:`bg-sky-700 text-sky-100`,printing:`bg-emerald-700 text-emerald-100`,completed:`bg-emerald-700 text-emerald-100`,failed:`bg-red-700 text-red-100`,cancelled:`bg-rose-900 text-rose-200`}[e]}`,children:t(`pipelineRuns.jobStatus.${e}`,e)})}function Ye(e){return e>=1e3?`${(e/1e3).toFixed(1)}kg`:`${Math.round(e)}g`}function Xe({activeCount:e,pendingCount:t,totalTime:n,totalWeight:r,historyCount:i,t:a}){return(0,J.jsx)(`div`,{className:`flex items-center gap-3 sm:gap-5 flex-wrap px-4 py-3 bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary mb-6`,children:[{icon:oe,value:e,label:a(`queue.summary.printing`),color:`text-blue-600 dark:text-blue-400`},{icon:H,value:t,label:a(`queue.summary.queued`),color:`text-yellow-600 dark:text-yellow-400`},{icon:I,value:de(n),label:a(`queue.summary.totalTime`),color:`text-bambu-green`},{icon:Pe,value:Ye(r),label:a(`queue.summary.totalWeight`),color:`text-purple-600 dark:text-purple-400`},{icon:k,value:i,label:a(`queue.summary.history`),color:`text-bambu-gray`}].map((e,t)=>(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t>0&&(0,J.jsx)(`span`,{className:`hidden sm:block text-bambu-dark-tertiary`,children:`|`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(e.icon,{className:`w-4 h-4 ${e.color}`}),(0,J.jsx)(`span`,{className:`text-sm font-semibold text-white`,children:e.value}),(0,J.jsx)(`span`,{className:`text-xs sm:text-sm text-bambu-gray`,children:e.label})]})]},t))})}var Z={completed:{icon:k,color:`text-emerald-600 dark:text-emerald-400`,border:`border-l-emerald-500`},failed:{icon:E,color:`text-red-600 dark:text-red-400`,border:`border-l-red-500`},skipped:{icon:F,color:`text-orange-600 dark:text-orange-400`,border:`border-l-gray-500`},cancelled:{icon:_,color:`text-gray-400`,border:`border-l-gray-500`}};function Ze(e){if(!e)return null;let t=e.startsWith(`#`)?e.slice(1):e;return/^0{6,8}$/.test(t)||!/^[0-9a-fA-F]{6,8}$/.test(t)?null:`#${t.slice(0,6)}`}function Qe({item:e,onRequeue:t,onRemove:n,timeFormat:i=`system`,hasPermission:a,canModify:o,t:s}){let c=Z[e.status]||Z.cancelled,l=c.icon,u=Le(e),d=e.archive_thumbnail?r.getArchiveThumbnail(e.archive_id):e.library_file_thumbnail?r.getLibraryFileThumbnailUrl(e.library_file_id):null,f=e.completed_at||e.created_at,p=Ze(e.filament_color),m=e.filament_used_grams?Math.round(e.filament_used_grams):null,h=!!e.error_message&&(e.status===`failed`||e.status===`skipped`);return(0,J.jsxs)(`div`,{className:`px-3 py-2 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary border-l-[3px] ${c.border}`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3`,children:[(0,J.jsx)(l,{className:`w-4 h-4 shrink-0 ${c.color}`}),(0,J.jsxs)(`div`,{className:`relative shrink-0 history-thumb-hover`,children:[(0,J.jsx)(`div`,{className:`w-8 h-8 bg-bambu-dark rounded overflow-hidden`,children:d?(0,J.jsx)(`img`,{src:d,alt:``,className:`w-full h-full object-cover`}):(0,J.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-bambu-gray`,children:(0,J.jsx)(ke,{className:`w-4 h-4`})})}),d&&(0,J.jsx)(`div`,{className:`history-thumb-preview absolute z-[60] left-full top-0 ml-2 w-48 h-48 pointer-events-none opacity-0 transition-opacity`,children:(0,J.jsx)(`img`,{src:d,alt:``,className:`w-full h-full object-cover rounded-lg shadow-2xl border-2 border-bambu-dark-tertiary bg-bambu-dark`})})]}),(0,J.jsx)(`span`,{className:`text-sm text-white font-medium truncate min-w-0 flex-1`,children:u}),(0,J.jsx)(`span`,{className:`text-xs text-bambu-gray shrink-0`,title:f??void 0,children:fe(f,i,s)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:t,disabled:!a(`queue:create`),title:a(`queue:create`)?s(`queue.actions.requeue`):s(`queue.permissions.noRequeue`),className:`text-bambu-green hover:text-bambu-green/80 hover:bg-bambu-green/10 p-1.5`,children:(0,J.jsx)(V,{className:`w-3.5 h-3.5`})}),(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:n,disabled:!o(`queue`,`delete`,e.created_by_id),title:o(`queue`,`delete`,e.created_by_id)?s(`common.remove`):s(`queue.permissions.noRemove`),className:`p-1.5`,children:(0,J.jsx)(he,{className:`w-3.5 h-3.5`})})]})]}),(0,J.jsxs)(`div`,{className:`mt-1 ml-[3.25rem] flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-bambu-gray`,children:[e.printer_name&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,children:[(0,J.jsx)(ye,{className:`w-3 h-3`}),(0,J.jsx)(`span`,{className:`truncate max-w-[100px] sm:max-w-[140px]`,children:e.printer_name})]}),(p||m)&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,children:[p?(0,J.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full border border-white/15`,style:{backgroundColor:p},"aria-hidden":!0}):(0,J.jsx)(Pe,{className:`w-3 h-3`}),(0,J.jsxs)(`span`,{className:`truncate`,children:[m?`${m}g`:null,m&&e.filament_type?` ${e.filament_type}`:null,!m&&e.filament_type?e.filament_type:null]})]}),e.print_time_seconds&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,children:[(0,J.jsx)(I,{className:`w-3 h-3`}),de(e.print_time_seconds)]}),e.created_by_username&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,title:s(`queue.addedBy`,{name:e.created_by_username}),children:[(0,J.jsx)(Se,{className:`w-3 h-3`}),(0,J.jsx)(`span`,{className:`truncate max-w-[120px]`,children:e.created_by_username})]})]}),h&&(0,J.jsxs)(`div`,{className:`mt-1 ml-[3.25rem] flex items-start gap-1 text-xs text-red-700 dark:text-red-400`,children:[(0,J.jsx)(D,{className:`w-3 h-3 mt-0.5 shrink-0`}),(0,J.jsx)(`span`,{className:`break-words`,children:e.error_message})]})]})}function $e(e){return e.printer_id==null?e.target_model?`model:${e.target_model}`:`unassigned`:`printer:${e.printer_id}`}function et(e,t,n){if(n){let n=+!!e.been_jumped,r=+!!t.been_jumped;if(n!==r)return r-n;let i=e.print_time_seconds??1/0,a=t.print_time_seconds??1/0;if(i!==a)return i-a}return e.position===t.position?(e.id??0)-(t.id??0):e.position-t.position}function tt(e){return e?e.split(` | `).map(e=>e.trim()).every(e=>e.startsWith(`Busy:`)):!1}var nt=3600*1e3,rt=24,it=rt*nt,at=32,ot=40;function st(e){return e.toLocaleTimeString(void 0,{hour:`numeric`})}function ct(e){return e.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function lt({queueItems:e,printers:t,printerStatuses:n,sjfEnabled:i,onItemClick:a,t:o}){let[s,c]=(0,q.useState)(()=>new Date);(0,q.useEffect)(()=>{let e=setInterval(()=>c(new Date),6e4);return()=>clearInterval(e)},[]);let[l,u]=(0,q.useState)(0),d=(0,q.useMemo)(()=>{let e=s.getTime()+l;return Math.floor(e/nt)*nt},[s,l]),f=d+it,p=s.getTime(),m=(0,q.useMemo)(()=>{let t=[],r=new Map,a=new Set,o=new Map;for(let i of e)if(i.status===`printing`){let e=i.printer_id==null?void 0:n[i.printer_id],r=z(i.started_at)||new Date,s;if(e?.remaining_time!=null&&e.remaining_time>0)s=new Date(p+e.remaining_time*60*1e3);else if(i.print_time_seconds){let t=e?.progress||0,n=Math.max(0,1-t/100);s=new Date(p+i.print_time_seconds*n*1e3)}else s=new Date(p+nt);t.push({item:i,estimatedStart:r,estimatedEnd:s,progress:e?.progress??void 0,type:`printing`});let c=$e(i);a.add(c),o.set(c,Math.max(o.get(c)??p,s.getTime()))}else if(i.status===`pending`){if(i.manual_start||i.waiting_reason&&!tt(i.waiting_reason))continue;let e=$e(i);r.has(e)||r.set(e,[]),r.get(e).push(i)}let s=Date.now()+4320*nt;for(let[e,n]of r){n.sort((e,t)=>et(e,t,i));let r=a.has(e),c=n[0]?z(n[0].scheduled_time):null,l=c&&c.getTime()<=s;if(!r&&!l)continue;let u=o.get(e)??p;for(let e of n){let n=z(e.scheduled_time);n&&n.getTime()<=s&&(u=Math.max(u,n.getTime()));let r=(e.print_time_seconds||3600)*1e3;t.push({item:e,estimatedStart:new Date(u),estimatedEnd:new Date(u+r),type:`queued`}),u+=r}}return t},[e,n,p,i]),h=(0,q.useMemo)(()=>{let e=[];for(let n of t)e.push({key:`printer:${n.id}`,label:n.name,printerId:n.id,targetModel:null});let n=new Set,r=!1;for(let t of m)if(t.item.printer_id==null)if(t.item.target_model){let r=`model:${t.item.target_model}`;n.has(r)||(n.add(r),e.push({key:r,label:`${o(`queue.filter.any`)} ${t.item.target_model}`,printerId:null,targetModel:t.item.target_model}))}else r=!0;return r&&e.push({key:`unassigned`,label:o(`queue.filter.unassigned`),printerId:null,targetModel:null}),e},[t,m,o]),g=(0,q.useMemo)(()=>{let e=new Map;for(let t of m){let n;n=t.item.printer_id==null?t.item.target_model?`model:${t.item.target_model}`:`unassigned`:`printer:${t.item.printer_id}`,e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[m]),_=(0,q.useMemo)(()=>{let e=[];for(let t=0;t<=rt;t+=2){let n=d+t*nt;e.push({ms:n,pct:t/rt*100,label:st(new Date(n))})}return e},[d]),v=(p-d)/it*100,y=v>=0&&v<=100,b=(0,q.useMemo)(()=>{let e=0;for(let t of m)e=Math.max(e,t.estimatedEnd.getTime());return e>0?new Date(e):null},[m]),x=(0,q.useRef)(null);return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>e-12*nt),className:`p-1.5`,title:o(`queue.timeline.window.back12h`),children:(0,J.jsx)(Ae,{className:`w-4 h-4`})}),(0,J.jsxs)(`span`,{className:`text-sm font-medium text-white min-w-[180px] text-center`,children:[new Date(d).toLocaleString(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),` → `,new Date(f).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})]}),(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>e+12*nt),className:`p-1.5`,title:o(`queue.timeline.window.forward12h`),children:(0,J.jsx)(xe,{className:`w-4 h-4`})}),l!==0&&(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:()=>u(0),className:`text-xs text-bambu-green`,children:o(`queue.timeline.window.now`)})]}),b&&(0,J.jsxs)(`span`,{className:`text-xs text-bambu-gray flex items-center gap-1.5`,children:[(0,J.jsx)(H,{className:`w-3.5 h-3.5`}),o(`queue.timeline.allDoneBy`,{time:b.toLocaleString(void 0,{weekday:`short`,hour:`2-digit`,minute:`2-digit`})})]})]}),h.length>0&&m.length===0&&(0,J.jsx)(`div`,{className:`mb-4 p-3 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark/40 text-xs text-bambu-gray`,children:o(`queue.timeline.nothingCommitted`)}),h.length===0?(0,J.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-bambu-gray`,children:[(0,J.jsx)(ke,{className:`w-12 h-12 mb-3 opacity-30`}),(0,J.jsx)(`p`,{className:`text-sm`,children:o(`queue.timeline.noData`)})]}):(0,J.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`flex border-b border-bambu-dark-tertiary`,children:[(0,J.jsx)(`div`,{className:`w-32 sm:w-40 shrink-0 px-3 py-2 text-xs font-medium text-bambu-gray border-r border-bambu-dark-tertiary`,children:o(`queue.timeline.printerColumnHeader`)}),(0,J.jsx)(`div`,{className:`relative flex-1 h-9`,children:_.map(e=>(0,J.jsx)(`div`,{className:`absolute top-0 bottom-0 border-l border-bambu-dark-tertiary/40 text-[10px] sm:text-xs text-bambu-gray pl-1 flex items-center`,style:{left:`${e.pct}%`},children:e.label},e.ms))})]}),(0,J.jsxs)(`div`,{ref:x,className:`relative`,children:[h.map(e=>{let t=g.get(e.key)??[];return(0,J.jsxs)(`div`,{className:`flex border-b border-bambu-dark-tertiary/40 last:border-b-0`,children:[(0,J.jsxs)(`div`,{className:`w-32 sm:w-40 shrink-0 px-3 py-3 border-r border-bambu-dark-tertiary flex items-center gap-2`,children:[(0,J.jsx)(ye,{className:`w-3.5 h-3.5 shrink-0 ${e.printerId==null&&e.targetModel==null?`text-orange-600 dark:text-orange-400`:e.targetModel?`text-blue-600 dark:text-blue-400`:`text-bambu-green`}`}),(0,J.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.label})]}),(0,J.jsxs)(`div`,{className:`relative flex-1`,style:{height:56},children:[_.map(e=>(0,J.jsx)(`div`,{className:`absolute top-0 bottom-0 border-l border-bambu-dark-tertiary/30`,style:{left:`${e.pct}%`}},e.ms)),(0,J.jsx)(`div`,{className:`absolute inset-0 opacity-30`,style:{backgroundImage:`repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(255,255,255,0.04) 6px, rgba(255,255,255,0.04) 12px)`},"aria-hidden":!0}),t.map(e=>{let t=Math.max(d,e.estimatedStart.getTime()),n=Math.min(f,e.estimatedEnd.getTime());if(n<=d||t>=f)return null;let i=(t-d)/it*100,o=(n-t)/it*100,s=e.item.archive_name||e.item.library_file_name||`#${e.item.id}`,c=e.item.archive_thumbnail?r.getArchiveThumbnail(e.item.archive_id):e.item.library_file_thumbnail?r.getLibraryFileThumbnailUrl(e.item.library_file_id):null,l=e.type===`printing`,u=e.item.batch_id!=null;return(0,J.jsxs)(`button`,{onClick:()=>a(e.item),title:[s,`${ct(e.estimatedStart)} → ${ct(e.estimatedEnd)}`,e.item.print_time_seconds?de(e.item.print_time_seconds):null,l&&e.progress!=null?`${Math.round(e.progress)}%`:null,e.item.batch_name?`batch: ${e.item.batch_name}`:null].filter(Boolean).join(` · `),className:`absolute rounded-md transition-all hover:brightness-110 hover:z-10 overflow-hidden flex items-center gap-1.5 px-1.5 text-left ${l?`bg-blue-500/30 border border-blue-400/60`:u?`bg-cyan-500/20 border border-cyan-400/50`:`bg-bambu-green/20 border border-bambu-green/40`}`,style:{left:`${i}%`,width:`max(${at}px, ${o}%)`,top:8,height:ot},children:[c&&(0,J.jsx)(`img`,{src:c,alt:``,className:`w-7 h-7 rounded object-cover shrink-0 bg-bambu-dark`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-xs text-white font-medium truncate leading-tight`,children:s}),(0,J.jsxs)(`div`,{className:`text-[10px] text-bambu-gray truncate leading-tight`,children:[e.item.print_time_seconds?de(e.item.print_time_seconds):``,l&&e.progress!=null?` · ${Math.round(e.progress)}%`:``]})]}),l&&e.progress!=null&&(0,J.jsx)(`div`,{className:`absolute bottom-0 left-0 h-0.5 bg-blue-300`,style:{width:`${e.progress}%`},"aria-hidden":!0})]},e.item.id)})]})]},e.key)}),y&&(0,J.jsxs)(`div`,{className:`absolute top-0 bottom-0 pointer-events-none z-20 flex inset-x-0`,children:[(0,J.jsx)(`div`,{className:`w-32 sm:w-40 shrink-0`}),(0,J.jsx)(`div`,{className:`relative flex-1`,children:(0,J.jsx)(`div`,{className:`absolute top-0 bottom-0 w-0.5 bg-red-400 shadow-[0_0_8px_rgba(248,113,113,0.6)]`,style:{left:`${v}%`},children:(0,J.jsx)(`div`,{className:`absolute -top-1 -left-1 w-2.5 h-2.5 bg-red-400 rounded-full`})})})]})]})]})]})}function ut({hasPermission:e,t,focusBatchId:n=null}){let i=o(),{showToast:a}=O(),[l,u]=(0,q.useState)(n?`all`:`active`),[d,f]=(0,q.useState)(null),{data:p}=s({queryKey:[`settings`],queryFn:r.getSettings}),m=De(p?.currency||`USD`),{data:h,isLoading:g}=s({queryKey:[`batches`,l],queryFn:()=>r.getBatches(l===`all`?void 0:l)}),_=n!=null&&!!h?.some(e=>e.id===n);(0,q.useEffect)(()=>{_&&document.getElementById(`batch-${n}`)?.scrollIntoView({block:`center`})},[_,n]);let v=()=>{i.invalidateQueries({queryKey:[`batches`]}),i.invalidateQueries({queryKey:[`queue`]})},y=c({mutationFn:({id:e,plateId:t})=>r.dispatchBatch(e,t===void 0?{}:{plate_id:t,only_plate:!0}),onSuccess:e=>{v(),a(t(`queue.batchOrders.dispatched`,{name:e.name}),`success`)},onError:e=>a(e.message,`error`)}),b=c({mutationFn:e=>r.cancelBatch(e),onSuccess:()=>{v(),f(null),a(t(`queue.batchCancelled`),`success`)},onError:e=>a(e.message,`error`)}),x=e(`queue:create`),S=e(`queue:delete_all`);return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-4`,children:[(0,J.jsx)(N,{className:`w-5 h-5 text-cyan-700 dark:text-cyan-300`}),(0,J.jsx)(`h2`,{className:`text-base sm:text-lg font-semibold text-white`,children:t(`queue.batchOrders.title`)}),(0,J.jsx)(`div`,{className:`flex gap-1 ml-auto`,children:[`active`,`completed`,`cancelled`,`all`].map(e=>(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`text-xs px-2.5 py-1 rounded-full border transition-colors ${l===e?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-gray`}`,children:t(`queue.batchOrders.filter.${e}`)},e))})]}),g?(0,J.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:t(`common.loading`)}):h?.length?(0,J.jsx)(`div`,{className:`space-y-4`,children:h.map(e=>(0,J.jsx)(ft,{batch:e,currency:m,canDispatch:x,canCancel:S,isDispatching:y.isPending&&y.variables?.id===e.id,highlighted:e.id===n,onDispatch:t=>y.mutate({id:e.id,plateId:t}),onCancel:()=>f(e),t},e.id))}):(0,J.jsxs)(le,{className:`p-12 text-center border-dashed`,children:[(0,J.jsx)(N,{className:`w-16 h-16 text-bambu-gray mx-auto mb-4 opacity-50`}),(0,J.jsx)(`h3`,{className:`text-xl font-medium text-white mb-2`,children:t(`queue.batchOrders.emptyTitle`)}),(0,J.jsx)(`p`,{className:`text-bambu-gray max-w-md mx-auto`,children:t(`queue.batchOrders.emptyDescription`)})]}),d&&(0,J.jsx)(Ee,{title:t(`queue.cancelBatchConfirmTitle`),message:t(`queue.cancelBatchConfirmMessage`),confirmText:t(`queue.cancelBatch`),variant:`warning`,onConfirm:()=>b.mutate(d.id),onCancel:()=>f(null)})]})}var dt={active:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-300`,completed:`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-300`,cancelled:`bg-bambu-dark-tertiary text-bambu-gray`};function ft({batch:e,currency:t,canDispatch:n,canCancel:r,isDispatching:i,onDispatch:a,onCancel:o,t:s,highlighted:c=!1}){let l=e.has_targets?e.target_count:e.completed_count+e.pending_count+e.printing_count+e.failed_count,u=l>0?Math.round(e.completed_count/l*100):0,d=e.has_targets?e.remaining_count-e.dispatchable_count:0,f=e.due_date?z(e.due_date):null,p=f!=null&&e.status===`active`&&f.getTime()0&&e.status!==`cancelled`&&n&&(0,J.jsxs)(R,{variant:`primary`,size:`sm`,onClick:()=>a(),disabled:i,children:[(0,J.jsx)(ze,{className:`w-4 h-4 mr-1`}),s(`queue.batchOrders.dispatchRemaining`,{count:e.dispatchable_count})]}),e.status===`active`&&r&&(0,J.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:o,children:[(0,J.jsx)(E,{className:`w-4 h-4 mr-1`}),s(`queue.cancelBatch`)]})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,J.jsx)(`div`,{className:`flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden`,children:(0,J.jsx)(`div`,{className:`h-full rounded-full transition-all ${e.status===`completed`?`bg-bambu-green`:`bg-blue-500`}`,style:{width:`${Math.min(100,u)}%`}})}),(0,J.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap tabular-nums`,children:s(`queue.batchProgress`,{completed:e.completed_count,total:l})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-bambu-gray mb-1`,children:[e.printing_count>0&&(0,J.jsx)(`span`,{children:s(`queue.batchOrders.printing`,{count:e.printing_count})}),e.pending_count>0&&(0,J.jsx)(`span`,{children:s(`queue.batch.pendingCount`,{count:e.pending_count})}),e.failed_count>0&&(0,J.jsxs)(`span`,{className:`text-orange-600 dark:text-orange-400 flex items-center gap-1`,children:[(0,J.jsx)(L,{className:`w-3 h-3`}),s(`queue.batchOrders.failed`,{count:e.failed_count})]}),e.has_targets&&e.remaining_count>0&&(0,J.jsx)(`span`,{children:s(`queue.batchOrders.remaining`,{count:e.remaining_count})}),e.print_time_seconds>0&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(H,{className:`w-3 h-3`}),de(e.print_time_seconds)]}),e.actual_cost!=null&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(A,{className:`w-3 h-3`}),(0,J.jsx)(`span`,{children:s(`queue.batchOrders.costSoFar`,{amount:`${t} ${e.actual_cost.toFixed(2)}`})}),e.estimated_remaining_cost!=null&&e.estimated_remaining_cost>0&&(0,J.jsx)(`span`,{children:s(`queue.batchOrders.costRemaining`,{amount:`${t} ${e.estimated_remaining_cost.toFixed(2)}`})})]})]}),d>0&&e.status!==`cancelled`&&(0,J.jsxs)(`p`,{className:`flex items-start gap-1.5 text-xs text-orange-600 dark:text-orange-400 mb-1`,children:[(0,J.jsx)(L,{className:`w-3 h-3 mt-0.5 flex-shrink-0`}),(0,J.jsx)(`span`,{children:s(`queue.batchOrders.strandedNotice`,{runs:d,owed:e.remaining_count})})]}),e.has_targets&&e.plates.length>0&&(0,J.jsx)(`div`,{className:`mt-3 border-t border-bambu-dark-tertiary pt-3 space-y-1.5`,children:e.plates.map(r=>(0,J.jsx)(pt,{plate:r,batchStatus:e.status,currency:t,canDispatch:n,isDispatching:i,onDispatch:()=>a(r.plate_id),t:s},`${r.plate_id??`file`}`))})]})}function pt({plate:e,batchStatus:t,currency:n,canDispatch:r,isDispatching:i,onDispatch:a,t:o}){let s=e.plate_name||(e.plate_id==null?o(`queue.batchOrders.wholeFile`):o(`queue.plateNumber`,{index:e.plate_id}));return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs`,children:[(0,J.jsx)(ke,{className:`w-3.5 h-3.5 text-bambu-gray flex-shrink-0`}),(0,J.jsx)(`span`,{className:`text-white min-w-0 truncate`,children:s}),(0,J.jsx)(`span`,{className:`text-bambu-gray tabular-nums`,children:o(`queue.batchOrders.plateProgress`,{completed:e.completed_count,target:e.quantity_target})}),e.failed_count>0&&(0,J.jsx)(`span`,{className:`text-orange-600 dark:text-orange-400`,children:o(`queue.batchOrders.failed`,{count:e.failed_count})}),e.actual_cost!=null&&(0,J.jsx)(`span`,{className:`text-bambu-gray tabular-nums`,children:`${n} ${e.actual_cost.toFixed(2)}`}),e.remaining>0&&t!==`cancelled`&&(0,J.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-bambu-gray`,children:o(`queue.batchOrders.remaining`,{count:e.remaining})}),e.can_dispatch?r&&(0,J.jsx)(`button`,{type:`button`,onClick:a,disabled:i,className:`text-bambu-green hover:underline disabled:opacity-50`,children:o(`queue.batchOrders.dispatchPlate`)}):(0,J.jsx)(`span`,{className:`text-orange-600 dark:text-orange-400`,children:o(`queue.batchOrders.strandedPlate`)})]})]})}function mt(e,t){if(!e?.connected||t>=254)return;let n=t>=128,r=n?t:Math.floor(t/4),i=n?0:t%4,a=e.ams?.find(e=>e.id===r);if(W(n?a?.tray[0]:a?.tray.find(e=>e.id===i))===`physical`)return ve(r,i,n,!1)}function ht(e,t){let n=new Map;if(!e?.length||!t?.length)return n;let r=new Set(e.filter(e=>e>=0)),i=new Map,a;for(let[e]of t){if(a!==void 0&&!r.has(e)&&!i.has(e)){let t=r.has(a)?a:i.get(a);t!==void 0&&(i.set(e,t),n.set(t,e))}a=e}return n}function gt(e){return e.slotLabel?[e.slotLabel,e.spoolName||e.type,e.colorName].filter(Boolean).join(` · `):e.colorName}function _t(e,t,n=[],r,i=`Empty`){let a=e.status===`printing`?ht(e.ams_mapping,r?.tray_change_log):new Map,o=t=>{let o=t.slotId,s=o>0?e.ams_mapping?.[o-1]:void 0;if(s==null||s<0)return t;let c=a.get(s)??s,l=n.find(e=>e.globalTrayId===c);if(l)return{slotId:o,type:l.type,color:l.color,colorName:l.colorName,slotLabel:l.label,spoolName:l.spoolName,extraColors:l.extraColors,effectType:l.effectType,subtype:l.spoolSubtype};let u=mt(r,c);return u?{...t,slotLabel:u,spoolName:i,emptySlot:!0}:t},s=e.plate_id==null?t[0]:t.find(t=>t.index===e.plate_id);if(s){let t=new Map((e.filament_overrides??[]).map(e=>[e.slot_id,e]));return s.filaments.filter(e=>e.used_in_plate!==!1&&e.used_grams>0).map(e=>{let n=t.get(e.slot_id),r=n?.color??e.color,i=n?.type??e.type;return o({slotId:e.slot_id,type:i,color:r,colorName:n?.color_name?.trim()||G(r,i)})})}return e.filament_overrides?.length?e.filament_overrides.map(e=>o({slotId:e.slot_id,type:e.type,color:e.color,colorName:e.color_name?.trim()||G(e.color,e.type)})):e.filament_color?[o({slotId:1,type:e.filament_type??``,color:e.filament_color,colorName:G(e.filament_color,e.filament_type)})]:[]}function vt(e,t=!1){return t&&e>=1e3?`${(e/1e3).toFixed(1)}kg`:`${Math.round(e)}g`}function yt({status:e,waitingReason:t,printerState:n,t:r}){if(e===`pending`&&t)return(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border text-purple-700 dark:text-purple-400 bg-purple-50 dark:bg-purple-400/10 border-purple-200 dark:border-purple-400/20`,children:[(0,J.jsx)(H,{className:`w-3.5 h-3.5`}),r(`queue.status.waiting`)]});if(e===`printing`&&n===`PAUSE`)return(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border text-yellow-700 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-400/10 border-yellow-200 dark:border-yellow-400/20`,children:[(0,J.jsx)(P,{className:`w-3.5 h-3.5`}),r(`queue.status.paused`)]});let{icon:i,color:a,label:o}={pending:{icon:H,color:`text-status-warning bg-status-warning/10 border-status-warning/20`,label:r(`queue.status.pending`)},printing:{icon:oe,color:`text-blue-700 dark:text-blue-400 bg-blue-50 dark:bg-blue-400/10 border-blue-200 dark:border-blue-400/20`,label:r(`queue.status.printing`)},completed:{icon:k,color:`text-status-ok bg-status-ok/10 border-status-ok/20`,label:r(`queue.status.completed`)},failed:{icon:E,color:`text-status-error bg-status-error/10 border-status-error/20`,label:r(`queue.status.failed`)},skipped:{icon:F,color:`text-orange-700 dark:text-orange-400 bg-orange-50 dark:bg-orange-400/10 border-orange-200 dark:border-orange-400/20`,label:r(`queue.status.skipped`)},cancelled:{icon:ce,color:`text-gray-400 bg-gray-400/10 border-gray-400/20`,label:r(`queue.status.cancelled`)}}[e];return(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${a}`,children:[(0,J.jsx)(i,{className:`w-3.5 h-3.5`}),o]})}function bt({selectedCount:e,printers:t,onSave:n,onClose:r,isSaving:i,canControlPrinter:a,hasGcodeSnippets:o,t:s}){let[c,l]=(0,q.useState)(`unchanged`),[u,d]=(0,q.useState)(`unchanged`),[f,p]=(0,q.useState)(`unchanged`),[m,h]=(0,q.useState)(`unchanged`),[g,_]=(0,q.useState)(`unchanged`),[v,y]=(0,q.useState)(`unchanged`),[b,x]=(0,q.useState)(`unchanged`),[S,ee]=(0,q.useState)(`unchanged`),[C,te]=(0,q.useState)(`unchanged`),[w,ne]=(0,q.useState)(`unchanged`),[T,re]=(0,q.useState)(`unchanged`),[E,D]=(0,q.useState)(`unchanged`),[O,k]=(0,q.useState)(`unchanged`),A=t.some(e=>e.nozzle_count===2),j=()=>{let e={};c!==`unchanged`&&(e.printer_id=c),u!==`unchanged`&&(e.manual_start=u),f!==`unchanged`&&(e.auto_off_after=f),m!==`unchanged`&&(e.require_previous_success=m),g!==`unchanged`&&(e.gcode_injection=g),v!==`unchanged`&&(e.bed_levelling=v),b!==`unchanged`&&(e.flow_cali=b),S!==`unchanged`&&(e.vibration_cali=S),C!==`unchanged`&&(e.layer_inspect=C),w!==`unchanged`&&(e.timelapse=w),T!==`unchanged`&&(e.use_ams=T),E!==`unchanged`&&(e.confirm_outcome=E),O!==`unchanged`&&(e.nozzle_offset_cali=O),n(e)},M=c!==`unchanged`||u!==`unchanged`||f!==`unchanged`||m!==`unchanged`||v!==`unchanged`||b!==`unchanged`||S!==`unchanged`||C!==`unchanged`||w!==`unchanged`||T!==`unchanged`||E!==`unchanged`||O!==`unchanged`||g!==`unchanged`;return(0,J.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,children:(0,J.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg max-h-[90vh] overflow-y-auto`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:s(`queue.bulkEdit.title`,{count:e})}),(0,J.jsx)(`button`,{onClick:r,className:`p-1 hover:bg-bambu-dark rounded`,children:(0,J.jsx)(ce,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,J.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,J.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:s(`queue.bulkEdit.description`)}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:s(`queue.bulkEdit.printer`)}),(0,J.jsxs)(`select`,{value:c===null?`null`:c===`unchanged`?`unchanged`:String(c),onChange:e=>{let t=e.target.value;l(t===`unchanged`?`unchanged`:t===`null`?null:Number(t))},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,J.jsx)(`option`,{value:`unchanged`,children:s(`queue.bulkEdit.noChange`)}),(0,J.jsx)(`option`,{value:`null`,children:s(`queue.filter.unassigned`)}),t.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:s(`queue.bulkEdit.queueOptions`)}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(Q,{label:s(`queue.bulkEdit.staged`),value:u,onChange:d,t:s}),(0,J.jsx)(Q,{label:s(`queue.bulkEdit.autoPowerOff`),value:f,onChange:p,disabled:!a,t:s}),(0,J.jsx)(Q,{label:s(`queue.bulkEdit.requirePrevious`),value:m,onChange:h,t:s}),o&&(0,J.jsx)(Q,{label:s(`queue.bulkEdit.gcodeInjection`),value:g,onChange:_,t:s})]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:s(`queue.bulkEdit.printOptions`)}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(xt,{label:s(`queue.bulkEdit.bedLevelling`),value:v,onChange:y,t:s}),(0,J.jsx)(xt,{label:s(`queue.bulkEdit.flowCalibration`),value:b,onChange:x,t:s}),(0,J.jsx)(Q,{label:s(`queue.bulkEdit.vibrationCalibration`),value:S,onChange:ee,t:s}),(0,J.jsx)(Q,{label:s(`queue.bulkEdit.layerInspection`),value:C,onChange:te,t:s}),(0,J.jsx)(Q,{label:s(`queue.bulkEdit.timelapse`),value:w,onChange:ne,t:s}),(0,J.jsx)(Q,{label:s(`queue.bulkEdit.useAms`),value:T,onChange:re,t:s}),(0,J.jsx)(Q,{label:s(`queue.bulkEdit.confirmOutcome`),value:E,onChange:D,t:s}),A&&(0,J.jsx)(xt,{label:s(`queue.bulkEdit.nozzleOffsetCali`),value:O,onChange:k,t:s})]})]})]}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-3 p-4 border-t border-bambu-dark-tertiary`,children:[(0,J.jsx)(R,{variant:`secondary`,onClick:r,children:s(`common.cancel`)}),(0,J.jsx)(R,{onClick:j,disabled:!M||i,children:s(i?`common.saving`:`queue.bulkEdit.applyChanges`)})]})]})})}function Q({label:e,value:t,onChange:n,disabled:r,t:i}){return(0,J.jsxs)(`div`,{className:`flex items-center justify-between py-1 ${r?`opacity-50`:``}`,children:[(0,J.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 bg-bambu-dark rounded-lg p-0.5`,children:[(0,J.jsx)(`button`,{onClick:()=>n(`unchanged`),disabled:r,className:`px-2 py-1 text-xs rounded ${t===`unchanged`?`bg-bambu-dark-tertiary text-white`:`text-bambu-gray hover:text-white`} disabled:cursor-not-allowed`,children:`—`}),(0,J.jsx)(`button`,{onClick:()=>n(!1),disabled:r,className:`px-2 py-1 text-xs rounded ${t===!1?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:`text-bambu-gray hover:text-white`} disabled:cursor-not-allowed`,children:i(`common.off`)}),(0,J.jsx)(`button`,{onClick:()=>n(!0),disabled:r,className:`px-2 py-1 text-xs rounded ${t===!0?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white`} disabled:cursor-not-allowed`,children:i(`common.on`)})]})]})}function xt({label:e,value:t,onChange:n,t:r}){let i=[{key:`unchanged`,label:`—`,active:`bg-bambu-dark-tertiary text-white`},{key:`off`,label:r(`settings.calibrationMode_off`),active:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`},{key:`auto`,label:r(`settings.calibrationMode_auto`),active:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`},{key:`on`,label:r(`settings.calibrationMode_on`),active:`bg-bambu-green/20 text-bambu-green`}];return(0,J.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,J.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e}),(0,J.jsx)(`div`,{className:`flex items-center gap-1 bg-bambu-dark rounded-lg p-0.5`,children:i.map(({key:e,label:r,active:i})=>(0,J.jsx)(`button`,{onClick:()=>n(e),className:`px-2 py-1 text-xs rounded ${t===e?i:`text-bambu-gray hover:text-white`}`,children:r},e))})]})}function St({item:e,position:t,onEdit:n,onCancel:i,onRemove:a,onStop:o,onRequeue:c,onStart:l,onMoveUp:u,onMoveDown:d,timeFormat:f=`system`,isSelected:m=!1,onToggleSelect:h,hasPermission:g,canModify:_,printerState:v,showEta:y=!1,etaNow:x,t:S}){let{hasAnyPermission:ee}=Ie(),C=!ee(`queue:update_all`,`queue:start_unreviewed`),te=e.printer_id!=null&&(e.ams_mapping?.some(e=>e>=0)??!1),{data:w}=s({queryKey:[`printerStatus`,e.printer_id],queryFn:()=>r.getPrinterStatus(e.printer_id),refetchInterval:v===`printing`?3e4:!1,enabled:e.printer_id!=null&&(v===`printing`||te)}),{data:E}=s({queryKey:[`printer-inventory-remain`,e.printer_id],queryFn:()=>r.getInventoryRemain(e.printer_id),enabled:te,staleTime:30*1e3}),O=(0,q.useMemo)(()=>{let e=E?.slot_materials;if(!e?.length)return;let t=new Map;return e.forEach(e=>{e.spool&&t.set(e.global_tray_id,e.spool)}),t.size>0?t:void 0},[E]),k=(0,q.useMemo)(()=>me(w,O),[w,O]),A=!!e.library_file_id&&!e.archive_id,{data:j}=s({queryKey:[`archive-plates`,e.archive_id],queryFn:()=>r.getArchivePlates(e.archive_id),enabled:!!e.archive_id&&!A&&!e.archive_deleted}),{data:ie}=s({queryKey:[`library-file-plates`,e.library_file_id],queryFn:()=>r.getLibraryFilePlates(e.library_file_id),enabled:A&&!!e.library_file_id}),ae=A?ie:j,N=ae?.plates??[],P=_t(e,N,k,w,S(`ams.empty`)),F=g(`queue:reorder`),{attributes:L,listeners:se,setNodeRef:le,transform:B,transition:ve,isDragging:be}=p({id:e.id,disabled:e.status!==`pending`||!F}),xe={transform:b.Transform.toString(B),transition:ve},we=e.status===`printing`,W=e.status===`pending`,Ee=[`completed`,`failed`,`skipped`,`cancelled`].includes(e.status),De=W&&y&&e.print_time_seconds!=null&&e.print_time_seconds>0?ue(e.print_time_seconds/60,f,S,x):null,Oe=W&&h;return(0,J.jsxs)(`div`,{ref:le,style:xe,className:` + group relative bg-bambu-dark-secondary rounded-xl border transition-all duration-200 + border-l-[3px] ${we?`border-l-blue-500`:W?`border-l-yellow-500`:e.status===`completed`?`border-l-emerald-500`:e.status===`failed`?`border-l-red-500`:`border-l-gray-500`} + ${be?`opacity-50 scale-[1.02] shadow-xl z-50`:``} + ${we?`border-blue-500/30 bg-gradient-to-r from-blue-500/5 to-transparent`:``} + ${m&&Oe?`sm:border-bambu-dark-tertiary border-bambu-green/40`:``} + ${!m&&!we?`border-bambu-dark-tertiary hover:border-bambu-dark-tertiary/80`:``} + ${Oe?`cursor-pointer sm:cursor-default`:``} + `,onClick:Oe?()=>{window.innerWidth<640&&h()}:void 0,children:[Oe&&m&&(0,J.jsx)(`div`,{className:`sm:hidden absolute left-0 top-3 bottom-3 w-1 rounded-full bg-bambu-green`}),(0,J.jsxs)(`div`,{className:`flex items-start sm:items-center gap-2 sm:gap-4 p-3 sm:p-4`,children:[W&&(u||d)&&(0,J.jsxs)(`div`,{className:`flex sm:hidden flex-col shrink-0 -my-1`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`button`,{type:`button`,onClick:u,disabled:!u,title:S(`queue.moveUp`),"aria-label":S(`queue.moveUp`),className:`flex items-center justify-center w-8 h-7 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark disabled:opacity-25 disabled:hover:bg-transparent transition-colors`,children:(0,J.jsx)(re,{className:`w-5 h-5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:d,disabled:!d,title:S(`queue.moveDown`),"aria-label":S(`queue.moveDown`),className:`flex items-center justify-center w-8 h-7 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark disabled:opacity-25 disabled:hover:bg-transparent transition-colors`,children:(0,J.jsx)(T,{className:`w-5 h-5`})})]}),W&&h&&(0,J.jsx)(`button`,{onClick:e=>{e.stopPropagation(),h()},className:`hidden sm:flex items-center justify-center w-6 h-6 rounded border transition-colors shrink-0 ${m?`bg-bambu-green border-bambu-green text-white`:`border-white/30 bg-black/30 hover:border-bambu-green/50`}`,children:m&&(0,J.jsx)(ne,{className:`w-4 h-4`})}),W?(0,J.jsx)(`div`,{...L,...se,className:`hidden sm:flex items-center justify-center w-8 h-8 rounded-lg bg-bambu-dark cursor-grab active:cursor-grabbing hover:bg-bambu-dark-tertiary transition-colors touch-none shrink-0`,children:(0,J.jsx)(M,{className:`w-4 h-4 text-bambu-gray`})}):t===void 0?(0,J.jsx)(`div`,{className:`hidden sm:block w-8 shrink-0`}):(0,J.jsxs)(`div`,{className:`hidden sm:flex items-center justify-center w-8 h-8 rounded-lg bg-bambu-dark text-bambu-gray text-sm font-medium shrink-0`,children:[`#`,t]}),(0,J.jsx)(`div`,{className:`w-10 h-10 sm:w-14 sm:h-14 flex-shrink-0 bg-bambu-dark rounded-lg overflow-hidden`,children:e.archive_thumbnail?(0,J.jsx)(`img`,{src:e.plate_id==null?r.getArchiveThumbnail(e.archive_id):r.getArchivePlateThumbnail(e.archive_id,e.plate_id),alt:``,className:`w-full h-full object-cover`}):e.library_file_thumbnail?(0,J.jsx)(`img`,{src:e.plate_id==null?r.getLibraryFileThumbnailUrl(e.library_file_id):r.getLibraryFilePlateThumbnail(e.library_file_id,e.plate_id),alt:``,className:`w-full h-full object-cover`}):(0,J.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-bambu-gray`,children:(0,J.jsx)(ke,{className:`w-5 h-5 sm:w-6 sm:h-6`})})}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,J.jsxs)(`p`,{className:`text-sm sm:text-base text-white font-medium truncate`,children:[Le(e,e=>S(`common.plusNMore`,{count:e})),(ae?.is_multi_plate??!1)&&e.plate_id!==void 0&&e.plate_id!==null&&` • ${N.find(t=>t.index===e.plate_id)?.name||S(`queue.plateNumber`,{index:e.plate_id})}`]}),e.archive_id?(0,J.jsx)(Ce,{to:`/archives?highlight=${e.archive_id}`,className:`text-bambu-gray hover:text-bambu-green transition-colors flex-shrink-0`,title:S(`queue.viewArchive`),children:(0,J.jsx)(ge,{className:`w-3.5 h-3.5`})}):e.library_file_id?(0,J.jsx)(Ce,{to:`/library?highlight=${e.library_file_id}`,className:`text-bambu-gray hover:text-bambu-green transition-colors flex-shrink-0`,title:S(`queue.viewInFileManager`),children:(0,J.jsx)(ge,{className:`w-3.5 h-3.5`})}):null,e.batch_name&&(0,J.jsx)(`span`,{className:`flex-shrink-0 px-1.5 py-0.5 text-[10px] sm:text-xs bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-300 rounded border border-cyan-300 dark:border-cyan-500/30`,children:e.batch_name})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs sm:text-sm text-bambu-gray`,children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1 sm:gap-1.5 ${e.printer_id===null&&!e.target_model?`text-orange-700 dark:text-orange-400`:``} ${e.target_model&&!e.printer_id?`text-blue-700 dark:text-blue-400`:``}`,children:[(0,J.jsx)(ye,{className:`w-3 h-3 sm:w-3.5 sm:h-3.5`}),(0,J.jsx)(`span`,{className:`truncate max-w-[120px] sm:max-w-none`,children:(e.variants?.length??0)>1&&!e.printer_id?`${S(`queue.filter.any`)} ${e.variants.map(e=>e.target_model).join(` / `)}${e.target_location?` @ ${e.target_location}`:``}`:e.target_model&&!e.printer_id?`${S(`queue.filter.any`)} ${e.target_model}${e.target_location?` @ ${e.target_location}`:``}${e.required_filament_types?.length?` (${e.required_filament_types.join(`, `)})`:``}`:e.printer_id===null?S(`queue.filter.unassigned`):e.printer_name||`${S(`common.printer`)} #${e.printer_id}`})]}),e.print_time_seconds&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 sm:gap-1.5`,children:[(0,J.jsx)(I,{className:`w-3 h-3 sm:w-3.5 sm:h-3.5`}),de(e.print_time_seconds)]}),De&&(0,J.jsxs)(`span`,{"data-testid":`queue-item-eta`,className:`text-bambu-green font-medium`,title:S(`queue.time.etaIfStartedNow`),children:[`ETA `,De]}),e.filament_used_grams&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 sm:gap-1.5`,children:[(0,J.jsx)(Pe,{className:`w-3 h-3 sm:w-3.5 sm:h-3.5`}),vt(e.filament_used_grams)]}),P.length>2?(0,J.jsxs)(`span`,{"data-testid":`queue-filament-compact`,className:`flex items-center gap-0.5 flex-shrink-0`,title:P.map(gt).join(` +`),role:`img`,"aria-label":P.map(gt).join(`, `),children:[P.map(e=>(0,J.jsx)(K,{rgba:e.color,extraColors:e.extraColors,effectType:e.effectType,subtype:e.subtype,className:`w-2.5 h-2.5 sm:w-3 sm:h-3 pointer-events-none`,effectSize:`table`},`filament-${e.slotId}`)),P.some(e=>e.emptySlot)&&(0,J.jsx)(D,{className:`w-3 h-3 ml-0.5 text-yellow-700 dark:text-yellow-400`,"aria-hidden":`true`})]}):P.map(e=>{let t=gt(e);return(0,J.jsxs)(`span`,{className:`flex items-center gap-1 sm:gap-1.5 min-w-0`,title:t,children:[(0,J.jsx)(K,{rgba:e.color,extraColors:e.extraColors,effectType:e.effectType,subtype:e.subtype,className:`w-3 h-3 sm:w-3.5 sm:h-3.5`,effectSize:`table`}),(0,J.jsx)(`span`,{className:`truncate max-w-[110px] sm:max-w-[260px]${e.emptySlot?` text-yellow-700 dark:text-yellow-400`:``}`,children:t})]},`filament-${e.slotId}`)}),(()=>{let t=U(e.bed_type);return t?(0,J.jsxs)(`span`,{className:`flex items-center gap-1 sm:gap-1.5`,title:t.label,children:[(0,J.jsx)(`img`,{src:t.icon,alt:``,className:`w-3.5 h-3.5 sm:w-4 sm:h-4 object-contain`}),(0,J.jsx)(`span`,{className:`truncate max-w-[120px]`,children:t.label})]}):null})(),e.created_by_username&&(0,J.jsxs)(`span`,{className:`hidden sm:flex items-center gap-1.5`,title:S(`queue.addedBy`,{name:e.created_by_username}),children:[(0,J.jsx)(Se,{className:`w-3.5 h-3.5`}),e.created_by_username]}),W&&!e.manual_start&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(H,{className:`w-3.5 h-3.5`}),e.scheduled_time?(z(e.scheduled_time)?.getTime()??0)-Date.now()<-6e4?S?.(`queue.time.overdue`)??`Overdue`:fe(e.scheduled_time,f,S):S?.(`queue.time.whenFree`)??`When a printer is free`]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 sm:gap-2 mt-1.5 sm:mt-2`,children:[e.manual_start&&(0,J.jsxs)(`span`,{className:`text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 bg-purple-50 dark:bg-purple-500/10 text-purple-700 dark:text-purple-400 rounded-full border border-purple-200 dark:border-purple-500/20 flex items-center gap-1`,children:[(0,J.jsx)(Me,{className:`w-2.5 h-2.5 sm:w-3 sm:h-3`}),S(C?`queue.badges.awaitingReview`:`queue.badges.staged`)]}),e.require_previous_success&&(0,J.jsx)(`span`,{className:`text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 bg-orange-50 dark:bg-orange-500/10 text-orange-700 dark:text-orange-400 rounded-full border border-orange-200 dark:border-orange-500/20`,children:S(`queue.badges.requiresPrevious`)}),e.auto_off_after&&(0,J.jsxs)(`span`,{className:`text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 bg-blue-50 dark:bg-blue-500/10 text-blue-700 dark:text-blue-400 rounded-full border border-blue-200 dark:border-blue-500/20 flex items-center gap-1`,children:[(0,J.jsx)(Te,{className:`w-2.5 h-2.5 sm:w-3 sm:h-3`}),S(`queue.badges.autoPowerOff`)]}),e.gcode_injection&&(0,J.jsxs)(`span`,{className:`text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 bg-emerald-50 dark:bg-emerald-500/10 text-emerald-700 dark:text-emerald-400 rounded-full border border-emerald-200 dark:border-emerald-500/20 flex items-center gap-1`,children:[(0,J.jsx)(_e,{className:`w-2.5 h-2.5 sm:w-3 sm:h-3`}),S(`queue.badges.gcodeInjection`)]}),e.confirm_outcome&&(0,J.jsxs)(`span`,{title:S(`queue.badges.confirmOutcomeTitle`),className:`text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 bg-green-50 dark:bg-green-500/10 text-green-700 dark:text-green-400 rounded-full border border-green-200 dark:border-green-500/20 flex items-center gap-1`,children:[(0,J.jsx)(je,{className:`w-2.5 h-2.5 sm:w-3 sm:h-3`}),S(`queue.badges.confirmOutcome`)]})]}),we&&w&&(()=>{let e=w.state===`RUNNING`||w.state===`PAUSE`,t=e&&w.progress||0,n=e?w.remaining_time:null,r=e?w.layer_num:null,i=e?w.total_layers:null;return(0,J.jsxs)(`div`,{className:`mt-2 sm:mt-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between text-xs sm:text-sm`,children:[(0,J.jsx)(`div`,{className:`flex-1 bg-bambu-dark-tertiary rounded-full h-1.5 sm:h-2 mr-3`,children:(0,J.jsx)(`div`,{className:`bg-bambu-green h-1.5 sm:h-2 rounded-full transition-all`,style:{width:`${t}%`}})}),(0,J.jsxs)(`span`,{className:`text-white`,children:[Math.round(t),`%`]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:gap-3 mt-1.5 sm:mt-2 text-[10px] sm:text-xs text-bambu-gray`,children:[n!=null&&n>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(H,{className:`w-3 h-3`}),de(n*60)]}),(0,J.jsxs)(`span`,{className:`text-bambu-green font-medium`,title:S(`printers.estimatedCompletion`),children:[`ETA `,ue(n,f,S)]})]}),r!=null&&i!=null&&i>0&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(ke,{className:`w-3 h-3`}),r,`/`,i]})]})]})})(),e.waiting_reason&&e.status===`pending`&&(0,J.jsxs)(`p`,{className:`text-[10px] sm:text-xs text-purple-700 dark:text-purple-400 mt-1.5 sm:mt-2 flex items-start gap-1`,children:[(0,J.jsx)(D,{className:`w-3 h-3 mt-0.5 flex-shrink-0`}),(0,J.jsx)(`span`,{children:e.waiting_reason})]}),e.filament_short&&e.status===`pending`&&(0,J.jsxs)(`p`,{className:`text-[10px] sm:text-xs text-yellow-700 dark:text-yellow-400 mt-1.5 sm:mt-2 flex items-start gap-1`,title:S(`queue.filamentShort.rowTooltip`),children:[(0,J.jsx)(D,{className:`w-3 h-3 mt-0.5 flex-shrink-0`}),(0,J.jsx)(`span`,{children:S(`queue.filamentShort.rowBadge`)})]}),e.archive_has_slicer_ams_mapping&&(0,J.jsxs)(`p`,{className:`text-[10px] sm:text-xs text-green-700 dark:text-green-400 mt-1.5 sm:mt-2 flex items-start gap-1`,title:S(`queue.slicerAmsMapping.rowTooltip`),children:[(0,J.jsx)(ne,{className:`w-3 h-3 mt-0.5 flex-shrink-0`}),(0,J.jsx)(`span`,{children:S(`queue.slicerAmsMapping.rowBadge`)})]}),e.error_message&&(0,J.jsxs)(`p`,{className:`text-[10px] sm:text-xs text-red-700 dark:text-red-400 mt-1.5 sm:mt-2 flex items-center gap-1`,children:[(0,J.jsx)(D,{className:`w-3 h-3`}),e.error_message]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-end sm:items-center gap-2 sm:gap-1 shrink-0`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(yt,{status:e.status,waitingReason:e.waiting_reason,printerState:v,t:S}),(0,J.jsxs)(`div`,{className:`flex items-center gap-0.5 sm:gap-1`,children:[we&&(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:o,disabled:!_(`queue`,`update`,e.created_by_id),title:_(`queue`,`update`,e.created_by_id)?S(`queue.actions.stopPrint`):S(`queue.permissions.noStopPrint`),className:`text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-500/10 p-1.5 sm:p-2`,children:(0,J.jsx)(Be,{className:`w-4 h-4`})}),W&&(0,J.jsxs)(J.Fragment,{children:[e.manual_start&&(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:l,disabled:C||!_(`queue`,`update`,e.created_by_id),title:C?S(`queue.permissions.awaitingReview`):_(`queue`,`update`,e.created_by_id)?S(`queue.actions.startPrint`):S(`queue.permissions.noStartPrint`),className:`text-bambu-green hover:text-bambu-green-light hover:bg-bambu-green/10 p-1.5 sm:p-2`,children:(0,J.jsx)(oe,{className:`w-4 h-4`})}),(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:n,disabled:!_(`queue`,`update`,e.created_by_id),title:_(`queue`,`update`,e.created_by_id)?S(`common.edit`):S(`queue.permissions.noEdit`),className:`p-1.5 sm:p-2`,children:(0,J.jsx)(pe,{className:`w-4 h-4`})}),(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:i,disabled:!_(`queue`,`delete`,e.created_by_id),title:_(`queue`,`delete`,e.created_by_id)?S(`common.cancel`):S(`queue.permissions.noCancel`),className:`text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-500/10 p-1.5 sm:p-2`,children:(0,J.jsx)(ce,{className:`w-4 h-4`})})]}),Ee&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:c,disabled:!g(`queue:create`),title:g(`queue:create`)?S(`queue.actions.requeue`):S(`queue.permissions.noRequeue`),className:`text-bambu-green hover:text-bambu-green/80 hover:bg-bambu-green/10 p-1.5 sm:p-2`,children:(0,J.jsx)(V,{className:`w-4 h-4`})}),(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:a,disabled:!_(`queue`,`delete`,e.created_by_id),title:_(`queue`,`delete`,e.created_by_id)?S(`common.remove`):S(`queue.permissions.noRemove`),className:`p-1.5 sm:p-2`,children:(0,J.jsx)(he,{className:`w-4 h-4`})})]})]})]})]})]})}function Ct(e){let{row:t,setEditItem:n,setConfirmAction:r,startMutation:i,selectedItems:a,handleToggleSelect:o,timeFormat:s,hasPermission:c,canModify:l,t:u,etaEligibleIds:d,etaNow:f,onMoveUp:p,onMoveDown:m}=e;return t.kind===`item`?(0,J.jsx)(St,{item:t.item,onEdit:()=>n(t.item),onCancel:()=>r({type:`cancel`,item:t.item}),onRemove:()=>{},onStop:()=>{},onRequeue:()=>{},onStart:()=>i.mutate({id:t.item.id}),onMoveUp:p,onMoveDown:m,timeFormat:s,isSelected:a.includes(t.item.id),onToggleSelect:()=>o(t.item.id),hasPermission:c,canModify:l,showEta:d.has(t.item.id),etaNow:f,t:u}):(0,J.jsx)($,{...e})}function $({row:e,collapsed:t,onToggleBatch:n,onUngroup:r,setEditItem:i,setConfirmAction:a,startMutation:o,selectedItems:s,handleToggleSelect:c,timeFormat:l,hasPermission:u,canModify:d,t:f,etaEligibleIds:m,etaNow:h,aggregateForRows:g,onMoveUp:_,onMoveDown:v,onMoveBlock:y}){let x=e,S=u(`queue:reorder`),{attributes:ee,listeners:C,setNodeRef:te,transform:w,transition:E,isDragging:D}=p({id:`batch-${x.batchId}`,disabled:!S}),O={transform:b.Transform.toString(w),transition:E},k=g([x]),A=x.items.map(e=>e.id),j=A.length>0&&A.every(e=>s.includes(e)),ie=new Set(x.items.map(e=>e.status)),ae=ie.has(`failed`)?`failed`:ie.has(`printing`)?`printing`:`pending`,P=x.items.filter(e=>e.status===`pending`).length;return(0,J.jsxs)(`div`,{ref:te,style:O,className:`bg-bambu-dark-secondary rounded-xl border border-l-[3px] border-l-cyan-400 border-bambu-dark-tertiary overflow-hidden ${D?`opacity-50 scale-[1.01] shadow-xl z-50`:``}`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3 p-3 sm:p-4`,children:[S&&(_||v)&&(0,J.jsxs)(`div`,{className:`flex sm:hidden flex-col shrink-0 -my-1`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:_,disabled:!_,title:f(`queue.moveUp`),"aria-label":f(`queue.moveUp`),className:`flex items-center justify-center w-8 h-7 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark disabled:opacity-25 disabled:hover:bg-transparent transition-colors`,children:(0,J.jsx)(re,{className:`w-5 h-5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:v,disabled:!v,title:f(`queue.moveDown`),"aria-label":f(`queue.moveDown`),className:`flex items-center justify-center w-8 h-7 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark disabled:opacity-25 disabled:hover:bg-transparent transition-colors`,children:(0,J.jsx)(T,{className:`w-5 h-5`})})]}),(0,J.jsx)(`button`,{onClick:e=>{e.stopPropagation(),A.forEach(e=>{(j&&s.includes(e)||!j&&!s.includes(e))&&c(e)})},className:`hidden sm:flex items-center justify-center w-6 h-6 rounded border transition-colors shrink-0 ${j?`bg-bambu-green border-bambu-green text-white`:`border-white/30 bg-black/30 hover:border-bambu-green/50`}`,title:f(j?`queue.bulkEdit.deselectAll`:`queue.bulkEdit.selectAll`),children:j&&(0,J.jsx)(ne,{className:`w-4 h-4`})}),S&&(0,J.jsx)(`div`,{...ee,...C,className:`hidden sm:flex items-center justify-center w-8 h-8 rounded-lg bg-bambu-dark cursor-grab active:cursor-grabbing hover:bg-bambu-dark-tertiary transition-colors touch-none shrink-0`,title:f(`queue.batch.dragGroup`,{defaultValue:`Drag group`}),children:(0,J.jsx)(M,{className:`w-4 h-4 text-bambu-gray`})}),(0,J.jsx)(`button`,{onClick:n,className:`flex items-center justify-center w-8 h-8 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary transition-colors shrink-0`,title:f(t?`queue.batch.expand`:`queue.batch.collapse`),children:t?(0,J.jsx)(xe,{className:`w-4 h-4 text-bambu-gray`}):(0,J.jsx)(T,{className:`w-4 h-4 text-bambu-gray`})}),(0,J.jsx)(`div`,{className:`w-10 h-10 sm:w-12 sm:h-12 flex-shrink-0 bg-bambu-dark rounded-lg flex items-center justify-center`,children:t?(0,J.jsx)(N,{className:`w-5 h-5 text-cyan-700 dark:text-cyan-300`}):(0,J.jsx)(Ve,{className:`w-5 h-5 text-cyan-700 dark:text-cyan-300`})}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,J.jsx)(`p`,{className:`text-sm sm:text-base text-white font-medium truncate`,children:x.batchName}),(0,J.jsx)(`span`,{className:`flex-shrink-0 px-1.5 py-0.5 text-[10px] sm:text-xs bg-cyan-100 dark:bg-cyan-500/15 text-cyan-700 dark:text-cyan-300 rounded border border-cyan-300 dark:border-cyan-500/30`,children:f(`queue.batch.label`,{count:k.count})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs sm:text-sm text-bambu-gray`,children:[k.time>0&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 sm:gap-1.5`,children:[(0,J.jsx)(I,{className:`w-3 h-3 sm:w-3.5 sm:h-3.5`}),de(k.time)]}),k.weight>0&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 sm:gap-1.5`,children:[(0,J.jsx)(Pe,{className:`w-3 h-3 sm:w-3.5 sm:h-3.5`}),vt(k.weight)]}),P>0&&ae===`pending`&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 sm:gap-1.5 text-yellow-700 dark:text-yellow-400`,children:[(0,J.jsx)(H,{className:`w-3 h-3 sm:w-3.5 sm:h-3.5`}),f(`queue.batch.pendingCount`,{count:P})]})]})]}),(0,J.jsx)(`div`,{className:`flex items-center gap-1 shrink-0`,children:r&&(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:r,title:f(`queue.batch.ungroup`),className:`text-cyan-700 dark:text-cyan-300 hover:text-cyan-900 dark:hover:text-cyan-200 hover:bg-cyan-50 dark:hover:bg-cyan-500/10 p-1.5 sm:p-2`,children:(0,J.jsx)(Ue,{className:`w-4 h-4`})})})]}),!t&&(0,J.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary bg-black/20 p-2 sm:p-3 space-y-2`,children:x.items.map((e,t)=>(0,J.jsx)(St,{item:e,onEdit:()=>i(e),onCancel:()=>a({type:`cancel`,item:e}),onRemove:()=>{},onStop:()=>{},onRequeue:()=>{},onStart:()=>o.mutate({id:e.id}),onMoveUp:y&&t>0?()=>y([e.id],x.items[t-1].id,!1):void 0,onMoveDown:y&&ty([e.id],x.items[t+1].id,!0):void 0,timeFormat:l,isSelected:s.includes(e.id),onToggleSelect:()=>c(e.id),hasPermission:u,canModify:d,showEta:m.has(e.id),etaNow:h,t:f},e.id))})]})}function wt({items:e,visibleCount:t,onShowMore:n,sortBy:r,sortAsc:i,onSortByChange:a,onSortAscToggle:o,onRemove:s,onRequeue:c,timeFormat:l,batchCollapsed:u,toggleBatchCollapsed:p,hasPermission:m,canModify:h,t:g}){if(e.length===0)return(0,J.jsxs)(le,{className:`p-12 text-center border-dashed`,children:[(0,J.jsx)(Ne,{className:`w-16 h-16 text-bambu-gray mx-auto mb-4 opacity-50`}),(0,J.jsx)(`h3`,{className:`text-xl font-medium text-white mb-2`,children:g(`queue.history.emptyTitle`)}),(0,J.jsx)(`p`,{className:`text-bambu-gray max-w-md mx-auto`,children:g(`queue.history.emptyDescription`)})]});let v=[],y=new Set;for(let n of e.slice(0,t))if(n.batch_id!=null){if(y.has(n.batch_id))continue;y.add(n.batch_id);let t=e.filter(e=>e.batch_id===n.batch_id);v.push({kind:`batch`,batchId:n.batch_id,batchName:n.batch_name||g(`queue.batch.defaultName`),items:t})}else v.push({kind:`item`,item:n});return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 mb-3 sm:mb-4`,children:[(0,J.jsxs)(`h2`,{className:`text-base sm:text-lg font-semibold text-white flex items-center gap-2`,children:[g(`queue.sections.history`),(0,J.jsxs)(`span`,{className:`text-xs sm:text-sm font-normal text-bambu-gray`,children:[`(`,g(`queue.itemCount`,{count:e.length}),`)`]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`select`,{className:`px-2 sm:px-3 py-1.5 text-xs sm:text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:r,onChange:e=>a(e.target.value),children:[(0,J.jsx)(`option`,{value:`date`,children:g(`queue.sort.byDate`)}),(0,J.jsx)(`option`,{value:`name`,children:g(`queue.sort.byName`)}),(0,J.jsx)(`option`,{value:`printer`,children:g(`queue.sort.byPrinter`)})]}),(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:o,title:g(i?`queue.sort.ascendingOldest`:`queue.sort.descendingNewest`),className:`px-2`,children:i?(0,J.jsx)(f,{className:`w-4 h-4`}):(0,J.jsx)(d,{className:`w-4 h-4`})})]})]}),(0,J.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2`,children:v.map(e=>{if(e.kind===`item`)return(0,J.jsx)(Qe,{item:e.item,onRemove:()=>s(e.item),onRequeue:()=>c(e.item),timeFormat:l,hasPermission:m,canModify:h,t:g},e.item.id);let t=u[e.batchId]??!0,n=e.items.filter(e=>e.status===`completed`).length,r=e.items.filter(e=>e.status===`failed`).length,i=e.items.filter(e=>e.status===`skipped`).length,a=e.items.filter(e=>e.status===`cancelled`).length,o=e.items.map(e=>e.completed_at||e.created_at).filter(e=>!!e).sort().at(-1);return(0,J.jsxs)(`div`,{className:`md:col-span-2 xl:col-span-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary border-l-[3px] border-l-cyan-400`,children:[(0,J.jsxs)(`button`,{onClick:()=>p(e.batchId),className:`w-full flex items-center gap-2 sm:gap-3 px-3 py-2 hover:bg-bambu-dark/30 transition-colors text-left`,title:g(t?`queue.batch.expand`:`queue.batch.collapse`),children:[t?(0,J.jsx)(xe,{className:`w-4 h-4 text-bambu-gray shrink-0`}):(0,J.jsx)(T,{className:`w-4 h-4 text-bambu-gray shrink-0`}),t?(0,J.jsx)(N,{className:`w-5 h-5 text-cyan-700 dark:text-cyan-300 shrink-0`}):(0,J.jsx)(Ve,{className:`w-5 h-5 text-cyan-700 dark:text-cyan-300 shrink-0`}),(0,J.jsx)(`span`,{className:`text-sm text-white font-medium truncate min-w-0 flex-1`,children:e.batchName}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray shrink-0`,children:[n>0&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-emerald-700 dark:text-emerald-400`,children:[(0,J.jsx)(k,{className:`w-3 h-3`}),n]}),r>0&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-red-700 dark:text-red-400`,children:[(0,J.jsx)(E,{className:`w-3 h-3`}),r]}),i>0&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-orange-700 dark:text-orange-400`,children:[(0,J.jsx)(F,{className:`w-3 h-3`}),i]}),a>0&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-gray-400`,children:[(0,J.jsx)(_,{className:`w-3 h-3`}),a]}),(0,J.jsx)(`span`,{title:o??void 0,children:o?fe(o,l,g):null})]})]}),!t&&(0,J.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary bg-black/20 p-2 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2`,children:e.items.map(e=>(0,J.jsx)(Qe,{item:e,onRemove:()=>s(e),onRequeue:()=>c(e),timeFormat:l,hasPermission:m,canModify:h,t:g},e.id))})]},`batch-${e.batchId}`)})}),e.length>t&&(0,J.jsxs)(`div`,{className:`mt-4 flex flex-col items-center gap-2`,children:[(0,J.jsx)(R,{variant:`secondary`,size:`sm`,onClick:n,children:g(`queue.history.showMore`)}),(0,J.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:g(`queue.history.showingCount`,{shown:Math.min(t,e.length),total:e.length})})]})]})}var Tt=50;function Et(){let{t:e}=a(),t=o(),{showToast:n}=O(),{hasPermission:u,hasAnyPermission:p,canModify:_}=Ie(),[b,ne]=(0,q.useState)(null),[T,re]=(0,q.useState)(``),[E,k]=(0,q.useState)(``),[A,j]=(0,q.useState)(!1),[M,ae]=(0,q.useState)(null),[P,oe]=(0,q.useState)(null),[F,I]=(0,q.useState)(null),[L,ue]=(0,q.useState)([]),[fe,me]=(0,q.useState)(!1),[ge,_e]=(0,q.useState)(null),[B,ve]=(0,q.useState)(()=>localStorage.getItem(`queue.historySortBy`)||`date`),[V,xe]=(0,q.useState)(()=>{let e=localStorage.getItem(`queue.historySortAsc`);return e===null?!1:e===`true`}),[Se,Ce]=(0,q.useState)(Tt),[U,W]=(0,q.useState)(()=>localStorage.getItem(`queue.pendingSortBy`)||`position`),[Te,De]=(0,q.useState)(()=>{let e=localStorage.getItem(`queue.pendingSortAsc`);return e===null?!0:e===`true`}),[ke]=(0,q.useState)(()=>{let e=Number(new URLSearchParams(window.location.search).get(`batch`));return Number.isInteger(e)&&e>0?e:null}),[G,Ae]=(0,q.useState)(()=>{let e=new URLSearchParams(window.location.search),t=e.get(`tab`);if(e.get(`batch`))return`batches`;if(t===`pipelines`||t===`history`||t===`timeline`||t===`queue`||t===`batches`)return t;let n=localStorage.getItem(`queue.activeTab`);return n===`history`||n===`timeline`||n===`pipelines`||n===`batches`?n:`queue`}),[je,Me]=(0,q.useState)(()=>localStorage.getItem(`queue.activeLayout`)===`printer`?`printer`:`position`),[K,Pe]=(0,q.useState)(()=>{try{let e=localStorage.getItem(`queue.batchCollapsed`);return e?JSON.parse(e):{}}catch{return{}}}),[Fe,Be]=(0,q.useState)(null),[Ve,Ue]=(0,q.useState)(!1),[We,Y]=(0,q.useState)(null);(0,q.useEffect)(()=>{localStorage.setItem(`queue.historySortBy`,B)},[B]),(0,q.useEffect)(()=>{localStorage.setItem(`queue.historySortAsc`,String(V))},[V]),(0,q.useEffect)(()=>{Ce(Tt)},[B,V,E]),(0,q.useEffect)(()=>{localStorage.setItem(`queue.pendingSortBy`,U)},[U]),(0,q.useEffect)(()=>{localStorage.setItem(`queue.pendingSortAsc`,String(Te))},[Te]),(0,q.useEffect)(()=>{localStorage.setItem(`queue.activeTab`,G)},[G]),(0,q.useEffect)(()=>{localStorage.setItem(`queue.activeLayout`,je)},[je]),(0,q.useEffect)(()=>{localStorage.setItem(`queue.batchCollapsed`,JSON.stringify(K))},[K]);let Ke=S(g(te,{activationConstraint:{distance:8}}),g(y,{coordinateGetter:v})),{data:X}=s({queryKey:[`settings`],queryFn:r.getSettings}),qe=X?.time_format||`system`,{data:Je}=s({queryKey:[`batches`,`active`],queryFn:()=>r.getBatches(`active`)}),Ye=Je?.length??0,{data:Z,isLoading:Ze}=s({queryKey:[`queue`,b,T],queryFn:()=>r.getQueue(b||void 0,T||void 0),refetchInterval:5e3}),{data:Qe}=s({queryKey:[`printers`],queryFn:()=>r.getPrinters()}),$e=c({mutationFn:e=>r.updateSettings({queue_shortest_first:e}),onSuccess:()=>{t.invalidateQueries({queryKey:[`settings`]})}}),tt=c({mutationFn:e=>r.cancelQueueItem(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`queue`]}),n(e(`queue.toast.cancelled`))},onError:()=>n(e(`queue.toast.cancelFailed`),`error`)}),nt=c({mutationFn:e=>r.removeFromQueue(e),onSuccess:r=>{t.invalidateQueries({queryKey:[`queue`]}),t.invalidateQueries({queryKey:[`batches`]}),n(r.deleted===!1?e(`queue.toast.keptForOrder`):e(`queue.toast.removed`))},onError:()=>n(e(`queue.toast.removeFailed`),`error`)}),rt=c({mutationFn:e=>r.stopQueueItem(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`queue`]}),n(e(`queue.toast.stopped`))},onError:()=>n(e(`queue.toast.stopFailed`),`error`)}),[it,at]=(0,q.useState)(null),[ot,st]=(0,q.useState)(null),ct=c({mutationFn:({id:e,skipFilamentCheck:t})=>r.startQueueItem(e,{skipFilamentCheck:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`queue`]}),n(e(`queue.toast.released`)),at(null),st(null)},onError:(t,r)=>{if(t instanceof i&&t.status===409&&t.code===`insufficient_filament`){let e=t.detail?.deficit??[];at({itemId:r.id,deficit:e});return}if(t instanceof i&&t.status===409&&t.code===`unmatched_filament`){let e=t.detail?.missing??[];st({itemId:r.id,missing:e});return}n(e(`queue.toast.startFailed`),`error`)}}),dt=c({mutationFn:e=>r.reorderQueue(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`queue`]})},onError:()=>n(e(`queue.toast.reorderFailed`),`error`)}),ft=c({mutationFn:async()=>{let e=Z?.filter(e=>[`completed`,`failed`,`skipped`,`cancelled`].includes(e.status))||[],t=0,n=0;for(let i of e)(await r.removeFromQueue(i.id)).deleted===!1?n+=1:t+=1;return{cleared:t,kept:n}},onSuccess:({cleared:r,kept:i})=>{t.invalidateQueries({queryKey:[`queue`]}),t.invalidateQueries({queryKey:[`batches`]}),n(i>0?`${e(`queue.toast.historyCleared`,{count:r})} ${e(`queue.toast.historyKeptForOrders`,{kept:i})}`:e(`queue.toast.historyCleared`,{count:r}))},onError:()=>n(e(`queue.toast.clearHistoryFailed`),`error`)}),pt=c({mutationFn:e=>r.bulkUpdateQueue(e),onSuccess:e=>{t.invalidateQueries({queryKey:[`queue`]}),ue([]),me(!1),n(e.message)},onError:()=>n(e(`queue.toast.updateFailed`),`error`)}),mt=c({mutationFn:async e=>{for(let t of e)await r.cancelQueueItem(t);return e.length},onSuccess:r=>{t.invalidateQueries({queryKey:[`queue`]}),ue([]),n(e(`queue.toast.bulkCancelled`,{count:r}))},onError:()=>n(e(`queue.toast.bulkCancelFailed`),`error`)}),ht=c({mutationFn:e=>r.resumeQueueAfterFailure(e),onSuccess:r=>{t.invalidateQueries({queryKey:[`queue`]}),_e(null),n(e(`queue.toast.resumedAfterFailure`,{restored:r.restored,acknowledged:r.acknowledged}))},onError:()=>n(e(`queue.toast.resumeAfterFailureFailed`),`error`)}),gt=c({mutationFn:e=>r.createBatch(e),onSuccess:r=>{t.invalidateQueries({queryKey:[`queue`]}),ue([]),Ue(!1),Pe(e=>({...e,[r.id]:!1})),n(e(`queue.toast.batchCreated`,{name:r.name}))},onError:()=>n(e(`queue.toast.batchCreateFailed`),`error`)}),_t=c({mutationFn:e=>r.ungroupBatch(e),onSuccess:r=>{t.invalidateQueries({queryKey:[`queue`]}),Y(null),n(e(`queue.toast.batchUngrouped`,{count:r.ungrouped_count}))},onError:()=>n(e(`queue.toast.batchUngroupFailed`),`error`)}),yt=e=>{ue(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},Q=(0,q.useMemo)(()=>{let e=new Set;return Qe?.forEach(t=>{t.location&&e.add(t.location)}),Z?.forEach(t=>{t.target_location&&e.add(t.target_location)}),Array.from(e).sort()},[Qe,Z]),xt=(0,q.useCallback)(e=>E?e.target_location?e.target_location===E:e.printer_id?Qe?.find(t=>t.id===e.printer_id)?.location===E:!1:!0,[E,Qe]),$=(0,q.useMemo)(()=>{let e=Z?.filter(e=>e.status===`pending`)||[];E&&(e=e.filter(xt));let t=e=>{if(!e.scheduled_time)return 0;let t=z(e.scheduled_time)?.getTime()??0;return t>Date.now()+4320*60*60*1e3?0:t};return X?.queue_shortest_first?[...e].sort((e,t)=>et(e,t,!0)):[...e].sort((e,n)=>{let r;if(U===`name`){let t=e.archive_name||e.library_file_name||``,i=n.archive_name||n.library_file_name||``;r=t.localeCompare(i)}else r=U===`printer`?(e.printer_name||``).localeCompare(n.printer_name||``):U===`time`?t(e)-t(n):e.position-n.position;return Te?r:-r})},[Z,U,Te,xt,E,X?.queue_shortest_first]),Et=()=>{let e=$.map(e=>e.id);L.length===e.length?ue([]):ue(e)},Ot=(0,q.useMemo)(()=>{let e=Z?.filter(e=>e.status===`printing`)||[];return E&&(e=e.filter(xt)),e},[Z,E,xt]),kt=(0,q.useMemo)(()=>{let e=new Set;if(!Z)return e;let t=new Set;Z.forEach(e=>{e.status===`printing`&&e.printer_id&&t.add(e.printer_id)});let n=e=>e.scheduled_time?(z(e.scheduled_time)?.getTime()??0)>Date.now():!1,r=(e,t)=>et(e,t,X?.queue_shortest_first??!1),i=new Map;return Z.filter(e=>e.status===`pending`&&e.printer_id!=null&&!e.manual_start&&!n(e)).sort(r).forEach(e=>{let t=i.get(e.printer_id)??[];t.push(e),i.set(e.printer_id,t)}),Z.forEach(r=>{if(r.status===`pending`&&!r.waiting_reason&&!n(r)&&!(r.print_time_seconds==null||r.print_time_seconds<=0)&&!r.require_previous_success){if(r.printer_id==null){e.add(r.id);return}if(!t.has(r.printer_id)){if(r.manual_start){e.add(r.id);return}i.get(r.printer_id)?.[0]?.id===r.id&&e.add(r.id)}}}),e},[Z,X?.queue_shortest_first]),[At,jt]=(0,q.useState)(()=>Date.now()),Mt=kt.size>0;(0,q.useEffect)(()=>{if(!Mt)return;jt(Date.now());let e=setInterval(()=>jt(Date.now()),3e4);return()=>clearInterval(e)},[Mt]);let Nt=(0,q.useMemo)(()=>{let e=new Set;return Ot.forEach(t=>{t.printer_id&&e.add(t.printer_id)}),Array.from(e)},[Ot]),Pt=l({queries:Nt.map(e=>({queryKey:[`printerStatus`,e],queryFn:()=>r.getPrinterStatus(e),refetchInterval:5e3}))}),Ft=(0,q.useMemo)(()=>{let e={};return Nt.forEach((t,n)=>{let r=Pt[n];r?.data?.state&&(e[t]=r.data.state)}),e},[Nt,Pt]),It=(0,q.useMemo)(()=>{let e={};return Nt.forEach((t,n)=>{let r=Pt[n];r?.data&&(e[t]={progress:r.data.progress??void 0,remaining_time:r.data.remaining_time??void 0,state:r.data.state??void 0})}),e},[Nt,Pt]),Lt=(0,q.useMemo)(()=>{let e=Z?.filter(e=>[`completed`,`failed`,`skipped`,`cancelled`].includes(e.status))||[];return E&&(e=e.filter(xt)),[...e].sort((e,t)=>{let n;if(B===`name`){let r=e.archive_name||e.library_file_name||``,i=t.archive_name||t.library_file_name||``;n=r.localeCompare(i)}else n=B===`printer`?(e.printer_name||``).localeCompare(t.printer_name||``):(z(t.completed_at||t.created_at)?.getTime()??0)-(z(e.completed_at||e.created_at)?.getTime()??0);return V?-n:n})},[Z,B,V,xt,E]),Rt=(0,q.useMemo)(()=>$.reduce((e,t)=>e+(t.print_time_seconds||0),0),[$]),zt=(0,q.useMemo)(()=>$.reduce((e,t)=>e+(t.filament_used_grams||0),0),[$]),Bt=e=>{let t=e.active.id;Be(typeof t==`number`||typeof t==`string`?t:null)},Vt=e=>{let{active:t,over:n}=e;if(Be(null),!n||t.id===n.id)return;let r,i=t.id;if(typeof i==`string`&&i.startsWith(`batch-`)){let e=Number(i.slice(6));r=$.filter(t=>t.batch_id===e).map(e=>e.id)}else{let e=i;r=L.includes(e)&&L.length>1?L.slice().sort((e,t)=>$.findIndex(t=>t.id===e)-$.findIndex(e=>e.id===t)):[e]}if(r.length===0)return;let a,o=n.id;if(typeof o==`string`&&o.startsWith(`batch-`)){let e=Number(o.slice(6));a=$.findIndex(t=>t.batch_id===e)}else a=$.findIndex(e=>e.id===o);if(a===-1)return;let s=$[a],c=$.filter(e=>!r.includes(e.id)),l=c.findIndex(e=>e.id===s.id);l===-1&&(l=a),$.findIndex(e=>e.id===r[0])$.find(t=>t.id===e)).filter(e=>!!e),...c.slice(l)].map((e,t)=>({id:e.id,position:t+1}));dt.mutate(u)},Ht=(0,q.useMemo)(()=>{let t=[],n=new Set;for(let r of $)if(r.batch_id!=null){if(n.has(r.batch_id))continue;n.add(r.batch_id);let i=$.filter(e=>e.batch_id===r.batch_id);t.push({kind:`batch`,batchId:r.batch_id,batchName:r.batch_name||e(`queue.batch.defaultName`),items:i})}else t.push({kind:`item`,item:r});return t},[$,e]),Ut=u(`queue:reorder`)&&U===`position`&&!X?.queue_shortest_first,Wt=e=>e.kind===`item`?[e.item.id]:e.items.map(e=>e.id),Gt=(e,t,n)=>{let r=$.filter(t=>!e.includes(t.id)),i=r.findIndex(e=>e.id===t);if(i===-1)return;n&&(i+=1);let a=e.map(e=>$.find(t=>t.id===e)).filter(e=>!!e),o=[...r.slice(0,i),...a,...r.slice(i)];dt.mutate(o.map((e,t)=>({id:e.id,position:t+1})))},Kt=(e,t)=>{if(!Ut)return{};let n=Wt(e[t]);return{onMoveUp:t>0?()=>Gt(n,Wt(e[t-1])[0],!1):void 0,onMoveDown:t{let r=Wt(e[t+1]);Gt(n,r[r.length-1],!0)}:void 0}},qt=(0,q.useMemo)(()=>{let e=[];for(let t of Ht)if(t.kind===`item`)e.push(t.item.id);else if(e.push(`batch-${t.batchId}`),!(K[t.batchId]??!0))for(let n of t.items)e.push(n.id);return e},[Ht,K]),Jt=(0,q.useMemo)(()=>L.length<2?!1:L.every(e=>{let t=$.find(t=>t.id===e);return t&&t.batch_id==null}),[L,$]),Yt=e=>{Pe(t=>({...t,[e]:!(t[e]??!0)}))},Xt=(0,q.useMemo)(()=>{let t=new Map,n=t=>{if(t.printer_id)return{key:`printer:${t.printer_id}`,label:t.printer_name||`Printer #${t.printer_id}`,printerId:t.printer_id,targetModel:null,isUnassigned:!1};if((t.variants?.length??0)>1){let n=t.variants.map(e=>e.target_model).join(` / `);return{key:`models:${n}`,label:`${e(`queue.filter.any`)} ${n}`,printerId:null,targetModel:null,isUnassigned:!1}}return t.target_model?{key:`model:${t.target_model}`,label:`${e(`queue.filter.any`)} ${t.target_model}`,printerId:null,targetModel:t.target_model,isUnassigned:!1}:{key:`unassigned`,label:e(`queue.filter.unassigned`),printerId:null,targetModel:null,isUnassigned:!0}};for(let e of Ht){let r=e.kind===`item`?e.item:e.items[0];if(!r)continue;let i=n(r);t.has(i.key)||t.set(i.key,{...i,rows:[]}),t.get(i.key).rows.push(e)}return Array.from(t.values()).sort((e,t)=>e.isUnassigned&&!t.isUnassigned?1:!e.isUnassigned&&t.isUnassigned?-1:e.label.localeCompare(t.label))},[Ht,e]),Zt=(0,q.useMemo)(()=>{let e=new Map;return Z?.forEach(t=>{if(t.status===`skipped`&&t.error_message===`Previous print failed or was aborted`&&t.printer_id){let n=e.get(t.printer_id);n?n.count+=1:e.set(t.printer_id,{name:t.printer_name||`Printer #${t.printer_id}`,count:1})}}),Array.from(e.entries()).map(([e,{name:t,count:n}])=>({printerId:e,printerName:t,skippedCount:n})).sort((e,t)=>e.printerName.localeCompare(t.printerName))},[Z]),Qt=e=>{let t=0,n=0,r=0;for(let i of e){let e=i.kind===`item`?[i.item]:i.items;for(let i of e)t+=1,n+=i.print_time_seconds||0,r+=i.filament_used_grams||0}return{count:t,time:n,weight:r}};return(0,J.jsxs)(`div`,{className:`p-4 md:p-8`,children:[(0,J.jsx)(`div`,{className:`flex items-center justify-between mb-6`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,J.jsx)(Ne,{className:`w-7 h-7 text-bambu-green`}),e(`queue.title`)]}),(0,J.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`queue.subtitle`)})]})}),(0,J.jsx)(`div`,{className:`flex gap-1 border-b border-bambu-dark-tertiary mb-6 overflow-x-auto`,children:[{id:`queue`,label:e(`queue.tabs.queue`),icon:H,count:$.length+Ot.length},{id:`batches`,label:e(`queue.tabs.batches`),icon:N,count:Ye},{id:`history`,label:e(`queue.tabs.history`),icon:Ne,count:Lt.length},{id:`timeline`,label:e(`queue.tabs.timeline`),icon:Re,count:null},{id:`pipelines`,label:e(`queue.tabs.pipelines`),icon:se,count:null}].map(({id:e,label:t,icon:n,count:r})=>(0,J.jsxs)(`button`,{onClick:()=>Ae(e),className:`px-4 py-2.5 text-sm flex items-center gap-2 border-b-2 -mb-px transition-colors whitespace-nowrap ${G===e?`text-white border-bambu-green font-medium`:`text-bambu-gray border-transparent hover:text-white`}`,children:[(0,J.jsx)(n,{className:`w-4 h-4`}),t,r!==null&&r>0&&(0,J.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded-full ${G===e?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:r})]},e))}),G!==`pipelines`&&G!==`batches`&&(0,J.jsx)(Xe,{activeCount:Ot.length,pendingCount:$.length,totalTime:Rt,totalWeight:zt,historyCount:Lt.length,t:e}),G===`queue`&&Zt.length>0&&u(`queue:update_all`)&&(0,J.jsx)(`div`,{className:`mb-4 space-y-2`,children:Zt.map(({printerId:t,printerName:n,skippedCount:r})=>(0,J.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 bg-orange-50 dark:bg-orange-500/10 border border-orange-300 dark:border-orange-500/30 rounded-lg`,children:[(0,J.jsx)(D,{className:`w-5 h-5 text-orange-600 dark:text-orange-400 flex-shrink-0`}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-sm text-orange-800 dark:text-orange-200`,children:e(`queue.resumeAfterFailure.banner`,{printer:n,count:r})}),(0,J.jsx)(`div`,{className:`text-xs text-orange-800/80 dark:text-orange-200/70 mt-0.5`,children:e(`queue.resumeAfterFailure.bannerHint`)})]}),(0,J.jsxs)(`button`,{onClick:()=>_e({printerId:t,printerName:n,skippedCount:r}),className:`flex items-center gap-1.5 px-3 py-1.5 bg-orange-100 dark:bg-orange-500/20 hover:bg-orange-200 dark:hover:bg-orange-500/30 text-orange-900 dark:text-orange-100 text-sm rounded-md border border-orange-300 dark:border-orange-500/40 transition-colors flex-shrink-0`,children:[(0,J.jsx)(ze,{className:`w-4 h-4`}),e(`queue.resumeAfterFailure.button`)]})]},t))}),G!==`pipelines`&&G!==`batches`&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:gap-4 mb-6`,children:[(0,J.jsxs)(`select`,{className:`px-2 sm:px-3 py-2 text-sm sm:text-base bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none min-w-0 flex-1 sm:flex-none`,value:b===-1?`unassigned`:b||``,onChange:e=>{let t=e.target.value;ne(t===`unassigned`?-1:t===``?null:Number(t))},children:[(0,J.jsx)(`option`,{value:``,children:e(`queue.filter.allPrinters`)}),(0,J.jsx)(`option`,{value:`unassigned`,children:e(`queue.filter.unassigned`)}),Qe?.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,J.jsxs)(`select`,{className:`px-2 sm:px-3 py-2 text-sm sm:text-base bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none min-w-0 flex-1 sm:flex-none`,value:T,onChange:e=>re(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:e(`queue.filter.allStatus`)}),(0,J.jsx)(`option`,{value:`pending`,children:e(`queue.status.pending`)}),(0,J.jsx)(`option`,{value:`printing`,children:e(`queue.status.printing`)}),(0,J.jsx)(`option`,{value:`completed`,children:e(`queue.status.completed`)}),(0,J.jsx)(`option`,{value:`failed`,children:e(`queue.status.failed`)}),(0,J.jsx)(`option`,{value:`skipped`,children:e(`queue.status.skipped`)}),(0,J.jsx)(`option`,{value:`cancelled`,children:e(`queue.status.cancelled`)})]}),Q.length>0&&(0,J.jsxs)(`select`,{className:`px-2 sm:px-3 py-2 text-sm sm:text-base bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none min-w-0 flex-1 sm:flex-none`,value:E,onChange:e=>k(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:e(`queue.filter.allLocations`)}),Q.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]}),(0,J.jsx)(`div`,{className:`hidden sm:block flex-1`}),G===`history`&&Lt.length>0&&(0,J.jsxs)(R,{className:`w-full sm:w-auto`,variant:`secondary`,size:`sm`,onClick:()=>j(!0),disabled:!u(`queue:delete_all`),title:u(`queue:delete_all`)?void 0:e(`queue.permissions.noClearHistory`),children:[(0,J.jsx)(he,{className:`w-4 h-4`}),e(`queue.clearHistory`)]})]}),G===`queue`&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mb-6`,children:[(0,J.jsxs)(`div`,{className:`inline-flex items-center bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg p-0.5`,children:[(0,J.jsxs)(`button`,{className:`px-3 py-1.5 text-xs sm:text-sm rounded-md transition-colors flex items-center gap-1.5 ${je===`position`?`bg-bambu-dark-tertiary text-white`:`text-bambu-gray hover:text-white`}`,onClick:()=>Me(`position`),title:e(`queue.layout.flatList`),children:[(0,J.jsx)(ie,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:e(`queue.layout.flatList`)})]}),(0,J.jsxs)(`button`,{className:`px-3 py-1.5 text-xs sm:text-sm rounded-md transition-colors flex items-center gap-1.5 ${je===`printer`?`bg-bambu-dark-tertiary text-white`:`text-bambu-gray hover:text-white`}`,onClick:()=>Me(`printer`),title:e(`queue.layout.groupByPrinter`),children:[(0,J.jsx)(ye,{className:`w-3.5 h-3.5`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:e(`queue.layout.byPrinter`)})]})]}),(0,J.jsxs)(`button`,{onClick:()=>{let e=!(X?.queue_shortest_first??!1);$e.mutate(e)},className:`flex items-center gap-1 px-2 py-1.5 text-xs rounded-lg border transition-colors ${X?.queue_shortest_first?`bg-bambu-green/20 border-bambu-green text-bambu-green`:`bg-bambu-dark-secondary border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray`}`,title:e(`queue.sjf.tooltip`,`Shortest Job First — scheduler prioritizes shorter prints`),children:[(0,J.jsx)(He,{className:`w-4 h-4`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:e(`queue.sjf.label`,`SJF`)}),(0,J.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${X?.queue_shortest_first?`bg-bambu-green`:`bg-bambu-gray`}`})]})]}),G===`pipelines`?(0,J.jsx)(Ge,{}):G===`batches`?(0,J.jsx)(ut,{hasPermission:u,t:e,focusBatchId:ke}):Ze?(0,J.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`common.loading`)}):Z?.length===0?(0,J.jsxs)(le,{className:`p-12 text-center border-dashed`,children:[(0,J.jsx)(w,{className:`w-16 h-16 text-bambu-gray mx-auto mb-4 opacity-50`}),(0,J.jsx)(`h3`,{className:`text-xl font-medium text-white mb-2`,children:e(`queue.empty.title`)}),(0,J.jsx)(`p`,{className:`text-bambu-gray max-w-md mx-auto`,children:e(`queue.empty.description`)})]}):G===`timeline`?(0,J.jsx)(lt,{queueItems:Z||[],printers:Qe||[],printerStatuses:It,sjfEnabled:X?.queue_shortest_first??!1,onItemClick:e=>{[`completed`,`failed`,`skipped`,`cancelled`].includes(e.status)?oe(e):e.status===`pending`?ae(e):e.status===`printing`&&I({type:`stop`,item:e})},t:e}):G===`history`?(0,J.jsx)(wt,{items:Lt,collapsed:!1,visibleCount:Se,onShowMore:()=>Ce(e=>e+Tt),sortBy:B,sortAsc:V,onSortByChange:ve,onSortAscToggle:()=>xe(!V),onRemove:e=>I({type:`remove`,item:e}),onRequeue:oe,timeFormat:qe,batchCollapsed:K,toggleBatchCollapsed:Yt,hasPermission:u,canModify:_,t:e}):(0,J.jsxs)(`div`,{className:`space-y-6 sm:space-y-8`,children:[Ot.length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h2`,{className:`text-base sm:text-lg font-semibold text-white mb-3 sm:mb-4 flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-400 animate-pulse`}),e(`queue.sections.currentlyPrinting`)]}),(0,J.jsx)(`div`,{className:`space-y-2 sm:space-y-3`,children:Ot.map(t=>(0,J.jsx)(St,{item:t,onEdit:()=>{},onCancel:()=>{},onRemove:()=>{},onStop:()=>I({type:`stop`,item:t}),onRequeue:()=>{},onStart:()=>{},timeFormat:qe,hasPermission:u,canModify:_,printerState:t.printer_id?Ft[t.printer_id]:null,t:e},t.id))})]}),$.length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 mb-3 sm:mb-4`,children:[(0,J.jsxs)(`h2`,{className:`text-base sm:text-lg font-semibold text-white flex items-center gap-2`,children:[(0,J.jsx)(H,{className:`w-4 h-4 sm:w-5 sm:h-5 text-yellow-600 dark:text-yellow-400`}),e(`queue.sections.queued`),(0,J.jsxs)(`span`,{className:`text-xs sm:text-sm font-normal text-bambu-gray`,children:[`(`,e(`queue.itemCount`,{count:$.length}),`)`]}),(0,J.jsx)(`span`,{className:`hidden sm:inline text-xs text-bambu-gray ml-2`,title:e(`queue.reorderHint`),children:e(`queue.dragToReorder`)})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`select`,{className:`px-2 sm:px-3 py-1.5 text-xs sm:text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:U,onChange:e=>W(e.target.value),children:[(0,J.jsx)(`option`,{value:`position`,children:e(`queue.sort.byPosition`)}),(0,J.jsx)(`option`,{value:`name`,children:e(`queue.sort.byName`)}),(0,J.jsx)(`option`,{value:`printer`,children:e(`queue.sort.byPrinter`)}),(0,J.jsx)(`option`,{value:`time`,children:e(`queue.sort.bySchedule`)})]}),(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:()=>De(!Te),title:e(Te?`common.ascending`:`common.descending`),className:`px-2`,children:Te?(0,J.jsx)(f,{className:`w-4 h-4`}):(0,J.jsx)(d,{className:`w-4 h-4`})})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:gap-3 mb-3 sm:mb-4 p-2 sm:p-3 bg-bambu-dark rounded-lg`,children:[(0,J.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:Et,className:`flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm`,children:[L.length===$.length&&$.length>0?(0,J.jsx)(we,{className:`w-4 h-4 text-bambu-green`}):(0,J.jsx)(be,{className:`w-4 h-4`}),L.length===$.length&&$.length>0?e(`queue.bulkEdit.deselectAll`):e(`queue.bulkEdit.selectAll`)]}),L.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-xs sm:text-sm text-bambu-gray`,children:e(`queue.bulkEdit.selected`,{count:L.length})}),(0,J.jsx)(`div`,{className:`hidden sm:block h-4 w-px bg-bambu-dark-tertiary`}),Jt&&(0,J.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:()=>Ue(!0),className:`flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm text-cyan-700 dark:text-cyan-300 hover:text-cyan-900 dark:hover:text-cyan-200`,title:e(`queue.batch.groupAsBatch`),children:[(0,J.jsx)(N,{className:`w-3.5 h-3.5 sm:w-4 sm:h-4`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:e(`queue.batch.groupAsBatch`)})]}),(0,J.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:()=>me(!0),className:`flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm text-bambu-green hover:text-bambu-green-light`,disabled:!p(`queue:update_own`,`queue:update_all`),title:p(`queue:update_own`,`queue:update_all`)?e(`queue.bulkEdit.editSelected`):e(`queue.permissions.noEditItems`),children:[(0,J.jsx)(pe,{className:`w-3.5 h-3.5 sm:w-4 sm:h-4`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:e(`queue.bulkEdit.editSelected`)})]}),(0,J.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:()=>mt.mutate(L),className:`flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300`,disabled:mt.isPending||!p(`queue:delete_own`,`queue:delete_all`),title:p(`queue:delete_own`,`queue:delete_all`)?e(`queue.bulkEdit.cancelSelected`):e(`queue.permissions.noCancelItems`),children:[(0,J.jsx)(ce,{className:`w-3.5 h-3.5 sm:w-4 sm:h-4`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:e(`queue.bulkEdit.cancelSelected`)})]})]})]}),(0,J.jsxs)(ee,{sensors:Ke,collisionDetection:h,onDragStart:Bt,onDragEnd:Vt,children:[(0,J.jsx)(C,{items:qt,strategy:x,children:je===`position`?(0,J.jsx)(`div`,{className:`space-y-2 sm:space-y-3`,children:Ht.map((t,n)=>(0,J.jsx)(Ct,{row:t,collapsed:t.kind===`batch`?K[t.batchId]??!0:!1,onToggleBatch:t.kind===`batch`?()=>Yt(t.batchId):void 0,onUngroup:t.kind===`batch`?()=>Y(t.batchId):void 0,setEditItem:ae,setConfirmAction:I,startMutation:ct,selectedItems:L,handleToggleSelect:yt,timeFormat:qe,hasPermission:u,canModify:_,t:e,etaEligibleIds:kt,etaNow:At,aggregateForRows:Qt,...Kt(Ht,n),onMoveBlock:Ut?Gt:void 0},t.kind===`item`?`item-${t.item.id}`:`batch-${t.batchId}`))}):(0,J.jsx)(`div`,{className:`space-y-4`,children:Xt.map(t=>{let n=Qt(t.rows);return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-t-lg`,children:[(0,J.jsx)(ye,{className:`w-4 h-4 ${t.isUnassigned?`text-orange-600 dark:text-orange-400`:t.targetModel?`text-blue-600 dark:text-blue-400`:`text-bambu-green`}`}),(0,J.jsx)(`span`,{className:`font-semibold text-white text-sm`,children:t.label}),(0,J.jsxs)(`span`,{className:`text-xs text-bambu-gray flex flex-wrap gap-x-3`,children:[(0,J.jsx)(`span`,{children:e(`queue.itemCount`,{count:n.count})}),n.time>0&&(0,J.jsx)(`span`,{children:de(n.time)}),n.weight>0&&(0,J.jsx)(`span`,{children:vt(n.weight)})]})]}),(0,J.jsx)(`div`,{className:`bg-bambu-dark/40 border border-t-0 border-bambu-dark-tertiary rounded-b-lg p-2 space-y-2`,children:t.rows.map((n,r)=>(0,J.jsx)(Ct,{row:n,collapsed:n.kind===`batch`?K[n.batchId]??!0:!1,onToggleBatch:n.kind===`batch`?()=>Yt(n.batchId):void 0,onUngroup:n.kind===`batch`?()=>Y(n.batchId):void 0,setEditItem:ae,setConfirmAction:I,startMutation:ct,selectedItems:L,handleToggleSelect:yt,timeFormat:qe,hasPermission:u,canModify:_,t:e,etaEligibleIds:kt,etaNow:At,aggregateForRows:Qt,...Kt(t.rows,r),onMoveBlock:Ut?Gt:void 0},n.kind===`item`?`item-${n.item.id}`:`batch-${n.batchId}`))})]},t.key)})})}),(0,J.jsx)(m,{children:(()=>{if(Fe===null)return null;if(typeof Fe==`string`&&Fe.startsWith(`batch-`)){let t=Number(Fe.slice(6)),n=$.filter(e=>e.batch_id===t);if(n.length===0)return null;let r=n[0].batch_name||e(`queue.batch.defaultName`);return(0,J.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 bg-bambu-dark-secondary border-2 border-cyan-400 rounded-lg shadow-2xl`,children:[(0,J.jsx)(N,{className:`w-4 h-4 text-cyan-700 dark:text-cyan-300`}),(0,J.jsx)(`span`,{className:`text-sm text-white font-medium`,children:e(`queue.dragGhost.batch`,{defaultValue:`{{name}} ({{count}} copies)`,name:r,count:n.length})})]})}return typeof Fe==`number`&&L.includes(Fe)&&L.length>1?(0,J.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 bg-bambu-dark-secondary border-2 border-cyan-400 rounded-lg shadow-2xl`,children:[(0,J.jsx)(N,{className:`w-4 h-4 text-cyan-700 dark:text-cyan-300`}),(0,J.jsx)(`span`,{className:`text-sm text-white font-medium`,children:e(`queue.dragGhost.multiCount`,{count:L.length})})]}):null})()})]})]})]}),M&&(0,J.jsx)(Oe,{mode:`edit-queue-item`,archiveId:M.archive_id??void 0,libraryFileId:M.library_file_id??void 0,archiveName:Le(M,t=>e(`common.plusNMore`,{count:t})),queueItem:M,onClose:()=>ae(null)}),P&&(0,J.jsx)(Oe,{mode:`create`,archiveId:P.archive_id??void 0,libraryFileId:P.library_file_id??void 0,archiveName:Le(P,t=>e(`common.plusNMore`,{count:t})),onClose:()=>oe(null)}),it&&(0,J.jsx)(Ee,{title:e(`queue.filamentShort.confirmTitle`),message:e(`queue.filamentShort.confirmIntro`)+` + +`+it.deficit.map(t=>e(`queue.filamentShort.lineItem`,{slot:t.slot_id,required:Math.round(t.required_grams),remaining:t.remaining_grams==null?e(`queue.filamentShort.unknown`):Math.round(t.remaining_grams)})).join(` +`),confirmText:e(`queue.filamentShort.printAnyway`),variant:`warning`,onConfirm:()=>{ct.mutate({id:it.itemId,skipFilamentCheck:!0})},onCancel:()=>at(null)}),ot&&(0,J.jsx)(Ee,{title:e(`queue.filamentMissing.confirmTitle`),message:e(`queue.filamentMissing.confirmIntro`)+` + +`+ot.missing.join(` +`),confirmText:e(`queue.filamentShort.printAnyway`),variant:`warning`,onConfirm:()=>{ct.mutate({id:ot.itemId,skipFilamentCheck:!0})},onCancel:()=>st(null)}),F&&(0,J.jsx)(Ee,{title:F.type===`cancel`?e(`queue.confirm.cancelTitle`):F.type===`stop`?e(`queue.confirm.stopTitle`):e(`queue.confirm.removeTitle`),message:F.type===`cancel`?e(`queue.confirm.cancelMessage`,{name:F.item.archive_name||F.item.library_file_name||e(`queue.confirm.thisPrint`)}):F.type===`stop`?e(`queue.confirm.stopMessage`,{name:F.item.archive_name||F.item.library_file_name||e(`queue.confirm.thisPrint`)}):e(`queue.confirm.removeMessage`,{name:F.item.archive_name||F.item.library_file_name||e(`queue.confirm.thisItem`)}),confirmText:F.type===`cancel`?e(`queue.confirm.cancelButton`):F.type===`stop`?e(`queue.confirm.stopButton`):e(`common.remove`),variant:`danger`,onConfirm:()=>{F.type===`cancel`?tt.mutate(F.item.id):F.type===`stop`?rt.mutate(F.item.id):nt.mutate(F.item.id),I(null)},onCancel:()=>I(null)}),ge&&(0,J.jsx)(Ee,{title:e(`queue.resumeAfterFailure.confirmTitle`),message:e(`queue.resumeAfterFailure.confirmMessage`,{printer:ge.printerName,count:ge.skippedCount}),confirmText:e(`queue.resumeAfterFailure.button`),variant:`warning`,onConfirm:()=>ht.mutate(ge.printerId),onCancel:()=>_e(null)}),A&&(0,J.jsx)(Ee,{title:e(`queue.confirm.clearHistoryTitle`),message:e(`queue.confirm.clearHistoryMessage`,{count:Lt.length}),confirmText:e(`queue.clearHistory`),variant:`danger`,onConfirm:()=>{ft.mutate(),j(!1)},onCancel:()=>j(!1)}),fe&&(0,J.jsx)(bt,{selectedCount:L.length,printers:Qe?.map(e=>({id:e.id,name:e.name,nozzle_count:e.nozzle_count}))||[],onSave:e=>{Object.keys(e).length>0&&pt.mutate({item_ids:L,...e})},onClose:()=>me(!1),isSaving:pt.isPending,canControlPrinter:u(`printers:control`),hasGcodeSnippets:!!X?.gcode_snippets,t:e}),Ve&&(0,J.jsx)(Dt,{itemCount:L.length,isSaving:gt.isPending,defaultName:(()=>{let t=$.find(e=>L.includes(e.id)),n=(t?.archive_name||t?.library_file_name||``).replace(/\.gcode\.3mf$/i,``).replace(/\.3mf$/i,``);return n?`${n}`:e(`queue.batch.defaultName`)})(),onSave:e=>gt.mutate({name:e,item_ids:L}),onClose:()=>Ue(!1),t:e}),We!==null&&(0,J.jsx)(Ee,{title:e(`queue.batch.ungroupConfirmTitle`),message:e(`queue.batch.ungroupConfirmMessage`),confirmText:e(`queue.batch.ungroup`),variant:`warning`,onConfirm:()=>_t.mutate(We),onCancel:()=>Y(null)})]})}function Dt({itemCount:e,defaultName:t,isSaving:n,onSave:r,onClose:i,t:a}){let[o,s]=(0,q.useState)(t);return(0,J.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,children:(0,J.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl p-6 w-full max-w-md`,children:[(0,J.jsxs)(`h3`,{className:`text-lg font-semibold text-white mb-2 flex items-center gap-2`,children:[(0,J.jsx)(N,{className:`w-5 h-5 text-cyan-700 dark:text-cyan-300`}),a(`queue.batch.groupAsBatch`)]}),(0,J.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:a(`queue.batch.groupAsBatchDescription`,{count:e})}),(0,J.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:a(`queue.batch.nameLabel`)}),(0,J.jsx)(`input`,{type:`text`,autoFocus:!0,value:o,onChange:e=>s(e.target.value),placeholder:a(`queue.batch.namePlaceholder`),maxLength:120,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none mb-5`}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(R,{variant:`ghost`,size:`sm`,onClick:i,disabled:n,children:a(`common.cancel`)}),(0,J.jsx)(R,{variant:`primary`,size:`sm`,onClick:()=>{let e=o.trim();e&&r(e)},disabled:n||!o.trim(),children:a(n?`common.saving`:`queue.batch.create`)})]})]})})}export{Et as QueuePage}; \ No newline at end of file diff --git a/static/assets/ReferenceLine-clJprXoH.js b/static/assets/ReferenceLine-clJprXoH.js new file mode 100644 index 000000000..91a21bfba --- /dev/null +++ b/static/assets/ReferenceLine-clJprXoH.js @@ -0,0 +1,4 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{D as t}from"./client-DnySrlFv.js";import{t as n}from"./react-dom-B8Dg6xzp.js";import{t as r}from"./createLucideIcon-DvBYJlWL.js";import{F as i,Gt as a,Ht as o,Jt as s,Ln as c,Mn as l,Nn as u,P as d,Pn as f,St as p,Tn as m,Vt as h,Yt as g,Zt as _,_ as v,_n as y,bn as b,dn as x,fn as S,g as C,gn as w,gt as ee,h as T,hn as E,ht as te,it as D,jn as O,m as ne,pn as k,qt as A,vn as j,yn as M,z as N}from"./CartesianChart-BAcHzPFb.js";var re=r(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),ie=r(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),ae=e(n()),P=e(t());function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var f=t.formatter||i,p=c({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var m=t.inactive?a:t.color,h=f?f(t.value,t,r):t.value;return P.createElement(`li`,F({className:p,style:l,key:`legend-item-${r}`},M(e,t,r)),P.createElement(u,{width:n,height:n,viewBox:s,style:d,"aria-label":`${h} legend icon`},P.createElement(B,{data:t,iconType:o,inactiveColor:a})),P.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:m}},h))})}var H=e=>{var t=j(e,z),{payload:n,layout:r,align:i}=t;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return P.createElement(`ul`,{className:`recharts-default-legend`,style:a},P.createElement(V,F({},t,{payload:n})))};function U(){return w(k)}var W=[`contextPayload`];function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(h(e))},[t,e]),null}function ve(e){var t=E();return(0,P.useEffect)(()=>(t(o(e)),()=>{t(o({width:0,height:0}))}),[t,e]),null}function ye(e,t,n,r){return e===`vertical`&&t!=null?{height:t}:e===`horizontal`?{width:n||r}:null}var be={align:`center`,iconSize:14,inactiveColor:`#ccc`,itemSorter:`value`,layout:`horizontal`,verticalAlign:`bottom`};function J(e){var t=j(e,be),n=U(),r=O(),i=s(),{width:o,height:c,wrapperStyle:l,portal:u}=t,[d,f]=S([n]),p=A(),m=a();if(p==null||m==null)return null;var h=p-(i?.left||0)-(i?.right||0),g=ye(t.layout,c,o,h),_=u?l:q(q({position:`absolute`,width:g?.width||o||`auto`,height:g?.height||c||`auto`},ge(l,t,i,p,m,d)),l),v=u??r;return v==null||n==null?null:(0,ae.createPortal)(P.createElement(`div`,{className:`recharts-legend-wrapper`,style:_,ref:f},P.createElement(_e,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!u&&P.createElement(ve,{width:d.width,height:d.height}),P.createElement(he,G({},t,g,{margin:i,chartWidth:p,chartHeight:m,contextPayload:n}))),v)}J.displayName=`Legend`;var xe=class{constructor(e){var{x:t,y:n}=e;this.xAxisScale=t,this.yAxisScale=n}map(e,t){var{position:n}=t;return{x:this.xAxisScale.map(e.x,{position:n})??0,y:this.yAxisScale.map(e.y,{position:n})??0}}mapWithFallback(e,t){var{position:n,fallback:r}=t,i=r===`rangeMin`?this.yAxisScale.rangeMin():r===`rangeMax`?this.yAxisScale.rangeMax():0,a=r===`rangeMin`?this.xAxisScale.rangeMin():r===`rangeMax`?this.xAxisScale.rangeMax():0;return{x:this.xAxisScale.map(e.x,{position:n})??a,y:this.yAxisScale.map(e.y,{position:n})??i}}isInRange(e){var{x:t,y:n}=e,r=t==null||this.xAxisScale.isInRange(t),i=n==null||this.yAxisScale.isInRange(n);return r&&i}};function Y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X(e){for(var t=1;t{var n;if(P.isValidElement(e))n=P.cloneElement(e,t);else if(typeof e==`function`)n=e(t);else{if(!x(t.x1)||!x(t.y1)||!x(t.x2)||!x(t.y2))return null;n=P.createElement(`line`,Z({},t,{className:`recharts-reference-line-line`}))}return n},Ee=(e,t,n,r,i,a)=>{var{x:o,width:s}=a,c=i.map(e,{position:n});if(!x(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:o+s,y:c},{x:o,y:c}];return r===`left`?l.reverse():l},Q=(e,t,n,r,i,a)=>{var{y:o,height:s}=a,c=i.map(e,{position:n});if(!x(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:c,y:o+s},{x:c,y:o}];return r===`top`?l.reverse():l},De=(e,t,n,r)=>{var i=[r.mapWithFallback(e[0],{position:n,fallback:`rangeMin`}),r.mapWithFallback(e[1],{position:n,fallback:`rangeMax`})];return t===`discard`&&i.some(e=>!r.isInRange(e))?null:i},Oe=(e,t,n,r,i,a,o)=>{var{x:s,y:c,segment:l,ifOverflow:u}=o,d=m(s);return m(c)?Ee(c,u,r,a,t,n):d?Q(s,u,r,i,e,n):l!=null&&l.length===2?De(l,u,r,new xe({x:e,y:t})):null};function ke(e){var t=E();return(0,P.useEffect)(()=>(t(T(e)),()=>{t(C(e))})),null}function Ae(e){var{xAxisId:t,yAxisId:n,shape:r,className:a,ifOverflow:o}=e,s=_(),u=ne(),p=w(e=>te(e,t)),m=w(e=>ee(e,n)),h=w(e=>D(e,`xAxis`,t,s)),y=w(e=>D(e,`yAxis`,n,s)),b=g();if(!u||!b||p==null||m==null||h==null||y==null)return null;var x=Oe(h,y,b,e.position,p.orientation,m.orientation,e);if(!x)return null;var S=x[0],C=x[1];if(S==null||C==null)return null;var{x:T,y:E}=S,{x:O,y:k}=C,A=X(X({clipPath:o===`hidden`?`url(#${u})`:void 0},f(e)),{},{x1:T,y1:E,x2:O,y2:k}),j=v({x1:T,y1:E,x2:O,y2:k});return P.createElement(N,{zIndex:e.zIndex},P.createElement(l,{className:c(`recharts-reference-line`,a)},Te(r,A),P.createElement(d,Z({},j,{lowerWidth:j.width,upperWidth:j.width}),P.createElement(i,{label:e.label}),e.children)))}var je={ifOverflow:`discard`,xAxisId:0,yAxisId:0,fill:`none`,label:!1,stroke:`#ccc`,fillOpacity:1,strokeWidth:1,position:`middle`,zIndex:p.line};function $(e){var t=j(e,je);return P.createElement(P.Fragment,null,P.createElement(ke,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x:t.x,y:t.y,segment:t.segment}),P.createElement(Ae,t))}$.displayName=`ReferenceLine`;export{re as i,J as n,ie as r,$ as t}; \ No newline at end of file diff --git a/static/assets/RichTextEditor-CuGcRbGW.js b/static/assets/RichTextEditor-CuGcRbGW.js new file mode 100644 index 000000000..ff78cc458 --- /dev/null +++ b/static/assets/RichTextEditor-CuGcRbGW.js @@ -0,0 +1,129 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,T as r,w as i}from"./client-DnySrlFv.js";import{t as a}from"./react-dom-B8Dg6xzp.js";import{t as o}from"./createLucideIcon-DvBYJlWL.js";import{t as s}from"./list-CLcpeoSz.js";import{t as c}from"./unlink-C098nwOf.js";import{on as l,sn as u}from"./index-CovRLYqQ.js";import{t as d}from"./with-selector-CsEuXInf.js";var f=o(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),p=o(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),m=o(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),h=o(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),g=o(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),_=o(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),v=e(n(),1),y=e(a(),1),b=r(),x=t(),ee=Object.defineProperty,te=(e,t)=>{let n={};for(var r in e)ee(n,r,{get:e[r],enumerable:!0});return t||ee(n,Symbol.toStringTag,{value:`Module`}),n};function S(e){this.content=e}S.prototype={constructor:S,find:function(e){for(var t=0;t>1}},S.from=function(e){if(e instanceof S)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new S(t)};function ne(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i=56320&&e<57344}function ae(e){return e>=55296&&e<56320}var C=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;te&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);at)for(let e=0,a=0;at&&((an)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?se(t+1,i):se(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;ethis.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;te.type.rank-t.type.rank),n}};w.none=[];var le=class extends Error{},T=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=de(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(ue(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(C.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};T.empty=new T(C.empty,0,0);function ue(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(ue(a.content,t-i-1,n-i-1)))}function de(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=de(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function fe(e,t,n){if(n.openStart>e.depth)throw new le(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new le(`Inconsistent open depths`);return pe(e,t,n,0)}function pe(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function _e(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ge(e.nodeAfter,r),a++));for(let e=a;ei&&he(e,t,i+1),o=r.depth>i&&he(n,r,i+1),s=[];return _e(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(me(a,o),ge(ve(a,ye(e,t,n,r,i+1)),s)):(a&&ge(ve(a,be(e,t,i+1)),s),_e(t,n,i,s),o&&ge(ve(o,be(n,r,i+1)),s)),_e(r,null,i,s),new C(s)}function be(e,t,n){let r=[];return _e(null,e,n,r),e.depth>n&&ge(ve(he(e,t,n+1),be(e,t,n+1)),r),_e(t,null,n,r),new C(r)}function xe(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(C.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Se=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Ee(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Te.get(t);if(r)for(let e=0;ee&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),Ae(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=C.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;ee.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=C.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Oe.prototype.text=void 0;var ke=class e extends Oe{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ae(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Ae(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var je=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Me(t,n);if(r.next==null)return e.empty;let i=Ne(r);r.next&&r.err(`Unexpected trailing text`);let a=Ue(Be(i));return We(a,r),a}matchType(e){for(let t=0;te.createAndFill()));for(let e=0;e=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n`+e.indexOf(t.next[n].next);return r}).join(` +`)}};je.empty=new je(!0);var Me=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Ne(e){let t=[];do t.push(Pe(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Pe(e){let t=[];do t.push(Fe(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Fe(e){let t=ze(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Le(e,t);else break;return t}function Ie(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Le(e,t){let n=Ie(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Ie(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Re(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function ze(e){if(e.eat(`(`)){let t=Ne(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Re(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Be(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new je(r.indexOf(e.length-1)>-1);for(let e=0;e-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ke(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Oe(this,this.computeAttrs(e),C.from(t),w.setFrom(n))}createChecked(e=null,t,n){return t=C.from(t),this.checkContent(t),new Oe(this,this.computeAttrs(e),t,w.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=C.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(C.empty,!0);return i?new Oe(this,e,t.append(i),w.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Xe(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Ze=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Xe(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Qe=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Je(e,r.attrs),this.excluded=null;let i=Ge(this.attrs);this.instance=i?new w(this,i):null}create(e=null){return!e&&this.instance?this.instance:new w(this,Ke(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t-1}},$e=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=S.from(e.nodes),t.marks=S.from(e.marks||{}),this.nodes=Ye.compile(this.spec.nodes,this),this.marks=Qe.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=je.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?et(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:et(this,n.split(` `))}this.nodeFromJSON=e=>Oe.fromJSON(this,e),this.markFromJSON=e=>w.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Ye))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new ke(n,n.defaultAttrs,e,w.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function et(e,t){let n=[];for(let r=0;r-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function tt(e){return e.tag!=null}function nt(e){return e.style!=null}var rt=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(tt(e))this.tags.push(e);else if(nt(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new ft(this,t,!1);return n.addAll(e,w.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ft(this,t,!0);return n.addAll(e,w.none,t.from,t.to),T.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;re.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r{n(e=ht(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=ht(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},it={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},at={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ot={ol:!0,ul:!0},st=1,ct=2,lt=4;function ut(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?st:0)|(t===`full`?ct:0)}var dt=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=w.none,this.match=i||(a<?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(C.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&st)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=C.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(C.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!it.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ft=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=ut(null,t.preserveWhitespace,0)|(n?lt:0);i=r?new dt(r.type,r.attrs,w.none,!0,t.topMatch||r.type.contentMatch,a):n?new dt(null,null,w.none,!0,null,a):new dt(e.schema.topNodeType,null,w.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&ct?`full`:this.localPreserveWS||(r.options&st)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,` +`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e(a.type?a.type.allowsMarkType(t.type):gt(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new dt(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=st);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function pt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&ot.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function mt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ht(e){let t={};for(let n in e)t[n]=e[n];return t}function gt(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n{if(i.length||e.marks.length){let n=0,a=0;for(;n=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Ct(yt(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Ct(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=vt(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return vt(e.marks)}};function vt(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function yt(e){return e.document||window.document}var bt=new WeakMap;function xt(e){let t=bt.get(e);return t===void 0&&bt.set(e,t=St(e)),t}function St(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;iu)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Ct(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var wt=65535,Tt=2**16;function Et(e,t){return e+t*Tt}function Dt(e){return e&wt}function Ot(e){return(e-(e&wt))/Tt}var kt=1,At=2,jt=4,Mt=8,Nt=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Mt)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&jt)>0}},Pt=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=Dt(e);if(!this.inverted)for(let e=0;ee)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:Et(o/3,e-s),f=e==s?At:e==u?kt:jt;return(t<0?e!=s:e!=u)&&(f|=Mt),new Nt(a,f,d)}r+=l-c}return n?e+r:new Nt(e+r,0,null)}touches(e,t){let n=0,r=Dt(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;te)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;nn&&t!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return D.fromReplace(e,this.from,this.to,i)}invert(){return new zt(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};E.jsonID(`addMark`,Rt);var zt=class e extends E{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new T(Lt(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return D.fromReplace(e,this.from,this.to,n)}invert(){return new Rt(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};E.jsonID(`removeMark`,zt);var Bt=class e extends E{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return D.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return D.fromReplace(e,this.pos,this.pos+1,new T(C.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;rr.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,T.fromJSON(t,n.slice),n.insert,!!n.structure)}};E.jsonID(`replaceAround`,O);function Ut(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Wt(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;ee.step(t)),a.forEach(t=>e.step(t))}function Gt(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Qe){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;ee.step(new zt(t.from,t.to,t.style)))}function Kt(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t=0;t--)e.step(o[t])}function qt(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Jt(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(nn;e--)t||r.index(e)>0?(t=!0,u=C.from(r.node(e).copy(u)),d++):c--;let f=C.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=C.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new O(i,a,i,a,new T(r,0,0),n.length,!0))}function tn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&an(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&rn(e,t,n,a),Kt(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new O(c,l,c+1,l-1,new T(C.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&nn(e,t,n,a),!1}})}function nn(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function rn(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(` +`))}})}function an(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function on(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new O(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new T(C.from(o),0,0),1,!0))}function sn(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function cn(e,t,n=1,r){let i=e.doc.resolve(t),a=C.empty,o=C.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=C.from(i.node(e).copy(a));let t=r&&r[s];o=C.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new Ht(t,t,new T(a.append(o),n,n),!0))}function ln(e,t){let n=e.resolve(t),r=n.index();return dn(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function un(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&dn(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function pn(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);rn(e,r.node(),r.before(),s)}o.inlineContent&&Kt(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new Ht(l,c.map(t+n,-1),T.empty,!0)),r===!0){let t=e.doc.resolve(l);nn(e,t.node(),t.before(),e.steps.length)}return e}function mn(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function gn(e,t,n=t,r=T.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return _n(i,a,r)?new Ht(t,n,r):new vn(i,a,r).fit()}function _n(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var vn=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=C.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=C.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new T(i,a,o);return e>-1?new O(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new Ht(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=xn(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(C.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced;return En(e,-1)<=t?!1:(this.unplaced.size>1&&En(e,1)>n&&n++,this.unplaced=new T(e,t+1,n),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=xn(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new T(yn(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new T(yn(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e1||s==0||e.content.size)&&(u=t,l.push(Sn(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=bn(this.placed,t,C.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t=0;n--){let{match:t,type:r}=this.frontier[n],i=Cn(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=bn(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=bn(this.placed,this.depth,C.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(C.empty,!0);e.childCount&&(this.placed=bn(this.placed,this.frontier.length,e))}};function yn(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(yn(e.firstChild.content,t-1,n)))}function bn(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(bn(e.lastChild.content,t-1,n)))}function xn(e,t){for(let n=0;n1&&(r=r.replaceChild(0,Sn(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(C.empty,!0)))),e.copy(r)}function Cn(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!wn(n,a.content,o)?s:null}function wn(e,t,n){for(let r=n;r0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=Tn(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function On(e,t,n,r,i){if(tr){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(C.empty,!0))}return e}function kn(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=mn(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new T(C.from(r),0,0))}function An(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=jn(r,i);for(let t=0;t0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function jn(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(rt.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var Mn=class e extends E{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return D.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return D.fromReplace(e,this.pos,this.pos+1,new T(C.from(r),0,+!t.isLeaf))}getMap(){return Pt.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};E.jsonID(`attr`,Mn);var Nn=class e extends E{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return D.ok(n)}getMap(){return Pt.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};E.jsonID(`docAttr`,Nn);var Pn=class extends Error{};Pn=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Pn.prototype=Object.create(Error.prototype),Pn.prototype.constructor=Pn,Pn.prototype.name=`TransformError`;var Fn=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ft}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Pn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=T.empty){let r=gn(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new T(C.from(n),0,0))}delete(e,t){return this.replace(e,t,T.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Dn(this,e,t,n),this}replaceRangeWith(e,t,n){return kn(this,e,t,n),this}deleteRange(e,t){return An(this,e,t),this}lift(e,t){return Yt(this,e,t),this}join(e,t=1){return pn(this,e,t),this}wrap(e,t){return en(this,e,t),this}setBlockType(e,t=e,n,r=null){return tn(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return on(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Mn(e,t,n)),this}setDocAttribute(e,t){return this.step(new Nn(e,t)),this}addNodeMark(e,t){return this.step(new Bt(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof w)t.isInSet(n.marks)&&this.step(new Vt(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new Vt(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return cn(this,e,t,n),this}addMark(e,t,n){return Wt(this,e,t,n),this}removeMark(e,t,n){return Gt(this,e,t,n),this}clearIncompatible(e,t,n){return Kt(this,e,t,n),this}},In=Object.create(null),k=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Ln(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;r--){let i=t<0?Wn(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Wn(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Hn(e.node(0))}static atStart(e){return Wn(e,e,0,0,1)||new Hn(e)}static atEnd(e){return Wn(e,e,e.content.size,e.childCount,-1)||new Hn(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=In[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in In)throw RangeError(`Duplicate use of selection JSON ID `+e);return In[e]=t,t.prototype.jsonID=e,t}getBookmark(){return A.between(this.$anchor,this.$head).getBookmark()}};k.prototype.visible=!0;var Ln=class{constructor(e,t){this.$from=e,this.$to=t}},Rn=!1;function zn(e){!Rn&&!e.parent.inlineContent&&(Rn=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var A=class e extends k{constructor(e,t=e){zn(e),zn(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return k.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Bn(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=k.findFrom(n,r,!0)||k.findFrom(n,-r,!0);if(e)n=e.$head;else return k.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(k.findFrom(t,-r,!0)||k.findFrom(t,r,!0)).$anchor,t.pos0?0:1);i>0?o=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=Wn(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&j.isSelectable(r))return j.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function Gn(e,t,n){let r=e.steps.length-1;if(r{o??=r}),e.setSelection(k.near(e.doc.resolve(o),n))}var Kn=1,qn=2,Jn=4,Yn=class extends Fn{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=qn,this}ensureMarks(e){return w.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&qn)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||w.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(k.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Jn,this}get scrolledIntoView(){return(this.updated&Jn)>0}};function Xn(e,t){return!t||!e?e:e.bind(t)}var Zn=class{constructor(e,t,n){this.name=e,this.init=Xn(t.init,n),this.apply=Xn(t.apply,n)}},Qn=[new Zn(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Zn(`selection`,{init(e,t){return e.selection||k.atStart(t.doc)},apply(e){return e.selection}}),new Zn(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Zn(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],$n=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Qn.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Zn(e.key,e.spec.state,e))})}},er=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;ne.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new $n(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=Oe.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=k.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function tr(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=tr(i,t,{})),n[r]=i}return n}var M=class{constructor(e){this.spec=e,this.props={},e.props&&tr(e.props,this,this.props),this.key=e.key?e.key.key:rr(`plugin`)}getState(e){return e[this.key]}},nr=Object.create(null);function rr(e){return e in nr?e+`$`+ ++nr[e]:(nr[e]=0,e+`$`)}var N=class{constructor(e=`key`){this.key=rr(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},ir=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ar(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var or=(e,t,n)=>{let r=ar(e,n);if(!r)return!1;let i=fr(r);if(!i){let n=r.blockRange(),i=n&&Jt(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(Ar(e,i,t,-1))return!0;if(r.parent.content.size==0&&(ur(a,`end`)||j.isSelectable(a)))for(let n=r.depth;;n--){let o=gn(e.doc,r.before(n),r.after(n),T.empty);if(o&&o.slice.size1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},sr=(e,t,n)=>{let r=ar(e,n);if(!r)return!1;let i=fr(r);return i?lr(e,i,t):!1},cr=(e,t,n)=>{let r=pr(e,n);if(!r)return!1;let i=gr(r);return i?lr(e,i,t):!1};function lr(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=gn(e.doc,i,o,T.empty);if(!s||s.from!=i||s instanceof Ht&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(A.create(t.doc,i)),n(t.scrollIntoView())}return!0}function ur(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var dr=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=fr(r)}let o=a&&a.nodeBefore;return!o||!j.isSelectable(o)?!1:(t&&t(e.tr.setSelection(j.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function fr(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function pr(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset{let r=pr(e,n);if(!r)return!1;let i=gr(r);if(!i)return!1;let a=i.nodeAfter;if(Ar(e,i,t,1))return!0;if(r.parent.content.size==0&&(ur(a,`start`)||j.isSelectable(a))){let n=gn(e.doc,r.before(),r.after(),T.empty);if(n&&n.slice.size{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset=0;t--){let n=e.node(t);if(e.index(t)+1{let n=e.selection,r=n instanceof j,i;if(r){if(n.node.isTextblock||!ln(e.doc,n.from))return!1;i=n.from}else if(i=fn(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(j.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},vr=(e,t)=>{let n=e.selection,r;if(n instanceof j){if(n.node.isTextblock||!ln(e.doc,n.to))return!1;r=n.to}else if(r=fn(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},yr=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Jt(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},br=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(` +`).scrollIntoView()),!0)};function xr(e){for(let t=0;t{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=xr(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(k.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},Cr=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Hn||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=xr(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index(){let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(sn(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Jt(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function Tr(e){return(t,n)=>{if(t.selection instanceof j&&t.selection.node.isBlock){let{$from:e}=t.selection;return!e.parentOffset||!sn(t.doc,e.pos)?!1:(n&&n(t.tr.split(e.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof A||t.selection instanceof Hn)&&r.deleteSelection();let{$from:i}=r.selection,a=r.steps.length,o=[],s,c,l=!1,u=!1;for(let t=i.depth;;t--)if(i.node(t).isBlock){l=i.end(t)==i.pos+(i.depth-t),u=i.start(t)==i.pos-(i.depth-t),c=xr(i.node(t-1).contentMatchAt(i.indexAfter(t-1)));let n=e&&e(i.parent,l,i);o.unshift(n||(l&&c?{type:c}:null)),s=t;break}else{if(t==1)return!1;o.unshift(null)}let d=i.pos,f=sn(r.doc,d,o.length,o);if(f||=(o[0]=c?{type:c}:null,sn(r.doc,d,o.length,o)),!f)return!1;if(r.split(d,o.length,o),!l&&u&&i.node(s).type!=c){let e=r.mapping.slice(a),t=e.map(i.before(s)),n=r.doc.resolve(t);c&&i.node(s-1).canReplaceWith(n.index(),n.index()+1,c)&&r.setNodeMarkup(e.map(i.before(s)),c)}return n&&n(r.scrollIntoView()),!0}}var Er=Tr(),Dr=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(j.create(e.doc,i))),!0)},Or=(e,t)=>(t&&t(e.tr.setSelection(new Hn(e.doc))),!0);function kr(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||ln(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Ar(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&kr(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=C.empty;for(let e=o.length-1;e>=0;e--)s=C.from(o[e].create(null,s));s=C.from(i.copy(s));let c=e.tr.step(new O(t.pos-1,r,t.pos,r,new T(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&ln(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:k.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Jt(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&ur(a,`start`,!0)&&ur(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=C.empty;for(let e=o.length-1;e>=0;e--)r=C.from(o[e].copy(r));n(e.tr.step(new O(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new T(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function jr(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(A.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var Mr=jr(-1),Nr=jr(1);function Pr(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&Xt(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function Fr(e,t=null){return function(n,r){let i=!1;for(let r=0;r{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new Ee(e,e,t.depth),t.endIndex=0;e--)a=C.from(n[e].type.create(n[e].attrs,a));e.step(new O(t.start-(r?2:0),t.end,t.start,t.end,new T(a,0,0),n.length,!0));let o=0;for(let e=0;et.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?Gr(t,n,e,a):Kr(t,n,a):!0:!1}}function Gr(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);aa;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?C.empty:C.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new O(d-+!!s,f+ +!!c,d+1,f-1,new T((s?C.empty:C.from(i.copy(C.empty))).append(c?C.empty:C.from(i.copy(C.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function qr(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=C.from(r?e.create():null),o=new T(C.from(e.create(null,C.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new O(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var P=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Jr=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Yr=null,Xr=function(e,t,n){let r=Yr||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Zr=function(){Yr=null},Qr=function(e,t,n,r){return n&&(ei(e,t,n,r,-1)||ei(e,t,n,r,1))},$r=/^(img|br|input|textarea|hr)$/i;function ei(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ti(e))){let n=e.parentNode;if(!n||n.nodeType!=1||ai(e)||$r.test(e.nodeName)||e.contentEditable==`false`)return!1;t=P(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?ti(e):0}else return!1}}function ti(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function ni(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=ti(e)}else if(e.parentNode&&!ai(e))t=P(e),e=e.parentNode;else return null}}function ri(e,t){for(;;){if(e.nodeType==3&&t2),xi=bi||(ui?/Mac/.test(ui.platform):!1),Si=ui?/Win/.test(ui.platform):!1,Ci=/Android \d/.test(fi),wi=!!di&&`webkitFontSmoothing`in di.documentElement.style,Ti=wi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ei(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Di(e,t){return typeof e==`number`?e:e[t]}function Oi(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function ki(e,t,n){if(!Wi(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Jr(o);continue}let e=o,n=e==a.body,s=n?Ei(a):Oi(e),c=0,l=0;if(t.tops.bottom-Di(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+Di(i,`top`)-s.top:t.bottom-s.bottom+Di(i,`bottom`)),t.lefts.right-Di(r,`right`)&&(c=t.right-s.right+Di(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:Jr(o)}}function Ai(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:ji(e.dom)}}function ji(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Jr(r));return t}function Mi({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Ni(n,r==0?0:r-t)}function Ni(e,t){for(let n=0;n=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?Li(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:Ii(n,i)}function Li(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function Ri(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function zi(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Vi(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right-1?i:e.docView.posFromDOM(t,n,-1)}function Hi(e,t,n){let r=e.childNodes.length;if(r&&n.topt.top&&i++}let n;wi&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=Vi(e,r,i,t))}s??=Bi(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Wi(e){return e.top=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Ji(Gi(Xr(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==ti(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return Yi(e.getBoundingClientRect(),!1)}if(a==null&&i=0)}if(a==null&&i&&(n<0||i==ti(r))){let e=r.childNodes[i-1],t=e.nodeType==3?Xr(e,ti(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Ji(Gi(t,1),!1)}if(a==null&&i=0)}function Ji(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Yi(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Xi(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Zi(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Xi(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=qi(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=Xr(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;ei.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Qi=/[\u0590-\u08ac]/;function $i(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Qi.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Xi(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var ea=null,ta=null,na=!1;function ra(e,t,n){return ea==t&&ta==n?na:(ea=t,ta=n,na=n==`up`||n==`down`?Zi(e,t,n):$i(e,t,n))}var ia=0,aa=1,oa=2,sa=3,ca=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=ia,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tP(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;te||i instanceof ha){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof la&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?P(e.dom)+1:0}}else{let e,r=!0;for(;e=n=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=P(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;es&&at){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r=n:en){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?oa:aa,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=sa:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?oa:sa}n=a}this.dirty=oa}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?oa:aa;t.dirty{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.hasAttribute(`contenteditable`)||(a.contentEditable=`false`),a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==ia&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},ua=class extends ca{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},da=class e extends ca{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=_t.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&sa||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=sa&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ia){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty0&&(a=Ma(a,0,t,r));for(let e=0;e{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=_t.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Ca(u,r,n),l?c=new ga(t,n,r,i,u,d||null,f,l):n.isText?new ma(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>t.nodeType==1&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>C.empty}}return t}matchesNode(e,t,n){return this.dirty==ia&&e.eq(this.node)&&wa(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new Ea(this,a&&a.node,e);ka(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?w.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==oa)&&(a&&this.protectLocalComposition(e,a),_a(this.contentDOM,this.children,e),bi&&Aa(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof A)||nt+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=ja(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new ua(this,i,t,r);e.input.compositionNodes.push(a),this.children=Ma(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==sa||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=ia}updateOuterDeco(e){if(wa(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=xa(this.dom,this.nodeDOM,ba(this.outerDeco,this.node,t),ba(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function pa(e,t,n,r,i){Ca(r,t,e);let a=new fa(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var ma=class e extends fa{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==sa||this.dirty!=ia&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ia||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=ia,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=sa)}get domAtom(){return!1}isText(e){return this.node.text==e}},ha=class extends ca{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ia&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},ga=class extends fa{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==sa)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function _a(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a>1,o=Math.min(a,e.length);for(;i-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=da.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof da)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function Oa(e,t){return e.type.side-t.type.side}function ka(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;na;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function Aa(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function ja(e,t,n,r){for(let i=0,a=0;i=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function Ma(e,t,n,r,i){let a=[];for(let o=0,s=0;o=n||u<=t?a.push(c):(ln&&a.push(c.slice(n-l,c.size,r)))}return a}function Na(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(oi(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&j.isSelectable(e)&&i.parent&&!(e.isInline&&ii(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new j(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!Pa(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Va(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,P(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&F&&gi<=11&&(n.disabled=!0,n.disabled=!1)}function Ha(e,t){if(t instanceof j){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Ua(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Ua(e)}function Ua(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function Wa(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||A.between(t,n,r)}function Ga(e){return e.editable&&!e.hasFocus()?!1:Ka(e)}function Ka(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function qa(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Qr(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Ja(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&k.findFrom(a,t)}function Ya(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Xa(e,t,n){let r=e.state.selection;if(r instanceof A){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return Ya(e,new A(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Ja(e.state,t);return n&&n instanceof j?Ya(e,n):!1}else if(!(xi&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?j.isSelectable(i)?Ya(e,new j(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):wi?Ya(e,new A(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof j&&r.node.isInline)return Ya(e,new A(t>0?r.$to:r.$from));else{let n=Ja(e.state,t);return n?Ya(e,n):!1}}function Za(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Qa(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function $a(e,t){return t<0?eo(e):to(e)}function eo(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(_i&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(Qa(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(no(n))break;else{let t=n.previousSibling;for(;t&&Qa(t,-1);)i=n.parentNode,a=P(t),t=t.previousSibling;if(t)n=t,r=Za(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?ao(e,n,r):i&&ao(e,i,a)}function to(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=Za(n),a,o;for(;;)if(r{e.state==i&&Fa(e)},50)}function oo(e,t){let n=e.state.doc.resolve(t);if(!(I||Si)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i1)return n.leftr.top&&i1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function so(e,t,n){let r=e.state.selection;if(r instanceof A&&!r.empty||n.indexOf(`s`)>-1||xi&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Ja(e.state,t);if(n&&n instanceof j)return Ya(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof Hn?k.near(n,t):k.findFrom(n,t);return o?Ya(e,o):!1}return!1}function co(e,t){if(!(e.state.selection instanceof A))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function lo(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function uo(e){if(!L||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;lo(e,n,`true`),setTimeout(()=>lo(e,n,`false`),20)}return!1}function fo(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function po(e,t){let n=t.keyCode,r=fo(t);if(n==8||xi&&n==72&&r==`c`)return co(e,-1)||$a(e,-1);if(n==46&&!t.shiftKey||xi&&n==68&&r==`c`)return co(e,1)||$a(e,1);if(n==13||n==27)return!0;if(n==37||xi&&n==66&&r==`c`){let t=n==37?oo(e,e.state.selection.from)==`ltr`?-1:1:-1;return Xa(e,t,r)||$a(e,t)}else if(n==39||xi&&n==70&&r==`c`){let t=n==39?oo(e,e.state.selection.from)==`ltr`?1:-1:1;return Xa(e,t,r)||$a(e,t)}else if(n==38||xi&&n==80&&r==`c`)return so(e,-1,r)||$a(e,-1);else if(n==40||xi&&n==78&&r==`c`)return uo(e)||so(e,1,r)||$a(e,1);else if(r==(xi?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function mo(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||_t.fromSchema(e.state.schema),s=wo(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=Co[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,` + +`),slice:t}}function ho(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new T(C.from(e.state.schema.text(t.replace(/\r\n?/g,` +`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=_t.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=Do(n),wi&&Oo(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||rt.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!go.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=ko(So(s,+u[1],+u[2]),u[4]);else if(s=T.maxOpen(_o(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e{s=t(s,e,c)}),s}var go=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function _o(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&yo(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=bo(a[a.length-1],i.length));let n=vo(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return C.from(a)}return e}function vo(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,C.from(e));return e}function yo(e,t,n,r,i){if(i1&&(a=0),i=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(C.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function So(e,t,n){return te})}return To.createHTML(e)}function Do(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=wo(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&Co[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>``).reverse().join(``)),r.innerHTML=Eo(e),a)for(let e=0;e=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{t.checkAttrs(r[e+1])}catch{break}i=C.from(t.create(r[e+1],i)),a++,o++}return new T(i,a,o)}var R={},z={},Ao={touchstart:!0,touchmove:!0},jo=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function Mo(e){for(let t in R){let n=R[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{Lo(e,t)&&!Io(e,t)&&(e.editable||!(t.type in z))&&n(e,t)},Ao[t]?{passive:!0}:void 0)}L&&e.dom.addEventListener(`input`,()=>null),Fo(e)}function No(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Po(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Fo(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Io(e,t))})}function Io(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function Lo(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Ro(e,t){!Io(e,t)&&R[t.type]&&(e.editable||!(t.type in z))&&R[t.type](e,t)}z.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!ts(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Ci&&I&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),bi&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,si(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||po(e,n)?n.preventDefault():No(e,`key`)},z.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},z.keypress=(e,t)=>{let n=t;if(ts(e)||!n.charCode||n.ctrlKey&&!n.altKey||xi&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof A)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function zo(e){return{left:e.clientX,top:e.clientY}}function Bo(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Vo(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function Ho(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function Uo(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&j.isSelectable(r)?(Ho(e,new j(n),`pointer`),!0):!1}function Wo(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof j&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(j.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(Ho(e,j.create(e.state.doc,i),`pointer`),!0)}function Go(e,t,n,r,i){return Vo(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Wo(e,n):Uo(e,n))}function Ko(e,t,n,r){return Vo(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function qo(e,t,n,r){return Vo(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||Jo(e,n,r)}function Jo(e,t,n){if(n.button!=0)return!1;let r=Yo(e,t,!0),i=e.state.doc;return r?(Ho(e,r,`pointer`),r instanceof A&&i.eq(e.state.doc)&&(e.input.mouseDown=new es(e,r)),!0):!1}function Yo(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?A.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return A.create(r,a+1,a+1+t.content.size);if(n&&j.isSelectable(t))return j.create(r,a)}return null}function Xo(e){return cs(e)}var Zo=xi?`metaKey`:`ctrlKey`;R.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Xo(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Bo(n,e.input.lastClick)&&!n[Zo]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(zo(n));o&&(a==`singleClick`?e.input.mouseDown=new $o(e,o,n,!!r):(a==`doubleClick`?Ko:qo)(e,o.pos,o.inside,n)?n.preventDefault():No(e,`pointer`))};var Qo=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},$o=class extends Qo{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[Zo],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof j&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&_i&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),No(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Fa(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(zo(e))),this.updateAllowDefault(e),this.allowDefault||!t?No(this.view,`pointer`):Go(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||L&&this.mightDrag&&!this.mightDrag.node.isAtom||I&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Ho(this.view,k.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):No(this.view,`pointer`)}move(e){this.updateAllowDefault(e),No(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},es=class extends Qo{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),No(this.view,`pointer`);let t=this.view.posAtCoords(zo(e)),n=t&&Yo(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from{e.input.lastTouch=Date.now(),Xo(e),No(e,`pointer`)},R.touchmove=e=>{e.input.lastTouch=Date.now(),No(e,`pointer`)},R.contextmenu=e=>Xo(e);function ts(e,t){return e.composing?!0:L&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var ns=Ci?5e3:-1;z.compositionstart=z.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof A&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||I&&Si&&rs(e)))e.markCursor=e.state.storedMarks||n.marks(),cs(e,!0),e.markCursor=null;else if(cs(e,!t.selection.empty),_i&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}is(e,ns)};function rs(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}z.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,is(e,20))};function is(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>cs(e),t))}function as(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function ss(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=ni(t.focusNode,t.focusOffset),r=ri(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function cs(e,t=!1){if(!(Ci&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),as(e),t||e.docView&&e.docView.dirty){let n=Na(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function ls(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var us=F&&gi<15||bi&&Ti<604;R.copy=z.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=us?null:n.clipboardData,{dom:o,text:s}=mo(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):ls(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function ds(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function fs(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ps(e,r.value,null,i,t):ps(e,r.textContent,r.innerHTML,i,t)},50)}function ps(e,t,n,r,i){let a=ho(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||T.empty)))return!0;if(!a)return!1;let o=ds(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function ms(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}z.paste=(e,t)=>{let n=t;if(e.composing&&!Ci)return;let r=us?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&ps(e,ms(r),r.getData(`text/html`),i,n)?n.preventDefault():fs(e,n)};var hs=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},gs=xi?`altKey`:`ctrlKey`;function _s(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[gs]:!n}R.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(zo(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof j?i.to-1:i.to))){if(r&&r.mightDrag)o=j.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=j.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=mo(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!I||yi>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(us?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,us||n.dataTransfer.setData(`text/plain`,c),e.dragging=new hs(l,_s(e,n),o)},R.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},z.dragover=z.dragenter=(e,t)=>t.preventDefault(),z.drop=(e,t)=>{try{vs(e,t,e.dragging)}finally{e.dragging=null}};function vs(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(zo(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=ho(e,ms(t.dataTransfer),us?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&_s(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||T.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?hn(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&j.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new j(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(Wa(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}R.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Fa(e)},20))},R.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},R.beforeinput=(e,t)=>{if(Ci&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,si(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in z)R[e]=z[e];function ys(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var bs=class e{constructor(e,t){this.toDOM=e,this.spec=t||Ts,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new Cs(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&ys(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},xs=class e{constructor(e,t){this.attrs=e,this.spec=t||Ts}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new Cs(i,a,this)}valid(e,t){return t.from=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;ae){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==V||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Ts)}mapInner(t,n,r,i,a){let o;for(let e=0;e{let o=t+r,s;if(s=As(n,e,o)){for(i||=this.children.slice();aa&&n.to=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;ea&&t.type instanceof xs){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;ee.map(t,n,Ts));return e.from(r)}forChild(t,n){if(n.isLeaf)return B.empty;let r=[];for(let i=0;ie instanceof B)?t:t.reduce((e,t)=>e.concat(t instanceof B?t:t.members),[]))}}forEachSet(e){for(let t=0;t{let o=a-i-(n-e);for(let i=0;ia+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==V?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=Ms(ks(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;en&&a.to{let s=As(e,t,o+n);if(s){a=!0;let e=Ms(s,t,n+o+1,r);e!=V&&i.push(o,o+t.nodeSize,e)}});let o=Os(a?js(e):e,-n).sort(Ns);for(let e=0;e0;)t++;e.splice(t,0,n)}function Is(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=V&&t.push(r)}),e.cursorWrapper&&t.push(B.create(e.state.doc,[e.cursorWrapper.deco])),Es.from(t)}var Ls={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Rs=F&&gi<=11,zs=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},Bs=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new zs,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;ee.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():L&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Rs&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Ls)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ga(this.view)){if(this.suppressingSelectionUpdates)return Fa(this.view);if(F&&gi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Qr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Jr(n))t.add(n);for(let r=e.anchorNode;r;r=Jr(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Ga(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;ee.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||I&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(_i&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||Ks(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Us(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,qs(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Fa(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;na;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){o=e;break}if(!n||n.size)break}let f=e.state.doc,p=e.someProp(`domParser`)||rt.fromSchema(e.state.schema),m=f.resolve(s),h=null,g=p.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:a,to:o,preserveWhitespace:m.parent.type.whitespace==`pre`?`full`:!0,findPositions:u,ruleFromNode:Ys(r),context:m});if(u&&u[0].pos!=null){let e=u[0].pos,t=u[1]&&u[1].pos;t??=e,h={anchor:e+s,head:t+s}}return{doc:g,sel:h,from:s,to:c}}var Ys=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName==`BR`&&t.parentNode){if(L&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(t.parentNode.lastChild==t||L&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName==`IMG`&&t.getAttribute(`mark-placeholder`))return{ignore:!0};return null},Xs=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Zs(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Na(e,t);if(n&&!e.state.selection.eq(n)){if(I&&Ci&&e.input.lastKeyCode===13&&Date.now()-100t(e,si(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=Js(e,t,n,i),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Ci)&&i.some(e=>e.nodeType==1&&!Xs.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,si(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof A&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Qs(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.frome.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),F&&gi<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((bi&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.post(e,si(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&ec(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,si(8,`Backspace`)))){Ci&&I&&e.domObserver.suppressSelectionUpdates();return}I&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Ci&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,si(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Qs(e,n.doc,l.sel);t&&!(I&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDeleteFa(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(ee=$s(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);ee.type==`add`?t.addMark(y,b,ee.mark):t.removeMark(y,b,ee.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function Qs(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Wa(e,t.resolve(n.anchor),t.resolve(n.head))}function $s(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;ee.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;en||tc(o,!0,!1)0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function nc(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var rc=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new jo,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(uc),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=oc(this),ac(this),this.nodeViews=cc(this),this.docView=pa(this.state.doc,ic(this),Is(this),this.dom,this),this.domObserver=new Bs(this,(e,t,n,r)=>Zs(this,e,t,n,r)),this.domObserver.start(),Mo(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Fo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(uc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(as(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=cc(this);lc(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Fo(this),this.editable=oc(this),ac(this);let o=Is(this),s=ic(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&Ai(this);if(i){this.domObserver.stop();let t=l&&(F||I)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&sc(n.selection,e.selection);if(l){let n=I?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ss(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=pa(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&qa(this)&&i.delaySelUpdate())?Fa(this,t):(Ha(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&Mi(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof j){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&ki(this,t.getBoundingClientRect(),e)}else ki(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e0&&ee.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Ui(this,e)}coordsAtPos(e,t=1){return qi(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return ra(this,t||this.state,e)}pasteHTML(e,t){return ps(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return ps(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return mo(this,e)}destroy(){this.docView&&(Po(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Is(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Zr())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ro(this,e)}domSelectionRange(){let e=this.domSelection();return e?L&&this.root.nodeType===11&&ci(this.dom.ownerDocument)==this.dom&&Gs(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};rc.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function ic(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[Cs.node(0,e.state.doc.content.size,t)]}function ac(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:Cs.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function oc(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function sc(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function cc(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function lc(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function uc(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var dc={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},fc={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},pc=typeof navigator<`u`&&/Mac/.test(navigator.platform),mc=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),H=0;H<10;H++)dc[48+H]=dc[96+H]=String(H);for(var H=1;H<=24;H++)dc[H+111]=`F`+H;for(var H=65;H<=90;H++)dc[H]=String.fromCharCode(H+32),fc[H]=String.fromCharCode(H);for(var hc in dc)fc.hasOwnProperty(hc)||(fc[hc]=dc[hc]);function gc(e){var t=!(pc&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||mc&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?fc:dc)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var _c=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),vc=typeof navigator<`u`&&/Win/.test(navigator.platform);function yc(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:wc({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},Ec=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),Dc=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),Oc=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=Jt(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},kc=e=>t=>e(t),Ac=()=>({state:e,dispatch:t})=>Cr(e,t),jc=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new A(r.doc.resolve(Math.max(o-1,0)))),!0},Mc=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function U(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Nc=e=>({tr:t,state:n,dispatch:r})=>{let i=U(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Pc=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},Fc=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Ic=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos({from:Ic(e,n,`left`),to:Ic(t,n,`right`)}),Rc=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=Lc(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.selection.empty||n.setSelection(A.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},zc=()=>({commands:e})=>e.keyboardShortcut(`Enter`),Bc=()=>({state:e,dispatch:t})=>Sr(e,t);function Vc(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function Hc(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:Vc(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function Uc(e,t,n={}){return e.find(e=>e.type===t&&Hc(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Wc(e,t,n={}){return!!Uc(e,t,n)}function Gc(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!Uc([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&Wc([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o({tr:n,state:r,dispatch:i})=>{let a=Kc(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=Gc(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=A.create(o,e.from,e.to);n.setSelection(t)}}return!0},Jc=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{($c()||Qc())&&r.dom.focus(),el()&&!$c()&&!Qc()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!Yc(n.state.selection))return o(),!0;let s=Zc(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},nl=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),rl=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),il=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&il(r)}return e};function al(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`${e}`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return il(n)}function ol(e){return typeof e?.nodesBetween==`function`}function sl(e,t,n){if(ol(e))return e;let r=typeof e==`object`&&!!e;n={slice:!0,parseOptions:{},...n};let i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return C.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),sl(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new $e({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?rt.fromSchema(a).parseSlice(al(e),n.parseOptions):rt.fromSchema(a).parse(al(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=rt.fromSchema(t);return n.slice?r.parseSlice(al(e),n.parseOptions).content:r.parse(al(e),n.parseOptions)}return sl(``,t,n)}function cl(e){return!(`type`in e)}function ll(e,t,n){let r=e.steps.length-1;if(r{o===0&&(o=r)}),e.setSelection(k.near(e.doc.resolve(o),n))}var ul=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{sl(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=sl(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0,f=cl(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let p;if(u)p=Array.isArray(t)?t.map(e=>e.text||``).join(``):ol(t)?f.map(e=>e.text??``).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(p,c,l);else{p=C.from(f);let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&ll(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:p}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:p})}return!0};function dl(e){for(let t=0;t({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=dl(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=sl(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&ll(t,t.steps.length-1,-1)),!0):!1},pl=()=>({state:e,dispatch:t})=>_r(e,t),ml=()=>({state:e,dispatch:t})=>vr(e,t),hl=()=>({state:e,dispatch:t})=>or(e,t),gl=()=>({state:e,dispatch:t})=>mr(e,t),_l=()=>({state:e,dispatch:t,tr:n})=>{try{let r=fn(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},vl=()=>({state:e,dispatch:t,tr:n})=>{try{let r=fn(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},yl=()=>({state:e,dispatch:t})=>sr(e,t),bl=()=>({state:e,dispatch:t})=>cr(e,t);function xl(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function Sl(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e({editor:t,view:n,tr:r,dispatch:i})=>{let a=Sl(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function wl(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?U(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>Hc(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var Tl=(e,t={})=>({state:n,dispatch:r})=>wl(n,U(e,n.schema),t)?yr(n,r):!1,El=()=>({state:e,dispatch:t})=>wr(e,t),Dl=e=>({state:t,dispatch:n})=>Wr(U(e,t.schema))(t,n),Ol=()=>({state:e,dispatch:t})=>br(e,t);function kl(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function Al(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var jl=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=kl(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=U(e,r.schema)),s===`mark`&&(o=Kc(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,Al(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(Al(a.attrs,t))))})})}),c},Ml=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Nl=()=>({tr:e,dispatch:t})=>{if(t){let t=new Hn(e.doc);e.setSelection(t)}return!0},Pl=()=>({state:e,dispatch:t})=>dr(e,t),Fl=()=>({state:e,dispatch:t})=>hr(e,t),Il=()=>({state:e,dispatch:t})=>Dr(e,t),Ll=()=>({state:e,dispatch:t})=>Nr(e,t),Rl=()=>({state:e,dispatch:t})=>Mr(e,t);function zl(e,t,n={},r={}){return sl(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Bl=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=zl(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(o){let e=cl(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function Vl(e,t){let n=Kc(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function Hl(e,t){let n=new Fn(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Ul(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function Wl(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Gl(e){return t=>Wl(t.$from,e)}function W(e,t,n){return e.config[t]===void 0&&e.parent?W(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?W(e.parent,t,n):null}):e.config[t]}function Kl(e){return e.map(e=>{let t=W(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...Kl(t())]:e}).flat(10)}function ql(e,t){let n=_t.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function Jl(e){return typeof e==`function`}function G(e,t=void 0,...n){return Jl(e)?t?e.bind(t)(...n):e(...n):e}function Yl(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Xl(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function Zl(e){let t=[],{nodeExtensions:n,markExtensions:r}=Xl(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=W(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=W(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function Ql(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function $l(e){let t=[],n=Ql(e||``),r=n.length;for(let e=0;e!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(e===`__proto__`){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});return}if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...$l(n[e]),...$l(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function eu(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>K(e,t),{})}function tu(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function nu(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):tu(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function ru(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&Yl(t)?!1:t!=null))}function iu(e){var t,n;let r={};return!(!(e==null||(t=e.attribute)==null)&&t.isRequired)&&`default`in(e?.attribute||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function au(e,t){let n=Zl(e),{nodeExtensions:r,markExtensions:i}=Xl(e);return new $e({topNode:r.find(e=>W(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=ru({...e.reduce((e,t)=>{let n=W(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:G(W(r,`content`,a)),marks:G(W(r,`marks`,a)),group:G(W(r,`group`,a)),inline:G(W(r,`inline`,a)),atom:G(W(r,`atom`,a)),selectable:G(W(r,`selectable`,a)),draggable:G(W(r,`draggable`,a)),code:G(W(r,`code`,a)),whitespace:G(W(r,`whitespace`,a)),linebreakReplacement:G(W(r,`linebreakReplacement`,a)),defining:G(W(r,`defining`,a)),isolating:G(W(r,`isolating`,a)),attrs:Object.fromEntries(i.map(iu))}),s=G(W(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>nu(e,i)));let c=W(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:eu(e,i)}));let l=W(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=ru({...e.reduce((e,t)=>{let n=W(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:G(W(r,`inclusive`,a)),excludes:G(W(r,`excludes`,a)),group:G(W(r,`group`,a)),spanning:G(W(r,`spanning`,a)),code:G(W(r,`code`,a)),attrs:Object.fromEntries(i.map(iu))}),s=G(W(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>nu(e,i)));let c=W(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:eu(e,i)})),[r.name,o]}))})}function ou(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function su(e){return e.sort((e,t)=>{let n=W(e,`priority`)||100,r=W(t,`priority`)||100;return n>r?-1:+(ne.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function lu(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=` + +`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;if(e.isText){var d;s+=e==null||(d=e.text)==null?void 0:d.slice(Math.max(r,n)-n,i-n)}}),s}function uu(e,t){return lu(e,{from:0,to:e.content.size},t)}function du(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function fu(e,t){let n=U(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function pu(e,t){let n=kl(typeof t==`string`?t:t.name,e.schema);return n===`node`?fu(e,t):n===`mark`?Vl(e,t):{}}function mu(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function hu(e){let t=mu(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function gu(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),hu(r)}function _u(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=Gc(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var vu=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]},yu=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return n===0?null:e.node(t).child(n-1)};function bu(e,t){return t.nodes[e]||t.marks[e]||null}function xu(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var Su=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function Cu(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?Kc(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>Hc(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>Hc(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function wu(e,t,n={}){if(!t)return wl(e,null,n)||Cu(e,null,n);let r=kl(t,e.schema);return r===`node`?wl(e,t,n):r===`mark`?Cu(e,t,n):!1}var Tu=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=Gl(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Du(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function Ou(e,t){let{nodeExtensions:n}=Xl(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=G(W(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function ku(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(ku(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Au(e){return e instanceof j}var ju=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Mu(e,t){let n=t.mapping.mapResult(e.position);return{position:new ju(n.pos),mapResult:n}}function Nu(e){return new ju(e)}function Pu(e,t,n){let{selection:r}=t,i=null;if(Yc(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var Fu=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=Kc(e,r.schema);if(i)if(o){let e=Vl(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return Pu(r,n,c)},Iu=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Lu=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=U(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>Fr(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>Fr(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},Ru=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=Xc(e,0,n.content.size),i=j.create(n,r);t.setSelection(i)}return!0},zu=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},Bu=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=A.atStart(n).from,o=A.atEnd(n).to,s=Xc(r,a,o),c=Xc(i,a,o),l=A.create(n,s,c);t.setSelection(l)}return!0},Vu=e=>({state:t,dispatch:n})=>qr(U(e,t.schema))(t,n);function Hu(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var Uu=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=xu(l,s.node().type.name,s.node().attrs);if(a instanceof j&&a.node.isBlock)return!s.parentOffset||!sn(o,s.pos)?!1:(r&&(e&&Hu(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:dl(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=sn(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&sn(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof A&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&Hu(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},Wu=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=U(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=C.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=C.from(s.node(t).copy(e));let i=s.indexAfter(-1){if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(A.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...xu(d,u.type.name,u.attrs),...t},m={...xu(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!sn(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0};function Gu(e){return!e||e===`1`?null:e}function Ku(e,t){return Gu(e)===Gu(t)}var qu=(e,t)=>{let n=Gl(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&ln(e.doc,n.pos))||!Ku(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},Ju=(e,t)=>{let n=Gl(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&ln(e.doc,r))||!Ku(n.node.attrs.type,i?.attrs.type)||e.join(r),!0};function Yu(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return A.between(r,i)}var Xu=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=U(e,o.schema),m=U(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=Gl(e=>Ou(e.type.name,d))(h),ee=h.from===0&&h.to===o.doc.content.size,te=o.doc.content.content,S=te.length===1?te[0]:null,ne=ee&&S&&Ou(S.type.name,d)?{node:S,pos:0,depth:0}:null,re=x??ne,ie=!!x&&y.depth>=1&&y.depth-x.depth<=1,ae=!!ne;if((ie||ae)&&re){if(re.node.type===p)return ee&&ae?c().command(({tr:e,dispatch:t})=>{let n=Yu(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(Ou(re.node.type.name,d)&&p.validContent(re.node.content))return c().command(()=>(a.setNodeMarkup(re.pos,p),!0)).command(()=>qu(a,p)).command(()=>Ju(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>qu(a,p)).command(()=>Ju(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>qu(a,p)).command(()=>Ju(a,p)).run()},Zu=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=Kc(e,r.schema);return Cu(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},Qu=(e,t,n={})=>({state:r,commands:i})=>{let a=U(e,r.schema),o=U(t,r.schema),s=wl(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},$u=(e,t={})=>({state:n,commands:r})=>{let i=U(e,n.schema);return wl(n,i,t)?r.lift(i):r.wrapIn(i,t)},ed=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},td=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},nd=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=Kc(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=Gc(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},rd=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},id=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=kl(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=U(e,r.schema)),s===`mark`&&(o=Kc(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},ad=new N(`__tiptap_decorations__`),od=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(ad,{type:`force`,name:e}),!0),sd=(e,t={})=>({state:n,dispatch:r})=>Pr(U(e,n.schema),t)(n,r),cd=(e,t={})=>({state:n,dispatch:r})=>Vr(U(e,n.schema),t)(n,r),ld=te({blur:()=>Ec,clearContent:()=>Dc,clearNodes:()=>Oc,command:()=>kc,createParagraphNear:()=>Ac,cut:()=>jc,deleteCurrentNode:()=>Mc,deleteNode:()=>Nc,deleteRange:()=>Pc,deleteSelection:()=>Rc,enter:()=>zc,exitCode:()=>Bc,extendMarkRange:()=>qc,first:()=>Jc,focus:()=>tl,forEach:()=>nl,insertContent:()=>rl,insertContentAt:()=>ul,insertDefaultBlock:()=>fl,joinBackward:()=>hl,joinDown:()=>ml,joinForward:()=>gl,joinItemBackward:()=>_l,joinItemForward:()=>vl,joinTextblockBackward:()=>yl,joinTextblockForward:()=>bl,joinUp:()=>pl,keyboardShortcut:()=>Cl,lift:()=>Tl,liftEmptyBlock:()=>El,liftListItem:()=>Dl,newlineInCode:()=>Ol,resetAttributes:()=>jl,scrollIntoView:()=>Ml,selectAll:()=>Nl,selectNodeBackward:()=>Pl,selectNodeForward:()=>Fl,selectParentNode:()=>Il,selectTextblockEnd:()=>Ll,selectTextblockStart:()=>Rl,setContent:()=>Bl,setMark:()=>Fu,setMeta:()=>Iu,setNode:()=>Lu,setNodeSelection:()=>Ru,setTextDirection:()=>zu,setTextSelection:()=>Bu,sinkListItem:()=>Vu,splitBlock:()=>Uu,splitListItem:()=>Wu,toggleList:()=>Xu,toggleMark:()=>Zu,toggleNode:()=>Qu,toggleWrap:()=>$u,undoInputRule:()=>ed,unsetAllMarks:()=>td,unsetMark:()=>nd,unsetTextDirection:()=>rd,updateAttributes:()=>id,updateDecorations:()=>od,wrapIn:()=>sd,wrapInList:()=>cd}),ud=new WeakMap;function dd(e,t){ud.set(e,(ud.get(e)??0)+1);try{return t()}finally{let t=(ud.get(e)??1)-1;t>0?ud.set(e,t):ud.delete(e)}}function fd(e){return ud.has(e)}var pd=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},md=typeof process<`u`&&!1;function hd(e){return e.kind===`widget`}function gd(e,t){let n=[],r=new Set;for(let i of e)i.kind===`widget`&&hd(i)&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function _d(e,t,n){let{decorations:r,widgetKeys:i}=gd(t,n);return{set:B.create(e,r),widgetKeys:i}}function vd({position:e,from:t,to:n,docSize:r}){return evd({position:e.anchor,from:t,to:n,docSize:r})?!0:(e.anchor===n||a.has(i)||(a.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}function bd(e){let t=e.spec?.key;return typeof t==`string`?t:void 0}function xd(e){let t=new Map,n=new Map;for(let r of e.find()){let e=bd(r);if(!e)continue;let i=r.spec.extensionName??`unknown`,a=t.get(e)??new Set;a.add(i),t.set(e,a),n.set(e,(n.get(e)??0)+1)}return Array.from(t,([e,t])=>({key:e,extensions:t})).filter(({key:e})=>(n.get(e)??0)>1)}function Sd(e){return e.jsonID===`attr`}function Cd(e){let t=!1;if(e.getMap().forEach(()=>{t=!0}),t||Sd(e))return!0;let n=e;return typeof n.from==`number`&&typeof n.to==`number`}function wd(e,t){let n=null,r=0,i=0;for(let a=0;at.to);a+=1){let o=i+e.child(a).nodeSize;o>=t.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function Td(e,t){if(e.steps.some(e=>!Cd(e)))return{type:`full`};let n=gu(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!Sd(t))return;let i=e.mapping.slice(r);n.push({from:i.map(t.pos,-1),to:i.map(t.pos+1)})});let r=[];for(let e of n){let n=wd(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let i=[];for(let e of r){let t=i[i.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):i.push({...e})}return{type:`ranges`,ranges:i}}function Ed(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=e?.key;typeof t==`string`&&r.delete(t)}})}function Dd(e,t,n){let r=t.decorationSetsByExtension[e]??B.empty,i=new Set(t.widgetKeysByExtension[e]??[]);return{set:Ed(r,n.mapping,n.doc,i),widgetKeys:i}}function Od(e,t){let n=Object.values(t).flatMap(e=>e.find());return B.create(e,n)}function kd(e){let t=new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}function Ad(e,t){switch(t.update??`document`){case`document`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case`changedRanges`:if(!t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case`manual`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function jd(e,t,n){return n?!0:e.update===`manual`?!1:e.shouldUpdate?e.shouldUpdate(t):t.tr.docChanged}var Md=new Set,Nd=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=ad.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>Ad(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on(`beforeTransaction`,this.handleBeforeTransaction)}destroy(){this.editor.off(`beforeTransaction`,this.handleBeforeTransaction)}liveWidgetKeys(){return ad.getState(this.editor.state)?.widgetKeys??Md}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new M({key:ad,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:a}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,a,n);r[e]=t,i[e]=o}let a={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:kd(i)};return this.warnDuplicateWidgetKeys(a),a},apply:(n,r,i,a)=>{let o=n.getMeta(ad),s=o?.type===`force`&&!o.name,c=o?.type===`force`?o.name:void 0,l={},u={},d=new Set;return dd(e,()=>{for(let{name:o,spec:f}of t){let t=s||c===o;if(!jd(f,{editor:e,tr:n,oldState:i,newState:a},t)){let e=Dd(o,r,n);l[o]=e.set,u[o]=e.widgetKeys}else if(f.update===`changedRanges`&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(o,f,r,n,a);l[o]=e.set,u[o]=e.widgetKeys,d.add(o)}else{let{set:e,widgetKeys:t}=this.buildFullSet(o,f,a);l[o]=e,u[o]=t,d.add(o)}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:l,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:l,recomputedNames:d}),widgetKeys:kd(u)}}},props:{decorations(e){return ad.getState(e)?.mergedDecorationSet??B.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let a=Td(r,i.doc);return a.type===`full`?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,a.ranges)}rebuildRanges(e,t,n,r,i,a){let o=n.decorationSetsByExtension[e]??B.empty,s=new Set(n.widgetKeysByExtension[e]??[]),c=Ed(o,r.mapping,r.doc,s),l=i.doc.content.size;for(let{from:n,to:r}of a){let a=c.find(n,r).filter(e=>vd({position:e.from,from:n,to:r,docSize:l}));for(let e of a){let t=bd(e);t&&s.delete(t)}c=c.remove(a);let{decorations:o,widgetKeys:u}=gd(yd({decorations:this.runCreate(e,`createInRange`,()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:l,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);c=c.add(i.doc,o);for(let e of u)s.add(e)}return{set:c,widgetKeys:s}}buildFullSet(e,t,n){let r=this.runCreate(e,`create`,()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return _d(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){if(!md)return;if(e.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let t=xd(e.mergedDecorationSet),n=new Set(t.map(({key:e})=>e));for(let{key:e,extensions:n}of t){if(this.warnedWidgetKeys.has(e))continue;let t=Array.from(n).map(e=>`"${e}"`).join(`, `);console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${n.size===1?``:`s`} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(e,t){let n=Object.keys(t);return n.length===1?t[n[0]]:Od(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):Od(n.doc,r)}};function Pd(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof j){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function Fd(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}function Id(e,t){let n=e.getAttribute(`style`);if(!n)return null;let r=n.split(`;`).map(e=>e.trim()).filter(Boolean),i=t.toLowerCase();for(let e=r.length-1;e>=0;--e){let t=r[e],n=t.indexOf(`:`);if(n!==-1&&t.slice(0,n).trim().toLowerCase()===i)return t.slice(n+1).trim()}return null}function Ld(e){return typeof e==`number`}function Rd(e){return Object.prototype.toString.call(e).slice(8,-1)}function zd(e){return Rd(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function Bd(e,t,n){let r=e.split(` +`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o0)break;if(e.trim()===``){o+=1,a=`${a}${e}\n`;continue}else return}let d=t.extractItemData(u),{indentLevel:f,mainContent:p}=d;a=`${a}${e}\n`;let m=[p];for(o+=1;oe.trim()!==``);if(t===-1)break;if((((l=r[o+1+t].match(/^(\s*)/))==null||(l=l[1])==null?void 0:l.length)||0)>f){m.push(e),a=`${a}${e}\n`,o+=1;continue}else break}if((((c=e.match(/^(\s*)/))==null||(c=c[1])==null?void 0:c.length)||0)>f)m.push(e),a=`${a}${e}\n`,o+=1;else break}let h,g=m.slice(1);if(g.length>0){let e=g.map(e=>e.slice(f+s)).join(` +`);e.trim()&&(h=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let _=t.createToken(d,h);i.push(_)}if(i.length!==0)return{items:i,raw:a}}var Vd=4;function Hd(e){let t=0;for(let n of e)t=n===` `?t+Vd-t%Vd:t+1;return t}function Ud(e,t,n,r,i){if(!e||!Array.isArray(e.content))return``;let a=typeof n==`function`?n(r):n,[o,...s]=e.content,c=`${a}${t.renderChildren([o])}`;return s&&s.length>0&&s.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=e=>{if(!i?.alignNestedToPrefix)return t.indent(e);let n=t.indent(``),r=Hd(a);return(Hd(n)>=r?n:` `.repeat(r))+e},o=r.split(` +`).map(e=>n(e||``)).join(` +`);c+=e.type===`paragraph`?`\n\n${o}`:`\n${o}`}}),c}function Wd(e,t){let n={...e};return zd(e)&&zd(t)&&Object.keys(t).forEach(r=>{zd(t[r])&&zd(e[r])?n[r]=Wd(e[r],t[r]):n[r]=t[r]}),n}function Gd(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var Kd=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},qd=(e,t)=>{if(Vc(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function Jd(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=Su(c)+i;return a.forEach(e=>{if(l)return;let a=qd(u,e.find);if(!a)return;let d=a[0].length-i.length;if(d>0){let e=c.parentOffset-d;if(e<0||c.parent.textBetween(e,c.parentOffset)!==a[0].slice(0,d))return}let f=s.state.tr,p=wc({state:s.state,transaction:f}),m={from:n-(a[0].length-i.length),to:r},{commands:h,chain:g,can:_}=new Tc({editor:t,state:p});e.handler({state:p,range:m,match:a,commands:h,chain:g,can:_})===null||!f.steps.length||(e.undoable&&f.setMeta(o,{transform:f,from:n,to:r,text:i}),s.dispatch(f),l=!0)}),l}function Yd(e){let{editor:t,rules:n}=e,r=new M({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:ql(C.from(e),a.schema);let{from:i}=s;Jd({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return Jd({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&Jd({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?Jd({editor:t,from:a.pos,to:a.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Xd=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...G(W(this,`addOptions`,{name:this.name}))}}get storage(){return{...G(W(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Wd(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},Zd=class e extends Xd{constructor(...e){super(...e),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Qd=class{constructor(e){this.find=e.find,this.handler=e.handler}},$d=(e,t,n)=>{if(Vc(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function ef(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new Tc({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{var f;if(!((f=e.type)==null||(f=f.spec)==null)&&f.code||!(e.isText||e.isTextblock||e.isInline))return;let p=e.content?.size??e.nodeSize??0,m=Math.max(r,t),h=Math.min(i,t+p);m>=h||$d(e.isText?e.text||``:e.textBetween(m-t,h-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=m+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var tf=null,nf=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function rf(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!ef({editor:t,state:wc({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new M({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(tf=t)},i=()=>{tf&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=tf;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:ql(C.from(t),r.schema);let{from:n}=d,i=n+t.length,a=nf(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!Ld(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var af=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=cu(e),this.schema=au(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=W(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:bu(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=su([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:bu(t.name,this.schema)},r=[],i=W(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&W(t,`exitable`,n)&&(a.ArrowRight=()=>Zd.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=Sc(a);r.push(o);let s=W(t,`addInputRules`,n);if(Du(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=Yd({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=W(t,`addPasteRules`,n);if(Du(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=rf({editor:e,rules:t});r.push(...n)}}let l=W(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;(e=this.decorationManager)==null||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=W(e,`addDecorations`,{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:bu(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new Nd({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){return Zl(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=Xl(this.extensions);return Object.fromEntries(t.filter(e=>!!W(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=W(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:U(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:eu(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return su([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:bu(n.name,this.schema)},i=W(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return su([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:bu(n.name,this.schema)},i=W(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=Xl(this.extensions);return Object.fromEntries(t.filter(e=>!!W(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=W(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Kc(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=eu(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{Gd(i,e,t)}})}]:[]}))}destroy(){var e;(e=this.decorationManager)==null||e.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:bu(e.name,this.schema)};e.type===`mark`&&((G(W(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(G(W(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=W(e,`onBeforeCreate`,t),r=W(e,`onCreate`,t),i=W(e,`onUpdate`,t),a=W(e,`onSelectionUpdate`,t),o=W(e,`onTransaction`,t),s=W(e,`onFocus`,t),c=W(e,`onBlur`,t),l=W(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};af.resolve=cu,af.sort=su,af.flatten=Kl;var q=class e extends Xd{constructor(...e){super(...e),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},of=q.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new M({key:new N(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=du(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>lu(r,{from:e.pos,to:t.pos},s)).join(o??` + +`)}}})]}}),sf=q.create({name:`commands`,addCommands(){return{...ld}}}),cf=q.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){var n;let r=()=>{var n,r;if(((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null||(r=n.filterTransaction)==null?void 0:r.call(n,e))??e.getMeta(`y-sync$`))return;let i=Hl(e.before,[e,...t]);gu(i).forEach(t=>{i.mapping.mapResult(t.oldRange.from).deletedAfter&&i.mapping.mapResult(t.oldRange.to).deletedBefore&&i.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let a=r+n.nodeSize-2,o=t.oldRange.from<=r&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:r,to:a,newFrom:i.mapping.map(r),newTo:i.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:i})})});let a=i.mapping;i.steps.forEach((t,n)=>{if(t instanceof zt){let r=a.slice(n).map(t.from,-1),o=a.slice(n).map(t.to),s=a.invert().map(r,-1),c=a.invert().map(o),l=r>0?i.doc.nodeAt(r-1)?.marks.some(e=>e.eq(t.mark)):!1,u=i.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:r,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:i})}})};((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null?void 0:n.async)??!0?setTimeout(r,0):r()}}),lf=q.create({name:`drop`,addProseMirrorPlugins(){return[new M({key:new N(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),uf=q.create({name:`editable`,addProseMirrorPlugins(){return[new M({key:new N(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),df=new N(`focusEvents`),ff=q.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new M({key:df,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),pf=q.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:k.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return $c()||xl()?i:r},addProseMirrorPlugins(){return[new M({key:new N(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=k.atStart(t.doc).from,l=k.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!ku(n.doc))return;let u=n.tr,d=wc({state:n,transaction:u}),{commands:f}=new Tc({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),mf=q.create({name:`paste`,addProseMirrorPlugins(){return[new M({key:new N(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),hf=q.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new M({key:new N(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),gf=q.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=Xl(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new M({key:new N(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),_f=!1;function vf(e){if(_f)return;_f=!0;let t;try{t=Ht.fromJSON(e,{from:0,to:0}).slice.content}catch{return}t instanceof C||console.warn(`[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.`)}var yf=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},bf=`.ProseMirror { + position: relative; +} + +.ProseMirror { + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ +} + +.ProseMirror [contenteditable="false"] { + white-space: normal; +} + +.ProseMirror [contenteditable="false"] [contenteditable="true"] { + white-space: pre-wrap; +} + +.ProseMirror pre { + white-space: pre-wrap; +} + +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; + width: 0 !important; + height: 0 !important; +} + +.ProseMirror-gapcursor { + display: none; + pointer-events: none; + position: absolute; + margin: 0; +} + +.ProseMirror-gapcursor:after { + content: ""; + display: block; + position: absolute; + top: -2px; + width: 20px; + border-top: 1px solid black; + animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; +} + +@keyframes ProseMirror-cursor-blink { + to { + visibility: hidden; + } +} + +.ProseMirror-hideselection *::selection { + background: transparent; +} + +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} + +.ProseMirror-hideselection * { + caret-color: transparent; +} + +.ProseMirror-focused .ProseMirror-gapcursor { + display: block; +}`,xf=class extends pd{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Mu,createMappablePosition:Nu},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=Zc(t,this.options.autofocus);this.editorState=er.create({doc:t,schema:this.schema,selection:e||void 0})}vf(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():Tc.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Tc.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=Fd(bf,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return md&&!this.hasWarnedStaleDecorationRead&&fd(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=Jl(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[uf,of.configure({blockSeparator:(e=this.options.coreExtensionOptions)==null||(e=e.clipboardTextSerializer)==null?void 0:e.blockSeparator}),sf,ff,pf,hf.configure({value:(t=this.options.coreExtensionOptions)==null||(t=t.tabindex)==null?void 0:t.value}),lf,mf,cf,gf.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new af(n,this)}createCommandManager(){this.commandManager=new Tc({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=zl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(e.message))throw e;let t=zl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=er.create({doc:t,schema:this.schema,selection:Zc(t,this.options.autofocus)||void 0}),this.emit(`contentError`,{editor:this,error:e,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),this.editorState.doc}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new rc(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return pu(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return wu(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ql(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=` + +`,textSerializers:n={}}=e||{};return uu(this.state.doc,{blockSeparator:t,textSerializers:{...du(this.schema),...n}})}get isEmpty(){return ku(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new yf(t,this,!1,n)}get $doc(){return this.$pos(0)}};function Sf(e){return new Kd({find:e.find,handler:({state:t,range:n,match:r})=>{let i=G(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(_u(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;ln.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function Cf(e){return new Kd({find:e.find,handler:({state:t,range:n,match:r})=>{let i=G(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function wf(e){return new Kd({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=G(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function Tf(e){return new Kd({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=G(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Xt(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&ln(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var Ef=e=>`touches`in e,Df=class{constructor(e){var t;this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),!(e==null||(t=e.options)==null)&&t.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,Ef(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return rthis.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}},J=class e extends Xd{constructor(...e){super(...e),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function Of(e){return new Qd({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=G(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(_u(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;dn.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:kf,getOwnPropertySymbols:Af}=Object,{hasOwnProperty:jf}=Object.prototype;function Mf(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function Nf(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Pf(e){return e?.[Symbol.toStringTag]}function Ff(e){return kf(e).concat(Af(e))}var If=Object.hasOwn||((e,t)=>jf.call(e,t));function Lf(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var Rf=`__v`,zf=`__o`,Bf=`_owner`,{getOwnPropertyDescriptor:Vf,keys:Hf}=Object;function Uf(e,t){return e.byteLength===t.byteLength&&np(new Uint8Array(e),new Uint8Array(t))}function Wf(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Gf(e,t){return e.byteLength===t.byteLength&&np(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Kf(e,t){return Lf(e.getTime(),t.getTime())}function qf(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Jf(e,t){return e===t}function Yf(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Xf=Lf;function Zf(e,t,n){let r=Hf(e),i=r.length;if(Hf(t).length!==i)return!1;for(;i-- >0;)if(!ip(e,t,n,r[i]))return!1;return!0}function Qf(e,t,n){let r=Ff(e),i=r.length;if(Ff(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!ip(e,t,n,a)||(o=Vf(e,a),s=Vf(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function $f(e,t){return Lf(e.valueOf(),t.valueOf())}function ep(e,t){return e.source===t.source&&e.flags===t.flags}function tp(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function np(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function rp(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function ip(e,t,n,r){return(r===Bf||r===zf||r===Rf)&&(e.$$typeof||t.$$typeof)?!0:If(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var ap=`[object ArrayBuffer]`,op=`[object Arguments]`,sp=`[object Boolean]`,cp=`[object DataView]`,lp=`[object Date]`,up=`[object Error]`,dp=`[object Map]`,fp=`[object Number]`,pp=`[object Object]`,mp=`[object RegExp]`,hp=`[object Set]`,gp=`[object String]`,_p={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},vp=`[object URL]`,yp=Object.prototype.toString;function bp({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=yp.call(h);if(b===lp)return r(h,g,_);if(b===mp)return u(h,g,_);if(b===dp)return o(h,g,_);if(b===hp)return d(h,g,_);if(b===pp)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===vp)return p(h,g,_);if(b===up)return i(h,g,_);if(b===op)return c(h,g,_);if(_p[b])return f(h,g,_);if(b===ap)return e(h,g,_);if(b===cp)return n(h,g,_);if(b===sp||b===fp||b===gp)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Pf(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function xp({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Uf,areArraysEqual:n?Qf:Wf,areDataViewsEqual:Gf,areDatesEqual:Kf,areErrorsEqual:qf,areFunctionsEqual:Jf,areMapsEqual:n?Mf(Yf,Qf):Yf,areNumbersEqual:Xf,areObjectsEqual:n?Qf:Zf,arePrimitiveWrappersEqual:$f,areRegExpsEqual:ep,areSetsEqual:n?Mf(tp,Qf):tp,areTypedArraysEqual:n?Mf(np,Qf):np,areUrlsEqual:rp,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=Nf(r.areArraysEqual),t=Nf(r.areMapsEqual),n=Nf(r.areObjectsEqual),i=Nf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function Sp(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function Cp({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var wp=Tp();Tp({strict:!0}),Tp({circular:!0}),Tp({circular:!0,strict:!0}),Tp({createInternalComparator:()=>Lf}),Tp({strict:!0,createInternalComparator:()=>Lf}),Tp({circular:!0,createInternalComparator:()=>Lf}),Tp({circular:!0,createInternalComparator:()=>Lf,strict:!0});function Tp(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=bp(xp(e));return Cp({circular:t,comparator:a,createState:r,equals:n?n(a):Sp(a),strict:i})}var Ep=d(),Dp=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},Op=({contentComponent:e})=>{let t=(0,b.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,x.jsx)(x.Fragment,{children:Object.values(t)})};function kp(){let e=new Set,t={},n=!1,r=()=>{n||!e.size||(n=!0,queueMicrotask(()=>{n=!1,e.forEach(e=>e())}))};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(e,n){t={...t,[e]:y.createPortal(n.reactElement,n.element,e)},r()},removeRenderer(e){let n={...t};delete n[e],t=n,r()}}}var Ap=class extends v.Component{constructor(e){super(e),this.editorContentRef=v.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=kp(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{ref:Dp(t,this.editorContentRef),...n}),e?.contentComponent&&(0,x.jsx)(Op,{contentComponent:e.contentComponent})]})}},jp=(0,v.forwardRef)((e,t)=>{let n=v.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return v.createElement(Ap,{key:n,innerRef:t,...e})}),Mp=v.memo(jp),Np=typeof window<`u`?v.useLayoutEffect:v.useEffect,Pp=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e,t=t=>{t?.transaction!==void 0&&t.transaction===e||(e=t?.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on(`transaction`,t),n.on(`update`,t),()=>{n.off(`transaction`,t),n.off(`update`,t)}}}};function Fp(e){let[t]=(0,v.useState)(()=>new Pp(e.editor)),n=(0,Ep.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??wp);return Np(()=>t.watch(e.editor),[e.editor,t]),(0,v.useDebugValue)(n),n}var Ip=typeof window>`u`,Lp=Ip||!!(typeof window<`u`&&window.next),Rp=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return(Ip||Lp&&e===void 0)&&(t=!1),t?this.createEditor():null}createEditor(){return new xf({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)},onMount:(...e)=>{var t;return(t=this.options.current).onMount?.call(t,...e)},onUnmount:(...e)=>{var t;return(t=this.options.current).onUnmount?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function zp(e={},t=[]){let n=(0,v.useRef)(e);n.current=e;let[r]=(0,v.useState)(()=>new Rp(n)),i=(0,b.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,v.useDebugValue)(i),(0,v.useEffect)(r.onRender(t)),Fp({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Bp=(0,v.createContext)({editor:null});Bp.Consumer;var Vp=(0,v.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Hp=()=>(0,v.useContext)(Vp);v.forwardRef((e,t)=>{let{onDragStart:n}=Hp();return(0,x.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),v.createContext({markViewContentRef:()=>{}});var Up=(0,v.createContext)({get editor(){throw Error(`useTiptap must be used within a provider`)}});Up.displayName=`TiptapContext`;var Wp=()=>(0,v.useContext)(Up);function Gp({children:e,...t}){let n=`editor`in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,v.useMemo)(()=>({editor:n}),[n]),i=(0,v.useMemo)(()=>({editor:n}),[n]);return(0,x.jsx)(Bp.Provider,{value:i,children:(0,x.jsx)(Up.Provider,{value:r,children:e})})}Gp.displayName=`Tiptap`;function Kp({...e}){let{editor:t}=Wp();return(0,x.jsx)(Mp,{editor:t,...e})}Kp.displayName=`Tiptap.Content`,Object.assign(Gp,{Content:Kp});var qp=new WeakSet,Jp=new WeakSet;function Yp(e){let t=e;return qp.add(t),t}function Xp(e){return Array.isArray(e)&&qp.has(e)}function Zp(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&Jp.has(e)&&!Xp(e)?Zp(e):[e])}function Qp(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!Xp(n)&&!Jp.has(n)?Yp(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(Xp(n))return Yp([e,r,n]);if(n.length===0)return Yp([e,r]);let t=Zp(n);return t.length===0?Yp([e,r]):Yp([e,r,...t])}return Yp(n==null?[e,r]:[e,r,n])}var $p=(e,t)=>Qp(e,t),em=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new T(n,0,0);return e.replace(l,i.after(),r),e.setSelection(A.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},tm=/^\s*>\s$/,nm=J.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return $p(`blockquote`,{...K(this.options.HTMLAttributes,e),children:$p(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(` +`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(` +`))}),n.join(` +> +`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>em(this.editor,this.type)}},addInputRules(){return[Tf({find:tm,type:this.type})]}}),rm=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,im=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,am=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,om=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,sm=Zd.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return $p(`strong`,{...K(this.options.HTMLAttributes,e),children:$p(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:``,close:``}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Sf({find:rm,type:this.type}),Sf({find:am,type:this.type})]},addPasteRules(){return[Of({find:im,type:this.type}),Of({find:om,type:this.type})]}}),cm=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},lm=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},um=Zd.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,K(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Sf({find:cm,type:this.type})]},addPasteRules(){return[Of({find:lm,type:this.type})]}}),dm=4,fm=/^```([a-z]+)?[\s\n]$/,pm=/^~~~([a-z]+)?[\s\n]$/,mm=J.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:dm,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,K(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(` +`):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??dm,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,` +`,` +`).split(` +`).map(e=>o+e).join(` +`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??dm,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,` +`,` +`).split(` +`),c=0,l=0,u=r-a;for(let e=0;e=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,` +`,` +`).split(` +`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(` +`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + +`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(k.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[wf({find:fm,type:this.type,getAttributes:e=>({language:e[1]})}),wf({find:pm,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new M({key:new N(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,` +`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(A.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),hm=J.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` + +`):``}),gm=J.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,K(this.options.HTMLAttributes,e)]},renderText(){return` +`},renderMarkdown:()=>` +`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),_m=J.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,K(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>wf({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),vm=J.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,K(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!Pd(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return Au(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(A.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(j.create(t.doc,n.pos)):t.setSelection(A.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(A.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Cf({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),ym=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,bm=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,xm=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Sm=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Cm=Zd.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,K(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:``,close:``}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Sf({find:ym,type:this.type}),Sf({find:xm,type:this.type})]},addPasteRules(){return[Of({find:bm,type:this.type}),Of({find:Sm,type:this.type})]}}),wm=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,Tm=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,Em=`numeric`,Dm=`ascii`,Om=`alpha`,km=`asciinumeric`,Am=`alphanumeric`,jm=`domain`,Mm=`emoji`,Nm=`scheme`,Pm=`slashscheme`,Fm=`whitespace`;function Im(e,t){return e in t||(t[e]=[]),t[e]}function Lm(e,t,n){t[Em]&&(t[km]=!0,t[Am]=!0),t[Dm]&&(t[km]=!0,t[Om]=!0),t[km]&&(t[Am]=!0),t[Om]&&(t[Am]=!0),t[Am]&&(t[jm]=!0),t[Mm]&&(t[jm]=!0);for(let r in t){let t=Im(r,n);t.indexOf(e)<0&&t.push(e)}}function Rm(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function zm(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}zm.groups={},zm.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;ne.ta(t,n,r,i),X=(e,t,n,r,i)=>e.tr(t,n,r,i),Bm=(e,t,n,r,i)=>e.ts(t,n,r,i),Z=(e,t,n,r,i)=>e.tt(t,n,r,i),Vm=`WORD`,Hm=`UWORD`,Um=`ASCIINUMERICAL`,Wm=`ALPHANUMERICAL`,Gm=`LOCALHOST`,Km=`TLD`,qm=`UTLD`,Jm=`SCHEME`,Ym=`SLASH_SCHEME`,Xm=`NUM`,Zm=`WS`,Qm=`NL`,$m=`OPENBRACE`,eh=`CLOSEBRACE`,th=`OPENBRACKET`,nh=`CLOSEBRACKET`,rh=`OPENPAREN`,ih=`CLOSEPAREN`,ah=`OPENANGLEBRACKET`,oh=`CLOSEANGLEBRACKET`,sh=`FULLWIDTHLEFTPAREN`,ch=`FULLWIDTHRIGHTPAREN`,lh=`LEFTCORNERBRACKET`,uh=`RIGHTCORNERBRACKET`,dh=`LEFTWHITECORNERBRACKET`,fh=`RIGHTWHITECORNERBRACKET`,ph=`FULLWIDTHLESSTHAN`,mh=`FULLWIDTHGREATERTHAN`,hh=`AMPERSAND`,gh=`APOSTROPHE`,_h=`ASTERISK`,vh=`AT`,yh=`BACKSLASH`,bh=`BACKTICK`,xh=`CARET`,Sh=`COLON`,Ch=`COMMA`,wh=`DOLLAR`,Th=`DOT`,Eh=`EQUALS`,Dh=`EXCLAMATION`,Oh=`HYPHEN`,kh=`PERCENT`,Ah=`PIPE`,jh=`PLUS`,Mh=`POUND`,Nh=`QUERY`,Ph=`QUOTE`,Fh=`FULLWIDTHMIDDLEDOT`,Ih=`SEMI`,Lh=`SLASH`,Rh=`TILDE`,zh=`UNDERSCORE`,Bh=`EMOJI`,Vh=`SYM`,Hh=Object.freeze({__proto__:null,ALPHANUMERICAL:Wm,AMPERSAND:hh,APOSTROPHE:gh,ASCIINUMERICAL:Um,ASTERISK:_h,AT:vh,BACKSLASH:yh,BACKTICK:bh,CARET:xh,CLOSEANGLEBRACKET:oh,CLOSEBRACE:eh,CLOSEBRACKET:nh,CLOSEPAREN:ih,COLON:Sh,COMMA:Ch,DOLLAR:wh,DOT:Th,EMOJI:Bh,EQUALS:Eh,EXCLAMATION:Dh,FULLWIDTHGREATERTHAN:mh,FULLWIDTHLEFTPAREN:sh,FULLWIDTHLESSTHAN:ph,FULLWIDTHMIDDLEDOT:Fh,FULLWIDTHRIGHTPAREN:ch,HYPHEN:Oh,LEFTCORNERBRACKET:lh,LEFTWHITECORNERBRACKET:dh,LOCALHOST:Gm,NL:Qm,NUM:Xm,OPENANGLEBRACKET:ah,OPENBRACE:$m,OPENBRACKET:th,OPENPAREN:rh,PERCENT:kh,PIPE:Ah,PLUS:jh,POUND:Mh,QUERY:Nh,QUOTE:Ph,RIGHTCORNERBRACKET:uh,RIGHTWHITECORNERBRACKET:fh,SCHEME:Jm,SEMI:Ih,SLASH:Lh,SLASH_SCHEME:Ym,SYM:Vh,TILDE:Rh,TLD:Km,UNDERSCORE:zh,UTLD:qm,UWORD:Hm,WORD:Vm,WS:Zm}),Uh=/[a-z]/,Wh=/\p{L}/u,Gh=/\p{Emoji}/u,Kh=/\d/,qh=/\s/,Jh=`\r`,Yh=` +`,Xh=`️`,Zh=`‍`,Qh=``,$h=null,eg=null;function tg(e=[]){let t={};zm.groups=t;let n=new zm;$h??=ag(wm),eg??=ag(Tm),Z(n,`'`,gh),Z(n,`{`,$m),Z(n,`}`,eh),Z(n,`[`,th),Z(n,`]`,nh),Z(n,`(`,rh),Z(n,`)`,ih),Z(n,`<`,ah),Z(n,`>`,oh),Z(n,`(`,sh),Z(n,`)`,ch),Z(n,`「`,lh),Z(n,`」`,uh),Z(n,`『`,dh),Z(n,`』`,fh),Z(n,`<`,ph),Z(n,`>`,mh),Z(n,`&`,hh),Z(n,`*`,_h),Z(n,`@`,vh),Z(n,"`",bh),Z(n,`^`,xh),Z(n,`:`,Sh),Z(n,`,`,Ch),Z(n,`$`,wh),Z(n,`.`,Th),Z(n,`=`,Eh),Z(n,`!`,Dh),Z(n,`-`,Oh),Z(n,`%`,kh),Z(n,`|`,Ah),Z(n,`+`,jh),Z(n,`#`,Mh),Z(n,`?`,Nh),Z(n,`"`,Ph),Z(n,`/`,Lh),Z(n,`;`,Ih),Z(n,`~`,Rh),Z(n,`_`,zh),Z(n,`\\`,yh),Z(n,`・`,Fh);let r=X(n,Kh,Xm,{[Em]:!0});X(r,Kh,r);let i=X(r,Uh,Um,{[km]:!0}),a=X(r,Wh,Wm,{[Am]:!0}),o=X(n,Uh,Vm,{[Dm]:!0});X(o,Kh,i),X(o,Uh,o),X(i,Kh,i),X(i,Uh,i);let s=X(n,Wh,Hm,{[Om]:!0});X(s,Uh),X(s,Kh,a),X(s,Wh,s),X(a,Kh,a),X(a,Uh),X(a,Wh,a);let c=Z(n,Yh,Qm,{[Fm]:!0}),l=Z(n,Jh,Zm,{[Fm]:!0}),u=X(n,qh,Zm,{[Fm]:!0});Z(n,Qh,u),Z(l,Yh,c),Z(l,Qh,u),X(l,qh,u),Z(u,Jh),Z(u,Yh),X(u,qh,u),Z(u,Qh,u);let d=X(n,Gh,Bh,{[Mm]:!0});Z(d,`#`),X(d,Gh,d),Z(d,Xh,d);let f=Z(d,Zh);Z(f,`#`),X(f,Gh,d);let p=[[Uh,o],[Kh,i]],m=[[Uh,null],[Wh,s],[Kh,a]];for(let e=0;e<$h.length;e++)ig(n,$h[e],Km,Vm,p);for(let e=0;ee[0]>t[0]?1:-1);for(let t=0;t=0?i[jm]=!0:Uh.test(r)?Kh.test(r)?i[km]=!0:i[Dm]=!0:i[Em]=!0,Bm(n,r,r,i)}return Bm(n,`localhost`,Gm,{ascii:!0}),n.jd=new zm(Vh),{start:n,tokens:Object.assign({groups:t},Hh)}}function ng(e,t){let n=rg(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function rg(e){let t=[],n=e.length,r=0;for(;r56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function ig(e,t,n,r,i){let a,o=t.length;for(let n=0;n=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var og={defaultProtocol:`http`,events:null,format:cg,formatHref:cg,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function sg(e,t=null){let n=Object.assign({},og);e&&(n=Object.assign(n,e instanceof sg?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;en?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=og.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function ug(e,t){class n extends lg{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var dg=ug(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),fg=ug(`text`),pg=ug(`nl`),mg=ug(`url`,{isLink:!0,toHref(e=og.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==Gm&&e[1].t===Sh}}),hg=e=>new zm(e);function gg({groups:e}){let t=e.domain.concat([hh,_h,vh,yh,bh,xh,wh,Eh,Oh,Xm,kh,Ah,jh,Mh,Lh,Vh,Rh,zh]),n=[gh,Sh,Ch,Th,Dh,kh,Nh,Ph,Ih,ah,oh,$m,eh,nh,th,rh,ih,sh,ch,lh,uh,dh,fh,ph,mh],r=[hh,gh,_h,yh,bh,xh,wh,Eh,Oh,$m,eh,kh,Ah,jh,Mh,Nh,Lh,Vh,Rh,zh],i=hg(),a=Z(i,Rh);Y(a,r,a),Y(a,e.domain,a);let o=hg(),s=hg(),c=hg();Y(i,e.domain,o),Y(i,e.scheme,s),Y(i,e.slashscheme,c),Y(o,r,a),Y(o,e.domain,o);let l=Z(o,vh);Z(a,vh,l),Z(s,vh,l),Z(c,vh,l);let u=Z(a,Th);Y(u,r,a),Y(u,e.domain,a);let d=hg();Y(l,e.domain,d),Y(d,e.domain,d);let f=Z(d,Th);Y(f,e.domain,d);let p=hg(dg);Y(f,e.tld,p),Y(f,e.utld,p),Z(l,Gm,p);let m=Z(d,Oh);Z(m,Oh,m),Y(m,e.domain,d),Y(p,e.domain,d),Z(p,Th,f),Z(p,Oh,m);let h=Z(o,Oh),g=Z(o,Th);Z(h,Oh,h),Y(h,e.domain,o),Y(g,r,a),Y(g,e.domain,o);let _=hg(mg);Y(g,e.tld,_),Y(g,e.utld,_),Y(_,e.domain,o),Y(_,r,a),Z(_,Th,g),Z(_,Oh,h),Z(_,vh,l);let v=Z(_,Sh),y=hg(mg);Y(v,e.numeric,y);let b=hg(mg),x=hg();Y(b,t,b),Y(b,n,x),Y(x,t,b),Y(x,n,x),Z(_,Lh,b),Z(y,Lh,b);let ee=Z(s,Sh),te=Z(Z(Z(c,Sh),Lh),Lh);Y(s,e.domain,o),Z(s,Th,g),Z(s,Oh,h),Y(c,e.domain,o),Z(c,Th,g),Z(c,Oh,h),Y(ee,e.domain,b),Z(ee,Lh,b),Z(ee,Nh,b),Y(te,e.domain,b),Y(te,t,b),Z(te,Lh,b);let S=[[$m,eh],[th,nh],[rh,ih],[ah,oh],[sh,ch],[lh,uh],[dh,fh],[ph,mh]];for(let e=0;e=0&&f++,i++,u++;if(f<0)i-=u,i0&&(a.push(vg(fg,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(vg(e,t,r))}}return o.length>0&&a.push(vg(fg,t,o)),a}function vg(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var yg=typeof console<`u`&&console&&console.warn||(()=>{}),bg=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,Q={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function xg(){return zm.groups={},Q.scanner=null,Q.parser=null,Q.tokenQueue=[],Q.pluginQueue=[],Q.customSchemes=[],Q.initialized=!1,Q}function Sg(e,t=!1){if(Q.initialized&&yg(`linkifyjs: already initialized - will not register custom scheme "${e}" ${bg}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format. +1. Must only contain digits, lowercase ASCII letters or "-" +2. Cannot start or end with "-" +3. "-" cannot repeat`);Q.customSchemes.push([e,t])}function Cg(){Q.scanner=tg(Q.customSchemes);for(let e=0;e{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(gu(Hl(n.doc,[...t])).forEach(({newRange:t})=>{let n=Ul(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!Og.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(Dg).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=wg(n).map(t=>t.toObject(e.defaultProtocol));if(!Ag(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{_u(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function Mg(e){return new M({key:new N(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=pu(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}var Ng=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,Pg=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function Fg(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function Ig(e,t){let n=0,r=0;for(;r0}function Lg(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||Fg(e,t.index??0)||Ig(e,t.index??0)?!1:!!r.trim()&&n(i)}function Rg(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function zg(e,t){return e.index{let n=Ng.exec(t);return!n||!Lg(t,n,e.isAllowedHref)?null:Rg(n)},type:e.type,getAttributes:Bg});return new Kd({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function Hg(e){let t=Of({find:t=>{let n=[];for(let r of t.matchAll(Pg))Lg(t,r,e.isAllowedHref)&&n.push(Rg(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>zg(t,e)));return[...n,...r]},type:e.type,getAttributes:Bg});return new Qd({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function Ug(e){return new M({key:new N(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=Tg(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function Wg(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(kg,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var Gg=Zd.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){Sg(e);return}Sg(e.scheme,e.optionalSlashes)})},onDestroy(){xg()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!Wg(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Wg(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Wg(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,K(this.options.HTMLAttributes,e),0]:[`a`,K(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!Wg(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Wg(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[Vg({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Wg(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;Tg(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Wg(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[Hg({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Wg(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[Of({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(jg({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Wg(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Mg({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Ug({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Kg=Gg,qg=`listItem`,Jg=`textStyle`,Yg=/^\s*([-+*])\s$/,Xg=J.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,K(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` +`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(qg,this.editor.getAttributes(Jg)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Tf({find:Yg,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Tf({find:Yg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Jg),editor:this.editor})),[e]}}),Zg=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},Qg=(e,t,n,r)=>{let i=Zg(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,C.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},$g=(e,t,n)=>Qg(e.state,e.view.dispatch,t,n),e_=(e,t)=>q.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>$g(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),t_=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],n_=`abcdefghijklmnopqrstuvwxyz`,r_=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function i_(e){let t=e,n=``;for(let[e,r]of t_)for(;t>=e;)n+=r,t-=e;return n}function a_(e){return i_(e).toUpperCase()}function o_(e){let t=e.toLowerCase(),n=0,r=0;for(;n0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function f_(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return l_(t);case`A`:return l_(t).toUpperCase();case`i`:return i_(t);case`I`:return a_(t);default:return String(t)}}function p_(e){if(e.length===0)return!1;let t=u_(e[0])??`numeric`,n=d_(e[0]);if(n<1)return!1;for(let r=0;r{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(__(e))return{type:`listItem`,content:[{type:`paragraph`,content:v_(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>Ud(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){var t,n;let r=((t=e.meta)==null||(t=t.parentAttrs)==null?void 0:t.start)||1;return g_((n=e.meta)==null||(n=n.parentAttrs)==null?void 0:n.type,r-1+(e.index||0),`. `)}return`- `},n,{alignNestedToPrefix:n?.parentType===`orderedList`}),addExtensions(){return[e_(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),b_=(e,t)=>{let{$from:n}=t.selection,r=U(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},x_=(e,t)=>{let n=b_(e,t);if(!n)return!1;let[,r]=vu(t,e,n.$pos.pos+4);return r},S_=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},C_=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!wl(e.state,t)&&S_(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!wl(e.state,t)||!Eu(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type!==e.schema.nodes[t]||r.index(i)!==0?!1:e.chain().liftListItem(t).run()},w_=(e,t)=>{let n=x_(e,t),r=b_(e,t);return!r||!n?!1:n>r.depth},T_=(e,t)=>{let n=x_(e,t),r=b_(e,t);return!r||!n?!1:n{if(!wl(e.state,t)||!Tu(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:w_(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():T_(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},D_=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0||!a.parent.isTextblock||wl(r,t))return!1;let o=yu(a);if(!o||!n.includes(o.type.name))return!1;let s=o.lastChild;if(!s||s.type.name!==t)return!1;let c=a.parent;if(!s.canReplace(s.childCount,s.childCount,C.from(c)))return!1;let l=a.before(),u=a.after(),d=l-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(l,u).insert(d,C.from(c)),e.setSelection(A.create(e.doc,d+1)),e.scrollIntoView()),!0))},O_=q.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&E_(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&E_(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&C_(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&C_(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(e.state.schema.nodes[t]!==void 0&&D_(e,t,n))return!0;return!1}}}}),k_=RegExp(`^(\\s*)(${r_})([.)])\\s+(.*)$`),A_=/^\s/,j_={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function M_(e){return k_.test(e.trimStart())}function N_(e){let t=e.trimStart();return j_.bulletItem.test(t)||M_(t)||j_.heading.test(t)||j_.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||j_.codeFence.test(t)||j_.blockMath.test(t)}function P_(e){return Object.values(j_).some(t=>t.test(e))}function F_(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&N_(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function I_(e){let t=[],n=0,r=0;for(;ne.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(L_);if(!t)return null;n.push({marker:t[1],content:t[3]})}return p_(n.map(e=>e.marker))?{type:`orderedList`,attrs:h_(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function z_(e,t,n){let r=[],i=0;for(;it;)f.push(e[d]),d+=1;if(f.length>0){let e=z_(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(` +`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function B_(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var V_=`listItem`,H_=`textStyle`,U_=/^(\d+)\.\s$/;function W_(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var G_=J.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=W_(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=W_(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=K(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?B_(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` +`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let r=e.split(` +`),[i,a]=I_(r);if(i.length===0)return;let o=z_(i,i[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,typeMarker:i[0]?.type,items:o,raw:r.slice(0,a).join(` +`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(V_,this.editor.getAttributes(H_)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new M({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=R_(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=Tf({find:U_,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Tf({find:U_,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(H_)}),joinPredicate:e,editor:this.editor})),[t]}}),K_=/^\s*(\[([( |x])?\])\s$/,q_=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,J_=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},Y_=J.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,K(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>Ud(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[e_(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=q_;let l=e=>{let t=J_(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=eu(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[Tf({find:K_,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),X_=J.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,K(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` +`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=Bd(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=Bd(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});q.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(Xg.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(y_.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(O_.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(G_.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Y_.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(X_.configure(this.options.taskList)),e}});var Z_=` `,Q_=`\xA0`,$_=J.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,K(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===Z_||n[0].text===Z_||n[0].raw===Q_||n[0].text===Q_)&&r.length===1&&r[0].type===`text`&&(r[0].text===Z_||r[0].text===Q_)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?Z_:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ev=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tv=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nv=Zd.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,K(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Sf({find:ev,type:this.type})]},addPasteRules(){return[Of({find:tv,type:this.type})]}}),rv=J.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),iv=Zd.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,K(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),av=iv;function ov(e={}){return new M({view(t){return new sv(t,e)}})}var sv=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=hn(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},cv=class e extends k{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):k.near(r)}content(){return T.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new lv(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!dv(e)||!fv(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!j.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};cv.prototype.visible=!1,cv.findFrom=cv.findGapCursorFrom,k.jsonID(`gapcursor`,cv);var lv=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return cv.valid(t)?new cv(t):k.near(t)}};function uv(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function dv(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||uv(e.type))return!0;if(e.inlineContent)return!1}}return!0}function fv(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||uv(e.type))return!0;if(e.inlineContent)return!1}}return!0}function pv(){return new M({props:{decorations:vv,createSelectionBetween(e,t,n){return t.pos==n.pos&&cv.valid(n)?new cv(n):null},handleClick:gv,handleKeyDown:mv,handleDOMEvents:{beforeinput:_v}}})}var mv=Cc({ArrowLeft:hv(`horiz`,-1),ArrowRight:hv(`horiz`,1),ArrowUp:hv(`vert`,-1),ArrowDown:hv(`vert`,1)});function hv(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof A){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=cv.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new cv(c))),!0):!1}}function gv(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!cv.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&j.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new cv(r))),!0)}function _v(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof cv))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=C.empty;for(let e=r.length-1;e>=0;e--)i=C.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new T(i,0,0));return a.setSelection(A.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function vv(e){if(!(e.selection instanceof cv))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,B.create(e.doc,[Cs.widget(e.selection.head,t,{key:`gapcursor`})])}var yv=200,$=function(){};$.prototype.append=function(e){return e.length?(e=$.from(e),!this.length&&e||e.length=t?$.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},$.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},$.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},$.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},$.from=function(e){return e instanceof $?e:e&&e.length?new bv(e):$.empty};var bv=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=yv)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=yv)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}($);$.empty=new bv([]);var xv=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return ei&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}($),Sv=500,Cv=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new Tv(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new Tv(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;eDv&&(s=wv(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new Ft;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new Tv(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new Tv(i,o,l))}else r.push(new Tv(i))},i);let l=[];for(let e=n;eSv&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new Tv(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e($.from(i.reverse()),a)}};Cv.empty=new Cv($.empty,0);function wv(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var Tv=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},Ev=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},Dv=20;function Ov(e,t,n,r){let i=n.getMeta(Iv),a;if(i)return i.historyState;n.getMeta(Lv)&&(e=new Ev(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(Iv))return o.getMeta(Iv).redo?new Ev(e.done.addTransform(n,void 0,r,Fv(t)),e.undone,Av(n.mapping.maps),e.prevTime,e.prevComposition):new Ev(e.done,e.undone.addTransform(n,void 0,r,Fv(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!kv(n,e.prevRanges)),s=o?jv(e.prevRanges,n.mapping):Av(n.mapping.maps);return new Ev(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,Fv(t)),Cv.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new Ev(e.done.rebased(n,a),e.undone.rebased(n,a),jv(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new Ev(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),jv(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function kv(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i=t[i]&&(n=!0)}),n}function Av(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function jv(e,t){if(!e)return null;let n=[];for(let r=0;r{let i=Iv.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=Mv(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var Bv=zv(!1,!0),Vv=zv(!0,!0);q.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new M({key:new N(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var Hv=q.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[ov(this.options)]}});q.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new M({key:new N(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return B.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(Cs.node(t,t+e.nodeSize,{class:this.options.className}))}),B.create(e,a)}}})]}});var Uv=q.create({name:`gapCursor`,addProseMirrorPlugins(){return[pv()]},extendNodeSchema(e){return{allowGapCursor:G(W(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),Wv=`placeholder`,Gv=new N(`tiptap__placeholder`);function Kv(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),Cs.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function qv(e,t){return typeof e==`function`?e(t):e}function Jv({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&ku(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(Kv({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:qv(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function Yv({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&ku(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(Kv({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:qv(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...Jv({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return B.create(r,o)}function Xv(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function Zv(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function Qv(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;st&&r.push({from:a,to:o})}),r}function $v(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;et.from?n.push(Zv(e,Xv(e,Math.min(t.to,e.content.size+1)-1))):t.frome.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=Jv({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function iy({editor:e,options:t,dataAttribute:n}){return{init(r,i){return Yv({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??B.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:ry({decorations:i.map(r.mapping,r.doc),ranges:ty(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function ay(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function oy({editor:e,options:t}){let n=t.dataAttribute?`data-${ay(t.dataAttribute)}`:`data-${Wv}`,r=t.showOnlyCurrent&&!t.includeChildren;return new M({key:Gv,...r?{}:{state:iy({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>Yv({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?B.empty:Gv.getState(n)??B.empty}})}q.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:Wv,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[oy({editor:this.editor,options:this.options})]}});function sy(e,t){return!e.selection.empty&&!Au(e.selection)&&t.isEditable}function cy(e,t){return sy(e,t)&&!t.isFocused&&!t.view.dragging}function ly(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function uy(e){e.focus()}q.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new M({key:new N(`selection`),props:{decorations(n){return cy(n,e)?B.create(n.doc,[Cs.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return sy(t.state,e)&&ly(),!1},focus(t){return sy(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&uy(t)}),!1}}}})]}});function dy({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var fy=q.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new N(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new M({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!dy({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!dy({node:r,types:n})}}})]}}),py=q.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Bv(e,t),redo:()=>({state:e,dispatch:t})=>Vv(e,t)}},addProseMirrorPlugins(){return[Rv(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),my=q.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(sm.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(nm.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(Xg.configure(this.options.bulletList)),this.options.code!==!1&&e.push(um.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(mm.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(hm.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(Hv.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(Uv.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(gm.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(_m.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(py.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(vm.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Cm.configure(this.options.italic)),this.options.listItem!==!1&&e.push(y_.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(O_.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Gg.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(G_.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push($_.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(nv.configure(this.options.strike)),this.options.text!==!1&&e.push(rv.configure(this.options.text)),this.options.underline!==!1&&e.push(iv.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(fy.configure(this.options?.trailingNode)),e}}),hy=q.create({name:`textAlign`,addOptions(){return{types:[],alignments:[`left`,`center`,`right`,`justify`],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign(`left`),"Mod-Shift-e":()=>this.editor.commands.setTextAlign(`center`),"Mod-Shift-r":()=>this.editor.commands.setTextAlign(`right`),"Mod-Shift-j":()=>this.editor.commands.setTextAlign(`justify`)}}}),gy=20,_y=(e,t=0)=>{let n=[];return!e.children.length||t>gy||Array.from(e.children).forEach(e=>{e.tagName===`SPAN`?n.push(e):e.children.length&&n.push(..._y(e,t+1))}),n},vy=e=>{if(!e.children.length)return;let t=_y(e);t&&t.forEach(e=>{var t;let n=e.getAttribute(`style`),r=(t=e.parentElement)==null||(t=t.closest(`span`))==null?void 0:t.getAttribute(`style`);e.setAttribute(`style`,`${r};${n}`)})},yy=Zd.create({name:`textStyle`,priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:`span`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?(this.options.mergeNestedSpanStyles&&vy(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return[`span`,K(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(!t.isInline)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),by=q.create({name:`backgroundColor`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>(Id(e,`background-color`)??e.style.backgroundColor)?.replace(/['"]+/g,``),renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark(`textStyle`,{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark(`textStyle`,{backgroundColor:null}).removeEmptyTextStyle().run()}}}),xy=q.create({name:`color`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>(Id(e,`color`)??e.style.color)?.replace(/['"]+/g,``),renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark(`textStyle`,{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark(`textStyle`,{color:null}).removeEmptyTextStyle().run()}}}),Sy=q.create({name:`fontFamily`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>Id(e,`font-family`)??e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark(`textStyle`,{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark(`textStyle`,{fontFamily:null}).removeEmptyTextStyle().run()}}}),Cy=q.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>Id(e,`font-size`)??e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark(`textStyle`,{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}}),wy=q.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>Id(e,`line-height`)??e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark(`textStyle`,{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark(`textStyle`,{lineHeight:null}).removeEmptyTextStyle().run()}}});q.create({name:`textStyleKit`,addExtensions(){let e=[];return this.options.backgroundColor!==!1&&e.push(by.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(xy.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(Sy.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(Cy.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(wy.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(yy.configure(this.options.textStyle)),e}});var Ty=xy,Ey=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Dy=J.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,K(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?`![${n}](${t} "${r}")`:`![${n}](${t})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set([`src`,`width`,`height`]);return({node:a,getPos:o,HTMLAttributes:s,editor:c})=>{let l=document.createElement(`img`);l.draggable=!1;let u=K(this.options.HTMLAttributes,s);Object.entries(u).forEach(([e,t])=>{if(t!=null)switch(e){case`src`:case`width`:case`height`:break;default:l.setAttribute(e,t)}}),u.src!==null&&(l.src=u.src);let d={...s},f=e=>{if(typeof e==`string`&&e!==``){l.getAttribute(`src`)!==e&&(l.src=e);return}l.hasAttribute(`src`)&&l.removeAttribute(`src`),l.src!==``&&(l.src=``)};f(s.src);let p=new Df({element:l,editor:c,node:a,getPos:o,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==a.type)return!1;let t=eu(e,c.extensionManager.attributes.filter(t=>t.type===e.type.name));return Object.keys(d).forEach(e=>{!i.has(e)&&!(e in t)&&l.removeAttribute(e)}),Object.entries(t).forEach(([e,t])=>{i.has(e)||(t==null?l.removeAttribute(e):l.setAttribute(e,t))}),f(t.src),d=t,!0},options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),m=p.dom,h=()=>{m.style.visibility=``,m.style.pointerEvents=``};return m.style.visibility=`hidden`,m.style.pointerEvents=`none`,l.complete&&l.naturalWidth>0?h():(l.onload=h,l.onerror=h),p}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Cf({find:Ey,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});function Oy({content:e,onChange:t,placeholder:n}){let{t:r}=i(),a=zp({extensions:[my.configure({heading:!1,codeBlock:!1,code:!1}),av,Kg.configure({openOnClick:!1,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`}}),hy.configure({types:[`paragraph`]}),yy,Ty,Dy.configure({HTMLAttributes:{style:`max-width: 100%; height: auto;`}})],content:e,onUpdate:({editor:e})=>{t(e.getHTML())},editorProps:{attributes:{class:`prose prose-invert prose-sm max-w-none focus:outline-none min-h-[120px] px-3 py-2`,placeholder:n||``}}});if(!a)return null;let o=({onClick:e,isActive:t=!1,children:n,title:r})=>(0,x.jsx)(`button`,{type:`button`,onClick:e,title:r,className:`p-1.5 rounded hover:bg-bambu-dark-tertiary transition-colors ${t?`bg-bambu-dark-tertiary text-bambu-green`:`text-bambu-gray`}`,children:n});return(0,x.jsxs)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden bg-bambu-dark`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-0.5 p-1.5 border-b border-bambu-dark-tertiary bg-bambu-dark-secondary`,children:[(0,x.jsx)(o,{onClick:()=>a.chain().focus().toggleBold().run(),isActive:a.isActive(`bold`),title:r(`richTextEditor.bold`),children:(0,x.jsx)(f,{className:`w-4 h-4`})}),(0,x.jsx)(o,{onClick:()=>a.chain().focus().toggleItalic().run(),isActive:a.isActive(`italic`),title:r(`richTextEditor.italic`),children:(0,x.jsx)(p,{className:`w-4 h-4`})}),(0,x.jsx)(o,{onClick:()=>a.chain().focus().toggleUnderline().run(),isActive:a.isActive(`underline`),title:r(`richTextEditor.underline`),children:(0,x.jsx)(_,{className:`w-4 h-4`})}),(0,x.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary mx-1`}),(0,x.jsx)(o,{onClick:()=>a.chain().focus().toggleBulletList().run(),isActive:a.isActive(`bulletList`),title:r(`richTextEditor.bulletList`),children:(0,x.jsx)(s,{className:`w-4 h-4`})}),(0,x.jsx)(o,{onClick:()=>a.chain().focus().toggleOrderedList().run(),isActive:a.isActive(`orderedList`),title:r(`richTextEditor.numberedList`),children:(0,x.jsx)(l,{className:`w-4 h-4`})}),(0,x.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary mx-1`}),(0,x.jsx)(o,{onClick:()=>a.chain().focus().setTextAlign(`left`).run(),isActive:a.isActive({textAlign:`left`}),title:r(`richTextEditor.alignLeft`),children:(0,x.jsx)(g,{className:`w-4 h-4`})}),(0,x.jsx)(o,{onClick:()=>a.chain().focus().setTextAlign(`center`).run(),isActive:a.isActive({textAlign:`center`}),title:r(`richTextEditor.alignCenter`),children:(0,x.jsx)(m,{className:`w-4 h-4`})}),(0,x.jsx)(o,{onClick:()=>a.chain().focus().setTextAlign(`right`).run(),isActive:a.isActive({textAlign:`right`}),title:r(`richTextEditor.alignRight`),children:(0,x.jsx)(h,{className:`w-4 h-4`})}),(0,x.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary mx-1`}),(0,x.jsx)(o,{onClick:()=>{let e=window.prompt(`Enter URL:`);e&&a.chain().focus().setLink({href:e}).run()},isActive:a.isActive(`link`),title:r(`richTextEditor.addLink`),children:(0,x.jsx)(u,{className:`w-4 h-4`})}),a.isActive(`link`)&&(0,x.jsx)(o,{onClick:()=>a.chain().focus().unsetLink().run(),title:r(`richTextEditor.removeLink`),children:(0,x.jsx)(c,{className:`w-4 h-4`})})]}),(0,x.jsx)(Mp,{editor:a})]})}export{Oy as t}; \ No newline at end of file diff --git a/static/assets/SettingsPage-TND5EBtx.js b/static/assets/SettingsPage-TND5EBtx.js new file mode 100644 index 000000000..31babbfd2 --- /dev/null +++ b/static/assets/SettingsPage-TND5EBtx.js @@ -0,0 +1,7 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,b as i,f as a,l as o,t as s,v as c,w as l}from"./client-DnySrlFv.js";import{n as u}from"./QueryClientProvider-Ce8_sN3w.js";import{t as d}from"./useQuery-BBCjCezC.js";import{t as f}from"./useMutation-B-Tr2hIP.js";import{t as p}from"./useQueries-Be6PMvSC.js";import{t as m}from"./createLucideIcon-DvBYJlWL.js";import{a as h,i as g,l as _,n as v,o as y,r as b,t as x,u as S}from"./haSensorDisplay-lPbcOxD8.js";import{t as C}from"./briefcase-Dau7xqMY.js";import{t as w}from"./calendar-BLKPnWqV.js";import{t as T}from"./check-Ck0cMLU4.js";import{a as E,i as D,n as O,r as k,t as A}from"./info-ROUoQhJR.js";import{n as ee,r as j}from"./ToastContext-BRX0SW3C.js";import{t as M}from"./cog-Dol1I0kq.js";import{t as N}from"./copy-Cu_0GKCU.js";import{t as P}from"./cpu-BKWEtc8k.js";import{t as te}from"./dollar-sign-Cj_Yhud4.js";import{t as F}from"./eye-off-6CkaxYwP.js";import{t as ne}from"./gauge-D21zgWMb.js";import{t as I}from"./grip-vertical-C_1RDxRw.js";import{t as re}from"./hard-drive-CgXAHN37.js";import{t as ie}from"./history-B4lOLL01.js";import{t as L}from"./layout-grid-DkD3u6wa.js";import{t as ae}from"./link-2-MI-QCMh8.js";import{t as R}from"./loader-circle-BEmFtawu.js";import{t as z}from"./lock-MLqgWH4Q.js";import{_ as oe,a as se,c as B,d as ce,f as le,g as ue,h as de,i as fe,l as V,m as pe,n as me,o as he,p as ge,r as _e,s as ve,t as ye,u as be,v as H}from"./locationSensorDefaults-zb4rpqFF.js";import{c as xe,l as Se,o as Ce,t as we,u as Te}from"./CopyButton-C5In5weo.js";import{t as Ee}from"./package-BGUevlqS.js";import{t as De}from"./play-DIDYtk2S.js";import{t as Oe}from"./qr-code-CCCo2-Br.js";import{t as ke}from"./scale-CD6XdXUk.js";import{t as Ae}from"./search-0n0CBc74.js";import{t as je}from"./settings-2-Cvn837lh.js";import{t as Me}from"./shield-bODVqOJd.js";import{t as Ne}from"./skip-forward-BsuMfFkw.js";import{t as Pe}from"./smartphone-DaDGaGLT.js";import{n as Fe}from"./wind-CI8UoBMf.js";import{t as Ie}from"./triangle-alert-Dt_1FcBy.js";import{t as Le}from"./workflow-BgT0wW83.js";import{t as Re}from"./x-DR-Trv6U.js";import{i as U,n as W,r as ze,t as G}from"./Card-Bzc64K35.js";import{t as K}from"./Button-DDr6eAFy.js";import{a as Be,f as Ve,i as He,u as Ue,v as We}from"./date-G9KUauqz.js";import{t as Ge}from"./filamentSwatchHelpers-D3oXQSGk.js";import{$t as Ke,An as q,At as qe,Cn as Je,Ct as Ye,Dn as Xe,Dt as Ze,En as Qe,Et as $e,Ft as et,Gn as tt,Gt as nt,In as rt,Jt as it,Kt as at,Ln as ot,Mn as st,N as ct,On as lt,Pn as ut,Qt as dt,Rn as ft,S as pt,Sn as mt,St as ht,Tn as gt,Ut as _t,Vn as vt,Vt as yt,Wn as bt,Wt as xt,Xt as St,Yt as Ct,Zt as wt,_t as Tt,at as Et,bn as Dt,bt as Ot,c as kt,cn as At,d as jt,dn as Mt,en as Nt,f as Pt,fn as Ft,gn as It,gt as Lt,h as Rt,hn as zt,ht as Bt,in as Vt,it as Ht,kn as Ut,kt as Wt,l as Gt,ln as Kt,m as qt,nn as Jt,nt as Yt,o as Xt,on as Zt,p as Qt,pn as $t,qt as en,rn as tn,rt as nn,u as rn,vt as an,w as on,wn as sn,x as cn,xn as ln,yt as un}from"./index-CovRLYqQ.js";import{t as J}from"./Toggle-KiqA_5fU.js";import{a as dn,i as fn,n as pn,r as mn,s as hn,t as gn}from"./OverlayFrame-fLmufrTC.js";var _n=m(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),vn=m(`camera-off`,[[`path`,{d:`M14.564 14.558a3 3 0 1 1-4.122-4.121`,key:`1rnrzw`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M20 20H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 .819-.175`,key:`1x3arw`}],[`path`,{d:`M9.695 4.024A2 2 0 0 1 10.004 4h3.993a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v7.344`,key:`1i84u0`}]]),yn=m(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),bn=m(`cylinder`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5v14a9 3 0 0 0 18 0V5`,key:`aqi0yr`}]]),xn=m(`folder-archive`,[[`circle`,{cx:`15`,cy:`19`,r:`2`,key:`u2pros`}],[`path`,{d:`M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1`,key:`1jj40k`}],[`path`,{d:`M15 11v-1`,key:`cntcp`}],[`path`,{d:`M15 17v-2`,key:`1279jj`}]]),Sn=m(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Cn=m(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),wn=m(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Tn=m(`tags`,[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]);function En(e){return e.length<8?`tooShort`:/[A-Z]/.test(e)?/[a-z]/.test(e)?/\d/.test(e)?/[^A-Za-z0-9]/.test(e)?null:`needsSpecial`:`needsDigit`:`needsLowercase`:`needsUppercase`}var Dn={PLA:0,PETG:0,"PETG-CF":40,ABS:45,ASA:45,PA:50,"PA-CF":55,PC:50,"PC-FR":50,TPU:0,PVA:0,default:0},On=[`PA-CF`,`PA`,`PC`,`PC-FR`,`ABS`,`ASA`,`PETG-CF`,`PETG`,`PLA`,`TPU`,`PVA`,`default`];function kn(e){if(!e)return{...Dn};try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let[n,r]of Object.entries(t)){let t=typeof r==`number`?r:Number(r);Number.isFinite(t)&&(e[n]=Math.max(0,Math.min(65,Math.round(t))))}return e.default===void 0&&(e.default=Dn.default),e}}catch{}return{...Dn}}function An(e){let t={};for(let n of On)e[n]!==void 0&&(t[n]=e[n]);for(let[n,r]of Object.entries(e))n in t||(t[n]=r);return JSON.stringify(t)}var Y=t();function jn({value:e,onChange:t,disabled:n=!1}){let{t:r}=l(),i=kn(e),a=(e,n)=>{let r=Math.max(0,Math.min(65,Math.round(n)));t(An({...i,[e]:r}))};return(0,Y.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-3 gap-y-1.5`,children:On.map(e=>{let t=i[e]??Dn[e]??0,o=e==="default"?r(`settings.preheatFilamentTargetsDefaultRow`,`Other / unmapped`):e;return(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs ${e==="default"?`text-bambu-gray italic`:`text-bambu-gray`}`,children:o}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`input`,{type:`number`,min:0,max:65,step:1,value:t,onChange:t=>a(e,parseInt(t.target.value,10)||0),disabled:n,className:`w-16 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-xs text-right focus:outline-none focus:border-bambu-green disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`°C`})]})]},e)})})}var X=e(n(),1);function Mn(e,t,n){if(!e)return null;let r=(e[n.source]?.[t]??[]).find(e=>e.id===n.id);return r?r.name:null}var Nn={orca_cloud:`Orca Cloud`,cloud:`Bambu Cloud`,local:`Imported`,standard:`Standard`};function Pn(){let{t:e}=l(),t=u(),{showToast:n}=ee(),{data:i,isLoading:a,error:o}=d({queryKey:[`slicer-pipelines`],queryFn:()=>r.listSlicerPipelines()}),{data:s}=d({queryKey:[`slicer-presets`],queryFn:()=>r.getSlicerPresets()}),{data:c}=d({queryKey:[`printers`],queryFn:()=>r.getPrinters()}),p=f({mutationFn:({id:e,name:t,description:n,target_printer_id:i,target_kind:a,target_model_class:o,fanout_strategy:s})=>r.updateSlicerPipeline(e,{name:t,description:n,target_printer_id:i,target_kind:a,target_model_class:o,fanout_strategy:s}),onSuccess:()=>{t.invalidateQueries({queryKey:[`slicer-pipelines`]}),n(e(`settings.pipelines.toast.saved`,`Pipeline saved`),`success`)},onError:t=>{n(t.message||e(`settings.pipelines.toast.saveFailed`,`Save failed`),`error`)}}),m=f({mutationFn:e=>r.deleteSlicerPipeline(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`slicer-pipelines`]}),n(e(`settings.pipelines.toast.deleted`,`Pipeline deleted`),`success`)},onError:t=>{n(t.message||e(`settings.pipelines.toast.deleteFailed`,`Delete failed`),`error`)}}),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(``),y=(0,X.useMemo)(()=>i?.pipelines??[],[i?.pipelines]),b=(0,X.useMemo)(()=>{let e=new Set,t=new Set,n=!1;for(let r of y)r.target_kind===`printer_class`&&r.target_model_class?t.add(r.target_model_class):r.target_printer_id?e.add(r.target_printer_id):n=!0;return{printers:(c??[]).filter(t=>e.has(t.id)),classes:Array.from(t).sort(),anyWithoutTarget:n}},[y,c]),x=(0,X.useMemo)(()=>{let e=h.trim().toLowerCase();return y.filter(t=>{if(e&&!t.name.toLowerCase().includes(e))return!1;if(_===`none`){if(t.target_kind===`printer_class`?t.target_model_class:t.target_printer_id!==null)return!1}else if(_.startsWith(`p:`)){let e=parseInt(_.slice(2),10);if(t.target_kind===`printer_class`||t.target_printer_id!==e)return!1}else if(_.startsWith(`c:`)){let e=_.slice(2);if(t.target_kind!==`printer_class`||t.target_model_class!==e)return!1}return!0})},[y,h,_]);return(0,Y.jsxs)(G,{children:[(0,Y.jsxs)(U,{children:[(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Le,{className:`w-4 h-4 text-bambu-green`}),e(`settings.pipelines.title`,`Slicer Pipelines`)]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`settings.pipelines.subtitle`,`Reusable preset bundles (printer + process + filaments + bed type). Save one from the Slice dialog and apply it with a single click on the next file.`)})]}),(0,Y.jsxs)(W,{children:[a&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),e(`settings.pipelines.loading`,`Loading pipelines…`)]}),o&&(0,Y.jsx)(`div`,{className:`text-sm text-red-700 dark:text-red-400`,children:e(`settings.pipelines.loadError`,`Could not load pipelines.`)}),!a&&!o&&y.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-3`,children:[(0,Y.jsxs)(`div`,{className:`relative flex-1 min-w-[12rem]`,children:[(0,Y.jsx)(Ae,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-bambu-gray pointer-events-none`}),(0,Y.jsx)(`input`,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:e(`settings.pipelines.searchPlaceholder`,`Search pipelines…`),"aria-label":e(`settings.pipelines.searchPlaceholder`,`Search pipelines…`),className:`w-full pl-7 pr-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`})]}),(0,Y.jsxs)(`select`,{value:_,onChange:e=>v(e.target.value),"aria-label":e(`settings.pipelines.filterTarget`,`Filter by target`),className:`text-xs px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`,children:[(0,Y.jsx)(`option`,{value:``,children:e(`settings.pipelines.filter.all`,`All targets`)}),b.printers.length>0&&(0,Y.jsx)(`optgroup`,{label:e(`settings.pipelines.field.targetKindSpecific`,`Specific printer`),children:b.printers.map(e=>(0,Y.jsx)(`option`,{value:`p:${e.id}`,children:e.name},`p-${e.id}`))}),b.classes.length>0&&(0,Y.jsx)(`optgroup`,{label:e(`settings.pipelines.field.targetKindClass`,`Printer class`),children:b.classes.map(t=>(0,Y.jsx)(`option`,{value:`c:${t}`,children:e(`library.runWithPipeline.classTarget`,`Any {{model}}`,{model:t})},`c-${t}`))}),b.anyWithoutTarget&&(0,Y.jsx)(`option`,{value:`none`,children:e(`settings.pipelines.filter.noTarget`,`No target set`)})]}),(h||_)&&(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e(`settings.pipelines.filter.count`,`{{shown}} / {{total}}`,{shown:x.length,total:y.length})})]}),!a&&!o&&y.length===0&&(0,Y.jsxs)(`div`,{className:`text-sm text-bambu-gray space-y-2`,children:[(0,Y.jsx)(`p`,{children:e(`settings.pipelines.empty.title`,`No pipelines yet.`)}),(0,Y.jsx)(`p`,{children:e(`settings.pipelines.empty.howto`,`Open the Slice dialog for any file, pick your printer / process / filaments / bed type, then click "Save as pipeline". Your saved pipelines will appear here.`)})]}),!a&&!o&&y.length>0&&x.length===0&&(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`settings.pipelines.filter.noMatches`,`No pipelines match the current filters.`)}),!a&&!o&&x.length>0&&(0,Y.jsx)(`div`,{className:`space-y-2`,children:x.map(t=>(0,Y.jsx)(Fn,{pipeline:t,presets:s,printers:c??[],onSave:e=>p.mutate({id:t.id,...e}),onDelete:()=>{confirm(e(`settings.pipelines.confirmDelete`,`Delete this pipeline? This cannot be undone.`))&&m.mutate(t.id)},saving:p.isPending,deleting:m.isPending},t.id))})]})]})}function Fn({pipeline:e,presets:t,printers:n,onSave:i,onDelete:a,saving:o,deleting:s}){let{t:c}=l(),[u,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(e.name),[h,g]=(0,X.useState)(e.description??``),[_,v]=(0,X.useState)(e.target_printer_id),[y,b]=(0,X.useState)(e.target_kind===`printer_class`?`printer_class`:`specific_printer`),[x,S]=(0,X.useState)(e.target_model_class??``),[C,w]=(0,X.useState)(e.fanout_strategy??`max_parallel`),E=Array.from(new Set(n.map(e=>e.model).filter(e=>!!e))).sort(),{data:D}=d({queryKey:[`pipeline-runs`,e.id],queryFn:()=>r.listPipelineRuns(e.id,1),enabled:!u,refetchInterval:15e3}),O=D?.runs?.[0],k=Mn(t,`printer`,e.printer_preset),A=Mn(t,`process`,e.process_preset),ee=e.filament_presets.map(e=>Mn(t,`filament`,e)),j=e.filament_presets.length>1&&e.filament_presets.every(t=>t.source===e.filament_presets[0].source&&t.id===e.filament_presets[0].id),M=t!==void 0&&(k===null||A===null||ee.some(e=>e===null)),N=e.target_printer_id?n.find(t=>t.id===e.target_printer_id):void 0,P=e.target_kind===`printer_class`,te=P?!e.target_model_class:e.target_printer_id===null;return(0,Y.jsxs)(`div`,{className:`rounded-md border border-bambu-dark-tertiary bg-bambu-dark/40 px-3 py-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:u?(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),"aria-label":c(`settings.pipelines.field.name`,`Pipeline name`),placeholder:c(`settings.pipelines.field.name`,`Pipeline name`),className:`w-full px-2 py-1 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`}),(0,Y.jsx)(`textarea`,{value:h,onChange:e=>g(e.target.value),"aria-label":c(`settings.pipelines.field.description`,`Description`),placeholder:c(`settings.pipelines.field.description`,`Description`),rows:2,className:`w-full px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs text-bambu-gray block mb-1`,children:c(`settings.pipelines.field.targetKind`,`Target type`)}),(0,Y.jsxs)(`div`,{className:`flex gap-3 text-xs`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-1 text-white`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`target-kind-${e.id}`,value:`specific_printer`,checked:y===`specific_printer`,onChange:()=>b(`specific_printer`),"aria-label":c(`settings.pipelines.field.targetKindSpecific`,`Specific printer`)}),c(`settings.pipelines.field.targetKindSpecific`,`Specific printer`)]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-1 text-white`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`target-kind-${e.id}`,value:`printer_class`,checked:y===`printer_class`,onChange:()=>b(`printer_class`),"aria-label":c(`settings.pipelines.field.targetKindClass`,`Printer class`)}),c(`settings.pipelines.field.targetKindClass`,`Printer class`)]})]})]}),y===`specific_printer`?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs text-bambu-gray block mb-1`,children:c(`settings.pipelines.field.targetPrinter`,`Target printer`)}),(0,Y.jsxs)(`select`,{value:_??``,onChange:e=>v(e.target.value?parseInt(e.target.value,10):null),"aria-label":c(`settings.pipelines.field.targetPrinter`,`Target printer`),className:`w-full px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`,children:[(0,Y.jsx)(`option`,{value:``,children:c(`settings.pipelines.field.noTarget`,`— No target —`)}),n.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}):(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs text-bambu-gray block mb-1`,children:c(`settings.pipelines.field.targetModelClass`,`Printer model`)}),(0,Y.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value),"aria-label":c(`settings.pipelines.field.targetModelClass`,`Printer model`),className:`w-full px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`,children:[(0,Y.jsx)(`option`,{value:``,children:c(`settings.pipelines.field.noTarget`,`— No target —`)}),E.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-xs text-bambu-gray block mb-1`,children:c(`settings.pipelines.field.fanoutStrategy`,`Fanout strategy`)}),(0,Y.jsxs)(`select`,{value:C,onChange:e=>w(e.target.value),"aria-label":c(`settings.pipelines.field.fanoutStrategy`,`Fanout strategy`),className:`w-full px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`,children:[(0,Y.jsx)(`option`,{value:`max_parallel`,children:c(`settings.pipelines.field.fanout.max_parallel`,`Max parallel — distribute across any idle matching printer`)}),(0,Y.jsx)(`option`,{value:`round_robin`,children:c(`settings.pipelines.field.fanout.round_robin`,`Round robin — cycle through eligible printers`)}),(0,Y.jsx)(`option`,{value:`fill_one_first`,children:c(`settings.pipelines.field.fanout.fill_one_first`,`Fill one first — pin all copies to one printer`)})]})]})]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium text-white truncate`,children:e.name}),(0,Y.jsxs)(`span`,{className:`text-xs px-1.5 py-0.5 rounded inline-flex items-center gap-1 ${te?`bg-amber-100 dark:bg-amber-500/15 text-amber-700 dark:text-amber-400`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:[(0,Y.jsx)(it,{className:`w-3 h-3`}),te?c(`settings.pipelines.noTargetHint`,`Set a target printer to run this`):P?(0,Y.jsxs)(Y.Fragment,{children:[c(`library.runWithPipeline.classTarget`,`Any {{model}}`,{model:e.target_model_class}),e.fanout_strategy&&(0,Y.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[` · `,c(`settings.pipelines.field.fanoutShort.${e.fanout_strategy}`,e.fanout_strategy)]})]}):N?.name??``]})]}),e.description&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:e.description})]})}),(0,Y.jsx)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:u?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{onClick:()=>{let e=p.trim();e&&(i({name:e,description:h.trim()||null,target_kind:y,target_printer_id:y===`specific_printer`?_??0:0,target_model_class:y===`printer_class`&&x||null,fanout_strategy:C}),f(!1))},disabled:o||!p.trim(),"aria-label":c(`settings.pipelines.action.save`,`Save`),className:`p-1.5 text-bambu-green hover:bg-bambu-dark-tertiary rounded disabled:opacity-50`,children:(0,Y.jsx)(T,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>{m(e.name),g(e.description??``),v(e.target_printer_id),b(e.target_kind===`printer_class`?`printer_class`:`specific_printer`),S(e.target_model_class??``),w(e.fanout_strategy??`max_parallel`),f(!1)},"aria-label":c(`settings.pipelines.action.cancel`,`Cancel`),className:`p-1.5 text-bambu-gray hover:bg-bambu-dark-tertiary rounded`,children:(0,Y.jsx)(Re,{className:`w-4 h-4`})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{onClick:()=>f(!0),"aria-label":c(`settings.pipelines.action.rename`,`Rename`),className:`p-1.5 text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary rounded`,children:(0,Y.jsx)(oe,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:a,disabled:s,"aria-label":c(`settings.pipelines.action.delete`,`Delete`),className:`p-1.5 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50`,children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]})})]}),!u&&(0,Y.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 md:grid-cols-2 gap-x-4 gap-y-2 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-bambu-gray/60`,children:c(`settings.pipelines.group.profiles`,`Profiles`)}),(0,Y.jsx)(Ln,{label:c(`settings.pipelines.slot.printer`,`Printer`),ref:e.printer_preset,name:k}),(0,Y.jsx)(Ln,{label:c(`settings.pipelines.slot.process`,`Process`),ref:e.process_preset,name:A}),e.bed_type&&(0,Y.jsxs)(`div`,{className:`text-bambu-gray`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-bambu-gray/80`,children:[c(`settings.pipelines.slot.bed`,`Bed`),`:`]}),` `,(0,Y.jsx)(`span`,{className:`text-white`,children:e.bed_type})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Y.jsxs)(`div`,{className:`text-[10px] uppercase tracking-wide text-bambu-gray/60`,children:[c(`settings.pipelines.group.filaments`,`Filaments`),e.filament_presets.length>1&&(0,Y.jsxs)(`span`,{className:`text-bambu-gray/60 normal-case ml-1`,children:[`(`,e.filament_presets.length,`)`]})]}),j?(0,Y.jsx)(Ln,{label:c(`settings.pipelines.slot.filamentAll`,`All {{n}} slots`,{n:e.filament_presets.length}),ref:e.filament_presets[0],name:ee[0]}):e.filament_presets.map((t,n)=>(0,Y.jsx)(Ln,{label:e.filament_presets.length>1?c(`settings.pipelines.slot.filamentN`,`Filament {{n}}`,{n:n+1}):c(`settings.pipelines.slot.filament`,`Filament`),ref:t,name:ee[n]},n))]})]}),!u&&O&&(0,Y.jsxs)(`div`,{className:`mt-1.5 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-bambu-gray/80`,children:[c(`settings.pipelines.runs.lastRun`,`Last run`),`:`]}),` `,(0,Y.jsx)(In,{status:O.status}),O.created_at&&(0,Y.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[`· `,new Date(O.created_at).toLocaleString()]})]}),te&&!u&&(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-xs text-amber-700 dark:text-amber-400`,children:[(0,Y.jsx)(Ie,{className:`w-3.5 h-3.5`}),c(`settings.pipelines.noTargetWarning`,`Set a target printer before running this pipeline.`)]}),M&&!u&&(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-xs text-amber-700 dark:text-amber-400`,children:[(0,Y.jsx)(Ie,{className:`w-3.5 h-3.5`}),c(`settings.pipelines.staleWarning`,`One or more referenced presets no longer exist. Re-save this pipeline from the Slice dialog to fix.`)]})]})}function In({status:e}){let{t}=l();return(0,Y.jsx)(`span`,{className:{queued:`text-bambu-gray`,slicing:`text-blue-700 dark:text-blue-400`,dispatching:`text-blue-700 dark:text-blue-400`,in_progress:`text-bambu-green`,completed:`text-bambu-green`,failed:`text-red-700 dark:text-red-400`,partial_failure:`text-amber-700 dark:text-amber-400`,cancelled:`text-bambu-gray`}[e],children:t(`settings.pipelines.runs.status.${e}`,e)})}function Ln({label:e,ref:t,name:n}){return(0,Y.jsxs)(`div`,{className:`text-bambu-gray truncate`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-bambu-gray/80`,children:[e,`:`]}),` `,n?(0,Y.jsx)(`span`,{className:`text-white`,children:n}):(0,Y.jsxs)(`span`,{className:`text-amber-700 dark:text-amber-400`,children:[`[`,Nn[t.source],` #`,t.id,`]`]})]})}var Rn=90,zn=365;function Bn(e){if(!e)return`—`;let t=We(e);return t?t.toLocaleString():`—`}function Vn(e){let t=We(e);return t?t.getTime(){if(l.preventDefault(),!(!o.trim()||p)){m(!0),n?.(!0);try{e(await r.createLongLivedCameraToken({name:o.trim(),expires_in_days:c,scope:t??d})),s(``),u(Rn),f(t??`camera_stream`),a(i(`cameraTokens.toast.created`,`Token created`))}catch(e){a(e instanceof Error&&e.message?e.message:i(`cameraTokens.toast.createFailed`,`Failed to create token`),`error`)}finally{m(!1),n?.(!1)}}},className:`@container/token-form min-w-0 bg-bambu-dark-secondary rounded-lg p-4 mb-6 border border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-semibold text-white mb-3`,children:i(`cameraTokens.create.title`,`Create new token`)}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 @min-[26rem]/token-form:grid-cols-2 @min-[44rem]/token-form:grid-cols-[minmax(0,1fr)_180px_140px_auto]`,children:[(0,Y.jsx)(`input`,{type:`text`,maxLength:100,required:!0,value:o,onChange:e=>s(e.target.value),placeholder:i(`cameraTokens.create.namePlaceholder`,`e.g. Home Assistant`),className:`min-w-0 w-full px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none`,"aria-label":i(`cameraTokens.create.nameLabel`,`Token name`)}),(0,Y.jsxs)(`select`,{value:d,disabled:!!t,onChange:e=>f(e.target.value),className:`min-w-0 w-full px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none`,"aria-label":i(`cameraTokens.create.scopeLabel`,`Scope`),children:[(0,Y.jsx)(`option`,{value:`camera_stream`,children:i(`cameraTokens.scope.camera_stream`,`Camera stream`)}),(0,Y.jsx)(`option`,{value:`camwall`,children:i(`cameraTokens.scope.camwall`,`Cam Wall`)}),(0,Y.jsx)(`option`,{value:`overlay`,children:i(`cameraTokens.scope.overlay`,`Streaming Overlay`)})]}),(0,Y.jsx)(`input`,{type:`number`,min:1,max:zn,required:!0,value:c,onChange:e=>{let t=Number(e.target.value);u(Math.min(Math.max(t,1),zn))},className:`min-w-0 w-full px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none`,"aria-label":i(`cameraTokens.create.daysLabel`,`Days until expiry`)}),(0,Y.jsxs)(`button`,{type:`submit`,disabled:p||!o.trim(),className:`min-w-0 flex items-center justify-center gap-2 px-4 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green/90 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),i(`cameraTokens.create.submit`,`Create`)]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:d===`camwall`?i(`cameraTokens.create.hintCamWall`,`A Cam Wall token opens /camwall on a screen with no login — it can see every printer's name and state, and their camera streams. It cannot see filenames, addresses or access codes.`):d===`overlay`?i(`cameraTokens.create.hintOverlay`,`A Streaming Overlay token opens /overlay/{printerId} on a screen with no login — for OBS or any live stream. It can see one printer's camera stream plus its live print status, including the filename shown on screen. It cannot see addresses or access codes.`):i(`cameraTokens.create.hintCameraStream`,`A camera-stream token can only fetch camera streams and snapshots. Use it for Home Assistant, Frigate, or anything embedding a single camera.`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`cameraTokens.create.hint`,`Maximum lifetime is 365 days. The token value is shown only once on creation — copy it now.`)})]})}function Un({token:e,onConfirm:t,onCancel:n}){let{t:r}=l();return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4`,role:`dialog`,"aria-modal":`true`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-6 max-w-md w-full border border-red-500/40`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,Y.jsx)(Ie,{className:`w-6 h-6 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:r(`cameraTokens.confirmRevoke.title`,`Revoke this token?`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:r(`cameraTokens.confirmRevoke.body`,`Any device using "{{name}}" will lose access immediately. This cannot be undone.`,{name:e.name})})]})]}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`px-4 py-2 bg-bambu-dark-tertiary text-white rounded-md hover:bg-bambu-dark-tertiary/80`,children:r(`cameraTokens.confirmRevoke.cancel`,`Cancel`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-600`,children:r(`cameraTokens.confirmRevoke.confirm`,`Revoke`)})]})]})})}function Wn({token:e,onClose:t}){let{t:n}=l(),{showToast:r}=ee(),i=e.token??``,a=e.scope===`camwall`&&i?`${window.location.origin}/camwall?token=${encodeURIComponent(i)}`:null,o=e.scope===`overlay`&&i?`${window.location.origin}/overlay/1?token=${encodeURIComponent(i)}`:null,s=async e=>{if(e)try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t);try{t.select(),document.execCommand(`copy`)}finally{document.body.removeChild(t)}}r(n(`cameraTokens.toast.copied`,`Copied to clipboard`))}catch{r(n(`cameraTokens.toast.copyFailed`,`Copy failed — select and copy manually`),`error`)}};return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-6 max-w-2xl w-full border border-bambu-green/40`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,Y.jsx)(Ie,{className:`w-6 h-6 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(`cameraTokens.created.title`,`Token created — copy it now`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:n(`cameraTokens.created.warning`,`This is the only time this token will be visible. After you close this dialog you can never view it again.`)})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,Y.jsx)(`code`,{className:`flex-1 px-3 py-2 bg-bambu-dark rounded-md text-bambu-green text-xs break-all font-mono select-all`,children:i}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>s(i),className:`flex items-center gap-2 px-3 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green/90`,children:[(0,Y.jsx)(N,{className:`w-4 h-4`}),n(`cameraTokens.created.copy`,`Copy`)]})]}),a&&(0,Y.jsxs)(`div`,{className:`mb-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-white mb-1`,children:n(`cameraTokens.created.camWallUrlTitle`,`Cam Wall URL for this display`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:n(`cameraTokens.created.camWallUrlHint`,`Open this on the screen. Anyone who can read the URL can watch the wall, so treat it like a key — revoke the token to cut the display off.`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`code`,{className:`flex-1 px-3 py-2 bg-bambu-dark rounded-md text-bambu-green text-xs break-all font-mono select-all`,children:a}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>s(a),className:`flex items-center gap-2 px-3 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green/90`,children:[(0,Y.jsx)(N,{className:`w-4 h-4`}),n(`cameraTokens.created.copy`,`Copy`)]})]})]}),o&&(0,Y.jsxs)(`div`,{className:`mb-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-white mb-1`,children:n(`cameraTokens.created.overlayUrlTitle`,`Overlay URL for OBS`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:n(`cameraTokens.created.overlayUrlHint`,`Add this as a Browser Source in OBS. Change the /overlay/1 number to your printer's number (from its URL on the Printers page). Anyone who can read the URL can watch the stream, so treat it like a key — revoke the token to cut it off.`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`code`,{className:`flex-1 px-3 py-2 bg-bambu-dark rounded-md text-bambu-green text-xs break-all font-mono select-all`,children:o}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>s(o),className:`flex items-center gap-2 px-3 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green/90`,children:[(0,Y.jsx)(N,{className:`w-4 h-4`}),n(`cameraTokens.created.copy`,`Copy`)]})]})]}),(0,Y.jsx)(`div`,{className:`flex justify-end`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-2 bg-bambu-dark-tertiary text-white rounded-md hover:bg-bambu-dark-tertiary/80`,children:n(`cameraTokens.created.dismiss`,`I've saved it`)})})]})})}function Gn({token:e,showOwner:t,ownerLabel:n,onRevoke:r}){let{t:i}=l(),a=Vn(e.expires_at);return(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary last:border-b-0`,children:[(0,Y.jsx)(`td`,{className:`py-3 px-3 text-white break-words max-w-64`,children:e.name}),t&&(0,Y.jsx)(`td`,{className:`py-3 px-3 text-bambu-gray`,children:n}),(0,Y.jsx)(`td`,{className:`py-3 px-3`,children:(0,Y.jsx)(`span`,{className:`rounded bg-bambu-dark-tertiary px-2 py-0.5 text-xs text-bambu-gray`,children:i(`cameraTokens.scope.${e.scope}`,e.scope)})}),(0,Y.jsxs)(`td`,{className:`py-3 px-3 text-bambu-gray font-mono text-xs`,children:[e.lookup_prefix,`…`]}),(0,Y.jsx)(`td`,{className:`py-3 px-3 text-bambu-gray`,children:Bn(e.created_at)}),(0,Y.jsxs)(`td`,{className:`py-3 px-3 ${a?`text-red-700 dark:text-red-400`:`text-bambu-gray`}`,children:[Bn(e.expires_at),a&&(0,Y.jsx)(`span`,{className:`ml-2 px-2 py-0.5 text-xs bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-300 rounded`,children:i(`cameraTokens.list.expired`,`Expired`)})]}),(0,Y.jsx)(`td`,{className:`py-3 px-3 text-bambu-gray`,children:Bn(e.last_used_at)}),(0,Y.jsx)(`td`,{className:`py-3 px-3 text-right`,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`inline-flex items-center gap-1 px-2 py-1 text-sm text-red-700 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300`,title:i(`cameraTokens.list.revoke`,`Revoke`),children:[(0,Y.jsx)(qe,{className:`w-4 h-4`}),i(`cameraTokens.list.revoke`,`Revoke`)]})})]})}function Kn({tokens:e,showOwner:t,userIdToName:n,onRevoke:r,emptyMessage:i}){let{t:a}=l();return e.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray italic`,children:i}):(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{className:`text-bambu-gray text-left border-b border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:a(`cameraTokens.list.name`,`Name`)}),t&&(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:a(`cameraTokens.list.owner`,`Owner`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:a(`cameraTokens.list.scope`,`Scope`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:a(`cameraTokens.list.prefix`,`Prefix`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:a(`cameraTokens.list.created`,`Created`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:a(`cameraTokens.list.expires`,`Expires`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:a(`cameraTokens.list.lastUsed`,`Last used`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3`})]})}),(0,Y.jsx)(`tbody`,{children:e.map(e=>(0,Y.jsx)(Gn,{token:e,showOwner:t,ownerLabel:n?.get(e.user_id)??`#${e.user_id}`,onRevoke:r},e.id))})]})})}function qn(){let{t:e}=l(),{user:t,isAdmin:n}=un(),{showToast:i}=ee(),[a,o]=(0,X.useState)([]),[s,c]=(0,X.useState)([]),[u,d]=(0,X.useState)(new Map),[f,p]=(0,X.useState)(!0),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(null),v=async()=>{p(!0);try{if(o(await r.listMyLongLivedCameraTokens()),n){c(await r.listAllLongLivedCameraTokens());try{let e=await r.getUsersSlim();d(new Map(e.map(e=>[e.id,e.username])))}catch{d(new Map)}}}catch(t){i(t instanceof Error?t.message:e(`cameraTokens.toast.loadFailed`,`Failed to load tokens`),`error`)}finally{p(!1)}};(0,X.useEffect)(()=>{v()},[n]);let y=async e=>{let t=[...a,...s].find(t=>t.id===e);t&&_(t)},b=async()=>{if(!g)return;let t=g.id;_(null);try{await r.revokeLongLivedCameraToken(t),i(e(`cameraTokens.toast.revoked`,`Token revoked`)),await v()}catch(t){i(t instanceof Error?t.message:e(`cameraTokens.toast.revokeFailed`,`Failed to revoke token`),`error`)}},x=(0,X.useMemo)(()=>s.filter(e=>e.user_id!==t?.id),[s,t?.id]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:e(`cameraTokens.description`,`Long-lived tokens for embedding the camera stream into Home Assistant, Frigate, kiosks, or any other tool that needs a stable URL. Each token is camera-stream-only and can be revoked at any time.`)}),(0,Y.jsx)(Hn,{onCreated:e=>{h(e),v()}}),(0,Y.jsxs)(`div`,{className:`mb-6`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-semibold text-white mb-3`,children:e(`cameraTokens.list.myTitle`,`My tokens`)}),f?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`cameraTokens.loading`,`Loading…`)}):(0,Y.jsx)(Kn,{tokens:a,onRevoke:y,emptyMessage:e(`cameraTokens.list.empty`,`No tokens yet.`)})]}),n&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-base font-semibold text-white mb-3`,children:e(`cameraTokens.list.allTitle`,`All users (admin view)`)}),(0,Y.jsx)(Kn,{tokens:x,showOwner:!0,userIdToName:u,onRevoke:y,emptyMessage:e(`cameraTokens.list.empty`,`No tokens yet.`)})]}),m&&(0,Y.jsx)(Wn,{token:m,onClose:()=>h(null)}),g&&(0,Y.jsx)(Un,{token:g,onConfirm:()=>void b(),onCancel:()=>_(null)})]})}var Jn=[`connected-apps`];function Yn(e){if(!e)return`—`;let t=We(e);return t?t.toLocaleString():`—`}async function Xn(e){if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t);try{t.select(),document.execCommand(`copy`)}finally{document.body.removeChild(t)}}function Zn({label:e,value:t}){let{t:n}=l(),{showToast:r}=ee();return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:e}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`code`,{className:`flex-1 min-w-0 px-3 py-2 bg-bambu-dark rounded-md text-bambu-green text-xs break-all font-mono select-all`,children:t}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>Xn(t).then(()=>r(n(`connectedApps.toast.copied`)),()=>r(n(`connectedApps.toast.copyFailed`),`error`)),className:`flex items-center gap-2 px-3 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green/90`,children:[(0,Y.jsx)(N,{className:`w-4 h-4`}),n(`connectedApps.copy`)]})]})]})}function Qn({app:e,onClose:t}){let{t:n}=l();return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4`,role:`dialog`,"aria-modal":`true`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-6 max-w-2xl w-full border border-bambu-green/40 space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(Ie,{className:`w-6 h-6 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(`connectedApps.secret.title`,{name:e.name})}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:n(`connectedApps.secret.warning`)})]})]}),(0,Y.jsx)(Zn,{label:n(`connectedApps.clientId`),value:e.client_id}),(0,Y.jsx)(Zn,{label:n(`connectedApps.clientSecret`),value:e.client_secret??``}),(0,Y.jsx)(`div`,{className:`flex justify-end`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-2 bg-bambu-dark-tertiary text-white rounded-md hover:bg-bambu-dark-tertiary/80`,children:n(`connectedApps.secret.dismiss`)})})]})})}function $n({title:e,body:t,confirmLabel:n,onConfirm:r,onCancel:i}){let{t:a}=l();return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4`,role:`dialog`,"aria-modal":`true`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-6 max-w-md w-full border border-red-500/40`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,Y.jsx)(Ie,{className:`w-6 h-6 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:t})]})]}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:i,className:`px-4 py-2 bg-bambu-dark-tertiary text-white rounded-md hover:bg-bambu-dark-tertiary/80`,children:a(`connectedApps.cancel`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:`px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-600`,children:n})]})]})})}function er(){let{t:e}=l(),{authEnabled:t}=un(),{showToast:n}=ee(),i=u(),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(null),{data:_=[],isLoading:v}=d({queryKey:Jn,queryFn:r.listConnectedApps,enabled:t}),y=t=>n(t instanceof Error?t.message:e(`connectedApps.toast.failed`),`error`),b=()=>i.invalidateQueries({queryKey:Jn}),x=f({mutationFn:()=>r.createConnectedApp({name:a.trim(),redirect_uri:s.trim()}),onSuccess:t=>{o(``),c(``),m(t),n(e(`connectedApps.toast.created`)),b()},onError:y}),S=f({mutationFn:e=>r.updateConnectedApp(e.id,{enabled:!e.enabled}),onSuccess:t=>{n(t.enabled?e(`connectedApps.toast.enabled`):e(`connectedApps.toast.disabled`)),b()},onError:y}),C=f({mutationFn:e=>r.rotateConnectedAppSecret(e.id),onSuccess:t=>{m(t),n(e(`connectedApps.toast.rotated`)),b()},onError:y}),w=f({mutationFn:e=>r.deleteConnectedApp(e.id),onSuccess:()=>{n(e(`connectedApps.toast.deleted`)),b()},onError:y});if(!t)return(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`connectedApps.requiresAuth`)});let T=`px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none`;return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`connectedApps.description`)}),(0,Y.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),a.trim()&&s.trim()&&x.mutate()},className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1.5fr)_auto]`,children:[(0,Y.jsx)(`input`,{type:`text`,maxLength:100,required:!0,value:a,onChange:e=>o(e.target.value),placeholder:e(`connectedApps.namePlaceholder`),"aria-label":e(`connectedApps.name`),className:T}),(0,Y.jsx)(`input`,{type:`url`,maxLength:500,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:`http://orders.local:8090/auth/callback`,"aria-label":e(`connectedApps.callbackUrl`),className:T}),(0,Y.jsxs)(`button`,{type:`submit`,disabled:x.isPending||!a.trim()||!s.trim(),className:`flex items-center justify-center gap-2 px-4 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green/90 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),e(`connectedApps.add`)]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:e(`connectedApps.callbackHint`)}),v?null:_.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`connectedApps.empty`)}):(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:e(`connectedApps.name`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:e(`connectedApps.clientId`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:e(`connectedApps.callbackUrl`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3 font-medium`,children:e(`connectedApps.lastUsed`)}),(0,Y.jsx)(`th`,{className:`py-2 px-3`})]})}),(0,Y.jsx)(`tbody`,{children:_.map(t=>(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary last:border-b-0`,children:[(0,Y.jsxs)(`td`,{className:`py-3 px-3 text-white`,children:[t.name,!t.enabled&&(0,Y.jsx)(`span`,{className:`ml-2 px-2 py-0.5 text-xs rounded bg-bambu-dark-tertiary text-bambu-gray`,children:e(`connectedApps.disabledBadge`)})]}),(0,Y.jsx)(`td`,{className:`py-3 px-3 text-bambu-gray font-mono text-xs`,children:t.client_id}),(0,Y.jsx)(`td`,{className:`py-3 px-3 text-bambu-gray text-xs break-all`,children:t.redirect_uri}),(0,Y.jsx)(`td`,{className:`py-3 px-3 text-bambu-gray`,children:Yn(t.last_used_at)}),(0,Y.jsx)(`td`,{className:`py-3 px-3`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-3 whitespace-nowrap`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>S.mutate(t),className:`text-sm text-bambu-gray hover:text-white`,children:t.enabled?e(`connectedApps.disable`):e(`connectedApps.enable`)}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>g({app:t,action:`rotate`}),className:`inline-flex items-center gap-1 text-sm text-bambu-gray hover:text-white`,children:[(0,Y.jsx)(at,{className:`w-4 h-4`}),e(`connectedApps.rotate`)]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>g({app:t,action:`delete`}),className:`inline-flex items-center gap-1 text-sm text-red-700 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300`,children:[(0,Y.jsx)(qe,{className:`w-4 h-4`}),e(`connectedApps.delete`)]})]})})]},t.id))})]})}),p&&(0,Y.jsx)(Qn,{app:p,onClose:()=>m(null)}),h&&(0,Y.jsx)($n,{title:h.action===`rotate`?e(`connectedApps.confirmRotate.title`):e(`connectedApps.confirmDelete.title`),body:h.action===`rotate`?e(`connectedApps.confirmRotate.body`,{name:h.app.name}):e(`connectedApps.confirmDelete.body`,{name:h.app.name}),confirmLabel:h.action===`rotate`?e(`connectedApps.rotate`):e(`connectedApps.delete`),onCancel:()=>g(null),onConfirm:()=>{h.action===`rotate`?C.mutate(h.app):w.mutate(h.app),g(null)}})]})}function tr({value:e,onChange:t,onBusyChange:n}){let{t:i}=l(),{showToast:a}=ee(),{authEnabled:o,hasPermission:s}=un(),c=!o||s(`settings:update`),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)({from:e.from||`#00ae42`,to:e.to||`#00ae42`}),m=hn(!0,null,e.logoRevision),h=async o=>{d(!0),n?.(!0);try{o?await r.uploadOverlayLogo(o):await r.deleteOverlayLogo(),t({...e,logo:o!==null,logoRevision:e.logoRevision+1})}catch(e){a(e instanceof Error?e.message:i(`streamOverlay.branding.failed`),`error`)}finally{d(!1),n?.(!1)}},g=(n,r)=>{p(e=>({...e,[n]:r})),fn(r)&&t({...e,from:e.from||`#00ae42`,to:e.to||`#00ae42`,[n]:r})};return(0,Y.jsxs)(`fieldset`,{disabled:u,className:`my-4 space-y-3 rounded-lg border border-bambu-dark-tertiary p-4`,children:[(0,Y.jsx)(`legend`,{className:`px-2 text-sm font-medium text-white`,children:i(`streamOverlay.branding.title`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`streamOverlay.branding.hint`)}),(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray`,children:[i(`streamOverlay.branding.upload`),(0,Y.jsx)(`input`,{type:`file`,accept:`image/png,image/webp`,disabled:!c,className:`mt-1 block w-full text-sm`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&h(t)}})]}),m&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(`img`,{src:m,alt:i(`streamOverlay.branding.logo`),className:`h-16 max-w-40 object-contain`}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.logo,onChange:n=>t({...e,logo:n.target.checked})}),i(`streamOverlay.branding.logo`)]}),(0,Y.jsx)(`button`,{type:`button`,disabled:!c,onClick:()=>void h(null),className:`text-sm text-red-400 disabled:opacity-50`,children:i(`common.remove`)})]}),(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[`from`,`to`].map(t=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`overlay-colour-${t}`,className:`block text-sm text-bambu-gray mb-1`,children:i(`streamOverlay.branding.${t}`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{id:`overlay-colour-${t}`,type:`color`,value:e[t]||`#00ae42`,onChange:e=>g(t,e.target.value),className:`h-9 w-12 bg-transparent`}),(0,Y.jsx)(`input`,{"aria-label":`${i(`streamOverlay.branding.${t}`)} (hex)`,value:f[t],onChange:e=>g(t,e.target.value),"aria-invalid":!fn(f[t]),maxLength:7,spellCheck:!1,className:`w-28 rounded border border-bambu-dark-tertiary bg-bambu-dark px-2 py-1 text-white`})]})]},t))}),(0,Y.jsx)(`button`,{type:`button`,className:`text-sm text-bambu-green`,onClick:()=>{p({from:`#00ae42`,to:`#00ae42`}),t({...e,from:``,to:``})},children:i(`streamOverlay.branding.reset`)})]})}var nr=[{key:`printer`,labelKey:`streamOverlay.builder.fieldPrinter`,fallback:`Printer name`},{key:`model`,labelKey:`streamOverlay.builder.fieldModel`,fallback:`Printer model`},{key:`filename`,labelKey:`streamOverlay.builder.fieldFilename`,fallback:`File name`},{key:`status`,labelKey:`streamOverlay.builder.fieldStatus`,fallback:`Status`},{key:`progress`,labelKey:`streamOverlay.builder.fieldProgress`,fallback:`Progress bar`},{key:`layers`,labelKey:`streamOverlay.builder.fieldLayers`,fallback:`Layer count`},{key:`eta`,labelKey:`streamOverlay.builder.fieldEta`,fallback:`Time remaining and ETA`},{key:`nozzle`,labelKey:`printers.heaterHistory.nozzle`,fallback:`Nozzle`},{key:`bed`,labelKey:`printers.heaterHistory.bed`,fallback:`Bed`},{key:`chamber`,labelKey:`printers.heaterHistory.chamber`,fallback:`Chamber`}],rr=[`progress`,`layers`,`eta`,`filename`,`status`],ir=15,ar=`bambuddy.streamOverlayBuilder`,or={printerId:null,fields:rr,size:`medium`,fps:ir,artwork:`1`,backgroundTransparency:0,showCamera:!0,layout:`landscape`,logo:!1,from:``,to:``};function sr(){let e;try{e=JSON.parse(window.localStorage.getItem(ar)??`null`)}catch{return or}if(!e||typeof e!=`object`)return or;let t=e,n=(e,t,n,r)=>typeof e==`number`&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r,r=typeof t.from==`string`&&typeof t.to==`string`&&dn(t.from,t.to);return{printerId:typeof t.printerId==`number`&&Number.isSafeInteger(t.printerId)&&t.printerId>0?t.printerId:null,fields:Array.isArray(t.fields)?t.fields.filter(e=>nr.some(t=>t.key===e)):rr,size:t.size===`small`||t.size===`large`?t.size:`medium`,fps:Math.round(n(t.fps,1,30,ir)),artwork:t.artwork===`2`?`2`:`1`,backgroundTransparency:n(t.backgroundTransparency,0,100,0),showCamera:t.showCamera!==!1,layout:t.layout===`portrait`||t.layout===`both`?t.layout:`landscape`,logo:t.logo===!0,from:r?t.from:``,to:r?t.to:``}}var cr=600;function lr(e){try{return window.localStorage.setItem(ar,JSON.stringify(e)),!0}catch{return!1}}function ur({onTokenCreated:e}){let{t}=l(),{showToast:n}=ee(),{user:i,hasPermission:a}=un(),[o,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(``),h=p,[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(!1),[b]=(0,X.useState)(sr),x=(0,X.useRef)(null),S=(0,X.useRef)(!1),C=(0,X.useRef)(null),[w,T]=(0,X.useState)([]),[E,D]=(0,X.useState)(b.printerId),[O,k]=(0,X.useState)(b.fields),[A,j]=(0,X.useState)(b.size),[M,P]=(0,X.useState)(b.fps),[te,ne]=(0,X.useState)(b.artwork),[I,re]=(0,X.useState)(b.backgroundTransparency),[ie,L]=(0,X.useState)(b.showCamera),[ae,R]=(0,X.useState)({...mn,logo:b.logo,from:b.from,to:b.to}),[z,oe]=(0,X.useState)(b.layout),[se,B]=(0,X.useState)(0),[ce,le]=(0,X.useState)(!1),[ue,de]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await r.getPrinters();if(e)return;T(t),t.length>0&&D(e=>{let n=e===null||e===b.printerId&&!t.some(t=>t.id===e)?t[0].id:e;return n!==e&&(S.current=!0),n})}catch{}})(),()=>{e=!0}},[b.printerId]),(0,X.useEffect)(()=>{let e={printerId:E,fields:O,size:A,fps:M,artwork:te,backgroundTransparency:I,showCamera:ie,layout:z,logo:ae.logo,from:ae.from,to:ae.to},r=JSON.stringify(e);if(r===x.current)return;let i=x.current===null||S.current;x.current=r,S.current=!1,!(!lr(e)||i)&&(C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{C.current=null,n(t(`settings.toast.settingsSaved`))},cr))},[E,O,A,M,te,I,ie,z,ae.logo,ae.from,ae.to,n,t]),(0,X.useEffect)(()=>()=>{C.current&&clearTimeout(C.current)},[]);let fe=()=>{D(w[0]?.id??null),k(or.fields),j(or.size),P(or.fps),ne(or.artwork),re(or.backgroundTransparency),L(or.showCamera),oe(or.layout),R(e=>({...e,logo:!1,from:``,to:``})),B(e=>e+1),de(!1)},V=(0,X.useMemo)(()=>{let e=E??1,t=new URLSearchParams,n=nr.filter(e=>O.includes(e.key)).map(e=>e.key);return t.set(`show`,n.join(`,`)),A!==`medium`&&t.set(`size`,A),M!==ir&&t.set(`fps`,String(M)),te!==`1`&&t.set(`artwork`,te),te===`2`&&I>0&&t.set(`backgroundTransparency`,String(I)),ie||t.set(`camera`,`false`),ae.logo&&t.set(`logo`,`1`),ae.from&&ae.to&&(t.set(`progressFrom`,ae.from),t.set(`progressTo`,ae.to)),h.trim()&&t.set(`token`,h.trim()),(z===`both`?[`landscape`,`portrait`]:[z]).map(n=>(n===`portrait`?t.set(`layout`,n):t.delete(`layout`),{layout:n,url:`${window.location.origin}/overlay/${e}?${t.toString()}`}))},[E,O,A,M,ie,h,te,z,ae,I]),pe=e=>{let t=new URL(e);return t.searchParams.has(`token`)&&!d&&t.searchParams.set(`token`,`****`),t.toString()},me=()=>{try{let e=new URL(g.trim()),t=/^\/overlay\/([1-9]\d*)\/?$/.exec(e.pathname);if(![`http:`,`https:`].includes(e.protocol)||e.username||e.password||!t)throw Error();let n=Number(t[1]);if(!Number.isSafeInteger(n))throw Error();let r=e.searchParams;if(r.getAll(`token`).length>1)throw Error();let i=r.has(`show`)?r.get(`show`).split(`,`).filter(e=>nr.some(t=>t.key===e)):rr,a=r.get(`size`),o=a===`small`||a===`large`?a:`medium`,s=parseInt(r.get(`fps`)||`15`,10),c=Math.min(Math.max(Number.isNaN(s)?ir:s,1),30),l=Number(r.get(`backgroundTransparency`)),u=Number.isFinite(l)?Math.min(100,Math.max(0,l)):0,d=r.get(`progressFrom`),p=r.get(`progressTo`),h=dn(d,p);D(n),oe(r.get(`layout`)===`portrait`?`portrait`:`landscape`),k(i),j(o),P(c),ne(r.get(`artwork`)===`2`?`2`:`1`),L(![`false`,`0`].includes(r.get(`camera`)??``)),re(u),R(e=>({...e,logo:r.get(`logo`)===`1`,from:h?d:``,to:h?p:``})),B(e=>e+1),m(r.get(`token`)??``),de(!1),f(!1),_(``),y(!1)}catch{y(!0)}},he=e=>{k(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ge=async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t);try{if(t.select(),!document.execCommand(`copy`))throw Error()}finally{document.body.removeChild(t)}}n(t(`cameraTokens.toast.copied`,`Copied to clipboard`))}catch{n(t(`cameraTokens.toast.copyFailed`,`Copy failed — select and copy manually`),`error`)}};return(0,Y.jsxs)(`div`,{className:`@container/overlay min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:t(`streamOverlay.builder.description`,`Build the URL for a streaming overlay — a full-screen camera view with live print data drawn over it, for OBS, a wall display, or any browser source. Pick the fields you want and copy the URL.`)}),(0,Y.jsxs)(`div`,{className:`-mt-2 mb-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-bambu-gray`,children:[(0,Y.jsx)(`span`,{children:t(`streamOverlay.builder.rememberedHint`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:fe,disabled:c||ce,className:`text-bambu-green hover:underline disabled:opacity-50`,children:t(`streamOverlay.builder.resetChoices`)})]}),(0,Y.jsxs)(`div`,{className:`mb-4 space-y-2`,children:[(0,Y.jsx)(`label`,{htmlFor:`overlay-builder-import`,className:`block text-sm font-medium text-white`,children:t(`streamOverlay.builder.importUrl`)}),(0,Y.jsx)(`input`,{id:`overlay-builder-import`,type:`password`,autoComplete:`new-password`,spellCheck:!1,value:g,disabled:c||ce,onChange:e=>{_(e.target.value),y(!1)},className:`w-full min-w-0 px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary`}),(0,Y.jsx)(`button`,{type:`button`,disabled:c||ce||!g.trim(),onClick:me,className:`px-3 py-2 bg-bambu-dark-tertiary text-white rounded-md disabled:opacity-50`,children:t(`streamOverlay.builder.importAction`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:t(`streamOverlay.builder.importHint`)}),v&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-sm text-red-400`,children:t(`streamOverlay.builder.importError`)})]}),(0,Y.jsxs)(`div`,{className:`mb-4 space-y-2`,children:[i&&a(`camera:view`)&&(0,Y.jsx)(`button`,{type:`button`,disabled:c,onClick:()=>s(e=>!e),className:`px-3 py-2 bg-bambu-dark-tertiary text-white rounded-md`,children:t(o?`common.cancel`:`streamOverlay.builder.createToken`)}),o&&i&&a(`camera:view`)&&(0,Y.jsx)(Hn,{fixedScope:`overlay`,onSubmittingChange:u,onCreated:t=>{e?.(),t.token&&(de(!1),m(t.token),f(!1),s(!1))}})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 @min-[28rem]/overlay:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`overlay-builder-printer`,className:`block text-sm font-medium text-white mb-1`,children:t(`streamOverlay.builder.printer`,`Printer`)}),(0,Y.jsxs)(`select`,{id:`overlay-builder-printer`,value:E??``,onChange:e=>D(Number(e.target.value)),className:`w-full px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none`,children:[w.length===0&&(0,Y.jsx)(`option`,{value:``,children:t(`common.loading`,`Loading…`)}),E!==null&&!w.some(e=>e.id===E)&&(0,Y.jsx)(`option`,{value:E,children:E}),w.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`overlay-builder-size`,className:`block text-sm font-medium text-white mb-1`,children:t(`streamOverlay.builder.size`,`Text size`)}),(0,Y.jsxs)(`select`,{id:`overlay-builder-size`,value:A,onChange:e=>j(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`small`,children:t(`streamOverlay.builder.sizeSmall`,`Small`)}),(0,Y.jsx)(`option`,{value:`medium`,children:t(`streamOverlay.builder.sizeMedium`,`Medium`)}),(0,Y.jsx)(`option`,{value:`large`,children:t(`streamOverlay.builder.sizeLarge`,`Large`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`overlay-builder-layout`,className:`block text-sm font-medium text-white mb-1`,children:t(`streamOverlay.builder.layout`)}),(0,Y.jsxs)(`select`,{id:`overlay-builder-layout`,value:z,onChange:e=>{let t=e.target.value;(t===`landscape`||t===`portrait`||t===`both`)&&oe(t)},className:`w-full px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`landscape`,children:t(`streamOverlay.builder.landscape`)}),(0,Y.jsx)(`option`,{value:`portrait`,children:t(`streamOverlay.builder.portrait`)}),(0,Y.jsx)(`option`,{value:`both`,children:t(`streamOverlay.builder.both`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`overlay-builder-artwork`,className:`block text-sm font-medium text-white mb-1`,children:t(`streamOverlay.builder.artwork`,`Artwork`)}),(0,Y.jsxs)(`select`,{id:`overlay-builder-artwork`,value:te,onChange:e=>ne(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`1`,children:t(`streamOverlay.builder.artworkClassic`,`Classic`)}),(0,Y.jsx)(`option`,{value:`2`,children:t(`streamOverlay.builder.artworkV2`,`Version 2`)})]})]}),te===`2`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{htmlFor:`overlay-builder-background-transparency`,className:`flex justify-between gap-2 text-sm font-medium text-white mb-1`,children:[(0,Y.jsx)(`span`,{children:t(`streamOverlay.builder.backgroundTransparency`)}),(0,Y.jsxs)(`span`,{"aria-hidden":`true`,children:[I,`%`]})]}),(0,Y.jsx)(`input`,{id:`overlay-builder-background-transparency`,type:`range`,min:0,max:100,step:1,value:I,"aria-valuetext":`${I}%`,onChange:e=>re(Number(e.target.value)),className:`w-full accent-bambu-green`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:t(`streamOverlay.builder.backgroundTransparencyHint`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`overlay-builder-fps`,className:`block text-sm font-medium text-white mb-1`,children:t(`streamOverlay.builder.fps`,`Frame rate`)}),(0,Y.jsx)(ct,{id:`overlay-builder-fps`,min:1,max:30,value:M,onChange:P,fallback:1,className:`w-full px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:t(`streamOverlay.builder.fpsHint`,`A1 and P1 cameras top out around 5 fps whatever you ask for.`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`overlay-builder-manual-token`,className:`block text-sm font-medium text-white mt-3 mb-1`,children:t(`streamOverlay.builder.manualToken`)}),(0,Y.jsx)(`input`,{id:`overlay-builder-manual-token`,type:d?`text`:`password`,value:p,disabled:c,autoComplete:`new-password`,spellCheck:!1,onChange:e=>{de(!1),f(!1),m(e.target.value)},placeholder:`bblt_…`,className:`w-full min-w-0 px-3 py-2 bg-bambu-dark rounded-md text-white border border-bambu-dark-tertiary`}),(0,Y.jsx)(`button`,{type:`button`,disabled:!h,onClick:()=>f(e=>!e),className:`mt-2 text-sm text-bambu-gray disabled:opacity-50`,children:t(d?`streamOverlay.builder.hideToken`:`streamOverlay.builder.showToken`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:t(`streamOverlay.builder.credentialHint`,`Create a token above, enter an existing token, or import an overlay URL. Copy the URL before leaving: tokens are held only in memory and cannot be recovered from their stored hash.`)})]})]}),(0,Y.jsxs)(`fieldset`,{className:`mt-4`,children:[(0,Y.jsx)(`legend`,{className:`text-sm font-medium text-white mb-2`,children:t(`streamOverlay.builder.fields`,`Fields to show`)}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 @min-[24rem]/overlay:grid-cols-2 @min-[36rem]/overlay:grid-cols-3`,children:[nr.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:O.includes(e.key),onChange:()=>he(e.key),className:`accent-bambu-green`}),t(e.labelKey,e.fallback)]},e.key)),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:ie,onChange:e=>L(e.target.checked),className:`accent-bambu-green`}),t(`streamOverlay.builder.fieldCamera`,`Camera feed`)]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:t(`streamOverlay.builder.chamberHint`,`Chamber temperature only appears on models with a real chamber sensor — P1 and A1 printers report a meaningless value, so it is left out there.`)})]}),(0,Y.jsx)(tr,{value:ae,onChange:R,onBusyChange:le},se),(0,Y.jsxs)(`div`,{className:`mt-4`,children:[V.map(({layout:e,url:n})=>(0,Y.jsxs)(`fieldset`,{className:`min-w-0 mb-3`,children:[(0,Y.jsx)(`legend`,{className:`text-sm font-medium text-white mb-1`,children:t(`streamOverlay.builder.orientationUrl`,{orientation:t(`streamOverlay.builder.${e}`)})}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:t(`streamOverlay.builder.sourceDimensions`,pn[e])}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`code`,{className:`w-full px-3 py-2 bg-bambu-dark rounded-md text-bambu-green text-xs break-all font-mono`,children:pe(n)}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>void ge(n),className:`flex items-center gap-2 px-3 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green/90`,children:[(0,Y.jsx)(N,{className:`w-4 h-4`}),t(`cameraTokens.created.copy`,`Copy`)]}),(0,Y.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 px-3 py-2 bg-bambu-dark-tertiary text-white rounded-md hover:bg-bambu-dark-tertiary/80`,children:[(0,Y.jsx)(Je,{className:`w-4 h-4`}),t(`streamOverlay.builder.open`,`Open`)]})]})]},e)),h.trim()&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:t(`streamOverlay.builder.tokenWarning`,`This URL contains a token — anyone who can read it can watch the stream and see the file name. Revoke the token to cut it off.`)})]}),(0,Y.jsxs)(`div`,{className:`mt-4`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>de(e=>!e),className:`flex items-center gap-2 px-3 py-2 bg-bambu-dark-tertiary text-white rounded-md hover:bg-bambu-dark-tertiary/80 text-sm`,children:[ue?(0,Y.jsx)(F,{className:`w-4 h-4`}):(0,Y.jsx)(mt,{className:`w-4 h-4`}),ue?t(`streamOverlay.builder.hidePreview`,`Hide preview`):t(`streamOverlay.builder.showPreview`,`Show preview`)]}),ue&&(0,Y.jsx)(`div`,{className:`mt-3 flex flex-wrap items-start gap-4`,children:V.map(({layout:e,url:n})=>(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 basis-64`,style:e===`portrait`?{maxWidth:360}:void 0,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white mb-2`,children:t(`streamOverlay.builder.${e}`)}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-md border border-bambu-dark-tertiary`,children:(0,Y.jsx)(gn,{layout:e,preview:!0,children:(0,Y.jsx)(dr,{url:n,logoRevision:ae.logoRevision,title:t(`streamOverlay.builder.orientationPreview`,{orientation:t(`streamOverlay.builder.${e}`)})})})})]},e))})]})]})}function dr({url:e,logoRevision:t,title:n}){let[r,i]=(0,X.useState)({url:e,logoRevision:t});return(0,X.useEffect)(()=>{let n=window.setTimeout(()=>i({url:e,logoRevision:t}),300);return()=>window.clearTimeout(n)},[e,t]),(0,Y.jsx)(`iframe`,{src:r.url,title:n,className:`w-full h-full border-0`},`${r.url}:${r.logoRevision}`)}function fr({plug:e,onEdit:t}){let{t:n}=l(),i=u(),{showToast:a}=ee(),[o,s]=(0,X.useState)(!1),[c,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(!1),{data:v,isLoading:y}=d({queryKey:[`smart-plug-status`,e.id],queryFn:()=>r.getSmartPlugStatus(e.id),refetchInterval:3e4}),{data:b}=d({queryKey:[`printers`],queryFn:r.getPrinters}),x=b?.find(t=>t.id===e.printer_id),S=f({mutationFn:t=>r.controlSmartPlug(e.id,t),onMutate:async t=>{await i.cancelQueries({queryKey:[`smart-plug-status`,e.id]});let n=i.getQueryData([`smart-plug-status`,e.id]),r=t===`on`?`ON`:t===`off`||v?.state===`ON`?`OFF`:`ON`;return i.setQueryData([`smart-plug-status`,e.id],e=>({...e,state:r})),{previousStatus:n}},onError:(t,r,o)=>{o?.previousStatus&&i.setQueryData([`smart-plug-status`,e.id],o.previousStatus),a(n(`smartPlugs.failedToTurn`,{action:r,name:e.name}),`error`)},onSettled:()=>{setTimeout(()=>{i.invalidateQueries({queryKey:[`smart-plug-status`,e.id]}),i.invalidateQueries({queryKey:[`smart-plugs`]})},1e3)}}),C=f({mutationFn:t=>r.updateSmartPlug(e.id,t),onSuccess:()=>{i.invalidateQueries({queryKey:[`smart-plugs`]}),e.printer_id&&(i.invalidateQueries({queryKey:[`smartPlugByPrinter`,e.printer_id]}),i.invalidateQueries({queryKey:[`scriptPlugsByPrinter`,e.printer_id]}))}}),T=f({mutationFn:()=>r.deleteSmartPlug(e.id),onSuccess:()=>{i.invalidateQueries({queryKey:[`smart-plugs`]}),e.printer_id&&i.invalidateQueries({queryKey:[`scriptPlugsByPrinter`,e.printer_id]})}}),E=v?.state===`ON`,D=e.plug_type===`mqtt`&&v?.energy?.power!==null&&v?.energy?.power!==void 0,O=(v?.reachable??!1)||D,k=S.isPending,A=(()=>{if(e.plug_type!==`tasmota`||!e.ip_address)return null;let t=e.ip_address;return e.username&&e.password?`http://${encodeURIComponent(e.username)}:${encodeURIComponent(e.password)}@${t}/`:`http://${t}/`})();return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{className:`relative`,children:(0,Y.jsxs)(W,{className:`p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`p-2 rounded-lg flex-shrink-0 ${e.plug_type===`mqtt`?O?`bg-teal-100 dark:bg-teal-500/20`:`bg-red-100 dark:bg-red-500/20`:O?E?`bg-bambu-green/20`:`bg-bambu-dark`:`bg-red-100 dark:bg-red-500/20`}`,children:e.plug_type===`mqtt`?(0,Y.jsx)(en,{className:`w-5 h-5 ${O?`text-teal-600 dark:text-teal-400`:`text-red-600 dark:text-red-400`}`}):e.plug_type===`homeassistant`?(0,Y.jsx)(Ft,{className:`w-5 h-5 ${O?E?`text-bambu-green`:`text-bambu-gray`:`text-red-600 dark:text-red-400`}`}):e.plug_type===`rest`?(0,Y.jsx)(zt,{className:`w-5 h-5 ${O?E?`text-bambu-green`:`text-bambu-gray`:`text-red-600 dark:text-red-400`}`}):(0,Y.jsx)(dt,{className:`w-5 h-5 ${O?E?`text-bambu-green`:`text-bambu-gray`:`text-red-600 dark:text-red-400`}`})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`font-medium text-white truncate`,children:e.name}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray truncate`,title:e.plug_type===`mqtt`?e.mqtt_topic??void 0:e.plug_type===`homeassistant`?e.ha_entity_id??void 0:e.plug_type===`rest`?e.rest_on_url??e.rest_off_url??void 0:e.ip_address??void 0,children:e.plug_type===`mqtt`?e.mqtt_topic:e.plug_type===`homeassistant`?e.ha_entity_id:e.plug_type===`rest`?e.rest_on_url||e.rest_off_url:e.ip_address})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col items-end gap-1 flex-shrink-0`,children:[y?(0,Y.jsx)(R,{className:`w-4 h-4 text-bambu-gray animate-spin`}):e.plug_type===`mqtt`?(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm whitespace-nowrap`,children:[(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400 text-[10px] font-medium rounded flex-shrink-0`,children:`MQTT`}),O&&(0,Y.jsx)(`span`,{className:`text-status-ok`,children:`✓`})]}):e.plug_type===`homeassistant`?(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,Y.jsx)(`span`,{className:`px-1 py-0.5 bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 text-[10px] font-medium rounded`,children:`HA`}),(0,Y.jsx)(`span`,{className:O?E?`text-status-ok`:`text-bambu-gray`:`text-status-error`,children:O?v?.state||`?`:n(`smartPlugs.offline`)})]}):e.plug_type===`rest`?(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,Y.jsx)(`span`,{className:`px-1 py-0.5 bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400 text-[10px] font-medium rounded`,children:`REST`}),(0,Y.jsx)(`span`,{className:O?E?`text-status-ok`:`text-bambu-gray`:`text-status-error`,children:O?v?.state||`?`:n(`smartPlugs.offline`)})]}):O?(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,Y.jsx)(ht,{className:`w-4 h-4 text-status-ok`}),(0,Y.jsx)(`span`,{className:E?`text-status-ok`:`text-bambu-gray`,children:v?.state||n(`smartPlugs.unknown`)})]}):(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 text-sm text-status-error`,children:[(0,Y.jsx)(Ye,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{children:n(`smartPlugs.offline`)})]}),A&&(0,Y.jsxs)(`a`,{href:A,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 px-2 py-0.5 bg-bambu-dark hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white text-xs rounded-full transition-colors`,title:n(`smartPlugs.openPlugAdminPage`),children:[(0,Y.jsx)(Je,{className:`w-3 h-3`}),n(`smartPlugs.admin`)]})]})]}),x&&(0,Y.jsxs)(`div`,{className:`mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg`,children:[(0,Y.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[n(`smartPlugs.linkedTo`),` `]}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:x.name})]}),(e.power_alert_enabled||e.schedule_enabled||e.plug_type===`mqtt`)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mb-3`,children:[e.plug_type===`mqtt`&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-0.5 bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400 text-xs rounded-full`,children:[(0,Y.jsx)(mt,{className:`w-3 h-3`}),n(`smartPlugs.monitorOnly`)]}),e.power_alert_enabled&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-0.5 bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 text-xs rounded-full`,children:[(0,Y.jsx)(rt,{className:`w-3 h-3`}),n(`smartPlugs.alerts`)]}),e.schedule_enabled&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-0.5 bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 text-xs rounded-full`,children:[(0,Y.jsx)(w,{className:`w-3 h-3`}),e.schedule_on_time&&e.schedule_off_time?`${e.schedule_on_time} - ${e.schedule_off_time}`:e.schedule_on_time?n(`smartPlugs.scheduleOn`,{time:e.schedule_on_time}):n(`smartPlugs.scheduleOff`,{time:e.schedule_off_time})]})]}),e.plug_type!==`mqtt`&&(0,Y.jsxs)(`div`,{className:`flex gap-2 mb-3`,children:[(0,Y.jsxs)(K,{size:`sm`,variant:E?`primary`:`secondary`,disabled:!O||k,onClick:()=>p(!0),className:`flex-1`,children:[k?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Ct,{className:`w-4 h-4`}),n(`smartPlugs.on`)]}),(0,Y.jsxs)(K,{size:`sm`,variant:E?`secondary`:`primary`,disabled:!O||k,onClick:()=>h(!0),className:`flex-1`,children:[k?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(St,{className:`w-4 h-4`}),n(`smartPlugs.off`)]})]}),e.plug_type===`mqtt`&&v?.energy&&(0,Y.jsxs)(`div`,{className:`flex gap-2 mb-3 px-3 py-2 bg-bambu-dark rounded-lg`,children:[v.energy.power!==null&&v.energy.power!==void 0&&(0,Y.jsxs)(`div`,{className:`flex-1 text-center`,children:[(0,Y.jsxs)(`p`,{className:`text-lg font-semibold text-white`,children:[Math.round(v.energy.power),`W`]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.power`)})]}),v.energy.today!==null&&v.energy.today!==void 0&&(0,Y.jsxs)(`div`,{className:`flex-1 text-center border-l border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`p`,{className:`text-lg font-semibold text-white`,children:v.energy.today.toFixed(3)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.kwhToday`)})]})]}),(0,Y.jsxs)(`button`,{onClick:()=>_(!g),className:`w-full flex items-center justify-between py-2 text-sm text-bambu-gray hover:text-white transition-colors`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(je,{className:`w-4 h-4`}),e.plug_type===`mqtt`?n(`smartPlugs.settings`):n(`smartPlugs.automationSettings`)]}),(0,Y.jsx)(`span`,{children:g?`-`:`+`})]}),g&&(0,Y.jsxs)(`div`,{className:`pt-3 border-t border-bambu-dark-tertiary space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(L,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`smartPlugs.showInSwitchbar`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.quickAccessSidebar`)})]})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.show_in_switchbar,onChange:e=>C.mutate({show_in_switchbar:e.target.checked}),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green`})]})]}),e.printer_id!=null&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Ct,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`smartPlugs.controlsPrinterPower`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.controlsPrinterPowerDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.controls_printer_power,onChange:e=>C.mutate({controls_printer_power:e.target.checked}),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green`})]})]}),e.plug_type!==`mqtt`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`smartPlugs.enabled`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.enableAutomation`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:e=>C.mutate({enabled:e.target.checked}),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`smartPlugs.autoOn`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.autoOnDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.auto_on,onChange:e=>C.mutate({auto_on:e.target.checked}),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`smartPlugs.autoOff`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.autoOffDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.auto_off,onChange:e=>C.mutate({auto_off:e.target.checked}),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green`})]})]}),e.auto_off&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between pl-4 border-l-2 border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`smartPlugs.autoOffPersistent`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.autoOffPersistentDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.auto_off_persistent,onChange:e=>C.mutate({auto_off_persistent:e.target.checked}),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green`})]})]}),e.auto_off&&(0,Y.jsxs)(`div`,{className:`space-y-3 pl-4 border-l-2 border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white mb-2`,children:n(`smartPlugs.turnOffDelayMode`)}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(`button`,{onClick:()=>C.mutate({off_delay_mode:`time`}),className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${e.off_delay_mode===`time`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,children:[(0,Y.jsx)(lt,{className:`w-4 h-4`}),n(`smartPlugs.time`)]}),(0,Y.jsxs)(`button`,{onClick:()=>C.mutate({off_delay_mode:`temperature`}),className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${e.off_delay_mode===`temperature`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,children:[(0,Y.jsx)(Fe,{className:`w-4 h-4`}),n(`smartPlugs.temp`)]})]})]}),e.off_delay_mode===`time`?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:n(`smartPlugs.delayMinutes`)}),(0,Y.jsx)(ct,{min:1,max:60,value:e.off_delay_minutes,onChange:e=>C.mutate({off_delay_minutes:e}),fallback:5,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`})]}):(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:n(`smartPlugs.tempThreshold`)}),(0,Y.jsx)(ct,{min:30,max:100,value:e.off_temp_threshold,onChange:e=>C.mutate({off_temp_threshold:e}),fallback:70,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`smartPlugs.tempThresholdDescription`)})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`smartPlugs.autoOffAfterDrying`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.autoOffAfterDryingDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.auto_off_after_drying,onChange:e=>C.mutate({auto_off_after_drying:e.target.checked}),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green`})]})]}),e.auto_off_after_drying&&(0,Y.jsxs)(`div`,{className:`pl-4 border-l-2 border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:n(`smartPlugs.delayAfterDryingMinutes`)}),(0,Y.jsx)(ct,{min:0,max:120,value:e.off_delay_after_drying_minutes,onChange:e=>C.mutate({off_delay_after_drying_minutes:e}),fallback:10,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,Y.jsxs)(K,{size:`sm`,variant:`secondary`,onClick:()=>t(e),className:`flex-1`,children:[(0,Y.jsx)(oe,{className:`w-4 h-4`}),n(`smartPlugs.edit`)]}),(0,Y.jsx)(K,{size:`sm`,variant:`secondary`,onClick:()=>s(!0),className:`text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300`,children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]})]})]})}),o&&(0,Y.jsx)(Tt,{title:n(`smartPlugs.deleteSmartPlug`),message:n(`smartPlugs.deleteConfirm`,{name:e.name}),confirmText:n(`smartPlugs.delete`),variant:`danger`,onConfirm:()=>{T.mutate(),s(!1)},onCancel:()=>s(!1)}),c&&(0,Y.jsx)(Tt,{title:n(`smartPlugs.turnOnSmartPlug`),message:n(`smartPlugs.turnOnConfirm`,{name:e.name}),confirmText:n(`smartPlugs.turnOn`),variant:`default`,onConfirm:()=>{S.mutate(`on`),p(!1)},onCancel:()=>p(!1)}),m&&(0,Y.jsx)(Tt,{title:n(`smartPlugs.turnOffSmartPlug`),message:n(`smartPlugs.turnOffConfirm`,{name:e.name}),confirmText:n(`smartPlugs.turnOff`),variant:`danger`,onConfirm:()=>{S.mutate(`off`),h(!1)},onCancel:()=>h(!1)})]})}function pr({plug:e,onClose:t}){let{t:n}=l(),i=u(),a=!!e,[o,s]=(0,X.useState)(e?.plug_type||`tasmota`),[c,p]=(0,X.useState)(e?.name||``),[m,h]=(0,X.useState)(e?.ip_address||``),[g,_]=(0,X.useState)(e?.username||``),[v,y]=(0,X.useState)(e?.password||``),[b,x]=(0,X.useState)(e?.ha_entity_id||``),[S,C]=(0,X.useState)(e?.mqtt_power_topic||e?.mqtt_topic||``),[w,T]=(0,X.useState)(e?.mqtt_power_path||``),[E,D]=(0,X.useState)((e?.mqtt_power_multiplier??e?.mqtt_multiplier??1).toString()),[O,k]=(0,X.useState)(e?.mqtt_energy_topic||``),[A,ee]=(0,X.useState)(e?.mqtt_energy_path||``),[M,N]=(0,X.useState)((e?.mqtt_energy_multiplier??1).toString()),[P,te]=(0,X.useState)(e?.mqtt_state_topic||``),[F,ne]=(0,X.useState)(e?.mqtt_state_path||``),[I,re]=(0,X.useState)(e?.mqtt_state_on_value||``),[ie,ae]=(0,X.useState)(e?.rest_on_url||``),[z,oe]=(0,X.useState)(e?.rest_on_body||``),[se,B]=(0,X.useState)(e?.rest_off_url||``),[ce,le]=(0,X.useState)(e?.rest_off_body||``),[ue,de]=(0,X.useState)(e?.rest_method||`POST`),[fe,V]=(0,X.useState)(e?.rest_headers||``),[pe,me]=(0,X.useState)(e?.rest_status_url||``),[he,ge]=(0,X.useState)(e?.rest_status_path||``),[_e,ve]=(0,X.useState)(e?.rest_status_on_value||``),[ye,be]=(0,X.useState)(e?.rest_power_url||``),[H,xe]=(0,X.useState)(e?.rest_power_path||``),[Se,Ce]=(0,X.useState)((e?.rest_power_multiplier??1).toString()),[we,Te]=(0,X.useState)(e?.rest_energy_url||``),[Ee,De]=(0,X.useState)(e?.rest_energy_path||``),[Oe,ke]=(0,X.useState)((e?.rest_energy_multiplier??1).toString()),[je,Me]=(0,X.useState)(e?.rest_energy_total_path||``),[Ne,Pe]=(0,X.useState)((e?.rest_energy_total_multiplier??1).toString()),[Fe,Ie]=(0,X.useState)(e?.ha_power_entity||``),[Le,U]=(0,X.useState)(e?.ha_energy_today_entity||``),[W,ze]=(0,X.useState)(e?.ha_energy_total_entity||``),[G,Be]=(0,X.useState)(``),[Ve,He]=(0,X.useState)(``),[Ue,We]=(0,X.useState)(!1),Ge=(0,X.useRef)(null),[Ke,q]=(0,X.useState)(``),[qe,Je]=(0,X.useState)(!1),Xe=(0,X.useRef)(null),[Ze,Qe]=(0,X.useState)(``),[$e,et]=(0,X.useState)(!1),tt=(0,X.useRef)(null),[nt,it]=(0,X.useState)(``),[at,ot]=(0,X.useState)(!1),st=(0,X.useRef)(null),[ct,ut]=(0,X.useState)(e?.printer_id||null),[ft,pt]=(0,X.useState)(e?.controls_printer_power??!0),[gt,vt]=(0,X.useState)(null),[yt,bt]=(0,X.useState)(null),[xt,St]=(0,X.useState)(e?.power_alert_enabled||!1),[wt,Tt]=(0,X.useState)(e?.power_alert_high?.toString()||``),[Et,Dt]=(0,X.useState)(e?.power_alert_low?.toString()||``),[Ot,kt]=(0,X.useState)(e?.schedule_enabled||!1),[At,jt]=(0,X.useState)(e?.schedule_on_time||``),[Mt,Nt]=(0,X.useState)(e?.schedule_off_time||``),[Pt,It]=(0,X.useState)(e?.show_in_switchbar||!1),[Lt,Rt]=(0,X.useState)(e?.show_on_printer_card??!0),[Bt,Vt]=(0,X.useState)(!1),[Ht,Ut]=(0,X.useState)({scanned:0,total:0}),[Wt,Gt]=(0,X.useState)([]),Kt=(0,X.useRef)(null),{data:qt}=d({queryKey:[`printers`],queryFn:r.getPrinters}),{data:Jt}=d({queryKey:[`smart-plugs`],queryFn:r.getSmartPlugs}),{data:Yt}=d({queryKey:[`settings`],queryFn:r.getSettings}),Xt=!!(Yt?.ha_enabled&&Yt?.ha_url&&Yt?.ha_token);(0,X.useEffect)(()=>{let e=setTimeout(()=>{He(G)},300);return()=>clearTimeout(e)},[G]),(0,X.useEffect)(()=>{let e=e=>{Ge.current&&!Ge.current.contains(e.target)&&We(!1),Xe.current&&!Xe.current.contains(e.target)&&Je(!1),tt.current&&!tt.current.contains(e.target)&&et(!1),st.current&&!st.current.contains(e.target)&&ot(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let{data:Zt,isLoading:Qt,error:$t}=d({queryKey:[`ha-entities`,Ve],queryFn:()=>r.getHAEntities(Ve||void 0),enabled:o===`homeassistant`&&Xt,retry:!1,staleTime:0}),{data:tn}=d({queryKey:[`ha-sensor-entities`],queryFn:r.getHASensorEntities,enabled:o===`homeassistant`&&Xt,retry:!1,staleTime:0});(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e),Kt.current&&clearInterval(Kt.current)}},[t]);let nn=async()=>{Vt(!0),Gt([]),Ut({scanned:0,total:0}),bt(null);try{await r.startTasmotaScan();let e=async()=>{try{let e=await r.getTasmotaScanStatus();Ut({scanned:e.scanned,total:e.total}),Gt(await r.getDiscoveredTasmotaDevices()),e.running||(Vt(!1),Kt.current&&=(clearInterval(Kt.current),null))}catch(e){console.error(`Polling error:`,e)}};await e(),Kt.current=setInterval(e,500)}catch(e){Vt(!1),bt((e instanceof Error?e.message:typeof e==`string`?e:JSON.stringify(e))||n(`smartPlugs.failedToStartScan`))}},rn=async()=>{try{await r.stopTasmotaScan()}catch{}Vt(!1),Kt.current&&=(clearInterval(Kt.current),null)},an=e=>{h(e.ip_address),p(e.name),vt(null)},on=f({mutationFn:()=>r.testSmartPlugConnection(m,g||null,v||null),onSuccess:e=>{vt(e),bt(null),!c&&e.device_name&&p(e.device_name)},onError:e=>{vt(null),bt(e.message)}}),sn=f({mutationFn:e=>r.createSmartPlug(e),onSuccess:()=>{i.invalidateQueries({queryKey:[`smart-plugs`]}),i.invalidateQueries({queryKey:[`scriptPlugsByPrinter`]}),t()},onError:e=>{bt(e.message)}}),cn=f({mutationFn:t=>r.updateSmartPlug(e.id,t),onSuccess:()=>{i.invalidateQueries({queryKey:[`smart-plugs`]}),i.invalidateQueries({queryKey:[`scriptPlugsByPrinter`]}),t()},onError:e=>{bt(e.message)}}),ln=qt?.filter(t=>o===`tasmota`?!Jt?.some(n=>n.printer_id===t.id&&n.id!==e?.id&&n.plug_type===`tasmota`):!0),un=e=>{if(e.preventDefault(),bt(null),!c.trim()){bt(n(`smartPlugs.nameRequired`));return}if(o===`tasmota`&&!m.trim()){bt(`IP address is required for Tasmota plugs`);return}if(o===`homeassistant`&&!b){bt(n(`smartPlugs.entityRequired`));return}if(o===`mqtt`){let e=S.trim(),t=O.trim(),r=P.trim();if(!e&&!t&&!r){bt(n(`smartPlugs.mqttTopicRequired`));return}}if(o===`rest`&&!ie.trim()&&!se.trim()){bt(n(`smartPlugs.restUrlRequired`));return}let t={name:c.trim(),plug_type:o,ip_address:o===`tasmota`?m.trim():null,ha_entity_id:o===`homeassistant`?b:null,ha_power_entity:o===`homeassistant`&&Fe||null,ha_energy_today_entity:o===`homeassistant`&&Le||null,ha_energy_total_entity:o===`homeassistant`&&W||null,mqtt_power_topic:o===`mqtt`&&S.trim()||null,mqtt_power_path:o===`mqtt`&&w.trim()||null,mqtt_power_multiplier:o===`mqtt`&&parseFloat(E)||1,mqtt_energy_topic:o===`mqtt`&&O.trim()||null,mqtt_energy_path:o===`mqtt`&&A.trim()||null,mqtt_energy_multiplier:o===`mqtt`&&parseFloat(M)||1,mqtt_state_topic:o===`mqtt`&&P.trim()||null,mqtt_state_path:o===`mqtt`&&F.trim()||null,mqtt_state_on_value:o===`mqtt`&&I.trim()||null,rest_on_url:o===`rest`&&ie.trim()||null,rest_on_body:o===`rest`&&z.trim()||null,rest_off_url:o===`rest`&&se.trim()||null,rest_off_body:o===`rest`&&ce.trim()||null,rest_method:o===`rest`?ue:null,rest_headers:o===`rest`&&fe.trim()||null,rest_status_url:o===`rest`&&pe.trim()||null,rest_status_path:o===`rest`&&he.trim()||null,rest_status_on_value:o===`rest`&&_e.trim()||null,rest_power_url:o===`rest`&&ye.trim()||null,rest_power_path:o===`rest`&&H.trim()||null,rest_power_multiplier:o===`rest`&&parseFloat(Se)||1,rest_energy_url:o===`rest`&&we.trim()||null,rest_energy_path:o===`rest`&&Ee.trim()||null,rest_energy_multiplier:o===`rest`&&parseFloat(Oe)||1,rest_energy_total_path:o===`rest`&&je.trim()||null,rest_energy_total_multiplier:o===`rest`&&parseFloat(Ne)||1,username:o===`tasmota`&&g.trim()||null,password:o===`tasmota`&&v.trim()||null,printer_id:ct,controls_printer_power:ft,power_alert_enabled:xt,power_alert_high:wt?parseFloat(wt):null,power_alert_low:Et?parseFloat(Et):null,schedule_enabled:Ot,schedule_on_time:At||null,schedule_off_time:Mt||null,show_in_switchbar:Pt,show_on_printer_card:Lt};a?cn.mutate(t):sn.mutate(t)},J=sn.isPending||cn.isPending;return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-md max-h-[90vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(a?`smartPlugs.editTitle`:`smartPlugs.addTitle`)}),(0,Y.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`form`,{onSubmit:un,className:`p-6 space-y-4 overflow-y-auto`,children:[yt&&(0,Y.jsx)(`div`,{className:`p-3 bg-red-100 dark:bg-red-500/20 border border-red-400 dark:border-red-500/50 rounded-lg text-sm text-red-700 dark:text-red-400`,children:yt}),!a&&(0,Y.jsxs)(`div`,{className:`flex gap-2 mb-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{s(`tasmota`),vt(null),bt(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2.5 rounded-lg font-medium transition-colors ${o===`tasmota`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white border border-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(dt,{className:`w-4 h-4`}),`Tasmota`]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{s(`homeassistant`),vt(null),bt(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2.5 rounded-lg font-medium transition-colors ${o===`homeassistant`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white border border-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(Ft,{className:`w-4 h-4`}),`HA`]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{s(`mqtt`),vt(null),bt(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2.5 rounded-lg font-medium transition-colors ${o===`mqtt`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white border border-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(en,{className:`w-4 h-4`}),`MQTT`]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{s(`rest`),vt(null),bt(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2.5 rounded-lg font-medium transition-colors ${o===`rest`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white border border-bambu-dark-tertiary`}`,children:[(0,Y.jsx)(zt,{className:`w-4 h-4`}),`REST`]})]}),!a&&o===`tasmota`&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[Bt?(0,Y.jsxs)(K,{type:`button`,variant:`secondary`,onClick:rn,className:`w-full`,children:[(0,Y.jsx)(Re,{className:`w-4 h-4`}),n(`smartPlugs.stopScanning`)]}):(0,Y.jsxs)(K,{type:`button`,variant:`primary`,onClick:nn,className:`w-full`,children:[(0,Y.jsx)(Ae,{className:`w-4 h-4`}),n(`smartPlugs.discoverTasmota`)]}),Bt&&Ht.total>0&&(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsxs)(`div`,{className:`flex justify-between text-xs text-bambu-gray`,children:[(0,Y.jsx)(`span`,{children:n(`smartPlugs.addSmartPlug.scanningNetwork`)}),(0,Y.jsxs)(`span`,{children:[Ht.scanned,` / `,Ht.total]})]}),(0,Y.jsx)(`div`,{className:`w-full bg-bambu-dark-tertiary rounded-full h-2`,children:(0,Y.jsx)(`div`,{className:`bg-bambu-green h-2 rounded-full transition-all duration-300`,style:{width:`${Ht.scanned/Ht.total*100}%`}})})]}),Wt.length>0&&(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.foundDevices`,{count:Wt.length})}),(0,Y.jsx)(`div`,{className:`max-h-40 overflow-y-auto space-y-1`,children:Wt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>an(e),className:`w-full flex items-center justify-between p-2 bg-bambu-dark hover:bg-bambu-dark-tertiary rounded-lg transition-colors text-left border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(dt,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:e.name}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:e.ip_address})]})]}),e.state&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-xs ${e.state===`ON`?`text-bambu-green`:`text-bambu-gray`}`,children:[(0,Y.jsx)(Ct,{className:`w-3 h-3`}),e.state]})]},e.ip_address))})]}),!Bt&&Wt.length===0&&Ht.total>0&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray text-center py-2`,children:n(`smartPlugs.noDevicesFound`)})]}),o===`homeassistant`&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[!Xt&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`p-3 bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-400 dark:border-yellow-500/50 rounded-lg text-sm text-yellow-700 dark:text-yellow-400`,children:[n(`smartPlugs.haNotConfigured`),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:n(`smartPlugs.haSettingsPath`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1 opacity-50`,children:n(`smartPlugs.selectEntity`)}),(0,Y.jsx)(`select`,{disabled:!0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray cursor-not-allowed opacity-50`,children:(0,Y.jsx)(`option`,{children:n(`smartPlugs.addSmartPlug.chooseEntity`)})})]})]}),Xt&&(0,Y.jsxs)(Y.Fragment,{children:[Qt&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-center py-4 text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-5 h-5 animate-spin mr-2`}),n(`smartPlugs.loadingEntities`)]}),$t&&(0,Y.jsx)(`div`,{className:`p-3 bg-red-100 dark:bg-red-500/20 border border-red-400 dark:border-red-500/50 rounded-lg text-sm text-red-700 dark:text-red-400`,children:n(`smartPlugs.failedToLoadEntities`,{error:$t.message})}),(()=>{let t=Jt?.filter(t=>t.ha_entity_id&&t.id!==e?.id).map(e=>e.ha_entity_id)||[],r=(Zt||[]).filter(e=>!t.includes(e.entity_id)),i=Zt?.find(e=>e.entity_id===b);return(0,Y.jsxs)(`div`,{ref:Ge,className:`relative`,children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.selectEntity`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`}),(0,Y.jsx)(`input`,{type:`text`,value:Ue?G:i?`${i.friendly_name} (${i.entity_id})`:``,onChange:e=>{Be(e.target.value),Ue||We(!0)},onFocus:()=>{We(!0),Be(``)},placeholder:n(`smartPlugs.addSmartPlug.placeholders.searchEntities`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`}),b&&!Ue&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{x(``),Be(``)},className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-bambu-dark-tertiary rounded`,children:(0,Y.jsx)(Re,{className:`w-4 h-4 text-bambu-gray hover:text-white`})}),Qt&&(0,Y.jsx)(R,{className:`absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray animate-spin`})]}),Ue&&(0,Y.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-60 overflow-y-auto`,children:[Qt&&(0,Y.jsxs)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray flex items-center gap-2`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),n(`smartPlugs.loading`)]}),!Qt&&r.length===0&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:Ve?n(`smartPlugs.noEntitiesMatching`,{search:Ve}):n(`smartPlugs.noEntitiesAvailable`)}),!Qt&&r.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{x(e.entity_id),We(!1),Be(``),c||p(e.friendly_name)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary transition-colors ${e.entity_id===b?`bg-bambu-green/20 text-bambu-green`:`text-white`}`,children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:e.friendly_name}),(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{children:e.entity_id}),(0,Y.jsx)(`span`,{className:e.state===`on`?`text-bambu-green`:``,children:e.state})]})]},e.entity_id))]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(Ve?`smartPlugs.searchingEntities`:`smartPlugs.showingEntities`,{count:r.length})})]})})(),b&&tn&&tn.length>0&&(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4 mt-4 space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white font-medium mb-1`,children:n(`smartPlugs.energyMonitoringOptional`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-3`,children:n(`smartPlugs.energyMonitoringHint`)})]}),(()=>{let e=tn.filter(e=>e.unit_of_measurement===`W`||e.unit_of_measurement===`kW`||e.unit_of_measurement===`mW`),t=Ke?e.filter(e=>e.entity_id.toLowerCase().includes(Ke.toLowerCase())||e.friendly_name.toLowerCase().includes(Ke.toLowerCase())):e,r=tn.find(e=>e.entity_id===Fe);return(0,Y.jsxs)(`div`,{ref:Xe,className:`relative`,children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.powerSensorW`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`}),(0,Y.jsx)(`input`,{type:`text`,value:qe?Ke:r?`${r.friendly_name} (${r.state} ${r.unit_of_measurement})`:``,onChange:e=>{q(e.target.value),qe||Je(!0)},onFocus:()=>{Je(!0),q(``)},placeholder:n(`smartPlugs.addSmartPlug.placeholders.searchPowerSensors`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`}),Fe&&!qe&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{Ie(``),q(``)},className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-bambu-dark-tertiary rounded`,children:(0,Y.jsx)(Re,{className:`w-4 h-4 text-bambu-gray hover:text-white`})})]}),qe&&(0,Y.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{Ie(``),Je(!1),q(``)},className:`w-full px-3 py-2 text-left text-sm text-bambu-gray hover:bg-bambu-dark-tertiary`,children:n(`smartPlugs.none`)}),t.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{Ie(e.entity_id),Je(!1),q(``)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e.entity_id===Fe?`bg-bambu-green/20 text-bambu-green`:`text-white`}`,children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:e.friendly_name}),(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray`,children:[e.entity_id,` • `,e.state,` `,e.unit_of_measurement]})]},e.entity_id)),t.length===0&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:n(`smartPlugs.noMatchingSensors`)})]})]})})(),(()=>{let e=tn.filter(e=>e.unit_of_measurement===`kWh`||e.unit_of_measurement===`Wh`||e.unit_of_measurement===`MWh`),t=Ze?e.filter(e=>e.entity_id.toLowerCase().includes(Ze.toLowerCase())||e.friendly_name.toLowerCase().includes(Ze.toLowerCase())):e,r=tn.find(e=>e.entity_id===Le);return(0,Y.jsxs)(`div`,{ref:tt,className:`relative`,children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.energyTodayKwh`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`}),(0,Y.jsx)(`input`,{type:`text`,value:$e?Ze:r?`${r.friendly_name} (${r.state} ${r.unit_of_measurement})`:``,onChange:e=>{Qe(e.target.value),$e||et(!0)},onFocus:()=>{et(!0),Qe(``)},placeholder:n(`smartPlugs.addSmartPlug.placeholders.searchEnergySensors`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`}),Le&&!$e&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{U(``),Qe(``)},className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-bambu-dark-tertiary rounded`,children:(0,Y.jsx)(Re,{className:`w-4 h-4 text-bambu-gray hover:text-white`})})]}),$e&&(0,Y.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{U(``),et(!1),Qe(``)},className:`w-full px-3 py-2 text-left text-sm text-bambu-gray hover:bg-bambu-dark-tertiary`,children:n(`smartPlugs.none`)}),t.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{U(e.entity_id),et(!1),Qe(``)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e.entity_id===Le?`bg-bambu-green/20 text-bambu-green`:`text-white`}`,children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:e.friendly_name}),(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray`,children:[e.entity_id,` • `,e.state,` `,e.unit_of_measurement]})]},e.entity_id)),t.length===0&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:n(`smartPlugs.noMatchingSensors`)})]})]})})(),(()=>{let e=tn.filter(e=>e.unit_of_measurement===`kWh`||e.unit_of_measurement===`Wh`||e.unit_of_measurement===`MWh`),t=nt?e.filter(e=>e.entity_id.toLowerCase().includes(nt.toLowerCase())||e.friendly_name.toLowerCase().includes(nt.toLowerCase())):e,r=tn.find(e=>e.entity_id===W);return(0,Y.jsxs)(`div`,{ref:st,className:`relative`,children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.totalEnergyKwh`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`}),(0,Y.jsx)(`input`,{type:`text`,value:at?nt:r?`${r.friendly_name} (${r.state} ${r.unit_of_measurement})`:``,onChange:e=>{it(e.target.value),at||ot(!0)},onFocus:()=>{ot(!0),it(``)},placeholder:n(`smartPlugs.addSmartPlug.placeholders.searchEnergySensors`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`}),W&&!at&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{ze(``),it(``)},className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-bambu-dark-tertiary rounded`,children:(0,Y.jsx)(Re,{className:`w-4 h-4 text-bambu-gray hover:text-white`})})]}),at&&(0,Y.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{ze(``),ot(!1),it(``)},className:`w-full px-3 py-2 text-left text-sm text-bambu-gray hover:bg-bambu-dark-tertiary`,children:n(`smartPlugs.none`)}),t.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{ze(e.entity_id),ot(!1),it(``)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e.entity_id===W?`bg-bambu-green/20 text-bambu-green`:`text-white`}`,children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:e.friendly_name}),(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray`,children:[e.entity_id,` • `,e.state,` `,e.unit_of_measurement]})]},e.entity_id)),t.length===0&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:n(`smartPlugs.noMatchingSensors`)})]})]})})()]})]})]}),o===`mqtt`&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[!Yt?.mqtt_broker&&(0,Y.jsxs)(`div`,{className:`p-3 bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-400 dark:border-yellow-500/50 rounded-lg text-sm text-yellow-700 dark:text-yellow-400`,children:[n(`smartPlugs.mqttNotConfigured`),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:n(`smartPlugs.mqttSettingsPath`)}),` `,n(`smartPlugs.mqttNotConfiguredSuffix`)]}),Yt?.mqtt_broker&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`p-3 bg-blue-50 dark:bg-blue-500/10 border border-blue-300 dark:border-blue-500/30 rounded-lg text-sm text-blue-700 dark:text-blue-300`,children:[(0,Y.jsx)(`p`,{className:`font-medium mb-1`,children:n(`smartPlugs.monitorOnly`)}),(0,Y.jsx)(`p`,{className:`text-xs opacity-80`,children:n(`smartPlugs.mqttMonitorOnlyDescription`)})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium text-sm`,children:n(`smartPlugs.powerMonitoring`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.topic`)}),(0,Y.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:`zigbee2mqtt/shelly-working-room`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.jsonPath`)}),(0,Y.jsx)(`input`,{type:`text`,value:w,onChange:e=>T(e.target.value),placeholder:`power_l1`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.multiplier`)}),(0,Y.jsx)(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:`1`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,style:{whiteSpace:`pre-line`},children:n(`smartPlugs.mqttPowerHint`)})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`p`,{className:`text-white font-medium text-sm`,children:[n(`smartPlugs.energyMonitoring`),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,n(`smartPlugs.optional`),`)`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.topic`)}),(0,Y.jsx)(`input`,{type:`text`,value:O,onChange:e=>k(e.target.value),placeholder:`Same as power topic, or different`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.jsonPath`)}),(0,Y.jsx)(`input`,{type:`text`,value:A,onChange:e=>ee(e.target.value),placeholder:`energy_l1`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.multiplier`)}),(0,Y.jsx)(`input`,{type:`text`,value:M,onChange:e=>N(e.target.value),placeholder:`1`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,style:{whiteSpace:`pre-line`},children:n(`smartPlugs.mqttEnergyHint`)})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`p`,{className:`text-white font-medium text-sm`,children:[n(`smartPlugs.stateMonitoring`),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,n(`smartPlugs.optional`),`)`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.topic`)}),(0,Y.jsx)(`input`,{type:`text`,value:P,onChange:e=>te(e.target.value),placeholder:`Same as power topic, or different`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.jsonPath`)}),(0,Y.jsx)(`input`,{type:`text`,value:F,onChange:e=>ne(e.target.value),placeholder:`state_l1`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.onValue`)}),(0,Y.jsx)(`input`,{type:`text`,value:I,onChange:e=>re(e.target.value),placeholder:n(`smartPlugs.addSmartPlug.placeholders.mqttStateOnValue`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,style:{whiteSpace:`pre-line`},children:n(`smartPlugs.mqttStateHint`)})]})]})]}),o===`rest`&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium text-sm`,children:n(`smartPlugs.restControl`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restMethod`)}),(0,Y.jsxs)(`select`,{value:ue,onChange:e=>de(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`GET`,children:`GET`}),(0,Y.jsx)(`option`,{value:`POST`,children:`POST`}),(0,Y.jsx)(`option`,{value:`PUT`,children:`PUT`}),(0,Y.jsx)(`option`,{value:`PATCH`,children:`PATCH`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restOnUrl`)}),(0,Y.jsx)(`input`,{type:`text`,value:ie,onChange:e=>{ae(e.target.value),vt(null)},placeholder:`http://openhab:8080/rest/items/MyPlug`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[n(`smartPlugs.restOnBody`),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,n(`smartPlugs.optional`),`)`]})]}),(0,Y.jsx)(`input`,{type:`text`,value:z,onChange:e=>oe(e.target.value),placeholder:n(`smartPlugs.restBodyHint`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restOffUrl`)}),(0,Y.jsx)(`input`,{type:`text`,value:se,onChange:e=>{B(e.target.value),vt(null)},placeholder:`http://openhab:8080/rest/items/MyPlug`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[n(`smartPlugs.restOffBody`),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,n(`smartPlugs.optional`),`)`]})]}),(0,Y.jsx)(`input`,{type:`text`,value:ce,onChange:e=>le(e.target.value),placeholder:n(`smartPlugs.restBodyHint`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`p`,{className:`text-white font-medium text-sm`,children:[n(`smartPlugs.restHeaders`),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,n(`smartPlugs.optional`),`)`]})]}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`textarea`,{value:fe,onChange:e=>V(e.target.value),placeholder:n(`smartPlugs.restHeadersHint`),rows:2,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none font-mono text-sm`})})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`p`,{className:`text-white font-medium text-sm`,children:[n(`smartPlugs.stateMonitoring`),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,n(`smartPlugs.optional`),`)`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restStatusUrl`)}),(0,Y.jsx)(`input`,{type:`text`,value:pe,onChange:e=>me(e.target.value),placeholder:n(`smartPlugs.restStatusHint`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restStatusPath`)}),(0,Y.jsx)(`input`,{type:`text`,value:he,onChange:e=>ge(e.target.value),placeholder:n(`smartPlugs.restPathHint`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restStatusOnValue`)}),(0,Y.jsx)(`input`,{type:`text`,value:_e,onChange:e=>ve(e.target.value),placeholder:`ON`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`p`,{className:`text-white font-medium text-sm`,children:[n(`smartPlugs.energyMonitoring`),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,n(`smartPlugs.optional`),`)`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[n(`smartPlugs.restPowerUrl`),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,n(`smartPlugs.optional`),`)`]})]}),(0,Y.jsx)(`input`,{type:`text`,value:ye,onChange:e=>be(e.target.value),placeholder:n(`smartPlugs.restPowerUrlHint`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restPowerPath`)}),(0,Y.jsx)(`input`,{type:`text`,value:H,onChange:e=>xe(e.target.value),placeholder:n(`smartPlugs.restPathHint`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restPowerMultiplier`)}),(0,Y.jsx)(`input`,{type:`text`,value:Se,onChange:e=>Ce(e.target.value),placeholder:`1`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[n(`smartPlugs.restEnergyUrl`),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,n(`smartPlugs.optional`),`)`]})]}),(0,Y.jsx)(`input`,{type:`text`,value:we,onChange:e=>Te(e.target.value),placeholder:n(`smartPlugs.restEnergyUrlHint`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restEnergyPath`)}),(0,Y.jsx)(`input`,{type:`text`,value:Ee,onChange:e=>De(e.target.value),placeholder:n(`smartPlugs.restPathHint`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restEnergyMultiplier`)}),(0,Y.jsx)(`input`,{type:`text`,value:Oe,onChange:e=>ke(e.target.value),placeholder:`1`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.restEnergyHint`)}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restEnergyTotalPath`)}),(0,Y.jsx)(`input`,{type:`text`,value:je,onChange:e=>Me(e.target.value),placeholder:n(`smartPlugs.restEnergyTotalPathHint`),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.restEnergyTotalMultiplier`)}),(0,Y.jsx)(`input`,{type:`text`,value:Ne,onChange:e=>Pe(e.target.value),placeholder:`1`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.restEnergyTotalHint`)})]}),(ie.trim()||se.trim())&&(0,Y.jsx)(`div`,{className:`flex gap-2`,children:(0,Y.jsxs)(K,{type:`button`,variant:`secondary`,onClick:async()=>{vt(null);try{let e=ie.trim()||se.trim(),t=await r.testRESTConnection(e,ue,fe.trim()||null);vt({success:t.success}),t.success||bt(t.error||n(`smartPlugs.addSmartPlug.connectionFailed`))}catch{vt({success:!1}),bt(n(`smartPlugs.addSmartPlug.connectionFailed`))}},className:`w-full`,children:[(0,Y.jsx)(ht,{className:`w-4 h-4`}),n(`smartPlugs.testConnection`)]})}),gt&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm ${gt.success?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`}`,children:[gt.success?(0,Y.jsx)(j,{className:`w-4 h-4`}):(0,Y.jsx)(Ye,{className:`w-4 h-4`}),gt.success?n(`smartPlugs.connectionSuccess`):n(`smartPlugs.addSmartPlug.connectionFailed`)]})]}),o===`tasmota`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.ipAddress`)}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`input`,{type:`text`,value:m,onChange:e=>{h(e.target.value),vt(null)},placeholder:`192.168.1.100`,className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsxs)(K,{type:`button`,variant:`secondary`,onClick:()=>on.mutate(),disabled:!m.trim()||on.isPending,children:[on.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(ht,{className:`w-4 h-4`}),n(`smartPlugs.test`)]})]})]}),o===`tasmota`&>&&(0,Y.jsx)(`div`,{className:`p-3 rounded-lg flex items-center gap-2 ${gt.success?`bg-bambu-green/20 border border-bambu-green/50 text-bambu-green`:`bg-red-100 dark:bg-red-500/20 border border-red-400 dark:border-red-500/50 text-red-700 dark:text-red-400`}`,children:gt.success?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j,{className:`w-5 h-5`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:n(`smartPlugs.connectedResult`)}),(0,Y.jsxs)(`p`,{className:`text-sm opacity-80`,children:[gt.device_name&&n(`smartPlugs.deviceLabel`,{name:gt.device_name}),n(`smartPlugs.stateLabel`,{state:gt.state})]})]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ye,{className:`w-5 h-5`}),(0,Y.jsx)(`span`,{children:n(`smartPlugs.addSmartPlug.connectionFailed`)})]})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.nameLabel`)}),(0,Y.jsx)(`input`,{type:`text`,value:c,onChange:e=>p(e.target.value),placeholder:n(`smartPlugs.addSmartPlug.placeholders.plugName`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),o===`tasmota`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.username`)}),(0,Y.jsx)(`input`,{type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:`admin`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.password`)}),(0,Y.jsx)(`input`,{type:`password`,value:v,onChange:e=>y(e.target.value),placeholder:`********`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray -mt-2`,children:n(`smartPlugs.authHint`)})]}),o!==`mqtt`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.linkToPrinter`)}),(0,Y.jsxs)(`select`,{value:ct??``,onChange:e=>ut(e.target.value?Number(e.target.value):null),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`smartPlugs.noPrinter`)}),ln?.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`smartPlugs.linkingDescription`)}),ct!==null&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mt-3`,children:[(0,Y.jsxs)(`div`,{className:`pr-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`smartPlugs.controlsPrinterPower`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.controlsPrinterPowerDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer shrink-0`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:ft,onChange:e=>pt(e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]}),(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(rt,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsx)(`span`,{className:`text-white font-medium`,children:n(`smartPlugs.powerAlerts`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:xt,onChange:e=>St(e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),xt&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.alertAbove`)}),(0,Y.jsx)(`input`,{type:`number`,value:wt,onChange:e=>Tt(e.target.value),placeholder:`e.g. 200`,min:`0`,max:`5000`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.alertBelow`)}),(0,Y.jsx)(`input`,{type:`number`,value:Et,onChange:e=>Dt(e.target.value),placeholder:`e.g. 10`,min:`0`,max:`5000`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.alertDescription`)})]})]}),o!==`mqtt`&&(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(lt,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsx)(`span`,{className:`text-white font-medium`,children:n(`smartPlugs.dailySchedule`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Ot,onChange:e=>kt(e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),Ot&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.turnOnAt`)}),(0,Y.jsx)(`input`,{type:`time`,value:At,onChange:e=>jt(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`smartPlugs.turnOffAt`)}),(0,Y.jsx)(`input`,{type:`time`,value:Mt,onChange:e=>Nt(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.scheduleDescription`)})]})]}),(0,Y.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(L,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white font-medium`,children:n(`smartPlugs.showInSwitchbar`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.quickAccessSidebar`)})]})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Pt,onChange:e=>It(e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})}),o===`homeassistant`&&(0,Y.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(mt,{className:`w-4 h-4 text-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white font-medium`,children:n(`smartPlugs.showOnPrinterCard`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`smartPlugs.displayOnPrinterCard`)})]})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Lt,onChange:e=>Rt(e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})}),(0,Y.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,Y.jsx)(K,{type:`button`,variant:`secondary`,onClick:t,className:`flex-1`,children:n(`smartPlugs.cancel`)}),(0,Y.jsxs)(K,{type:`submit`,disabled:J,className:`flex-1`,children:[J?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(_t,{className:`w-4 h-4`}),n(a?`smartPlugs.save`:`smartPlugs.add`)]})]})]})]})})}function mr({sensor:e,printers:t,onClose:n}){let{t:i}=l(),a=u(),{showToast:o}=ee(),s=!!e,[c,p]=(0,X.useState)(e?.printer_id??t[0]?.id??``),[m,h]=(0,X.useState)(e?.entity_id??``),[g,_]=(0,X.useState)(e?.kind??`binary`),[v,y]=(0,X.useState)(e?.device_class??null),[b,S]=(0,X.useState)(e?.unit??null),[C,w]=(0,X.useState)(e?.name??``),[T,E]=(0,X.useState)(e?.alert_state??``),[D,O]=(0,X.useState)(e?.alert_above?.toString()??``),[k,A]=(0,X.useState)(e?.alert_below?.toString()??``),[j,M]=(0,X.useState)(e?.show_on_printer_card??!0),[N,P]=(0,X.useState)(e?.notify_on_alert??!1),[te,F]=(0,X.useState)(e?.block_print??!1),[I,re]=(0,X.useState)(``),[ie,L]=(0,X.useState)(null);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);let{data:ae}=d({queryKey:[`settings`],queryFn:r.getSettings}),z=!!(ae?.ha_enabled&&ae?.ha_url&&ae?.ha_token),{data:oe,isLoading:se,error:B}=d({queryKey:[`bindableHAEntities`],queryFn:()=>r.getBindableHAEntities(),enabled:z}),ce=(0,X.useMemo)(()=>{let e=I.trim().toLowerCase(),t=oe??[];return e?t.filter(t=>t.entity_id.toLowerCase().includes(e)||t.friendly_name.toLowerCase().includes(e)):t},[oe,I]),le=e=>{h(e.entity_id),y(e.device_class),S(e.unit_of_measurement);let t=e.domain===`binary_sensor`?`binary`:`numeric`;_(t),t===`numeric`?E(``):(O(``),A(``)),C.trim()||w(e.friendly_name.slice(0,100))},ue=()=>{a.invalidateQueries({queryKey:[`haSensors`]}),a.invalidateQueries({queryKey:[`haSensorReadings`]})},de=f({mutationFn:()=>{let t={name:C.trim(),entity_id:m,kind:g,device_class:v,unit:b,alert_state:g===`binary`&&T?T:null,alert_above:g===`numeric`&&D!==``?Number(D):null,alert_below:g===`numeric`&&k!==``?Number(k):null,block_print:te,notify_on_alert:N,show_on_printer_card:j};return s?r.updateHASensor(e.id,t):r.createHASensor({...t,printer_id:Number(c)})},onSuccess:()=>{ue(),o(i(s?`haSensors.toast.updated`:`haSensors.toast.created`),`success`),n()},onError:e=>L(e.message)}),fe=f({mutationFn:()=>r.deleteHASensor(e.id),onSuccess:()=>{ue(),o(i(`haSensors.toast.deleted`),`success`),n()},onError:e=>L(e.message)}),V=g===`binary`?T!==``:D!==``||k!==``,pe=e=>{if(e.preventDefault(),L(null),!m)return L(i(`haSensors.error.pickEntity`));if(!C.trim())return L(i(`haSensors.error.nameRequired`));if(c===``)return L(i(`haSensors.error.printerRequired`));if((te||N)&&!V)return L(i(`haSensors.error.alertRequired`));de.mutate()},me=x[v??``],he=e=>{let t=me?.[e]??e;return i(`haSensors.states.${t}`,{defaultValue:t})},ge=de.isPending||fe.isPending;return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:n,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`p-2 rounded-full bg-bambu-green/20 text-bambu-green`,children:(0,Y.jsx)(ne,{className:`w-5 h-5`})}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(s?`haSensors.editTitle`:`haSensors.addTitle`)})]}),(0,Y.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`form`,{onSubmit:pe,className:`p-6 space-y-4`,children:[ie&&(0,Y.jsx)(`div`,{className:`p-3 bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/50 rounded-lg text-sm text-red-700 dark:text-red-400`,children:ie}),!s&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`haSensors.printer`)}),(0,Y.jsx)(`select`,{value:c,onChange:e=>p(e.target.value===``?``:Number(e.target.value)),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`,children:t.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),!z&&(0,Y.jsxs)(`div`,{className:`p-3 bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-400 dark:border-yellow-500/50 rounded-lg text-sm text-yellow-700 dark:text-yellow-400`,children:[i(`smartPlugs.haNotConfigured`),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:i(`smartPlugs.haSettingsPath`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1 ${z?``:`opacity-50`}`,children:i(`haSensors.entity`)}),B&&(0,Y.jsx)(`div`,{className:`p-3 mb-2 bg-red-100 dark:bg-red-500/20 rounded-lg text-sm text-red-700 dark:text-red-400`,children:B.message}),(0,Y.jsxs)(`div`,{className:`relative mb-2`,children:[(0,Y.jsx)(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Y.jsx)(`input`,{type:`text`,value:I,onChange:e=>re(e.target.value),placeholder:i(`haSensors.searchPlaceholder`),disabled:!z,className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed`})]}),(0,Y.jsxs)(`div`,{className:`max-h-44 overflow-y-auto rounded-lg border border-bambu-dark-tertiary ${z?``:`opacity-50`}`,children:[!z&&(0,Y.jsx)(`div`,{className:`p-3 text-sm text-bambu-gray`,children:i(`haSensors.noEntities`)}),z&&se&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 p-3 text-sm text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),i(`common.loading`)]}),z&&!se&&ce.length===0&&(0,Y.jsx)(`div`,{className:`p-3 text-sm text-bambu-gray`,children:i(`haSensors.noEntities`)}),z&&!se&&ce.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>le(e),className:`w-full text-left px-3 py-2 text-sm transition-colors ${e.entity_id===m?`bg-bambu-green/20 text-bambu-green`:`text-white hover:bg-bambu-dark`}`,children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:e.friendly_name}),(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray`,children:[e.entity_id,e.state!==null&&` — ${e.state}`,e.unit_of_measurement?` ${e.unit_of_measurement}`:``]})]},e.entity_id))]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`haSensors.name`)}),(0,Y.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`haSensors.alertWhen`)}),g===`binary`?(0,Y.jsxs)(`select`,{value:T,onChange:e=>E(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`,children:[(0,Y.jsx)(`option`,{value:``,children:i(`haSensors.alertNever`)}),(0,Y.jsx)(`option`,{value:`on`,children:he(`on`)}),(0,Y.jsx)(`option`,{value:`off`,children:he(`off`)})]}):(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:[i(`haSensors.alertAbove`),` `,b??``]}),(0,Y.jsx)(`input`,{type:`number`,step:`any`,value:D,onChange:e=>O(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:[i(`haSensors.alertBelow`),` `,b??``]}),(0,Y.jsx)(`input`,{type:`number`,step:`any`,value:k,onChange:e=>A(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-bambu-gray`,children:i(`haSensors.alertHint`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:j,onChange:e=>M(e.target.checked),className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:i(`haSensors.showOnCard`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>P(e.target.checked),disabled:!V,className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`text-sm ${V?`text-white`:`text-bambu-gray`}`,children:i(`haSensors.notifyOnAlert`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:te,onChange:e=>F(e.target.checked),disabled:!V,className:`w-4 h-4 mt-0.5`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block text-sm ${V?`text-white`:`text-bambu-gray`}`,children:i(`haSensors.blockPrint`)}),(0,Y.jsx)(`span`,{className:`block text-xs text-bambu-gray`,children:i(`haSensors.blockPrintHint`)})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between pt-2`,children:[s?(0,Y.jsx)(K,{type:`button`,variant:`danger`,onClick:()=>fe.mutate(),disabled:ge,children:i(`common.delete`)}):(0,Y.jsx)(`span`,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(K,{type:`button`,variant:`secondary`,onClick:n,disabled:ge,children:i(`common.cancel`)}),(0,Y.jsxs)(K,{type:`submit`,disabled:ge||!z&&!s,children:[ge?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(_t,{className:`w-4 h-4`}),i(`common.save`)]})]})]})]})]})})}function hr(e){return e===`temperature`?`temperature`:e===`humidity`?`humidity`:e===`battery`?`battery`:null}var gr={temperature:`temperature`,humidity:`humidity`,battery:`battery`};function _r(e,t,n){let r=gr[t];if(!e.toLowerCase().endsWith(r))return[];let i=e.slice(0,e.length-r.length),a=[];return Object.keys(gr).forEach(e=>{if(e===t)return;let r=`${i}${gr[e]}`.toLowerCase(),o=n.find(e=>e.entity_id.toLowerCase()===r);o&&a.push(o)}),a}function vr({sensor:e,locations:t,onClose:n}){let{t:i}=l(),a=u(),{showToast:o}=ee(),s=!!e,[c,p]=(0,X.useState)(e?.location_id??t[0]?.id??``),[m,h]=(0,X.useState)(e?.entity_id??``),[g,_]=(0,X.useState)(e?.kind??`numeric`),[v,y]=(0,X.useState)(e?.device_class??null),[b,S]=(0,X.useState)(e?.unit??null),[C,w]=(0,X.useState)(e?.name??``),T=(0,X.useRef)(e?.name??``),[E,D]=(0,X.useState)(e?.alert_state??``),[O,k]=(0,X.useState)(e?.alert_above?.toString()??``),[A,j]=(0,X.useState)(e?.alert_below?.toString()??``),[M,N]=(0,X.useState)(e?.notify_on_alert??!1),[P,te]=(0,X.useState)(e?.show_on_card??!0),[F,I]=(0,X.useState)(``),[re,ie]=(0,X.useState)(null),[L,ae]=(0,X.useState)(!1),[z,oe]=(0,X.useState)(!1),[se,B]=(0,X.useState)(null),[ce,le]=(0,X.useState)(!1),[de,fe]=(0,X.useState)([]),[V,pe]=(0,X.useState)({}),{data:me}=d({queryKey:[`settings`],queryFn:r.getSettings}),ge=!!(me?.ha_enabled&&me?.ha_url&&me?.ha_token),{data:_e,isLoading:ve,error:ye}=d({queryKey:[`bindableLocationHAEntities`],queryFn:()=>r.getBindableLocationHAEntities(),enabled:ge}),be=(0,X.useMemo)(()=>(_e??[]).filter(e=>hr(e.device_class)!==null),[_e]),{data:H}=d({queryKey:[`locationHaSensors`],queryFn:()=>r.getLocationHASensors()}),xe=be.find(e=>e.entity_id===m),Se=(0,X.useMemo)(()=>{let e=F.trim().toLowerCase(),t=be??[],n=e?t.filter(t=>t.entity_id.toLowerCase().includes(e)||t.friendly_name.toLowerCase().includes(e)):t;return!xe||n[0]?.entity_id===xe.entity_id?n:[xe,...n.filter(e=>e.entity_id!==xe.entity_id)]},[be,F,xe]),Ce=e=>{h(e.entity_id),y(e.device_class),S(e.unit_of_measurement?.slice(0,16)??null);let t=e.domain===`binary_sensor`?`binary`:`numeric`;if(_(t),t===`numeric`?D(``):(k(``),j(``)),C===T.current){let t=e.friendly_name.slice(0,100);w(t),T.current=t}if(!s){let n=hr(e.device_class);if(n){let e=he(me?.location_sensor_alert_defaults)[n];t===`numeric`&&(k(n===`battery`?``:e.alertAbove),j(e.alertBelow)),N(e.notifyOnAlert),te(e.showOnCard)}}},we=()=>{a.invalidateQueries({queryKey:[`locationHaSensors`]}),a.invalidateQueries({queryKey:[`locationHaSensorReadings`]})},Te=()=>({name:C.trim(),entity_id:m,kind:g,device_class:v,unit:b,alert_state:g===`binary`&&E?E:null,alert_above:g===`numeric`&&hr(v)!==`battery`&&O!==``?Number(O):null,alert_below:g===`numeric`&&A!==``?Number(A):null,notify_on_alert:M,show_on_card:P}),Ee=f({mutationFn:()=>{let t=Te();return s?r.updateLocationHASensor(e.id,t):r.createLocationHASensor({...t,location_id:Number(c)})},onSuccess:()=>{we(),o(i(s?`locationHaSensors.toast.updated`:`locationHaSensors.toast.created`),`success`),n()},onError:e=>ie(e.message)}),De=f({mutationFn:async()=>{let e=Number(c);await r.createLocationHASensor({...Te(),location_id:e});let t=he(me?.location_sensor_alert_defaults),n=de.filter(e=>V[e.entity_id]);for(let i of n){let n=hr(i.device_class),a=n?t[n]:null;await r.createLocationHASensor({name:i.friendly_name.slice(0,100),entity_id:i.entity_id,kind:i.domain===`binary_sensor`?`binary`:`numeric`,device_class:i.device_class,unit:i.unit_of_measurement?.slice(0,16)??null,alert_state:null,alert_above:n!==`battery`&&a&&a.alertAbove!==``?Number(a.alertAbove):null,alert_below:a&&a.alertBelow!==``?Number(a.alertBelow):null,notify_on_alert:a?.notifyOnAlert??!1,show_on_card:a?.showOnCard??P,location_id:e})}return n},onSuccess:e=>{we(),le(!1),e.length>0?o(i(`locationHaSensors.autoAdd.added`,{names:e.map(e=>e.entity_id).join(`, `)}),`success`):o(i(`locationHaSensors.toast.created`),`success`),n()},onError:e=>{we(),le(!1),ie(e.message)}}),Oe=f({mutationFn:()=>r.deleteLocationHASensor(e.id),onSuccess:()=>{we(),o(i(`locationHaSensors.toast.deleted`),`success`),n()},onError:e=>ie(e.message)}),ke=f({mutationFn:()=>r.updateLocationHASensor(se.id,Te()),onSuccess:()=>{we(),oe(!1),B(null),o(i(`locationHaSensors.toast.updated`),`success`),n()},onError:e=>{oe(!1),B(null),ie(e.message)}}),je=g===`binary`?E!==``:O!==``||A!==``,Me=e=>{if(e.preventDefault(),ie(null),!m)return ie(i(`haSensors.error.pickEntity`));if(!C.trim())return ie(i(`haSensors.error.nameRequired`));if(c===``)return ie(i(`locationHaSensors.error.locationRequired`));if(M&&!je)return ie(i(`haSensors.error.alertRequired`));if(!s){let e=(H??[]).filter(e=>e.location_id===Number(c)),t=hr(v);if(t){let n=e.find(e=>hr(e.device_class)===t);if(n){B(n),oe(!0);return}}if(e.length===0&&t){let e=_r(m,t,be);if(e.length>0){fe(e),pe(Object.fromEntries(e.map(e=>[e.entity_id,!0]))),le(!0);return}o(i(`locationHaSensors.autoAdd.noneFound`),`info`)}}Ee.mutate()},Ne=x[v??``],Pe=e=>{let t=Ne?.[e]??e;return i(`haSensors.states.${t}`,{defaultValue:t})},Fe=Ee.isPending||Oe.isPending||ke.isPending||De.isPending,Ie=t.find(e=>e.id===Number(c));return(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!Fe&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,Fe]),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:()=>{Fe||n()},children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`p-2 rounded-full bg-bambu-green/20 text-bambu-green`,children:(0,Y.jsx)(ne,{className:`w-5 h-5`})}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(s?`locationHaSensors.editTitle`:`locationHaSensors.addTitle`)})]}),(0,Y.jsx)(`button`,{onClick:n,disabled:Fe,className:`text-bambu-gray hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`form`,{onSubmit:Me,className:`p-6 space-y-4`,children:[re&&(0,Y.jsx)(`div`,{className:`p-3 bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/50 rounded-lg text-sm text-red-700 dark:text-red-400`,children:re}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`locationHaSensors.location`)}),s?(0,Y.jsx)(`div`,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`,children:t.find(t=>t.id===e.location_id)?.name??i(`locationHaSensors.unknownLocation`)}):(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`select`,{value:c,onChange:e=>p(e.target.value===``?``:Number(e.target.value)),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`,children:t.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>ae(!0),className:`p-2 rounded-lg bg-bambu-dark-tertiary hover:bg-bambu-gray-dark text-white transition-colors shrink-0`,title:i(`locations.add`),"aria-label":i(`locations.add`),children:(0,Y.jsx)(wt,{className:`w-4 h-4`})})]})]}),!ge&&(0,Y.jsxs)(`div`,{className:`p-3 bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-400 dark:border-yellow-500/50 rounded-lg text-sm text-yellow-700 dark:text-yellow-400`,children:[i(`smartPlugs.haNotConfigured`),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:i(`smartPlugs.haSettingsPath`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1 ${ge?``:`opacity-50`}`,children:i(`haSensors.entity`)}),ye&&(0,Y.jsx)(`div`,{className:`p-3 mb-2 bg-red-100 dark:bg-red-500/20 rounded-lg text-sm text-red-700 dark:text-red-400`,children:ye.message}),(0,Y.jsxs)(`div`,{className:`relative mb-2`,children:[(0,Y.jsx)(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Y.jsx)(`input`,{type:`text`,value:F,onChange:e=>I(e.target.value),placeholder:i(`haSensors.searchPlaceholder`),disabled:!ge,className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed`})]}),(0,Y.jsxs)(`div`,{className:`max-h-44 overflow-y-auto rounded-lg border border-bambu-dark-tertiary ${ge?``:`opacity-50`}`,children:[m&&!xe&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-sm bg-bambu-green/10 text-bambu-green border-b border-bambu-dark-tertiary`,children:i(`locationHaSensors.currentlyBound`,{entity:m})}),!ge&&(0,Y.jsx)(`div`,{className:`p-3 text-sm text-bambu-gray`,children:i(`haSensors.noEntities`)}),ge&&ve&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 p-3 text-sm text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),i(`common.loading`)]}),ge&&!ve&&Se.length===0&&(0,Y.jsx)(`div`,{className:`p-3 text-sm text-bambu-gray`,children:i(`haSensors.noEntities`)}),ge&&!ve&&Se.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>Ce(e),className:`w-full text-left px-3 py-2 text-sm transition-colors ${e.entity_id===m?`bg-bambu-green/20 text-bambu-green`:`text-white hover:bg-bambu-dark`}`,children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:e.friendly_name}),(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray`,children:[e.entity_id,e.state!==null&&` — ${e.state}`,e.unit_of_measurement?` ${e.unit_of_measurement}`:``]})]},e.entity_id))]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,htmlFor:`location-ha-sensor-name`,children:i(`haSensors.name`)}),(0,Y.jsx)(`input`,{id:`location-ha-sensor-name`,type:`text`,value:C,onChange:e=>w(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]}),m&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`haSensors.alertWhen`)}),g===`binary`?(0,Y.jsxs)(`select`,{value:E,onChange:e=>D(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`,children:[(0,Y.jsx)(`option`,{value:``,children:i(`haSensors.alertNever`)}),(0,Y.jsx)(`option`,{value:`on`,children:Pe(`on`)}),(0,Y.jsx)(`option`,{value:`off`,children:Pe(`off`)})]}):hr(v)===`battery`?(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:[i(`haSensors.alertBelow`),` `,b??``]}),(0,Y.jsx)(`input`,{type:`number`,step:`any`,value:A,onChange:e=>j(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]}):(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:[i(`haSensors.alertAbove`),` `,b??``]}),(0,Y.jsx)(`input`,{type:`number`,step:`any`,value:O,onChange:e=>k(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:[i(`haSensors.alertBelow`),` `,b??``]}),(0,Y.jsx)(`input`,{type:`number`,step:`any`,value:A,onChange:e=>j(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-bambu-gray`,children:i(`haSensors.alertHint`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:P,onChange:e=>te(e.target.checked),className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:i(`locationHaSensors.showOnCard`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:M,onChange:e=>N(e.target.checked),disabled:!je,className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`text-sm ${je?`text-white`:`text-bambu-gray`}`,children:i(`haSensors.notifyOnAlert`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between pt-2`,children:[s?(0,Y.jsx)(K,{type:`button`,variant:`danger`,onClick:()=>Oe.mutate(),disabled:Fe,children:i(`common.delete`)}):(0,Y.jsx)(`span`,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(K,{type:`button`,variant:`secondary`,onClick:n,disabled:Fe,children:i(`common.cancel`)}),(0,Y.jsxs)(K,{type:`submit`,disabled:Fe||!ge&&!s,children:[Fe?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(_t,{className:`w-4 h-4`}),i(`common.save`)]})]})]})]})]})}),z&&se&&(0,Y.jsx)(Tt,{title:i(`locationHaSensors.overwriteConfirm.title`),message:i(`locationHaSensors.overwriteConfirm.message${hr(se.device_class)===`humidity`?`Humidity`:hr(se.device_class)===`battery`?`Battery`:`Temperature`}`,{location:Ie?.name??``,name:se.name}),variant:`warning`,overlayZIndex:`z-[110]`,isLoading:ke.isPending,onConfirm:()=>ke.mutate(),onCancel:()=>{oe(!1),B(null)}}),ce&&de.length>0&&(0,Y.jsx)(Tt,{title:i(`locationHaSensors.autoAdd.confirmTitle`),message:i(`locationHaSensors.autoAdd.confirmMessage`),overlayZIndex:`z-[110]`,isLoading:De.isPending,confirmDisabled:!de.some(e=>V[e.entity_id]),onConfirm:()=>De.mutate(),cancelText:i(`locationHaSensors.autoAdd.onlyThisOne`),onCancel:()=>{le(!1),fe([]),pe({}),Ee.mutate()},children:(0,Y.jsx)(`div`,{className:`space-y-2`,children:de.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:V[e.entity_id]??!0,onChange:t=>pe(n=>({...n,[e.entity_id]:t.target.checked})),className:`w-4 h-4`}),(0,Y.jsxs)(`span`,{className:`text-sm text-white`,children:[e.friendly_name,(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[` — `,e.entity_id]})]})]},e.entity_id))})}),L&&(0,Y.jsx)(ue,{open:L,onClose:()=>ae(!1),onPickLocation:e=>{p(e),ae(!1)},startCreating:!0})]})}var yr=60,br=120,xr={temperature:Fe,humidity:y,battery:_},Sr={temperature:`°C`,humidity:`%`,battery:`%`};function Cr(e){return e===`temperature`?`temperature`:e===`humidity`?`humidity`:e===`battery`?`battery`:null}function wr({category:e,state:t,onChange:n}){let{t:r}=l(),i=xr[e],a=Sr[e],o=t.alertAbove!==``||t.alertBelow!==``;return(0,Y.jsxs)(`div`,{className:`p-3 border border-bambu-dark-tertiary rounded-lg space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm text-white font-medium`,children:[(0,Y.jsx)(i,{className:`w-4 h-4`}),r(`inventory.${e}`)]}),e===`battery`?(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:[r(`haSensors.alertBelow`),` `,a]}),(0,Y.jsx)(`input`,{type:`number`,step:`any`,value:t.alertBelow,onChange:e=>n({alertBelow:e.target.value}),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]}):(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:[r(`haSensors.alertAbove`),` `,a]}),(0,Y.jsx)(`input`,{type:`number`,step:`any`,value:t.alertAbove,onChange:e=>n({alertAbove:e.target.value}),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:[r(`haSensors.alertBelow`),` `,a]}),(0,Y.jsx)(`input`,{type:`number`,step:`any`,value:t.alertBelow,onChange:e=>n({alertBelow:e.target.value}),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t.showOnCard,onChange:e=>n({showOnCard:e.target.checked}),className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:r(`locationHaSensors.showOnCard`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t.notifyOnAlert,onChange:e=>n({notifyOnAlert:e.target.checked}),disabled:!o,className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`text-sm ${o?`text-white`:`text-bambu-gray`}`,children:r(`haSensors.notifyOnAlert`)})]})]})}function Tr({onClose:e}){let{t}=l(),{showToast:n}=ee(),i=u(),[a,o]=(0,X.useState)(()=>he()),[s,c]=(0,X.useState)(()=>se()),[p,m]=(0,X.useState)(()=>me()),[h,g]=(0,X.useState)(()=>_e()),[_,v]=(0,X.useState)(()=>fe()),[y,b]=(0,X.useState)(!1),{data:x}=d({queryKey:[`settings`],queryFn:r.getSettings}),[S,C]=(0,X.useState)(br),w=(0,X.useRef)(!1),T=(0,X.useRef)(new Set);(0,X.useEffect)(()=>{if(!x||w.current)return;w.current=!0,T.current.has(`pollInterval`)||C(x.location_sensor_poll_interval);let e=he(x.location_sensor_alert_defaults);o(t=>{let n={...e};return Object.keys(n).forEach(e=>{T.current.has(e)&&(n[e]=t[e])}),n})},[x]);let E=(e,t)=>{T.current.add(e),o(n=>({...n,[e]:{...n[e],...t}}))},D=e=>{T.current.add(`pollInterval`),C(e)},O=async()=>{let e=Math.max(yr,S),t=pe({...a,battery:{...a.battery,alertAbove:``}}),n={};x&&e!==x.location_sensor_poll_interval&&(n.location_sensor_poll_interval=e),x&&t!==x.location_sensor_alert_defaults&&(n.location_sensor_alert_defaults=t),Object.keys(n).length>0&&(await r.updateSettings(n),i.invalidateQueries({queryKey:[`settings`]})),ge(a),le(s),V(p),be(h),ce(_)},k=f({mutationFn:O,onSuccess:()=>{n(t(`locationHaSensors.options.saved`),`success`),e()},onError:e=>{n(e.message||t(`locationHaSensors.options.saveFailed`),`error`)}}),A=e=>{e.preventDefault(),k.mutate()},j=f({mutationFn:async()=>{let[e,t]=await Promise.all([r.getLocationHASensors(),r.getBindableLocationHAEntities()]),n=new Map(t.map(e=>[e.entity_id,e.friendly_name])),i=e.filter(e=>Cr(e.device_class)!==null);return await Promise.all(i.map(e=>{let t=Cr(e.device_class),i=a[t],o=n.get(e.entity_id);return r.updateLocationHASensor(e.id,{...o?{name:o.slice(0,100)}:{},alert_above:t!==`battery`&&i.alertAbove!==``?Number(i.alertAbove):null,alert_below:i.alertBelow===``?null:Number(i.alertBelow),notify_on_alert:i.notifyOnAlert,show_on_card:i.showOnCard})})),await O(),i.length},onSuccess:r=>{i.invalidateQueries({queryKey:[`locationHaSensors`]}),i.invalidateQueries({queryKey:[`locationHaSensorReadings`]}),n(t(`locationHaSensors.options.resetDone`,{count:r}),`success`),b(!1),e()},onError:e=>{n(e.message||t(`locationHaSensors.options.resetFailed`),`error`),b(!1)}});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:e,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`p-2 rounded-full bg-bambu-green/20 text-bambu-green`,children:(0,Y.jsx)(je,{className:`w-5 h-5`})}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:t(`locationHaSensors.options.title`)})]}),(0,Y.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`form`,{onSubmit:A,className:`px-6 pb-6 pt-3 space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:t(`locationHaSensors.options.description`)}),(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(wr,{category:`temperature`,state:a.temperature,onChange:e=>E(`temperature`,e)}),(0,Y.jsx)(wr,{category:`humidity`,state:a.humidity,onChange:e=>E(`humidity`,e)}),(0,Y.jsx)(wr,{category:`battery`,state:a.battery,onChange:e=>E(`battery`,e)})]}),(0,Y.jsxs)(`div`,{className:`p-3 border border-bambu-dark-tertiary rounded-lg space-y-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:t(`locationHaSensors.options.colorizeValues`)})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-3 gap-x-3 gap-y-1 items-end ${s?``:`opacity-50`}`,children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray`,htmlFor:`location-sensor-below-color`,children:t(`locationHaSensors.options.belowColor`)}),(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray`,htmlFor:`location-sensor-optimal-color`,children:t(`locationHaSensors.options.optimalColor`)}),(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray`,htmlFor:`location-sensor-above-color`,children:t(`locationHaSensors.options.aboveColor`)}),(0,Y.jsx)(`select`,{id:`location-sensor-below-color`,value:h,onChange:e=>g(e.target.value),disabled:!s,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white disabled:cursor-not-allowed`,children:ye.map(e=>(0,Y.jsx)(`option`,{value:e,children:t(`locationHaSensors.options.colors.${e}`)},e))}),(0,Y.jsx)(`select`,{id:`location-sensor-optimal-color`,value:_,onChange:e=>v(e.target.value),disabled:!s,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white disabled:cursor-not-allowed`,children:ye.map(e=>(0,Y.jsx)(`option`,{value:e,children:t(`locationHaSensors.options.colors.${e}`)},e))}),(0,Y.jsx)(`select`,{id:`location-sensor-above-color`,value:p,onChange:e=>m(e.target.value),disabled:!s,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white disabled:cursor-not-allowed`,children:ye.map(e=>(0,Y.jsx)(`option`,{value:e,children:t(`locationHaSensors.options.colors.${e}`)},e))})]})]}),(0,Y.jsx)(`div`,{className:`pt-4 mt-4 border-t border-bambu-dark-tertiary`,children:(0,Y.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wider mb-3`,children:t(`locationHaSensors.options.generalSettings`)})}),(0,Y.jsxs)(`div`,{className:`p-3 border border-bambu-dark-tertiary rounded-lg space-y-2`,children:[(0,Y.jsx)(`label`,{className:`block text-sm text-white`,htmlFor:`location-sensor-poll-interval`,children:t(`locationHaSensors.options.pollInterval`)}),(0,Y.jsx)(`input`,{id:`location-sensor-poll-interval`,type:`number`,min:yr,step:`1`,value:S,onChange:e=>D(Number(e.target.value)),onBlur:()=>D(Math.max(yr,S||br)),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:t(`locationHaSensors.options.pollIntervalHint`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-2`,children:[(0,Y.jsxs)(K,{type:`button`,variant:`secondary`,onClick:()=>b(!0),children:[(0,Y.jsx)(nt,{className:`w-4 h-4`}),t(`locationHaSensors.options.reset`)]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(K,{type:`button`,variant:`secondary`,onClick:e,children:t(`common.cancel`)}),(0,Y.jsxs)(K,{type:`submit`,disabled:k.isPending,children:[(0,Y.jsx)(_t,{className:`w-4 h-4`}),t(`common.save`)]})]})]})]})]})}),y&&(0,Y.jsx)(Tt,{title:t(`locationHaSensors.options.resetConfirm.title`),message:t(`locationHaSensors.options.resetConfirm.message`),confirmText:t(`locationHaSensors.options.reset`),variant:`danger`,overlayZIndex:`z-[60]`,isLoading:j.isPending,onConfirm:()=>j.mutate(),onCancel:()=>b(!1)})]})}var Er=e=>/^(GRP|WB|MC)/i.test(e.trim()),Dr=e=>/^(GRP|WB)/i.test(e.trim());function Or({provider:e,onEdit:t}){let{t:n}=l(),i=u(),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),{data:h}=d({queryKey:[`printers`],queryFn:r.getPrinters}),g=e.provider_type===`notify`&&Dr(String(e.config.device_id||``)),_=h?.find(t=>t.id===e.printer_id),v=f({mutationFn:t=>r.updateNotificationProvider(e.id,t),onSuccess:()=>{i.invalidateQueries({queryKey:[`notification-providers`]})}}),y=f({mutationFn:()=>r.deleteNotificationProvider(e.id),onSuccess:()=>{i.invalidateQueries({queryKey:[`notification-providers`]})}}),b=f({mutationFn:()=>r.testNotificationProvider(e.id),onSuccess:e=>{m(e),i.invalidateQueries({queryKey:[`notification-providers`]})},onError:e=>{m({success:!1,message:e.message})}}),x=e=>e||``;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{className:`relative`,children:(0,Y.jsxs)(W,{className:`p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between ${e.enabled?`mb-3`:`mb-0`}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`p-2 rounded-lg ${e.enabled?`bg-bambu-green/20`:`bg-bambu-dark`}`,children:(0,Y.jsx)(rt,{className:`w-5 h-5 ${e.enabled?`text-bambu-green`:`text-bambu-gray`}`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`font-medium text-white`,children:e.name}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`notifications.providerTypes.${e.provider_type}`,e.provider_type)})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.last_success&&(0,Y.jsx)(`span`,{className:`text-xs text-status-ok hidden sm:inline`,children:n(`notifications.lastSuccess`,{date:He(e.last_success)})}),e.last_error&&e.last_error_at&&(!e.last_success||(We(e.last_error_at)?.getTime()||0)>(We(e.last_success)?.getTime()||0))&&(0,Y.jsx)(`span`,{className:`text-xs text-status-error`,title:e.last_error,children:n(`notifications.error`)}),(0,Y.jsx)(J,{checked:e.enabled,onChange:e=>v.mutate({enabled:e})})]})]}),e.enabled&&(0,Y.jsxs)(Y.Fragment,{children:[_&&(0,Y.jsxs)(`div`,{className:`mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg`,children:[(0,Y.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[n(`notifications.printer`),` `]}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:_.name})]}),!_&&!e.printer_id&&(0,Y.jsx)(`div`,{className:`mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg`,children:(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:n(`notifications.allPrinters`)})}),(0,Y.jsxs)(`div`,{className:`mb-3 flex flex-wrap gap-1`,children:[e.provider_type===`notify`&&e.config.live_activities===!0&&!Er(String(e.config.device_id||``))&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400 text-xs rounded`,children:n(`notifications.notifyLiveActivities`)}),e.provider_type===`notify`&&e.config.lock_screen_widgets===!0&&!Er(String(e.config.device_id||``))&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400 text-xs rounded`,children:n(`notifications.notifyLockScreenWidgets`)}),e.on_print_start&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 text-xs rounded`,children:n(`notifications.start`)}),e.on_plate_not_empty&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-rose-100 dark:bg-rose-600/20 text-rose-700 dark:text-rose-300 text-xs rounded`,children:n(`notifications.plateCheck`)}),e.on_print_complete&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-bambu-green/20 text-bambu-green text-xs rounded`,children:n(`notifications.complete`)}),e.on_plate_clear_required&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 text-xs rounded`,children:n(`notifications.plateClear`)}),e.on_print_confirm_request&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400 text-xs rounded`,children:n(`notifications.printConfirmRequest`)}),e.provider_type===`telegram`&&e.on_print_confirm_request&&e.telegram_verdict_mode===`reactions`&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400 text-xs rounded`,children:n(`notifications.telegramVerdictBadgeReactions`)}),e.provider_type===`telegram`&&e.on_print_confirm_request&&e.telegram_verdict_mode===`both`&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400 text-xs rounded`,children:n(`notifications.telegramVerdictBadgeBoth`)}),e.on_print_failed&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 text-xs rounded`,children:n(`notifications.failed`)}),e.on_print_stopped&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400 text-xs rounded`,children:n(`notifications.stopped`)}),e.on_billing_charge_failed&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-red-100 dark:bg-red-600/20 text-red-700 dark:text-red-300 text-xs rounded`,children:n(`notifications.billingChargeFailedLabel`)}),e.on_print_progress&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 text-xs rounded`,children:n(`notifications.progress`)}),e.on_printer_offline&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-gray-500/20 text-gray-400 text-xs rounded`,children:n(`notifications.offline`)}),e.on_printer_error&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-rose-100 dark:bg-rose-500/20 text-rose-700 dark:text-rose-400 text-xs rounded`,children:n(`notifications.error`)}),e.on_ai_failure_detection&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-fuchsia-100 dark:bg-fuchsia-500/20 text-fuchsia-700 dark:text-fuchsia-300 text-xs rounded`,children:n(`notifications.aiFailureDetection`)}),e.on_ha_sensor_alert&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-indigo-100 dark:bg-indigo-500/20 text-indigo-700 dark:text-indigo-300 text-xs rounded`,children:n(`notifications.haSensorAlert`)}),e.on_location_ha_sensor_alert&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-indigo-100 dark:bg-indigo-500/20 text-indigo-700 dark:text-indigo-300 text-xs rounded`,children:n(`notifications.locationHaSensorAlert`)}),e.on_filament_low&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-400 text-xs rounded`,children:n(`notifications.lowFilament`)}),e.on_maintenance_due&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400 text-xs rounded`,children:n(`notifications.maintenance`)}),e.on_ams_humidity_high&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-blue-100 dark:bg-blue-600/20 text-blue-700 dark:text-blue-300 text-xs rounded`,children:n(`notifications.amsHumidity`)}),e.on_ams_temperature_high&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-orange-100 dark:bg-orange-600/20 text-orange-700 dark:text-orange-300 text-xs rounded`,children:n(`notifications.amsTemp`)}),e.on_ams_drying_suspended&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-rose-100 dark:bg-rose-600/20 text-rose-700 dark:text-rose-300 text-xs rounded`,children:n(`notifications.amsDryingSuspended`)}),e.on_ams_ht_humidity_high&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-cyan-100 dark:bg-cyan-600/20 text-cyan-700 dark:text-cyan-300 text-xs rounded`,children:n(`notifications.amsHtHumidity`)}),e.on_ams_ht_temperature_high&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-amber-100 dark:bg-amber-600/20 text-amber-700 dark:text-amber-300 text-xs rounded`,children:n(`notifications.amsHtTemp`)}),e.on_bed_cooled&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400 text-xs rounded`,children:n(`notifications.bedCooled`)}),e.on_first_layer_complete&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-emerald-100 dark:bg-emerald-600/20 text-emerald-700 dark:text-emerald-300 text-xs rounded`,children:n(`notifications.firstLayer`)}),e.on_app_message&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400 text-xs rounded`,children:n(`notifications.appMessagesBadge`)}),e.on_print_missing_spool_assignment&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-300 text-xs rounded`,children:n(`notifications.missingSpoolAssignmentLabel`)}),e.on_stock_reorder_alert&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-lime-100 dark:bg-lime-500/20 text-lime-700 dark:text-lime-400 text-xs rounded`,children:n(`notifications.stockReorderAlert`)}),e.on_stock_break_alert&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 bg-red-100 dark:bg-red-600/20 text-red-700 dark:text-red-300 text-xs rounded`,children:n(`notifications.stockBreakAlert`)}),e.quiet_hours_enabled&&(0,Y.jsxs)(`span`,{className:`px-2 py-0.5 bg-indigo-100 dark:bg-indigo-500/20 text-indigo-700 dark:text-indigo-400 text-xs rounded flex items-center gap-1`,children:[(0,Y.jsx)(Jt,{className:`w-3 h-3`}),n(`notifications.quiet`)]}),e.daily_digest_enabled&&(0,Y.jsxs)(`span`,{className:`px-2 py-0.5 bg-emerald-100 dark:bg-emerald-500/20 text-emerald-700 dark:text-emerald-400 text-xs rounded flex items-center gap-1`,children:[(0,Y.jsx)(w,{className:`w-3 h-3`}),n(`notifications.digest`,{time:e.daily_digest_time})]}),(e.attach_photo===!1||g)&&(0,Y.jsxs)(`span`,{className:`px-2 py-0.5 bg-bambu-dark-tertiary text-bambu-gray text-xs rounded flex items-center gap-1`,children:[(0,Y.jsx)(vn,{className:`w-3 h-3`}),n(`notifications.noPhoto`)]})]}),(0,Y.jsx)(`div`,{className:`mb-3`,children:(0,Y.jsxs)(K,{size:`sm`,variant:`secondary`,disabled:b.isPending,onClick:()=>{m(null),b.mutate()},className:`w-full`,children:[b.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Sn,{className:`w-4 h-4`}),n(`notifications.sendTestNotification`)]})}),p&&(0,Y.jsxs)(`div`,{className:`mb-3 p-2 rounded-lg flex items-center gap-2 text-sm ${p.success?`bg-bambu-green/20 text-bambu-green`:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`}`,children:[p.success?(0,Y.jsx)(j,{className:`w-4 h-4`}):(0,Y.jsx)(O,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{children:p.message})]})]}),(0,Y.jsxs)(`button`,{onClick:()=>c(!s),className:`w-full flex items-center justify-between py-2 text-sm text-bambu-gray hover:text-white transition-colors ${e.enabled?`border-t border-bambu-dark-tertiary`:`mt-2 border-t border-bambu-dark-tertiary`}`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(je,{className:`w-4 h-4`}),n(`notifications.eventSettings`)]}),s?(0,Y.jsx)(D,{className:`w-4 h-4`}):(0,Y.jsx)(E,{className:`w-4 h-4`})]}),s&&(0,Y.jsxs)(`div`,{className:`pt-3 border-t border-bambu-dark-tertiary space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.enabled`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.sendFromProvider`)})]}),(0,Y.jsx)(J,{checked:e.enabled,onChange:e=>v.mutate({enabled:e})})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide`,children:n(`notifications.printEvents`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.printStarted`)}),(0,Y.jsx)(J,{checked:e.on_print_start,onChange:e=>v.mutate({on_print_start:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.plateNotEmpty`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.plateNotEmptyDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_plate_not_empty??!0,onChange:e=>v.mutate({on_plate_not_empty:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.printCompleted`)}),(0,Y.jsx)(J,{checked:e.on_print_complete,onChange:e=>v.mutate({on_print_complete:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.plateClearRequired`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.plateClearRequiredDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_plate_clear_required??!1,onChange:e=>v.mutate({on_plate_clear_required:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.printConfirmRequest`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.printConfirmRequestDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_print_confirm_request??!0,onChange:e=>v.mutate({on_print_confirm_request:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.bedCooledLabel`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.bedCooledDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_bed_cooled??!1,onChange:e=>v.mutate({on_bed_cooled:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.firstLayerCompleteLabel`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.firstLayerCompleteDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_first_layer_complete??!1,onChange:e=>v.mutate({on_first_layer_complete:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.missingSpoolAssignmentLabel`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.missingSpoolAssignmentDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_print_missing_spool_assignment??!1,onChange:e=>v.mutate({on_print_missing_spool_assignment:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.printFailed`)}),(0,Y.jsx)(J,{checked:e.on_print_failed,onChange:e=>v.mutate({on_print_failed:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.printStopped`)}),(0,Y.jsx)(J,{checked:e.on_print_stopped,onChange:e=>v.mutate({on_print_stopped:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.billingChargeFailedLabel`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.billingChargeFailedDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_billing_charge_failed??!0,onChange:e=>v.mutate({on_billing_charge_failed:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.progressMilestones`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.progressMilestonesDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_print_progress,onChange:e=>v.mutate({on_print_progress:e})})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide`,children:n(`notifications.printerStatus`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.printerOffline`)}),(0,Y.jsx)(J,{checked:e.on_printer_offline,onChange:e=>v.mutate({on_printer_offline:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.printerError`)}),(0,Y.jsx)(J,{checked:e.on_printer_error,onChange:e=>v.mutate({on_printer_error:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.aiFailureDetection`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.aiFailureDetectionDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_ai_failure_detection??!1,onChange:e=>v.mutate({on_ai_failure_detection:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.haSensorAlert`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.haSensorAlertDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_ha_sensor_alert??!1,onChange:e=>v.mutate({on_ha_sensor_alert:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.locationHaSensorAlert`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.locationHaSensorAlertDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_location_ha_sensor_alert??!1,onChange:e=>v.mutate({on_location_ha_sensor_alert:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.lowFilamentLabel`)}),(0,Y.jsx)(J,{checked:e.on_filament_low,onChange:e=>v.mutate({on_filament_low:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.maintenanceDue`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.maintenanceDueDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_maintenance_due??!1,onChange:e=>v.mutate({on_maintenance_due:e})})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide`,children:n(`notifications.amsAlarms`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.amsHumidityHigh`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.amsHumidityHighDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_ams_humidity_high??!1,onChange:e=>v.mutate({on_ams_humidity_high:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.amsTemperatureHigh`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.amsTemperatureHighDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_ams_temperature_high??!1,onChange:e=>v.mutate({on_ams_temperature_high:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.amsDryingSuspendedTitle`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.amsDryingSuspendedDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_ams_drying_suspended??!1,onChange:e=>v.mutate({on_ams_drying_suspended:e})})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide`,children:n(`notifications.amsHtAlarms`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.amsHtHumidityHigh`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.amsHtHumidityHighDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_ams_ht_humidity_high??!1,onChange:e=>v.mutate({on_ams_ht_humidity_high:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.amsHtTemperatureHigh`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.amsHtTemperatureHighDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_ams_ht_temperature_high??!1,onChange:e=>v.mutate({on_ams_ht_temperature_high:e})})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide`,children:n(`notifications.inventoryAlerts`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.stockReorderAlert`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.stockReorderAlertDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_stock_reorder_alert??!1,onChange:e=>v.mutate({on_stock_reorder_alert:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.stockBreakAlert`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.stockBreakAlertDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_stock_break_alert??!1,onChange:e=>v.mutate({on_stock_break_alert:e})})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide`,children:n(`notifications.printQueue`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.jobAdded`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.jobAddedDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_queue_job_added??!1,onChange:e=>v.mutate({on_queue_job_added:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.jobAssigned`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.jobAssignedDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_queue_job_assigned??!1,onChange:e=>v.mutate({on_queue_job_assigned:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.jobStarted`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.jobStartedDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_queue_job_started??!1,onChange:e=>v.mutate({on_queue_job_started:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.jobWaiting`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.jobWaitingDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_queue_job_waiting??!0,onChange:e=>v.mutate({on_queue_job_waiting:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.jobSkipped`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.jobSkippedDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_queue_job_skipped??!0,onChange:e=>v.mutate({on_queue_job_skipped:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.jobFailed`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.jobFailedDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_queue_job_failed??!0,onChange:e=>v.mutate({on_queue_job_failed:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.queueComplete`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.queueCompleteDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_queue_completed??!1,onChange:e=>v.mutate({on_queue_completed:e})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.appMessages`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.appMessagesDescription`)})]}),(0,Y.jsx)(J,{checked:e.on_app_message??!1,onChange:e=>v.mutate({on_app_message:e})})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Jt,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.quietHours`)})]}),(0,Y.jsx)(J,{checked:e.quiet_hours_enabled,onChange:e=>v.mutate({quiet_hours_enabled:e})})]}),e.quiet_hours_enabled&&(0,Y.jsxs)(`div`,{className:`pl-4 border-l-2 border-bambu-dark-tertiary space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.noNotificationsDuring`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(lt,{className:`w-4 h-4 text-bambu-gray`}),(0,Y.jsxs)(`span`,{className:`text-sm text-white`,children:[x(e.quiet_hours_start)||`22:00`,` - `,x(e.quiet_hours_end)||`07:00`]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.editProviderToChangeQuietHours`)})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(w,{className:`w-4 h-4 text-emerald-600 dark:text-emerald-400`}),(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.dailyDigest`)})]}),(0,Y.jsx)(J,{checked:e.daily_digest_enabled,onChange:e=>v.mutate({daily_digest_enabled:e})})]}),e.daily_digest_enabled&&(0,Y.jsxs)(`div`,{className:`pl-4 border-l-2 border-bambu-dark-tertiary space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.batchNotifications`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(lt,{className:`w-4 h-4 text-bambu-gray`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.sendAt`,{time:x(e.daily_digest_time)||`08:00`})})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.editProviderToChangeDigestTime`)})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ut,{className:`w-4 h-4 text-bambu-gray`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:n(`notifications.attachPhotoLabel`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(g?`notifications.notifyPhotoUnavailable`:`notifications.attachPhotoDescription`)})]})]}),(0,Y.jsx)(J,{checked:!g&&(e.attach_photo??!0),disabled:g,onChange:e=>v.mutate({attach_photo:e})})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,Y.jsxs)(K,{size:`sm`,variant:`secondary`,onClick:()=>t(e),className:`flex-1`,children:[(0,Y.jsx)(oe,{className:`w-4 h-4`}),n(`notifications.edit`)]}),(0,Y.jsx)(K,{size:`sm`,variant:`secondary`,onClick:()=>o(!0),className:`text-red-700 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300`,children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]})]})]})}),a&&(0,Y.jsx)(Tt,{title:n(`notifications.deleteProvider`),message:n(`notifications.deleteConfirm`,{name:e.name}),confirmText:n(`notifications.delete`),variant:`danger`,onConfirm:()=>{y.mutate(),o(!1)},onCancel:()=>o(!1)})]})}var kr=[`progress`,`eta`,`layers`,`nozzle`,`bed`,`chamber`],Ar=[`email`,`telegram`,`discord`,`ntfy`,`pushover`,`bark`,`gotify`,`callmebot`,`webhook`,`homeassistant`,`notify`];function jr({provider:e,onClose:t}){let{t:n,i18n:i}=l(),a=u(),o=!!e,[s,c]=(0,X.useState)(e?.name||``),[p,m]=(0,X.useState)(e?.provider_type||`email`),[h,g]=(0,X.useState)(e?.printer_id||null),[_,v]=(0,X.useState)(e?.provider_type===`notify`&&Dr(String(e.config.device_id||``))?!1:e?.attach_photo??!0),[y,b]=(0,X.useState)(e?.quiet_hours_enabled||!1),[x,S]=(0,X.useState)(e?.quiet_hours_start||`22:00`),[C,w]=(0,X.useState)(e?.quiet_hours_end||`07:00`),[T,E]=(0,X.useState)(e?.daily_digest_enabled||!1),[D,k]=(0,X.useState)(e?.daily_digest_time||`08:00`),[A,ee]=(0,X.useState)(e?.on_print_start??!1),[M,N]=(0,X.useState)(e?.on_print_complete??!0),[P,te]=(0,X.useState)(e?.on_print_failed??!0),[F,ne]=(0,X.useState)(e?.on_print_stopped??!0),[I,re]=(0,X.useState)(e?.on_print_progress??!1),[ie,L]=(0,X.useState)(e?.on_billing_charge_failed??!0),[ae,z]=(0,X.useState)(e?.on_printer_offline??!1),[oe,se]=(0,X.useState)(e?.on_printer_error??!1),[B,ce]=(0,X.useState)(e?.on_ai_failure_detection??!1),[le,ue]=(0,X.useState)(e?.on_filament_low??!1),[de,fe]=(0,X.useState)(e?.on_maintenance_due??!1),[V,pe]=(0,X.useState)(e?.on_stock_reorder_alert??!1),[me,he]=(0,X.useState)(e?.on_stock_break_alert??!1),[ge,_e]=(0,X.useState)(e?.on_plate_clear_required??!1),[ve,ye]=(0,X.useState)(e?.on_print_confirm_request??!0),[be,H]=(0,X.useState)(e?.telegram_verdict_mode??`buttons`),[xe,Se]=(0,X.useState)(e?.on_bed_cooled??!1),[Ce,we]=(0,X.useState)(e?.on_ha_sensor_alert??!1),[Te,Ee]=(0,X.useState)(e?.on_location_ha_sensor_alert??!1),[De,Oe]=(0,X.useState)(e?.on_first_layer_complete??!1),[ke,Ae]=(0,X.useState)(e?.on_app_message??!1),[je,Me]=(0,X.useState)(e?.config?.live_activities===!0&&!Er(String(e?.config?.device_id||``))),[Ne,Pe]=(0,X.useState)(e?.config?.lock_screen_widgets===!0&&!Er(String(e?.config?.device_id||``))),[Fe,Ie]=(0,X.useState)(()=>{let t=e?.config?.live_activity_metrics;return Array.isArray(t)?kr.filter(e=>t.includes(e)):[]}),[Le,U]=(0,X.useState)(e?.config?Object.fromEntries(Object.entries(e.config).filter(([e])=>e!==`event_priorities`&&e!==`live_activities`&&e!==`live_activity_metrics`&&e!==`lock_screen_widgets`).map(([e,t])=>[e,String(t)])):{}),[W,ze]=(0,X.useState)((()=>{let t=e?.config?.event_priorities;if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t)){let t=Number(r);Number.isInteger(t)&&t>=1&&t<=5&&(n[e]=t)}return n})()),[G,Be]=(0,X.useState)(null),[Ve,He]=(0,X.useState)(null),{data:Ue}=d({queryKey:[`printers`],queryFn:r.getPrinters});(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let We=p===`notify`&&Er(Le.device_id||``),Ge=p===`notify`&&Dr(Le.device_id||``),Ke=()=>p===`notify`?{...Le,live_activities:je&&!We,lock_screen_widgets:Ne&&!We,live_activity_privacy:Le.live_activity_privacy===`true`,live_activity_stage:Le.live_activity_stage===`true`,live_activity_metrics:Fe,time_sensitive:Le.time_sensitive===`true`}:Le,q=f({mutationFn:()=>r.testNotificationConfig({provider_type:p,config:Ke(),attach_photo:_&&!Ge}),onSuccess:e=>{Be(e),He(null)},onError:e=>{Be({success:!1,message:e.message})}}),qe=f({mutationFn:e=>r.createNotificationProvider(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`notification-providers`]}),t()},onError:e=>{He(e.message)}}),Je=f({mutationFn:t=>r.updateNotificationProvider(e.id,t),onSuccess:()=>{a.invalidateQueries({queryKey:[`notification-providers`]}),t()},onError:e=>{He(e.message)}}),Ye=e=>{if(e.preventDefault(),He(null),!s.trim()){He(n(`notifications.nameRequired`));return}let t=Qe(p);for(let e of t)if(!Le[e.key]?.trim()){He(n(`notifications.fieldRequired`,{field:e.label}));return}if(p===`homeassistant`&&Le.data?.trim()){let e;try{e=JSON.parse(Le.data)}catch{He(n(`notifications.haDataInvalid`));return}if(typeof e!=`object`||!e||Array.isArray(e)){He(n(`notifications.haDataInvalid`));return}}if(p===`telegram`&&Le.message_thread_id?.trim()&&!/^\d+$/.test(Le.message_thread_id.trim())){He(n(`notifications.telegramThreadIdInvalid`));return}let r=(p===`ntfy`||p===`gotify`)&&Object.keys(W).length>0?{...Le,event_priorities:W}:Ke(),i={name:s.trim(),provider_type:p,config:r,printer_id:h,attach_photo:_&&!Ge,quiet_hours_enabled:y,quiet_hours_start:y?x:null,quiet_hours_end:y?C:null,daily_digest_enabled:T,daily_digest_time:T?D:null,on_print_start:A,on_print_complete:M,on_print_failed:P,on_print_stopped:F,on_print_progress:I,on_billing_charge_failed:ie,on_printer_offline:ae,on_printer_error:oe,on_ai_failure_detection:B,on_filament_low:le,on_maintenance_due:de,on_stock_reorder_alert:V,on_stock_break_alert:me,on_plate_clear_required:ge,on_print_confirm_request:ve,telegram_verdict_mode:p===`telegram`?be:`buttons`,on_bed_cooled:xe,on_ha_sensor_alert:Ce,on_location_ha_sensor_alert:Te,on_first_layer_complete:De,on_app_message:ke};o?Je.mutate(i):qe.mutate(i)},Xe=qe.isPending||Je.isPending,Ze=e=>{switch(e){case`callmebot`:return[{key:`phone`,label:`Phone Number`,placeholder:`+1234567890`,type:`text`,required:!0},{key:`apikey`,label:`API Key`,placeholder:`Your CallMeBot API key`,type:`text`,required:!0}];case`ntfy`:return[{key:`server`,label:`Server URL`,placeholder:`https://ntfy.sh`,type:`text`,required:!1},{key:`topic`,label:`Topic`,placeholder:`my-bambuddy`,type:`text`,required:!0},{key:`auth_token`,label:`Auth Token`,placeholder:`Optional authentication`,type:`password`,required:!1}];case`pushover`:return[{key:`user_key`,label:`User Key`,placeholder:`Your Pushover user key`,type:`text`,required:!0},{key:`app_token`,label:`App Token`,placeholder:`Your Pushover app token`,type:`text`,required:!0},{key:`priority`,label:`Priority`,placeholder:`0 (normal)`,type:`number`,required:!1},{key:`retry`,label:n(`notifications.pushoverRetry`),placeholder:`60`,type:`number`,required:!1,showIf:e=>e.priority===`2`},{key:`expire`,label:n(`notifications.pushoverExpire`),placeholder:`3600`,type:`number`,required:!1,showIf:e=>e.priority===`2`}];case`notify`:return[{key:`device_id`,label:n(`notifications.notifyDeviceId`),type:`text`,required:!0},{key:`token`,label:n(`notifications.notifyToken`),type:`password`,required:!0},{key:`icon_url`,label:n(`notifications.notifyIconUrl`),placeholder:`https://example.com/icon.png`,type:`url`,pattern:`https://.*`,required:!1},{key:`group_type`,label:n(`notifications.notifyGroupType`),type:`text`,required:!1,help:n(`notifications.notifyGroupTypeHelp`)},{key:`time_sensitive`,label:n(`notifications.notifyTimeSensitive`),type:`select`,required:!1,options:[{value:`false`,label:n(`common.no`)},{value:`true`,label:n(`common.yes`)}],help:n(`notifications.notifyTimeSensitiveHelp`)},{key:`live_activity_privacy`,label:n(`notifications.notifyPrivacy`),type:`select`,required:!1,advanced:!0,options:[{value:`false`,label:n(`common.no`)},{value:`true`,label:n(`common.yes`)}],help:n(`notifications.notifyPrivacyHelp`)},{key:`live_activity_stage`,label:n(`notifications.notifyShowStage`),type:`select`,required:!1,advanced:!0,options:[{value:`false`,label:n(`common.no`)},{value:`true`,label:n(`common.yes`)}]},{key:`live_activity_style`,label:n(`notifications.notifyStyle`),type:`select`,required:!1,advanced:!0,options:[{value:`bar`,label:n(`notifications.notifyStyleBar`)},{value:`segments`,label:n(`notifications.notifyStyleSegments`)},{value:`none`,label:n(`notifications.notifyStyleNone`)}]},{key:`live_activity_button_url`,label:n(`notifications.notifyDashboardUrl`),type:`url`,pattern:`https://.*`,placeholder:`https://bambuddy.example.com`,required:!1,advanced:!0},{key:`live_activity_symbol`,label:n(`notifications.notifySymbol`),type:`text`,placeholder:`printer.fill`,required:!1,advanced:!0},{key:`live_activity_tint`,label:n(`notifications.notifyTint`),type:`text`,placeholder:`#00AE42`,pattern:`#[0-9a-fA-F]{6}`,required:!1,advanced:!0}];case`telegram`:return[{key:`bot_token`,label:`Bot Token`,placeholder:`Bot token from @BotFather`,type:`password`,required:!0},{key:`chat_id`,label:`Chat ID`,placeholder:`Your chat or group ID`,type:`text`,required:!0},{key:`message_thread_id`,label:n(`notifications.telegramThreadId`),placeholder:`123`,type:`number`,required:!1,help:n(`notifications.telegramThreadIdHelp`)}];case`email`:return[{key:`smtp_server`,label:`SMTP Server`,placeholder:`smtp.gmail.com`,type:`text`,required:!0},{key:`smtp_port`,label:`SMTP Port`,placeholder:`587`,type:`number`,required:!1},{key:`security`,label:`Security`,type:`select`,required:!1,options:[{value:`starttls`,label:`STARTTLS (Port 587)`},{value:`ssl`,label:`SSL/TLS (Port 465)`},{value:`none`,label:`None (Port 25)`}]},{key:`auth_enabled`,label:`Authentication`,type:`select`,required:!1,options:[{value:`true`,label:`Enabled`},{value:`false`,label:`Disabled`}]},{key:`username`,label:`Username`,placeholder:`your@email.com`,type:`text`,required:!1},{key:`password`,label:`Password`,placeholder:`App password`,type:`password`,required:!1},{key:`from_email`,label:`From Email`,placeholder:`your@email.com`,type:`text`,required:!0},{key:`to_email`,label:`To Email`,placeholder:`recipient@email.com`,type:`text`,required:!0}];case`discord`:return[{key:`webhook_url`,label:`Webhook URL`,placeholder:`https://discord.com/api/webhooks/...`,type:`text`,required:!0}];case`webhook`:return[{key:`webhook_url`,label:`Webhook URL`,placeholder:`https://example.com/webhook`,type:`text`,required:!0},{key:`payload_format`,label:`Payload Format`,type:`select`,required:!1,options:[{value:`generic`,label:`Generic JSON`},{value:`slack`,label:`Slack / Mattermost`}]},{key:`auth_header`,label:`Authorization`,placeholder:`Bearer token (optional)`,type:`password`,required:!1},{key:`field_title`,label:`Title Field Name`,placeholder:`title`,type:`text`,required:!1,showIf:e=>e.payload_format!==`slack`},{key:`field_message`,label:`Message Field Name`,placeholder:`message`,type:`text`,required:!1,showIf:e=>e.payload_format!==`slack`}];case`homeassistant`:return[{key:`service`,label:`Home Assistant Service`,placeholder:`notify.mobile_app_myphone`,type:`text`,required:!1,help:n(`notifications.haServiceHelp`)},{key:`data`,label:`Data (JSON, optional)`,placeholder:`{"priority": "high", "ttl": 0, "channel": "3D Printing"}`,type:`textarea`,required:!1}];case`bark`:return[{key:`device_key`,label:`Device Key`,placeholder:`Your Bark device key`,type:`text`,required:!0},{key:`server`,label:`Server URL`,placeholder:`https://api.day.app`,type:`text`,required:!1},{key:`group`,label:`Group`,placeholder:`Bambuddy`,type:`text`,required:!1},{key:`sound`,label:`Sound`,placeholder:`minuet`,type:`text`,required:!1},{key:`level`,label:`Interruption Level`,type:`select`,required:!1,options:[{value:``,label:`Default`},{value:`active`,label:`Active`},{value:`timeSensitive`,label:`Time Sensitive`},{value:`critical`,label:`Critical (bypasses Silent/Focus)`},{value:`passive`,label:`Passive (no sound)`}]}];case`gotify`:return[{key:`server`,label:`Server URL`,placeholder:`https://gotify.example.com`,type:`text`,required:!0},{key:`app_token`,label:`App Token`,placeholder:`Token of a Gotify application`,type:`password`,required:!0}];default:return[]}},Qe=e=>Ze(e).filter(e=>e.required),$e=Ze(p),et=e=>e.filter(e=>e.showIf?.(Le)!==!1).map(e=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{htmlFor:`notification-config-${e.key}`,className:`block text-sm text-bambu-gray mb-1`,children:[e.label,` `,e.required&&`*`]}),e.type===`select`&&e.options?(0,Y.jsx)(`select`,{id:`notification-config-${e.key}`,value:Le[e.key]||e.options[0]?.value||``,onChange:t=>{U({...Le,[e.key]:t.target.value}),Be(null)},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:e.options.map(e=>(0,Y.jsx)(`option`,{value:e.value,children:e.label},e.value))}):e.type===`textarea`?(0,Y.jsx)(`textarea`,{id:`notification-config-${e.key}`,value:Le[e.key]||``,onChange:t=>{U({...Le,[e.key]:t.target.value}),Be(null)},placeholder:e.placeholder,rows:3,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none font-mono text-sm`}):(0,Y.jsx)(`input`,{id:`notification-config-${e.key}`,type:e.type,pattern:e.pattern,value:Le[e.key]||``,onChange:t=>{U({...Le,[e.key]:t.target.value}),p===`notify`&&e.key===`device_id`&&Er(t.target.value)&&(Me(!1),Pe(!1)),p===`notify`&&e.key===`device_id`&&Dr(t.target.value)&&v(!1),Be(null)},placeholder:e.placeholder,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),e.help&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e.help})]},e.key));return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4 overflow-y-auto`,onClick:t,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg my-8 max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(o?`notifications.editTitle`:`notifications.addTitle`)}),(0,Y.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`form`,{onSubmit:Ye,className:`p-6 space-y-4`,children:[Ve&&(0,Y.jsx)(`div`,{className:`p-3 bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/50 rounded-lg text-sm text-red-700 dark:text-red-400`,children:Ve}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`notifications.nameLabel`)}),(0,Y.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:n(`notifications.namePlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`notifications.providerTypeLabel`)}),(0,Y.jsx)(`select`,{value:p,onChange:e=>{m(e.target.value),U({}),Me(!1),Pe(!1),Ie([]),Be(null)},disabled:o,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50`,children:Ar.map(e=>({value:e,label:n(`notifications.providerTypes.${e}`,e)})).sort((e,t)=>e.label.localeCompare(t.label,i.language,{sensitivity:`base`})).map(({value:e,label:t})=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`notifications.providerDescriptions.${p}`,``)})]}),(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`notifications.configuration`)}),et($e.filter(e=>!e.advanced)),p===`notify`&&(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,role:`group`,"aria-label":n(`notifications.notifyLiveActivities`),children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-sm text-white`,children:n(`notifications.notifyLiveActivities`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.notifyLiveActivitiesHelp`)})]}),(0,Y.jsx)(J,{checked:je&&!We,disabled:We,onChange:e=>{Me(e),Be(null),He(null)}})]}),je&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.notifyLifecycleHelp`)}),(0,Y.jsxs)(`details`,{className:`rounded-lg border border-bambu-dark-tertiary p-3`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-sm text-white`,children:n(`notifications.notifyAppearance`)}),(0,Y.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[et($e.filter(e=>e.advanced)),(0,Y.jsxs)(`fieldset`,{children:[(0,Y.jsx)(`legend`,{className:`text-sm text-bambu-gray mb-1`,children:n(`notifications.notifyMetrics`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:n(`notifications.notifyMetricsHelp`)}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:kr.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-1 text-sm text-white`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Fe.includes(e),onChange:t=>{Ie(t.target.checked?[...Fe,e]:Fe.filter(t=>t!==e)),Be(null)},className:`accent-bambu-green`}),n(e===`progress`?`notifications.progress`:e===`eta`?`streamOverlay.eta`:e===`layers`?`streamOverlay.layer`:`printers.temperatures.${e}`)]},e))})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,role:`group`,"aria-label":n(`notifications.notifyLockScreenWidgets`),children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-sm text-white`,children:n(`notifications.notifyLockScreenWidgets`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.notifyLockScreenWidgetsHelp`)})]}),(0,Y.jsx)(J,{checked:Ne&&!We,disabled:We,onChange:e=>{Pe(e),Be(null),He(null)}})]}),We&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.notifyIosFeaturesUnavailable`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.notifyTestHelp`)})]}),p===`telegram`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`telegram-verdict-mode`,className:`block text-sm text-bambu-gray mb-1`,children:n(`notifications.telegramVerdictMode`)}),(0,Y.jsxs)(`select`,{id:`telegram-verdict-mode`,value:be,onChange:e=>H(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`buttons`,children:n(`notifications.telegramVerdictModeButtons`)}),(0,Y.jsx)(`option`,{value:`reactions`,children:n(`notifications.telegramVerdictModeReactions`)}),(0,Y.jsx)(`option`,{value:`both`,children:n(`notifications.telegramVerdictModeBoth`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`notifications.telegramVerdictModeHelp`)})]})]}),(0,Y.jsx)(`div`,{className:`flex gap-2`,children:(0,Y.jsxs)(K,{type:`button`,variant:`secondary`,onClick:()=>{Be(null),q.mutate()},disabled:q.isPending||Qe(p).some(e=>!Le[e.key]?.trim()),className:`flex-1`,children:[q.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Sn,{className:`w-4 h-4`}),n(`notifications.testConfiguration`)]})}),G&&(0,Y.jsx)(`div`,{className:`p-3 rounded-lg flex items-center gap-2 ${G.success?`bg-bambu-green/20 border border-bambu-green/50 text-bambu-green`:`bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/50 text-red-700 dark:text-red-400`}`,children:G.success?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j,{className:`w-5 h-5`}),(0,Y.jsx)(`span`,{children:G.message})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{className:`w-5 h-5`}),(0,Y.jsx)(`span`,{children:G.message})]})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`notifications.printerFilter`)}),(0,Y.jsxs)(`select`,{value:h??``,onChange:e=>g(e.target.value?Number(e.target.value):null),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`notifications.allPrinters`)}),Ue?.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`notifications.onlyFromPrinter`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-sm text-white`,children:n(`notifications.attachPhotoLabel`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(Ge?`notifications.notifyPhotoUnavailable`:`notifications.attachPhotoDescription`)})]}),(0,Y.jsx)(J,{checked:_&&!Ge,disabled:Ge,onChange:v})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`label`,{className:`text-sm text-white`,children:n(`notifications.quietHoursDnd`)}),(0,Y.jsx)(J,{checked:y,onChange:b})]}),y&&(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:n(`notifications.quietStart`)}),(0,Y.jsx)(`input`,{type:`time`,value:x,onChange:e=>S(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:n(`notifications.quietEnd`)}),(0,Y.jsx)(`input`,{type:`time`,value:C,onChange:e=>w(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-sm text-white`,children:n(`notifications.dailyDigestLabel`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`notifications.batchNotifications`)})]}),(0,Y.jsx)(J,{checked:T,onChange:E})]}),T&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:n(`notifications.sendDigestAt`)}),(0,Y.jsx)(`input`,{type:`time`,value:D,onChange:e=>k(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`notifications.digestCollected`)})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`notifications.notificationEvents`)}),(0,Y.jsxs)(`div`,{className:`space-y-2 p-3 bg-bambu-dark rounded-lg`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide mb-2`,children:n(`notifications.printEvents`)}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.start`)}),(0,Y.jsx)(J,{checked:A,onChange:ee})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.complete`)}),(0,Y.jsx)(J,{checked:M,onChange:N})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.failed`)}),(0,Y.jsx)(J,{checked:P,onChange:te})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.stopped`)}),(0,Y.jsx)(J,{checked:F,onChange:ne})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between col-span-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.progress`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.progressPercent`)})]}),(0,Y.jsx)(J,{checked:I,onChange:re})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between col-span-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.billingChargeFailedLabel`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.billingChargeFailedDescription`)})]}),(0,Y.jsx)(J,{checked:ie,onChange:L})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between col-span-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.plateClearRequired`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.plateClearRequiredDescription`)})]}),(0,Y.jsx)(J,{checked:ge,onChange:_e})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between col-span-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.printConfirmRequest`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.printConfirmRequestDescription`)})]}),(0,Y.jsx)(J,{checked:ve,onChange:ye})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between col-span-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.bedCooled`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.bedCooledAfterPrint`)})]}),(0,Y.jsx)(J,{checked:xe,onChange:Se})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between col-span-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.firstLayerCompleteLabel`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.firstLayerCompleteDescription`)})]}),(0,Y.jsx)(J,{checked:De,onChange:Oe})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2 p-3 bg-bambu-dark rounded-lg`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide mb-2`,children:n(`notifications.printerStatus`)}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.offline`)}),(0,Y.jsx)(J,{checked:ae,onChange:z})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between col-span-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.haSensorAlert`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.haSensorAlertDescription`)})]}),(0,Y.jsx)(J,{checked:Ce,onChange:we})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between col-span-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.locationHaSensorAlert`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.locationHaSensorAlertDescription`)})]}),(0,Y.jsx)(J,{checked:Te,onChange:Ee})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.error`)}),(0,Y.jsx)(J,{checked:oe,onChange:se})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.aiFailureDetection`)}),(0,Y.jsx)(J,{checked:B,onChange:ce})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.lowFilament`)}),(0,Y.jsx)(J,{checked:le,onChange:ue})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.maintenance`)}),(0,Y.jsx)(J,{checked:de,onChange:fe})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2 p-3 bg-bambu-dark rounded-lg`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide mb-2`,children:n(`notifications.inventoryAlerts`)}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.stockReorderAlert`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.stockReorderAlertDescription`)})]}),(0,Y.jsx)(J,{checked:V,onChange:pe})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.stockBreakAlert`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.stockBreakAlertDescription`)})]}),(0,Y.jsx)(J,{checked:me,onChange:he})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2 p-3 bg-bambu-dark rounded-lg`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide mb-2`,children:n(`notifications.connectedApps`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`notifications.appMessages`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1`,children:n(`notifications.appMessagesDescription`)})]}),(0,Y.jsx)(J,{checked:ke,onChange:Ae})]})]}),(p===`ntfy`||p===`gotify`)&&(()=>{let e=[];return A&&e.push({key:`on_print_start`,label:n(`notifications.start`)}),M&&e.push({key:`on_print_complete`,label:n(`notifications.complete`)}),P&&e.push({key:`on_print_failed`,label:n(`notifications.failed`)}),F&&e.push({key:`on_print_stopped`,label:n(`notifications.stopped`)}),I&&e.push({key:`on_print_progress`,label:n(`notifications.progress`)}),ie&&e.push({key:`on_billing_charge_failed`,label:n(`notifications.billingChargeFailedLabel`)}),ge&&e.push({key:`on_plate_clear_required`,label:n(`notifications.plateClearRequired`)}),ve&&e.push({key:`on_print_confirm_request`,label:n(`notifications.printConfirmRequest`)}),xe&&e.push({key:`on_bed_cooled`,label:n(`notifications.bedCooled`)}),De&&e.push({key:`on_first_layer_complete`,label:n(`notifications.firstLayerCompleteLabel`)}),ae&&e.push({key:`on_printer_offline`,label:n(`notifications.offline`)}),oe&&e.push({key:`on_printer_error`,label:n(`notifications.error`)}),Ce&&e.push({key:`on_ha_sensor_alert`,label:n(`notifications.haSensorAlert`)}),Te&&e.push({key:`on_location_ha_sensor_alert`,label:n(`notifications.locationHaSensorAlert`)}),B&&e.push({key:`on_ai_failure_detection`,label:n(`notifications.aiFailureDetection`)}),le&&e.push({key:`on_filament_low`,label:n(`notifications.lowFilament`)}),de&&e.push({key:`on_maintenance_due`,label:n(`notifications.maintenance`)}),V&&e.push({key:`on_stock_reorder_alert`,label:n(`notifications.stockReorderAlert`)}),me&&e.push({key:`on_stock_break_alert`,label:n(`notifications.stockBreakAlert`)}),e.length===0?null:(0,Y.jsxs)(`div`,{className:`space-y-2 p-3 bg-bambu-dark rounded-lg`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray uppercase tracking-wide mb-1`,children:n(p===`gotify`?`notifications.eventPriority.sectionTitleGotify`:`notifications.eventPriority.sectionTitle`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:n(p===`gotify`?`notifications.eventPriority.helpGotify`:`notifications.eventPriority.helpNtfy`)}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:e.label}),(0,Y.jsxs)(`select`,{value:W[e.key]??3,onChange:t=>{let n=Number(t.target.value);ze(t=>({...t,[e.key]:n}))},className:`px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:1,children:n(`notifications.eventPriority.min`)}),(0,Y.jsx)(`option`,{value:2,children:n(`notifications.eventPriority.low`)}),(0,Y.jsx)(`option`,{value:3,children:n(`notifications.eventPriority.default`)}),(0,Y.jsx)(`option`,{value:4,children:n(`notifications.eventPriority.high`)}),(0,Y.jsx)(`option`,{value:5,children:n(`notifications.eventPriority.urgent`)})]})]},e.key))})]})})()]}),(0,Y.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,Y.jsx)(K,{type:`button`,variant:`secondary`,onClick:t,className:`flex-1`,children:n(`notifications.cancel`)}),(0,Y.jsxs)(K,{type:`submit`,disabled:Xe,className:`flex-1`,children:[Xe?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(_t,{className:`w-4 h-4`}),n(o?`notifications.save`:`notifications.add`)]})]})]})]})})}function Mr({template:e,onClose:t}){let{t:n}=l(),i=u(),a=(0,X.useRef)(null),[o,s]=(0,X.useState)(e.title_template),[c,p]=(0,X.useState)(e.body_template),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(!0),{data:v}=d({queryKey:[`template-variables`],queryFn:r.getTemplateVariables}),y=v?.find(t=>t.event_type===e.event_type),{data:b,isLoading:x}=d({queryKey:[`template-preview`,e.event_type,o,c],queryFn:()=>r.previewTemplate({event_type:e.event_type,title_template:o,body_template:c}),enabled:g&&o.length>0&&c.length>0});(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let S=f({mutationFn:t=>r.updateNotificationTemplate(e.id,t),onSuccess:()=>{i.invalidateQueries({queryKey:[`notification-templates`]}),t()},onError:e=>{h(e.message)}}),C=f({mutationFn:()=>r.resetNotificationTemplate(e.id),onSuccess:e=>{s(e.title_template),p(e.body_template),i.invalidateQueries({queryKey:[`notification-templates`]})},onError:e=>{h(e.message)}}),w=e=>{if(e.preventDefault(),h(null),!o.trim()){h(n(`notifications.titleRequired`));return}if(!c.trim()){h(n(`notifications.bodyRequired`));return}S.mutate({title_template:o,body_template:c})},T=e=>{let t=a.current;if(!t)return;let n=t.selectionStart,r=t.selectionEnd,i=c,o=i.substring(0,n),s=i.substring(r);p(o+`{${e}}`+s),setTimeout(()=>{t.focus();let r=n+e.length+2;t.setSelectionRange(r,r)},0)},E=o!==e.title_template||c!==e.body_template;return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-2xl max-h-[90vh] flex flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(`notifications.editTemplate`,{name:e.name})}),(0,Y.jsx)(`button`,{onClick:t,className:`p-1 hover:bg-bambu-dark-tertiary rounded transition-colors`,children:(0,Y.jsx)(Re,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,Y.jsxs)(`form`,{onSubmit:w,className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[m&&(0,Y.jsx)(`div`,{className:`p-3 bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/50 rounded text-red-700 dark:text-red-400 text-sm`,children:m}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:n(`notifications.titleLabel`)}),(0,Y.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white focus:outline-none focus:ring-1 focus:ring-bambu-green`,placeholder:n(`notifications.titlePlaceholder`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:n(`notifications.bodyLabel`)}),(0,Y.jsx)(`textarea`,{ref:a,value:c,onChange:e=>p(e.target.value),rows:4,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white focus:outline-none focus:ring-1 focus:ring-bambu-green font-mono text-sm resize-none`,placeholder:n(`notifications.bodyPlaceholder`)})]}),y&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-2`,children:n(`notifications.availableVariables`)}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:y.variables.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>T(e),className:`inline-flex items-center gap-1 px-2 py-1 bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-xs text-bambu-gray hover:text-white transition-colors`,children:[(0,Y.jsx)(wt,{className:`w-3 h-3`}),e]},e))}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray/60 mt-1`,children:n(`notifications.clickToInsert`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,Y.jsxs)(`label`,{className:`text-sm font-medium text-bambu-gray flex items-center gap-2`,children:[(0,Y.jsx)(mt,{className:`w-4 h-4`}),n(`notifications.livePreview`)]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>_(!g),className:`text-xs text-bambu-green hover:text-bambu-green-light`,children:n(g?`notifications.hide`:`notifications.show`)})]}),g&&(0,Y.jsx)(`div`,{className:`bg-bambu-dark border border-bambu-dark-tertiary rounded p-3 space-y-2`,children:x?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-sm`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),n(`notifications.loadingPreview`)]}):b?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:n(`notifications.titlePreview`)}),(0,Y.jsx)(`div`,{className:`text-white font-medium`,children:b.title})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:n(`notifications.bodyPreview`)}),(0,Y.jsx)(`div`,{className:`text-white whitespace-pre-wrap text-sm`,children:b.body})]}),y?.supports_photo&&(0,Y.jsxs)(`div`,{className:`pt-2 mt-2 border-t border-bambu-dark-tertiary/60 flex items-center gap-3`,children:[(0,Y.jsx)(`img`,{src:`/img/screenshot-desktop.png`,alt:n(`notifications.photoPreview`),className:`w-24 h-14 object-cover rounded border border-bambu-dark-tertiary shrink-0`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:e.event_type.startsWith(`user_`)?n(`notifications.photoPreviewNoteEmailOnly`):y.variables.includes(`finish_photo_url`)?n(`notifications.photoPreviewNoteWithEmail`):n(`notifications.photoPreviewNote`)})]})]}):(0,Y.jsx)(`div`,{className:`text-bambu-gray text-sm`,children:n(`notifications.enterTemplateContent`)})})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-t border-bambu-dark-tertiary shrink-0`,children:[(0,Y.jsxs)(K,{type:`button`,variant:`ghost`,onClick:()=>C.mutate(),disabled:C.isPending,className:`text-orange-600 dark:text-orange-400 hover:text-orange-700 dark:hover:text-orange-300`,children:[C.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin mr-2`}):(0,Y.jsx)(nt,{className:`w-4 h-4 mr-2`}),n(`notifications.resetToDefault`)]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(K,{type:`button`,variant:`secondary`,onClick:t,children:n(`notifications.cancel`)}),(0,Y.jsxs)(K,{onClick:w,disabled:S.isPending||!E,children:[S.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin mr-2`}):(0,Y.jsx)(_t,{className:`w-4 h-4 mr-2`}),n(`notifications.save`)]})]})]})]})})}var Nr={print_start:`text-blue-700 dark:text-blue-400`,print_complete:`text-bambu-green`,print_failed:`text-red-700 dark:text-red-400`,print_stopped:`text-orange-700 dark:text-orange-400`,print_progress:`text-yellow-700 dark:text-yellow-400`,printer_offline:`text-gray-400`,printer_error:`text-rose-700 dark:text-rose-400`,filament_low:`text-cyan-700 dark:text-cyan-400`,maintenance_due:`text-purple-700 dark:text-purple-400`,test:`text-bambu-gray`};function Pr({onClose:e}){let{t}=l(),n=u(),{showToast:i}=ee(),[a,o]=(0,X.useState)(7),[s,c]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),{data:h}=d({queryKey:[`settings`],queryFn:r.getSettings}),g=h?.time_format||`system`,{data:_,isLoading:v,refetch:y,isRefetching:b}=d({queryKey:[`notification-logs`,a,p],queryFn:()=>r.getNotificationLogs({days:a,limit:100,success:p?!1:void 0})}),{data:x}=d({queryKey:[`notification-log-stats`,a],queryFn:()=>r.getNotificationLogStats(a)}),S=f({mutationFn:()=>r.clearNotificationLogs(30),onSuccess:e=>{i(e.message,`success`),n.invalidateQueries({queryKey:[`notification-logs`]}),n.invalidateQueries({queryKey:[`notification-log-stats`]})},onError:e=>{i(`Failed to clear logs: ${e.message}`,`error`)}}),C=e=>{let n=We(e);if(!n)return``;let r=new Date().getTime()-n.getTime();return r<6e4?t(`notifications.justNow`):r<36e5?`${Math.floor(r/6e4)}m ago`:r<864e5?`${Math.floor(r/36e5)}h ago`:n.toLocaleDateString()+` `+Ve(n,g)};return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg w-full max-w-3xl max-h-[85vh] flex flex-col`,children:[(0,Y.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(ie,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:t(`notifications.notificationLog`)})]}),(0,Y.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white transition-colors`,children:`×`})]}),x&&(0,Y.jsx)(`div`,{className:`px-4 py-3 border-b border-bambu-dark-tertiary bg-bambu-dark/50`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-6 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[t(`notifications.statsSummary`,{days:a}),` `,(0,Y.jsx)(`span`,{className:`text-white font-medium`,children:x.total}),` `,t(`notifications.statsNotifications`)]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-green`,children:[(0,Y.jsx)(j,{className:`w-4 h-4`}),t(`notifications.statsSent`,{count:x.success_count})]}),x.failure_count>0&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-red-700 dark:text-red-400`,children:[(0,Y.jsx)(O,{className:`w-4 h-4`}),t(`notifications.statsFailed`,{count:x.failure_count})]})]})}),(0,Y.jsxs)(`div`,{className:`px-4 py-3 border-b border-bambu-dark-tertiary flex items-center gap-4`,children:[(0,Y.jsxs)(`select`,{value:a,onChange:e=>o(Number(e.target.value)),className:`px-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:ring-1 focus:ring-bambu-green`,children:[(0,Y.jsx)(`option`,{value:1,children:t(`notifications.last24Hours`)}),(0,Y.jsx)(`option`,{value:7,children:t(`notifications.last7Days`)}),(0,Y.jsx)(`option`,{value:30,children:t(`notifications.last30Days`)}),(0,Y.jsx)(`option`,{value:90,children:t(`notifications.last90Days`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-bambu-gray cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),t(`notifications.showFailedOnly`)]}),(0,Y.jsx)(`div`,{className:`flex-1`}),(0,Y.jsxs)(K,{size:`sm`,variant:`secondary`,onClick:()=>y(),disabled:b,children:[b?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(at,{className:`w-4 h-4`}),t(`notifications.refresh`)]}),(0,Y.jsxs)(K,{size:`sm`,variant:`secondary`,onClick:()=>S.mutate(),disabled:S.isPending,className:`text-red-700 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300`,children:[S.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(qe,{className:`w-4 h-4`}),t(`notifications.clearOld`)]})]}),(0,Y.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:v?(0,Y.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,Y.jsx)(R,{className:`w-6 h-6 text-bambu-green animate-spin`})}):_&&_.length>0?(0,Y.jsx)(`div`,{className:`space-y-2`,children:_.map(e=>(0,Y.jsx)(Fr,{log:e,isExpanded:s===e.id,onToggle:()=>c(s===e.id?null:e.id),formatDate:C,formatFullDate:e=>Be(e,g)},e.id))}):(0,Y.jsxs)(`div`,{className:`text-center py-12 text-bambu-gray`,children:[(0,Y.jsx)(ie,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,Y.jsx)(`p`,{className:`text-sm`,children:t(p?`notifications.noFailedNotifications`:`notifications.noNotificationsLogged`)})]})})]})})}function Fr({log:e,isExpanded:t,onToggle:n,formatDate:r,formatFullDate:i}){let{t:a}=l();return(0,Y.jsxs)(`div`,{className:`border rounded-lg overflow-hidden transition-colors ${e.success?`border-bambu-dark-tertiary bg-bambu-dark/30`:`border-red-500/30 bg-red-500/5`}`,children:[(0,Y.jsxs)(`button`,{className:`w-full px-3 py-2 flex items-center gap-3 text-left hover:bg-bambu-dark/50 transition-colors`,onClick:n,children:[e.success?(0,Y.jsx)(j,{className:`w-4 h-4 text-bambu-green shrink-0`}):(0,Y.jsx)(O,{className:`w-4 h-4 text-red-600 dark:text-red-400 shrink-0`}),(0,Y.jsx)(`span`,{className:`text-xs font-medium ${Nr[e.event_type]||`text-bambu-gray`}`,children:a(`notifications.eventTypes.${e.event_type}`,e.event_type)}),(0,Y.jsx)(`span`,{className:`text-sm text-white truncate flex-1`,children:e.provider_name||a(`notifications.unknownProvider`)}),e.printer_name&&(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.printer_name}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray shrink-0`,children:r(e.created_at)}),t?(0,Y.jsx)(D,{className:`w-4 h-4 text-bambu-gray shrink-0`}):(0,Y.jsx)(E,{className:`w-4 h-4 text-bambu-gray shrink-0`})]}),t&&(0,Y.jsxs)(`div`,{className:`px-3 py-2 border-t border-bambu-dark-tertiary bg-bambu-dark/20 space-y-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:a(`notifications.logTitle`)}),(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:e.title})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:a(`notifications.logMessage`)}),(0,Y.jsx)(`p`,{className:`text-sm text-white whitespace-pre-wrap`,children:e.message})]}),!e.success&&e.error_message&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-xs text-red-700 dark:text-red-400 mb-1`,children:a(`notifications.logError`)}),(0,Y.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-300`,children:e.error_message})]}),(0,Y.jsxs)(`div`,{className:`flex gap-4 text-xs text-bambu-gray pt-1`,children:[(0,Y.jsx)(`span`,{children:a(`notifications.logProvider`,{type:e.provider_type})}),(0,Y.jsx)(`span`,{children:a(`notifications.logTime`,{time:i(e.created_at)})})]})]})]})}var Ir=Object.defineProperty,Lr=Object.getOwnPropertySymbols,Rr=Object.prototype.hasOwnProperty,zr=Object.prototype.propertyIsEnumerable,Br=(e,t,n)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vr=(e,t)=>{for(var n in t||={})Rr.call(t,n)&&Br(e,n,t[n]);if(Lr)for(var n of Lr(t))zr.call(t,n)&&Br(e,n,t[n]);return e},Z=(e,t)=>{var n={};for(var r in e)Rr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lr)for(var r of Lr(e))t.indexOf(r)<0&&zr.call(e,r)&&(n[r]=e[r]);return n},Hr;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],et.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.lengthm[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;ne+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.lengtht.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e=1<{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(Hr||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(Hr||={});var Ur=Hr,Wr={L:Ur.QrCode.Ecc.LOW,M:Ur.QrCode.Ecc.MEDIUM,Q:Ur.QrCode.Ecc.QUARTILE,H:Ur.QrCode.Ecc.HIGH},Gr=128,Kr=`L`,qr=`#FFFFFF`,Jr=`#000000`,Yr=!1,Xr=1,Zr=4,Qr=0,$r=.1;function ei(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ti(e,t){return e.slice().map((e,n)=>n=t.y+t.h?e:e.map((e,n)=>n=t.x+t.w?e:!1))}function ni(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*$r),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function ri(e,t){return t==null?e?Zr:Qr:Math.max(Math.floor(t),0)}function ii({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=X.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...Ur.QrSegment.makeSegments(t)),e),[]);return Ur.QrCode.encodeSegments(r,Wr[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=X.useMemo(()=>{let e=c.getModules(),t=ri(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:ni(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var ai=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),oi=X.forwardRef(function(e,t){let n=e,{value:r,size:i=Gr,level:a=Kr,bgColor:o=qr,fgColor:s=Jr,includeMargin:c=Yr,minVersion:l=Xr,boostLevel:u,marginSize:d,imageSettings:f}=n,p=Z(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=Z(p,[`style`]),g=f?.src,_=X.useRef(null),v=X.useRef(null),y=X.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=X.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=ii({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});X.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ti(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,ai?t.fill(new Path2D(ei(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),X.useEffect(()=>{x(!1)},[g]);let E=Vr({height:i,width:i},m),D=null;return g!=null&&(D=X.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),X.createElement(X.Fragment,null,X.createElement(`canvas`,Vr({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});oi.displayName=`QRCodeCanvas`;var si=X.forwardRef(function(e,t){let n=e,{value:r,size:i=Gr,level:a=Kr,bgColor:o=qr,fgColor:s=Jr,includeMargin:c=Yr,minVersion:l=Xr,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=Z(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=ii({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ti(g,v.excavation)),b=X.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=ei(y,h);return X.createElement(`svg`,Vr({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&X.createElement(`title`,null,d),X.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),X.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});si.displayName=`QRCodeSVG`;function ci(e,t){return`bambuddy://config?v=1&url=${encodeURIComponent(e)}&key=${encodeURIComponent(t)}`}function li({apiKey:e,baseUrl:t,onClose:n}){let{t:r}=l(),i=ci(t??window.location.origin,e);return(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:n,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-sm`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:r(`settings.apiKeyQrTitle`)}),(0,Y.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,"aria-label":r(`common.close`),children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`div`,{className:`p-6 flex flex-col items-center`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4 text-center`,children:r(`settings.apiKeyQrCaption`)}),(0,Y.jsx)(`div`,{className:`bg-white p-4 rounded-lg mb-4`,children:(0,Y.jsx)(si,{value:i,size:256})}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-amber-700 dark:text-amber-400 mb-4`,children:[(0,Y.jsx)(Ie,{className:`w-4 h-4 flex-shrink-0 mt-0.5`}),(0,Y.jsx)(`span`,{children:r(`settings.apiKeyQrWarning`)})]}),(0,Y.jsx)(K,{onClick:n,className:`w-full`,children:r(`common.close`)})]})]})})}var ui=300,di=2;function fi({onSuccess:e}){let{t}=l(),n=u(),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(``),[c,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(null);(0,X.useEffect)(()=>{let e=i.trim();if(e.lengths(e),ui);return()=>clearTimeout(t)},[i]),(0,X.useEffect)(()=>{p(null),h(null)},[o]);let g=d({queryKey:[`ldap-search`,o],queryFn:()=>r.searchLDAPDirectory(o),enabled:o.length>=di,staleTime:3e4}),_=f({mutationFn:e=>r.provisionLDAPUser(e),onSuccess:t=>{n.invalidateQueries({queryKey:[`users`]}),e(t)},onError:e=>{h(e.message||t(`users.modal.ldapErrorProvision`))}}),v=(0,X.useMemo)(()=>g.data?.find(e=>e.dn===c)??null,[g.data,c]),y=i.trim().length>0&&i.trim().length=di,x=!!g.data&&g.data.length>0,S=!b&&!!g.data&&g.data.length===0&&o.length>=di;return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:t(`users.modal.ldapSearchLabel`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(Ae,{className:`w-4 h-4 text-bambu-gray absolute left-3 top-1/2 -translate-y-1/2`}),(0,Y.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),className:`w-full pl-9 pr-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:t(`users.modal.ldapSearchPlaceholder`),autoComplete:`off`})]}),y&&(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-bambu-gray`,children:t(`users.modal.ldapMinChars`)})]}),(0,Y.jsxs)(`div`,{className:`min-h-[8rem] max-h-64 overflow-y-auto bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:[b&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin mr-2`}),(0,Y.jsx)(`span`,{children:t(`users.modal.ldapSearching`)})]}),S&&(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-8 text-bambu-gray text-sm`,children:t(`users.modal.ldapNoResults`)}),g.isError&&(0,Y.jsx)(`div`,{className:`px-3 py-4 text-sm text-red-700 dark:text-red-400`,children:g.error instanceof Error?g.error.message:t(`users.modal.ldapSearchError`)}),!b&&x&&(0,Y.jsx)(`ul`,{className:`divide-y divide-bambu-dark-tertiary`,children:g.data.map(e=>(0,Y.jsx)(pi,{result:e,selected:c===e.dn,onSelect:()=>p(e.dn)},e.dn))}),!b&&!g.data&&!g.isError&&(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-8 text-bambu-gray text-sm`,children:t(`users.modal.ldapTypeToSearch`)})]}),v&&(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary/50 border border-bambu-green/20 rounded-lg p-3 space-y-1`,children:[(0,Y.jsxs)(`p`,{className:`text-sm text-white`,children:[(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[t(`users.modal.ldapSelectedLabel`),`: `]}),(0,Y.jsx)(`span`,{className:`font-medium`,children:v.username}),v.display_name&&(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[` — `,v.display_name]})]}),v.email&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:v.email}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray break-all`,children:v.dn})]}),m&&(0,Y.jsx)(`div`,{className:`bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg p-3`,children:(0,Y.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-400`,children:m})}),(0,Y.jsx)(`div`,{className:`flex justify-end`,children:(0,Y.jsx)(K,{onClick:()=>{!v||v.already_provisioned||(h(null),_.mutate(v.username))},disabled:!v||v.already_provisioned||_.isPending,children:_.isPending?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),t(`users.modal.ldapProvisioning`)]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),t(`users.modal.ldapProvision`)]})})})]})}function pi({result:e,selected:t,onSelect:n}){let{t:r}=l(),i=e.already_provisioned;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:n,disabled:i,className:`w-full text-left px-3 py-2 flex items-center gap-3 transition-colors ${i?`opacity-50 cursor-not-allowed`:t?`bg-bambu-green/10`:`hover:bg-bambu-dark-tertiary`}`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsxs)(`p`,{className:`text-sm text-white truncate`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:e.username}),e.display_name&&(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[` — `,e.display_name]})]}),e.email&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray truncate`,children:e.email})]}),i&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-bambu-gray whitespace-nowrap`,children:[(0,Y.jsx)(q,{className:`w-3.5 h-3.5`}),r(`users.modal.ldapAlreadyProvisioned`)]})]})})}function mi({formData:e,setFormData:t,groups:n,onClose:r,onCreate:i,isCreating:a,isCreateButtonDisabled:o,ldapEnabled:s=!1,onLdapProvisioned:c}){let{t:u}=l(),[d,f]=(0,X.useState)(`local`);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let p=n=>{t({...e,group_ids:e.group_ids.includes(n)?e.group_ids.filter(e=>e!==n):[...e.group_ids,n]})};return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:r,children:(0,Y.jsxs)(G,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Ze,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:u(`users.modal.createUser`)})]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray ml-7`,children:u(`users.modal.advancedAuthSubtitle`)||`with Advanced Authentication`})]}),(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:r,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]})}),(0,Y.jsxs)(W,{children:[s&&(0,Y.jsxs)(`div`,{className:`mb-4 flex items-center gap-1 p-1 bg-bambu-dark-secondary rounded-lg`,role:`tablist`,"aria-label":u(`users.modal.tabsAriaLabel`),children:[(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":d===`local`,onClick:()=>f(`local`),className:`flex-1 px-3 py-2 text-sm rounded-md transition-colors ${d===`local`?`bg-bambu-green/15 text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:u(`users.modal.localTab`)}),(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":d===`ldap`,onClick:()=>f(`ldap`),className:`flex-1 px-3 py-2 text-sm rounded-md transition-colors ${d===`ldap`?`bg-bambu-green/15 text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:u(`users.modal.ldapTab`)})]}),d===`ldap`&&s?(0,Y.jsx)(fi,{onSuccess:e=>{c?.(e)}}):(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[u(`users.form.username`),` `,(0,Y.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:`*`})]}),(0,Y.jsx)(`input`,{type:`text`,value:e.username,onChange:n=>t({...e,username:n.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:u(`users.form.usernamePlaceholder`),autoComplete:`username`,required:!0})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[u(`users.form.email`)||`Email`,` `,(0,Y.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:`*`})]}),(0,Y.jsx)(`input`,{type:`email`,value:e.email,onChange:n=>t({...e,email:n.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:u(`users.form.emailPlaceholder`)||`user@example.com`,required:!0})]}),(0,Y.jsx)(`div`,{className:`bg-bambu-dark-secondary/50 border border-bambu-green/20 rounded-lg p-3`,children:(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:u(`users.form.autoGeneratedPassword`)||`A secure password will be automatically generated and emailed to the user.`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:u(`users.form.groups`)}),(0,Y.jsxs)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:[n.map(t=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:e.group_ids.includes(t.id),onChange:()=>p(t.id),className:`w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:t.name}),t.is_system&&(0,Y.jsxs)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:[`(`,u(`users.system`),`)`]})]},t.id)),n.length===0&&(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:u(`users.noGroupsAvailable`)})]})]})]}),(0,Y.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:r,children:u(`users.modal.cancel`)}),d===`local`&&(0,Y.jsx)(K,{onClick:i,disabled:o,children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),u(`users.modal.creating`)]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),u(`users.modal.createUser`)]})})]})]})]})})}function hi(){let{t:e}=l(),t=u(),{showToast:n}=ee(),[i,a]=(0,X.useState)(!1),[o,c]=(0,X.useState)(``),[p,m]=(0,X.useState)(`auto`),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!0),[y,b]=(0,X.useState)(!0),[x,S]=(0,X.useState)(`all`),[C,w]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[k,j]=(0,X.useState)(!1),[M,N]=(0,X.useState)(!1),[P,te]=(0,X.useState)(null),{data:F,isLoading:ne}=d({queryKey:[`spoolman-settings`],queryFn:r.getSpoolmanSettings}),{data:I,isLoading:re,refetch:ie}=d({queryKey:[`spoolman-status`],queryFn:r.getSpoolmanStatus,refetchInterval:3e4}),{data:L}=d({queryKey:[`printers`],queryFn:r.getPrinters});(0,X.useEffect)(()=>{F&&(a(F.spoolman_enabled===`true`),c(F.spoolman_url||``),m(F.spoolman_sync_mode||`auto`),g(F.spoolman_disable_weight_sync===`true`),v(F.spoolman_report_partial_usage!==`false`),b(F.auto_add_unknown_rfid!==`false`),w(!0))},[F]),(0,X.useEffect)(()=>{if(!(!C||!F)&&(F.spoolman_enabled===`true`!==i||(F.spoolman_url||``)!==o||(F.spoolman_sync_mode||`auto`)!==p||F.spoolman_disable_weight_sync===`true`!==h||F.spoolman_report_partial_usage!==`false`!==_||F.auto_add_unknown_rfid!==`false`!==y)){let e=setTimeout(()=>{z.mutate()},500);return()=>clearTimeout(e)}},[i,o,p,h,_,y,C]);let z=f({mutationFn:()=>r.updateSpoolmanSettings({spoolman_enabled:i?`true`:`false`,spoolman_url:o,spoolman_sync_mode:p,spoolman_disable_weight_sync:h?`true`:`false`,spoolman_report_partial_usage:_?`true`:`false`,auto_add_unknown_rfid:y?`true`:`false`}),onSuccess:()=>{t.invalidateQueries({queryKey:[`spoolman-settings`]}),t.invalidateQueries({queryKey:[`spoolman-status`]}),t.invalidateQueries({queryKey:[`spool-assignments`]}),t.invalidateQueries({queryKey:[`settings`]}),t.invalidateQueries({queryKey:[`spoolman-inventory-filaments`]}),n(e(`settings.toast.settingsSaved`))},onError:()=>{n(e(`settings.toast.saveFailed`),`error`)}}),oe=f({mutationFn:r.connectSpoolman,onSuccess:()=>{ie()},onError:()=>{n(e(`settings.toast.saveFailed`),`error`)}}),se=f({mutationFn:r.syncAllPrintersAms,onSuccess:t=>{n(e(`settings.spoolmanAmsSyncSuccess`,{synced:t.synced_count,skipped:0}),`success`)},onError:()=>{n(e(`settings.toast.saveFailed`),`error`)}}),B=f({mutationFn:e=>r.syncPrinterAms(e),onSuccess:t=>{n(e(`settings.spoolmanAmsSyncSuccess`,{synced:t.synced_count,skipped:0}),`success`)},onError:()=>{n(e(`settings.toast.saveFailed`),`error`)}}),ce=()=>{x===`all`?se.mutate():B.mutate(x)},le=f({mutationFn:r.syncWeightsFromAms,onSuccess:r=>{t.invalidateQueries({queryKey:[`spools`]}),t.invalidateQueries({queryKey:[`inventory-spools`]}),n(e(`settings.amsSyncSuccess`,{synced:r.synced,skipped:r.skipped}),`success`),j(!1)},onError:()=>{n(e(`settings.amsSyncError`),`error`),j(!1)}}),ue=f({mutationFn:r.syncSpoolmanAmsWeights,onSuccess:r=>{t.invalidateQueries({queryKey:[`spoolman-inventory-spools`]}),n(e(`settings.spoolmanAmsSyncSuccess`,{synced:r.synced,skipped:r.skipped}),`success`),N(!1)},onError:t=>{t instanceof s&&t.status===503?n(e(`settings.spoolmanAmsSyncErrorUnreachable`),`error`):t instanceof s&&t.status===400?n(e(`settings.spoolmanAmsSyncErrorNotConfigured`),`error`):n(e(`settings.spoolmanAmsSyncError`),`error`),N(!1)}}),de=f({mutationFn:e=>r.migrateSpoolmanTags(e),onSuccess:r=>{te(r),r.dry_run||(t.invalidateQueries({queryKey:[`spoolman-inventory-spools`]}),n(e(`settings.nativeTagsMoved`,{count:r.moved.length}),`success`))},onError:()=>{n(e(`settings.nativeTagsError`),`error`)}}),fe=se.isPending||B.isPending,V=x===`all`?se.data:B.data,pe=x===`all`?se.isSuccess:B.isSuccess;return ne?(0,Y.jsxs)(G,{id:`card-spoolman`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(gt,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`settings.filamentTracking`)})]})}),(0,Y.jsx)(W,{children:(0,Y.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,Y.jsx)(R,{className:`w-6 h-6 text-bambu-green animate-spin`})})})]}):(0,Y.jsxs)(G,{id:`card-spoolman`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(gt,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`settings.filamentTracking`)})]}),z.isPending&&(0,Y.jsx)(R,{className:`w-4 h-4 text-bambu-green animate-spin`})]})}),(0,Y.jsxs)(W,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`settings.filamentTrackingDesc`)}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>a(!1),className:`p-3 rounded-lg border-2 text-left transition-colors ${i?`border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray/50`:`border-bambu-green bg-bambu-green/10`}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,Y.jsx)(Ee,{className:`w-4 h-4 ${i?`text-bambu-gray`:`text-bambu-green`}`}),(0,Y.jsx)(`span`,{className:`text-sm font-medium ${i?`text-bambu-gray`:`text-white`}`,children:e(`settings.trackingModeBuiltIn`)})]}),(0,Y.jsx)(`p`,{className:`text-xs ${i?`text-bambu-gray/60`:`text-bambu-gray`}`,children:e(`settings.trackingModeBuiltInDesc`)}),!i&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[(0,Y.jsx)(T,{className:`w-3 h-3 text-bambu-green`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-green`,children:e(`common.enabled`)})]})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`p-3 rounded-lg border-2 text-left transition-colors ${i?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray/50`}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,Y.jsx)(Je,{className:`w-4 h-4 ${i?`text-bambu-green`:`text-bambu-gray`}`}),(0,Y.jsx)(`span`,{className:`text-sm font-medium ${i?`text-white`:`text-bambu-gray`}`,children:`Spoolman`})]}),(0,Y.jsx)(`p`,{className:`text-xs ${i?`text-bambu-gray`:`text-bambu-gray/60`}`,children:e(`settings.trackingModeSpoolmanDesc`)}),i&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[(0,Y.jsx)(T,{className:`w-3 h-3 text-bambu-green`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-green`,children:e(`common.enabled`)})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`pr-4`,children:[(0,Y.jsx)(`p`,{className:`text-white`,children:e(`settings.autoAddUnknownRfid`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`settings.autoAddUnknownRfidDesc`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),!i&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`div`,{className:`p-3 bg-bambu-green/5 border border-bambu-green/20 rounded-lg`,children:(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(A,{className:`w-4 h-4 text-bambu-green flex-shrink-0 mt-0.5`}),(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:(0,Y.jsxs)(`ul`,{className:`list-disc list-inside space-y-0.5`,children:[(0,Y.jsx)(`li`,{children:e(`settings.builtInFeatureRfid`)}),(0,Y.jsx)(`li`,{children:e(`settings.builtInFeatureUsage`)}),(0,Y.jsx)(`li`,{children:e(`settings.builtInFeatureCatalog`)}),(0,Y.jsx)(`li`,{children:e(`settings.builtInFeatureThirdParty`)})]})})]})}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>j(!0),disabled:le.isPending,children:[le.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 mr-2 animate-spin`}):(0,Y.jsx)(at,{className:`w-4 h-4 mr-2`}),e(`settings.amsSyncButton`)]})]}),i&&(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`div`,{className:`p-3 bg-blue-50 dark:bg-blue-500/10 border border-blue-300 dark:border-blue-500/30 rounded-lg`,children:(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(A,{className:`w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{className:`text-xs text-blue-700 dark:text-blue-300`,children:[(0,Y.jsx)(`p`,{className:`font-medium mb-1`,children:e(`settings.howSyncWorks`)}),(0,Y.jsxs)(`ul`,{className:`list-disc list-inside space-y-0.5 text-blue-700/90 dark:text-blue-300/80`,children:[(0,Y.jsx)(`li`,{children:e(`settings.syncInfoRfidOnly`)}),(0,Y.jsx)(`li`,{children:e(`settings.syncInfoAutoCreate`)}),(0,Y.jsx)(`li`,{children:e(`settings.syncInfoThirdPartySkipped`)})]}),(0,Y.jsx)(`p`,{className:`font-medium mt-2 mb-1`,children:e(`settings.linkingExistingSpools`)}),(0,Y.jsx)(`p`,{className:`text-blue-700/90 dark:text-blue-300/80`,children:e(`settings.linkingExistingSpoolsDesc`)})]})]})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`settings.spoolmanUrl`)}),(0,Y.jsx)(`input`,{type:`text`,placeholder:`http://192.168.1.100:7912`,value:o,onChange:e=>c(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`settings.spoolmanUrlHint`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`settings.syncMode`)}),(0,Y.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`auto`,children:e(`settings.syncModeAuto`)}),(0,Y.jsx)(`option`,{value:`manual`,children:e(`settings.syncModeManual`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(p===`auto`?`settings.syncModeAutoDesc`:`settings.syncModeManualDesc`)})]}),p===`auto`&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:e(`spoolman.disableWeightSync`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`spoolman.disableWeightSyncDesc`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),h&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:e(`spoolman.reportPartialUsage`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`spoolman.reportPartialUsageDesc`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[e(`settings.status`),`:`]}),re?(0,Y.jsx)(R,{className:`w-4 h-4 text-bambu-gray animate-spin`}):I?.connected?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-sm text-green-500`,children:[(0,Y.jsx)(T,{className:`w-4 h-4`}),e(`settings.spoolmanConnected`)]}):(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-sm text-red-500`,children:[(0,Y.jsx)(Re,{className:`w-4 h-4`}),e(`settings.spoolmanDisconnected`)]})]}),(0,Y.jsx)(`div`,{className:`flex gap-2`,children:!I?.connected&&(0,Y.jsxs)(K,{size:`sm`,onClick:()=>oe.mutate(),disabled:oe.isPending||!o,children:[oe.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(ae,{className:`w-4 h-4`}),e(`settings.connect`)]})})]}),oe.isError&&(0,Y.jsx)(`div`,{className:`mb-3 p-2 bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/50 rounded text-sm text-red-700 dark:text-red-400`,children:oe.error.message}),I?.connected&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:e(`settings.syncAmsData`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:e(`settings.syncAmsDataDesc`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Y.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value===`all`?`all`:Number(e.target.value)),className:`w-full px-3 py-2 pr-8 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,Y.jsx)(`option`,{value:`all`,children:e(`settings.allPrinters`)}),L?.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,Y.jsx)(E,{className:`absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:ce,disabled:fe,children:[fe?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(at,{className:`w-4 h-4`}),e(`spoolman.sync`)]})]})]}),I?.connected&&(0,Y.jsx)(`div`,{className:`mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:e(`settings.spoolmanAmsSyncButton`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:e(`settings.spoolmanAmsSyncMessage`)})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>N(!0),disabled:ue.isPending,children:[ue.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(at,{className:`w-4 h-4`}),ue.isPending?e(`settings.spoolmanAmsSyncing`):e(`settings.spoolmanAmsSyncButton`)]})]})}),I?.connected&&I.native_tags&&(0,Y.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-bambu-dark-tertiary space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`pr-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:e(`settings.nativeTagsTitle`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:e(`settings.nativeTagsDesc`)})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>de.mutate(!0),disabled:de.isPending,className:`flex-shrink-0 whitespace-nowrap`,children:[de.isPending&&de.variables?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Tn,{className:`w-4 h-4`}),e(`settings.nativeTagsCheck`)]})]}),P&&(0,Y.jsxs)(`div`,{className:`p-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm space-y-2`,children:[(0,Y.jsxs)(`dl`,{className:`grid grid-cols-[1fr_auto] gap-x-4 gap-y-0.5 text-xs`,children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.nativeTagsToMove`)}),(0,Y.jsx)(`dd`,{className:`text-white text-right`,children:P.dry_run?P.moved.length:0}),(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.nativeTagsAlready`)}),(0,Y.jsx)(`dd`,{className:`text-white text-right`,children:P.already+(P.dry_run?0:P.moved.length)}),(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.nativeTagsSlotIds`)}),(0,Y.jsx)(`dd`,{className:`text-white text-right`,children:P.slot_ids}),(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.nativeTagsConflicts`)}),(0,Y.jsx)(`dd`,{className:`text-white text-right`,children:P.conflicts.length})]}),P.conflicts.length>0&&(0,Y.jsx)(`ul`,{className:`p-2 bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 rounded text-xs text-amber-700 dark:text-amber-400 space-y-0.5`,children:P.conflicts.map(t=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[(0,Y.jsx)(Ie,{className:`w-3.5 h-3.5 flex-shrink-0 mt-px`}),(0,Y.jsx)(`span`,{children:t.holder>0?e(`settings.nativeTagsConflictSpool`,{spool:t.spool_id,tag:t.tag,holder:t.holder}):e(`settings.nativeTagsConflictElsewhere`,{spool:t.spool_id,tag:t.tag})})]},`${t.spool_id}-${t.tag}`))}),P.dry_run&&P.moved.length>0?(0,Y.jsxs)(K,{size:`sm`,onClick:()=>de.mutate(!1),disabled:de.isPending,children:[de.isPending&&!de.variables?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Tn,{className:`w-4 h-4`}),e(`settings.nativeTagsMove`)]}):P.conflicts.length===0&&(0,Y.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-green-600 dark:text-green-400`,children:[(0,Y.jsx)(T,{className:`w-3.5 h-3.5`}),e(`settings.nativeTagsNothing`)]})]})]}),pe&&V&&(0,Y.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Y.jsx)(`div`,{className:`p-2 rounded text-sm ${V.success?`bg-green-100 dark:bg-green-500/20 border border-green-300 dark:border-green-500/50 text-green-700 dark:text-green-400`:`bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-300 dark:border-yellow-500/50 text-yellow-700 dark:text-yellow-400`}`,children:V.success?`Synced ${V.synced_count} spool${V.synced_count===1?``:`s`} successfully`:`Synced ${V.synced_count} spool${V.synced_count===1?``:`s`} with ${V.errors.length} error${V.errors.length===1?``:`s`}`}),V.skipped_count>0&&(0,Y.jsxs)(`div`,{className:`p-2 bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 rounded text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-amber-700 dark:text-amber-400 mb-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(Ie,{className:`w-3.5 h-3.5`}),(0,Y.jsxs)(`span`,{className:`font-medium`,children:[V.skipped_count,` spool`,V.skipped_count===1?``:`s`,` skipped`]})]}),V.skipped_count>5&&(0,Y.jsx)(`button`,{onClick:()=>O(!D),className:`text-xs text-amber-700 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-300 underline`,children:D?`Show less`:`Show all`})]}),(0,Y.jsxs)(`ul`,{className:`text-xs text-amber-700/90 dark:text-amber-300/80 space-y-0.5`,children:[(D?V.skipped:V.skipped.slice(0,5)).map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[e.color&&(0,Y.jsx)(`span`,{className:`w-3 h-3 rounded-full border border-black/20`,style:{backgroundColor:`#${e.color}`}}),(0,Y.jsx)(`span`,{children:e.location}),(0,Y.jsxs)(`span`,{className:`text-amber-700/70 dark:text-amber-300/60`,children:[`- `,e.reason]})]},t)),!D&&V.skipped_count>5&&(0,Y.jsxs)(`li`,{className:`text-amber-700/70 dark:text-amber-300/60 italic`,children:[`...and `,V.skipped_count-5,` more`]})]})]}),V.errors.length>0&&(0,Y.jsxs)(`div`,{className:`p-2 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded text-sm`,children:[(0,Y.jsx)(`div`,{className:`text-red-700 dark:text-red-400 font-medium mb-1`,children:`Errors:`}),(0,Y.jsx)(`ul`,{className:`text-xs text-red-700/90 dark:text-red-300/80 space-y-0.5`,children:V.errors.map((e,t)=>(0,Y.jsx)(`li`,{children:e},t))})]})]})]})]})]}),k&&(0,Y.jsx)(Tt,{title:e(`settings.amsSyncTitle`),message:e(`settings.amsSyncMessage`),confirmText:e(`settings.amsSyncButton`),variant:`warning`,isLoading:le.isPending,loadingText:e(`settings.amsSyncing`),onConfirm:()=>le.mutate(),onCancel:()=>j(!1)}),M&&(0,Y.jsx)(Tt,{title:e(`settings.spoolmanAmsSyncTitle`),message:e(`settings.spoolmanAmsSyncMessage`),confirmText:e(`settings.spoolmanAmsSyncButton`),variant:`warning`,isLoading:ue.isPending,loadingText:e(`settings.spoolmanAmsSyncing`),onConfirm:()=>ue.mutate(),onCancel:()=>N(!1)})]})}function gi(){let{t:e}=l(),{showToast:t}=ee(),[n,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(!0),[s,c]=(0,X.useState)(``),u=(0,X.useRef)(null),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(new Set),[C,w]=(0,X.useState)(!1),[E,D]=(0,X.useState)(null),[O,k]=(0,X.useState)(!1),A=(0,X.useCallback)(async()=>{try{i(await r.getSpoolCatalog())}catch(n){console.error(`SpoolCatalogSettings.loadCatalog failed:`,n),t(e(`settings.catalog.loadFailed`),`error`)}finally{o(!1)}},[t,e]);(0,X.useEffect)(()=>{A()},[A]);let j=n.filter(e=>e.name.toLowerCase().includes(s.toLowerCase())),M=async()=>{if(!h.trim()||!_){t(e(`settings.catalog.nameWeightRequired`),`error`);return}b(!0);try{let n=await r.addCatalogEntry({name:h.trim(),weight:parseInt(_)});i(e=>[...e,n].sort((e,t)=>e.name.localeCompare(t.name))),f(!1),g(``),v(``),t(e(`settings.catalog.entryAdded`),`success`)}catch(n){console.error(`SpoolCatalogSettings.handleAdd failed:`,n),t(e(`settings.catalog.addFailed`),`error`)}finally{b(!1)}},N=e=>{m(e.id),g(e.name),v(e.weight.toString())},P=()=>{m(null),g(``),v(``)},te=async n=>{if(!h.trim()||!_){t(e(`settings.catalog.nameWeightRequired`),`error`);return}b(!0);try{let a=await r.updateCatalogEntry(n,{name:h.trim(),weight:parseInt(_)});i(e=>e.map(e=>e.id===n?a:e).sort((e,t)=>e.name.localeCompare(t.name))),m(null),g(``),v(``),t(e(`settings.catalog.entryUpdated`),`success`)}catch(n){console.error(`SpoolCatalogSettings.handleUpdate failed:`,n),t(e(`settings.catalog.updateFailed`),`error`)}finally{b(!1)}},F=async()=>{if(E)try{await r.deleteCatalogEntry(E.id),i(e=>e.filter(e=>e.id!==E.id)),t(e(`settings.catalog.entryDeleted`),`success`)}catch(n){console.error(`SpoolCatalogSettings.handleDelete failed:`,n),t(e(`settings.catalog.deleteFailed`),`error`)}finally{D(null)}},ne=async()=>{k(!1),o(!0);try{await r.resetSpoolCatalog(),await A(),t(e(`settings.catalog.resetSuccess`),`success`)}catch(n){console.error(`SpoolCatalogSettings.handleReset failed:`,n),t(e(`settings.catalog.resetFailed`),`error`),o(!1)}},I=e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,Y.jsxs)(G,{id:`card-spool-catalog`,children:[(0,Y.jsxs)(U,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,Y.jsx)(gt,{className:`w-5 h-5 text-bambu-gray`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`settings.catalog.spoolCatalog`)}),(0,Y.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[`(`,n.length,`)`]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,Y.jsxs)(`button`,{onClick:()=>{let r=n.map(({name:e,weight:t})=>({name:e,weight:t})),i=new Blob([JSON.stringify(r,null,2)],{type:`application/json`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`spool-catalog.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a),t(e(`settings.catalog.exported`,{count:n.length}),`success`)},className:`px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5`,title:e(`settings.catalog.exportTooltip`),children:[(0,Y.jsx)(sn,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.export`)})]}),(0,Y.jsxs)(`button`,{onClick:()=>u.current?.click(),className:`px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5`,title:e(`settings.catalog.importTooltip`),children:[(0,Y.jsx)(Wt,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.import`)})]}),(0,Y.jsx)(`input`,{ref:u,type:`file`,accept:`.json`,className:`hidden`,onChange:async a=>{let o=a.target.files?.[0];if(o){try{let a=await o.text(),s=JSON.parse(a);if(!Array.isArray(s))throw Error(`Invalid format`);let c=0,l=0;for(let e of s){if(!e.name||typeof e.weight!=`number`){l++;continue}if(n.some(t=>t.name.toLowerCase()===e.name.toLowerCase())){l++;continue}try{let t=await r.addCatalogEntry({name:e.name,weight:e.weight});i(e=>[...e,t].sort((e,t)=>e.name.localeCompare(t.name))),c++}catch(e){console.error(`SpoolCatalogSettings import item failed:`,e),l++}}t(e(`settings.catalog.imported`,{added:c,skipped:l}),`success`)}catch(n){console.error(`SpoolCatalogSettings.handleImport failed:`,n),t(e(`settings.catalog.importFailed`),`error`)}u.current&&(u.current.value=``)}}}),(0,Y.jsxs)(`button`,{onClick:()=>k(!0),className:`px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5`,title:e(`settings.catalog.resetTooltip`),children:[(0,Y.jsx)(nt,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.reset`)})]}),(0,Y.jsxs)(`button`,{onClick:()=>f(!0),className:`px-3 py-1.5 text-sm bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 transition-colors flex items-center gap-1.5`,children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.add`)})]})]}),x.size>0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mt-2 px-3 py-2 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-red-700 dark:text-red-400`,children:e(`settings.catalog.selectedCount`,{count:x.size})}),(0,Y.jsxs)(`button`,{onClick:()=>w(!0),className:`ml-auto px-3 py-1.5 text-sm bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors flex items-center gap-1.5`,children:[(0,Y.jsx)(qe,{className:`w-4 h-4`}),e(`settings.catalog.deleteSelected`)]}),(0,Y.jsx)(`button`,{onClick:()=>S(new Set),className:`px-3 py-1.5 text-sm text-bambu-gray hover:text-white transition-colors`,children:e(`common.cancel`)})]})]}),(0,Y.jsxs)(W,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`settings.catalog.spoolCatalogDescription`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Y.jsx)(`input`,{type:`text`,className:`w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:e(`settings.catalog.searchCatalog`),value:s,onChange:e=>c(e.target.value)})]}),d&&(0,Y.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-white mb-3`,children:e(`settings.catalog.addNewEntry`)}),(0,Y.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,Y.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,Y.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:e(`settings.catalog.namePlaceholder`),value:h,onChange:e=>g(e.target.value)})}),(0,Y.jsx)(`input`,{type:`number`,className:`w-20 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white text-center focus:border-bambu-green focus:outline-none`,placeholder:`g`,value:_,onChange:e=>v(e.target.value)}),(0,Y.jsx)(`span`,{className:`text-bambu-gray shrink-0`,children:`g`}),(0,Y.jsxs)(`button`,{onClick:M,disabled:y,className:`px-3 py-2 bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 flex items-center gap-1 shrink-0`,children:[y?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(T,{className:`w-4 h-4`}),e(`common.add`)]}),(0,Y.jsx)(`button`,{onClick:()=>{f(!1),g(``),v(``)},className:`p-2 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary`,children:(0,Y.jsx)(Re,{className:`w-4 h-4`})})]})]}),a?(0,Y.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-5 h-5 animate-spin mr-2`}),e(`common.loading`)]}):(0,Y.jsx)(`div`,{className:`max-h-[600px] overflow-y-auto border border-bambu-dark-tertiary rounded-lg`,children:(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{className:`bg-bambu-dark sticky top-0`,children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`px-2 py-2 w-10`,children:(0,Y.jsx)(`input`,{type:`checkbox`,checked:j.length>0&&x.size===j.length,onChange:()=>{x.size===j.length?S(new Set):S(new Set(j.map(e=>e.id)))},className:`w-4 h-4 accent-bambu-green cursor-pointer`})}),(0,Y.jsx)(`th`,{className:`px-4 py-2 text-left text-bambu-gray font-medium`,children:e(`common.name`)}),(0,Y.jsx)(`th`,{className:`px-4 py-2 text-right text-bambu-gray font-medium w-24`,children:e(`settings.catalog.weight`)}),(0,Y.jsx)(`th`,{className:`px-4 py-2 text-center text-bambu-gray font-medium w-20`,children:e(`settings.catalog.type`)}),(0,Y.jsx)(`th`,{className:`px-4 py-2 w-24`})]})}),(0,Y.jsx)(`tbody`,{children:j.length===0?(0,Y.jsx)(`tr`,{children:(0,Y.jsx)(`td`,{colSpan:5,className:`px-4 py-8 text-center text-bambu-gray`,children:e(s?`settings.catalog.noMatch`:`settings.catalog.empty`)})}):j.map(t=>(0,Y.jsx)(`tr`,{className:`border-t border-bambu-dark-tertiary hover:bg-bambu-dark ${x.has(t.id)?`bg-bambu-dark`:``}`,children:p===t.id?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`td`,{className:`px-2 py-2`,children:(0,Y.jsx)(`input`,{type:`checkbox`,checked:x.has(t.id),onChange:()=>I(t.id),className:`w-4 h-4 accent-bambu-green cursor-pointer`})}),(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsx)(`input`,{type:`text`,className:`w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white focus:border-bambu-green focus:outline-none`,value:h,onChange:e=>g(e.target.value)})}),(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsx)(`input`,{type:`number`,className:`w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-right focus:border-bambu-green focus:outline-none`,value:_,onChange:e=>v(e.target.value)})}),(0,Y.jsx)(`td`,{className:`px-4 py-2 text-center`,children:(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`-`})}),(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,Y.jsx)(`button`,{onClick:()=>te(t.id),disabled:y,className:`p-1.5 rounded hover:bg-green-500/20 text-green-500`,children:y?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(T,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:P,className:`p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray`,children:(0,Y.jsx)(Re,{className:`w-4 h-4`})})]})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`td`,{className:`px-2 py-2`,children:(0,Y.jsx)(`input`,{type:`checkbox`,checked:x.has(t.id),onChange:()=>I(t.id),className:`w-4 h-4 accent-bambu-green cursor-pointer`})}),(0,Y.jsx)(`td`,{className:`px-4 py-2 text-white`,children:t.name}),(0,Y.jsxs)(`td`,{className:`px-4 py-2 text-right font-mono text-white`,children:[t.weight,`g`]}),(0,Y.jsx)(`td`,{className:`px-4 py-2 text-center`,children:t.is_default?(0,Y.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-bambu-dark-tertiary text-bambu-gray`,children:e(`settings.catalog.default`)}):(0,Y.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-bambu-green/20 text-bambu-green`,children:e(`settings.catalog.custom`)})}),(0,Y.jsx)(`td`,{className:`px-4 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,Y.jsx)(`button`,{onClick:()=>N(t),className:`p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white`,children:(0,Y.jsx)(Ke,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>D(t),className:`p-1.5 rounded bg-red-500/10 hover:bg-red-500/20 text-red-500`,children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]})})]})},t.id))})]})})]}),E&&(0,Y.jsx)(Tt,{title:e(`settings.catalog.deleteEntry`),message:e(`settings.catalog.deleteConfirm`,{name:E.name}),confirmText:e(`common.delete`),variant:`danger`,onConfirm:F,onCancel:()=>D(null)}),C&&(0,Y.jsx)(Tt,{title:e(`settings.catalog.deleteSelected`),message:e(`settings.catalog.bulkDeleteConfirm`,{count:x.size}),confirmText:e(`common.delete`),variant:`danger`,onConfirm:async()=>{if(w(!1),x.size!==0)try{let n=await r.bulkDeleteCatalogEntries([...x]);i(e=>e.filter(e=>!x.has(e.id))),S(new Set),t(e(`settings.catalog.bulkDeleted`,{count:n.deleted}),`success`)}catch(n){console.error(`SpoolCatalogSettings.handleBulkDelete failed:`,n),t(e(`settings.catalog.bulkDeleteFailed`),`error`)}},onCancel:()=>w(!1)}),O&&(0,Y.jsx)(Tt,{title:e(`settings.catalog.resetCatalog`),message:e(`settings.catalog.resetConfirm`),confirmText:e(`common.reset`),variant:`danger`,onConfirm:ne,onCancel:()=>k(!1)})]})}function _i(){let{t:e}=l(),{showToast:t}=ee(),[n,i]=(0,X.useState)([]),[a,s]=(0,X.useState)(!0),[c,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(``),p=(0,X.useRef)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(``),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(`#FFFFFF`),[w,E]=(0,X.useState)(``),[D,O]=(0,X.useState)(``),[k,A]=(0,X.useState)(``),[j,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)(new Set),[te,F]=(0,X.useState)(!1),[ne,I]=(0,X.useState)(!1),[re,ie]=(0,X.useState)(null),[L,ae]=(0,X.useState)(null),[z,oe]=(0,X.useState)(!1),se=(0,X.useCallback)(async()=>{try{i(await r.getColorCatalog())}catch{t(e(`settings.colorCatalog.loadFailed`),`error`)}finally{s(!1)}},[t,e]);(0,X.useEffect)(()=>{se()},[se]);let B=[...new Set(n.map(e=>e.manufacturer))].sort(),ce=n.filter(e=>{let t=c===``||e.manufacturer.toLowerCase().includes(c.toLowerCase())||e.color_name.toLowerCase().includes(c.toLowerCase())||(e.material?.toLowerCase().includes(c.toLowerCase())??!1),n=d===``||e.manufacturer===d;return t&&n}),le=()=>{y(``),x(``),C(`#FFFFFF`),E(``),O(``),A(``)},ue=async()=>{if(!v.trim()||!b.trim()||!S){t(e(`settings.colorCatalog.fieldsRequired`),`error`);return}M(!0);try{let n=await r.addColorEntry({manufacturer:v.trim(),color_name:b.trim(),hex_color:S,material:w.trim()||null,extra_colors:D.trim()||null,effect_type:k.trim()||null});i(e=>[...e,n].sort((e,t)=>e.manufacturer.localeCompare(t.manufacturer)||(e.material||``).localeCompare(t.material||``)||e.color_name.localeCompare(t.color_name))),h(!1),le(),t(e(`settings.colorCatalog.colorAdded`),`success`)}catch{t(e(`settings.colorCatalog.addFailed`),`error`)}finally{M(!1)}},de=e=>{_(e.id),y(e.manufacturer),x(e.color_name),C(e.hex_color),E(e.material||``),O(e.extra_colors||``),A(e.effect_type||``)},fe=()=>{_(null),le()},V=async n=>{if(!v.trim()||!b.trim()||!S){t(e(`settings.colorCatalog.fieldsRequired`),`error`);return}M(!0);try{let a=await r.updateColorEntry(n,{manufacturer:v.trim(),color_name:b.trim(),hex_color:S,material:w.trim()||null,extra_colors:D.trim()||null,effect_type:k.trim()||null});i(e=>e.map(e=>e.id===n?a:e).sort((e,t)=>e.manufacturer.localeCompare(t.manufacturer)||(e.material||``).localeCompare(t.material||``)||e.color_name.localeCompare(t.color_name))),_(null),le(),t(e(`settings.colorCatalog.colorUpdated`),`success`)}catch{t(e(`settings.colorCatalog.updateFailed`),`error`)}finally{M(!1)}},pe=async()=>{if(L)try{await r.deleteColorEntry(L.id),i(e=>e.filter(e=>e.id!==L.id)),t(e(`settings.colorCatalog.colorDeleted`),`success`)}catch{t(e(`settings.colorCatalog.deleteFailed`),`error`)}finally{ae(null)}},me=async()=>{oe(!1),s(!0);try{await r.resetColorCatalog(),await se(),t(e(`settings.colorCatalog.resetSuccess`),`success`)}catch{t(e(`settings.colorCatalog.resetFailed`),`error`),s(!1)}},he=async()=>{I(!0),ie(null);try{let n={},r=o();r&&(n.Authorization=`Bearer ${r}`);let i=await fetch(`/api/v1/inventory/colors/sync`,{method:`POST`,headers:n});if(!i.ok)throw Error(`Failed to start sync`);let a=i.body?.getReader();if(!a)throw Error(`No response body`);let s=new TextDecoder,c=``;for(;;){let{done:n,value:r}=await a.read();if(n)break;c+=s.decode(r,{stream:!0});let i=c.split(` +`);c=i.pop()||``;for(let n of i)if(n.startsWith(`data: `))try{let r=JSON.parse(n.slice(6));r.type===`progress`?ie({fetched:r.total_fetched,total:r.total_available}):r.type===`complete`?r.added===0?t(e(`settings.colorCatalog.syncUpToDate`,{count:r.total_fetched}),`success`):t(e(`settings.colorCatalog.syncComplete`,{added:r.added,skipped:r.skipped}),`success`):r.type===`error`&&t(`${e(`settings.colorCatalog.syncError`)}: ${r.error}`,`error`)}catch{}}await se()}catch{t(e(`settings.colorCatalog.syncFailed`),`error`)}finally{I(!1),ie(null)}},ge=e=>{P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,Y.jsxs)(G,{id:`card-color-catalog`,children:[(0,Y.jsxs)(U,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,Y.jsx)(Nt,{className:`w-5 h-5 text-bambu-gray`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`settings.colorCatalog.title`)}),(0,Y.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[`(`,n.length,`)`]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,Y.jsxs)(`button`,{onClick:()=>{let r=n.map(({manufacturer:e,color_name:t,hex_color:n,material:r,extra_colors:i,effect_type:a})=>({manufacturer:e,color_name:t,hex_color:n,material:r,extra_colors:i,effect_type:a})),i=new Blob([JSON.stringify(r,null,2)],{type:`application/json`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`color-catalog.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a),t(e(`settings.colorCatalog.exported`,{count:n.length}),`success`)},className:`px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5`,children:[(0,Y.jsx)(sn,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.export`)})]}),(0,Y.jsxs)(`button`,{onClick:()=>p.current?.click(),className:`px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5`,children:[(0,Y.jsx)(Wt,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.import`)})]}),(0,Y.jsx)(`input`,{ref:p,type:`file`,accept:`.json`,className:`hidden`,onChange:async a=>{let o=a.target.files?.[0];if(o){try{let a=await o.text(),s=JSON.parse(a);if(!Array.isArray(s))throw Error(`Invalid format`);let c=0,l=0;for(let e of s){if(!e.manufacturer||!e.color_name||!e.hex_color){l++;continue}if(n.some(t=>t.manufacturer.toLowerCase()===e.manufacturer.toLowerCase()&&t.color_name.toLowerCase()===e.color_name.toLowerCase()&&(t.material||``).toLowerCase()===(e.material||``).toLowerCase())){l++;continue}try{let t=await r.addColorEntry({manufacturer:e.manufacturer,color_name:e.color_name,hex_color:e.hex_color,material:e.material||null,extra_colors:e.extra_colors||null,effect_type:e.effect_type||null});i(e=>[...e,t].sort((e,t)=>e.manufacturer.localeCompare(t.manufacturer)||(e.material||``).localeCompare(t.material||``)||e.color_name.localeCompare(t.color_name))),c++}catch{l++}}t(e(`settings.colorCatalog.imported`,{added:c,skipped:l}),`success`)}catch{t(e(`settings.colorCatalog.importFailed`),`error`)}p.current&&(p.current.value=``)}}}),(0,Y.jsxs)(`button`,{onClick:he,disabled:ne,className:`px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5`,title:e(`settings.colorCatalog.syncTooltip`),children:[ne?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Xe,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:ne?re?`${Math.min(re.fetched,re.total)} / ${re.total}`:e(`settings.colorCatalog.starting`):e(`settings.colorCatalog.sync`)})]}),(0,Y.jsxs)(`button`,{onClick:()=>oe(!0),className:`px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5`,children:[(0,Y.jsx)(nt,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.reset`)})]}),(0,Y.jsxs)(`button`,{onClick:()=>h(!0),className:`px-3 py-1.5 text-sm bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 transition-colors flex items-center gap-1.5`,children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.add`)})]})]}),N.size>0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mt-2 px-3 py-2 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-red-700 dark:text-red-400`,children:e(`settings.colorCatalog.selectedCount`,{count:N.size})}),(0,Y.jsxs)(`button`,{onClick:()=>F(!0),className:`ml-auto px-3 py-1.5 text-sm bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors flex items-center gap-1.5`,children:[(0,Y.jsx)(qe,{className:`w-4 h-4`}),e(`settings.colorCatalog.deleteSelected`)]}),(0,Y.jsx)(`button`,{onClick:()=>P(new Set),className:`px-3 py-1.5 text-sm text-bambu-gray hover:text-white transition-colors`,children:e(`common.cancel`)})]})]}),(0,Y.jsxs)(W,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`settings.colorCatalog.description`)}),(0,Y.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,Y.jsxs)(`div`,{className:`relative flex-1 min-w-[200px]`,children:[(0,Y.jsx)(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,Y.jsx)(`input`,{type:`text`,className:`w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:e(`settings.colorCatalog.searchColors`),value:c,onChange:e=>u(e.target.value)})]}),(0,Y.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:d,onChange:e=>f(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:e(`settings.colorCatalog.allManufacturers`)}),B.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]})]}),m&&(0,Y.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-white mb-3`,children:e(`settings.colorCatalog.addNewColor`)}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-2 items-end`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:e(`settings.colorCatalog.manufacturer`),value:v,onChange:e=>y(e.target.value)}),(0,Y.jsx)(`input`,{type:`text`,className:`px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:e(`settings.colorCatalog.colorName`),value:b,onChange:e=>x(e.target.value)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`color`,className:`w-20 h-10 rounded cursor-pointer border border-bambu-dark-tertiary`,value:S,onChange:e=>C(e.target.value)}),(0,Y.jsx)(`input`,{type:`text`,className:`w-32 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:`#FFFFFF`,value:S,onChange:e=>C(e.target.value)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`flex-1 max-w-lg min-w-[200px] px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:e(`settings.colorCatalog.materialOptional`),value:w,onChange:e=>E(e.target.value)}),(0,Y.jsxs)(`button`,{onClick:ue,disabled:j,className:`w-24 px-3 py-2 bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 flex items-center justify-center gap-3`,children:[j?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(T,{className:`w-4 h-4`}),e(`common.add`)]}),(0,Y.jsx)(`button`,{onClick:()=>{h(!1),le()},className:`p-2 ml-2 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary`,children:(0,Y.jsx)(Re,{className:`w-4 h-4`})})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2 mt-2`,children:[(0,Y.jsx)(`input`,{type:`text`,className:`px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:e(`inventory.extraColorsPlaceholder`),value:D,onChange:e=>O(e.target.value)}),(0,Y.jsx)(`select`,{className:`px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:k,onChange:e=>A(e.target.value),children:Ge.map(t=>(0,Y.jsx)(`option`,{value:t.value,children:e(t.labelKey)},t.value||`none`))})]})]}),(c||d)&&(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:e(`settings.colorCatalog.showing`,{filtered:ce.length,total:n.length})}),a?(0,Y.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-5 h-5 animate-spin mr-2`}),e(`common.loading`)]}):(0,Y.jsx)(`div`,{className:`max-h-[600px] overflow-auto border border-bambu-dark-tertiary rounded-lg`,children:(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{className:`bg-bambu-dark sticky top-0`,children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`px-2 py-2 w-10`,children:(0,Y.jsx)(`input`,{type:`checkbox`,checked:ce.length>0&&N.size===ce.length,onChange:()=>{N.size===ce.length?P(new Set):P(new Set(ce.map(e=>e.id)))},className:`w-4 h-4 accent-bambu-green cursor-pointer`})}),(0,Y.jsx)(`th`,{className:`px-3 py-2 text-left text-bambu-gray font-medium w-12`}),(0,Y.jsx)(`th`,{className:`px-3 py-2 text-left text-bambu-gray font-medium`,children:e(`settings.colorCatalog.manufacturer`)}),(0,Y.jsx)(`th`,{className:`px-3 py-2 text-left text-bambu-gray font-medium`,children:e(`inventory.material`)}),(0,Y.jsx)(`th`,{className:`px-3 py-2 text-left text-bambu-gray font-medium`,children:e(`settings.colorCatalog.colorName`)}),(0,Y.jsx)(`th`,{className:`px-3 py-2 text-left text-bambu-gray font-medium w-24`,children:e(`settings.colorCatalog.hex`)}),(0,Y.jsx)(`th`,{className:`px-3 py-2 w-16`})]})}),(0,Y.jsx)(`tbody`,{children:ce.length===0?(0,Y.jsx)(`tr`,{children:(0,Y.jsx)(`td`,{colSpan:7,className:`px-3 py-8 text-center text-bambu-gray`,children:e(c||d?`settings.colorCatalog.noMatch`:`settings.colorCatalog.empty`)})}):ce.map(t=>(0,Y.jsxs)(X.Fragment,{children:[(0,Y.jsx)(`tr`,{className:`border-t border-bambu-dark-tertiary hover:bg-bambu-dark ${N.has(t.id)?`bg-bambu-dark`:``}`,children:g===t.id?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`td`,{className:`px-2 py-2`,children:(0,Y.jsx)(`input`,{type:`checkbox`,checked:N.has(t.id),onChange:()=>ge(t.id),className:`w-4 h-4 accent-bambu-green cursor-pointer`})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsx)(`input`,{type:`color`,className:`w-8 h-8 rounded cursor-pointer border border-bambu-dark-tertiary`,value:S,onChange:e=>C(e.target.value)})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsx)(`input`,{type:`text`,className:`w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,value:v,onChange:e=>y(e.target.value)})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsx)(`input`,{type:`text`,className:`w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,value:w,onChange:e=>E(e.target.value)})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsx)(`input`,{type:`text`,className:`w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,value:b,onChange:e=>x(e.target.value)})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsx)(`input`,{type:`text`,className:`w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,value:S,onChange:e=>C(e.target.value)})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,Y.jsx)(`button`,{onClick:()=>V(t.id),disabled:j,className:`p-1.5 rounded hover:bg-green-500/20 text-green-500`,children:j?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(T,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:fe,className:`p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray`,children:(0,Y.jsx)(Re,{className:`w-4 h-4`})})]})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`td`,{className:`px-2 py-2`,children:(0,Y.jsx)(`input`,{type:`checkbox`,checked:N.has(t.id),onChange:()=>ge(t.id),className:`w-4 h-4 accent-bambu-green cursor-pointer`})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsx)(on,{rgba:t.hex_color.replace(/^#/,``)+(t.hex_color.length===7?`FF`:``),extraColors:t.extra_colors,effectType:t.effect_type,className:`w-8 h-8`,shape:`square`,title:t.hex_color,effectSize:`table`})}),(0,Y.jsx)(`td`,{className:`px-3 py-2 text-white`,children:t.manufacturer}),(0,Y.jsx)(`td`,{className:`px-3 py-2 text-bambu-gray`,children:t.material||`-`}),(0,Y.jsx)(`td`,{className:`px-3 py-2 text-white`,children:t.color_name}),(0,Y.jsx)(`td`,{className:`px-3 py-2 font-mono text-xs text-bambu-gray`,children:t.hex_color}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,Y.jsx)(`button`,{onClick:()=>de(t),className:`p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white`,children:(0,Y.jsx)(Ke,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>ae(t),className:`p-1.5 rounded bg-red-500/10 hover:bg-red-500/20 text-red-500`,children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]})})]})}),g===t.id&&(0,Y.jsxs)(`tr`,{className:`border-t border-bambu-dark-tertiary/50 bg-bambu-dark`,children:[(0,Y.jsx)(`td`,{colSpan:2}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,colSpan:2,children:(0,Y.jsx)(`input`,{type:`text`,className:`w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm font-mono focus:border-bambu-green focus:outline-none`,placeholder:e(`inventory.extraColorsPlaceholder`),value:D,onChange:e=>O(e.target.value)})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,colSpan:2,children:(0,Y.jsx)(`select`,{className:`w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,value:k,onChange:e=>A(e.target.value),children:Ge.map(t=>(0,Y.jsx)(`option`,{value:t.value,children:e(t.labelKey)},t.value||`none`))})}),(0,Y.jsx)(`td`,{})]})]},t.id))})]})})]}),L&&(0,Y.jsx)(Tt,{title:e(`settings.colorCatalog.deleteColor`),message:e(`settings.colorCatalog.deleteConfirm`,{name:`${L.manufacturer} - ${L.color_name}`}),confirmText:e(`common.delete`),variant:`danger`,onConfirm:pe,onCancel:()=>ae(null)}),te&&(0,Y.jsx)(Tt,{title:e(`settings.colorCatalog.deleteSelected`),message:e(`settings.colorCatalog.bulkDeleteConfirm`,{count:N.size}),confirmText:e(`common.delete`),variant:`danger`,onConfirm:async()=>{if(F(!1),N.size!==0)try{let n=await r.bulkDeleteColorEntries([...N]);i(e=>e.filter(e=>!N.has(e.id))),P(new Set),t(e(`settings.colorCatalog.bulkDeleted`,{count:n.deleted}),`success`)}catch{t(e(`settings.colorCatalog.bulkDeleteFailed`),`error`)}},onCancel:()=>F(!1)}),z&&(0,Y.jsx)(Tt,{title:e(`settings.colorCatalog.resetCatalog`),message:e(`settings.colorCatalog.resetConfirm`),confirmText:e(`common.reset`),variant:`danger`,onConfirm:me,onCancel:()=>oe(!1)})]})}function vi({link:e,onClose:t}){let{t:n}=l(),i=u(),a=!!e,o=(0,X.useRef)(null),[s,c]=(0,X.useState)(e?.name||``),[d,p]=(0,X.useState)(e?.url||``),[m,h]=(0,X.useState)(e?.icon||`link`),[g,_]=(0,X.useState)(e?.open_in_new_tab||!1),[v,y]=(0,X.useState)(!!e?.custom_icon),[b,x]=(0,X.useState)(e?.custom_icon?r.getExternalLinkIconUrl(e.id):null),[S,C]=(0,X.useState)(null),[w,T]=(0,X.useState)(null);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let E=f({mutationFn:async e=>{let t=await r.createExternalLink(e);return S?await r.uploadExternalLinkIcon(t.id,S):t},onSuccess:()=>{i.invalidateQueries({queryKey:[`external-links`]}),t()},onError:e=>{T(e.message)}}),D=f({mutationFn:async t=>{let n=await r.updateExternalLink(e.id,t);return S?n=await r.uploadExternalLinkIcon(e.id,S):!v&&e?.custom_icon&&(n=await r.deleteExternalLinkIcon(e.id)),n},onSuccess:()=>{i.invalidateQueries({queryKey:[`external-links`]}),t()},onError:e=>{T(e.message)}}),O=e=>{let t=e.target.files?.[0];if(t){if(![`image/png`,`image/jpeg`,`image/gif`,`image/svg+xml`,`image/webp`,`image/x-icon`].includes(t.type)){T(`Please select a valid image file (PNG, JPG, GIF, SVG, WebP, or ICO)`);return}if(t.size>1024*1024){T(`Image file must be less than 1MB`);return}C(t),y(!0);let e=new FileReader;e.onload=e=>{x(e.target?.result)},e.readAsDataURL(t)}},k=()=>{C(null),x(null),y(!1),o.current&&(o.current.value=``)},A=e=>{if(e.preventDefault(),T(null),!s.trim()){T(`Name is required`);return}if(!d.trim()){T(`URL is required`);return}if(!d.startsWith(`http://`)&&!d.startsWith(`https://`)){T(`URL must start with http:// or https://`);return}let t={name:s.trim(),url:d.trim(),icon:m,open_in_new_tab:g};a?D.mutate(t):E.mutate(t)},ee=E.isPending||D.isPending,j=Lt(m);return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`p-2 rounded-full bg-bambu-green/20 text-bambu-green`,children:v&&b?(0,Y.jsx)(`img`,{src:b,alt:``,className:`w-5 h-5 rounded`}):(0,Y.jsx)(j,{className:`w-5 h-5`})}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:a?`Edit Link`:`Add External Link`})]}),(0,Y.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`form`,{onSubmit:A,className:`p-6 space-y-4`,children:[w&&(0,Y.jsx)(`div`,{className:`p-3 bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/50 rounded-lg text-sm text-red-700 dark:text-red-400`,children:w}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Name *`}),(0,Y.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`My Link`,maxLength:50,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`URL *`}),(0,Y.jsx)(`input`,{type:`text`,value:d,onChange:e=>p(e.target.value),placeholder:`https://example.com`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`label`,{className:`text-sm text-bambu-gray`,children:n(`externalLinks.openInNewTab`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>_(!g),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${g?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,children:(0,Y.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${g?`translate-x-6`:`translate-x-1`}`})})]}),(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray`,children:`Icon`}),(0,Y.jsxs)(`div`,{className:`p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:`Custom Icon`}),(0,Y.jsx)(`input`,{ref:o,type:`file`,accept:`image/png,image/jpeg,image/gif,image/svg+xml,image/webp,image/x-icon`,className:`hidden`,onChange:O}),v&&b?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`img`,{src:b,alt:`Custom icon`,className:`w-8 h-8 rounded border border-bambu-dark-tertiary`}),(0,Y.jsx)(`button`,{type:`button`,onClick:k,className:`p-1 text-red-700 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 transition-colors`,title:`Remove custom icon`,children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]}):(0,Y.jsxs)(K,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>o.current?.click(),children:[(0,Y.jsx)(Wt,{className:`w-4 h-4`}),`Upload`]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:`PNG, JPG, GIF, SVG, WebP, or ICO. Max 1MB.`})]}),!v&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray block mb-2`,children:`Or choose a preset icon`}),(0,Y.jsx)(Bt,{value:m,onChange:h})]})]}),(0,Y.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,Y.jsx)(K,{type:`button`,variant:`secondary`,onClick:t,className:`flex-1`,children:`Cancel`}),(0,Y.jsxs)(K,{type:`submit`,disabled:ee,className:`flex-1`,children:[ee?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(_t,{className:`w-4 h-4`}),a?`Save`:`Add`]})]})]})]})})}function yi(){let{t:e}=l(),t=u(),{authEnabled:n,hasPermission:i}=un(),{showToast:a}=ee(),[o,s]=(0,X.useState)(!1),[c,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(jt),[S,C]=(0,X.useState)(()=>Pt(kt.map(e=>e.id))),{data:w,isLoading:T}=d({queryKey:[`external-links`],queryFn:r.getExternalLinks}),E=f({mutationFn:e=>r.deleteExternalLink(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`external-links`]})}}),{data:D}=d({queryKey:[`settings`],queryFn:r.getSettings,enabled:n&&i(`settings:update`)}),O=f({mutationFn:e=>r.updateSettings({default_sidebar_order:e}),onSuccess:(n,r)=>{t.invalidateQueries({queryKey:[`settings`]}),t.invalidateQueries({queryKey:[`default-sidebar-order`]}),a(e(r?`settings.sidebarDefaultSet`:`settings.sidebarDefaultCleared`),`success`)},onError:()=>{a(e(`settings.sidebarDefaultFailed`),`error`)}}),k=(0,X.useMemo)(()=>{let e=new Map(kt.map(e=>[e.id,e])),t=new Map((w||[]).map(e=>[`ext-${e.id}`,e])),n=[],r=new Set,i=i=>{if(r.has(i))return;let a=e.get(i);if(a){n.push({type:`system`,id:i,navItem:a}),r.add(i);return}let o=t.get(i);o&&(n.push({type:`external`,id:i,link:o}),r.add(i))};return S.forEach(i),kt.forEach(e=>i(e.id)),(w||[]).forEach(e=>i(`ext-${e.id}`)),n},[w,S]),A=e=>{C(e),qt(e)},j=(e,t)=>{_(t),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t)},M=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,y(t)},N=(e,t)=>{if(e.preventDefault(),g===null||g===t){_(null),y(null);return}let n=k.map(e=>e.id),r=n.indexOf(g),i=n.indexOf(t);if(r===-1||i===-1){_(null),y(null);return}n.splice(r,1),n.splice(i,0,g),A(n),_(null),y(null)},P=()=>{_(null),y(null)},te=e=>{h(e)},ne=()=>{m&&(E.mutate(m.id),h(null))},re=()=>{let e=[...kt.map(e=>e.id),...(w||[]).map(e=>`ext-${e.id}`)];x([]),C(e),Qt([]),qt(e)},ie=e=>{let t=k.map(e=>e.id);O.mutate(e?JSON.stringify({order:t,hiddenSystemItemIds:b}):``)},L=e=>{if(e===`settings`)return;let t=b.includes(e)?b.filter(t=>t!==e):[...b,e];x(t),Qt(t)},z=n&&i(`settings:update`),oe=!!D?.default_sidebar_order;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(G,{id:`card-sidebar-links`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-y-2 gap-x-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ae,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`externalLinks.sidebarLayout`)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[z&&(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Y.jsx)(`span`,{children:e(`settings.setDefault`)}),(0,Y.jsx)(J,{checked:oe,onChange:ie,disabled:O.isPending})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:re,className:`whitespace-nowrap`,children:[(0,Y.jsx)(nt,{className:`w-4 h-4`}),e(`settings.reset`)]}),(0,Y.jsxs)(K,{size:`sm`,onClick:()=>s(!0),className:`whitespace-nowrap`,children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),`Add Link`]})]})]})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:e(`externalLinks.sidebarLayoutDescription`)}),T?(0,Y.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,Y.jsx)(R,{className:`w-6 h-6 text-bambu-green animate-spin`})}):(0,Y.jsx)(`div`,{className:`space-y-2`,children:k.map(t=>{let n=t.type===`system`&&b.includes(t.id),i=t.id===`settings`;if(t.type===`system`){let r=t.navItem.icon;return(0,Y.jsxs)(`div`,{draggable:!0,onDragStart:e=>j(e,t.id),onDragOver:e=>M(e,t.id),onDragLeave:()=>y(null),onDrop:e=>N(e,t.id),onDragEnd:P,className:`relative flex items-center gap-3 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary transition-colors ${g===t.id?`opacity-50`:n?`opacity-60`:``} ${v===t.id&&g!==t.id?`before:absolute before:left-3 before:right-3 before:top-0 before:h-0.5 before:bg-bambu-green`:``}`,children:[(0,Y.jsx)(I,{className:`w-6 h-6 md:w-4 md:h-4 text-bambu-gray cursor-grab flex-shrink-0`}),(0,Y.jsx)(`div`,{className:`p-2 rounded-lg bg-bambu-dark-tertiary text-bambu-gray`,children:(0,Y.jsx)(r,{className:`w-4 h-4`})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`span`,{className:`text-white font-medium truncate block`,children:e(t.navItem.labelKey)}),(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray truncate block`,children:e(i?`externalLinks.requiredInSidebar`:n?`externalLinks.hiddenFromSidebar`:`externalLinks.visibleInSidebar`)})]}),(0,Y.jsx)(`button`,{onClick:()=>L(t.id),disabled:i,className:`p-2 rounded-lg hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors flex-shrink-0 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-bambu-gray`,title:e(i?`externalLinks.settingsCannotBeHidden`:n?`externalLinks.showPage`:`externalLinks.hidePage`),"aria-label":e(i?`externalLinks.settingsCannotBeHidden`:n?`externalLinks.showPage`:`externalLinks.hidePage`),children:n?(0,Y.jsx)(F,{className:`w-4 h-4`}):(0,Y.jsx)(mt,{className:`w-4 h-4`})})]},t.id)}let a=t.link,o=Lt(a.icon);return(0,Y.jsxs)(`div`,{draggable:!0,onDragStart:e=>j(e,t.id),onDragOver:e=>M(e,t.id),onDragLeave:()=>y(null),onDrop:e=>N(e,t.id),onDragEnd:P,className:`relative flex items-center gap-3 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary transition-colors ${g===t.id?`opacity-50`:``} ${v===t.id&&g!==t.id?`before:absolute before:left-3 before:right-3 before:top-0 before:h-0.5 before:bg-bambu-green`:``}`,children:[(0,Y.jsx)(I,{className:`w-6 h-6 md:w-4 md:h-4 text-bambu-gray cursor-grab flex-shrink-0`}),(0,Y.jsx)(`div`,{className:`p-2 rounded-lg bg-bambu-dark-tertiary text-bambu-gray`,children:a.custom_icon?(0,Y.jsx)(`img`,{src:r.getExternalLinkIconUrl(a.id),alt:``,className:`w-4 h-4`}):(0,Y.jsx)(o,{className:`w-4 h-4`})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-white font-medium truncate`,children:a.name}),(0,Y.jsx)(Je,{className:`w-3 h-3 text-bambu-gray flex-shrink-0`})]}),(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray truncate block`,children:a.url})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[(0,Y.jsx)(`button`,{onClick:()=>p(a),className:`p-2 rounded-lg hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors`,title:e(`common.edit`),children:(0,Y.jsx)(Ke,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>te(a),disabled:E.isPending,className:`p-2 rounded-lg hover:bg-red-100 dark:hover:bg-red-500/20 text-bambu-gray hover:text-red-900 dark:hover:text-red-400 transition-colors disabled:opacity-50`,title:e(`externalLinks.deleteLink`),children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]})]},t.id)})})]})]}),(o||c)&&(0,Y.jsx)(vi,{link:c,onClose:()=>{s(!1),p(null)}}),m&&(0,Y.jsx)(Tt,{title:`Delete Link`,message:`Are you sure you want to delete "${m.name}"? This action cannot be undone.`,confirmText:`Delete`,cancelText:`Cancel`,variant:`danger`,onConfirm:ne,onCancel:()=>h(null)})]})}async function bi(e){if(navigator.clipboard&&window.isSecureContext)try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t);try{return t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.parentNode&&t.parentNode.removeChild(t)}}function xi(e,t,n=`text/plain`){let r=new Blob([e],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}function Si({status:e}){return e===`pass`?(0,Y.jsx)(q,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}):e===`fail`?(0,Y.jsx)(O,{className:`w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0`}):e===`warn`?(0,Y.jsx)(Ie,{className:`w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0`}):(0,Y.jsx)(Ut,{className:`w-5 h-5 text-bambu-gray flex-shrink-0`})}function Ci({vpId:e,vpName:t,onClose:n}){let{t:r}=l(),i=f({mutationFn:()=>a.diagnose(e)});(0,X.useEffect)(()=>{i.mutate()},[]),(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);let o=i.data,s=o?.overall===`ok`?`bg-bambu-green/10 border-bambu-green/30 text-bambu-green`:o?.overall===`warnings`?`bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-300`:`bg-red-50 dark:bg-red-500/10 border-red-300 dark:border-red-500/30 text-red-700 dark:text-red-300`;return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:n,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg flex flex-col max-h-[85vh]`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Y.jsx)(et,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,children:r(`vpDiagnostic.title`,{name:t})})]}),(0,Y.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,title:r(`common.close`),children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`div`,{className:`p-6 space-y-4 overflow-y-auto`,children:[i.isPending&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),(0,Y.jsx)(`span`,{children:r(`vpDiagnostic.running`)})]}),i.isError&&(0,Y.jsx)(`div`,{className:`rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:r(`vpDiagnostic.runFailed`,{error:i.error.message})}),o&&(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`ol`,{className:`space-y-2`,children:o.checks.map(e=>{let t=r(`vpDiagnostic.check.${e.id}.${e.status}`,{...e.params,defaultValue:``});return(0,Y.jsxs)(`li`,{className:`flex items-start gap-3 bg-bambu-dark rounded-lg px-4 py-2.5 ${e.status===`skip`?`opacity-60`:``}`,children:[(0,Y.jsx)(`div`,{className:`mt-0.5`,children:(0,Y.jsx)(Si,{status:e.status})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-sm text-white`,children:r(`vpDiagnostic.check.${e.id}.title`,e.params)}),t&&(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray mt-0.5`,children:t})]})]},e.id)})}),(0,Y.jsx)(`div`,{className:`rounded-lg border px-4 py-3 text-sm ${s}`,children:r(`vpDiagnostic.overall.${o.overall}`)})]})]}),(0,Y.jsxs)(`div`,{className:`px-6 py-4 border-t border-bambu-dark-tertiary flex justify-end gap-2`,children:[(0,Y.jsx)(`button`,{onClick:()=>i.mutate(),disabled:i.isPending,className:`px-4 py-2 bg-bambu-dark hover:bg-bambu-dark-tertiary disabled:opacity-50 text-white text-sm rounded-lg transition-colors`,children:r(`vpDiagnostic.retry`)}),(0,Y.jsx)(`button`,{onClick:n,className:`px-4 py-2 bg-bambu-green hover:bg-bambu-green/90 text-white text-sm rounded-lg transition-colors`,children:r(`common.close`)})]})]})})}var wi={archive:`archive`,review:`review`,queue:`queue`,proxy:`proxy`};function Ti(e){return e===`immediate`?`archive`:e===`print_queue`||e===`queue`?`queue`:e===`archive`||e===`review`||e===`proxy`?e:`archive`}function Ei({printer:e,models:t}){let{t:n}=l(),i=u(),{showToast:o}=ee(),[s,c]=(0,X.useState)(!0),[p,m]=(0,X.useState)(e.enabled),[h,g]=(0,X.useState)(e.name),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(Ti(e.mode)),[x,S]=(0,X.useState)(e.target_printer_id),[C,w]=(0,X.useState)(e.bind_ip||``),[D,O]=(0,X.useState)(e.remote_interface_ip||``),[k,j]=(0,X.useState)(e.model||``),[M,P]=(0,X.useState)(e.auto_dispatch??!0),[te,ne]=(0,X.useState)(e.queue_force_color_match??!1),[I,re]=(0,X.useState)(e.save_ams_mapping??!1),[ie,L]=(0,X.useState)(e.gcode_injection??!1),[ae,z]=(0,X.useState)(e.tailscale_disabled??!0),[oe,se]=(0,X.useState)(!1),[B,ce]=(0,X.useState)(null),[le,ue]=(0,X.useState)(!1),[de,fe]=(0,X.useState)(!1),[V,pe]=(0,X.useState)(!1),{data:me}=d({queryKey:[`tailscale-status`],queryFn:a.getTailscaleStatus,enabled:!ae,staleTime:6e4}),he=me?.available?me.fqdn:``,ge=me?.available?me.tailscale_ips?.[0]??``:``,_e=async e=>{e.stopPropagation();let t=he;t&&(await bi(t)?(pe(!0),o(n(`printers.copied`)),setTimeout(()=>pe(!1),2e3)):o(n(`virtualPrinter.toast.copyFailed`),`error`))};(0,X.useEffect)(()=>{B||(m(e.enabled),b(Ti(e.mode)),g(e.name),S(e.target_printer_id),w(e.bind_ip||``),O(e.remote_interface_ip||``),j(e.model||``),P(e.auto_dispatch??!0),ne(e.queue_force_color_match??!1),re(e.save_ams_mapping??!1),L(e.gcode_injection??!1),z(e.tailscale_disabled??!0))},[e,B]);let{data:ve}=d({queryKey:[`printers`],queryFn:r.getPrinters}),{data:ye}=d({queryKey:[`network-interfaces`],queryFn:()=>r.getNetworkInterfaces().then(e=>e.interfaces)}),be=f({mutationFn:t=>a.update(e.id,t),onSuccess:()=>{i.invalidateQueries({queryKey:[`virtual-printers`]}),o(n(`virtualPrinter.toast.updated`)),ce(null)},onError:t=>{o(t.message||n(`virtualPrinter.toast.failedToUpdate`),`error`),m(e.enabled),b(Ti(e.mode)),S(e.target_printer_id),w(e.bind_ip||``),z(e.tailscale_disabled??!0),ne(e.queue_force_color_match??!1),re(e.save_ams_mapping??!1),L(e.gcode_injection??!1),ce(null)}}),H=f({mutationFn:()=>a.remove(e.id),onSuccess:()=>{i.invalidateQueries({queryKey:[`virtual-printers`]}),o(n(`virtualPrinter.toast.deleted`)),ue(!1)},onError:e=>{o(e.message||n(`virtualPrinter.toast.failedToDelete`),`error`),ue(!1)}}),xe=t=>{t.stopPropagation();let r=!p;if(r){if(!C){o(n(`virtualPrinter.toast.bindIpRequired`),`error`);return}if(y===`proxy`){if(!x){o(n(`virtualPrinter.toast.targetPrinterRequired`),`error`);return}}else if(!_&&!e.access_code_set){o(n(`virtualPrinter.toast.accessCodeRequired`),`error`);return}}m(r),ce(`toggle`),be.mutate({enabled:r})},Se=()=>{h.trim()&&(ce(`name`),be.mutate({name:h.trim()}))},Ce=()=>{if(!_){o(n(`virtualPrinter.toast.accessCodeEmpty`),`error`);return}if(_.length!==8){o(n(`virtualPrinter.toast.accessCodeLength`),`error`);return}ce(`accessCode`),be.mutate({access_code:_}),v(``)},we=e=>{b(e),ce(`mode`),be.mutate({mode:e})},Te=e=>{j(e),ce(`model`),be.mutate({model:e})},Ee=e=>{let t=Ae?.access_code,r=ve?.find(t=>t.id===e)?.access_code;S(e),ce(`targetPrinter`),be.mutate({target_printer_id:e},{onSuccess:()=>{t&&r&&t!==r&&o(n(`virtualPrinter.toast.targetCodeChangedRebind`),`info`)}})},De=e=>{O(e),ce(`remoteInterface`),be.mutate({remote_interface_ip:e})},Oe=e.status?.running||!1,ke=n(`virtualPrinter.mode.${wi[y]||`archive`}`),Ae=ve?.find(e=>e.id===x),je=Ae?.name,Me=!!x,Ne=Me?Ae?.access_code??``:``;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(G,{className:`overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`px-4 py-3 flex items-center gap-3 cursor-pointer select-none`,onClick:()=>c(!s),children:[(0,Y.jsx)(`button`,{className:`text-bambu-gray flex-shrink-0`,children:s?(0,Y.jsx)(E,{className:`w-4 h-4`}):(0,Y.jsx)(st,{className:`w-4 h-4`})}),(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0 ${Oe?`bg-green-400 animate-pulse`:`bg-gray-500`}`}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Y.jsx)(`span`,{className:`text-white font-medium truncate max-w-full`,children:e.name}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray flex-shrink-0`,children:ke}),e.model_name&&(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray flex-shrink-0`,children:e.model_name}),je&&(0,Y.jsxs)(`span`,{className:`text-xs text-bambu-gray truncate max-w-full`,children:[y===`proxy`&&(0,Y.jsx)(_n,{className:`w-3 h-3 inline mr-1`}),je]}),C&&(0,Y.jsx)(`span`,{className:`text-[10px] text-bambu-gray flex-shrink-0 font-mono`,children:C}),D&&(0,Y.jsx)(`span`,{className:`text-[10px] text-bambu-gray flex-shrink-0 font-mono`,children:D})]}),(0,Y.jsx)(`div`,{className:`ml-auto flex items-center gap-2 flex-shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Y.jsx)(`button`,{onClick:xe,disabled:B===`toggle`,className:`relative w-10 h-5 rounded-full transition-colors ${p?`bg-bambu-green`:`bg-bambu-dark-tertiary`} ${B===`toggle`?`opacity-50`:``}`,children:(0,Y.jsx)(`span`,{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform ${p?`translate-x-5`:``}`})})})]}),s&&(0,Y.jsxs)(W,{className:`pt-0 space-y-4`,children:[(0,Y.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),onBlur:Se,onKeyDown:e=>e.key===`Enter`&&Se(),className:`flex-1 text-sm text-white bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`button`,{onClick:()=>fe(!0),className:`p-1.5 text-bambu-gray hover:text-bambu-green transition-colors flex-shrink-0`,title:n(`vpDiagnostic.runButton`),children:(0,Y.jsx)(et,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>ue(!0),className:`p-1.5 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors flex-shrink-0`,title:n(`common.delete`),children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 -mt-2`,children:[he&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-green-700/80 dark:text-green-400/70 min-w-0`,children:[(0,Y.jsx)(Cn,{className:`w-3.5 h-3.5 flex-shrink-0`}),(0,Y.jsx)(`span`,{className:`font-mono text-xs truncate`,children:ge?`${ge} (${he})`:he}),(0,Y.jsx)(`button`,{onClick:_e,className:`p-0.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors flex-shrink-0`,title:n(V?`printers.copied`:`printers.copyToClipboard`),children:V?(0,Y.jsx)(T,{className:`w-3.5 h-3.5 text-bambu-green`}):(0,Y.jsx)(N,{className:`w-3.5 h-3.5`})})]}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray font-mono ml-auto flex-shrink-0`,children:e.serial})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium mb-2`,children:n(`virtualPrinter.mode.title`)}),(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[`archive`,`review`,`queue`,`proxy`].map(e=>(0,Y.jsxs)(`button`,{onClick:()=>we(e),disabled:B===`mode`,className:`p-2 rounded-lg border text-left transition-colors ${y===e?e===`proxy`?`border-blue-500 bg-blue-500/10`:`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-white text-xs font-medium`,children:[e===`proxy`&&(0,Y.jsx)(_n,{className:`w-3 h-3`}),n(`virtualPrinter.mode.${wi[e]}`)]}),(0,Y.jsx)(`div`,{className:`text-[10px] text-bambu-gray`,children:n(`virtualPrinter.mode.${wi[e]}Desc`)})]},e))})]}),y===`queue`&&(0,Y.jsx)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium`,children:n(`virtualPrinter.autoDispatch.title`)}),(0,Y.jsx)(`div`,{className:`text-[10px] text-bambu-gray`,children:n(`virtualPrinter.autoDispatch.description`)})]}),(0,Y.jsx)(`button`,{onClick:()=>{let e=!M;P(e),ce(`autoDispatch`),be.mutate({auto_dispatch:e})},disabled:B===`autoDispatch`,className:`relative w-10 h-5 rounded-full transition-colors flex-shrink-0 ${M?`bg-bambu-green`:`bg-bambu-dark-tertiary`} ${B===`autoDispatch`?`opacity-50`:``}`,children:(0,Y.jsx)(`span`,{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform ${M?`translate-x-5`:``}`})})]})}),y===`queue`&&(0,Y.jsx)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium`,children:n(`virtualPrinter.queueForceColorMatch.title`)}),(0,Y.jsx)(`div`,{className:`text-[10px] text-bambu-gray`,children:n(`virtualPrinter.queueForceColorMatch.description`)})]}),(0,Y.jsx)(`button`,{onClick:()=>{let e=!te;ne(e),ce(`queueForceColorMatch`),be.mutate({queue_force_color_match:e})},disabled:B===`queueForceColorMatch`,className:`relative w-10 h-5 rounded-full transition-colors flex-shrink-0 ${te?`bg-bambu-green`:`bg-bambu-dark-tertiary`} ${B===`queueForceColorMatch`?`opacity-50`:``}`,children:(0,Y.jsx)(`span`,{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform ${te?`translate-x-5`:``}`})})]})}),y===`queue`&&(0,Y.jsx)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium`,children:n(`virtualPrinter.saveAmsMapping.title`)}),(0,Y.jsx)(`div`,{className:`text-[10px] text-bambu-gray`,children:n(`virtualPrinter.saveAmsMapping.description`)})]}),(0,Y.jsx)(`button`,{onClick:()=>{let e=!I;re(e),ce(`saveAmsMapping`),be.mutate({save_ams_mapping:e})},disabled:B===`saveAmsMapping`,className:`relative w-10 h-5 rounded-full transition-colors flex-shrink-0 ${I?`bg-bambu-green`:`bg-bambu-dark-tertiary`} ${B===`saveAmsMapping`?`opacity-50`:``}`,children:(0,Y.jsx)(`span`,{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform ${I?`translate-x-5`:``}`})})]})}),y===`queue`&&(0,Y.jsx)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium`,children:n(`virtualPrinter.gcodeInjection.title`)}),(0,Y.jsx)(`div`,{className:`text-[10px] text-bambu-gray`,children:n(`virtualPrinter.gcodeInjection.description`)})]}),(0,Y.jsx)(`button`,{onClick:()=>{let e=!ie;L(e),ce(`gcodeInjection`),be.mutate({gcode_injection:e})},disabled:B===`gcodeInjection`,className:`relative w-10 h-5 rounded-full transition-colors flex-shrink-0 ${ie?`bg-bambu-green`:`bg-bambu-dark-tertiary`} ${B===`gcodeInjection`?`opacity-50`:``}`,children:(0,Y.jsx)(`span`,{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform ${ie?`translate-x-5`:``}`})})]})}),(0,Y.jsx)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium`,children:n(`virtualPrinter.tailscaleDisabled.title`)}),(0,Y.jsx)(`div`,{className:`text-[10px] text-bambu-gray`,children:n(`virtualPrinter.tailscaleDisabled.description`)})]}),(0,Y.jsx)(`button`,{onClick:()=>{let e=!ae;z(e),ce(`tailscaleDisabled`),be.mutate({tailscale_disabled:e})},disabled:B===`tailscaleDisabled`,className:`relative w-10 h-5 rounded-full transition-colors shrink-0 ${ae?`bg-bambu-dark-tertiary`:`bg-bambu-green`} ${B===`tailscaleDisabled`?`opacity-50`:``}`,children:(0,Y.jsx)(`span`,{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform ${ae?``:`translate-x-5`}`})})]})}),y!==`proxy`&&(0,Y.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium mb-1`,children:n(`virtualPrinter.model.title`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:n(`virtualPrinter.model.description`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`select`,{value:k,onChange:e=>Te(e.target.value),disabled:B===`model`,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm appearance-none cursor-pointer disabled:opacity-50 pr-10`,children:Object.entries(t).map(([e,t])=>(0,Y.jsxs)(`option`,{value:e,children:[t,` (`,e,`)`]},e))}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),y===`proxy`&&(0,Y.jsx)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 p-2 rounded bg-blue-50 border border-blue-300 dark:bg-blue-500/10 dark:border-blue-500/30`,children:[(0,Y.jsx)(A,{className:`w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`virtualPrinter.proxy.accessCodeHint`)})]})}),y!==`proxy`&&(0,Y.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium`,children:n(`virtualPrinter.accessCode.title`)}),Me?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-blue-700 dark:text-blue-400`,children:[(0,Y.jsx)(A,{className:`w-3 h-3`}),n(`virtualPrinter.accessCode.inheritedFromTarget`)]}):e.access_code_set?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-green-700 dark:text-green-400`,children:[(0,Y.jsx)(T,{className:`w-3 h-3`}),n(`virtualPrinter.accessCode.isSet`)]}):(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-yellow-700 dark:text-yellow-400`,children:[(0,Y.jsx)(Ie,{className:`w-3 h-3`}),n(`virtualPrinter.accessCode.notSet`)]})]}),Me?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`input`,{type:oe?`text`:`password`,value:Ne,readOnly:!0,"aria-label":n(`virtualPrinter.accessCode.title`),className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm pr-10 font-mono opacity-90 cursor-default`}),(0,Y.jsx)(`button`,{onClick:()=>se(!oe),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,"aria-label":n(oe?`virtualPrinter.accessCode.hide`:`virtualPrinter.accessCode.reveal`),children:oe?(0,Y.jsx)(F,{className:`w-4 h-4`}):(0,Y.jsx)(mt,{className:`w-4 h-4`})})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`virtualPrinter.accessCode.derivedFromTargetHint`)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Y.jsx)(`input`,{type:oe?`text`:`password`,value:_,onChange:e=>v(e.target.value),placeholder:e.access_code_set?n(`virtualPrinter.accessCode.placeholderChange`):n(`virtualPrinter.accessCode.placeholder`),maxLength:8,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm placeholder-bambu-gray pr-10 font-mono`}),(0,Y.jsx)(`button`,{onClick:()=>se(!oe),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:oe?(0,Y.jsx)(F,{className:`w-4 h-4`}):(0,Y.jsx)(mt,{className:`w-4 h-4`})})]}),(0,Y.jsx)(K,{onClick:Ce,disabled:!_||B===`accessCode`,variant:`primary`,children:B===`accessCode`?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):n(`common.save`)})]}),_&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:(0,Y.jsx)(`span`,{className:_.length===8?`text-green-700 dark:text-green-400`:`text-yellow-700 dark:text-yellow-400`,children:n(`virtualPrinter.accessCode.charCount`,{count:_.length})})})]})]}),(0,Y.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium mb-2`,children:n(`virtualPrinter.targetPrinter.title`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsxs)(`select`,{value:x??``,onChange:e=>{let t=parseInt(e.target.value,10);isNaN(t)||Ee(t)},disabled:B===`targetPrinter`,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm appearance-none cursor-pointer disabled:opacity-50 pr-10`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`virtualPrinter.targetPrinter.placeholder`)}),ve?.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.ip_address,`)`]},e.id))]}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,Y.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium mb-1`,children:n(`virtualPrinter.bindIp.title`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsxs)(`select`,{value:C,onChange:e=>{w(e.target.value),ce(`bindIp`),be.mutate({bind_ip:e.target.value})},disabled:B===`bindIp`,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm appearance-none cursor-pointer disabled:opacity-50 pr-10`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`virtualPrinter.bindIp.placeholder`)}),ye?.map(e=>(0,Y.jsxs)(`option`,{value:e.ip,children:[e.name,` (`,e.ip,`)`,e.is_alias?` [alias]`:``,` - `,e.subnet]},e.ip))]}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`virtualPrinter.bindIp.hint`)})]}),(0,Y.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,Y.jsx)(`div`,{className:`text-white text-sm font-medium`,children:n(`virtualPrinter.remoteInterface.title`)}),D?(0,Y.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-green-700 dark:text-green-400`,children:(0,Y.jsx)(T,{className:`w-3 h-3`})}):(0,Y.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-bambu-gray`,title:n(`virtualPrinter.remoteInterface.optional`),children:(0,Y.jsx)(A,{className:`w-3 h-3`})})]}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsxs)(`select`,{value:D,onChange:e=>De(e.target.value),disabled:B===`remoteInterface`,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm appearance-none cursor-pointer disabled:opacity-50 pr-10`,children:[(0,Y.jsx)(`option`,{value:``,children:n(`virtualPrinter.remoteInterface.placeholder`)}),ye?.map(e=>(0,Y.jsxs)(`option`,{value:e.ip,children:[e.name,` (`,e.ip,`) - `,e.subnet]},e.ip))]}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]})]})]}),le&&(0,Y.jsx)(Tt,{title:n(`virtualPrinter.deleteConfirm.title`),message:n(`virtualPrinter.deleteConfirm.message`,{name:e.name}),variant:`danger`,confirmText:n(`common.delete`),isLoading:H.isPending,onConfirm:()=>H.mutate(),onCancel:()=>ue(!1)}),de&&(0,Y.jsx)(Ci,{vpId:e.id,vpName:e.name,onClose:()=>fe(!1)})]})}var Di={archive:`archive`,review:`review`,queue:`queue`,proxy:`proxy`};function Oi({onClose:e}){let{t}=l(),n=u(),{showToast:i}=ee(),[o,s]=(0,X.useState)(``),[c,p]=(0,X.useState)(`archive`),[m,h]=(0,X.useState)(null),{data:g}=d({queryKey:[`printers`],queryFn:r.getPrinters}),_=f({mutationFn:()=>a.create({name:o.trim()||`Bambuddy`,mode:c,target_printer_id:c===`proxy`?m??void 0:void 0}),onSuccess:()=>{n.invalidateQueries({queryKey:[`virtual-printers`]}),i(t(`virtualPrinter.toast.created`)),e()},onError:e=>{i(e.message||t(`virtualPrinter.toast.failedToCreate`),`error`)}});return(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:e,children:(0,Y.jsx)(G,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:(0,Y.jsxs)(W,{className:`p-6 space-y-4`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:t(`virtualPrinter.addDialog.title`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-sm text-white font-medium block mb-1`,children:t(`virtualPrinter.addDialog.name`)}),(0,Y.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`Bambuddy`,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white text-sm placeholder-bambu-gray`,autoFocus:!0})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-sm text-white font-medium block mb-1`,children:t(`virtualPrinter.mode.title`)}),(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[`archive`,`review`,`queue`,`proxy`].map(e=>(0,Y.jsxs)(`button`,{onClick:()=>p(e),className:`p-2 rounded-lg border text-left transition-colors ${c===e?e===`proxy`?`border-blue-500 bg-blue-500/10`:`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-white text-xs font-medium`,children:[e===`proxy`&&(0,Y.jsx)(_n,{className:`w-3 h-3`}),t(`virtualPrinter.mode.${Di[e]}`)]}),(0,Y.jsx)(`div`,{className:`text-[10px] text-bambu-gray`,children:t(`virtualPrinter.mode.${Di[e]}Desc`)})]},e))})]}),c===`proxy`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`text-sm text-white font-medium block mb-1`,children:t(`virtualPrinter.targetPrinter.title`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsxs)(`select`,{value:m??``,onChange:e=>{let t=parseInt(e.target.value,10);h(isNaN(t)?null:t)},className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white text-sm appearance-none cursor-pointer pr-10`,children:[(0,Y.jsx)(`option`,{value:``,children:t(`virtualPrinter.targetPrinter.placeholder`)}),g?.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.ip_address,`)`]},e.id))]}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:t(`virtualPrinter.addDialog.hint`)}),(0,Y.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:e,className:`flex-1`,disabled:_.isPending,children:t(`common.cancel`)}),(0,Y.jsx)(K,{variant:`primary`,onClick:()=>_.mutate(),className:`flex-1`,disabled:_.isPending,children:_.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):t(`virtualPrinter.addDialog.create`)})]})]})})})}function ki(){let{t:e}=l(),t=u(),{showToast:n}=ee(),[r,o]=(0,X.useState)(!1),{data:s,isLoading:c}=d({queryKey:[`virtual-printers`],queryFn:a.list,refetchInterval:1e4}),{data:p}=d({queryKey:[`virtual-printer-settings`],queryFn:i.getSettings}),m=f({mutationFn:e=>i.updateSettings({archive_name_source:e}),onSuccess:()=>{t.invalidateQueries({queryKey:[`virtual-printer-settings`]}),n(e(`virtualPrinter.toast.updated`))},onError:t=>{n(t.message||e(`virtualPrinter.toast.failedToUpdate`),`error`)}}),h=p?.archive_name_source===`filename`,{data:g}=d({queryKey:[`vp-ca-certificate`],queryFn:a.getCaCertificate,staleTime:1/0}),[_,v]=(0,X.useState)(!1),y=async()=>{g&&(await bi(g.pem)?(v(!0),n(e(`virtualPrinter.caCert.copied`)),setTimeout(()=>v(!1),2e3)):n(e(`virtualPrinter.toast.copyFailed`),`error`))},b=()=>{g&&xi(g.pem,`bambuddy-virtual-printer-ca.crt`,`application/x-pem-file`)};if(c)return(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-8 flex justify-center`,children:(0,Y.jsx)(R,{className:`w-6 h-6 animate-spin text-bambu-green`})})});let x=s?.printers||[],S=s?.models||{};return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4 items-stretch`,children:[(0,Y.jsx)(G,{className:`border-l-4 border-l-yellow-500`,children:(0,Y.jsx)(W,{className:`py-3 px-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(Ie,{className:`w-4 h-4 text-yellow-500 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{className:`text-xs`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium`,children:e(`virtualPrinter.setupRequired.title`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`virtualPrinter.setupRequired.description`)}),(0,Y.jsxs)(`a`,{href:`https://wiki.bambuddy.cool/features/virtual-printer/`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 mt-2 px-3 py-1.5 bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-500/50 rounded text-yellow-700 dark:text-yellow-400 hover:bg-yellow-500/30 transition-colors text-xs`,children:[(0,Y.jsx)(Je,{className:`w-3 h-3`}),e(`virtualPrinter.setupRequired.readGuide`)]})]})]})})}),(0,Y.jsx)(G,{className:`lg:col-span-2`,children:(0,Y.jsx)(W,{className:`py-3 px-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(A,{className:`w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium mb-1`,children:e(`virtualPrinter.howItWorks.title`)}),(0,Y.jsxs)(`ul`,{className:`space-y-1 list-disc list-inside`,children:[(0,Y.jsx)(`li`,{children:e(`virtualPrinter.howItWorks.step1`)}),(0,Y.jsx)(`li`,{children:e(`virtualPrinter.howItWorks.step2`)}),(0,Y.jsx)(`li`,{children:e(`virtualPrinter.howItWorks.step3`)})]})]})]})})})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4 items-stretch`,children:[(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-3 px-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(Cn,{className:`w-4 h-4 text-bambu-green flex-shrink-0 mt-1`}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white font-medium`,children:e(`virtualPrinter.caCert.title`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Y.jsxs)(`button`,{onClick:y,disabled:!g,className:`inline-flex items-center gap-1.5 px-2.5 py-1 text-xs rounded bg-bambu-dark-secondary border border-bambu-dark-tertiary text-white hover:border-bambu-gray disabled:opacity-50 transition-colors`,children:[_?(0,Y.jsx)(T,{className:`w-3.5 h-3.5 text-bambu-green`}):(0,Y.jsx)(N,{className:`w-3.5 h-3.5`}),e(_?`virtualPrinter.caCert.copied`:`virtualPrinter.caCert.copy`)]}),(0,Y.jsxs)(`button`,{onClick:b,disabled:!g,className:`inline-flex items-center gap-1.5 px-2.5 py-1 text-xs rounded bg-bambu-dark-secondary border border-bambu-dark-tertiary text-white hover:border-bambu-gray disabled:opacity-50 transition-colors`,children:[(0,Y.jsx)(sn,{className:`w-3.5 h-3.5`}),e(`virtualPrinter.caCert.download`)]})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`virtualPrinter.caCert.description`)}),g&&(0,Y.jsxs)(`p`,{className:`text-[10px] text-bambu-gray font-mono mt-1 truncate`,title:g.fingerprint_sha256,children:[e(`virtualPrinter.caCert.fingerprint`),`: `,g.fingerprint_sha256]})]})]})})}),(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-3 px-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(ln,{className:`w-4 h-4 text-bambu-green flex-shrink-0 mt-1`}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white font-medium`,children:e(`virtualPrinter.archiveNameSource.title`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Y.jsx)(`span`,{className:`text-xs ${h?`text-bambu-gray`:`text-white`}`,children:e(`virtualPrinter.archiveNameSource.metadata`)}),(0,Y.jsx)(J,{checked:h,onChange:e=>m.mutate(e?`filename`:`metadata`),disabled:m.isPending}),(0,Y.jsx)(`span`,{className:`text-xs ${h?`text-white`:`text-bambu-gray`}`,children:e(`virtualPrinter.archiveNameSource.filename`)})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`virtualPrinter.archiveNameSource.description`)})]})]})})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(it,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`virtualPrinter.list.title`)}),(0,Y.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[`(`,x.length,`)`]})]}),(0,Y.jsxs)(K,{variant:`primary`,onClick:()=>o(!0),children:[(0,Y.jsx)(wt,{className:`w-4 h-4 mr-1`}),e(`virtualPrinter.list.add`)]})]}),x.length===0?(0,Y.jsx)(G,{children:(0,Y.jsxs)(W,{className:`py-8 text-center`,children:[(0,Y.jsx)(it,{className:`w-12 h-12 text-bambu-gray mx-auto mb-3`}),(0,Y.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`virtualPrinter.list.empty`)}),(0,Y.jsxs)(K,{variant:`primary`,onClick:()=>o(!0),children:[(0,Y.jsx)(wt,{className:`w-4 h-4 mr-1`}),e(`virtualPrinter.list.addFirst`)]})]})}):(0,Y.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 items-start`,children:x.map(e=>(0,Y.jsx)(Ei,{printer:e,models:S},e.id))}),r&&(0,Y.jsx)(Oi,{onClose:()=>o(!1)})]})}function Ai(e){if(e<60)return`${e}s`;let t=Math.floor(e/60);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;if(n<24)return r?`${n}h ${r}m`:`${n}h`;let i=Math.floor(n/24),a=n%24;return a?`${i}d ${a}h`:`${i}d`}function ji(e){return e==null?`—`:e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}function Mi({device:e,onUnregister:t,isDeleting:n}){let{t:r}=l(),{showToast:i}=ee(),a=e.system_stats,o=a?.memory,s=a?.disk,u=e.online,[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(null),h=async t=>{m(t);try{t===`update`?await c.triggerUpdate(e.device_id):await c.systemCommand(e.device_id,t),i(r(`settings.spoolbuddy.commandQueued`),`success`)}catch(e){i(e instanceof Error?e.message:r(`settings.spoolbuddy.commandError`),`error`)}finally{m(null),f(null)}},g=[{key:`update`,label:r(`settings.spoolbuddy.update`),icon:sn},{key:`restart_browser`,label:r(`settings.spoolbuddy.restartBrowser`),icon:tn},{key:`restart_daemon`,label:r(`settings.spoolbuddy.restartDaemon`),icon:at},{key:`reboot`,label:r(`settings.spoolbuddy.reboot`),icon:xt},{key:`shutdown`,label:r(`settings.spoolbuddy.shutdown`),icon:Ct,variant:`danger`}],_={update:r(`settings.spoolbuddy.updateConfirmTitle`),restart_browser:r(`settings.spoolbuddy.restartBrowserConfirmTitle`),restart_daemon:r(`settings.spoolbuddy.restartDaemonConfirmTitle`),reboot:r(`settings.spoolbuddy.rebootConfirmTitle`),shutdown:r(`settings.spoolbuddy.shutdownConfirmTitle`)},v={update:r(`settings.spoolbuddy.updateConfirmBody`,{hostname:e.hostname}),restart_browser:r(`settings.spoolbuddy.restartBrowserConfirmBody`,{hostname:e.hostname}),restart_daemon:r(`settings.spoolbuddy.restartDaemonConfirmBody`,{hostname:e.hostname}),reboot:r(`settings.spoolbuddy.rebootConfirmBody`,{hostname:e.hostname}),shutdown:r(`settings.spoolbuddy.shutdownConfirmBody`,{hostname:e.hostname})};return(0,Y.jsxs)(G,{children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3 flex-wrap`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-semibold text-white truncate`,children:e.hostname}),(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${u?`bg-green-500/15 text-green-400 border border-green-500/40`:`bg-gray-500/15 text-gray-400 border border-gray-500/40`}`,children:[u?(0,Y.jsx)(ht,{className:`w-3 h-3`}):(0,Y.jsx)(Ye,{className:`w-3 h-3`}),r(u?`settings.spoolbuddy.online`:`settings.spoolbuddy.offline`)]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray font-mono mt-1 truncate`,children:e.device_id})]}),(0,Y.jsxs)(K,{variant:`danger`,size:`sm`,onClick:()=>t(e),disabled:n,"aria-label":r(`settings.spoolbuddy.unregister`),children:[(0,Y.jsx)(qe,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{className:`hidden sm:inline`,children:r(`settings.spoolbuddy.unregister`)})]})]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 text-xs`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-bambu-gray`,children:r(`settings.spoolbuddy.ipAddress`)}),(0,Y.jsx)(`div`,{className:`text-white font-mono`,children:e.ip_address})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-bambu-gray`,children:r(`settings.spoolbuddy.firmware`)}),(0,Y.jsx)(`div`,{className:`text-white`,children:e.firmware_version??`—`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`text-bambu-gray flex items-center gap-1`,children:[(0,Y.jsx)(lt,{className:`w-3 h-3`}),r(`settings.spoolbuddy.lastSeen`)]}),(0,Y.jsx)(`div`,{className:`text-white`,children:e.last_seen?Ue(e.last_seen):r(`settings.spoolbuddy.never`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-bambu-gray`,children:r(`settings.spoolbuddy.daemonUptime`)}),(0,Y.jsx)(`div`,{className:`text-white`,children:Ai(e.uptime_s)})]})]}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:g.map(({key:e,label:t,icon:n,variant:r})=>(0,Y.jsxs)(K,{variant:r??`secondary`,size:`sm`,onClick:()=>f(e),disabled:!u||p!==null,"aria-label":t,children:[p===e?(0,Y.jsx)(R,{className:`w-3.5 h-3.5 animate-spin`}):(0,Y.jsx)(n,{className:`w-3.5 h-3.5`}),(0,Y.jsx)(`span`,{children:t})]},e))}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 text-xs flex-wrap`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-gray`,children:[e.nfc_ok?(0,Y.jsx)(q,{className:`w-3.5 h-3.5 text-green-400`}):(0,Y.jsx)(O,{className:`w-3.5 h-3.5 text-red-400`}),r(`settings.spoolbuddy.nfc`),e.nfc_reader_type&&(0,Y.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[`(`,e.nfc_reader_type,`)`]})]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-gray`,children:[e.scale_ok?(0,Y.jsx)(q,{className:`w-3.5 h-3.5 text-green-400`}):(0,Y.jsx)(O,{className:`w-3.5 h-3.5 text-red-400`}),r(`settings.spoolbuddy.scale`)]})]}),a&&(0,Y.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 text-xs`,children:[a.cpu_temp_c!==void 0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Fe,{className:`w-3.5 h-3.5 text-bambu-gray`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-bambu-gray`,children:r(`settings.spoolbuddy.cpuTemp`)}),(0,Y.jsxs)(`div`,{className:`text-white`,children:[a.cpu_temp_c.toFixed(1),`°C`]})]})]}),a.load_avg&&a.load_avg.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(S,{className:`w-3.5 h-3.5 text-bambu-gray`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-bambu-gray`,children:r(`settings.spoolbuddy.cpuLoad`)}),(0,Y.jsxs)(`div`,{className:`text-white`,children:[a.load_avg[0].toFixed(2),a.cpu_count?` / ${a.cpu_count} (${Math.round(a.load_avg[0]/a.cpu_count*100)}%)`:``]})]})]}),o&&o.percent!==void 0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(P,{className:`w-3.5 h-3.5 text-bambu-gray`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-bambu-gray`,children:r(`settings.spoolbuddy.memory`)}),(0,Y.jsxs)(`div`,{className:`text-white`,children:[o.percent.toFixed(0),`% (`,ji(o.used_mb),` / `,ji(o.total_mb),`)`]})]})]}),s&&s.percent!==void 0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(re,{className:`w-3.5 h-3.5 text-bambu-gray`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-bambu-gray`,children:r(`settings.spoolbuddy.disk`)}),(0,Y.jsxs)(`div`,{className:`text-white`,children:[s.percent.toFixed(0),`% (`,s.used_gb?.toFixed(1),` / `,s.total_gb?.toFixed(1),` GB)`]})]})]}),a.system_uptime_s!==void 0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(lt,{className:`w-3.5 h-3.5 text-bambu-gray`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-bambu-gray`,children:r(`settings.spoolbuddy.systemUptime`)}),(0,Y.jsx)(`div`,{className:`text-white`,children:Ai(a.system_uptime_s)})]})]})]}),a.os&&(0,Y.jsx)(`div`,{className:`mt-3 text-xs text-bambu-gray font-mono truncate`,children:[a.os.os,a.os.kernel,a.os.arch,a.os.python&&`Python ${a.os.python}`].filter(Boolean).join(` · `)})]})]}),d&&(0,Y.jsx)(Tt,{variant:d===`shutdown`||d===`reboot`?`danger`:`default`,title:_[d],message:v[d],confirmText:r(`settings.spoolbuddy.commandConfirm`),isLoading:p!==null,onConfirm:()=>h(d),onCancel:()=>f(null)})]})}function Ni(){let{t:e}=l(),t=u(),{showToast:n}=ee(),[r,i]=(0,X.useState)(null),{data:a=[],isLoading:o}=d({queryKey:[`spoolbuddy-devices`],queryFn:()=>c.getDevices(),refetchInterval:15e3}),s=f({mutationFn:e=>c.deleteDevice(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`spoolbuddy-devices`]}),n(e(`settings.spoolbuddy.unregisterSuccess`),`success`),i(null)},onError:t=>{n(t.message||e(`settings.spoolbuddy.unregisterError`),`error`)}});if(o)return(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-8 flex justify-center`,children:(0,Y.jsx)(R,{className:`w-6 h-6 animate-spin text-bambu-green`})})});let p=a.length>1;return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-3 px-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-xs`,children:[(0,Y.jsx)(A,{className:`w-4 h-4 text-blue-400 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{className:`text-bambu-gray`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium mb-1`,children:e(`settings.spoolbuddy.infoTitle`)}),(0,Y.jsx)(`p`,{children:e(`settings.spoolbuddy.infoBody`)})]})]})})}),p&&(0,Y.jsx)(G,{className:`border-l-4 border-l-yellow-500`,children:(0,Y.jsx)(W,{className:`py-3 px-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-xs`,children:[(0,Y.jsx)(Ie,{className:`w-4 h-4 text-yellow-500 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{className:`text-bambu-gray`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium mb-1`,children:e(`settings.spoolbuddy.duplicatesTitle`,{count:a.length})}),(0,Y.jsx)(`p`,{children:e(`settings.spoolbuddy.duplicatesBody`)})]})]})})}),a.length===0?(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-8 text-center text-bambu-gray text-sm`,children:e(`settings.spoolbuddy.empty`)})}):(0,Y.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,Y.jsx)(Mi,{device:e,onUnregister:i,isDeleting:s.isPending&&s.variables===e.device_id},e.id))}),r&&(0,Y.jsx)(Tt,{variant:`danger`,title:e(`settings.spoolbuddy.confirmTitle`),message:e(`settings.spoolbuddy.confirmBody`,{hostname:r.hostname,deviceId:r.device_id}),confirmText:e(`settings.spoolbuddy.unregister`),isLoading:s.isPending,onConfirm:()=>s.mutate(r.device_id),onCancel:()=>i(null)})]})}function Pi(e,t,n,r,i){return n?e(`backup.restoreFromGit.${t}.${n}`,{...r??{},defaultValue:i??n}):i}var Fi=[{id:`archives`,labelKey:`backup.printArchives`,icon:(0,Y.jsx)(ot,{className:`w-4 h-4`})},{id:`spools`,labelKey:`backup.spoolInventory`,icon:(0,Y.jsx)(Nt,{className:`w-4 h-4`})},{id:`settings`,labelKey:`backup.appSettings`,icon:(0,Y.jsx)(yt,{className:`w-4 h-4`})},{id:`kprofiles`,labelKey:`backup.kProfiles`,icon:(0,Y.jsx)(Fe,{className:`w-4 h-4`})}],Ii=Object.fromEntries(Fi.map(e=>[e.id,e.labelKey])),Li=`HEAD`;function Ri({onClose:e}){let{t}=l(),n=u(),[i,a]=(0,X.useState)(Li),[o,s]=(0,X.useState)({}),[c,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),v=d({queryKey:[`github-backup-commits`],queryFn:()=>r.getGitHubBackupCommits(20)}),y=d({queryKey:[`github-restore-preview`,i],queryFn:()=>r.getGitHubRestorePreview(i)}),b=y.data?.success?y.data.ref:i,x=(0,X.useMemo)(()=>{let e={};return y.data?.categories?.forEach(n=>{e[n.category]={available:n.available,itemCount:n.item_count,detail:Pi(t,`details`,n.detail_code,n.detail_params,n.detail)}}),e},[y.data,t]),S=(0,X.useMemo)(()=>Fi.filter(e=>o[e.id]&&x[e.id]?.available).map(e=>e.id),[o,x]),C=S.length,w=!c&&S.includes(`kprofiles`),T=f({mutationFn:()=>r.restoreFromGitHub({ref:b,categories:S,overwrite_existing:c}),onSuccess:e=>{h(!1);let t=Object.keys(e.results??{}).length>0;(e.success||t)&&(_(e),n.invalidateQueries({queryKey:[`spools`]}),n.invalidateQueries({queryKey:[`archives`]}),n.invalidateQueries({queryKey:[`settings`]})),n.invalidateQueries({queryKey:[`github-backup-logs`]}),n.invalidateQueries({queryKey:[`github-backup-status`]})},onError:()=>h(!1)}),E=T.isPending,D=!!(g&&`settings`in g.results),O=(0,X.useCallback)(()=>{if(D){window.location.reload();return}e()},[D,e]);(0,X.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!E&&!m&&O()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O,E,m]),(0,X.useEffect)(()=>{if(!E)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[E]),(0,X.useEffect)(()=>{y.data&&s(e=>{let t={};return Fi.forEach(n=>{t[n.id]=!!e[n.id]&&!!x[n.id]?.available}),t})},[y.data,x]);let k=v.data?.commits??[],ee=(e,t,n)=>{let r=(t||``).split(` +`)[0],i=n?new Date(n).toLocaleString():``;return`${e.slice(0,7)} — ${i}${r?` — ${r}`:``}`},j=e=>e.isError?e.error?.message||t(`backup.restoreFromGit.loadFailed`):null,M=j(y)??(y.data&&!y.data.success?y.data.message:null),N=j(v)??(v.data&&!v.data.success?v.data.message:null);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:E?void 0:O,children:(0,Y.jsx)(G,{className:`w-full max-w-lg`,onClick:e=>e.stopPropagation(),children:(0,Y.jsxs)(W,{className:`p-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`p-2 rounded-full bg-bambu-green/20 text-bambu-green`,children:(0,Y.jsx)(nt,{className:`w-5 h-5`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:t(`backup.restoreFromGit.title`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t(`backup.restoreFromGit.subtitle`)})]})]}),(0,Y.jsx)(`button`,{onClick:O,disabled:E,"aria-label":t(`common.close`),className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors disabled:opacity-50`,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),g?(0,Y.jsxs)(`div`,{className:`p-4 space-y-3 max-h-[400px] overflow-y-auto`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[g.success?(0,Y.jsx)(q,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}):(0,Y.jsx)(Ie,{className:`w-4 h-4 text-yellow-500 mt-0.5 flex-shrink-0`}),(0,Y.jsx)(`span`,{className:`text-white`,children:g.message})]}),!g.success&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:t(`backup.restoreFromGit.partialHint`)}),Object.entries(g.results).map(([e,n])=>(0,Y.jsxs)(`div`,{className:`p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-white`,children:Ii[e]?t(Ii[e]):e}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:t(`backup.restoreFromGit.tally`,{restored:n.restored,skipped:n.skipped,failed:n.failed})})]}),n.notes.length>0&&(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1`,children:n.notes.map(e=>(0,Y.jsxs)(`li`,{className:`text-xs text-bambu-gray flex items-start gap-1.5`,children:[(0,Y.jsx)(A,{className:`w-3 h-3 mt-0.5 flex-shrink-0`}),(0,Y.jsx)(`span`,{children:Pi(t,`notes`,e.code,e.params,e.message)})]},`${e.code}:${JSON.stringify(e.params)}`))})]},e)),(0,Y.jsx)(`div`,{className:`p-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30`,children:(0,Y.jsx)(`p`,{className:`text-xs text-yellow-700 dark:text-yellow-200`,children:t(`backup.restoreFromGit.reloadHint`)})})]}):(0,Y.jsxs)(`div`,{className:`p-4 space-y-4 max-h-[400px] overflow-y-auto ${E?`opacity-50 pointer-events-none`:``}`,children:[T.isError&&(0,Y.jsx)(`div`,{className:`p-3 rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30`,children:(0,Y.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-400`,children:T.error?.message||t(`backup.restoreFromGit.failed`)})}),T.data&&!T.data.success&&(0,Y.jsx)(`div`,{className:`p-3 rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30`,children:(0,Y.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-400`,children:T.data.message})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`restore-commit`,className:`block text-sm font-medium text-white mb-1`,children:t(`backup.restoreFromGit.commitLabel`)}),(0,Y.jsxs)(`select`,{id:`restore-commit`,value:i,onChange:e=>{a(e.target.value),T.reset()},disabled:E||v.isLoading,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,children:[(0,Y.jsx)(`option`,{value:Li,children:t(`backup.restoreFromGit.latestCommit`)}),k.map(e=>(0,Y.jsx)(`option`,{value:e.sha,children:ee(e.sha,e.message,e.date)},e.sha))]}),N&&(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-red-500 dark:text-red-400`,children:N})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-white mb-2`,children:t(`backup.restoreFromGit.categoriesLabel`)}),y.isLoading?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray p-3`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),t(`backup.restoreFromGit.inspecting`)]}):M?(0,Y.jsx)(`div`,{className:`p-3 rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30`,children:(0,Y.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-400`,children:M})}):(0,Y.jsx)(`div`,{className:`space-y-2`,children:Fi.map(e=>{let n=x[e.id],r=!!n?.available,i=!!o[e.id]&&r;return(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 p-3 rounded-lg transition-colors ${r?`cursor-pointer`:`cursor-not-allowed opacity-50`} ${i?`bg-bambu-green/10 border border-bambu-green/30`:`bg-bambu-dark hover:bg-bambu-dark-tertiary border border-transparent`}`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:i,disabled:!r||E,onChange:()=>s(t=>({...t,[e.id]:!t[e.id]})),className:`w-4 h-4 rounded border-bambu-gray bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0`}),(0,Y.jsx)(`div`,{className:i?`text-bambu-green`:`text-bambu-gray`,children:e.icon}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsxs)(`div`,{className:`text-white text-sm font-medium`,children:[t(e.labelKey),r&&n?.itemCount?(0,Y.jsx)(`span`,{className:`ml-2 text-xs text-bambu-gray`,children:t(`backup.restoreFromGit.itemCount`,{count:n.itemCount})}):null]}),n?.detail&&(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:n.detail}),e.id===`kprofiles`&&i&&w&&(0,Y.jsx)(`div`,{className:`text-xs text-yellow-700 dark:text-yellow-200`,children:t(`backup.restoreFromGit.kprofilesOverwriteCaveat`)})]})]},e.id)})})]}),(0,Y.jsx)(`div`,{className:`p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-white`,children:t(`backup.restoreFromGit.overwriteLabel`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:t(c?`backup.restoreFromGit.overwriteOn`:`backup.restoreFromGit.overwriteOff`)})]}),(0,Y.jsx)(J,{checked:c,onChange:p,disabled:E})]})})]}),(0,Y.jsx)(`div`,{className:`flex items-center justify-between p-4 border-t border-bambu-dark-tertiary`,children:g?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{}),(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:O,children:t(`common.close`)}),(0,Y.jsx)(K,{onClick:()=>window.location.reload(),className:`bg-bambu-green hover:bg-bambu-green-dark`,children:t(`backup.reloadNow`)})]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:t(`backup.restoreFromGit.selectedCount`,{count:C})}),(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:O,disabled:E,children:t(`common.cancel`)}),(0,Y.jsx)(K,{onClick:()=>h(!0),disabled:C===0||E,className:`bg-bambu-green hover:bg-bambu-green-dark disabled:opacity-50 disabled:cursor-not-allowed min-w-[100px]`,children:E?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 mr-2 animate-spin`}),t(`backup.restoreFromGit.restoring`)]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(nt,{className:`w-4 h-4 mr-2`}),t(`backup.restore`)]})})]})]})})]})})}),m&&(0,Y.jsx)(Tt,{variant:`danger`,overlayZIndex:`z-[110]`,title:t(`backup.restoreFromGit.confirmTitle`),message:c?t(`backup.restoreFromGit.confirmMessageOverwrite`):w?`${t(`backup.restoreFromGit.confirmMessage`)} ${t(`backup.restoreFromGit.kprofilesOverwriteCaveat`)}`:t(`backup.restoreFromGit.confirmMessage`),confirmText:t(`backup.restore`),isLoading:E,loadingText:t(`backup.restoreFromGit.restoring`),onConfirm:()=>T.mutate(),onCancel:()=>h(!1)})]})}function zi(e){if(!e)return`-`;let t=We(e);return t?t.toLocaleString():`-`}function Bi({status:e}){if(!e)return null;let t={success:`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`,failed:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`,skipped:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`,running:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`},n={success:(0,Y.jsx)(j,{className:`w-3 h-3`}),failed:(0,Y.jsx)(O,{className:`w-3 h-3`}),skipped:(0,Y.jsx)(Ne,{className:`w-3 h-3`}),running:(0,Y.jsx)(R,{className:`w-3 h-3 animate-spin`})};return(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium ${t[e]||`bg-gray-500/20 text-gray-400`}`,children:[n[e],e.charAt(0).toUpperCase()+e.slice(1)]})}var Vi={github:`backup.repoUrlPlaceholderGitHub`,gitea:`backup.repoUrlPlaceholderGitea`,forgejo:`backup.repoUrlPlaceholderForgejo`,gitlab:`backup.repoUrlPlaceholderGitLab`},Hi={github:`ghp_xxxxxxxxxxxx`,gitea:`your_access_token`,forgejo:`your_access_token`,gitlab:`glpat-xxxxxxxxxxxx`},Ui={github:`backup.tokenHintGitHub`,gitea:`backup.tokenHintGitea`,forgejo:`backup.tokenHintForgejo`,gitlab:`backup.tokenHintGitLab`};function Wi(e){return JSON.stringify(e)}function Gi(e,t){if(!t)return e;let n={};for(let r of Object.keys(e))e[r]!==t[r]&&(n[r]=e[r]);return n}function Ki(){let e=u(),{showToast:t}=ee(),{t:n}=l(),{hasPermission:i}=un(),a=i(`github:restore`),[o,s]=(0,X.useState)(``),[c,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(`main`),[_,v]=(0,X.useState)(`github`),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(`daily`),[C,w]=(0,X.useState)(!0),[T,E]=(0,X.useState)(!0),[D,k]=(0,X.useState)(!1),[A,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)(!1),[te,F]=(0,X.useState)(!1),[ne,I]=(0,X.useState)(!0),[re,L]=(0,X.useState)(!1),[ae,z]=(0,X.useState)(!1),[oe,se]=(0,X.useState)(``),[B,ce]=(0,X.useState)(!1),[le,ue]=(0,X.useState)(null),[de,fe]=(0,X.useState)(null),V=(0,X.useRef)(null),[pe,me]=(0,X.useState)(!1),[he,ge]=(0,X.useState)(null),[_e,ve]=(0,X.useState)(null),[ye,be]=(0,X.useState)(``),{data:H,refetch:xe}=d({queryKey:[`local-backup-status`],queryFn:r.getLocalBackupStatus,refetchInterval:e=>e.state.data?.is_running?1e3:1e4}),{data:Se,refetch:Ce}=d({queryKey:[`local-backup-files`],queryFn:r.getLocalBackups,refetchInterval:3e4}),{data:we,refetch:Te}=d({queryKey:[`local-backup-path-check`],queryFn:r.checkLocalBackupPath,enabled:H?.enabled===!0,refetchOnWindowFocus:!1});(0,X.useEffect)(()=>{H?.path!==void 0&&be(H.path)},[H?.path]);let Ee=f({mutationFn:r.triggerLocalBackup,onSuccess:e=>{e.success?t(n(`backup.scheduledBackupComplete`)):t(e.message,`error`),xe(),Ce(),Te()},onError:()=>t(n(`backup.scheduledBackupFailed`),`error`)}),Oe=f({mutationFn:e=>r.deleteLocalBackup(e),onSuccess:()=>{Ce(),ge(null)}}),ke=f({mutationFn:async e=>(ve(null),z(!0),fe(null),se(n(`backup.restoring`)),r.restoreLocalBackup(e)),onSuccess:e=>{z(!1),se(``),e.success?(fe({success:!0,message:e.message}),t(n(`backup.backupRestoredRestart`),`success`)):(fe({success:!1,message:e.message}),t(e.message,`error`))},onError:e=>{z(!1),se(``);let r=e instanceof Error?e.message:n(`backup.failedToRestore`);fe({success:!1,message:r}),t(r,`error`)}});(0,X.useEffect)(()=>{if(re||ae){let e=e=>(e.preventDefault(),e.returnValue=`A backup operation is in progress. Are you sure you want to leave?`,e.returnValue);return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)}},[re,ae]);let[Ae,je]=(0,X.useState)(!1),[Me,Ne]=(0,X.useState)(null),[Pe,Fe]=(0,X.useState)(null),Le=(0,X.useRef)(null),Re=(0,X.useRef)(null),ze=(0,X.useRef)(null),Be=(0,X.useRef)(null),Ve=(0,X.useRef)(``),[He,We]=(0,X.useState)(!1),Ge=(0,X.useMemo)(()=>({repository_url:o,branch:h,provider:_,allow_insecure_http:te,schedule_enabled:y,schedule_type:x,backup_kprofiles:C,backup_cloud_profiles:T,backup_settings:D,backup_spools:A,backup_archives:N,enabled:ne}),[o,h,_,te,y,x,C,T,D,A,N,ne]),Ke=(0,X.useMemo)(()=>Wi(Ge),[Ge]),{data:q,isLoading:Ye}=d({queryKey:[`github-backup-config`],queryFn:r.getGitHubBackupConfig}),{data:Xe}=d({queryKey:[`github-backup-status`],queryFn:r.getGitHubBackupStatus,refetchInterval:e=>e.state.data?.is_running?500:1e4}),{data:Ze}=d({queryKey:[`github-backup-logs`],queryFn:()=>r.getGitHubBackupLogs(20)}),{data:Qe}=d({queryKey:[`cloud-status`],queryFn:r.getCloudStatus}),{data:$e}=d({queryKey:[`github-backup-cloud-accounts`],queryFn:r.getGitHubBackupCloudAccounts,staleTime:6e4}),et=($e?.bambu??0)+($e?.orca??0),tt=$e?et>0:!!Qe?.is_authenticated,{data:rt}=d({queryKey:[`printers`],queryFn:r.getPrinters}),it=p({queries:(rt??[]).map(e=>({queryKey:[`printerStatus`,e.id],queryFn:()=>r.getPrinterStatus(e.id),staleTime:1e4,refetchInterval:3e4}))}),ot=(rt??[]).map((e,t)=>({printer:e,connected:it[t]?.data?.connected??!1})),st=ot.length,ut=ot.filter(e=>e.connected).length,dt=st>0&&ut===0,ft=ut>0&&ut(ze.current&&clearTimeout(ze.current),q?(We(!1),Be.current={repository_url:q.repository_url,branch:q.branch,provider:q.provider??`github`,allow_insecure_http:q.allow_insecure_http??!1,schedule_enabled:q.schedule_enabled,schedule_type:q.schedule_type,backup_kprofiles:q.backup_kprofiles,backup_cloud_profiles:q.backup_cloud_profiles,backup_settings:q.backup_settings,backup_spools:q.backup_spools,backup_archives:q.backup_archives,enabled:q.enabled},s(q.repository_url),g(q.branch),v(q.provider??`github`),b(q.schedule_enabled),S(q.schedule_type),w(q.backup_kprofiles),E(q.backup_cloud_profiles),k(q.backup_settings),M(q.backup_spools),P(q.backup_archives),F(q.allow_insecure_http??!1),I(q.enabled),m(``),ze.current=setTimeout(()=>{We(!0)},100)):(We(!1),Be.current=null,m(``)),()=>{ze.current&&clearTimeout(ze.current)}),[q]);let pt=(0,X.useCallback)(async(i=!1)=>{if(q)try{i&&c?(await r.saveGitHubBackupConfig({...Ge,access_token:c}),m(``),Fe(null),t(n(`backup.tokenUpdated`)),Ve.current=``):(await r.updateGitHubBackupConfig(Gi(Ge,Be.current)),Fe(null),t(n(`backup.settingsSaved`))),Be.current=Ge,e.invalidateQueries({queryKey:[`github-backup-config`]}),e.invalidateQueries({queryKey:[`github-backup-status`]})}catch(e){Fe(e.message)}},[q,c,Ge,e,t,n]),mt=(0,X.useRef)(pt);(0,X.useEffect)(()=>{mt.current=pt},[pt]),(0,X.useEffect)(()=>{if(!(!He||!q)&&!(Be.current&&Ke===Wi(Be.current)))return Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{pt(!1)},500),()=>{Le.current&&clearTimeout(Le.current)}},[He,q,Ke,pt]),(0,X.useEffect)(()=>{if(!(!He||!q||!c)&&c!==Ve.current)return Ve.current=c,Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{mt.current(!0)},1e3),()=>{Re.current&&clearTimeout(Re.current)}},[He,c,q]);let ht=f({mutationFn:e=>r.saveGitHubBackupConfig(e),onMutate:()=>{Fe(null)},onSuccess:()=>{e.invalidateQueries({queryKey:[`github-backup-config`]}),e.invalidateQueries({queryKey:[`github-backup-status`]}),t(n(`backup.githubBackupEnabled`)),m(``),We(!0)},onError:e=>{Fe(e.message)}}),_t=f({mutationFn:r.triggerGitHubBackup,onSuccess:r=>{e.invalidateQueries({queryKey:[`github-backup-status`]}),e.invalidateQueries({queryKey:[`github-backup-logs`]}),r.success?r.files_changed>0?t(n(`backup.backupCompleteFiles`,{count:r.files_changed})):t(n(`backup.backupSkippedNoChanges`)):t(n(`backup.backupFailed2`,{message:r.message}),`error`)},onError:e=>{t(n(`backup.backupFailed2`,{message:e.message}),`error`)}}),vt=f({mutationFn:()=>r.clearGitHubBackupLogs(0),onSuccess:r=>{e.invalidateQueries({queryKey:[`github-backup-logs`]}),t(n(`backup.clearedLogs`,{count:r.deleted}))},onError:e=>{t(n(`backup.failedToClearLogs`,{message:e.message}),`error`)}}),yt=async()=>{je(!0),Ne(null);try{let e;if(c){if(!o){t(n(`backup.enterRepoUrl`),`error`),je(!1);return}e=await r.testGitHubConnection(o,c,_)}else if(q?.has_token)e=await r.testGitHubStoredConnection();else{t(n(`backup.enterRepoAndToken`),`error`),je(!1);return}Ne({success:e.success,message:e.message,isPrivate:e.is_private})}catch(e){Ne({success:!1,message:e.message,isPrivate:null})}finally{je(!1)}};return Ye?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Y.jsx)(R,{className:`w-8 h-8 animate-spin text-bambu-green`})}):(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsxs)(G,{id:`card-backup-github`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(It,{className:`w-5 h-5 text-gray-400`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(`backup.githubBackup`)})]}),q&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:n(`backup.enabled`)}),(0,Y.jsx)(J,{checked:ne,onChange:I})]})]})}),(0,Y.jsxs)(W,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`backup.githubDescription`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`git-provider-select`,className:`block text-sm text-bambu-gray mb-1`,children:n(`backup.provider`)}),(0,Y.jsxs)(`select`,{id:`git-provider-select`,value:_,onChange:e=>{v(e.target.value),Ne(null),Fe(null)},className:`w-full h-10 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`github`,children:n(`backup.providerGitHub`)}),(0,Y.jsx)(`option`,{value:`gitlab`,children:n(`backup.providerGitLab`)}),(0,Y.jsx)(`option`,{value:`gitea`,children:n(`backup.providerGitea`)}),(0,Y.jsx)(`option`,{value:`forgejo`,children:n(`backup.providerForgejo`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`backup.repositoryUrl`)}),(0,Y.jsx)(`input`,{type:`text`,value:o,onChange:e=>{s(e.target.value),Ne(null),Fe(null)},placeholder:n(Vi[_]),className:`w-full h-10 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-2 mt-2 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:te,onChange:e=>{F(e.target.checked),Ne(null)},className:`w-4 h-4 mt-0.5 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:n(`backup.allowInsecureHttp`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`backup.allowInsecureHttpHint`)})]})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[n(`backup.personalAccessToken`),` `,q?.has_token&&(0,Y.jsx)(`span`,{className:`text-green-700 dark:text-green-400`,children:n(`backup.tokenSaved`)})]}),(0,Y.jsx)(`input`,{type:`password`,value:c,onChange:e=>{m(e.target.value),Ne(null),Fe(null)},placeholder:q?.has_token?n(`backup.enterNewToken`):Hi[_],className:`w-full h-10 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(Ui[_])})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`backup.branch`)}),(0,Y.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`main`,className:`w-full h-10 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`backup.autoBackup`)}),(0,Y.jsxs)(`select`,{value:y?x:`disabled`,onChange:e=>{e.target.value===`disabled`?b(!1):(b(!0),S(e.target.value))},className:`w-full h-10 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`disabled`,children:n(`backup.manualOnly`)}),(0,Y.jsx)(`option`,{value:`hourly`,children:n(`backup.hourly`)}),(0,Y.jsx)(`option`,{value:`daily`,children:n(`backup.daily`)}),(0,Y.jsx)(`option`,{value:`weekly`,children:n(`backup.weekly`)})]})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:n(`backup.includeInBackup`)}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`label`,{className:`flex items-start gap-2 ${dt?`cursor-not-allowed opacity-60`:`cursor-pointer`}`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:C,onChange:e=>w(e.target.checked),className:`w-4 h-4 mt-0.5 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`,disabled:dt}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm ${dt?`text-bambu-gray`:`text-white`}`,children:n(`backup.kProfiles`)}),dt&&(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`,children:[(0,Y.jsx)(Ie,{className:`w-3 h-3`}),n(`backup.noPrintersConnected`)]}),ft&&(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`,children:[(0,Y.jsx)(Ie,{className:`w-3 h-3`}),n(`backup.printersConnected`,{connected:ut,total:st})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`backup.kProfilesDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-2 ${tt?`cursor-pointer`:`cursor-not-allowed opacity-60`}`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:T,onChange:e=>E(e.target.checked),className:`w-4 h-4 mt-0.5 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`,disabled:!tt}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm ${tt?`text-white`:`text-bambu-gray`}`,children:n(`backup.cloudProfiles`)}),!tt&&(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`,children:[(0,Y.jsx)(Ie,{className:`w-3 h-3`}),n(`backup.cloudLoginRequiredShort`)]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`backup.cloudProfilesDescription`)}),et>0&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:n(`backup.cloudProfilesAccounts`,{bambu:$e?.bambu??0,orca:$e?.orca??0})})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>k(e.target.checked),className:`w-4 h-4 mt-0.5 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white text-sm`,children:n(`backup.appSettings`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`backup.appSettingsDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:A,onChange:e=>M(e.target.checked),className:`w-4 h-4 mt-0.5 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white text-sm`,children:n(`backup.spoolInventory`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`backup.spoolInventoryDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>P(e.target.checked),className:`w-4 h-4 mt-0.5 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white text-sm`,children:n(`backup.printArchives`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`backup.printArchivesDescription`)})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4 space-y-3`,children:[Xe?.configured&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:Xe.last_backup_at?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{children:[n(`backup.lastBackupAt`),` `,Ue(Xe.last_backup_at,`system`,n)]}),(0,Y.jsx)(Bi,{status:Xe.last_backup_status})]}):(0,Y.jsx)(`span`,{children:n(`backup.noBackupsYet`)})}),Xe.next_scheduled_run&&(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[(0,Y.jsx)(lt,{className:`w-3 h-3 inline mr-1`}),n(`backup.next`),` `,Ue(Xe.next_scheduled_run,`system`,n)]})]}),Pe&&(0,Y.jsxs)(`div`,{className:`text-sm text-red-700 dark:text-red-400 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded p-3 flex items-start gap-2`,children:[(0,Y.jsx)(O,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,Y.jsx)(`div`,{className:`flex-1 leading-relaxed whitespace-pre-wrap break-words`,children:Pe}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>Fe(null),className:`text-bambu-gray hover:text-white shrink-0`,"aria-label":n(`common.dismiss`,`Dismiss`),children:(0,Y.jsx)(O,{className:`w-4 h-4`})})]}),Me&&(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsxs)(`div`,{className:`text-sm flex items-center gap-1 ${Me.success?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`}`,children:[Me.success?(0,Y.jsx)(j,{className:`w-4 h-4`}):(0,Y.jsx)(O,{className:`w-4 h-4`}),Me.message]}),Me.success&&Me.isPrivate===!0&&(0,Y.jsxs)(`div`,{className:`text-xs flex items-center gap-1 text-green-700 dark:text-green-400`,children:[(0,Y.jsx)(j,{className:`w-3.5 h-3.5`}),n(`backup.repoIsPrivate`,`Repository is private — safe to back up to.`)]}),Me.success&&Me.isPrivate===!1&&(0,Y.jsxs)(`div`,{className:`text-xs text-red-700 dark:text-red-400 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded p-2 flex items-start gap-1.5`,children:[(0,Y.jsx)(O,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,Y.jsx)(`span`,{children:n(`backup.repoIsPublicWarning`,`Repository is PUBLIC. Bambuddy backups include MQTT credentials, Home Assistant tokens, Prometheus tokens, your Bambu Cloud email, and printer access codes via K-profiles. Saving is blocked until you make the repository private in your provider's settings.`)})]}),Me.success&&Me.isPrivate===null&&(0,Y.jsxs)(`div`,{className:`text-xs text-yellow-700 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30 rounded p-2 flex items-start gap-1.5`,children:[(0,Y.jsx)(O,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,Y.jsx)(`span`,{children:n(`backup.repoVisibilityUnknown`,`Could not determine repository visibility. Bambuddy refuses to back up to anything not confirmed private; saving will be blocked.`)})]})]}),(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:Xe?.configured?(0,Y.jsx)(Y.Fragment,{children:_t.isPending||Xe.is_running?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-green`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),(0,Y.jsx)(`span`,{className:`text-sm`,children:Xe.progress||n(`backup.startingBackup`)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(K,{variant:`primary`,size:`sm`,onClick:()=>_t.mutate(),disabled:!q?.enabled,children:[(0,Y.jsx)(De,{className:`w-4 h-4`}),n(`backup.backupNow`)]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:yt,disabled:Ae,children:[Ae?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(at,{className:`w-4 h-4`}),n(`backup.test`)]}),a&&(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>me(!0),disabled:Xe.restore_running,children:[(0,Y.jsx)(nt,{className:`w-4 h-4`}),n(`backup.restoreFromGit.button`)]})]})}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(K,{variant:`primary`,size:`sm`,onClick:()=>{if(!o){t(n(`backup.repoRequired`),`error`);return}if(!c){t(n(`backup.tokenRequired`),`error`);return}ht.mutate({repository_url:o,access_token:c,branch:h,provider:_,allow_insecure_http:te,schedule_enabled:y,schedule_type:x,backup_kprofiles:C,backup_cloud_profiles:T,backup_settings:D,backup_spools:A,backup_archives:N,enabled:ne})},disabled:ht.isPending||!o||!c,children:[ht.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(j,{className:`w-4 h-4`}),n(`backup.enableBackup`)]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:yt,disabled:Ae||!o||!c,children:[Ae?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(at,{className:`w-4 h-4`}),n(`backup.testConnection`)]})]})})]})]})]}),Ze&&Ze.length>0&&(0,Y.jsxs)(G,{id:`card-backup-history`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ie,{className:`w-5 h-5 text-gray-400`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(`backup.history`)})]}),(0,Y.jsxs)(K,{variant:`ghost`,size:`sm`,onClick:()=>vt.mutate(),disabled:vt.isPending,children:[(0,Y.jsx)(qe,{className:`w-4 h-4`}),n(`backup.clear`)]})]})}),(0,Y.jsx)(W,{children:(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`th`,{className:`text-left py-2 px-2`,children:n(`backup.date`)}),(0,Y.jsx)(`th`,{className:`text-left py-2 px-2`,children:n(`backup.trigger`)}),(0,Y.jsx)(`th`,{className:`text-left py-2 px-2`,children:n(`backup.status`)}),(0,Y.jsx)(`th`,{className:`text-left py-2 px-2`,children:n(`backup.commit`)})]})}),(0,Y.jsx)(`tbody`,{children:Ze.slice(0,10).map(e=>(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 hover:bg-bambu-dark-secondary`,children:[(0,Y.jsx)(`td`,{className:`py-2 px-2 text-white`,children:zi(e.started_at)}),(0,Y.jsx)(`td`,{className:`py-2 px-2 text-bambu-gray`,children:n(`backup.triggers.${e.trigger}`,{defaultValue:e.trigger})}),(0,Y.jsx)(`td`,{className:`py-2 px-2`,children:(0,Y.jsx)(Bi,{status:e.status})}),(0,Y.jsx)(`td`,{className:`py-2 px-2`,children:e.commit_sha?(0,Y.jsxs)(`a`,{href:`${q?.repository_url}/commit/${e.commit_sha}`,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-green hover:underline inline-flex items-center gap-1`,children:[e.commit_sha.substring(0,7),(0,Y.jsx)(Je,{className:`w-3 h-3`})]}):(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`-`})})]},e.id))})]})})})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsxs)(G,{id:`card-backup-local`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(gt,{className:`w-5 h-5 text-gray-400`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(`backup.localBackup`)})]})}),(0,Y.jsxs)(W,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`backup.localBackupDescription`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between py-3 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:n(`backup.downloadBackupLabel`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`backup.completeBackupZip`)})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,disabled:re||ae,onClick:async()=>{L(!0),se(n(`backup.preparingBackup`));try{se(n(`backup.creatingArchive`));let{blob:e,filename:i}=await r.exportBackup();se(n(`backup.downloadingFile`));let a=URL.createObjectURL(e),o=document.createElement(`a`);o.href=a,o.download=i,o.click(),URL.revokeObjectURL(a),t(n(`backup.backupDownloaded`))}catch(e){t(n(`backup.failedToCreateBackup`,{message:e instanceof Error?e.message:`Unknown error`}),`error`)}finally{L(!1),se(``)}},children:[(0,Y.jsx)(sn,{className:`w-4 h-4`}),n(`backup.download`)]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between py-3 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:n(`backup.restoreBackup`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`backup.restoreDescription`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray-light mt-1`,children:n(`backup.restoreNote`)})]}),(0,Y.jsx)(`input`,{ref:V,type:`file`,accept:`.zip`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&(ue(t),ce(!0)),e.target.value=``}}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,disabled:ae||re,onClick:()=>V.current?.click(),children:[(0,Y.jsx)(Wt,{className:`w-4 h-4`}),n(`backup.restore`)]})]}),de&&(0,Y.jsx)(`div`,{className:`p-3 rounded-lg ${de.success?`bg-green-50 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30`:`bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30`}`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[de.success?(0,Y.jsx)(j,{className:`w-4 h-4 text-green-600 dark:text-green-400 mt-0.5 flex-shrink-0`}):(0,Y.jsx)(O,{className:`w-4 h-4 text-red-600 dark:text-red-400 mt-0.5 flex-shrink-0`}),(0,Y.jsxs)(`div`,{className:de.success?`text-green-800 dark:text-green-200`:`text-red-800 dark:text-red-200`,children:[de.message,de.success&&(0,Y.jsx)(`div`,{className:`mt-2`,children:(0,Y.jsxs)(K,{size:`sm`,onClick:()=>window.location.reload(),children:[(0,Y.jsx)(nt,{className:`w-3 h-3`}),n(`backup.reloadNow`)]})})]})]})}),(0,Y.jsx)(`div`,{className:`p-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,Y.jsx)(Ie,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400 mt-0.5 flex-shrink-0`}),(0,Y.jsxs)(`div`,{className:`text-yellow-800 dark:text-yellow-200`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:n(`backup.restoreReplacesAll`)}),` `,(0,Y.jsx)(`span`,{className:`text-yellow-800/80 dark:text-yellow-200/70`,children:n(`backup.restoreReplacesAllDetail`)})]})]})})]})]}),(0,Y.jsxs)(G,{id:`card-backup-scheduled`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(xn,{className:`w-5 h-5 text-gray-400`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(`backup.scheduledBackup`)})]}),(0,Y.jsx)(J,{checked:H?.enabled??!1,onChange:async i=>{try{await r.updateSettings({local_backup_enabled:i}),e.invalidateQueries({queryKey:[`settings`]}),t(n(`backup.settingsSaved`))}catch(e){t(n(`backup.failedToSave`,{message:e instanceof Error?e.message:`Unknown error`}),`error`)}xe()}})]})}),(0,Y.jsxs)(W,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`backup.scheduledBackupDescription`)}),H?.enabled&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`backup.frequency`)}),(0,Y.jsxs)(`select`,{value:H?.schedule??`daily`,className:`w-full h-10 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,onChange:async e=>{try{await r.updateSettings({local_backup_schedule:e.target.value}),t(n(`backup.settingsSaved`))}catch(e){t(n(`backup.failedToSave`,{message:e instanceof Error?e.message:`Unknown error`}),`error`)}xe()},children:[(0,Y.jsx)(`option`,{value:`hourly`,children:n(`backup.hourly`)}),(0,Y.jsx)(`option`,{value:`daily`,children:n(`backup.daily`)}),(0,Y.jsx)(`option`,{value:`weekly`,children:n(`backup.weekly`)})]})]}),(H?.schedule??`daily`)!==`hourly`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`backup.backupTime`)}),(0,Y.jsx)(`input`,{type:`time`,value:H?.time??`03:00`,className:`w-full h-10 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,onChange:async e=>{try{await r.updateSettings({local_backup_time:e.target.value}),t(n(`backup.settingsSaved`))}catch(e){t(n(`backup.failedToSave`,{message:e instanceof Error?e.message:`Unknown error`}),`error`)}xe()}}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray-light mt-1`,children:n(`backup.localTimeHint`,{tz:H?.timezone||`UTC`})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`backup.retention`)}),(0,Y.jsx)(ct,{min:1,max:100,value:H?.retention??5,className:`w-full h-10 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,onChange:async e=>{try{await r.updateSettings({local_backup_retention:e}),t(n(`backup.settingsSaved`))}catch(e){t(n(`backup.failedToSave`,{message:e instanceof Error?e.message:`Unknown error`}),`error`)}xe()},fallback:5}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray-light mt-1`,children:n(`backup.retentionDescription`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`backup.outputPath`)}),(0,Y.jsx)(`input`,{type:`text`,value:ye,onChange:e=>be(e.target.value),className:`w-full h-10 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,onBlur:async()=>{try{await r.updateSettings({local_backup_path:ye}),t(n(`backup.settingsSaved`))}catch(e){t(n(`backup.failedToSave`,{message:e instanceof Error?e.message:`Unknown error`}),`error`)}xe(),Ce(),Te()},onKeyDown:e=>{e.key===`Enter`&&e.target.blur()}}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray-light mt-1`,children:ye?n(`backup.outputPathDescription`):(0,Y.jsxs)(Y.Fragment,{children:[n(`backup.defaultPathLabel`),` `,(0,Y.jsx)(`code`,{className:`text-bambu-gray`,children:H?.default_path||`...`})]})}),we&&!we.writable&&(0,Y.jsx)(`div`,{className:`mt-2 p-3 rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,Y.jsx)(Ie,{className:`w-4 h-4 text-red-600 dark:text-red-400 mt-0.5 flex-shrink-0`}),(0,Y.jsxs)(`div`,{className:`min-w-0 text-red-800 dark:text-red-200`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:n(`backup.pathCheck.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-red-800/80 dark:text-red-200/80`,children:n(`backup.pathCheck.${we.code}`,{path:we.path,defaultValue:we.message})}),we.remedy&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`mt-2 font-medium`,children:n(`backup.pathCheck.howToFix`)}),(0,Y.jsx)(`pre`,{className:`mt-1 p-2 rounded bg-black/10 dark:bg-black/40 text-xs whitespace-pre-wrap break-words`,children:we.remedy})]}),we.detail&&(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-red-800/60 dark:text-red-200/60 break-words`,children:we.detail})]})]})}),we?.writable&&we.warning===`container_ephemeral`&&(0,Y.jsx)(`div`,{className:`mt-2 p-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,Y.jsx)(Ie,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400 mt-0.5 flex-shrink-0`}),(0,Y.jsxs)(`div`,{className:`min-w-0 text-yellow-800 dark:text-yellow-200`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:n(`backup.pathCheck.ephemeralTitle`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-yellow-800/80 dark:text-yellow-200/80`,children:n(`backup.pathCheck.container_ephemeral`,{path:we.path})}),we.remedy&&(0,Y.jsx)(`pre`,{className:`mt-1 p-2 rounded bg-black/10 dark:bg-black/40 text-xs whitespace-pre-wrap break-words`,children:we.remedy})]})]})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between py-3 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`text-sm`,children:[H?.last_backup_at&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,Y.jsxs)(`span`,{children:[n(`backup.lastBackup`),`:`]}),(0,Y.jsx)(Bi,{status:H.last_status}),(0,Y.jsx)(`span`,{children:Ue(H.last_backup_at)})]}),H?.next_run&&(0,Y.jsxs)(`div`,{className:`text-bambu-gray mt-1`,children:[(0,Y.jsxs)(`span`,{children:[n(`backup.nextBackup`),`: `]}),(0,Y.jsx)(`span`,{children:zi(H.next_run)})]})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,disabled:H?.is_running||Ee.isPending,onClick:()=>Ee.mutate(),children:[H?.is_running||Ee.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(De,{className:`w-4 h-4`}),H?.is_running?n(`backup.backupRunning`):n(`backup.runNow`)]})]}),Se&&Se.length>0&&(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-white mb-2`,children:n(`backup.backupFiles`)}),(0,Y.jsx)(`div`,{className:`space-y-1`,children:Se.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between py-1.5 px-2 rounded hover:bg-bambu-dark-tertiary/50 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`span`,{className:`text-white truncate block`,children:e.filename}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray text-xs`,children:[(e.size/1024/1024).toFixed(1),` MB · `,zi(e.created_at)]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[(0,Y.jsx)(`button`,{className:`text-bambu-gray hover:text-bambu-green p-1`,title:n(`backup.download`),onClick:async()=>{try{let{blob:t,filename:n}=await r.downloadLocalBackup(e.filename),i=URL.createObjectURL(t),a=document.createElement(`a`);a.href=i,a.download=n,a.click(),URL.revokeObjectURL(i)}catch{t(n(`backup.scheduledBackupFailed`),`error`)}},children:(0,Y.jsx)(sn,{className:`w-3.5 h-3.5`})}),(0,Y.jsx)(`button`,{className:`text-bambu-gray hover:text-yellow-600 dark:hover:text-yellow-400 p-1`,title:n(`backup.restore`),onClick:()=>ve(e.filename),children:(0,Y.jsx)(nt,{className:`w-3.5 h-3.5`})}),(0,Y.jsx)(`button`,{className:`text-bambu-gray hover:text-red-600 dark:hover:text-red-400 p-1`,onClick:()=>ge(e.filename),title:n(`backup.deleteBackup`),children:(0,Y.jsx)(qe,{className:`w-3.5 h-3.5`})})]})]},e.filename))})]}),Se&&Se.length===0&&(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray text-center py-3 border-t border-bambu-dark-tertiary`,children:n(`backup.noScheduledBackups`)})]})]})]})]}),pe&&(0,Y.jsx)(Ri,{onClose:()=>me(!1)}),he&&(0,Y.jsx)(Tt,{title:n(`backup.deleteBackup`),message:n(`backup.deleteBackupConfirm`),confirmText:n(`backup.deleteBackup`),variant:`danger`,onConfirm:()=>Oe.mutate(he),onCancel:()=>ge(null)}),_e&&(0,Y.jsx)(Tt,{title:n(`backup.restoreConfirmTitle`),message:n(`backup.restoreConfirmMessage`,{filename:_e}),confirmText:n(`backup.restoreConfirmButton`),variant:`danger`,onConfirm:()=>ke.mutate(_e),onCancel:()=>ve(null)}),B&&le&&(0,Y.jsx)(Tt,{title:n(`backup.restoreConfirmTitle`),message:n(`backup.restoreConfirmMessage`,{filename:le.name}),confirmText:n(`backup.restoreConfirmButton`),variant:`danger`,onConfirm:async()=>{ce(!1),z(!0),fe(null);try{se(n(`backup.uploadingFile`));let e=await r.importBackup(le);fe(e),e.success?t(n(`backup.backupRestoredRestart`),`success`):t(e.message||n(`backup.failedToRestore`),`error`)}catch(e){let r=e instanceof Error?e.message:n(`backup.failedToRestore`);fe({success:!1,message:r}),t(r,`error`)}finally{z(!1),se(``),ue(null)}},onCancel:()=>{ce(!1),ue(null)}}),(re||ae)&&(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-[100]`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl p-8 max-w-md w-full mx-4 text-center`,children:[(0,Y.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`div`,{className:`w-16 h-16 border-4 border-bambu-dark-tertiary rounded-full`}),(0,Y.jsx)(`div`,{className:`w-16 h-16 border-4 border-bambu-green border-t-transparent rounded-full absolute inset-0 animate-spin`})]})}),(0,Y.jsx)(`h3`,{className:`text-xl font-semibold text-white mb-2`,children:n(re?`backup.creatingBackup`:`backup.restoringBackup`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:oe||n(re?`backup.preparing`:`backup.processing`)}),(0,Y.jsx)(`div`,{className:`p-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,Y.jsx)(Ie,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400 mt-0.5 flex-shrink-0`}),(0,Y.jsx)(`p`,{className:`text-yellow-800 dark:text-yellow-200 text-left`,children:n(`backup.doNotClosePage`)})]})})]})})]})}function qi(e){let t=e.trim();if(t===``)return!0;if(/\s/.test(t)||!/^https?:\/\/[^\s/?#]/i.test(t))return!1;try{return new URL(t).hostname!==``}catch{return!1}}function Ji(){let{t:e}=l(),t=u(),{showToast:n}=ee(),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(`medium`),[v,y]=(0,X.useState)(`notify`),[b,x]=(0,X.useState)(10),[S,C]=(0,X.useState)(null),[w,E]=(0,X.useState)(null),[D,O]=(0,X.useState)(!1),k=qi(c),{data:j}=d({queryKey:[`settings`],queryFn:r.getSettings}),{data:M,refetch:N}=d({queryKey:[`obico-status`],queryFn:r.getObicoStatus,refetchInterval:1e4}),{data:P}=d({queryKey:[`printers`],queryFn:r.getPrinters});(0,X.useEffect)(()=>{if(j){a(j.obico_enabled??!1),s(j.obico_ml_url??``),p(j.bambuddy_internal_url??``),h(j.obico_ml_token??``),_(j.obico_sensitivity??`medium`),y(j.obico_action??`notify`),x(j.obico_poll_interval??10);try{let e=j.obico_enabled_printers?JSON.parse(j.obico_enabled_printers):null;C(Array.isArray(e)?e:null)}catch{C(null)}O(!0)}},[j]);let te=f({mutationFn:()=>r.updateSettings({obico_enabled:i,obico_ml_url:o,...k?{bambuddy_internal_url:c.trim()}:{},obico_ml_token:m,obico_sensitivity:g,obico_action:v,obico_poll_interval:b,obico_enabled_printers:S===null?``:JSON.stringify(S)}),onSuccess:()=>{t.invalidateQueries({queryKey:[`settings`]}),t.invalidateQueries({queryKey:[`obico-status`]}),t.invalidateQueries({queryKey:[`obico-printer-status`]}),n(e(`settings.toast.settingsSaved`))}}),F=(0,X.useMemo)(()=>!D||!j?!1:j.obico_enabled!==i||j.obico_ml_url!==o||k&&(j.bambuddy_internal_url??``)!==c.trim()||(j.obico_ml_token??``)!==m||j.obico_sensitivity!==g||j.obico_action!==v||j.obico_poll_interval!==b||j.obico_enabled_printers!==(S===null?``:JSON.stringify(S)),[j,D,i,o,c,k,m,g,v,b,S]);(0,X.useEffect)(()=>{if(!F)return;let e=setTimeout(()=>te.mutate(),500);return()=>clearTimeout(e)},[F,i,o,c,m,g,v,b,S]);let ne=async()=>{E(null);try{F&&await te.mutateAsync();let t=await r.testObicoConnection(o,m);t.ok?E({ok:!0,message:t.auth_ok===null?e(`failureDetection.testSuccessTokenUnknown`):e(`failureDetection.testSuccess`)}):E({ok:!1,message:t.error||`HTTP ${t.status_code??`?`} — ${t.body??e(`failureDetection.testFailed`)}`})}catch(e){E({ok:!1,message:e instanceof Error?e.message:String(e)})}},I=(e,t)=>{if(S===null){let n=P?.map(e=>e.id)??[];C(t?n:n.filter(t=>t!==e));return}C(t?[...S,e]:S.filter(t=>t!==e))};return(0,Y.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-xl`,children:[(0,Y.jsxs)(G,{id:`card-fd-ml`,children:[(0,Y.jsxs)(U,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Se,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`failureDetection.title`)})]}),(0,Y.jsx)(J,{checked:i,onChange:a})]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-2`,children:e(`failureDetection.description`)})]}),(0,Y.jsxs)(W,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`failureDetection.mlUrl`)}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`http://192.168.1.10:3333`,className:`flex-1 bg-gray-800 border border-gray-700 rounded px-3 py-2 text-white text-sm`,disabled:!i}),(0,Y.jsx)(K,{onClick:ne,disabled:!o||te.isPending,variant:`secondary`,children:e(`failureDetection.test`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`failureDetection.mlUrlHint`)}),(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1 mt-3`,children:e(`failureDetection.mlToken`)}),(0,Y.jsx)(`input`,{type:`password`,value:m,onChange:e=>h(e.target.value),autoComplete:`off`,placeholder:e(`failureDetection.mlTokenPlaceholder`),className:`w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-white text-sm`,disabled:!i}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`failureDetection.mlTokenHint`)}),w&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 mt-2 text-sm ${w.ok?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`}`,children:[w.ok?(0,Y.jsx)(T,{className:`w-4 h-4 mt-0.5`}):(0,Y.jsx)(Re,{className:`w-4 h-4 mt-0.5`}),(0,Y.jsx)(`span`,{children:w.message})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`failureDetection.bambuddyInternalUrl`)}),(0,Y.jsx)(`input`,{type:`text`,value:c,onChange:e=>p(e.target.value),placeholder:`http://bambuddy:8000`,className:`w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-white text-sm`,disabled:!i,"aria-invalid":!k}),!k&&(0,Y.jsx)(`p`,{className:`text-xs text-red-700 dark:text-red-400 mt-1`,children:e(`failureDetection.bambuddyInternalUrlInvalid`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`failureDetection.bambuddyInternalUrlHint`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`failureDetection.sensitivity`)}),(0,Y.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),disabled:!i,className:`w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-white text-sm`,children:[(0,Y.jsx)(`option`,{value:`low`,children:e(`failureDetection.sensitivityLow`)}),(0,Y.jsx)(`option`,{value:`medium`,children:e(`failureDetection.sensitivityMedium`)}),(0,Y.jsx)(`option`,{value:`high`,children:e(`failureDetection.sensitivityHigh`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`failureDetection.sensitivityHint`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`failureDetection.action`)}),(0,Y.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),disabled:!i,className:`w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-white text-sm`,children:[(0,Y.jsx)(`option`,{value:`notify`,children:e(`failureDetection.actionNotify`)}),(0,Y.jsx)(`option`,{value:`pause`,children:e(`failureDetection.actionPause`)}),(0,Y.jsx)(`option`,{value:`pause_and_off`,children:e(`failureDetection.actionPauseOff`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`failureDetection.pollInterval`)}),(0,Y.jsx)(ct,{value:b,onChange:x,fallback:10,min:5,max:120,disabled:!i,className:`w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-white text-sm`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`failureDetection.pollIntervalHint`)})]}),M&&!M.external_url_configured&&i&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 p-3 bg-amber-50 dark:bg-amber-900/30 border border-amber-300 dark:border-amber-700 rounded text-sm text-amber-800 dark:text-amber-200`,children:[(0,Y.jsx)(Ie,{className:`w-4 h-4 mt-0.5 flex-shrink-0`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:e(`failureDetection.externalUrlMissing`)}),(0,Y.jsx)(`div`,{className:`text-xs mt-1`,children:e(`failureDetection.externalUrlHint`)})]})]})]})]}),(0,Y.jsxs)(G,{id:`card-fd-perprinter`,children:[(0,Y.jsxs)(U,{children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`failureDetection.perPrinterTitle`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`failureDetection.perPrinterHint`)})]}),(0,Y.jsxs)(W,{className:`space-y-2`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:S===null,onChange:e=>C(e.target.checked?null:P?.map(e=>e.id)??[]),disabled:!i}),(0,Y.jsx)(`span`,{className:`text-white`,children:e(`failureDetection.monitorAll`)})]}),S!==null&&P&&(0,Y.jsx)(`div`,{className:`pl-5 space-y-1 border-l border-gray-700`,children:P.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:S.includes(e.id),onChange:t=>I(e.id,t.target.checked),disabled:!i}),(0,Y.jsx)(`span`,{className:`text-white`,children:e.name})]},e.id))})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-xl`,children:[(0,Y.jsxs)(G,{id:`card-fd-status`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`failureDetection.statusTitle`)})}),(0,Y.jsx)(W,{children:M?(0,Y.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:e(`failureDetection.serviceRunning`)}),(0,Y.jsx)(`span`,{className:M.is_running?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`,children:M.is_running?e(`common.yes`):e(`common.no`)})]}),(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:e(`failureDetection.thresholds`)}),(0,Y.jsxs)(`span`,{className:`text-white font-mono`,children:[M.thresholds.low.toFixed(2),` / `,M.thresholds.high.toFixed(2)]})]}),M.last_error&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-red-700 dark:text-red-400`,children:[(0,Y.jsx)(Re,{className:`w-4 h-4 mt-0.5 flex-shrink-0`}),(0,Y.jsx)(`span`,{className:`break-words`,children:M.last_error})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-bambu-gray mb-1`,children:e(`failureDetection.activePrinters`)}),Object.keys(M.per_printer).length===0?(0,Y.jsx)(`div`,{className:`text-bambu-gray italic text-xs`,children:e(`failureDetection.noActivePrints`)}):(0,Y.jsx)(`div`,{className:`space-y-1`,children:Object.entries(M.per_printer).map(([e,t])=>{let n=P?.find(t=>String(t.id)===e),r=t.class===`failure`?`text-red-700 dark:text-red-400`:t.class===`warning`?`text-amber-700 dark:text-amber-400`:`text-green-700 dark:text-green-400`;return(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-white`,children:n?.name??`Printer ${e}`}),(0,Y.jsxs)(`span`,{className:`font-mono ${r}`,children:[t.class,` (`,t.score.toFixed(3),`, `,t.frame_count,`f)`]})]},e)})})]})]}):(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),(0,Y.jsx)(`span`,{children:e(`common.loading`)})]})})]}),(0,Y.jsxs)(G,{id:`card-fd-history`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`failureDetection.historyTitle`)}),(0,Y.jsx)(`button`,{onClick:()=>N(),className:`text-xs text-bambu-gray hover:text-white`,children:e(`common.refresh`)})]})}),(0,Y.jsx)(W,{children:!M||M.history.length===0?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-sm`,children:[(0,Y.jsx)(A,{className:`w-4 h-4`}),(0,Y.jsx)(`span`,{children:e(`failureDetection.noHistory`)})]}):(0,Y.jsx)(`div`,{className:`space-y-1 max-h-96 overflow-y-auto text-xs font-mono`,children:M.history.map((e,t)=>{let n=P?.find(t=>t.id===e.printer_id),r=e.class===`failure`?`text-red-700 dark:text-red-400`:e.class===`warning`?`text-amber-700 dark:text-amber-400`:`text-bambu-gray`;return(0,Y.jsxs)(`div`,{className:`flex justify-between gap-2 py-1 border-b border-gray-800`,children:[(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:new Date(e.timestamp).toLocaleTimeString()}),(0,Y.jsx)(`span`,{className:`text-white truncate`,children:n?.name??`#${e.printer_id}`}),(0,Y.jsxs)(`span`,{className:r,children:[e.class,` `,e.score.toFixed(3)]})]},t)})})})]})]})]})}var Yi={starttls:587,ssl:465,none:25},Xi={587:`starttls`,465:`ssl`,25:`none`};function Zi(){let{t:e}=l(),{showToast:t}=ee(),n=u(),[i,a]=(0,X.useState)({smtp_host:``,smtp_port:587,smtp_username:``,smtp_password:``,smtp_security:`starttls`,smtp_auth_enabled:!0,smtp_from_email:``,smtp_from_name:`BamBuddy`}),[o,s]=(0,X.useState)(``),{data:c,isLoading:p}=d({queryKey:[`smtpSettings`],queryFn:()=>r.getSMTPSettings()}),{authEnabled:m}=un(),{data:g}=d({queryKey:[`advancedAuthStatus`],queryFn:()=>r.getAdvancedAuthStatus()});(0,X.useEffect)(()=>{c&&a({...c,smtp_password:``})},[c]);let _=e=>{a({...i,smtp_security:e,smtp_port:Yi[e]})},v=e=>{let t=Xi[e];a({...i,smtp_port:e,...t?{smtp_security:t}:{}})},y=e=>{a({...i,smtp_auth_enabled:e,...e?{}:{smtp_username:``,smtp_password:``}})},b=f({mutationFn:e=>r.saveSMTPSettings(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`smtpSettings`]}),n.invalidateQueries({queryKey:[`advancedAuthStatus`]}),t(e(`settings.email.success.settingsSaved`),`success`)},onError:e=>{t(e.message,`error`)}}),x=f({mutationFn:e=>r.testSMTP(e),onSuccess:e=>{t(e.message,e.success?`success`:`error`)},onError:e=>{t(e.message,`error`)}}),S=f({mutationFn:e=>e?r.enableAdvancedAuth():r.disableAdvancedAuth(),onSuccess:e=>{n.invalidateQueries({queryKey:[`advancedAuthStatus`]}),t(e.message,`success`)},onError:e=>{t(e.message,`error`)}}),C=()=>{if(!i.smtp_host||!i.smtp_from_email){t(e(`settings.email.errors.requiredFields`),`error`);return}if(i.smtp_auth_enabled&&!i.smtp_username){t(e(`settings.email.errors.usernameRequired`),`error`);return}b.mutate(i)},w=()=>{if(!o){t(e(`settings.email.errors.enterTestEmail`),`error`);return}x.mutate({test_recipient:o})},T=()=>{if(!m){t(e(`settings.email.errors.enableAuthFirst`),`error`);return}if(!g?.advanced_auth_enabled&&!g?.smtp_configured){t(e(`settings.email.errors.configureSmtpFirst`),`error`);return}S.mutate(!g?.advanced_auth_enabled)};if(p)return(0,Y.jsx)(`div`,{className:`flex items-center justify-center p-12`,children:(0,Y.jsx)(R,{className:`w-8 h-8 animate-spin text-bambu-green`})});let E=g?.advanced_auth_enabled??!1,D=`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,O=`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white/40 placeholder-bambu-gray/40 cursor-not-allowed`;return(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(G,{id:`card-email-advanced-auth`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Vt,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`settings.email.advancedAuth`)||`Advanced Authentication`})]}),(0,Y.jsx)(K,{onClick:T,disabled:S.isPending,variant:E?`danger`:`primary`,children:E?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(h,{className:`w-4 h-4`}),e(`settings.email.disable`)||`Disable`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(z,{className:`w-4 h-4`}),e(`settings.email.enable`)||`Enable`]})})]})}),(0,Y.jsx)(W,{children:(0,Y.jsx)(`div`,{className:`space-y-3`,children:E?(0,Y.jsx)(`div`,{className:`bg-green-50 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30 rounded-lg p-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(j,{className:`w-5 h-5 text-green-600 dark:text-green-400 mt-0.5 flex-shrink-0`}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium`,children:e(`settings.email.advancedAuthEnabled`)||`Advanced Authentication is enabled`}),(0,Y.jsxs)(`ul`,{className:`text-sm text-green-700 dark:text-green-300 space-y-1 list-disc list-inside`,children:[(0,Y.jsx)(`li`,{children:e(`settings.email.feature1`)||`Passwords are auto-generated and emailed to new users`}),(0,Y.jsx)(`li`,{children:e(`settings.email.feature2`)||`Users can login with username or email`}),(0,Y.jsx)(`li`,{children:e(`settings.email.feature3`)||`Forgot password feature is available`}),(0,Y.jsx)(`li`,{children:e(`settings.email.feature4`)||`Admins can reset user passwords via email`})]})]})]})}):(0,Y.jsx)(`div`,{className:`bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30 rounded-lg p-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(Ie,{className:`w-5 h-5 text-yellow-600 dark:text-yellow-400 mt-0.5 flex-shrink-0`}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium`,children:e(`settings.email.advancedAuthDisabled`)||`Advanced Authentication is disabled`}),(0,Y.jsx)(`p`,{className:`text-sm text-yellow-700 dark:text-yellow-300`,children:e(`settings.email.advancedAuthDisabledDesc`)||`Enable advanced authentication to activate email-based features for user management.`})]})]})})})})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,Y.jsx)(`div`,{className:`lg:col-span-2`,children:(0,Y.jsxs)(G,{id:`card-smtp-config`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`settings.email.smtpSettings`)||`SMTP Configuration`})}),(0,Y.jsx)(W,{children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:e(`settings.email.authentication`)||`Authentication`}),(0,Y.jsxs)(`select`,{value:i.smtp_auth_enabled?`true`:`false`,onChange:e=>y(e.target.value===`true`),className:D,children:[(0,Y.jsx)(`option`,{value:`true`,children:e(`settings.email.authOptions.enabled`)}),(0,Y.jsx)(`option`,{value:`false`,children:e(`settings.email.authOptions.disabled`)})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 transition-opacity ${i.smtp_auth_enabled?``:`opacity-40 pointer-events-none`}`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:e(`settings.email.username`)||`Username`}),(0,Y.jsx)(`input`,{type:`text`,value:i.smtp_username||``,onChange:e=>a({...i,smtp_username:e.target.value}),placeholder:`your.email@gmail.com`,disabled:!i.smtp_auth_enabled,className:i.smtp_auth_enabled?D:O})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:e(`settings.email.password`)||`Password`}),(0,Y.jsx)(`input`,{type:`password`,value:i.smtp_password||``,onChange:e=>a({...i,smtp_password:e.target.value}),placeholder:c?`••••••••`:`App password`,disabled:!i.smtp_auth_enabled,className:i.smtp_auth_enabled?D:O})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:[e(`settings.email.smtpHost`)||`SMTP Server`,` *`]}),(0,Y.jsx)(`input`,{type:`text`,value:i.smtp_host,onChange:e=>a({...i,smtp_host:e.target.value}),placeholder:`smtp.gmail.com`,className:D})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:e(`settings.email.smtpPort`)||`SMTP Port`}),(0,Y.jsx)(ct,{value:i.smtp_port,onChange:v,min:1,max:65535,fallback:587,placeholder:`587`,className:D})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:e(`settings.email.security`)||`Security`}),(0,Y.jsxs)(`select`,{value:i.smtp_security,onChange:e=>_(e.target.value),className:D,children:[(0,Y.jsx)(`option`,{value:`starttls`,children:e(`settings.email.securityOptions.starttls`)}),(0,Y.jsx)(`option`,{value:`ssl`,children:e(`settings.email.securityOptions.ssl`)}),(0,Y.jsx)(`option`,{value:`none`,children:e(`settings.email.securityOptions.none`)})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:[e(`settings.email.fromEmail`)||`From Email`,` *`]}),(0,Y.jsx)(`input`,{type:`email`,value:i.smtp_from_email,onChange:e=>a({...i,smtp_from_email:e.target.value}),placeholder:`your@email.com`,className:D})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:e(`settings.email.fromName`)||`From Name`}),(0,Y.jsx)(`input`,{type:`text`,value:i.smtp_from_name,onChange:e=>a({...i,smtp_from_name:e.target.value}),placeholder:`BamBuddy`,className:D})]})]}),(0,Y.jsx)(`div`,{className:`flex gap-2`,children:(0,Y.jsx)(K,{onClick:C,disabled:b.isPending,className:`flex-1`,children:b.isPending?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),e(`settings.email.saving`)||`Saving...`]}):e(`settings.email.save`)||`Save Settings`})})]})})]})}),(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(G,{id:`card-email-test`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`settings.email.testConnection`)||`Test SMTP Connection`})}),(0,Y.jsx)(W,{children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:e(`settings.email.testRecipient`)||`Test Recipient Email`}),(0,Y.jsx)(`input`,{type:`email`,value:o,onChange:e=>s(e.target.value),placeholder:`test@example.com`,className:D})]}),(0,Y.jsx)(K,{onClick:w,disabled:x.isPending,variant:`secondary`,children:x.isPending?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),e(`settings.email.sending`)||`Sending...`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Sn,{className:`w-4 h-4`}),e(`settings.email.sendTest`)||`Send Test Email`]})})]})})]})})]})]})}var Qi={starttls:`389`,ldaps:`636`};function $i(){let{t:e}=l(),{showToast:t}=ee(),n=u(),{authEnabled:i}=un(),[a,o]=(0,X.useState)({ldap_server_url:``,ldap_bind_dn:``,ldap_bind_password:``,ldap_search_base:``,ldap_user_filter:`(sAMAccountName={username})`,ldap_security:`starttls`,ldap_group_mapping:``,ldap_auto_provision:!1,ldap_default_group:``}),{data:s,isLoading:c}=d({queryKey:[`settings`],queryFn:()=>r.getSettings()}),{data:p}=d({queryKey:[`ldapStatus`],queryFn:()=>r.getLDAPStatus()}),{data:m=[]}=d({queryKey:[`groups`],queryFn:()=>r.getGroups()});(0,X.useEffect)(()=>{s&&o({ldap_server_url:s.ldap_server_url||``,ldap_bind_dn:s.ldap_bind_dn||``,ldap_bind_password:``,ldap_search_base:s.ldap_search_base||``,ldap_user_filter:s.ldap_user_filter||`(sAMAccountName={username})`,ldap_security:s.ldap_security||`starttls`,ldap_group_mapping:s.ldap_group_mapping||``,ldap_auto_provision:s.ldap_auto_provision??!1,ldap_default_group:s.ldap_default_group||``})},[s]);let g=f({mutationFn:e=>r.updateSettings(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`settings`]}),n.invalidateQueries({queryKey:[`ldapStatus`]}),t(e(`settings.ldap.settingsSaved`)||`LDAP settings saved`,`success`)},onError:e=>{t(e.message,`error`)}}),_=f({mutationFn:e=>r.updateSettings({ldap_enabled:e}),onSuccess:()=>{n.invalidateQueries({queryKey:[`settings`]}),n.invalidateQueries({queryKey:[`ldapStatus`]}),t(p?.ldap_enabled?e(`settings.ldap.disabled`)||`LDAP authentication disabled`:e(`settings.ldap.enabled`)||`LDAP authentication enabled`,`success`)},onError:e=>{t(e.message,`error`)}}),v=f({mutationFn:()=>r.testLDAP(),onSuccess:e=>{t(e.message,e.success?`success`:`error`)},onError:e=>{t(e.message,`error`)}}),y=()=>{if(!a.ldap_server_url){t(e(`settings.ldap.errors.serverRequired`)||`LDAP server URL is required`,`error`);return}if(!a.ldap_search_base){t(e(`settings.ldap.errors.searchBaseRequired`)||`Search base DN is required`,`error`);return}let n={ldap_server_url:a.ldap_server_url,ldap_bind_dn:a.ldap_bind_dn,ldap_search_base:a.ldap_search_base,ldap_user_filter:a.ldap_user_filter,ldap_security:a.ldap_security,ldap_group_mapping:a.ldap_group_mapping,ldap_auto_provision:a.ldap_auto_provision,ldap_default_group:a.ldap_default_group};a.ldap_bind_password&&(n.ldap_bind_password=a.ldap_bind_password),g.mutate(n)},b=()=>{if(!i){t(e(`settings.ldap.errors.enableAuthFirst`)||`Enable authentication first`,`error`);return}if(!p?.ldap_enabled&&!p?.ldap_configured){t(e(`settings.ldap.errors.configureLdapFirst`)||`Save LDAP settings first`,`error`);return}_.mutate(!p?.ldap_enabled)};if(c)return(0,Y.jsx)(`div`,{className:`flex items-center justify-center p-12`,children:(0,Y.jsx)(R,{className:`w-8 h-8 animate-spin text-bambu-green`})});let x=p?.ldap_enabled??!1,S=`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`;return(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(G,{id:`card-ldap-toggle`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Me,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`settings.ldap.title`)||`LDAP Authentication`})]}),(0,Y.jsx)(K,{onClick:b,disabled:_.isPending,variant:x?`danger`:`primary`,children:x?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(h,{className:`w-4 h-4`}),e(`common.disable`)||`Disable`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(z,{className:`w-4 h-4`}),e(`common.enable`)||`Enable`]})})]})}),(0,Y.jsx)(W,{children:x?(0,Y.jsx)(`div`,{className:`bg-green-50 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30 rounded-lg p-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(j,{className:`w-5 h-5 text-green-600 dark:text-green-400 mt-0.5 flex-shrink-0`}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium`,children:e(`settings.ldap.enabledDesc`)||`LDAP authentication is enabled`}),(0,Y.jsxs)(`ul`,{className:`text-sm text-green-700 dark:text-green-300 space-y-1 list-disc list-inside`,children:[(0,Y.jsx)(`li`,{children:e(`settings.ldap.feature1`)||`Users can login with LDAP credentials`}),(0,Y.jsx)(`li`,{children:e(`settings.ldap.feature2`)||`Local admin account remains as fallback`}),(0,Y.jsx)(`li`,{children:e(`settings.ldap.feature3`)||`LDAP groups are mapped to BamBuddy groups on login`})]})]})]})}):(0,Y.jsx)(`div`,{className:`bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30 rounded-lg p-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(Ie,{className:`w-5 h-5 text-yellow-600 dark:text-yellow-400 mt-0.5 flex-shrink-0`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white font-medium`,children:e(`settings.ldap.disabledDesc`)||`LDAP authentication is disabled`}),(0,Y.jsx)(`p`,{className:`text-sm text-yellow-700 dark:text-yellow-300 mt-1`,children:e(`settings.ldap.disabledHint`)||`Configure and save LDAP settings below, then enable.`})]})]})})})]}),(0,Y.jsxs)(G,{id:`card-ldap-server`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`settings.ldap.serverConfig`)||`LDAP Server Configuration`})}),(0,Y.jsx)(W,{children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-3`,children:[(0,Y.jsxs)(`div`,{className:`md:col-span-2`,children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:e(`settings.ldap.serverUrl`)||`Server URL`}),(0,Y.jsx)(`input`,{type:`text`,className:S,placeholder:`ldaps://ldap.example.com:636`,value:a.ldap_server_url,onChange:e=>o({...a,ldap_server_url:e.target.value})}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`settings.ldap.serverUrlHint`)||`Use ldaps:// for SSL or ldap:// with StartTLS`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:e(`settings.ldap.security`)||`Security`}),(0,Y.jsx)(`div`,{className:`flex gap-2`,children:[`starttls`,`ldaps`].map(e=>(0,Y.jsx)(`button`,{onClick:()=>o({...a,ldap_security:e}),className:`flex-1 px-2 py-2 rounded-lg text-sm font-medium transition-colors ${a.ldap_security===e?`bg-bambu-green text-black`:`bg-bambu-dark-secondary text-bambu-gray hover:text-white border border-bambu-dark-tertiary`}`,children:e===`starttls`?`StartTLS`:`LDAPS`},e))}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`settings.ldap.securityHint`)||`Default port: ${Qi[a.ldap_security]}`})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:e(`settings.ldap.bindDn`)||`Bind DN (Service Account)`}),(0,Y.jsx)(`input`,{type:`text`,className:S,placeholder:`cn=service-account,ou=service,dc=example,dc=com`,value:a.ldap_bind_dn,onChange:e=>o({...a,ldap_bind_dn:e.target.value})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:e(`settings.ldap.bindPassword`)||`Bind Password`}),(0,Y.jsx)(`input`,{type:`password`,className:S,placeholder:s?.ldap_bind_dn?`••••••••`:``,value:a.ldap_bind_password,onChange:e=>o({...a,ldap_bind_password:e.target.value})})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:e(`settings.ldap.searchBase`)||`Search Base DN`}),(0,Y.jsx)(`input`,{type:`text`,className:S,placeholder:`ou=users,dc=example,dc=com`,value:a.ldap_search_base,onChange:e=>o({...a,ldap_search_base:e.target.value})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:e(`settings.ldap.userFilter`)||`User Search Filter`}),(0,Y.jsx)(`input`,{type:`text`,className:S,placeholder:`(sAMAccountName={username})`,value:a.ldap_user_filter,onChange:e=>o({...a,ldap_user_filter:e.target.value})})]})]}),(0,Y.jsx)(Rt,{summary:(0,Y.jsx)(`span`,{className:`text-sm font-medium text-bambu-gray`,children:e(`settings.ldap.advanced`)||`Advanced`}),className:`border-t border-bambu-dark-tertiary pt-3`,summaryClassName:`py-1`,children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white`,children:e(`settings.ldap.autoProvision`)||`Auto-provision users`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:e(`settings.ldap.autoProvisionHint`)||`Automatically create a BamBuddy account on first LDAP login`})]}),(0,Y.jsx)(`button`,{onClick:()=>o({...a,ldap_auto_provision:!a.ldap_auto_provision}),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors flex-shrink-0 ${a.ldap_auto_provision?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,children:(0,Y.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${a.ldap_auto_provision?`translate-x-6`:`translate-x-1`}`})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:e(`settings.ldap.defaultGroup`)||`Default group`}),(0,Y.jsxs)(`select`,{className:S,value:a.ldap_default_group,onChange:e=>o({...a,ldap_default_group:e.target.value}),children:[(0,Y.jsx)(`option`,{value:``,children:e(`settings.ldap.defaultGroupNone`)||`— None (reject login) —`}),m.map(e=>(0,Y.jsx)(`option`,{value:e.name,children:e.name},e.id))]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`settings.ldap.defaultGroupHint`)||`Fallback group assigned when an LDAP user authenticates but is not listed in any mapped group. Leave empty to leave unmapped users without permissions.`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:e(`settings.ldap.groupMapping`)||`Group Mapping (JSON)`}),(0,Y.jsx)(`textarea`,{className:`${S} font-mono text-sm`,rows:4,placeholder:`{ + "CN=PrintFarm_Admins,OU=Groups,DC=example,DC=com": "Administrators", + "CN=PrintFarm_Users,OU=Groups,DC=example,DC=com": "Operators" +}`,value:a.ldap_group_mapping,onChange:e=>o({...a,ldap_group_mapping:e.target.value})}),(0,Y.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:[e(`settings.ldap.groupMappingHint`)||`Map LDAP group DNs to BamBuddy groups. Available groups: `,m.map(e=>e.name).join(`, `)]})]})]})}),(0,Y.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,Y.jsxs)(K,{onClick:y,disabled:g.isPending,children:[g.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(j,{className:`w-4 h-4`}),e(`common.save`)||`Save`]}),(0,Y.jsxs)(K,{variant:`secondary`,onClick:()=>v.mutate(),disabled:v.isPending,children:[v.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Sn,{className:`w-4 h-4`}),e(`settings.ldap.testConnection`)||`Test Connection`]})]})]})})]})]})}var ea=`__none__`,ta=60,na=`px-3 py-2 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,ra=e=>e.is_system&&e.name===`Administrators`,ia=e=>({restrict:e.restrict_printers,printerIds:[...e.printer_ids].sort((e,t)=>e-t),locations:[...e.locations??[]].sort()}),aa=(e,t)=>e.restrict===t.restrict&&e.printerIds.length===t.printerIds.length&&e.printerIds.every((e,n)=>e===t.printerIds[n])&&e.locations.length===t.locations.length&&e.locations.every((e,n)=>e===t.locations[n]),oa=e=>e.location||ea;function sa(e,t){return t.location&&e.locations.includes(t.location)?`location`:e.printerIds.includes(t.id)?`picked`:null}function ca(){let{t:e}=l(),t=u(),{showToast:n}=ee(),[i,a]=bt(),o=i.get(`view`)===`printers`?`printers`:`groups`,s=Number(i.get(`group`))||null,c=Number(i.get(`printer`))||null,p=e=>{a(t=>{let n=new URLSearchParams(t);for(let[t,r]of Object.entries(e))r===null?n.delete(t):n.set(t,r);return n},{replace:!0})},[m,h]=(0,X.useState)({}),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(`all`),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(`all`),[w,T]=(0,X.useState)(`all`),[D,O]=(0,X.useState)(`all`),[k,A]=(0,X.useState)({}),{data:j,isLoading:M}=d({queryKey:[`groups`],queryFn:()=>r.getGroups()}),{data:N,isLoading:P}=d({queryKey:[`printers`],queryFn:()=>r.getPrinters()}),{data:te}=d({queryKey:[`users`],queryFn:()=>r.getUsers()}),F=e=>m[e.id]??ia(e),ne=(e,t)=>{h(n=>{let r=t(n[e.id]??ia(e)),i={restrict:r.restrict,printerIds:[...new Set(r.printerIds)].sort((e,t)=>e-t),locations:[...new Set(r.locations)].sort()},a={...n};return aa(i,ia(e))?delete a[e.id]:a[e.id]=i,a})},I=(0,X.useMemo)(()=>(j??[]).filter(e=>m[e.id]!==void 0),[j,m]),re=I.length>0;(0,X.useEffect)(()=>{if(!re)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[re]);let ie=f({mutationFn:async()=>{for(let e of I){let t=m[e.id];await r.updateGroup(e.id,{restrict_printers:t.restrict,printer_ids:t.printerIds,locations:t.locations}),h(t=>{let n={...t};return delete n[e.id],n})}},onSuccess:()=>n(e(`printerAccess.saved`)),onError:e=>n(e.message,`error`),onSettled:()=>{t.invalidateQueries({queryKey:[`groups`]}),t.invalidateQueries({queryKey:[`group`]})}}),L=(0,X.useMemo)(()=>[...N??[]].sort((e,t)=>e.name.localeCompare(t.name)),[N]),ae=(0,X.useMemo)(()=>{let e=new Set;for(let t of L)t.location&&e.add(t.location);return[...e].sort((e,t)=>e.localeCompare(t))},[L]),z=L.some(e=>!e.location),oe=(0,X.useMemo)(()=>{let e=new Set;for(let t of L)t.model&&e.add(t.model);return[...e].sort()},[L]),se=(0,X.useMemo)(()=>{let e=new Map;for(let t of L){let n=oa(t);e.set(n,[...e.get(n)??[],t])}return e},[L]),B=(0,X.useMemo)(()=>{let e=b.trim().toLowerCase();return L.filter(t=>S!==`all`&&oa(t)!==S||w!==`all`&&t.model!==w?!1:e?t.name.toLowerCase().includes(e)||(t.model??``).toLowerCase().includes(e)||t.serial_number.toLowerCase().includes(e)||(t.location??``).toLowerCase().includes(e):!0)},[L,b,S,w]),ce=(0,X.useMemo)(()=>[...j??[]].sort((e,t)=>e.name.localeCompare(t.name)),[j]),le=g.trim().toLowerCase(),ue=ce.filter(e=>{if(le&&!e.name.toLowerCase().includes(le))return!1;let t=!ra(e)&&F(e).restrict;return v===`limited`?t:v===`open`?!t:!0}),de=ce.filter(e=>!ra(e)&&F(e).restrict),fe=e=>L.filter(t=>sa(e,t)!==null).length;if(M||P)return(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,Y.jsx)(R,{className:`w-8 h-8 text-bambu-green animate-spin`})});let V=ce.find(e=>e.id===s)??null,pe=t=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`div`,{className:`relative flex-1 min-w-[12rem]`,children:[(0,Y.jsx)(Ae,{className:`w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray`}),(0,Y.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:e(`printerAccess.searchPrinters`),"aria-label":e(`printerAccess.searchPrinters`),className:`${na} w-full pl-9`})]}),(0,Y.jsxs)(`select`,{value:S,onChange:e=>C(e.target.value),"aria-label":e(`printerAccess.allLocations`),className:na,children:[(0,Y.jsx)(`option`,{value:`all`,children:e(`printerAccess.allLocations`)}),ae.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e)),z&&(0,Y.jsx)(`option`,{value:ea,children:e(`printerAccess.noLocation`)})]}),oe.length>1&&(0,Y.jsxs)(`select`,{value:w,onChange:e=>T(e.target.value),"aria-label":e(`printerAccess.allModels`),className:na,children:[(0,Y.jsx)(`option`,{value:`all`,children:e(`printerAccess.allModels`)}),oe.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]}),t&&(0,Y.jsxs)(`select`,{value:D,onChange:e=>O(e.target.value),"aria-label":e(`printerAccess.accessFilter`),className:na,children:[(0,Y.jsx)(`option`,{value:`all`,children:e(`printerAccess.accessAll`)}),(0,Y.jsx)(`option`,{value:`with`,children:e(`printerAccess.accessWith`)}),(0,Y.jsx)(`option`,{value:`without`,children:e(`printerAccess.accessWithout`)})]})]});return(0,Y.jsxs)(`div`,{className:`space-y-4 max-w-6xl`,id:`card-printer-access`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`printerAccess.intro`)}),(0,Y.jsx)(`div`,{className:`flex gap-1 p-1 rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary w-fit`,children:[`groups`,`printers`].map(t=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>p({view:t===`groups`?null:`printers`}),className:`px-3 py-1.5 text-sm rounded-md transition-colors ${o===t?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:e(t===`groups`?`printerAccess.byGroup`:`printerAccess.byPrinter`)},t))}),o===`groups`?(0,Y.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 items-start`,children:[(0,Y.jsxs)(G,{className:`lg:w-80 shrink-0 flex flex-col lg:max-h-[calc(100vh-14rem)]`,children:[(0,Y.jsxs)(`div`,{className:`p-3 space-y-2 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(Ae,{className:`w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray`}),(0,Y.jsx)(`input`,{type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:e(`printerAccess.searchGroups`),"aria-label":e(`printerAccess.searchGroups`),className:`${na} w-full pl-9`})]}),(0,Y.jsx)(`div`,{className:`flex gap-1`,children:[`all`,`limited`,`open`].map(t=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>y(t),className:`flex-1 px-2 py-1 text-xs rounded-md transition-colors ${v===t?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary`}`,children:e(`printerAccess.groupFilter.${t}`)},t))})]}),(0,Y.jsx)(`div`,{className:`overflow-y-auto p-1`,children:ue.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray p-3`,children:e(`printerAccess.noGroupsMatch`)}):ue.map(t=>{let n=F(t),r=ra(t),i=r?e(`printerAccess.alwaysAll`):n.restrict?e(`printerAccess.reachShort`,{count:fe(n),total:L.length}):e(`printerAccess.notLimited`);return(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>p({group:String(t.id)}),className:`w-full text-left px-3 py-2 rounded-lg transition-colors ${t.id===s?`bg-bambu-dark-tertiary`:`hover:bg-bambu-dark-tertiary/60`}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white truncate flex-1`,children:t.name}),m[t.id]&&(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-yellow-400 shrink-0`,title:e(`printerAccess.unsaved`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray mt-0.5`,children:[(0,Y.jsx)(Ze,{className:`w-3 h-3 shrink-0`}),(0,Y.jsx)(`span`,{children:t.user_count}),(0,Y.jsx)(`span`,{children:`·`}),(0,Y.jsx)(`span`,{className:!r&&n.restrict?`text-bambu-green`:``,children:i})]})]},t.id)})})]}),(()=>{if(!V)return(0,Y.jsx)(G,{className:`flex-1 p-8 text-center text-sm text-bambu-gray`,children:e(`printerAccess.pickGroup`)});let t=V,n=F(t),r=fe(n),i=B.filter(e=>{let t=sa(n,e);return D===`with`?t!==null:D===`without`?t===null:!0}),a=new Map;for(let e of i){let t=oa(e);a.set(t,[...a.get(t)??[],e])}let o=[...a.keys()].sort((e,t)=>e===ea?1:t===ea?-1:e.localeCompare(t)),s=n.locations.filter(e=>!se.has(e)),c=i.length>ta&&!b.trim(),l=e=>k[e]??!c,u=(e,n)=>ne(t,t=>({...t,locations:n?[...t.locations,e]:t.locations.filter(t=>t!==e)})),d=(e,n)=>ne(t,t=>({...t,printerIds:n?[...t.printerIds,e]:t.printerIds.filter(t=>t!==e)})),f=e=>{let r=i.filter(e=>sa(n,e)!==`location`).map(e=>e.id);ne(t,t=>({...t,printerIds:e?[...t.printerIds,...r]:t.printerIds.filter(e=>!r.includes(e))}))};return(0,Y.jsx)(G,{className:`flex-1 min-w-0`,children:(0,Y.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-white font-medium truncate`,children:t.name}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:e(`printerAccess.memberCount`,{count:t.user_count})})]}),(0,Y.jsxs)(ft,{to:`/groups/${t.id}/edit`,className:`flex items-center gap-1.5 text-xs text-bambu-gray hover:text-white shrink-0`,children:[(0,Y.jsx)(Ke,{className:`w-3.5 h-3.5`}),e(`printerAccess.editGroup`)]})]}),ra(t)?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`printerAccess.adminsSeeAll`)}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:e(`printerAccess.limit`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`printerAccess.limitHint`)})]}),(0,Y.jsx)(J,{checked:n.restrict,onChange:e=>ne(t,t=>({...t,restrict:e}))})]}),n.restrict&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`printerAccess.reach`,{count:r,total:L.length})}),r===0&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-yellow-700 dark:text-yellow-400`,children:[(0,Y.jsx)(Ie,{className:`w-3.5 h-3.5 shrink-0`}),e(`printerAccess.noneGranted`)]})]}),L.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`printerAccess.noPrinters`)}):(0,Y.jsxs)(Y.Fragment,{children:[pe(!0),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>f(!0),disabled:i.length===0,children:e(`printerAccess.tickShown`)}),(0,Y.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>f(!1),disabled:i.length===0,children:e(`printerAccess.untickShown`)})]}),s.map(t=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2 rounded-lg border border-dashed border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-bambu-gray min-w-0`,children:[(0,Y.jsx)(H,{className:`w-4 h-4 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:t}),(0,Y.jsxs)(`span`,{className:`text-xs`,children:[`(`,e(`printerAccess.emptyLocation`),`)`]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-bambu-gray cursor-pointer shrink-0`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:!0,onChange:()=>u(t,!1),"aria-label":e(`printerAccess.wholeLocationHint`,{location:t}),className:`w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark-secondary`}),e(`printerAccess.wholeLocation`)]})]},`stale-${t}`)),o.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray py-4 text-center`,children:e(`printerAccess.noPrintersMatch`)}):(0,Y.jsx)(`div`,{className:`space-y-2`,children:o.map(t=>{let r=a.get(t)??[],i=se.get(t)??[],o=i.filter(e=>sa(n,e)!==null).length,s=t!==ea,c=s&&n.locations.includes(t),f=l(t);return(0,Y.jsxs)(`div`,{className:`rounded-lg border border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>A(e=>({...e,[t]:!f})),className:`flex items-center gap-2 flex-1 min-w-0 text-left`,"aria-expanded":f,children:[f?(0,Y.jsx)(E,{className:`w-4 h-4 text-bambu-gray shrink-0`}):(0,Y.jsx)(st,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,Y.jsx)(H,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,Y.jsx)(`span`,{className:`text-sm text-white truncate`,children:s?t:e(`printerAccess.noLocation`)}),(0,Y.jsxs)(`span`,{className:`text-xs text-bambu-gray tabular-nums shrink-0`,children:[o,`/`,i.length]})]}),s&&(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-bambu-gray cursor-pointer shrink-0`,title:e(`printerAccess.wholeLocationHint`,{location:t}),children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>u(t,e.target.checked),"aria-label":e(`printerAccess.wholeLocationHint`,{location:t}),className:`w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark-secondary`}),e(`printerAccess.wholeLocation`)]})]}),f&&(0,Y.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-1 px-2 pb-2`,children:r.map(t=>{let r=sa(n,t);return(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded ${r===`location`?`cursor-default`:`cursor-pointer hover:bg-bambu-dark-tertiary/60`}`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r!==null,disabled:r===`location`,onChange:e=>d(t.id,e.target.checked),"aria-label":t.name,className:`w-4 h-4 shrink-0 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark-secondary disabled:opacity-60`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block text-sm text-white truncate`,children:t.name}),(0,Y.jsx)(`span`,{className:`block text-xs text-bambu-gray truncate`,children:[t.model,t.serial_number].filter(Boolean).join(` · `)})]}),r===`location`&&(0,Y.jsx)(`span`,{className:`text-xs text-bambu-green shrink-0`,children:e(`printerAccess.viaLocation`)})]},t.id)})})]},t)})})]})]})]})]})})})()]}):(()=>{let t=new Set(de.map(e=>e.id)),n=(te??[]).filter(e=>e.is_active&&!e.is_admin&&!e.groups.some(e=>t.has(e.id))),r=c?L.filter(e=>e.id===c):B;return(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(G,{children:(0,Y.jsxs)(`div`,{className:`p-4 space-y-1 text-sm`,children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray`,children:e(`printerAccess.alsoVisible`)}),te&&(0,Y.jsx)(`p`,{className:n.length>0?`text-yellow-700 dark:text-yellow-400`:`text-bambu-gray`,children:n.length>0?e(`printerAccess.openUsers`,{names:n.slice(0,10).map(e=>e.username).join(`, `)+(n.length>10?` +${n.length-10}`:``)}):e(`printerAccess.noOpenUsers`)})]})}),de.length===0&&(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`printerAccess.noLimitedGroups`)}),c?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Y.jsx)(`span`,{children:e(`printerAccess.showingOne`)}),(0,Y.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>p({printer:null}),children:e(`printerAccess.showAll`)})]}):pe(!1),r.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray py-4 text-center`,children:L.length===0?e(`printerAccess.noPrinters`):e(`printerAccess.noPrintersMatch`)}):(0,Y.jsx)(G,{children:(0,Y.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:r.map(t=>{let n=de.map(e=>({group:e,reach:sa(F(e),t)})).filter(e=>e.reach!==null),r=de.filter(e=>sa(F(e),t)===null);return(0,Y.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-center gap-2 md:gap-4 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`md:w-64 shrink-0 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(it,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,Y.jsx)(`span`,{className:`text-sm text-white truncate`,children:t.name})]}),(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray truncate pl-6`,children:[t.model,t.location||e(`printerAccess.noLocation`)].filter(Boolean).join(` · `)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 flex-1 min-w-0`,children:[n.map(({group:n,reach:r})=>r===`location`?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>p({view:null,group:String(n.id),printer:null}),title:e(`printerAccess.viaLocationTitle`,{location:t.location}),className:`flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bambu-green/10 text-bambu-green border border-bambu-green/30`,children:[(0,Y.jsx)(H,{className:`w-3 h-3`}),n.name]},n.id):(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full text-xs bg-bambu-green/20 text-bambu-green`,children:[n.name,(0,Y.jsx)(`button`,{type:`button`,onClick:()=>ne(n,e=>({...e,printerIds:e.printerIds.filter(e=>e!==t.id)})),"aria-label":e(`printerAccess.removeGroup`,{group:n.name}),className:`p-0.5 rounded-full hover:bg-bambu-green/30`,children:(0,Y.jsx)(Re,{className:`w-3 h-3`})})]},n.id)),n.length===0&&de.length>0&&(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e(`printerAccess.noLimitedGroupReaches`)})]}),r.length>0&&(0,Y.jsxs)(`select`,{value:``,onChange:e=>{let n=de.find(t=>t.id===Number(e.target.value));n&&ne(n,e=>({...e,printerIds:[...e.printerIds,t.id]}))},"aria-label":e(`printerAccess.addGroup`),className:`${na} md:w-48 shrink-0`,children:[(0,Y.jsx)(`option`,{value:``,children:e(`printerAccess.addGroup`)}),r.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]},t.id)})})})]})})(),re&&(0,Y.jsxs)(`div`,{className:`sticky bottom-0 z-20 flex flex-wrap items-center justify-between gap-3 px-4 py-3 rounded-xl bg-bambu-dark-secondary border border-bambu-dark-tertiary shadow-lg`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:e(`printerAccess.changedGroups`,{names:I.map(e=>e.name).join(`, `)})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>h({}),disabled:ie.isPending,children:e(`printerAccess.discard`)}),(0,Y.jsxs)(K,{onClick:()=>ie.mutate(),disabled:ie.isPending,children:[ie.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(_t,{className:`w-4 h-4`}),e(`common.save`)]})]})]})]})}function la({value:e,onChange:t,placeholder:n,maxLength:r=6}){return(0,Y.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value.toUpperCase().replace(/\s/g,``)),maxLength:r,className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors font-mono tracking-widest text-center`,placeholder:n,autoComplete:`one-time-code`})}function ua({codes:e,onDone:t}){let{t:n}=l(),[r,i]=(0,X.useState)(!1);return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`div`,{className:`bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 rounded-lg p-4`,children:(0,Y.jsx)(`p`,{className:`text-amber-700 dark:text-amber-400 text-sm font-medium`,children:n(`settings.twoFa.backupCodesWarning`)})}),(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:e.map((e,t)=>(0,Y.jsx)(`code`,{className:`bg-bambu-dark-secondary rounded px-3 py-2 text-center font-mono text-sm text-white tracking-widest`,children:e},t))}),(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(e.join(` +`)),i(!0),setTimeout(()=>i(!1),2e3)},className:`flex items-center gap-2`,children:[(0,Y.jsx)(N,{className:`w-4 h-4`}),n(r?`common.copied`:`common.copy`)]}),(0,Y.jsx)(K,{variant:`primary`,size:`sm`,onClick:t,className:`flex-1`,children:n(`settings.twoFa.savedCodes`)})]})]})}function da({onDone:e}){let{t}=l(),n=u(),{showToast:i}=ee(),[a,o]=(0,X.useState)(`qr`),[s,c]=(0,X.useState)(``),[p,m]=(0,X.useState)([]),[h,g]=(0,X.useState)(!1),{data:_,isLoading:v}=d({queryKey:[`totp-setup`],queryFn:()=>r.setupTOTP(),staleTime:1/0}),y=f({mutationFn:e=>r.enableTOTP(e),onSuccess:e=>{m(e.backup_codes),o(`backup`),n.invalidateQueries({queryKey:[`2fa-status`]})},onError:()=>i(t(`settings.twoFa.invalidCode`),`error`)});return v||!_?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Y.jsx)(at,{className:`w-6 h-6 animate-spin text-bambu-green`})}):a===`qr`?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:t(`settings.twoFa.setupInstructions`)}),(0,Y.jsx)(`div`,{className:`flex justify-center`,children:(0,Y.jsx)(`img`,{src:`data:image/png;base64,${_.qr_code_b64}`,alt:`TOTP QR Code`,className:`w-48 h-48 rounded-lg`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:t(`settings.twoFa.manualEntry`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 bg-bambu-dark-secondary rounded-lg px-3 py-2`,children:[(0,Y.jsx)(`code`,{className:`text-white text-xs font-mono flex-1 break-all`,children:h?_.secret:`••••••••••••••••`}),(0,Y.jsx)(`button`,{onClick:()=>g(!h),className:`text-bambu-gray hover:text-white`,children:h?(0,Y.jsx)(F,{className:`w-4 h-4`}):(0,Y.jsx)(mt,{className:`w-4 h-4`})}),(0,Y.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(_.secret)},className:`text-bambu-gray hover:text-white`,children:(0,Y.jsx)(N,{className:`w-4 h-4`})})]})]}),(0,Y.jsx)(K,{variant:`primary`,className:`w-full`,onClick:()=>o(`confirm`),children:t(`settings.twoFa.scannedContinue`)})]}):a===`confirm`?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:t(`settings.twoFa.enterCodeToConfirm`)}),(0,Y.jsx)(la,{value:s,onChange:c,placeholder:`000000`}),(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>o(`qr`),className:`flex-1`,children:t(`common.back`)}),(0,Y.jsx)(K,{variant:`primary`,className:`flex-1`,disabled:s.length!==6||y.isPending,onClick:()=>y.mutate(s),children:y.isPending?t(`common.saving`):t(`settings.twoFa.activate`)})]})]}):(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`h3`,{className:`text-white font-medium`,children:t(`settings.twoFa.backupCodesTitle`)}),(0,Y.jsx)(ua,{codes:p,onDone:e})]})}function fa(){let{t:e}=l(),t=u(),{showToast:n}=ee(),{user:i}=un(),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(``),[T,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(``),[k,A]=(0,X.useState)(!1),{data:j,isLoading:M}=d({queryKey:[`2fa-status`],queryFn:()=>r.get2FAStatus()}),{data:N}=d({queryKey:[`oidc-links`],queryFn:()=>r.getOIDCLinks()}),P=f({mutationFn:()=>r.enableEmailOTP(),onSuccess:e=>{S(e.setup_token),n(e.message,`success`)},onError:t=>{let r=t.message??``;r.toLowerCase().includes(`smtp`)?n(e(`settings.twoFa.smtpRequired`),`error`):n(r,`error`)}}),te=f({mutationFn:()=>r.confirmEnableEmailOTP(x,C),onSuccess:()=>{t.invalidateQueries({queryKey:[`2fa-status`]}),S(null),w(``),n(e(`settings.twoFa.emailOtpEnabled`),`success`)},onError:e=>n(e.message,`error`)}),ne=f({mutationFn:e=>r.disableEmailOTP(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`2fa-status`]}),E(!1),O(``),n(e(`settings.twoFa.emailOtpDisabled`),`success`)},onError:e=>n(e.message,`error`)}),I=f({mutationFn:e=>r.disableTOTP(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`2fa-status`]}),c(!1),g(``),n(e(`settings.twoFa.totpDisabled`),`success`)},onError:()=>n(e(`settings.twoFa.invalidCode`),`error`)}),re=f({mutationFn:e=>r.regenerateBackupCodes(e),onSuccess:e=>{t.invalidateQueries({queryKey:[`2fa-status`]}),m(!1),v(``),b(e.backup_codes)},onError:()=>n(e(`settings.twoFa.invalidCode`),`error`)}),ie=f({mutationFn:e=>r.deleteOIDCLink(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-links`]}),n(e(`settings.twoFa.oidcUnlinked`),`success`)},onError:e=>n(e.message,`error`)});if(M)return(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Y.jsx)(at,{className:`w-6 h-6 animate-spin text-bambu-green`})});let L=!!i?.email;return(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsxs)(G,{id:`card-2fa-totp`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${j?.totp_enabled?`bg-green-100 dark:bg-green-500/20`:`bg-gray-500/20`}`,children:(0,Y.jsx)(Pe,{className:`w-5 h-5 ${j?.totp_enabled?`text-green-600 dark:text-green-400`:`text-gray-400`}`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.twoFa.totpTitle`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:e(`settings.twoFa.totpDesc`)})]}),(0,Y.jsx)(`div`,{className:`ml-auto`,children:j?.totp_enabled?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-green-700 dark:text-green-400 text-sm font-medium`,children:[(0,Y.jsx)(Cn,{className:`w-4 h-4`}),` `,e(`common.enabled`)]}):(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-gray text-sm`,children:[(0,Y.jsx)(wn,{className:`w-4 h-4`}),` `,e(`common.disabled`)]})})]})}),(0,Y.jsx)(W,{children:a?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,Y.jsx)(`h4`,{className:`text-white font-medium`,children:e(`settings.twoFa.setupAuthApp`)}),(0,Y.jsx)(`button`,{onClick:()=>{o(!1),t.removeQueries({queryKey:[`totp-setup`]})},className:`text-bambu-gray hover:text-white`,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsx)(da,{onDone:()=>{o(!1),t.removeQueries({queryKey:[`totp-setup`]})}})]}):s?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.disableConfirmHint`)}),(0,Y.jsx)(la,{value:h,onChange:g,placeholder:`000000 or XXXXXXXX`,maxLength:8}),(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>{c(!1),g(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,Y.jsx)(K,{variant:`danger`,className:`flex-1`,disabled:h.length<6||I.isPending,onClick:()=>I.mutate(h),children:I.isPending?e(`common.saving`):e(`settings.twoFa.disableTotp`)})]})]}):p?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.regenBackupHint`)}),(0,Y.jsx)(la,{value:_,onChange:v,placeholder:`000000 or XXXXXXXX`,maxLength:8}),(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>{m(!1),v(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,Y.jsx)(K,{variant:`primary`,className:`flex-1`,disabled:_.length<6||re.isPending,onClick:()=>re.mutate(_),children:re.isPending?e(`common.saving`):e(`settings.twoFa.regenBackup`)})]})]}):y?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`h4`,{className:`text-white font-medium`,children:e(`settings.twoFa.newBackupCodes`)}),(0,Y.jsx)(ua,{codes:y,onDone:()=>b(null)})]}):(0,Y.jsx)(`div`,{className:`space-y-3`,children:j?.totp_enabled?(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray-light`,children:[(0,Y.jsx)(Kt,{className:`w-4 h-4`}),e(`settings.twoFa.backupCodesRemaining`,{count:j.backup_codes_remaining})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>m(!0),className:`flex items-center gap-2`,children:[(0,Y.jsx)(at,{className:`w-4 h-4`}),e(`settings.twoFa.regenBackup`)]}),(0,Y.jsxs)(K,{variant:`danger`,size:`sm`,onClick:()=>c(!0),className:`flex items-center gap-2`,children:[(0,Y.jsx)(qe,{className:`w-4 h-4`}),e(`settings.twoFa.disableTotp`)]})]}):(0,Y.jsxs)(K,{variant:`primary`,onClick:()=>o(!0),className:`flex items-center gap-2`,children:[(0,Y.jsx)(Pe,{className:`w-4 h-4`}),e(`settings.twoFa.setupTotp`)]})})})]}),(0,Y.jsxs)(G,{id:`card-2fa-emailotp`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${j?.email_otp_enabled?`bg-green-100 dark:bg-green-500/20`:`bg-gray-500/20`}`,children:(0,Y.jsx)(Vt,{className:`w-5 h-5 ${j?.email_otp_enabled?`text-green-600 dark:text-green-400`:`text-gray-400`}`})}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.twoFa.emailOtpTitle`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:L?e(`settings.twoFa.emailOtpDesc`,{email:i?.email}):e(`settings.twoFa.emailOtpNoEmail`)})]}),(0,Y.jsx)(`div`,{className:`ml-auto`,children:j?.email_otp_enabled?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-green-700 dark:text-green-400 text-sm font-medium`,children:[(0,Y.jsx)(Cn,{className:`w-4 h-4`}),` `,e(`common.enabled`)]}):(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-gray text-sm`,children:[(0,Y.jsx)(wn,{className:`w-4 h-4`}),` `,e(`common.disabled`)]})})]})}),(0,Y.jsx)(W,{children:L?x?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.emailSetupEnterCode`)}),(0,Y.jsx)(la,{value:C,onChange:w,placeholder:`000000`}),(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>{S(null),w(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,Y.jsx)(K,{variant:`primary`,className:`flex-1`,disabled:C.length!==6||te.isPending,onClick:()=>te.mutate(),children:te.isPending?e(`common.saving`):e(`settings.twoFa.verifyAndEnable`)})]})]}):T?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.emailDisablePasswordHint`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`input`,{type:k?`text`:`password`,value:D,onChange:e=>O(e.target.value),placeholder:e(`settings.twoFa.passwordPlaceholder`),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>A(!k),className:`absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:k?(0,Y.jsx)(F,{className:`w-5 h-5`}):(0,Y.jsx)(mt,{className:`w-5 h-5`})})]}),(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>{E(!1),O(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,Y.jsx)(K,{variant:`danger`,className:`flex-1`,disabled:!D||ne.isPending,onClick:()=>ne.mutate(D),children:ne.isPending?e(`common.saving`):e(`settings.twoFa.disableEmailOtp`)})]})]}):(0,Y.jsx)(`div`,{className:`flex gap-3`,children:j?.email_otp_enabled?(0,Y.jsxs)(K,{variant:`danger`,size:`sm`,onClick:()=>E(!0),className:`flex items-center gap-2`,children:[(0,Y.jsx)(qe,{className:`w-4 h-4`}),e(`settings.twoFa.disableEmailOtp`)]}):(0,Y.jsxs)(K,{variant:`primary`,disabled:!L||P.isPending,onClick:()=>P.mutate(),className:`flex items-center gap-2`,children:[(0,Y.jsx)(Vt,{className:`w-4 h-4`}),P.isPending?e(`common.saving`):e(`settings.twoFa.enableEmailOtp`)]})}):(0,Y.jsx)(`p`,{className:`text-amber-700 dark:text-amber-400 text-sm`,children:e(`settings.twoFa.addEmailFirst`)})})]}),N&&N.length>0&&(0,Y.jsxs)(G,{id:`card-2fa-linked`,children:[(0,Y.jsxs)(U,{children:[(0,Y.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.twoFa.linkedAccounts`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:e(`settings.twoFa.linkedAccountsDesc`)})]}),(0,Y.jsx)(W,{children:(0,Y.jsx)(`div`,{className:`space-y-3`,children:N.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between py-2 border-b border-bambu-dark-tertiary last:border-0`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white text-sm font-medium`,children:e.provider_name}),e.provider_email&&(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:e.provider_email})]}),(0,Y.jsx)(K,{variant:`danger`,size:`sm`,onClick:()=>ie.mutate(e.provider_id),disabled:ie.isPending,children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]},e.id))})})]})]})}var pa={name:``,issuer_url:``,client_id:``,client_secret:``,scopes:`openid email profile`,is_enabled:!0,auto_create_users:!1,auto_link_existing_accounts:!1,email_claim:`email`,require_email_verified:!0,group_claim:`groups`,group_mapping:{},icon_url:void 0,default_group_id:null,is_autologin:!1};function ma({initial:e,isEdit:t=!1,groups:n=[],onSave:r,onCancel:i,isPending:a}){let{t:o}=l(),[s,c]=(0,X.useState)(e),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(()=>Object.entries(e.group_mapping??{}).map(([e,t])=>({idpGroup:e,bambuddyGroup:t}))),m=()=>p(e=>[...e,{idpGroup:``,bambuddyGroup:``}]),h=e=>p(t=>t.filter((t,n)=>n!==e)),g=(e,t)=>p(n=>n.map((n,r)=>r===e?{...n,...t}:n)),_=(e,t)=>c(n=>({...n,[e]:t})),v=`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors text-sm`,y=`block text-sm font-medium text-white mb-1`,b=()=>{let e={...s};t&&!u&&delete e.client_secret,(!e.group_claim||!e.group_claim.trim())&&(e.group_claim=`groups`);let n={};for(let e of f){let t=e.idpGroup.trim();t&&e.bambuddyGroup&&(n[t]=e.bambuddyGroup)}e.group_mapping=n,r(e)},x=new Set(n.map(e=>e.name)),S=f.map((e,t)=>{let n=e.idpGroup.trim();if(!n&&!e.bambuddyGroup)return null;if(!n||!e.bambuddyGroup)return`incomplete`;let r=n.toLowerCase();return f.slice(0,t).some(e=>e.idpGroup.trim().toLowerCase()===r)?`duplicate`:null}),C=S.some(e=>e!==null),w=s.auto_link_existing_accounts===!0,T=s.require_email_verified??!0,E;return E=w?o(`settings.oidc.form.requireEmailVerifiedAutoLink`):T?o(`settings.oidc.form.requireEmailVerifiedDesc`):(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:o(`settings.oidc.form.requireEmailVerifiedWarning`)}),(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.name`),` `,(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,Y.jsx)(`input`,{className:v,value:s.name,onChange:e=>_(`name`,e.target.value),placeholder:`Google`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.issuerUrl`),` `,(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,Y.jsx)(`input`,{className:v,value:s.issuer_url,onChange:e=>_(`issuer_url`,e.target.value),placeholder:`https://accounts.google.com`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.clientId`),` `,(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,Y.jsx)(`input`,{className:v,value:s.client_id,onChange:e=>_(`client_id`,e.target.value),placeholder:`your-client-id`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.clientSecret`),!t&&(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:` *`}),t&&(0,Y.jsxs)(`span`,{className:`text-bambu-gray text-xs ml-1`,children:[`(`,o(`settings.oidc.form.secretHint`),`)`]})]}),(0,Y.jsx)(`input`,{className:v,type:`password`,value:u?s.client_secret:``,placeholder:t&&!u?`••••••••`:o(`settings.oidc.form.secretPlaceholder`),onChange:e=>{d(!0),_(`client_secret`,e.target.value)}})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:y,children:o(`settings.oidc.form.scopes`)}),(0,Y.jsx)(`input`,{className:v,value:s.scopes,onChange:e=>_(`scopes`,e.target.value),placeholder:`openid email profile`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:y,children:o(`settings.oidc.form.iconUrl`)}),(0,Y.jsx)(`input`,{className:v,value:s.icon_url??``,onChange:e=>_(`icon_url`,e.target.value===``?null:e.target.value),placeholder:`https://...`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-6 pt-2`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(J,{checked:s.is_enabled??!0,onChange:e=>_(`is_enabled`,e)}),(0,Y.jsx)(`span`,{className:`text-white text-sm`,children:o(`settings.oidc.form.enabled`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(J,{checked:s.auto_create_users??!1,onChange:e=>_(`auto_create_users`,e)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.autoCreate`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:o(`settings.oidc.form.autoCreateDesc`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer w-full`,children:[(0,Y.jsx)(J,{checked:s.auto_link_existing_accounts??!1,onChange:e=>_(`auto_link_existing_accounts`,e)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.autoLink`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:o(`settings.oidc.form.autoLinkDesc`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer w-full`,children:[(0,Y.jsx)(J,{checked:T,onChange:e=>_(`require_email_verified`,e),disabled:w}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.requireEmailVerified`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:E})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer w-full`,children:[(0,Y.jsx)(J,{checked:s.is_autologin??!1,onChange:e=>_(`is_autologin`,e)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.autologin`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:o(`settings.oidc.form.autologinDesc`)})]})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:y,children:o(`settings.oidc.form.emailClaim`)}),(0,Y.jsx)(`input`,{className:v,value:s.email_claim,onChange:e=>_(`email_claim`,e.target.value||`email`),placeholder:o(`settings.oidc.form.emailClaimPlaceholder`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.emailClaimDesc`)}),w&&s.email_claim!==`email`&&(0,Y.jsx)(`p`,{className:`text-yellow-700 dark:text-yellow-400 text-xs mt-1`,children:o(`settings.oidc.form.emailClaimCustomClaimAutoLinkWarning`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:y,children:o(`settings.oidc.form.defaultGroup`)}),(0,Y.jsxs)(`select`,{className:v,value:s.default_group_id??``,onChange:e=>_(`default_group_id`,e.target.value?Number(e.target.value):null),children:[(0,Y.jsx)(`option`,{value:``,children:o(`settings.oidc.form.defaultGroupViewersFallback`)}),n.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.defaultGroupDesc`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:y,children:o(`settings.oidc.form.groupClaim`)}),(0,Y.jsx)(`input`,{className:v,value:s.group_claim??`groups`,onChange:e=>_(`group_claim`,e.target.value),placeholder:`groups`}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.groupClaimDesc`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:y,children:o(`settings.oidc.form.groupMapping`)}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[f.map((e,t)=>{let r=e.bambuddyGroup!==``&&!x.has(e.bambuddyGroup);return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{className:v,value:e.idpGroup,onChange:e=>g(t,{idpGroup:e.target.value}),placeholder:o(`settings.oidc.form.groupMappingIdpGroupPlaceholder`)}),(0,Y.jsx)(`span`,{className:`text-bambu-gray text-sm shrink-0`,children:`→`}),(0,Y.jsxs)(`select`,{className:`${v} ${r?`border-red-700 dark:border-red-400 text-red-700 dark:text-red-400`:``}`,value:e.bambuddyGroup,onChange:e=>g(t,{bambuddyGroup:e.target.value}),children:[(0,Y.jsx)(`option`,{value:``,children:o(`settings.oidc.form.groupMappingSelectGroup`)}),r&&(0,Y.jsx)(`option`,{value:e.bambuddyGroup,children:o(`settings.oidc.form.groupMappingDeletedGroupOption`,{group:e.bambuddyGroup})}),n.map(e=>(0,Y.jsx)(`option`,{value:e.name,children:e.name},e.id))]}),(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>h(t),title:o(`common.remove`),children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]}),r&&(0,Y.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:o(`settings.oidc.form.groupMappingDeletedGroupWarning`)}),S[t]&&(0,Y.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:S[t]===`incomplete`?o(`settings.oidc.form.groupMappingIncompleteRow`):o(`settings.oidc.form.groupMappingDuplicateRow`)})]},t)}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:m,className:`inline-flex items-center gap-2`,children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),o(`settings.oidc.form.groupMappingAddRow`)]})]}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.groupMappingDesc`)})]}),(0,Y.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:i,className:`flex-1`,children:o(`common.cancel`)}),(0,Y.jsx)(K,{variant:`primary`,className:`flex-1`,disabled:!s.name||!s.issuer_url||!s.client_id||!t&&!s.client_secret||t&&u&&!s.client_secret||C||a,onClick:b,children:o(a?`common.saving`:`common.save`)})]})]})}function ha({provider:e}){let[t,n]=(0,X.useState)(!1);return e.has_icon&&!t?(0,Y.jsx)(`img`,{src:r.oidcProviderIconUrl(e.id),alt:e.name,className:`w-8 h-8 rounded object-contain`,onError:()=>n(!0)}):(0,Y.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-bambu-dark-tertiary flex items-center justify-center`,children:(0,Y.jsx)(zt,{className:`w-4 h-4 text-bambu-gray`})})}function ga(){let{t:e}=l(),t=u(),{showToast:n}=ee(),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(null),[c,p]=(0,X.useState)(null),{data:m,isLoading:h}=d({queryKey:[`oidc-providers-all`],queryFn:()=>r.getOIDCProvidersAll()}),{data:g=[]}=d({queryKey:[`groups`],queryFn:()=>r.getGroups()}),_=f({mutationFn:e=>r.createOIDCProvider(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),a(!1),n(e(`settings.oidc.created`),`success`)},onError:e=>n(e.message,`error`)}),v=f({mutationFn:({id:e,data:t})=>r.updateOIDCProvider(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),s(null),n(e(`settings.oidc.updated`),`success`)},onError:e=>n(e.message,`error`)}),y=f({mutationFn:e=>r.deleteOIDCProvider(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),p(null),n(e(`settings.oidc.deleted`),`success`)},onError:e=>n(e.message,`error`)}),b=f({mutationFn:e=>r.refreshOIDCProviderIcon(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),t.invalidateQueries({queryKey:[`oidc-providers`]}),n(e(`settings.oidc.iconRefreshed`),`success`)},onError:t=>n(t.message||e(`settings.oidc.iconFetchFailed`),`error`)}),x=f({mutationFn:e=>r.deleteOIDCProviderIcon(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),t.invalidateQueries({queryKey:[`oidc-providers`]}),n(e(`settings.oidc.iconRemoved`),`success`)},onError:e=>n(e.message,`error`)}),S=e=>v.mutate({id:e.id,data:{is_enabled:!e.is_enabled}});return h?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Y.jsx)(at,{className:`w-6 h-6 animate-spin text-bambu-green`})}):(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsxs)(G,{id:`card-oidc`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.oidc.title`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:e(`settings.oidc.desc`)})]}),!i&&(0,Y.jsxs)(K,{variant:`primary`,size:`sm`,onClick:()=>a(!0),className:`flex items-center gap-2`,children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),e(`settings.oidc.addProvider`)]})]})}),i&&(0,Y.jsx)(W,{children:(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:[(0,Y.jsx)(`h4`,{className:`text-white font-medium mb-4`,children:e(`settings.oidc.newProvider`)}),(0,Y.jsx)(ma,{initial:pa,groups:g,onSave:e=>_.mutate(e),onCancel:()=>a(!1),isPending:_.isPending})]})})]}),m&&m.length===0&&!i&&(0,Y.jsx)(G,{id:`card-oidc-empty`,children:(0,Y.jsx)(W,{children:(0,Y.jsxs)(`div`,{className:`text-center py-8 space-y-3`,children:[(0,Y.jsx)(zt,{className:`w-12 h-12 text-bambu-gray mx-auto`}),(0,Y.jsx)(`p`,{className:`text-bambu-gray`,children:e(`settings.oidc.empty`)}),(0,Y.jsxs)(K,{variant:`primary`,size:`sm`,onClick:()=>a(!0),className:`inline-flex items-center gap-2`,children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),e(`settings.oidc.addProvider`)]})]})})}),m?.map(t=>(0,Y.jsxs)(G,{children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(ha,{provider:t}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`h4`,{className:`text-white font-medium`,children:t.name}),t.is_enabled?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-green-700 dark:text-green-400 bg-green-50 dark:bg-green-400/10 px-2 py-0.5 rounded-full`,children:[(0,Y.jsx)(T,{className:`w-3 h-3`}),` `,e(`common.enabled`)]}):(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-bambu-gray bg-bambu-dark-tertiary px-2 py-0.5 rounded-full`,children:[(0,Y.jsx)(Re,{className:`w-3 h-3`}),` `,e(`common.disabled`)]}),t.is_env_managed&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-bambu-green`,children:[(0,Y.jsx)(z,{className:`w-3 h-3`}),` `,e(`settings.environmentManagedLabel`)]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 text-bambu-gray text-xs mt-0.5`,children:[(0,Y.jsx)(Je,{className:`w-3 h-3`}),(0,Y.jsx)(`span`,{children:t.issuer_url})]})]}),(0,Y.jsx)(`div`,{className:`flex items-center gap-2`,children:!t.is_env_managed&&(0,Y.jsxs)(Y.Fragment,{children:[t.icon_url&&(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>b.mutate(t.id),disabled:b.isPending,title:e(`settings.oidc.refreshIcon`),"data-testid":`refresh-icon-${t.id}`,children:(0,Y.jsx)(at,{className:`w-4 h-4 ${b.isPending?`animate-spin`:``}`})}),t.has_icon&&(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>x.mutate(t.id),disabled:x.isPending,title:e(`settings.oidc.removeIcon`),"data-testid":`remove-icon-${t.id}`,children:(0,Y.jsx)(Mt,{className:`w-4 h-4`})}),(0,Y.jsx)(J,{checked:t.is_enabled,onChange:()=>S(t),disabled:v.isPending}),(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>s(o===t.id?null:t.id),"data-testid":`edit-provider-${t.id}`,children:(0,Y.jsx)(oe,{className:`w-4 h-4`})}),(0,Y.jsx)(K,{variant:`danger`,size:`sm`,onClick:()=>p(t),"data-testid":`delete-provider-${t.id}`,children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]})})]})}),o===t.id&&(0,Y.jsx)(W,{children:(0,Y.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:(0,Y.jsx)(ma,{isEdit:!0,groups:g,initial:{name:t.name,issuer_url:t.issuer_url,client_id:t.client_id,client_secret:``,scopes:t.scopes,is_enabled:t.is_enabled,auto_create_users:t.auto_create_users,auto_link_existing_accounts:t.auto_link_existing_accounts,email_claim:t.email_claim,require_email_verified:t.require_email_verified,group_claim:t.group_claim??`groups`,group_mapping:t.group_mapping??{},icon_url:t.icon_url??void 0,default_group_id:t.default_group_id??null,is_autologin:t.is_autologin},onSave:e=>v.mutate({id:t.id,data:e}),onCancel:()=>s(null),isPending:v.isPending})})}),o!==t.id&&(0,Y.jsx)(W,{children:(0,Y.jsxs)(`dl`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-x-6 gap-y-2 text-sm`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.clientId`)}),(0,Y.jsx)(`dd`,{className:`text-white font-mono truncate`,children:t.client_id})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.scopes`)}),(0,Y.jsx)(`dd`,{className:`text-white`,children:t.scopes})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.autoCreate`)}),(0,Y.jsx)(`dd`,{className:t.auto_create_users?`text-green-700 dark:text-green-400`:`text-bambu-gray`,children:t.auto_create_users?e(`common.yes`):e(`common.no`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.autoLink`)}),(0,Y.jsx)(`dd`,{className:t.auto_link_existing_accounts?`text-green-700 dark:text-green-400`:`text-bambu-gray`,children:t.auto_link_existing_accounts?e(`common.yes`):e(`common.no`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.emailClaim`)}),(0,Y.jsx)(`dd`,{className:`text-white font-mono`,children:t.email_claim})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.groupClaim`)}),(0,Y.jsx)(`dd`,{className:`text-white font-mono`,children:t.group_claim??`groups`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.requireEmailVerified`)}),(0,Y.jsx)(`dd`,{className:t.require_email_verified?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`,children:t.require_email_verified?e(`common.yes`):e(`common.no`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.defaultGroup`)}),(0,Y.jsx)(`dd`,{className:`text-white`,children:t.default_group_id?g.find(e=>e.id===t.default_group_id)?.name??e(`settings.oidc.form.defaultGroupViewersFallback`):e(`settings.oidc.form.defaultGroupViewersFallback`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.groupSync`)}),(0,Y.jsx)(`dd`,{className:t.group_mapping&&Object.keys(t.group_mapping).length>0?`text-green-700 dark:text-green-400`:`text-bambu-gray`,children:t.group_mapping&&Object.keys(t.group_mapping).length>0?e(`settings.oidc.form.groupSyncOn`):e(`common.off`)})]})]})})]},t.id)),c&&(0,Y.jsx)(Tt,{title:e(`settings.oidc.deleteTitle`),message:e(`settings.oidc.deleteMessage`,{name:c.name}),confirmText:e(`common.delete`),variant:`danger`,onConfirm:()=>y.mutate(c.id),onCancel:()=>p(null)})]})}var _a=new Map;function Q(e){_a.set(e.anchor,e)}function va(){return Array.from(_a.values())}Q({labelKey:`settings.encryption.title`,labelFallback:`MFA Encryption Status`,tab:`users`,subTab:`security`,keywords:`mfa encryption status security backup totp oidc fernet`,anchor:`card-mfa-encryption`});function ya(){let{t:e}=l(),{data:t,isLoading:n,isError:i,refetch:a}=d({queryKey:[`encryptionStatus`],queryFn:()=>r.getEncryptionStatus(),refetchInterval:e=>{if(!e.state.error)return 3e4;let t=e.state.fetchFailureCount??0;return t<=3?Math.min(5e3*Math.max(1,t),3e4):!1}});if(n)return(0,Y.jsxs)(G,{id:`card-mfa-encryption`,"data-testid":`encryption-status-card`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Me,{className:`text-bambu-gray`,size:20}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`settings.encryption.title`)})]})}),(0,Y.jsx)(W,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,"data-testid":`encryption-loading`,children:[(0,Y.jsx)(R,{className:`animate-spin`,size:16}),(0,Y.jsx)(`span`,{children:e(`common.loading`)})]})})]});if(i||!t)return(0,Y.jsxs)(G,{id:`card-mfa-encryption`,"data-testid":`encryption-status-card`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Me,{className:`text-bambu-gray`,size:20}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`settings.encryption.title`)})]})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(`div`,{className:`text-red-700 dark:text-red-400`,"data-testid":`encryption-error`,children:e(`common.errorLoading`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>a(),className:`mt-2 text-sm text-blue-700 dark:text-blue-400 underline hover:text-blue-800 dark:hover:text-blue-300`,"data-testid":`encryption-retry-button`,children:e(`common.retry`)})]})]});let o=t.legacy_plaintext_rows.oidc_providers+t.legacy_plaintext_rows.user_totp,s=t.encrypted_rows.oidc_providers+t.encrypted_rows.user_totp,c,u,f,p;t.decryption_broken?(c=`bg-red-100 dark:bg-red-500/20 border-red-400 dark:border-red-500/50 text-red-700 dark:text-red-400`,u=(0,Y.jsx)(O,{className:`text-red-600 dark:text-red-400`,size:20}),f=e(`settings.encryption.decryptionBrokenTitle`),p=e(`settings.encryption.decryptionBrokenError`,{count:s})):t.key_source===`generated`?(c=`bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,u=(0,Y.jsx)(Cn,{className:`text-amber-600 dark:text-amber-400`,size:20}),f=e(`settings.encryption.enabledGenerated`),p=e(`settings.encryption.backupHint`)):o>0?(c=`bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,u=(0,Y.jsx)(Ie,{className:`text-amber-600 dark:text-amber-400`,size:20}),f=t.key_source===`env`?e(`settings.encryption.enabledFromEnv`):e(`settings.encryption.enabledFromFile`),p=e(`settings.encryption.legacyRowsWarning`,{count:o})):t.key_configured?(c=`bg-green-100 dark:bg-green-500/20 border-green-300 dark:border-green-500/30 text-green-700 dark:text-green-400`,u=(0,Y.jsx)(Cn,{className:`text-green-600 dark:text-green-400`,size:20}),f=t.key_source===`env`?e(`settings.encryption.enabledFromEnv`):e(`settings.encryption.enabledFromFile`),p=e(`settings.encryption.allEncrypted`)):(c=`bg-gray-500/20 border-gray-500/30 text-gray-400`,u=(0,Y.jsx)(wn,{className:`text-gray-400`,size:20}),f=e(`settings.encryption.notConfigured`),p=e(`settings.encryption.notConfiguredDesc`));let m=t.key_source===`generated`&&o>0;return(0,Y.jsxs)(G,{id:`card-mfa-encryption`,"data-testid":`encryption-status-card`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u,(0,Y.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`settings.encryption.title`)})]})}),(0,Y.jsxs)(W,{children:[(0,Y.jsxs)(`div`,{className:`p-3 border rounded-lg ${c}`,"data-testid":`encryption-status`,children:[(0,Y.jsx)(`p`,{className:`font-medium mb-1`,children:f}),(0,Y.jsx)(`p`,{className:`text-sm`,children:p})]}),m&&(0,Y.jsx)(`div`,{className:`mt-2 p-3 border rounded-lg bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,"data-testid":`encryption-legacy-warning`,children:(0,Y.jsx)(`p`,{className:`text-sm`,children:e(`settings.encryption.legacyRowsWarning`,{count:o})})}),t.migration_error_count>0&&(0,Y.jsx)(`div`,{className:`mt-2 p-3 border rounded-lg bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,"data-testid":`encryption-migration-warning`,children:(0,Y.jsx)(`p`,{className:`text-sm`,children:e(`settings.encryption.migrationErrorWarning`,{count:t.migration_error_count})})}),(0,Y.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 text-sm`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray`,children:e(`settings.encryption.encryptedRowsLabel`)}),(0,Y.jsxs)(`p`,{className:`font-medium`,children:[`OIDC: `,t.encrypted_rows.oidc_providers,` · TOTP: `,t.encrypted_rows.user_totp]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray`,children:e(`settings.encryption.legacyRowsLabel`)}),(0,Y.jsxs)(`p`,{className:`font-medium`,children:[`OIDC: `,t.legacy_plaintext_rows.oidc_providers,` · TOTP: `,t.legacy_plaintext_rows.user_totp]})]})]})]})]})}var ba={get:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 border-blue-300 dark:border-blue-500/30`,post:`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 border-green-300 dark:border-green-500/30`,put:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 border-yellow-300 dark:border-yellow-500/30`,patch:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400 border-orange-300 dark:border-orange-500/30`,delete:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 border-red-300 dark:border-red-500/30`};function xa(e,t){let n=t.replace(`#/`,``).split(`/`),r=e;for(let e of n)r=r[e];return r}function Sa(e,t,n=0){if(n>5)return`...`;if(t.$ref)return Sa(e,xa(e,t.$ref),n+1);if(t.allOf){let r={};for(let i of t.allOf){let t=Sa(e,i,n+1);typeof t==`object`&&t&&Object.assign(r,t)}return r}if(t.example!==void 0)return t.example;if(t.default!==void 0)return t.default;switch(t.type){case`string`:return t.enum?t.enum[0]:`string`;case`integer`:case`number`:return 0;case`boolean`:return!1;case`array`:return t.items?[Sa(e,t.items,n+1)]:[];case`object`:if(t.properties){let r={};for(let[i,a]of Object.entries(t.properties))r[i]=Sa(e,a,n+1);return r}return{};default:return null}}function Ca({path:e,method:t,spec:n,schema:r,apiKey:i}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)({}),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(a&&n.parameters){let e={};for(let t of n.parameters)t.schema?.default!==void 0&&(e[t.name]=String(t.schema.default));c(t=>({...e,...t}))}},[a,n.parameters]),(0,X.useEffect)(()=>{if(a&&n.requestBody?.content?.[`application/json`]?.schema&&!l){let e=n.requestBody.content[`application/json`].schema,t=Sa(r,e);u(JSON.stringify(t,null,2))}},[a,n.requestBody,r,l]);let _=(()=>{let e=[];for(let t of n.parameters||[])if(t.in===`path`||t.required){let n=s[t.name];(n===void 0||n===``)&&e.push(t.name)}return e})(),v=async()=>{if(_.length>0){f({status:0,statusText:`Validation Error`,headers:{},body:`Missing required parameters: ${_.join(`, `)}`,duration:0});return}m(!0),f(null);try{let r=e,a=new URLSearchParams;for(let e of n.parameters||[]){let t=s[e.name];t!==void 0&&t!==``&&(e.in===`path`?r=r.replace(`{${e.name}}`,encodeURIComponent(t)):e.in===`query`&&a.append(e.name,t))}let o=a.toString(),c=`${r}${o?`?${o}`:``}`,u={"Content-Type":`application/json`};i&&(u[`X-API-Key`]=i);let d={method:t.toUpperCase(),headers:u};[`post`,`put`,`patch`].includes(t)&&l&&(d.body=l);let p=performance.now(),m=await fetch(c,d),h=Math.round(performance.now()-p),g={};m.headers.forEach((e,t)=>{g[t]=e});let _;_=m.headers.get(`content-type`)?.includes(`application/json`)?await m.json():await m.text(),f({status:m.status,statusText:m.statusText,headers:g,body:_,duration:h})}catch(e){f({status:0,statusText:`Network Error`,headers:{},body:e instanceof Error?e.message:`Unknown error`,duration:0})}finally{m(!1)}},y=async()=>{if(d){let e=typeof d.body==`string`?d.body:JSON.stringify(d.body,null,2);try{await navigator.clipboard.writeText(e),g(!0),setTimeout(()=>g(!1),2e3)}catch{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-999999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),g(!0),setTimeout(()=>g(!1),2e3)}}},b=(n.parameters||[]).filter(e=>e.in===`path`),x=(n.parameters||[]).filter(e=>e.in===`query`),S=[`post`,`put`,`patch`].includes(t)&&n.requestBody;return(0,Y.jsxs)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,Y.jsxs)(`button`,{onClick:()=>o(!a),className:`w-full flex items-center gap-3 p-3 hover:bg-bambu-dark-tertiary/50 transition-colors text-left`,children:[a?(0,Y.jsx)(E,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}):(0,Y.jsx)(st,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,Y.jsx)(`span`,{className:`px-2 py-0.5 text-xs font-mono font-semibold uppercase rounded border ${ba[t]||`bg-gray-500/20 text-gray-400`}`,children:t}),(0,Y.jsx)(`code`,{className:`text-sm text-white font-mono flex-1 truncate`,children:e}),n.summary&&(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray truncate max-w-[40%]`,children:n.summary})]}),a&&(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary p-4 space-y-4 bg-bambu-dark/50`,children:[n.description&&(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n.description}),b.length>0&&(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:`Path Parameters`}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:b.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`text-sm text-bambu-gray w-32 flex-shrink-0`,children:[e.name,e.required&&(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400 ml-1`,children:`*`})]}),(0,Y.jsx)(`input`,{type:`text`,value:s[e.name]||``,onChange:t=>c(n=>({...n,[e.name]:t.target.value})),placeholder:e.description||e.schema?.type||`value`,className:`flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm font-mono focus:border-bambu-green focus:outline-none`})]},e.name))})]}),x.length>0&&(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:`Query Parameters`}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:x.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`text-sm text-bambu-gray w-32 flex-shrink-0`,children:[e.name,e.required&&(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400 ml-1`,children:`*`})]}),e.schema?.enum?(0,Y.jsxs)(`select`,{value:s[e.name]||``,onChange:t=>c(n=>({...n,[e.name]:t.target.value})),className:`flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:``,children:`-- Select --`}),e.schema.enum.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]}):(0,Y.jsx)(`input`,{type:`text`,value:s[e.name]||``,onChange:t=>c(n=>({...n,[e.name]:t.target.value})),placeholder:e.description||e.schema?.type||`value`,className:`flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm font-mono focus:border-bambu-green focus:outline-none`})]},e.name))})]}),S&&(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:`Request Body`}),(0,Y.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),rows:8,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono focus:border-bambu-green focus:outline-none resize-y`,placeholder:`JSON request body...`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(K,{onClick:v,disabled:p,children:[p?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(De,{className:`w-4 h-4`}),`Execute`]}),_.length>0&&(0,Y.jsxs)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400 flex items-center gap-1`,children:[(0,Y.jsx)(k,{className:`w-3 h-3`}),`Fill in: `,_.join(`, `)]})]}),d&&(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`h4`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[`Response`,(0,Y.jsxs)(`span`,{className:`px-2 py-0.5 text-xs rounded ${d.status>=200&&d.status<300?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`:d.status>=400?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`}`,children:[d.status,` `,d.statusText]}),(0,Y.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[d.duration,`ms`]})]}),(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:y,children:h?(0,Y.jsx)(j,{className:`w-3 h-3 text-green-600 dark:text-green-400`}):(0,Y.jsx)(N,{className:`w-3 h-3`})})]}),(0,Y.jsx)(`pre`,{className:`p-3 bg-bambu-dark rounded-lg text-sm font-mono text-white overflow-auto max-h-96 border border-bambu-dark-tertiary`,children:typeof d.body==`string`?d.body:JSON.stringify(d.body,null,2)})]})]})]})}function wa({apiKey:e=``}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(!0),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(new Set),[l,u]=(0,X.useState)(``);if((0,X.useEffect)(()=>{async function e(){try{let e=await fetch(`/openapi.json`);if(!e.ok)throw Error(`Failed to fetch OpenAPI schema`);n(await e.json())}catch(e){o(e instanceof Error?e.message:`Unknown error`)}finally{i(!1)}}e()},[]),r)return(0,Y.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,Y.jsx)(R,{className:`w-8 h-8 text-bambu-green animate-spin`})});if(a||!t)return(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-8`,children:(0,Y.jsxs)(`div`,{className:`text-center text-red-700 dark:text-red-400`,children:[(0,Y.jsx)(k,{className:`w-12 h-12 mx-auto mb-3 opacity-50`}),(0,Y.jsx)(`p`,{children:`Failed to load API schema`}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:a})]})})});let d={};for(let[e,n]of Object.entries(t.paths))for(let[t,r]of Object.entries(n)){if(t===`parameters`)continue;let n=r.tags||[`Other`];for(let i of n)d[i]||(d[i]=[]),d[i].push({path:e,method:t,spec:r})}let f=Object.entries(d).map(([e,t])=>l?{tag:e,endpoints:t.filter(({path:e,method:t,spec:n})=>{let r=l.toLowerCase();return e.toLowerCase().includes(r)||t.toLowerCase().includes(r)||(n.summary?.toLowerCase()||``).includes(r)||(n.description?.toLowerCase()||``).includes(r)})}:{tag:e,endpoints:t}).filter(({endpoints:e})=>e.length>0).sort((e,t)=>e.tag.localeCompare(t.tag)),p=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsx)(`div`,{className:`flex-1`,children:(0,Y.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:`Search endpoints...`,className:`w-full max-w-md px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>{c(new Set(f.map(e=>e.tag)))},children:`Expand All`}),(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>{c(new Set)},children:`Collapse All`}),(0,Y.jsxs)(`a`,{href:`/docs`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-sm text-bambu-green hover:underline`,children:[(0,Y.jsx)(Je,{className:`w-4 h-4`}),`Swagger UI`]})]})]}),(0,Y.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[f.reduce((e,t)=>e+t.endpoints.length,0),` endpoints in `,f.length,` categories`]}),(0,Y.jsx)(`div`,{className:`space-y-3`,children:f.map(({tag:n,endpoints:r})=>(0,Y.jsxs)(G,{children:[(0,Y.jsx)(`button`,{onClick:()=>p(n),className:`w-full flex items-center justify-between p-4 hover:bg-bambu-dark-tertiary/30 transition-colors text-left`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.has(n)?(0,Y.jsx)(E,{className:`w-5 h-5 text-bambu-gray`}):(0,Y.jsx)(st,{className:`w-5 h-5 text-bambu-gray`}),(0,Y.jsx)(`h3`,{className:`text-base font-semibold text-white capitalize`,children:n.replace(/-/g,` `)}),(0,Y.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-2 py-0.5 rounded-full text-bambu-gray`,children:r.length})]})}),s.has(n)&&(0,Y.jsx)(W,{className:`pt-0 space-y-2`,children:r.map(({path:n,method:r,spec:i})=>(0,Y.jsx)(Ca,{path:n,method:r,spec:i,schema:t,apiKey:e},`${r}-${n}`))})]},n))})]})}var Ta=[{id:`sidecar`,labelKey:`settings.sliceEngineSidecar`,descriptionKey:`settings.sliceEngineSidecarHint`,available:!0},{id:`browser`,labelKey:`settings.sliceEngineBrowser`,descriptionKey:`settings.sliceEngineBrowserHint`,available:!1}];function Ea(){return Ta.filter(e=>e.available)}function Da(){return Ea().length>1}function Oa(e){return Ea().find(t=>t.id===e)?.id??`sidecar`}function ka({printers:e,onPick:t,label:n,disabled:r}){let{t:i}=l(),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),u=(0,X.useRef)(null);(0,X.useEffect)(()=>{if(!a)return;let e=e=>{u.current&&!u.current.contains(e.target)&&o(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[a]);let d=s.trim().toLowerCase(),f=e.filter(e=>!d||e.name.toLowerCase().includes(d)||(e.location??``).toLowerCase().includes(d)),p=()=>{o(!1),c(``)};return(0,Y.jsxs)(`div`,{ref:u,className:`relative inline-block`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>a?p():o(!0),disabled:r||e.length===0,"aria-expanded":a,className:`inline-flex items-center gap-1 px-2 py-1 rounded border border-dashed border-bambu-dark-tertiary text-xs text-bambu-gray hover:text-white hover:border-bambu-green disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,Y.jsx)(wt,{className:`w-3.5 h-3.5`}),n]}),a&&(0,Y.jsxs)(`div`,{className:`absolute left-0 z-20 mt-1 w-64 max-w-[calc(100vw-2rem)] rounded-lg border border-bambu-dark-tertiary bg-bambu-dark-secondary shadow-lg`,onKeyDown:e=>{e.key===`Escape`&&p()},children:[(0,Y.jsxs)(`div`,{className:`relative p-2 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsx)(Ae,{className:`w-3.5 h-3.5 text-bambu-gray absolute left-4 top-1/2 -translate-y-1/2`}),(0,Y.jsx)(`input`,{type:`search`,autoFocus:!0,value:s,onChange:e=>c(e.target.value),placeholder:i(`settings.printerPickerSearch`),"aria-label":i(`settings.printerPickerSearch`),className:`w-full pl-7 pr-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`ul`,{className:`max-h-60 overflow-y-auto py-1`,role:`listbox`,"aria-label":n,children:[f.length===0&&(0,Y.jsx)(`li`,{className:`px-3 py-2 text-xs text-bambu-gray italic`,children:i(`settings.printerPickerNoMatch`)}),f.map(e=>(0,Y.jsx)(`li`,{role:`option`,"aria-selected":!1,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{t(e),p()},className:`w-full text-left px-3 py-1.5 text-sm text-white hover:bg-bambu-dark-tertiary`,children:[(0,Y.jsx)(`span`,{className:`block truncate`,children:e.name}),e.location&&(0,Y.jsx)(`span`,{className:`block truncate text-[11px] text-bambu-gray`,children:e.location})]})},e.id))]})]})]})}var Aa=[`general`,`plugs`,`sensors`,`notifications`,`queue`,`filament`,`camera`,`network`,`apikeys`,`virtual-printer`,`spoolbuddy`,`failure-detection`,`users`,`backup`];Q({labelKey:`settings.general`,tab:`general`,keywords:`language date time format printer model printers cards`,anchor:`card-general`}),Q({labelKey:`settings.appearance`,tab:`general`,keywords:`theme dark light mode colors`,anchor:`card-appearance`}),Q({labelKey:`settings.archiveSettings`,tab:`general`,keywords:`archive auto save thumbnails captures`,anchor:`card-archive`}),Q({labelKey:`settings.camera`,tab:`camera`,keywords:`camera external video stream rtsp mjpeg usb snapshot rotation chamber light led lamp`,anchor:`card-camera`}),Q({labelKey:`settings.costTracking`,tab:`general`,keywords:`currency filament cost energy kwh price`,anchor:`card-cost`}),Q({labelKey:`settings.fileManager`,tab:`general`,keywords:`file manager archive mode disk warning storage`,anchor:`card-filemanager`}),Q({labelKey:`settings.updates`,tab:`general`,keywords:`updates version firmware beta check`,anchor:`card-updates`}),Q({labelKey:`settings.dataManagement`,tab:`general`,keywords:`data reset clear logs notifications preferences`,anchor:`card-data`}),Q({labelKey:`settings.smartPlugs`,tab:`plugs`,keywords:`smart plug energy power automation tapo kasa tplink shelly`,anchor:`card-plugs`}),Q({labelKey:`haSensors.sectionTitle`,tab:`sensors`,keywords:`home assistant sensor printer temperature humidity alert notify block print`,anchor:`card-ha-sensors`}),Q({labelKey:`locationHaSensors.sectionTitle`,tab:`sensors`,keywords:`home assistant sensor location storage box temperature humidity battery alert notify`,anchor:`card-location-sensors`}),Q({labelKey:`settings.providers`,tab:`notifications`,keywords:`telegram discord email notification providers webhook`,anchor:`card-providers`}),Q({labelKey:`settings.messageTemplates`,tab:`notifications`,keywords:`message templates notification text edit`,anchor:`card-templates`}),Q({labelKey:`settings.defaultPrintOptions`,labelFallback:`Default Print Options`,tab:`queue`,keywords:`print bed leveling flow calibration vibration first layer timelapse`,anchor:`card-print-options`}),Q({labelKey:`settings.tempFanPresetsTitle`,labelFallback:`Temperature & Fan Presets`,tab:`queue`,keywords:`temperature fan presets nozzle bed chamber quick buttons popover`,anchor:`card-temp-fan-presets`}),Q({labelKey:`settings.staggeredStart`,labelFallback:`Staggered Start`,tab:`queue`,keywords:`staggered batch delay start queue group`,anchor:`card-staggered`}),Q({labelKey:`settings.plateClear`,labelFallback:`Plate-Clear Confirmation`,tab:`queue`,keywords:`plate clear confirm auto queue`,anchor:`card-plate`}),Q({labelKey:`settings.concurrentUploadsTitle`,labelFallback:`Concurrent Uploads`,tab:`queue`,keywords:`concurrent parallel upload transfer ftp queue slow farm simultaneous`,anchor:`card-concurrent-uploads`}),Q({labelKey:`settings.gcodeInjection`,labelFallback:`G-code Injection`,tab:`queue`,keywords:`gcode injection start end autoprint farmloop swapmod autoclear printflow`,anchor:`card-gcode`}),Q({labelKey:`settings.slicerCard`,labelFallback:`Slicer`,tab:`queue`,keywords:`slicer orcaslicer bambustudio orca bambu api sidecar url docker preferred`,anchor:`card-slicer`}),Q({labelKey:`settings.queueDrying`,tab:`queue`,keywords:`drying presets temperature time humidity ams`,anchor:`card-drying`}),Q({labelKey:`settings.filamentChecks`,tab:`filament`,keywords:`filament check warning runout remaining`,anchor:`card-filamentchecks`}),Q({labelKey:`settings.printModal`,tab:`filament`,keywords:`print modal custom mapping`,anchor:`card-printmodal`}),Q({labelKey:`settings.amsDisplayThresholds`,tab:`filament`,keywords:`ams humidity temperature threshold history retention`,anchor:`card-amsthresholds`}),Q({labelKey:`settings.externalUrl`,tab:`network`,keywords:`external url reverse proxy public notification link`,anchor:`card-externalurl`}),Q({labelKey:`settings.ftpRetry`,tab:`network`,keywords:`ftp retry upload retries backoff`,anchor:`card-ftpretry`}),Q({labelKey:`settings.homeAssistant`,tab:`network`,keywords:`home assistant ha hass mqtt integration`,anchor:`card-ha`}),Q({labelKey:`settings.mqttPublishing`,tab:`network`,keywords:`mqtt publish broker topic`,anchor:`card-mqtt`}),Q({labelKey:`settings.prometheusMetrics`,tab:`network`,keywords:`prometheus metrics grafana monitoring bearer token`,anchor:`card-prometheus`}),Q({labelKey:`settings.createNewApiKey`,tab:`apikeys`,keywords:`api key create permission scope`,anchor:`card-createapi`}),Q({labelKey:`settings.webhookEndpoints`,tab:`apikeys`,keywords:`webhook endpoint post http`,anchor:`card-webhooks`}),Q({labelKey:`settings.apiBrowser`,tab:`apikeys`,keywords:`api browser endpoint documentation test`,anchor:`card-apibrowser`}),Q({labelKey:`connectedApps.title`,tab:`apikeys`,keywords:`connected app sign in single sign-on sso oauth login orders`,anchor:`card-connected-apps`}),Q({labelKey:`cameraTokens.title`,tab:`camera`,keywords:`camera token long-lived home assistant frigate kiosk stream cam wall`,anchor:`card-camera-tokens`}),Q({labelKey:`streamOverlay.builder.title`,labelFallback:`Streaming Overlay`,tab:`camera`,keywords:`streaming overlay obs browser source stream url token`,anchor:`card-stream-overlay`}),Q({labelKey:`settings.tabs.virtualPrinter`,tab:`virtual-printer`,keywords:`virtual printer proxy archive slicer bambustudio orcaslicer ip bind`,anchor:`card-vp`}),Q({labelKey:`settings.tabs.spoolbuddy`,tab:`spoolbuddy`,keywords:`spoolbuddy device scale nfc rfid kiosk unregister`,anchor:`card-spoolbuddy`}),Q({labelKey:`settings.currentUser`,tab:`users`,subTab:`users`,keywords:`current user profile password change`,anchor:`card-currentuser`}),Q({labelKey:`settings.users`,tab:`users`,subTab:`users`,keywords:`users accounts list`,anchor:`card-users`}),Q({labelKey:`settings.groups`,tab:`users`,subTab:`users`,keywords:`groups roles permissions administrators operators viewers`,anchor:`card-groups`}),Q({labelKey:`printerAccess.tab`,tab:`users`,subTab:`printer-access`,keywords:`printer access groups teams locations limit restrict scope who can see`,anchor:`card-printer-access`}),Q({labelKey:`settings.sessionPolicy.title`,labelFallback:`Session Policy`,tab:`users`,subTab:`users`,keywords:`session timeout expiry logout remember me jwt token lifetime`,anchor:`card-session-policy`}),Q({labelKey:`settings.email.smtpSettings`,labelFallback:`SMTP Configuration`,tab:`users`,subTab:`email`,keywords:`smtp email send server port password auth starttls ssl`,anchor:`card-smtp`}),Q({labelKey:`settings.ldap.title`,labelFallback:`LDAP Authentication`,tab:`users`,subTab:`ldap`,keywords:`ldap active directory ad authentication bind dn search base group mapping`,anchor:`card-ldap`}),Q({labelKey:`settings.tabs.backup`,tab:`backup`,keywords:`backup github restore download cloud sync profiles archives`,anchor:`card-backup`}),Q({labelKey:`externalLinks.sidebarLayout`,labelFallback:`Sidebar`,tab:`general`,keywords:`sidebar layout links pages hide show external custom navigation url add`,anchor:`card-sidebar-links`}),Q({labelKey:`settings.filamentTracking`,tab:`filament`,keywords:`spoolman filament tracking inventory sync remote integration`,anchor:`card-spoolman`}),Q({labelKey:`settings.catalog.spoolCatalog`,labelFallback:`Spool Catalog`,tab:`filament`,keywords:`spool catalog entries brand material reset import export`,anchor:`card-spool-catalog`}),Q({labelKey:`settings.colorCatalog.title`,labelFallback:`Color Catalog`,tab:`filament`,keywords:`color catalog hex swatch palette sync reset`,anchor:`card-color-catalog`}),Q({labelKey:`settings.tabs.failureDetection`,labelFallback:`Failure Detection`,tab:`failure-detection`,keywords:`failure detection ai ml obico spaghetti detect monitoring`,anchor:`card-fd-ml`}),Q({labelKey:`failureDetection.perPrinterTitle`,labelFallback:`Per-Printer Settings`,tab:`failure-detection`,keywords:`failure detection per printer enable per-printer sensitivity`,anchor:`card-fd-perprinter`}),Q({labelKey:`failureDetection.statusTitle`,labelFallback:`Detection Status`,tab:`failure-detection`,keywords:`failure detection status running connection`,anchor:`card-fd-status`}),Q({labelKey:`failureDetection.historyTitle`,labelFallback:`Detection History`,tab:`failure-detection`,keywords:`failure detection history log events`,anchor:`card-fd-history`}),Q({labelKey:`settings.email.advancedAuth`,labelFallback:`Advanced Email Authentication`,tab:`users`,subTab:`email`,keywords:`email authentication advanced password reset self-service forgot`,anchor:`card-email-advanced-auth`}),Q({labelKey:`settings.email.testConnection`,labelFallback:`Test SMTP Connection`,tab:`users`,subTab:`email`,keywords:`email smtp test connection send check`,anchor:`card-email-test`}),Q({labelKey:`settings.twoFa.totpTitle`,labelFallback:`Authenticator App (TOTP)`,tab:`users`,subTab:`twofa`,keywords:`two factor 2fa totp authenticator app google authy otp`,anchor:`card-2fa-totp`}),Q({labelKey:`settings.twoFa.emailOtpTitle`,labelFallback:`Email One-Time Codes`,tab:`users`,subTab:`twofa`,keywords:`two factor 2fa email otp one time code`,anchor:`card-2fa-emailotp`}),Q({labelKey:`settings.twoFa.linkedAccounts`,labelFallback:`Linked Accounts`,tab:`users`,subTab:`twofa`,keywords:`two factor 2fa linked accounts sso oidc provider google github`,anchor:`card-2fa-linked`}),Q({labelKey:`settings.oidc.title`,labelFallback:`Single Sign-On (OIDC)`,tab:`users`,subTab:`oidc`,keywords:`sso oidc openid single sign-on pocketid authentik keycloak google okta azure provider`,anchor:`card-oidc`}),Q({labelKey:`settings.ldap.serverConfig`,labelFallback:`LDAP Server Configuration`,tab:`users`,subTab:`ldap`,keywords:`ldap server url bind dn user search base group filter tls`,anchor:`card-ldap-server`}),Q({labelKey:`backup.githubBackup`,labelFallback:`GitHub Backup`,tab:`backup`,keywords:`github backup cloud remote sync profiles token`,anchor:`card-backup-github`}),Q({labelKey:`backup.history`,labelFallback:`Backup History`,tab:`backup`,keywords:`backup history log runs github commits`,anchor:`card-backup-history`}),Q({labelKey:`backup.localBackup`,labelFallback:`Local Backup`,tab:`backup`,keywords:`local backup download zip manual export`,anchor:`card-backup-local`}),Q({labelKey:`backup.scheduledBackup`,labelFallback:`Scheduled Backups`,tab:`backup`,keywords:`scheduled backup automatic hourly daily weekly retention local path`,anchor:`card-backup-scheduled`});var ja=20,Ma={database:`bg-blue-600`,library_files:`bg-green-500`,library_thumbnails:`bg-teal-500`,library_other:`bg-emerald-700`,archive_timelapses:`bg-red-500`,archive_thumbnails:`bg-amber-500`,archive_files:`bg-sky-500`,virtual_printer_uploads:`bg-purple-500`,virtual_printer_upload_cache:`bg-fuchsia-500`,virtual_printer_certs:`bg-violet-500`,virtual_printer_other:`bg-purple-700`,downloads:`bg-cyan-500`,plate_calibration:`bg-lime-500`,logs:`bg-orange-500`,other_data:`bg-yellow-500`},Na=[`bg-blue-500`,`bg-green-500`,`bg-yellow-500`,`bg-red-500`,`bg-orange-500`,`bg-teal-500`,`bg-cyan-500`,`bg-purple-500`],Pa=(e,t)=>Ma[e]||Na[t%Na.length],Fa={temperature:0,humidity:1,battery:2};function Ia(e,t){return e?v(e,t,{decimals:2}):null}var La=[`off`,`all`,`selected`];function Ra(e){let t=(e.external_camera_type||`mjpeg`).toUpperCase(),n=e.external_camera_url||``;if(!n)return t;let r=n;try{r=new URL(n).host||n}catch{}return`${t} · ${r}`}function za(){let[e,t]=(0,X.useState)(0),n=u(),a=vt(),[o,s]=bt(),{t:m,i18n:_}=l(),{showToast:v}=ee(),{authEnabled:x,user:S,isAdmin:T,refreshAuth:D,hasPermission:k,loading:P}=un(),{mode:F,resolvedMode:I,darkStyle:re,darkBackground:L,darkAccent:se,lightStyle:ce,lightBackground:le,lightAccent:ue,setMode:fe,setDarkStyle:V,setDarkBackground:pe,setDarkAccent:me,setLightStyle:he,setLightBackground:ge,setLightAccent:_e,progressInTitle:ye,setProgressInTitle:be}=an(),[H,Ee]=(0,X.useState)(null),[De,je]=(0,X.useState)({}),[Ne,Pe]=(0,X.useState)(null),[Be,Ve]=(0,X.useState)(!1),[Ue,We]=(0,X.useState)(null),[Ge,q]=(0,X.useState)(!1),[Ye,Xe]=(0,X.useState)(null),[et,ot]=(0,X.useState)(!1),[st,lt]=(0,X.useState)(null),[ut,ft]=(0,X.useState)(!1),{colorize:mt,aboveColor:xt,belowColor:jt,optimalColor:Mt}=de(),[Pt,It]=(0,X.useState)(null),[Lt,Bt]=(0,X.useState)(!1),[Ut,Wt]=(0,X.useState)(null),[qt,Jt]=(0,X.useState)(null),[Qt,en]=(0,X.useState)(``),[tn,on]=(0,X.useState)(``),[J,dn]=(0,X.useState)(!1),[fn,pn]=(0,X.useState)(!1),[mn,hn]=(0,X.useState)(!1),[gn,_n]=(0,X.useState)(Gt()),vn=o.get(`tab`),xn=vn===`email`,Cn=k(`api_keys:read`)||k(`settings:update`),wn=vn===`apikeys`&&[`#card-camera-tokens`,`#card-stream-overlay`].includes(window.location.hash),[Tn,Dn]=(0,X.useState)(xn?`users`:wn?`camera`:vn&&Aa.includes(vn)?vn:`general`),[On,kn]=(0,X.useState)(xn?`email`:vn===`users`&&o.get(`sub`)===`printer-access`?`printer-access`:`users`),An=e=>{if(kn(e),e===`printer-access`)o.set(`sub`,`printer-access`);else for(let e of[`sub`,`view`,`group`,`printer`])o.delete(e);s(o,{replace:!0})},Mn=On===`printer-access`&&!(x&&T)?`users`:On,[Nn,Fn]=(0,X.useState)(vn===`queue`&&o.get(`sub`)===`pipelines`?`pipelines`:`dispatch`),In=e=>{Dn(e),e===`users`&&kn(`users`);for(let e of[`sub`,`view`,`group`,`printer`])o.delete(e);e===`queue`&&Fn(`dispatch`),e===`general`?o.delete(`tab`):o.set(`tab`,e),s(o,{replace:!0})};(0,X.useEffect)(()=>{!P&&Tn===`apikeys`&&!Cn&&In(`camera`)},[P,Tn,Cn]);let Ln=e=>{Fn(e),e===`pipelines`?o.set(`sub`,`pipelines`):o.delete(`sub`),s(o,{replace:!0})},[Rn,zn]=(0,X.useState)(!1),[Bn,Vn]=(0,X.useState)(``),[Hn,Un]=(0,X.useState)({can_queue:!0,can_control_printer:!1,can_read_status:!0,can_manage_library:!0,can_manage_inventory:!0,can_manage_maintenance:!0,can_manage_archives:!0,can_manage_projects:!0,can_access_cloud:!1,can_update_energy_cost:!1,can_send_notifications:!1}),[Wn,Gn]=(0,X.useState)(null),[Kn,Jn]=(0,X.useState)(!1),[Yn,Xn]=(0,X.useState)(null),[Zn,Qn]=(0,X.useState)(``),[$n,tr]=(0,X.useState)(!1),[nr,rr]=(0,X.useState)(!1),[ir,ar]=(0,X.useState)(null),[or,sr]=(0,X.useState)(!1),[cr,lr]=(0,X.useState)(!1),[dr,hr]=(0,X.useState)(!1),[gr,_r]=(0,X.useState)({currentPassword:``,newPassword:``,confirmPassword:``}),[yr,br]=(0,X.useState)(!1),[xr,Sr]=(0,X.useState)(!1),[Cr,wr]=(0,X.useState)(!1),[Er,Dr]=(0,X.useState)(`local`),[kr,Ar]=(0,X.useState)(!1),[Nr,Fr]=(0,X.useState)(null),[Ir,Lr]=(0,X.useState)(null),[Rr,zr]=(0,X.useState)(null),[Br,Vr]=(0,X.useState)(!1),[Z,Hr]=(0,X.useState)({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),[Ur,Wr]=(0,X.useState)(null),[Gr,Kr]=(0,X.useState)(null),[qr,Jr]=(0,X.useState)(!1),[Yr,Xr]=(0,X.useState)({}),[Zr,Qr]=(0,X.useState)({}),$r=e=>{_n(e),rn(e),v(m(`settings.toast.settingsSaved`),`success`)},{data:ei,isLoading:ti}=d({queryKey:[`settings`],queryFn:r.getSettings}),{data:ni,isLoading:ri,isFetching:ii}=d({queryKey:[`storage-usage`],queryFn:()=>r.getStorageUsage(),enabled:Tn===`general`,staleTime:1/0,refetchInterval:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),{data:ai}=d({queryKey:[`ha-price-entities`],queryFn:async()=>(await r.getBindableHAEntities()).filter(e=>e.domain===`sensor`&&/\/\s*[km]?wh$/i.test(e.unit_of_measurement??``)),enabled:Tn===`general`&&ei?.energy_price_source===`homeassistant`&&!!ei?.ha_enabled,staleTime:6e4,retry:!1}),oi=async()=>{Sr(!0);try{let e=await r.getStorageUsage({refresh:!0});n.setQueryData([`storage-usage`],e)}catch(e){v(e instanceof Error?e.message:`Failed to refresh storage usage`,`error`)}finally{Sr(!1)}},{data:si,isLoading:ci}=d({queryKey:[`smart-plugs`],queryFn:r.getSmartPlugs}),{data:ui,isLoading:di}=d({queryKey:[`smart-plugs-energy`,si?.map(e=>e.id)],queryFn:async()=>{if(!si||si.length===0)return null;let e=await Promise.all(si.filter(e=>e.enabled).map(async e=>{try{return{plug:e,status:await r.getSmartPlugStatus(e.id)}}catch{return{plug:e,status:null}}})),t=0,n=0,i=0,a=0,o=0;for(let{plug:r,status:s}of e){let e=r.plug_type===`mqtt`&&s?.energy?.power!=null;(s?.reachable||e)&&(o++,s?.energy?.power!=null&&(t+=s.energy.power),s?.energy?.today!=null&&(n+=s.energy.today),s?.energy?.yesterday!=null&&(i+=s.energy.yesterday),s?.energy?.total!=null&&(a+=s.energy.total))}return{totalPower:t,totalToday:n,totalYesterday:i,totalLifetime:a,reachableCount:o,totalPlugs:si.filter(e=>e.enabled).length}},enabled:Tn===`plugs`&&!!si&&si.length>0,refetchInterval:Tn===`plugs`?1e4:!1}),{data:pi,isLoading:vi}=d({queryKey:[`notification-providers`],queryFn:r.getNotificationProviders}),{data:bi,isLoading:xi}=d({queryKey:[`api-keys`],queryFn:r.getAPIKeys}),Si=f({mutationFn:e=>r.createAPIKey(e),onSuccess:e=>{Gn(e.key||null),zn(!1),Vn(``),n.invalidateQueries({queryKey:[`api-keys`]}),v(m(`settings.toast.apiKeyCreated`))},onError:e=>{v(`Failed to create API key: ${e.message}`,`error`)}}),Ci=f({mutationFn:e=>r.deleteAPIKey(e),onSuccess:(e,t)=>{n.setQueryData([`api-keys`],e=>(e??[]).filter(e=>e.id!==t)),v(m(`settings.toast.apiKeyDeleted`))},onError:e=>{v(`Failed to delete API key: ${e.message}`,`error`)}}),{data:wi}=d({queryKey:[`printers`],queryFn:r.getPrinters}),{data:Ti}=d({queryKey:[`haSensors`],queryFn:()=>r.getHASensors()}),{data:Ei}=d({queryKey:[`locationHaSensors`],queryFn:()=>r.getLocationHASensors()}),{data:Di}=d({queryKey:Xt,queryFn:r.getLocations,enabled:Tn===`sensors`}),Oi=p({queries:(0,X.useMemo)(()=>Array.from(new Set((Ei??[]).map(e=>e.location_id))),[Ei]).map(e=>({queryKey:[`locationHaSensorReadings`,e],queryFn:()=>r.getLocationHASensorReadings(e,!1),enabled:Tn===`sensors`,refetchInterval:Tn===`sensors`?(ei?.location_sensor_poll_interval||120)*1e3:!1}))}),Ai=(0,X.useMemo)(()=>{let e=new Map;for(let t of Oi)for(let n of t.data??[])e.set(n.id,n);return e},[Oi]),ji=f({mutationFn:async e=>{for(let t of e)await r.deleteLocationHASensor(t)},onSuccess:()=>{v(m(`locationHaSensors.toast.deleted`),`success`)},onError:e=>{v(e.message,`error`)},onSettled:()=>{n.invalidateQueries({queryKey:[`locationHaSensors`]}),n.invalidateQueries({queryKey:[`locationHaSensorReadings`]}),It(null)}}),Mi=Yt(wi?.length??0),{data:Pi,isLoading:Fi}=d({queryKey:[`notification-templates`],queryFn:r.getNotificationTemplates}),{data:Ii}=d({queryKey:[`virtual-printer-settings`],queryFn:i.getSettings,refetchInterval:1e4}),Li=Ii?.status?.running??!1,{data:Ri}=d({queryKey:[`spoolbuddy-devices`],queryFn:()=>c.getDevices(),refetchInterval:15e3}),zi=Ri?.length??0,Bi=Ri?.some(e=>e.online)??!1,{data:Vi}=d({queryKey:[`obico-status`],queryFn:r.getObicoStatus,refetchInterval:15e3}),Hi=!!(Vi?.is_running&&Vi?.enabled),{data:Ui}=d({queryKey:[`ffmpeg-status`],queryFn:r.checkFfmpeg}),{data:Wi}=d({queryKey:[`version`],queryFn:r.getVersion}),Gi=!x||k(`library:purge`),{data:qi}=d({queryKey:[`library-trash-settings`],queryFn:()=>r.getLibraryTrashSettings(),enabled:Gi}),Yi=f({mutationFn:e=>r.updateLibraryTrashSettings(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`library-trash-settings`]}),v(m(`settings.toast.settingsSaved`),`success`)},onError:e=>v(e.message||m(`libraryAutoPurge.saveFailed`),`error`)}),Xi=e=>{qi&&Yi.mutate({retention_days:qi.retention_days,auto_purge_enabled:qi.auto_purge_enabled,auto_purge_days:qi.auto_purge_days,auto_purge_include_never_printed:qi.auto_purge_include_never_printed,...e})},Qi=!x||k(`archives:purge`),{data:ea}=d({queryKey:[`archive-purge-settings`],queryFn:()=>r.getArchivePurgeSettings(),enabled:Qi}),ta=f({mutationFn:e=>r.updateArchivePurgeSettings(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`archive-purge-settings`]}),v(m(`settings.toast.settingsSaved`),`success`)},onError:e=>v(e.message||m(`archiveAutoPurge.saveFailed`),`error`)}),na=e=>{ea&&ta.mutate({enabled:ea.enabled,days:ea.days,purge_stats:ea.purge_stats,...e})},{data:ra,refetch:ia,isRefetching:aa}=d({queryKey:[`updateCheck`],queryFn:r.checkForUpdates,enabled:ei?.check_updates!==!1,staleTime:300*1e3}),{data:oa,refetch:sa}=d({queryKey:[`updateStatus`],queryFn:r.getUpdateStatus,refetchInterval:e=>{let t=e.state.data;return t?.status===`downloading`||t?.status===`installing`?1e3:!1}}),{data:la}=d({queryKey:[`mqtt-status`],queryFn:r.getMQTTStatus,refetchInterval:Tn===`network`?5e3:!1}),{data:ua}=d({queryKey:[`github-backup-status`],queryFn:r.getGitHubBackupStatus}),{data:da}=d({queryKey:[`cloud-status`],queryFn:r.getCloudStatus}),{data:pa={advanced_auth_enabled:!1,smtp_configured:!1,local_login_enabled:!0,autologin_provider_id:null}}=d({queryKey:[`advancedAuthStatus`],queryFn:()=>r.getAdvancedAuthStatus()}),{data:ma}=d({queryKey:[`ldapStatus`],queryFn:()=>r.getLDAPStatus()}),{data:ha}=d({queryKey:[`twoFAStatus`],queryFn:()=>r.get2FAStatus()}),{data:_a=[]}=d({queryKey:[`oidcProvidersAll`],queryFn:()=>r.getOIDCProvidersAll(),enabled:T}),{data:Q=[],isLoading:ba}=d({queryKey:[`users`],queryFn:()=>r.getUsers(),enabled:x&&k(`users:read`)}),{data:xa=[],isLoading:Sa}=d({queryKey:[`groups`],queryFn:()=>r.getGroups(),enabled:x&&k(`groups:read`)}),Ca=f({mutationFn:e=>r.createUser(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`users`]}),n.invalidateQueries({queryKey:[`groups`]}),wr(!1),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),v(m(`settings.toast.userCreated`))},onError:e=>{v(e.message,`error`)}}),Ta=f({mutationFn:({id:e,data:t})=>r.updateUser(e,t),onSuccess:()=>{n.invalidateQueries({queryKey:[`users`]}),n.invalidateQueries({queryKey:[`groups`]}),Ar(!1),Fr(null),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),v(m(`settings.toast.userUpdated`))},onError:e=>{v(e.message,`error`)}}),Ma=f({mutationFn:({id:e,deleteItems:t})=>r.deleteUser(e,t),onSuccess:()=>{n.invalidateQueries({queryKey:[`users`]}),v(m(`settings.toast.userDeleted`)),Lr(null),zr(null)},onError:e=>{v(e.message,`error`)}}),Na=f({mutationFn:e=>r.resetUserPassword({user_id:e}),onSuccess:e=>{v(e.message,`success`)},onError:e=>{v(e.message,`error`)}}),za=async e=>{Lr(e),Vr(!0);try{zr(await r.getUserItemsCount(e))}catch{zr({archives:0,queue_items:0,library_files:0})}finally{Vr(!1)}},Ba=f({mutationFn:e=>r.deleteGroup(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`groups`]}),v(m(`settings.toast.groupDeleted`))},onError:e=>{v(e.message,`error`)}}),Va=()=>{let e=pa?.advanced_auth_enabled||!1;if(!Z.username){v(m(`settings.toast.fillRequiredFields`),`error`);return}if(e&&!Z.email){v(`Email is required when advanced authentication is enabled`,`error`);return}if(!e){if(!Z.password){v(m(`settings.toast.fillRequiredFields`),`error`);return}if(Z.password!==Z.confirmPassword){v(m(`settings.toast.passwordsDoNotMatch`),`error`);return}let e=En(Z.password);if(e){v(m({tooShort:`settings.toast.passwordTooShort`,needsUppercase:`settings.toast.passwordNeedsUppercase`,needsLowercase:`settings.toast.passwordNeedsLowercase`,needsDigit:`settings.toast.passwordNeedsDigit`,needsSpecial:`settings.toast.passwordNeedsSpecial`}[e]),`error`);return}}Ca.mutate({username:Z.username,password:e?void 0:Z.password,email:Z.email||void 0,role:Z.role,group_ids:Z.group_ids.length>0?Z.group_ids:void 0})},Ha=e=>{if(Z.password){if(Z.password!==Z.confirmPassword){v(m(`settings.toast.passwordsDoNotMatch`),`error`);return}let e=En(Z.password);if(e){v(m({tooShort:`settings.toast.passwordTooShort`,needsUppercase:`settings.toast.passwordNeedsUppercase`,needsLowercase:`settings.toast.passwordNeedsLowercase`,needsDigit:`settings.toast.passwordNeedsDigit`,needsSpecial:`settings.toast.passwordNeedsSpecial`}[e]),`error`);return}}let t={username:Z.username||void 0,password:Z.password||void 0,email:Z.email||void 0,role:Z.role,group_ids:Z.group_ids};t.password||delete t.password,Ta.mutate({id:e,data:t})},Ua=e=>{Fr(e.id),Hr({username:e.username,password:``,email:e.email||``,confirmPassword:``,role:e.role,group_ids:e.groups?.map(e=>e.id)||[]}),Ar(!0)},Wa=e=>{Hr(t=>({...t,group_ids:t.group_ids.includes(e)?t.group_ids.filter(t=>t!==e):[...t.group_ids,e]}))},Ga=f({mutationFn:r.applyUpdate,onSuccess:e=>{e.is_ha_addon||e.is_docker||e.is_windows_installer?v(e.message,`error`):sa()}}),[Ka,qa]=(0,X.useState)(null),Ja=f({mutationFn:r.testAllNotificationProviders,onSuccess:e=>{qa(e),n.invalidateQueries({queryKey:[`notification-providers`]}),e.failed===0?v(`All ${e.tested} providers tested successfully!`,`success`):v(`${e.success}/${e.tested} providers succeeded`,e.failed>0?`error`:`success`)},onError:e=>{v(`Failed to test providers: ${e.message}`,`error`)}}),Ya=f({mutationFn:async e=>{if(!si)return{success:0,failed:0};let t=si.filter(e=>e.enabled),n=await Promise.all(t.map(async t=>{try{return await r.controlSmartPlug(t.id,e),{success:!0}}catch{return{success:!1}}}));return{success:n.filter(e=>e.success).length,failed:n.filter(e=>!e.success).length}},onSuccess:(e,t)=>{n.invalidateQueries({queryKey:[`smart-plugs`]}),n.invalidateQueries({queryKey:[`smart-plugs-energy`]}),e.failed===0?v(`All ${e.success} plugs turned ${t}`,`success`):v(`${e.success} plugs turned ${t}, ${e.failed} failed`,`error`)},onError:e=>{v(`Failed: ${e.message}`,`error`)}}),Xa=(0,X.useRef)(null),Za=(0,X.useRef)(null),Qa=(0,X.useRef)(!1),$a=(0,X.useRef)(!0),eo=(0,X.useRef)(null);(0,X.useEffect)(()=>{if(ei&&!H){let e={...ei,external_url:ei.external_url||window.location.origin};eo.current=ei,Ee(e),setTimeout(()=>{$a.current=!1},100)}},[ei,H]),(0,X.useEffect)(()=>{let e=eo.current;if(!ei||!H||!e||ei===e)return;let t={};for(let n of Object.keys(ei))ei[n]!==e[n]&&H[n]===e[n]&&(t[n]=ei[n]);eo.current=ei,Object.keys(t).length>0&&Ee(e=>e&&{...e,...t})},[ei,H]);let to=f({mutationFn:r.updateSettings,onSuccess:e=>{eo.current=e,n.setQueryData([`settings`],e),e.energy_price_source===`homeassistant`&&Ee(t=>t&&{...t,energy_cost_per_kwh:e.energy_cost_per_kwh}),n.invalidateQueries({queryKey:[`archiveStats`]}),n.invalidateQueries({queryKey:[`ui-flags`]}),n.invalidateQueries({queryKey:[`announcements`]}),v(m(`settings.toast.settingsSaved`),`success`)},onError:e=>{v(`Failed to save: ${e.message}`,`error`)},onSettled:()=>{Qa.current=!1}}),no=f({mutationFn:({id:e,data:t})=>r.updatePrinter(e,t),onSuccess:()=>{n.invalidateQueries({queryKey:[`printers`]}),v(m(`settings.toast.cameraSettingsSaved`),`success`)},onError:e=>{v(`Failed to update printer: ${e.message}`,`error`)}});(0,X.useEffect)(()=>{let e=eo.current;if(!($a.current||!H||!ei||!e)&&!(x&&!k(`settings:update`))&&(e.auto_archive!==H.auto_archive||e.save_thumbnails!==H.save_thumbnails||e.capture_finish_photo!==H.capture_finish_photo||(e.finish_photo_restore_plate??!0)!==(H.finish_photo_restore_plate??!0)||e.default_filament_cost!==H.default_filament_cost||e.currency!==H.currency||H.energy_price_source!==`homeassistant`&&e.energy_cost_per_kwh!==H.energy_cost_per_kwh||e.energy_tracking_mode!==H.energy_tracking_mode||(e.energy_price_source??`fixed`)!==(H.energy_price_source??`fixed`)||(e.energy_price_ha_entity??``)!==(H.energy_price_ha_entity??``)||e.check_updates!==H.check_updates||(e.check_printer_firmware??!0)!==(H.check_printer_firmware??!0)||(e.include_beta_updates??!1)!==(H.include_beta_updates??!1)||(e.announcements_enabled??!0)!==(H.announcements_enabled??!0)||(e.announcements_all_users??!1)!==(H.announcements_all_users??!1)||(e.local_login_enabled??!0)!==(H.local_login_enabled??!0)||e.notification_language!==H.notification_language||(e.bed_cooled_threshold??35)!==(H.bed_cooled_threshold??35)||e.ams_humidity_good!==H.ams_humidity_good||e.ams_humidity_fair!==H.ams_humidity_fair||e.ams_temp_good!==H.ams_temp_good||e.ams_temp_fair!==H.ams_temp_fair||(e.ams_temp_alarm??null)!==(H.ams_temp_alarm??null)||e.ams_history_retention_days!==H.ams_history_retention_days||e.disable_filament_warnings!==H.disable_filament_warnings||e.prefer_lowest_filament!==H.prefer_lowest_filament||(e.queue_drying_enabled??!1)!==(H.queue_drying_enabled??!1)||(e.queue_drying_block??!1)!==(H.queue_drying_block??!1)||(e.ambient_drying_enabled??!1)!==(H.ambient_drying_enabled??!1)||(e.ambient_drying_sustained_minutes??0)!==(H.ambient_drying_sustained_minutes??0)||(e.print_drying_enabled??!1)!==(H.print_drying_enabled??!1)||(e.drying_presets??``)!==(H.drying_presets??``)||(e.ams_humidity_thresholds??``)!==(H.ams_humidity_thresholds??``)||e.per_printer_mapping_expanded!==H.per_printer_mapping_expanded||e.date_format!==H.date_format||e.time_format!==H.time_format||e.default_printer_id!==H.default_printer_id||e.ftp_retry_enabled!==H.ftp_retry_enabled||e.ftp_retry_count!==H.ftp_retry_count||e.ftp_retry_delay!==H.ftp_retry_delay||e.ftp_timeout!==H.ftp_timeout||e.mqtt_enabled!==H.mqtt_enabled||e.mqtt_broker!==H.mqtt_broker||e.mqtt_port!==H.mqtt_port||e.mqtt_username!==H.mqtt_username||e.mqtt_password!==H.mqtt_password||e.mqtt_topic_prefix!==H.mqtt_topic_prefix||e.mqtt_use_tls!==H.mqtt_use_tls||e.external_url!==H.external_url||e.ha_enabled!==H.ha_enabled||e.ha_url!==H.ha_url||e.ha_token!==H.ha_token||(e.library_archive_mode??`ask`)!==(H.library_archive_mode??`ask`)||Number(e.library_disk_warning_gb??5)!==Number(H.library_disk_warning_gb??5)||(e.camera_light_mode??`off`)!==(H.camera_light_mode??`off`)||Number(e.camera_light_delay??2)!==Number(H.camera_light_delay??2)||(e.preferred_slicer??`bambu_studio`)!==(H.preferred_slicer??`bambu_studio`)||Oa(e.slice_engine)!==Oa(H.slice_engine)||(e.open_in_slicer??null)!==(H.open_in_slicer??null)||(e.use_slicer_api??!1)!==(H.use_slicer_api??!1)||(e.orcaslicer_api_url??``)!==(H.orcaslicer_api_url??``)||(e.slicer_stall_timeout_minutes??15)!==(H.slicer_stall_timeout_minutes??15)||(e.bambu_studio_api_url??``)!==(H.bambu_studio_api_url??``)||e.prometheus_enabled!==H.prometheus_enabled||e.prometheus_token!==H.prometheus_token||(e.user_notifications_enabled??!0)!==(H.user_notifications_enabled??!0)||(e.default_bed_levelling??`auto`)!==(H.default_bed_levelling??`auto`)||(e.default_flow_cali??`auto`)!==(H.default_flow_cali??`auto`)||(e.default_vibration_cali??!0)!==(H.default_vibration_cali??!0)||(e.default_layer_inspect??!1)!==(H.default_layer_inspect??!1)||(e.default_timelapse??!1)!==(H.default_timelapse??!1)||(e.default_nozzle_offset_cali??`auto`)!==(H.default_nozzle_offset_cali??`auto`)||(e.default_confirm_outcome??!1)!==(H.default_confirm_outcome??!1)||(e.confirm_outcome_external_prints??!1)!==(H.confirm_outcome_external_prints??!1)||(e.confirm_default_good_on_plate_clear??!1)!==(H.confirm_default_good_on_plate_clear??!1)||(e.stagger_group_size??2)!==(H.stagger_group_size??2)||(e.stagger_interval_minutes??5)!==(H.stagger_interval_minutes??5)||(e.require_plate_clear??!1)!==(H.require_plate_clear??!1)||(e.queue_max_concurrent_uploads??4)!==(H.queue_max_concurrent_uploads??4)||(e.preheat_enabled??!1)!==(H.preheat_enabled??!1)||(e.preheat_filament_targets??``)!==(H.preheat_filament_targets??``)||(e.preheat_max_wait_seconds??900)!==(H.preheat_max_wait_seconds??900)||(e.preheat_soak_seconds??300)!==(H.preheat_soak_seconds??300)||(e.queue_keep_bed_warm??!1)!==(H.queue_keep_bed_warm??!1)||(e.queue_keep_warm_bed_temp??90)!==(H.queue_keep_warm_bed_temp??90)||(e.queue_keep_warm_max_minutes??120)!==(H.queue_keep_warm_max_minutes??120)||(e.nozzle_temp_presets??``)!==(H.nozzle_temp_presets??``)||(e.bed_temp_presets??``)!==(H.bed_temp_presets??``)||(e.chamber_temp_presets??``)!==(H.chamber_temp_presets??``)||(e.fan_speed_presets??``)!==(H.fan_speed_presets??``)||(e.session_max_hours??24)!==(H.session_max_hours??24)||(e.billing_enabled??!1)!==(H.billing_enabled??!1)||(e.printer_kill_switch_enabled??!1)!==(H.printer_kill_switch_enabled??!1)||(e.finance_budget_reset_day??1)!==(H.finance_budget_reset_day??1)||(e.finance_budget_reset_timezone??`UTC`)!==(H.finance_budget_reset_timezone??`UTC`))&&!Qa.current)return Xa.current&&clearTimeout(Xa.current),Xa.current=setTimeout(()=>{if(Qa.current)return;Qa.current=!0;let e={auto_archive:H.auto_archive,save_thumbnails:H.save_thumbnails,capture_finish_photo:H.capture_finish_photo,finish_photo_restore_plate:H.finish_photo_restore_plate??!0,default_filament_cost:H.default_filament_cost,currency:H.currency,...H.energy_price_source===`homeassistant`?{}:{energy_cost_per_kwh:H.energy_cost_per_kwh},energy_tracking_mode:H.energy_tracking_mode,energy_price_source:H.energy_price_source===`homeassistant`?`homeassistant`:`fixed`,energy_price_ha_entity:H.energy_price_ha_entity??``,check_updates:H.check_updates,check_printer_firmware:H.check_printer_firmware,include_beta_updates:H.include_beta_updates,announcements_enabled:H.announcements_enabled??!0,announcements_all_users:H.announcements_all_users??!1,local_login_enabled:H.local_login_enabled,notification_language:H.notification_language,bed_cooled_threshold:H.bed_cooled_threshold,ams_humidity_good:H.ams_humidity_good,ams_humidity_fair:H.ams_humidity_fair,ams_temp_good:H.ams_temp_good,ams_temp_fair:H.ams_temp_fair,ams_temp_alarm:H.ams_temp_alarm??null,ams_history_retention_days:H.ams_history_retention_days,disable_filament_warnings:H.disable_filament_warnings,prefer_lowest_filament:H.prefer_lowest_filament,queue_drying_enabled:H.queue_drying_enabled,queue_drying_block:H.queue_drying_block,ambient_drying_enabled:H.ambient_drying_enabled,ambient_drying_sustained_minutes:H.ambient_drying_sustained_minutes,print_drying_enabled:H.print_drying_enabled,drying_presets:H.drying_presets,ams_humidity_thresholds:H.ams_humidity_thresholds,per_printer_mapping_expanded:H.per_printer_mapping_expanded,date_format:H.date_format,time_format:H.time_format,default_printer_id:H.default_printer_id,ftp_retry_enabled:H.ftp_retry_enabled,ftp_retry_count:H.ftp_retry_count,ftp_retry_delay:H.ftp_retry_delay,ftp_timeout:H.ftp_timeout,mqtt_enabled:H.mqtt_enabled,mqtt_broker:H.mqtt_broker,mqtt_port:H.mqtt_port,mqtt_username:H.mqtt_username,mqtt_password:H.mqtt_password,mqtt_topic_prefix:H.mqtt_topic_prefix,mqtt_use_tls:H.mqtt_use_tls,external_url:H.external_url,ha_enabled:H.ha_enabled,ha_url:H.ha_url,ha_token:H.ha_token,library_archive_mode:H.library_archive_mode,library_disk_warning_gb:H.library_disk_warning_gb,camera_light_mode:H.camera_light_mode,camera_light_delay:H.camera_light_delay,preferred_slicer:H.preferred_slicer,slice_engine:H.slice_engine,open_in_slicer:H.open_in_slicer,use_slicer_api:H.use_slicer_api,orcaslicer_api_url:H.orcaslicer_api_url,slicer_stall_timeout_minutes:H.slicer_stall_timeout_minutes,bambu_studio_api_url:H.bambu_studio_api_url,prometheus_enabled:H.prometheus_enabled,prometheus_token:H.prometheus_token,user_notifications_enabled:H.user_notifications_enabled,default_bed_levelling:H.default_bed_levelling,default_flow_cali:H.default_flow_cali,default_vibration_cali:H.default_vibration_cali,default_layer_inspect:H.default_layer_inspect,default_timelapse:H.default_timelapse,default_nozzle_offset_cali:H.default_nozzle_offset_cali,default_confirm_outcome:H.default_confirm_outcome,confirm_outcome_external_prints:H.confirm_outcome_external_prints,confirm_default_good_on_plate_clear:H.confirm_default_good_on_plate_clear,stagger_group_size:H.stagger_group_size,stagger_interval_minutes:H.stagger_interval_minutes,require_plate_clear:H.require_plate_clear,queue_max_concurrent_uploads:H.queue_max_concurrent_uploads,preheat_enabled:H.preheat_enabled,preheat_filament_targets:H.preheat_filament_targets,preheat_max_wait_seconds:H.preheat_max_wait_seconds,preheat_soak_seconds:H.preheat_soak_seconds,queue_keep_bed_warm:H.queue_keep_bed_warm,queue_keep_warm_bed_temp:H.queue_keep_warm_bed_temp,queue_keep_warm_max_minutes:H.queue_keep_warm_max_minutes,nozzle_temp_presets:H.nozzle_temp_presets,bed_temp_presets:H.bed_temp_presets,chamber_temp_presets:H.chamber_temp_presets,fan_speed_presets:H.fan_speed_presets,session_max_hours:H.session_max_hours,billing_enabled:H.billing_enabled,printer_kill_switch_enabled:H.printer_kill_switch_enabled,finance_budget_reset_day:H.finance_budget_reset_day,finance_budget_reset_timezone:H.finance_budget_reset_timezone};to.mutate(e)},500),()=>{Xa.current&&clearTimeout(Xa.current)}},[H,ei,to,x,k,v,m]);let $=(0,X.useCallback)((e,t)=>{if(x&&!k(`settings:update`)){v(m(`settings.toast.noPermissionUpdate`),`error`);return}Ee(n=>n?{...n,[e]:t}:null)},[x,k,v,m]),ro=async(e,t,n)=>{if(!t){v(m(`settings.toast.enterCameraUrl`),`error`);return}Qr(t=>({...t,[e]:!0})),Xr(t=>({...t,[e]:null}));try{let i=await r.testExternalCamera(e,t,n);Xr(t=>({...t,[e]:i})),i.success?v(i.coalesced?m(`settings.toast.cameraConnectedCoalesced`,{resolution:i.resolution||``}):m(`settings.toast.cameraConnected`,{resolution:i.resolution||``}),`success`):v(i.error||m(`settings.toast.connectionFailed`),`error`)}catch(t){let n=t instanceof Error?t.message:m(`settings.toast.testFailed`);Xr(t=>({...t,[e]:{success:!1,error:n}})),v(n,`error`)}finally{Qr(t=>({...t,[e]:!1}))}},[io,ao]=(0,X.useState)({}),oo=(0,X.useRef)({}),so=(0,X.useRef)(new Set),[co,lo]=(0,X.useState)({}),uo=(0,X.useRef)({}),[fo,po]=(0,X.useState)(null),mo=(0,X.useRef)(new Set);(0,X.useEffect)(()=>{if(wi){let e={},t={};wi.forEach(n=>{n.external_camera_url&&!so.current.has(n.id)&&(e[n.id]=n.external_camera_url,so.current.add(n.id)),n.external_camera_snapshot_url&&!mo.current.has(n.id)&&(t[n.id]=n.external_camera_snapshot_url,mo.current.add(n.id))}),Object.keys(e).length>0&&ao(t=>({...t,...e})),Object.keys(t).length>0&&lo(e=>({...e,...t}))}},[wi]);let ho=(e,t)=>{ao(n=>({...n,[e]:t})),oo.current[e]&&clearTimeout(oo.current[e]),oo.current[e]=setTimeout(()=>{no.mutate({id:e,data:{external_camera_url:t||null}})},800)},go=(e,t)=>{lo(n=>({...n,[e]:t})),uo.current[e]&&clearTimeout(uo.current[e]),uo.current[e]=setTimeout(()=>{no.mutate({id:e,data:{external_camera_snapshot_url:t||null}})},800)},_o=(e,t)=>{let n={};t.type!==void 0&&(n.external_camera_type=t.type||null),t.enabled!==void 0&&(n.external_camera_enabled=t.enabled),t.rotation!==void 0&&(n.camera_rotation=t.rotation),t.lightAuto!==void 0&&(n.camera_light_auto=t.lightAuto),no.mutate({id:e,data:n})};if(ti||!H)return(0,Y.jsx)(`div`,{className:`p-4 md:p-8 flex justify-center`,children:(0,Y.jsx)(R,{className:`w-8 h-8 text-bambu-green animate-spin`})});let vo=va().map(e=>({...e,label:m(e.labelKey,e.labelFallback??e.labelKey)})),yo=tn.trim().toLowerCase(),bo=yo?vo.filter(e=>e.label.toLowerCase().includes(yo)||e.keywords.toLowerCase().includes(yo)).slice(0,8):[],xo=e=>{In(e.tab),e.subTab&&An(e.subTab),on(``),setTimeout(()=>{let t=document.getElementById(e.anchor);t&&(t.scrollIntoView({behavior:`smooth`,block:`start`}),t.classList.add(`ring-2`,`ring-bambu-green`),setTimeout(()=>t.classList.remove(`ring-2`,`ring-bambu-green`),1500))},50)},So=(H?.docker_compose_dir??``).trim()||(ra?.compose_dir_detected??``),Co=So?`cd ${/\s/.test(So)?`"${So}"`:So} && docker compose pull && docker compose up -d`:`docker compose pull && docker compose up -d`,wo=H.camera_light_mode??`off`,To=(wi??[]).filter(e=>e.camera_light_auto),Eo=(wi??[]).filter(e=>e.external_camera_enabled),Do=e=>e>0&&(0,Y.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full shrink-0`,children:e}),Oo=e=>(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 ${e?`bg-green-400`:`bg-gray-500`}`}),ko=(Ti?.length??0)+(Ei?.length??0),Ao={tab:`general`,icon:yt,label:m(`settings.tabs.general`)},jo=[{tab:`plugs`,icon:dt,label:m(`settings.tabs.smartPlugs`),extra:Do(si?.length??0)},{tab:`sensors`,icon:ne,label:m(`settings.tabs.sensors`),extra:Do(ko)},{tab:`notifications`,icon:rt,label:m(`settings.tabs.notifications`),extra:Do(pi?.length??0)},{tab:`queue`,icon:Zt,label:m(`settings.tabs.queue`,`Workflow`)},{tab:`filament`,icon:bn,label:m(`settings.tabs.filament`)},{tab:`camera`,icon:$e,label:m(`settings.tabs.camera`)},{tab:`network`,icon:ht,label:m(`settings.tabs.network`),extra:Oo(!!la?.enabled)},...Cn?[{tab:`apikeys`,icon:Kt,label:m(`settings.tabs.apiKeys`),extra:Do(bi?.length??0)}]:[],{tab:`virtual-printer`,icon:it,label:m(`settings.tabs.virtualPrinter`),extra:Oo(!!Li)},{tab:`spoolbuddy`,icon:ke,label:m(`settings.tabs.spoolbuddy`),extra:(0,Y.jsxs)(Y.Fragment,{children:[Do(zi),Oo(!!Bi)]})},{tab:`failure-detection`,icon:Se,label:m(`settings.tabs.failureDetection`),extra:Oo(!!Hi)},{tab:`users`,icon:Ze,label:m(`settings.tabs.users`),extra:x&&(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 bg-green-400`})},{tab:`backup`,icon:gt,label:m(`settings.tabs.backup`),extra:Oo(!!(da?.is_authenticated&&ua?.configured&&ua?.enabled||ei?.local_backup_enabled))}].sort((e,t)=>e.label.localeCompare(t.label,_.language));return(0,Y.jsx)(ze,{density:`dense`,children:(0,Y.jsxs)(`div`,{className:`p-4 md:p-8`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,Y.jsx)(yt,{className:`w-7 h-7 text-bambu-green`}),m(`settings.title`)]}),(0,Y.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:m(`settings.configureBambuddy`)})]}),(0,Y.jsxs)(`div`,{className:`relative sm:w-72`,children:[(0,Y.jsx)(Ae,{className:`w-4 h-4 text-bambu-gray absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none`}),(0,Y.jsx)(`input`,{type:`text`,value:tn,onChange:e=>on(e.target.value),placeholder:m(`settings.searchPlaceholder`,`Search settings…`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),tn&&(0,Y.jsx)(`button`,{onClick:()=>on(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-bambu-gray hover:text-white`,"aria-label":`Clear`,children:(0,Y.jsx)(Re,{className:`w-3.5 h-3.5`})}),bo.length>0&&(0,Y.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-30 overflow-hidden`,children:bo.map(e=>(0,Y.jsxs)(`button`,{onClick:()=>xo(e),className:`w-full px-3 py-2 text-left hover:bg-bambu-dark-tertiary transition-colors border-b border-bambu-dark-tertiary last:border-b-0`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:e.label}),(0,Y.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[m(`settings.tabs.${e.tab===`virtual-printer`?`virtualPrinter`:e.tab===`failure-detection`?`failureDetection`:e.tab}`),e.subTab?` › ${m(`settings.tabs.${e.subTab}`,e.subTab)}`:``]})]},e.anchor))}),yo&&bo.length===0&&(0,Y.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-30 p-3`,children:(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray italic`,children:m(`settings.noSearchResults`,`No matching settings.`)})})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,Y.jsx)(`nav`,{className:`flex flex-wrap gap-1 border-b border-bambu-dark-tertiary lg:flex-col lg:flex-nowrap lg:gap-0 lg:border-b-0 lg:border-r lg:w-60 lg:flex-shrink-0 lg:self-start lg:sticky lg:top-4`,children:[Ao,...jo].map(({tab:e,icon:t,label:n,extra:r})=>(0,Y.jsxs)(`button`,{onClick:()=>In(e),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Tn===e?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(t,{className:`w-4 h-4 shrink-0`}),n,r]},e))}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[Tn===`general`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`a`,{href:nn(Mi,`app-settings`),target:`_blank`,rel:`noopener noreferrer`,className:`group block mb-4 lg:mb-6 rounded-xl border border-bambu-green/30 bg-gradient-to-br from-bambu-green/15 via-bambu-green/5 to-transparent hover:border-bambu-green/50 hover:from-bambu-green/20 transition-colors`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col md:flex-row items-start md:items-center gap-4 p-4 md:p-5`,children:[(0,Y.jsx)(`div`,{className:`p-3 rounded-lg bg-bambu-green/20 text-bambu-green flex-shrink-0`,children:Mi===`business`?(0,Y.jsx)(C,{className:`w-6 h-6`}):(0,Y.jsx)($t,{className:`w-6 h-6`})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-base font-semibold text-white`,children:Mi===`business`?m(`sponsors.businessTitle`,`Bambuddy for business`):m(`sponsors.sectionTitle`,`Independent & community-funded`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-0.5`,children:Mi===`business`?m(`sponsors.businessTagline`,`You're running {{count}} printers. Priority support, commercial licensing and invoicing are available for teams and print farms.`,{count:wi?.length??0}):m(`sponsors.tagline`,`Bambuddy is free and stays that way because people choose to support it. No VC, no cloud lock-in.`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 rounded-lg bg-bambu-green/20 text-bambu-green group-hover:bg-bambu-green/30 text-sm font-medium whitespace-nowrap self-start md:self-auto`,children:[Mi===`business`?m(`sponsors.businessCta`,`Bambuddy for business`):m(`sponsors.viewSupporters`,`View supporters`),(0,Y.jsx)(Je,{className:`w-4 h-4`})]})]})}),(0,Y.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-xl`,children:[(0,Y.jsxs)(G,{id:`card-general`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.general`)})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,Y.jsx)(zt,{className:`w-4 h-4 inline mr-1`}),m(`settings.language`)]}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`select`,{value:_.language,onChange:e=>{let t=e.target.value;if(x&&!k(`settings:update`)){v(m(`settings.toast.noPermissionUpdate`),`error`);return}_.changeLanguage(t),to.mutate({language:t})},className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:tt.map(e=>(0,Y.jsxs)(`option`,{value:e.code,children:[e.nativeName,` (`,e.name,`)`]},e.code))}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.languageDescription`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.defaultView`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`select`,{value:gn,onChange:e=>$r(e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:kt.map(e=>(0,Y.jsx)(`option`,{value:e.to,children:m(e.labelKey)},e.id))}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.defaultViewDescription`)})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.dateFormat`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsxs)(`select`,{value:H.date_format||`system`,onChange:e=>$(`date_format`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,Y.jsx)(`option`,{value:`system`,children:m(`settings.systemDefault`)}),(0,Y.jsx)(`option`,{value:`us`,children:m(`settings.dateFormatUs`)}),(0,Y.jsx)(`option`,{value:`eu`,children:m(`settings.dateFormatEu`)}),(0,Y.jsx)(`option`,{value:`iso`,children:m(`settings.dateFormatIso`)})]}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.timeFormat`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsxs)(`select`,{value:H.time_format||`system`,onChange:e=>$(`time_format`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,Y.jsx)(`option`,{value:`system`,children:m(`settings.systemDefault`)}),(0,Y.jsx)(`option`,{value:`12h`,children:m(`settings.timeFormat12`)}),(0,Y.jsx)(`option`,{value:`24h`,children:m(`settings.timeFormat24`)})]}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.defaultPrinter`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsxs)(`select`,{value:H.default_printer_id??``,onChange:e=>$(`default_printer_id`,e.target.value?Number(e.target.value):null),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,Y.jsx)(`option`,{value:``,children:m(`settings.noDefaultPrinter`)}),wi?.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.defaultPrinterDescription`)})]})]})]}),(0,Y.jsxs)(G,{id:`card-appearance`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Nt,{className:`w-5 h-5`}),m(`settings.appearance`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Y.jsxs)(`label`,{className:`text-sm text-bambu-gray`,children:[m(`settings.theme`),`:`]}),(0,Y.jsx)(`div`,{className:`flex gap-1`,children:[{id:`dark`,label:m(`settings.themeDark`)},{id:`light`,label:m(`settings.themeLight`)},{id:`system`,label:m(`settings.themeSystem`)}].map(({id:e,label:t})=>(0,Y.jsx)(`button`,{onClick:()=>{fe(e),v(m(`settings.toast.settingsSaved`),`success`)},className:`px-3 py-1 text-xs rounded-lg border transition-colors ${F===e?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-gray-300 dark:border-bambu-dark-tertiary text-gray-500 dark:text-bambu-gray hover:text-gray-900 dark:hover:text-white cursor-pointer`}`,children:t},e))})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 p-4 rounded-lg border ${I===`dark`?`border-bambu-green bg-bambu-green/5`:`border-bambu-dark-tertiary`}`,children:[(0,Y.jsxs)(`h3`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[m(`settings.darkMode`),I===`dark`&&(0,Y.jsx)(`span`,{className:`text-xs text-bambu-green`,children:m(`settings.active`)})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.background`)}),(0,Y.jsxs)(`select`,{value:L,onChange:e=>{pe(e.target.value),v(m(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`neutral`,children:m(`settings.bgNeutral`)}),(0,Y.jsx)(`option`,{value:`warm`,children:m(`settings.bgWarm`)}),(0,Y.jsx)(`option`,{value:`cool`,children:m(`settings.bgCool`)}),(0,Y.jsx)(`option`,{value:`oled`,children:m(`settings.bgOled`)}),(0,Y.jsx)(`option`,{value:`slate`,children:m(`settings.bgSlate`)}),(0,Y.jsx)(`option`,{value:`forest`,children:m(`settings.bgForest`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.accent`)}),(0,Y.jsxs)(`select`,{value:se,onChange:e=>{me(e.target.value),v(m(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`green`,children:m(`settings.accentGreen`)}),(0,Y.jsx)(`option`,{value:`teal`,children:m(`settings.accentTeal`)}),(0,Y.jsx)(`option`,{value:`blue`,children:m(`settings.accentBlue`)}),(0,Y.jsx)(`option`,{value:`orange`,children:m(`settings.accentOrange`)}),(0,Y.jsx)(`option`,{value:`purple`,children:m(`settings.accentPurple`)}),(0,Y.jsx)(`option`,{value:`red`,children:m(`settings.accentRed`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.style`)}),(0,Y.jsxs)(`select`,{value:re,onChange:e=>{V(e.target.value),v(m(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`classic`,children:m(`settings.styleClassic`)}),(0,Y.jsx)(`option`,{value:`glow`,children:m(`settings.styleGlow`)}),(0,Y.jsx)(`option`,{value:`vibrant`,children:m(`settings.styleVibrant`)})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 p-4 rounded-lg border ${I===`light`?`border-bambu-green bg-bambu-green/5`:`border-bambu-dark-tertiary`}`,children:[(0,Y.jsxs)(`h3`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[m(`settings.lightMode`),I===`light`&&(0,Y.jsx)(`span`,{className:`text-xs text-bambu-green`,children:m(`settings.active`)})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.background`)}),(0,Y.jsxs)(`select`,{value:le,onChange:e=>{ge(e.target.value),v(m(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`neutral`,children:m(`settings.bgNeutral`)}),(0,Y.jsx)(`option`,{value:`warm`,children:m(`settings.bgWarm`)}),(0,Y.jsx)(`option`,{value:`cool`,children:m(`settings.bgCool`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.accent`)}),(0,Y.jsxs)(`select`,{value:ue,onChange:e=>{_e(e.target.value),v(m(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`green`,children:m(`settings.accentGreen`)}),(0,Y.jsx)(`option`,{value:`teal`,children:m(`settings.accentTeal`)}),(0,Y.jsx)(`option`,{value:`blue`,children:m(`settings.accentBlue`)}),(0,Y.jsx)(`option`,{value:`orange`,children:m(`settings.accentOrange`)}),(0,Y.jsx)(`option`,{value:`purple`,children:m(`settings.accentPurple`)}),(0,Y.jsx)(`option`,{value:`red`,children:m(`settings.accentRed`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.style`)}),(0,Y.jsxs)(`select`,{value:ce,onChange:e=>{he(e.target.value),v(m(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`classic`,children:m(`settings.styleClassic`)}),(0,Y.jsx)(`option`,{value:`glow`,children:m(`settings.styleGlow`)}),(0,Y.jsx)(`option`,{value:`vibrant`,children:m(`settings.styleVibrant`)})]})]})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.themeToggleHint`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.progressInTitle`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.progressInTitleDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:ye,onChange:e=>{be(e.target.checked),v(m(`settings.toast.settingsSaved`),`success`)},className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,Y.jsxs)(G,{id:`card-archive`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.archiveSettings`)})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.autoArchivePrints`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.autoArchiveDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.auto_archive,onChange:e=>$(`auto_archive`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.saveThumbnails`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.saveThumbnailsDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.save_thumbnails,onChange:e=>$(`save_thumbnails`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.captureFinishPhoto`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.captureFinishPhotoDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.capture_finish_photo,onChange:e=>$(`capture_finish_photo`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),H.capture_finish_photo&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between pl-4 border-l-2 border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.finishPhotoRestorePlate`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.finishPhotoRestorePlateDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.finish_photo_restore_plate??!0,onChange:e=>$(`finish_photo_restore_plate`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),H.capture_finish_photo&&Ui&&!Ui.installed&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg`,children:[(0,Y.jsx)(Ie,{className:`w-5 h-5 text-yellow-500 flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{className:`text-sm`,children:[(0,Y.jsx)(`p`,{className:`text-yellow-500 font-medium`,children:m(`settings.ffmpegNotInstalled`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:m(`settings.ffmpegRequired`)})]})]}),Qi&&ea&&(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3 mt-3 space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`archiveAutoPurge.enableLabel`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`archiveAutoPurge.enableDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:ea.enabled,onChange:e=>na({enabled:e.target.checked}),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`archiveAutoPurge.ageLabel`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`number`,min:7,max:3650,disabled:!ea.enabled,value:ea.days,onChange:e=>na({days:Math.max(7,Math.min(3650,parseInt(e.target.value||`0`,10)||0))}),className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:m(`archiveAutoPurge.days`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`archiveAutoPurge.ageDescription`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,disabled:!ea.enabled,checked:ea.purge_stats,onChange:e=>na({purge_stats:e.target.checked}),className:`mt-0.5 shrink-0 disabled:opacity-50`}),(0,Y.jsxs)(`span`,{className:`text-sm`,children:[(0,Y.jsx)(`span`,{className:`text-white block`,children:m(`archiveAutoPurge.purgeStatsLabel`)}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray block mt-0.5`,children:m(`archiveAutoPurge.purgeStatsDescription`)})]})]})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-md`,children:[(0,Y.jsxs)(G,{id:`card-cost`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.costTracking`)})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.currency`)}),(0,Y.jsx)(`select`,{value:H.currency,onChange:e=>$(`currency`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:Ht.map(e=>(0,Y.jsx)(`option`,{value:e.code,children:e.label},e.code))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.defaultFilamentCost`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none`,children:Et(H.currency)}),(0,Y.jsx)(ct,{step:`0.01`,min:0,value:H.default_filament_cost,onChange:e=>$(`default_filament_cost`,e),integer:!1,fallback:0,style:{paddingLeft:`${Math.max(2,Et(H.currency).length*.6+1)}rem`},className:`w-full pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.energyPriceSource`)}),(0,Y.jsxs)(`select`,{value:H.energy_price_source===`homeassistant`?`homeassistant`:`fixed`,onChange:e=>$(`energy_price_source`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`fixed`,children:m(`settings.energyPriceSourceFixed`)}),(0,Y.jsx)(`option`,{value:`homeassistant`,children:m(`settings.energyPriceSourceHomeAssistant`)})]}),H.energy_price_source===`homeassistant`&&!H.ha_enabled&&(0,Y.jsx)(`p`,{className:`text-xs text-yellow-500 mt-1`,children:m(`settings.energyPriceHaNotConfigured`)})]}),H.energy_price_source===`homeassistant`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.energyPriceHaEntity`)}),(0,Y.jsx)(`input`,{type:`text`,list:`ha-price-entities`,value:H.energy_price_ha_entity??``,onChange:e=>$(`energy_price_ha_entity`,e.target.value.trim()),placeholder:`sensor.electricity_price`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`datalist`,{id:`ha-price-entities`,children:(ai??[]).map(e=>(0,Y.jsx)(`option`,{value:e.entity_id,children:`${e.friendly_name} (${e.state??`?`} ${e.unit_of_measurement??``})`},e.entity_id))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:H.energy_price_source===`homeassistant`?m(`settings.energyPriceLastRead`):m(`settings.electricityCost`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none`,children:Et(H.currency)}),(0,Y.jsx)(ct,{step:`0.001`,min:0,value:H.energy_cost_per_kwh,onChange:e=>$(`energy_cost_per_kwh`,e),integer:!1,fallback:0,disabled:H.energy_price_source===`homeassistant`,style:{paddingLeft:`${Math.max(2,Et(H.currency).length*.6+1)}rem`},className:`w-full pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-60`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:H.energy_price_source===`homeassistant`?m(`settings.energyPriceHaHint`):m(`settings.energyPriceFixedHint`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.energyDisplayMode`)}),(0,Y.jsxs)(`select`,{value:H.energy_tracking_mode||`total`,onChange:e=>$(`energy_tracking_mode`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`print`,children:m(`settings.printsOnly`)}),(0,Y.jsx)(`option`,{value:`total`,children:m(`settings.totalConsumption`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:H.energy_tracking_mode===`print`?m(`settings.energyModePrintDescription`):m(`settings.energyModeTotalDescription`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.billingEnabled`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.billingEnabledDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.billing_enabled??!1,onChange:e=>$(`billing_enabled`,e.target.checked),className:`peer sr-only`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary rounded-full peer-checked:bg-bambu-green peer-checked:after:translate-x-5 after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border after:rounded-full after:h-5 after:w-5 after:transition-all`})]})]}),H.billing_enabled&&(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.printerKillSwitch`,`Unauthorized print kill switch`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.printerKillSwitchDescription`,`Immediately stop prints that start without authorization.`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.printer_kill_switch_enabled??!1,onChange:e=>$(`printer_kill_switch_enabled`,e.target.checked),className:`peer sr-only`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary rounded-full peer-checked:bg-bambu-green peer-checked:after:translate-x-5 after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border after:rounded-full after:h-5 after:w-5 after:transition-all`})]})]}),H.billing_enabled&&(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-4`,children:[(0,Y.jsx)(`div`,{className:`mb-3`,children:(0,Y.jsxs)(`h4`,{className:`text-base font-medium text-white flex items-center gap-2`,children:[(0,Y.jsx)(w,{className:`w-4 h-4 text-bambu-green`}),m(`settings.financeBudgetReset`,`Finance Monthly Budget Reset`)]})}),(0,Y.jsxs)(`div`,{className:`flex gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.financeBudgetResetDay`,`Reset Day`)}),(0,Y.jsx)(`input`,{type:`number`,min:1,max:31,value:H.finance_budget_reset_day??1,onChange:e=>$(`finance_budget_reset_day`,Math.max(1,Math.min(31,parseInt(e.target.value,10)||1))),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.financeBudgetResetDayHelp`,`For short months, reset uses the last day of the month.`)})]}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.financeBudgetResetTimezone`,`Reset timezone`)}),(0,Y.jsxs)(`select`,{value:H.finance_budget_reset_timezone??`UTC`,onChange:e=>$(`finance_budget_reset_timezone`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,children:[(0,Y.jsx)(`option`,{value:`UTC`,children:`UTC`}),(0,Y.jsx)(`option`,{value:`Europe/Berlin`,children:`Europe/Berlin`}),(0,Y.jsx)(`option`,{value:`Europe/Vienna`,children:`Europe/Vienna`}),(0,Y.jsx)(`option`,{value:`Europe/Zurich`,children:`Europe/Zurich`}),(0,Y.jsx)(`option`,{value:`America/New_York`,children:`America/New_York`}),(0,Y.jsx)(`option`,{value:`America/Chicago`,children:`America/Chicago`}),(0,Y.jsx)(`option`,{value:`America/Denver`,children:`America/Denver`}),(0,Y.jsx)(`option`,{value:`America/Los_Angeles`,children:`America/Los_Angeles`}),(0,Y.jsx)(`option`,{value:`Asia/Tokyo`,children:`Asia/Tokyo`}),(0,Y.jsx)(`option`,{value:`Asia/Singapore`,children:`Asia/Singapore`}),(0,Y.jsx)(`option`,{value:`Australia/Sydney`,children:`Australia/Sydney`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.financeBudgetResetTimezoneHelp`,`Budget window start is calculated in this timezone.`)})]})]})]}),H.billing_enabled&&T&&(0,Y.jsxs)(`div`,{className:`mt-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>pn(!0),disabled:mn,children:mn?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 mr-2 animate-spin`}),m(`settings.rebuildLedgerInProgress`,`Starting...`)]}):m(`settings.rebuildLedger`,`Rebuild wallet ledger`)}),fn&&(0,Y.jsx)(Tt,{title:m(`settings.rebuildLedgerConfirmTitle`,`Rebuild wallet ledger?`),message:m(`settings.rebuildLedgerConfirmMessage`,`This will rebuild the wallet ledger to repair historical balance values. Run this only if you know what you are doing.`),confirmText:m(`common.run`,`Run`),cancelText:m(`common.cancel`,`Cancel`),isLoading:mn,loadingText:m(`common.running`,`Running`),variant:`warning`,onCancel:()=>pn(!1),onConfirm:async()=>{hn(!0);try{await r.rebuildBalanceLedger(),v(m(`settings.rebuildLedgerStarted`,`Ledger rebuild started`),`success`),pn(!1)}catch(e){v(e.message||`Failed to start ledger rebuild`,`error`)}finally{hn(!1)}}})]})]})]})]}),(0,Y.jsxs)(G,{id:`card-filemanager`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(ln,{className:`w-5 h-5 text-bambu-green`}),m(`settings.fileManager`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.createArchiveEntry`)}),(0,Y.jsxs)(`select`,{value:H.library_archive_mode??`ask`,onChange:e=>$(`library_archive_mode`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`always`,children:m(`settings.archiveMode.always`)}),(0,Y.jsx)(`option`,{value:`never`,children:m(`settings.archiveMode.never`)}),(0,Y.jsx)(`option`,{value:`ask`,children:m(`settings.archiveMode.ask`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.createArchiveEntryDescription`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.lowDiskSpaceWarning`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ct,{min:.5,max:100,step:`0.5`,value:H.library_disk_warning_gb??5,onChange:e=>$(`library_disk_warning_gb`,e),integer:!1,fallback:5,className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`GB`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.lowDiskSpaceDescription`)})]}),Gi&&qi&&(0,Y.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3 mt-3 space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`libraryAutoPurge.enableLabel`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`libraryAutoPurge.enableDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:qi.auto_purge_enabled,onChange:e=>Xi({auto_purge_enabled:e.target.checked}),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`libraryAutoPurge.ageLabel`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`number`,min:7,max:3650,disabled:!qi.auto_purge_enabled,value:qi.auto_purge_days,onChange:e=>Xi({auto_purge_days:Math.max(7,Math.min(3650,parseInt(e.target.value||`0`,10)||0))}),className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:m(`libraryAutoPurge.days`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`libraryAutoPurge.ageDescription`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-white cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,disabled:!qi.auto_purge_enabled,checked:qi.auto_purge_include_never_printed,onChange:e=>Xi({auto_purge_include_never_printed:e.target.checked}),className:`rounded border-gray-300 disabled:opacity-50`}),m(`libraryAutoPurge.includeNeverPrinted`)]})]})]})]}),(0,Y.jsxs)(G,{id:`card-data`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.dataManagement`)})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.clearNotificationLogs`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.clearNotificationLogsDescription`)})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>tr(!0),children:[(0,Y.jsx)(qe,{className:`w-4 h-4`}),m(`common.clear`)]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.resetUiPreferences`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.resetUiPreferencesDescription`)})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>rr(!0),children:[(0,Y.jsx)(qe,{className:`w-4 h-4`}),m(`settings.reset`)]})]}),(0,Y.jsxs)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.storageUsage`,`Storage Usage`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.storageUsageDescription`,`Breakdown of data usage by category`)})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:oi,disabled:ii||xr,children:[(0,Y.jsx)(at,{className:`w-4 h-4 ${ii||xr?`animate-spin`:``}`}),m(`common.refresh`,`Refresh`)]})]}),(0,Y.jsx)(`div`,{className:`mt-3`,children:ri?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),m(`common.loading`,`Loading`)]}):ni?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`w-full h-3 bg-bambu-dark rounded-full overflow-hidden flex`,children:ni.categories.filter(e=>e.bytes>0).map((e,t)=>(0,Y.jsx)(`div`,{className:`${Pa(e.key,t)} h-full`,style:{width:`${e.percent_of_total}%`},title:`${e.label}: ${e.formatted}`},e.key))}),(0,Y.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3`,children:ni.categories.filter(e=>e.bytes>0).map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`span`,{className:`w-3 h-3 rounded-full ${Pa(e.key,t)}`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:e.label}),(0,Y.jsx)(`span`,{className:`text-white`,children:e.formatted}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[`(`,e.percent_of_total.toFixed(1),`%)`]})]},e.key))}),(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-bambu-gray`,children:[m(`settings.storageUsageTotal`,`Total`),`: `,(0,Y.jsx)(`span`,{className:`text-white`,children:ni.total_formatted}),ni.scan_errors>0&&(0,Y.jsxs)(`span`,{className:`ml-2 text-amber-700 dark:text-amber-400`,children:[m(`settings.storageUsageErrors`,`Scan errors`),`: `,ni.scan_errors]})]}),ni.other_breakdown?.length>0&&(0,Y.jsxs)(`div`,{className:`mt-4`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:m(`settings.storageUsageOtherBreakdown`,`Other breakdown`)}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:ni.other_breakdown.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-white`,children:e.label}),(0,Y.jsx)(`span`,{className:`px-2 py-0.5 rounded-full border ${e.kind===`system`?`border-slate-500 text-slate-300`:`border-bambu-green text-bambu-green`}`,children:e.kind===`system`?m(`settings.storageUsageSystem`,`System`):m(`settings.storageUsageData`,`Data`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,Y.jsx)(`span`,{className:`text-white`,children:e.formatted}),(0,Y.jsxs)(`span`,{children:[`(`,e.percent_of_total.toFixed(1),`%)`]})]})]},`${e.bucket}-${e.kind}`))})]})]}):(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.storageUsageUnavailable`,`Storage usage data is unavailable`)})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between pt-4 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.backupRestore`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.backupRestoreDescription`)})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>In(`backup`),children:[(0,Y.jsx)(gt,{className:`w-4 h-4`}),m(`settings.goToBackup`)]})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-sm`,children:[(0,Y.jsxs)(G,{id:`card-updates`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.updates`)})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wider`,children:m(`settings.printerFirmware`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.checkPrinterFirmware`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.checkFirmwareDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.check_printer_firmware??!0,onChange:e=>$(`check_printer_firmware`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:(0,Y.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wider mb-4`,children:m(`settings.bambuddySoftware`)})}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.checkForUpdatesLabel`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.autoCheckDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.check_updates,onChange:e=>$(`check_updates`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between ${H.check_updates?``:`opacity-50`}`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.includeBetaUpdates`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.includeBetaUpdatesDesc`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.include_beta_updates??!1,onChange:e=>$(`include_beta_updates`,e.target.checked),disabled:!H.check_updates,className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.currentVersion`)}),(0,Y.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`v`,Wi?.version||`...`]})]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>ia(),disabled:aa,children:[aa?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(at,{className:`w-4 h-4`}),m(`settings.checkNow`)]})]}),ra?.update_available?(0,Y.jsxs)(`div`,{className:`mt-4 p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{className:`text-bambu-green font-medium`,children:[`Update available: v`,ra.latest_version]}),ra.release_name&&ra.release_name!==ra.latest_version&&(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:ra.release_name})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ra.release_notes&&(0,Y.jsx)(`button`,{onClick:()=>sr(!0),className:`text-bambu-gray hover:text-white transition-colors text-sm underline`,children:m(`settings.releaseNotes`)}),ra.release_url&&(0,Y.jsx)(`a`,{href:ra.release_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-gray hover:text-white transition-colors`,title:m(`settings.viewReleaseOnGitHub`),children:(0,Y.jsx)(Je,{className:`w-4 h-4`})})]})]}),oa?.status===`downloading`||oa?.status===`installing`?(0,Y.jsxs)(`div`,{className:`mt-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),(0,Y.jsx)(`span`,{children:oa.message})]}),(0,Y.jsx)(`div`,{className:`mt-2 w-full bg-bambu-dark-tertiary rounded-full h-2`,children:(0,Y.jsx)(`div`,{className:`bg-bambu-green h-2 rounded-full transition-all duration-300`,style:{width:`${oa.progress}%`}})})]}):oa?.status===`complete`?(0,Y.jsx)(`div`,{className:`mt-3 p-2 bg-bambu-green/20 rounded text-sm text-bambu-green`,children:oa.message}):oa?.status===`error`?(0,Y.jsx)(`div`,{className:`mt-3 p-2 bg-red-100 dark:bg-red-500/20 rounded text-sm text-red-700 dark:text-red-400`,children:oa.error||oa.message}):ra?.is_ha_addon?(0,Y.jsx)(`div`,{className:`mt-3 p-3 bg-bambu-dark-tertiary rounded-lg`,children:(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.updateViaHomeAssistant`)})}):ra?.is_docker?(0,Y.jsxs)(`div`,{className:`mt-3 p-3 bg-bambu-dark-tertiary rounded-lg`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:m(`settings.updateViaDocker`)}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,Y.jsx)(`code`,{className:`flex-1 block text-xs bg-bambu-dark p-2 rounded text-bambu-green font-mono break-all select-all`,children:Co}),(0,Y.jsx)(we,{value:Co,titleKey:`settings.copyUpdateCommand`,copiedTitleKey:`printers.copied`,className:`ml-0 p-2 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors flex-shrink-0`,iconClassName:`w-4 h-4`})]}),(0,Y.jsxs)(`label`,{className:`block mt-3`,children:[(0,Y.jsx)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.composeDirectory`)}),(0,Y.jsx)(`input`,{type:`text`,value:H?.docker_compose_dir??``,onChange:e=>$(`docker_compose_dir`,e.target.value),placeholder:ra?.compose_dir_detected||`/opt/bambuddy`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white font-mono placeholder:text-bambu-gray/60 focus:outline-none focus:border-bambu-green`}),(0,Y.jsx)(`span`,{className:`block text-xs text-bambu-gray mt-1`,children:m(`settings.composeDirectoryHint`)})]})]}):ra?.update_method===`windows_installer`?(0,Y.jsxs)(`div`,{className:`mt-3 p-3 bg-bambu-dark-tertiary rounded-lg`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:m(`settings.updateViaWindowsInstaller`)}),(0,Y.jsxs)(`a`,{href:ra.installer_download_url||ra.release_url||`https://github.com/maziggy/bambuddy/releases/tag/v${ra.latest_version}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-bambu-dark disabled:opacity-50 bg-bambu-green hover:bg-bambu-green-light text-white focus:ring-bambu-green px-4 py-2 text-sm gap-2 min-h-[44px] md:min-h-0`,children:[(0,Y.jsx)(sn,{className:`w-4 h-4`}),m(`settings.downloadWindowsInstaller`,{version:ra.latest_version})]})]}):(0,Y.jsxs)(K,{className:`mt-3`,onClick:()=>Ga.mutate(),disabled:Ga.isPending,children:[Ga.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(sn,{className:`w-4 h-4`}),m(`settings.installUpdate`)]})]}):ra?.error?(0,Y.jsx)(`div`,{className:`mt-2 p-2 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded text-sm text-red-700 dark:text-red-400`,children:m(`settings.failedToCheckUpdates`,{error:ra.error})}):ra&&!ra.update_available?(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:m(`settings.latestVersionRunning`)}):null]}),(0,Y.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:(0,Y.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wider mb-4`,children:m(`announcements.title`)})}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.announcementsEnabled`)}),(0,Y.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[m(`settings.announcementsEnabledDesc`),` `,(0,Y.jsx)(`a`,{href:`https://wiki.bambuddy.cool/features/announcements/`,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-green hover:underline`,children:m(`settings.announcementsLearnMore`)})]})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.announcements_enabled??!0,onChange:e=>$(`announcements_enabled`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between ${H.announcements_enabled===!1?`opacity-50`:``}`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.announcementsAllUsers`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.announcementsAllUsersDesc`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.announcements_all_users??!1,onChange:e=>$(`announcements_all_users`,e.target.checked),disabled:H.announcements_enabled===!1,className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,Y.jsx)(yi,{})]})]})]}),Tn===`network`&&H&&(0,Y.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-6`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 lg:max-w-xl space-y-3`,children:[(0,Y.jsxs)(G,{id:`card-externalurl`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(zt,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),m(`settings.externalUrl`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.externalUrlDescription`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.bambuddyUrl`)}),(0,Y.jsx)(`input`,{type:`text`,value:H.external_url??``,onChange:e=>$(`external_url`,e.target.value),placeholder:`http://192.168.1.100:8000`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.externalUrlHint`)})]})]})]}),(0,Y.jsxs)(G,{id:`card-ftpretry`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(at,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),m(`settings.ftpRetry`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.ftpRetryDescription`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.enableRetry`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.autoRetryDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.ftp_retry_enabled??!0,onChange:e=>$(`ftp_retry_enabled`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),H.ftp_retry_enabled&&(0,Y.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.retryAttempts`)}),(0,Y.jsxs)(`div`,{className:`relative w-44`,children:[(0,Y.jsx)(`select`,{value:H.ftp_retry_count??3,onChange:e=>$(`ftp_retry_count`,parseInt(e.target.value)),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[1,2,3,4,5,6,7,8,9,10].map(e=>(0,Y.jsx)(`option`,{value:e,children:m(`settings.time`,{count:e})},e))}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.retryDelay`)}),(0,Y.jsxs)(`div`,{className:`relative w-44`,children:[(0,Y.jsx)(`select`,{value:H.ftp_retry_delay??2,onChange:e=>$(`ftp_retry_delay`,parseInt(e.target.value)),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[1,2,3,5,10,15,20,30].map(e=>(0,Y.jsx)(`option`,{value:e,children:m(`settings.second`,{count:e})},e))}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.connectionTimeout`)}),(0,Y.jsxs)(`div`,{className:`relative w-44`,children:[(0,Y.jsx)(`select`,{value:H.ftp_timeout??30,onChange:e=>$(`ftp_timeout`,parseInt(e.target.value)),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[10,15,20,30,45,60,90,120,180,300].map(e=>(0,Y.jsx)(`option`,{value:e,children:m(`settings.nSeconds`,{count:e})},e))}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.increaseForWeakWifi`)})]})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex-1 lg:max-w-xl space-y-3`,children:[(0,Y.jsxs)(G,{id:`card-ha`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Ft,{className:`w-5 h-5 text-bambu-green`}),m(`settings.homeAssistant`)]}),H.ha_enabled&&Gr&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full ${Gr.success?`bg-green-400`:`bg-red-400`}`}),(0,Y.jsx)(`span`,{className:`text-sm ${Gr.success?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`}`,children:Gr.success?m(`settings.connected`):m(`settings.disconnected`)})]})]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.homeAssistantFullDescription`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.enableHomeAssistant`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.homeAssistantDescription`)}),H.ha_env_managed&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 mt-1`,children:[(0,Y.jsx)(z,{className:`w-3 h-3 text-bambu-green`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-green`,children:m(`settings.autoEnabledViaEnv`)})]})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.ha_enabled??!1,onChange:e=>$(`ha_enabled`,e.target.checked),disabled:H.ha_env_managed,className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green ${H.ha_env_managed?`opacity-60 cursor-not-allowed`:``}`})]})]}),H.ha_enabled&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[m(`settings.homeAssistantUrl`),H.ha_url_from_env&&(0,Y.jsx)(`span`,{className:`ml-2 text-xs text-bambu-green`,children:m(`settings.environmentManagedLabel`)})]}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`input`,{type:`text`,value:H.ha_url??``,onChange:e=>$(`ha_url`,e.target.value),placeholder:`http://192.168.1.100:8123`,disabled:H.ha_url_from_env,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${H.ha_url_from_env?`opacity-60 cursor-not-allowed`:``}`}),H.ha_url_from_env&&(0,Y.jsx)(z,{className:`absolute right-3 top-2.5 w-4 h-4 text-bambu-gray`})]}),H.ha_url_from_env&&(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.urlFromEnvReadOnly`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[m(`settings.longLivedAccessToken`),H.ha_token_from_env&&(0,Y.jsx)(`span`,{className:`ml-2 text-xs text-bambu-green`,children:m(`settings.environmentManagedLabel`)})]}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`input`,{type:`password`,value:H.ha_token??``,onChange:e=>$(`ha_token`,e.target.value),placeholder:`eyJ0eXAiOiJKV1QiLC...`,disabled:H.ha_token_from_env,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${H.ha_token_from_env?`opacity-60 cursor-not-allowed`:``}`}),H.ha_token_from_env&&(0,Y.jsx)(z,{className:`absolute right-3 top-2.5 w-4 h-4 text-bambu-gray`})]}),H.ha_token_from_env?(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.tokenFromEnvReadOnly`)}):(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.haTokenHint`)})]}),H.ha_url&&H.ha_token&&(0,Y.jsx)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,disabled:qr,onClick:async()=>{Jr(!0),Kr(null);try{Kr(await r.testHAConnection(H.ha_url,H.ha_token))}catch(e){Kr({success:!1,message:null,error:e instanceof Error?e.message:m(`common.unknownError`)})}finally{Jr(!1)}},children:[qr?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(ht,{className:`w-4 h-4`}),m(`settings.testConnection`)]})})]})]})]}),(0,Y.jsxs)(G,{id:`card-mqtt`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(ht,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),m(`settings.mqttPublishing`)]}),la?.enabled&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full ${la.connected?`bg-green-400`:`bg-red-400`}`}),(0,Y.jsx)(`span`,{className:`text-sm ${la.connected?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`}`,children:la.connected?m(`settings.connected`):m(`settings.disconnected`)})]})]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.mqttDescription`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.enableMqtt`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.mqttEnableDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.mqtt_enabled??!1,onChange:e=>$(`mqtt_enabled`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),H.mqtt_enabled&&(0,Y.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.brokerHostname`)}),(0,Y.jsx)(`input`,{type:`text`,value:H.mqtt_broker??``,onChange:e=>$(`mqtt_broker`,e.target.value),placeholder:`mqtt.example.com or 192.168.1.100`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`flex items-end gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.port`)}),(0,Y.jsx)(ct,{min:1,max:65535,value:H.mqtt_port??1883,onChange:e=>$(`mqtt_port`,e),fallback:1883,className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.mqtt_use_tls??!1,onChange:e=>{let t=e.target.checked;$(`mqtt_use_tls`,t);let n=H.mqtt_port??1883;t&&n===1883?$(`mqtt_port`,8883):!t&&n===8883&&$(`mqtt_port`,1883)},className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]}),(0,Y.jsx)(`span`,{className:`text-white text-sm`,children:m(`settings.useTls`)})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.usernameOptional`)}),(0,Y.jsx)(`input`,{type:`text`,value:H.mqtt_username??``,onChange:e=>$(`mqtt_username`,e.target.value),placeholder:m(`settings.leaveEmptyForAnonymous`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.passwordOptional`)}),(0,Y.jsx)(`input`,{type:`password`,value:H.mqtt_password??``,onChange:e=>$(`mqtt_password`,e.target.value),placeholder:m(`settings.leaveEmptyForAnonymous`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.topicPrefix`)}),(0,Y.jsx)(`input`,{type:`text`,value:H.mqtt_topic_prefix??`bambuddy`,onChange:e=>$(`mqtt_topic_prefix`,e.target.value),placeholder:`bambuddy`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.topicPrefixHint`,{prefix:H.mqtt_topic_prefix||`bambuddy`})})]}),la&&(0,Y.jsx)(`div`,{className:`pt-3 mt-3 border-t border-bambu-dark-tertiary`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full ${la.connected?`bg-green-400`:`bg-red-400`}`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:la.connected?(0,Y.jsxs)(Y.Fragment,{children:[m(`settings.mqttConnectedTo`),` `,(0,Y.jsxs)(`span`,{className:`text-white`,children:[la.broker,`:`,la.port]})]}):m(`settings.spoolmanDisconnected`)})]})})]})]})]})]}),(0,Y.jsx)(`div`,{className:`flex-1 lg:max-w-md space-y-3`,children:(0,Y.jsxs)(G,{id:`card-prometheus`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(g,{className:`w-5 h-5 text-orange-600 dark:text-orange-400`}),m(`settings.prometheusMetrics`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.prometheusEndpointDescription`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.enableMetricsEndpoint`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.prometheusDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.prometheus_enabled??!1,onChange:e=>$(`prometheus_enabled`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),H.prometheus_enabled&&(0,Y.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.bearerTokenOptional`)}),(0,Y.jsx)(`input`,{type:`password`,value:H.prometheus_token??``,onChange:e=>$(`prometheus_token`,e.target.value),placeholder:m(`settings.leaveEmptyForNoAuth`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.bearerTokenHint`)})]}),(0,Y.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white mb-2`,children:m(`settings.availableMetrics`)}),(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray space-y-1`,children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_printer_connected`}),` - `,m(`settings.metricsConnectionStatus`)]}),(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_printer_state`}),` - `,m(`settings.metricsPrinterState`)]}),(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_print_progress`}),` - `,m(`settings.metricsPrintProgress`)]}),(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_bed_temp_celsius`}),` - `,m(`settings.metricsBedTemp`)]}),(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_nozzle_temp_celsius`}),` - `,m(`settings.metricsNozzleTemp`)]}),(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_prints_total`}),` - `,m(`settings.metricsPrintsTotal`)]}),(0,Y.jsx)(`p`,{className:`text-bambu-gray/70 italic`,children:m(`settings.metricsMore`)})]})]})]})]})]})})]}),Gr&&(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-6 max-w-md w-full mx-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[Gr.success?(0,Y.jsx)(j,{className:`w-8 h-8 text-green-600 dark:text-green-400`}):(0,Y.jsx)(O,{className:`w-8 h-8 text-red-600 dark:text-red-400`}),(0,Y.jsx)(`h3`,{className:`text-lg font-medium text-white`,children:Gr.success?m(`settings.connectionSuccessful`):m(`settings.connectionFailed`)})]}),(0,Y.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:Gr.success?Gr.message||m(`settings.haConnectionSuccess`):Gr.error||m(`settings.haConnectionFailed`)}),(0,Y.jsx)(`div`,{className:`flex justify-end`,children:(0,Y.jsx)(K,{variant:`primary`,onClick:()=>Kr(null),children:m(`settings.ok`)})})]})}),Tn===`plugs`&&(0,Y.jsxs)(`div`,{id:`card-plugs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between mb-6`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(dt,{className:`w-5 h-5 text-bambu-green`}),m(`settings.smartPlugs`)]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:m(`settings.smartPlugsDescription`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 pt-1 shrink-0`,children:[si&&si.filter(e=>e.enabled).length>1&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,className:`whitespace-nowrap`,onClick:()=>ar(`on`),disabled:Ya.isPending,title:m(`settings.turnAllPlugsOn`),children:[Ya.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Ct,{className:`w-4 h-4 text-bambu-green`}),m(`settings.allOn`)]}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,className:`whitespace-nowrap`,onClick:()=>ar(`off`),disabled:Ya.isPending,title:m(`settings.turnAllPlugsOff`),children:[Ya.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(St,{className:`w-4 h-4 text-red-600 dark:text-red-400`}),m(`settings.allOff`)]})]}),(0,Y.jsxs)(K,{className:`whitespace-nowrap`,onClick:()=>{We(null),Ve(!0)},children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.addSmartPlug`)]})]})]}),si&&si.length>0&&(0,Y.jsxs)(G,{className:`mb-6`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Ot,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`}),m(`settings.energySummary`),di&&(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin text-bambu-gray ml-2`})]})}),(0,Y.jsx)(W,{children:ui?(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,Y.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,Y.jsx)(Ot,{className:`w-3 h-3`}),m(`settings.currentPower`)]}),(0,Y.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[ui.totalPower.toFixed(1),(0,Y.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`W`})]}),(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.plugsOnline`,{reachable:ui.reachableCount,total:ui.totalPlugs})})]}),(0,Y.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,Y.jsx)(w,{className:`w-3 h-3`}),m(`settings.today`)]}),(0,Y.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[ui.totalToday.toFixed(3),(0,Y.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`kWh`})]}),(H?.energy_cost_per_kwh??0)>0&&(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[`~`,(ui.totalToday*(H?.energy_cost_per_kwh??0)).toFixed(2),` `,Et(H?.currency||`USD`)]})]}),(0,Y.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,Y.jsx)(g,{className:`w-3 h-3`}),m(`settings.yesterday`)]}),(0,Y.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[ui.totalYesterday.toFixed(3),(0,Y.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`kWh`})]}),(H?.energy_cost_per_kwh??0)>0&&(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[`~`,(ui.totalYesterday*(H?.energy_cost_per_kwh??0)).toFixed(2),` `,Et(H?.currency||`USD`)]})]}),(0,Y.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,Y.jsx)(te,{className:`w-3 h-3`}),m(`settings.total`)]}),(0,Y.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[ui.totalLifetime.toFixed(1),(0,Y.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`kWh`})]}),(H?.energy_cost_per_kwh??0)>0&&(0,Y.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[`~`,(ui.totalLifetime*(H?.energy_cost_per_kwh??0)).toFixed(2),` `,Et(H?.currency||`USD`)]})]})]}):di?null:(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.enablePlugsForSummary`)})})]}),ci?(0,Y.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,Y.jsx)(R,{className:`w-8 h-8 text-bambu-green animate-spin`})}):si&&si.length>0?(0,Y.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4`,children:si.map(e=>(0,Y.jsx)(fr,{plug:e,onEdit:e=>{We(e),Ve(!0)}},e.id))}):(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-12`,children:(0,Y.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,Y.jsx)(dt,{className:`w-16 h-16 mx-auto mb-4 opacity-30`}),(0,Y.jsx)(`p`,{className:`text-lg font-medium text-white mb-2`,children:m(`settings.noSmartPlugsTitle`)}),(0,Y.jsx)(`p`,{className:`text-sm mb-4`,children:m(`settings.noSmartPlugsDescription`)}),(0,Y.jsxs)(K,{onClick:()=>{We(null),Ve(!0)},children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.addFirstSmartPlug`)]})]})})})]}),Tn===`sensors`&&(0,Y.jsxs)(`div`,{id:`card-sensors`,children:[(0,Y.jsxs)(`div`,{id:`card-ha-sensors`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(ne,{className:`w-5 h-5 text-bambu-green`}),m(`haSensors.sectionTitle`)]}),(0,Y.jsxs)(K,{className:`whitespace-nowrap`,disabled:!wi?.length,onClick:()=>{Xe(null),q(!0)},children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`haSensors.add`)]})]}),Ti&&Ti.length>0?(0,Y.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:Ti.map(e=>{let t=wi?.find(t=>t.id===e.printer_id);return(0,Y.jsx)(G,{children:(0,Y.jsxs)(W,{className:`py-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-white font-medium truncate`,children:e.name}),(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray truncate`,children:e.entity_id}),(0,Y.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:t?.name??m(`haSensors.unknownPrinter`)})]}),(0,Y.jsx)(K,{size:`sm`,variant:`secondary`,onClick:()=>{Xe(e),q(!0)},children:m(`common.edit`)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:[e.block_print&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`,children:m(`haSensors.badgeBlocks`)}),e.notify_on_alert&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:m(`haSensors.badgeNotifies`)}),!e.show_on_printer_card&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded bg-bambu-dark-tertiary text-bambu-gray`,children:m(`haSensors.badgeHidden`)})]})]})},e.id)})}):(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-8`,children:(0,Y.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,Y.jsx)(ne,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,Y.jsx)(`p`,{className:`text-sm`,children:m(`haSensors.empty`)})]})})})]}),(0,Y.jsxs)(`div`,{id:`card-location-sensors`,className:`mt-8`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-[20px] mb-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(ne,{className:`w-5 h-5 text-bambu-green`}),m(`locationHaSensors.sectionTitle`)]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:m(`locationHaSensors.sectionDescription`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 pt-1 shrink-0`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>ft(!0),className:`p-2 rounded-lg bg-bambu-dark-tertiary hover:bg-bambu-gray-dark text-white transition-colors`,title:m(`locationHaSensors.options.buttonLabel`),"aria-label":m(`locationHaSensors.options.buttonLabel`),children:(0,Y.jsx)(M,{className:`w-4 h-4`})}),(0,Y.jsxs)(K,{className:`whitespace-nowrap`,disabled:!Di?.length,onClick:()=>{lt(null),ot(!0)},children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`locationHaSensors.add`)]})]})]}),Ei&&Ei.length>0?(0,Y.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:(()=>{let e=new Map((Di??[]).map((e,t)=>[e.id,t])),t=Ei.reduce((e,t)=>{let n=e.get(t.location_id)??[];return n.push(t),e.set(t.location_id,n),e},new Map);return Array.from(t.entries()).sort(([t],[n])=>(e.get(t)??2**53-1)-(e.get(n)??2**53-1))})().map(([e,t])=>{let n=Di?.find(t=>t.id===e),r=e=>b({device_class:e.device_class,state:e.last_state,kind:e.kind}),i=[...t].sort((e,t)=>(Fa[e.device_class??``]??99)-(Fa[t.device_class??``]??99));return(0,Y.jsx)(G,{children:(0,Y.jsxs)(W,{className:`py-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Y.jsx)(`div`,{className:`text-white font-medium truncate`,children:n?.name??m(`locationHaSensors.unknownLocation`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>It({locationName:n?.name??m(`locationHaSensors.unknownLocation`),sensorIds:i.map(e=>e.id)}),className:`p-1 text-bambu-gray hover:text-red-500 rounded transition-colors shrink-0`,title:m(`common.delete`),"aria-label":m(`common.delete`),children:(0,Y.jsx)(qe,{className:`w-3.5 h-3.5`})})]}),(0,Y.jsx)(`div`,{className:`mt-2 space-y-1.5`,children:i.map(e=>{let t=r(e),n=Ai.get(e.id),i=Ia(n,m),a=B(mt&&n?ve(n):null,xt,jt,Mt)||`text-white`;return(0,Y.jsxs)(`div`,{className:`flex items-center min-w-0 text-xs text-bambu-gray`,children:[(0,Y.jsx)(t,{className:`w-3.5 h-3.5 shrink-0 mr-1.5`}),i&&(0,Y.jsx)(`span`,{className:`${a} shrink-0 w-[52px] text-center`,children:i}),i&&(0,Y.jsx)(`span`,{className:`shrink-0 mr-1.5`,children:`-`}),(0,Y.jsx)(`span`,{className:`truncate mr-1.5`,title:e.name,children:e.entity_id}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{lt(e),ot(!0)},className:`p-1 text-bambu-gray hover:text-white rounded transition-colors shrink-0`,title:m(`common.edit`),"aria-label":m(`common.edit`),children:(0,Y.jsx)(Ke,{className:`w-3.5 h-3.5`})})]},e.id)})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:[(()=>{let e=i.filter(e=>e.notify_on_alert);return e.length?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-0.5 text-xs rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:[m(`haSensors.badgeNotifies`),e.map(e=>(0,Y.jsx)(r(e),{className:`w-3 h-3`},e.id))]}):null})(),(()=>{let e=i.filter(e=>!e.show_on_card);return e.length?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-0.5 text-xs rounded bg-bambu-dark-tertiary text-bambu-gray`,children:[m(`haSensors.badgeHidden`),e.map(e=>(0,Y.jsx)(r(e),{className:`w-3 h-3`},e.id))]}):null})()]})]})},e)})}):(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-8`,children:(0,Y.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,Y.jsx)(ne,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,Y.jsx)(`p`,{className:`text-sm`,children:m(`locationHaSensors.empty`)})]})})})]})]}),Tn===`notifications`&&(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-providers`,children:[(0,Y.jsx)(rt,{className:`w-5 h-5 text-bambu-green`}),m(`settings.providers`)]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(K,{size:`sm`,variant:`secondary`,onClick:()=>dn(!0),children:[(0,Y.jsx)(ie,{className:`w-4 h-4`}),m(`settings.log`)]}),pi&&pi.length>0&&(0,Y.jsxs)(K,{size:`sm`,variant:`secondary`,onClick:()=>{qa(null),Ja.mutate()},disabled:Ja.isPending,children:[Ja.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(Sn,{className:`w-4 h-4`}),m(`settings.testAll`)]}),(0,Y.jsxs)(K,{size:`sm`,onClick:()=>{Wt(null),Bt(!0)},children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.addNotificationProvider`)]})]})]}),(0,Y.jsx)(G,{className:`mb-4`,children:(0,Y.jsx)(W,{className:`py-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white text-sm font-medium`,children:m(`settings.notificationLanguage`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.notificationLanguageDescription`)})]}),(0,Y.jsx)(`select`,{value:H.notification_language||`en`,onChange:e=>$(`notification_language`,e.target.value),className:`px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:ring-1 focus:ring-bambu-green`,children:tt.map(e=>(0,Y.jsx)(`option`,{value:e.code,children:e.nativeName},e.code))})]})})}),(0,Y.jsx)(G,{className:`mb-4`,children:(0,Y.jsx)(W,{className:`py-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white text-sm font-medium`,children:m(`settings.bedCooledThreshold`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.bedCooledThresholdDescription`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`input`,{type:`number`,min:20,max:80,step:1,value:H.bed_cooled_threshold??35,onChange:e=>$(`bed_cooled_threshold`,Number(e.target.value)),className:`w-16 px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm text-center focus:outline-none focus:ring-1 focus:ring-bambu-green`}),(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`°C`})]})]})})}),(0,Y.jsx)(G,{className:`mb-4`,children:(0,Y.jsx)(W,{className:`py-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between ${pa?.advanced_auth_enabled?``:`opacity-50`}`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white text-sm font-medium`,children:m(`settings.userNotificationsEnabled`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:pa?.advanced_auth_enabled?m(`settings.userNotificationsEnabledDescription`):m(`settings.userNotificationsDisabledHint`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,className:`sr-only peer`,checked:H.user_notifications_enabled??!0,disabled:!pa?.advanced_auth_enabled,onChange:e=>$(`user_notifications_enabled`,e.target.checked)}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green peer-disabled:cursor-not-allowed`})]})]})})}),Ka&&(0,Y.jsx)(G,{className:`mb-4`,children:(0,Y.jsxs)(W,{className:`py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-white`,children:m(`settings.testResults`)}),(0,Y.jsx)(`button`,{onClick:()=>qa(null),className:`text-bambu-gray hover:text-white text-xs`,children:m(`common.dismiss`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-4 text-sm mb-2`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-green`,children:[(0,Y.jsx)(j,{className:`w-4 h-4`}),m(`settings.testPassedCount`,{count:Ka.success})]}),Ka.failed>0&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-red-700 dark:text-red-400`,children:[(0,Y.jsx)(O,{className:`w-4 h-4`}),m(`settings.testFailedCount`,{count:Ka.failed})]})]}),Ka.results.filter(e=>!e.success).length>0&&(0,Y.jsx)(`div`,{className:`space-y-1 mt-2 pt-2 border-t border-bambu-dark-tertiary`,children:Ka.results.filter(e=>!e.success).map(e=>(0,Y.jsxs)(`div`,{className:`text-xs text-red-700 dark:text-red-400`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[e.provider_name,`:`]}),` `,e.message]},e.provider_id))})]})}),vi?(0,Y.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,Y.jsx)(R,{className:`w-6 h-6 text-bambu-green animate-spin`})}):pi&&pi.length>0?(0,Y.jsx)(`div`,{className:`space-y-3`,children:pi.map(e=>(0,Y.jsx)(Or,{provider:e,onEdit:e=>{Wt(e),Bt(!0)}},e.id))}):(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-8`,children:(0,Y.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,Y.jsx)(rt,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,Y.jsx)(`p`,{className:`text-sm font-medium text-white mb-2`,children:m(`settings.noProvidersTitle`)}),(0,Y.jsx)(`p`,{className:`text-xs mb-3`,children:m(`settings.noProvidersDescription`)}),(0,Y.jsxs)(K,{size:`sm`,onClick:()=>{Wt(null),Bt(!0)},children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.addProvider`)]})]})})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2 mb-2`,id:`card-templates`,children:[(0,Y.jsx)(ln,{className:`w-5 h-5 text-bambu-green`}),m(`settings.messageTemplates`)]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:m(`settings.messageTemplatesDescription`)}),(0,Y.jsxs)(`div`,{className:`relative mb-3`,children:[(0,Y.jsx)(Ae,{className:`w-4 h-4 text-bambu-gray absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none`}),(0,Y.jsx)(`input`,{type:`text`,value:Qt,onChange:e=>en(e.target.value),placeholder:m(`settings.filterTemplates`,`Filter templates…`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),Qt&&(0,Y.jsx)(`button`,{onClick:()=>en(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-bambu-gray hover:text-white`,"aria-label":`Clear filter`,children:(0,Y.jsx)(Re,{className:`w-3.5 h-3.5`})})]}),Fi?(0,Y.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,Y.jsx)(R,{className:`w-6 h-6 text-bambu-green animate-spin`})}):Pi&&Pi.length>0?(()=>{let e=Qt.trim().toLowerCase(),t=[...Pi].sort((e,t)=>e.name.localeCompare(t.name)).filter(t=>!e||t.name.toLowerCase().includes(e)||(t.title_template||``).toLowerCase().includes(e));return t.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray italic text-center py-6`,children:m(`settings.noTemplatesMatch`,`No templates match your filter.`)}):(0,Y.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,Y.jsx)(G,{className:`cursor-pointer hover:border-bambu-green/50 transition-colors`,onClick:()=>Jt(e),children:(0,Y.jsx)(W,{className:`py-2.5 px-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium text-sm truncate`,children:e.name}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs truncate mt-0.5`,children:e.title_template})]}),(0,Y.jsx)(`button`,{className:`p-1.5 hover:bg-bambu-dark-tertiary rounded transition-colors shrink-0 ml-2`,onClick:t=>{t.stopPropagation(),Jt(e)},children:(0,Y.jsx)(oe,{className:`w-4 h-4 text-bambu-gray`})})]})})},e.id))})})():(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-8`,children:(0,Y.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,Y.jsx)(ln,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,Y.jsx)(`p`,{className:`text-sm`,children:m(`settings.noTemplatesAvailable`)})]})})})]})]}),Tn===`camera`&&(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[(0,Y.jsxs)(G,{id:`card-camera`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)($e,{className:`w-5 h-5 text-bambu-green`}),m(`settings.camera`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`section`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:m(`settings.cameraLight`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.cameraLightHint`)})]}),(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":m(`settings.cameraLight`),className:`inline-flex rounded-lg border border-bambu-dark-tertiary overflow-hidden`,children:La.map(e=>(0,Y.jsxs)(`label`,{className:`cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`camera-light-mode`,value:e,checked:wo===e,onChange:()=>$(`camera_light_mode`,e),className:`sr-only peer`}),(0,Y.jsx)(`span`,{className:`block px-3 py-1.5 text-xs text-bambu-gray peer-checked:bg-bambu-green peer-checked:text-white peer-focus-visible:ring-2 peer-focus-visible:ring-inset peer-focus-visible:ring-white hover:text-white`,children:m(`settings.cameraLightMode_${e}`)})]},e))}),wo!==`off`&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`label`,{htmlFor:`camera-light-delay`,className:`text-xs text-bambu-gray`,children:m(`settings.cameraLightDelay`)}),(0,Y.jsx)(ct,{id:`camera-light-delay`,min:0,max:5,step:`0.5`,integer:!1,fallback:2,value:H.camera_light_delay??2,onChange:e=>$(`camera_light_delay`,e),className:`w-16 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs text-center focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:m(`settings.cameraLightDelayUnit`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray opacity-75 mt-1`,children:m(`settings.cameraLightDelayHint`)})]}),wo===`selected`&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,"data-testid":`camera-light-printers`,children:[To.length===0&&(0,Y.jsx)(`span`,{className:`text-xs text-bambu-gray italic`,children:m(`settings.cameraLightNoneSelected`)}),To.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-bambu-dark-tertiary text-xs text-white`,children:[e.name,(0,Y.jsx)(`button`,{type:`button`,onClick:()=>_o(e.id,{lightAuto:!1}),"aria-label":m(`settings.cameraLightRemovePrinter`,{name:e.name}),className:`p-0.5 rounded-full text-bambu-gray hover:text-white`,children:(0,Y.jsx)(Re,{className:`w-3 h-3`})})]},e.id)),(0,Y.jsx)(ka,{printers:(wi??[]).filter(e=>!e.camera_light_auto),onPick:e=>_o(e.id,{lightAuto:!0}),label:m(`settings.cameraLightAddPrinter`)})]})]}),(0,Y.jsxs)(`section`,{className:`space-y-2 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:m(`settings.externalCameras`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.externalCamerasDescription`)})]}),Eo.length>0&&(0,Y.jsx)(`div`,{className:`rounded-lg border border-bambu-dark-tertiary`,"data-testid":`external-camera-list`,children:Eo.map(e=>{let t=fo===e.id,n=Ra(e);return(0,Y.jsxs)(`div`,{className:`border-b border-bambu-dark-tertiary last:border-b-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>po(t?null:e.id),"aria-expanded":t,"aria-label":`${m(`settings.cameraShowSettings`)}: ${e.name}`,className:`flex flex-1 min-w-0 items-center gap-2 text-left`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block text-sm text-white truncate`,children:e.name}),(0,Y.jsx)(`span`,{className:`block text-[11px] text-bambu-gray truncate`,title:n,children:n})]}),(0,Y.jsx)(E,{className:`w-4 h-4 shrink-0 text-bambu-gray transition-transform ${t?`rotate-180`:``}`})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{_o(e.id,{enabled:!1}),t&&po(null)},"aria-label":m(`settings.externalCameraRemove`,{name:e.name}),title:m(`settings.externalCameraRemove`,{name:e.name}),className:`p-1 rounded text-bambu-gray hover:text-red-400`,children:(0,Y.jsx)(qe,{className:`w-3.5 h-3.5`})})]}),t&&(0,Y.jsxs)(`div`,{className:`space-y-2 px-2 pb-3 pt-1 bg-bambu-dark/40`,children:[(0,Y.jsx)(`input`,{type:`text`,"aria-label":`${m(`settings.cameraPlaceholderUrl`)}: ${e.name}`,placeholder:e.external_camera_type===`usb`?m(`settings.cameraPlaceholderUsb`):m(`settings.cameraPlaceholderUrl`),value:io[e.id]??e.external_camera_url??``,onChange:t=>ho(e.id,t.target.value),className:`w-full px-2 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`select`,{value:e.external_camera_type||`mjpeg`,onChange:t=>_o(e.id,{type:t.target.value}),className:`flex-1 min-w-0 px-2 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:`mjpeg`,children:m(`settings.cameraTypeMjpeg`)}),(0,Y.jsx)(`option`,{value:`rtsp`,children:m(`settings.cameraTypeRtsp`)}),(0,Y.jsx)(`option`,{value:`snapshot`,children:m(`settings.cameraTypeSnapshot`)}),(0,Y.jsx)(`option`,{value:`usb`,children:m(`settings.cameraTypeUsb`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-1 text-xs text-bambu-gray`,children:[m(`settings.cameraRotation`),(0,Y.jsxs)(`select`,{value:e.camera_rotation||0,onChange:t=>_o(e.id,{rotation:parseInt(t.target.value)}),className:`px-1.5 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs focus:border-bambu-green focus:outline-none`,children:[(0,Y.jsx)(`option`,{value:0,children:`0°`}),(0,Y.jsx)(`option`,{value:90,children:`90°`}),(0,Y.jsx)(`option`,{value:180,children:`180°`}),(0,Y.jsx)(`option`,{value:270,children:`270°`})]})]}),(0,Y.jsx)(K,{size:`sm`,variant:`secondary`,onClick:()=>ro(e.id,io[e.id]??e.external_camera_url??``,e.external_camera_type||`mjpeg`),disabled:Zr[e.id]||!(io[e.id]??e.external_camera_url),children:Zr[e.id]?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):m(`settings.test`)})]}),Yr[e.id]&&(0,Y.jsx)(`div`,{className:`text-xs flex items-center gap-1 ${Yr[e.id]?.success?`text-green-500`:`text-red-500`}`,children:Yr[e.id]?.success?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j,{className:`w-3 h-3`}),m(`settings.connected`),Yr[e.id]?.resolution&&` (${Yr[e.id]?.resolution})`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{className:`w-3 h-3`}),Yr[e.id]?.error||m(`settings.toast.connectionFailed`)]})}),(e.external_camera_type===`mjpeg`||e.external_camera_type===`rtsp`||e.external_camera_type===`usb`)&&(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsxs)(`label`,{className:`text-xs text-bambu-gray flex items-center gap-1`,children:[m(`settings.cameraSnapshotUrl`,`Snapshot URL (optional)`),(0,Y.jsx)(`span`,{title:m(`settings.cameraSnapshotUrlHelp`),className:`cursor-help`,"aria-label":m(`settings.cameraSnapshotUrlHelp`),children:(0,Y.jsx)(A,{className:`w-3 h-3`})})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`input`,{type:`text`,placeholder:m(`settings.cameraSnapshotUrlPlaceholder`,`http://192.168.1.61:1984/api/frame.jpeg?src=printer`),value:co[e.id]??e.external_camera_snapshot_url??``,onChange:t=>go(e.id,t.target.value),className:`flex-1 min-w-0 px-2 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(K,{size:`sm`,variant:`secondary`,onClick:()=>ro(e.id,co[e.id]??e.external_camera_snapshot_url??``,`snapshot`),disabled:Zr[e.id]||!(co[e.id]??e.external_camera_snapshot_url),children:Zr[e.id]?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):m(`settings.test`)})]})]})]})]},e.id)})}),wi&&wi.length>0?(0,Y.jsx)(ka,{printers:wi.filter(e=>!e.external_camera_enabled),onPick:e=>{_o(e.id,{enabled:!0}),po(e.id)},label:m(`settings.externalCameraAdd`)}):(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray italic`,children:m(`settings.noPrintersConfigured`)})]})]})]}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-camera-tokens`,children:[(0,Y.jsx)($e,{className:`w-4 h-4 text-bambu-green`}),m(`cameraTokens.title`,`Camera API Tokens`)]})}),(0,Y.jsx)(W,{children:(0,Y.jsx)(qn,{},e)})]})]}),(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-stream-overlay`,children:[(0,Y.jsx)(Te,{className:`w-4 h-4 text-bambu-green`}),m(`streamOverlay.builder.title`,`Streaming Overlay`)]})}),(0,Y.jsx)(W,{children:(0,Y.jsx)(ur,{onTokenCreated:()=>t(e=>e+1)})})]})})]}),Tn===`apikeys`&&(0,Y.jsxs)(`div`,{className:k(`api_keys:read`)?`grid grid-cols-1 lg:grid-cols-2 gap-4`:`grid grid-cols-1 gap-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[k(`api_keys:read`)&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-6`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-createapi`,children:[(0,Y.jsx)(Kt,{className:`w-5 h-5 text-bambu-green`}),m(`settings.apiKeys`)]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:m(`settings.apiKeysDescription`)})]}),(0,Y.jsxs)(K,{size:`sm`,onClick:()=>zn(!0),className:`flex-shrink-0`,children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.createKey`)]})]}),Wn&&(0,Y.jsx)(G,{className:`mb-6 border-bambu-green`,children:(0,Y.jsx)(W,{className:`py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(j,{className:`w-5 h-5 text-bambu-green flex-shrink-0 mt-0.5`}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium mb-1`,children:m(`settings.apiKeyCreated`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:m(`settings.apiKeyCopyWarning`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 bg-bambu-dark rounded-lg p-2`,children:[(0,Y.jsx)(`code`,{className:`flex-1 text-sm text-bambu-green font-mono break-all`,children:Wn}),(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:async()=>{try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(Wn);else{let e=document.createElement(`textarea`);e.value=Wn,e.style.position=`fixed`,e.style.left=`-999999px`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}v(m(`settings.toast.keyCopied`))}catch{v(m(`settings.toast.copyFailed`),`error`)}},children:(0,Y.jsx)(N,{className:`w-4 h-4`})})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2 mt-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>{Qn(Wn),v(m(`settings.toast.keyAddedToBrowser`))},children:m(`settings.useInApiBrowser`)}),(0,Y.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>Jn(!0),children:[(0,Y.jsx)(Oe,{className:`w-4 h-4`}),m(`settings.apiKeyQrButton`)]}),(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>{Jn(!1),Gn(null)},children:m(`common.dismiss`)})]})]})]})})}),Kn&&Wn&&(0,Y.jsx)(li,{apiKey:Wn,baseUrl:H?.external_url||void 0,onClose:()=>Jn(!1)}),Rn&&(0,Y.jsxs)(G,{className:`mb-6`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h3`,{className:`text-base font-semibold text-white`,children:m(`settings.createNewApiKey`)})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.keyName`)}),(0,Y.jsx)(`input`,{type:`text`,value:Bn,onChange:e=>Vn(e.target.value),placeholder:m(`settings.keyNamePlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:m(`common.permissions`)}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_read_status,onChange:e=>Un(t=>({...t,can_read_status:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.readStatus`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.readStatusDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_queue,onChange:e=>Un(t=>({...t,can_queue:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.manageQueue`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.manageQueueDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_control_printer,onChange:e=>Un(t=>({...t,can_control_printer:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.controlPrinter`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.controlPrinterDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_manage_library,onChange:e=>Un(t=>({...t,can_manage_library:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.manageLibrary`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.manageLibraryDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_manage_inventory,onChange:e=>Un(t=>({...t,can_manage_inventory:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.manageInventory`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.manageInventoryDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_manage_maintenance,onChange:e=>Un(t=>({...t,can_manage_maintenance:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.manageMaintenance`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.manageMaintenanceDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_manage_archives,onChange:e=>Un(t=>({...t,can_manage_archives:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.manageArchives`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.manageArchivesDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_manage_projects,onChange:e=>Un(t=>({...t,can_manage_projects:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.manageProjects`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.manageProjectsDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_access_cloud,onChange:e=>Un(t=>({...t,can_access_cloud:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.cloudAccess`,`Allow cloud access`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.cloudAccessDescription`,`Read Bambu Cloud presets and filaments on your behalf. Requires you to be signed into Bambu Cloud.`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_update_energy_cost,onChange:e=>Un(t=>({...t,can_update_energy_cost:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.updateEnergyCost`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.updateEnergyCostDescription`)})]})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Hn.can_send_notifications,onChange:e=>Un(t=>({...t,can_send_notifications:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-white`,children:m(`settings.sendNotifications`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.sendNotificationsDescription`)})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 pt-2`,children:[(0,Y.jsxs)(K,{onClick:()=>Si.mutate({name:Bn||m(`settings.unnamedKey`),...Hn}),disabled:Si.isPending,children:[Si.isPending?(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}):(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.createKey`)]}),(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>zn(!1),children:m(`common.cancel`)})]})]})]}),xi?(0,Y.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,Y.jsx)(R,{className:`w-8 h-8 text-bambu-green animate-spin`})}):bi&&bi.length>0?(0,Y.jsx)(`div`,{className:`space-y-3`,children:bi.map(e=>(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(Kt,{className:`w-5 h-5 ${e.enabled?`text-bambu-green`:`text-bambu-gray`}`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white font-medium`,children:e.name}),(0,Y.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[e.key_prefix,`••••••••`,e.last_used&&` · ${m(`settings.lastUsed`)}: ${He(e.last_used)}`]})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-1 text-xs flex-wrap justify-end`,children:[e.can_read_status&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 rounded`,children:m(`settings.read`)}),e.can_queue&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 rounded`,children:m(`queue.title`)}),e.can_control_printer&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400 rounded`,children:m(`settings.control`)}),e.can_manage_library&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-400 rounded`,children:m(`settings.libraryBadge`)}),e.can_manage_inventory&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-pink-100 dark:bg-pink-500/20 text-pink-700 dark:text-pink-400 rounded`,children:m(`settings.inventoryBadge`)}),e.can_manage_maintenance&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400 rounded`,children:m(`settings.maintenanceBadge`)}),e.can_manage_archives&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-indigo-100 dark:bg-indigo-500/20 text-indigo-700 dark:text-indigo-400 rounded`,children:m(`settings.archivesBadge`)}),e.can_manage_projects&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-lime-100 dark:bg-lime-500/20 text-lime-700 dark:text-lime-400 rounded`,children:m(`settings.projectsBadge`)}),e.can_access_cloud&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400 rounded`,children:m(`settings.cloudBadge`,`Cloud`)}),e.can_update_energy_cost&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 rounded`,children:m(`settings.energyCostBadge`)}),e.can_send_notifications&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400 rounded`,children:m(`settings.sendNotificationsBadge`)}),e.user_id===null&&(0,Y.jsx)(`span`,{className:`px-1.5 py-0.5 bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 rounded`,title:m(`settings.legacyKeyTooltip`,`Created before per-user ownership; recreate to use cloud access`),children:m(`settings.legacyKey`,`Legacy`)})]}),(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>Xn(e.id),children:(0,Y.jsx)(qe,{className:`w-4 h-4 text-red-600 dark:text-red-400`})})]})]})})},e.id))}):(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-12`,children:(0,Y.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,Y.jsx)(Kt,{className:`w-16 h-16 mx-auto mb-4 opacity-30`}),(0,Y.jsx)(`p`,{className:`text-lg font-medium text-white mb-2`,children:m(`settings.apiKeysEmptyTitle`)}),(0,Y.jsx)(`p`,{className:`text-sm mb-4`,children:m(`settings.apiKeysEmptyDescription`)}),(0,Y.jsxs)(K,{onClick:()=>zn(!0),children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.createFirstKey`)]})]})})}),(0,Y.jsxs)(G,{className:`mt-6`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h3`,{className:`text-base font-semibold text-white`,id:`card-webhooks`,children:m(`settings.webhookEndpoints`)})}),(0,Y.jsxs)(W,{className:`space-y-3 text-sm`,children:[(0,Y.jsx)(`p`,{className:`text-bambu-gray`,children:m(`settings.webhookApiKeyHint`)}),(0,Y.jsxs)(`div`,{className:`space-y-2 font-mono text-xs`,children:[(0,Y.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,Y.jsx)(`span`,{className:`text-blue-700 dark:text-blue-400`,children:`GET`}),` `,(0,Y.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/status`}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,m(`settings.webhook.getAllStatus`)]})]}),(0,Y.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,Y.jsx)(`span`,{className:`text-blue-700 dark:text-blue-400`,children:`GET`}),` `,(0,Y.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/status/:id`}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,m(`settings.webhook.getSpecificStatus`)]})]}),(0,Y.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,Y.jsx)(`span`,{className:`text-green-700 dark:text-green-400`,children:`POST`}),` `,(0,Y.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/queue`}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,m(`settings.webhook.addToQueue`)]})]}),(0,Y.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,Y.jsx)(`span`,{className:`text-orange-700 dark:text-orange-400`,children:`POST`}),` `,(0,Y.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/printer/:id/pause`}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,m(`settings.webhook.pausePrint`)]})]}),(0,Y.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,Y.jsx)(`span`,{className:`text-orange-700 dark:text-orange-400`,children:`POST`}),` `,(0,Y.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/printer/:id/resume`}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,m(`settings.webhook.resumePrint`)]})]}),(0,Y.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`POST`}),` `,(0,Y.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/printer/:id/stop`}),(0,Y.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,m(`settings.webhook.stopPrint`)]})]})]})]})]})]}),k(`settings:update`)&&(0,Y.jsxs)(G,{className:`mt-6`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-connected-apps`,children:[(0,Y.jsx)(ae,{className:`w-4 h-4 text-bambu-green`}),m(`connectedApps.title`)]})}),(0,Y.jsx)(W,{children:(0,Y.jsx)(er,{})})]})]}),k(`api_keys:read`)&&(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-6`,children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-apibrowser`,children:[(0,Y.jsx)(zt,{className:`w-5 h-5 text-bambu-green`}),m(`settings.apiBrowser`)]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:m(`settings.apiBrowserDescription`)})]}),(0,Y.jsx)(G,{className:`mb-4`,children:(0,Y.jsxs)(W,{className:`py-3`,children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:m(`settings.apiKeyForTesting`)}),(0,Y.jsx)(`input`,{type:`text`,value:Zn,onChange:e=>Qn(e.target.value),placeholder:m(`settings.apiKeyPlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white font-mono text-sm focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:m(`settings.apiKeyHint`)})]})}),(0,Y.jsx)(wa,{apiKey:Zn})]})]}),Tn===`virtual-printer`&&(0,Y.jsx)(`div`,{id:`card-vp`,children:(0,Y.jsx)(ki,{})}),Tn===`spoolbuddy`&&(0,Y.jsx)(`div`,{id:`card-spoolbuddy`,children:(0,Y.jsx)(Ni,{})}),Tn===`queue`&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-1 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`button`,{onClick:()=>Ln(`dispatch`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Nn===`dispatch`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(Zt,{className:`w-4 h-4`}),m(`settings.tabs.queueDispatch`,`Queue & Dispatch`)]}),(0,Y.jsxs)(`button`,{onClick:()=>Ln(`pipelines`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Nn===`pipelines`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(Le,{className:`w-4 h-4`}),m(`settings.tabs.queuePipelines`,`Pipelines`)]})]}),Nn===`pipelines`&&(0,Y.jsx)(Pn,{}),Nn===`dispatch`&&H&&(0,Y.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,Y.jsxs)(`div`,{className:`lg:w-1/2 space-y-3`,children:[(0,Y.jsxs)(G,{id:`card-print-options`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Zt,{className:`w-4 h-4 text-bambu-green`}),m(`settings.defaultPrintOptions`,`Default Print Options`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.defaultPrintOptionsDescription`,`Set default values for print options when starting new prints. These can be overridden per print in the print dialog.`)}),[{key:`default_bed_levelling`,label:m(`settings.defaultBedLevelling`,`Bed Levelling`),desc:m(`settings.defaultBedLevellingDesc`,`Auto-level bed before print`),fallback:!0,dualNozzleOnly:!1,tristate:!0},{key:`default_flow_cali`,label:m(`settings.defaultFlowCali`,`Flow Calibration`),desc:m(`settings.defaultFlowCaliDesc`,`Calibrate extrusion flow`),fallback:!1,dualNozzleOnly:!1,tristate:!0},{key:`default_vibration_cali`,label:m(`settings.defaultVibrationCali`,`Vibration Calibration`),desc:m(`settings.defaultVibrationCaliDesc`,`Reduce ringing artifacts`),fallback:!0,dualNozzleOnly:!1,tristate:!1},{key:`default_layer_inspect`,label:m(`settings.defaultLayerInspect`,`First Layer Inspection`),desc:m(`settings.defaultLayerInspectDesc`,`AI inspection of first layer`),fallback:!1,dualNozzleOnly:!1,tristate:!1},{key:`default_timelapse`,label:m(`settings.defaultTimelapse`,`Timelapse`),desc:m(`settings.defaultTimelapseDesc`,`Record timelapse video`),fallback:!1,dualNozzleOnly:!1,tristate:!1},{key:`default_nozzle_offset_cali`,label:m(`settings.defaultNozzleOffsetCali`,`Nozzle Offset Calibration`),desc:m(`settings.defaultNozzleOffsetCaliDesc`,`Calibrate nozzle offsets between extruders`),fallback:!0,dualNozzleOnly:!0,tristate:!0},{key:`default_confirm_outcome`,label:m(`settings.defaultConfirmOutcome`,`Ask for Outcome`),desc:m(`settings.defaultConfirmOutcomeDesc`,`Ask whether the print came out well after it completes`),fallback:!1,dualNozzleOnly:!1,tristate:!1}].filter(({dualNozzleOnly:e})=>!e||(wi||[]).some(e=>e.nozzle_count===2)).map(({key:e,label:t,desc:n,fallback:r,tristate:i})=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:t}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:n})]}),i?(0,Y.jsx)(`div`,{className:`flex gap-1 shrink-0`,children:cn.map(t=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>$(e,t),className:`px-2.5 py-1 text-xs rounded transition-colors ${(H[e]??`auto`)===t?pt[t]:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:m(`settings.calibrationMode_${t}`)},t))}):(0,Y.jsx)(`div`,{className:`flex gap-1 shrink-0`,children:[`off`,`on`].map(t=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>$(e,t===`on`),className:`px-2.5 py-1 text-xs rounded transition-colors ${(H[e]??r?`on`:`off`)===t?pt[t]:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:m(`settings.calibrationMode_${t}`)},t))})]},e)),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:m(`settings.confirmOutcomeExternalPrints`,`Also ask for prints started outside Bambuddy`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.confirmOutcomeExternalPrintsDesc`,`Prints started at the printer, in Bambu Studio or in the Handy app are archived by Bambuddy too. With this on, they get the same outcome prompt as queued prints.`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer shrink-0`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.confirm_outcome_external_prints??!1,onChange:e=>$(`confirm_outcome_external_prints`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,Y.jsxs)(G,{id:`card-plate`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Me,{className:`w-4 h-4 text-bambu-green`}),m(`settings.plateClear`,`Plate-Clear Confirmation`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:m(`settings.requirePlateClear`,`Require plate-clear confirmation`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.requirePlateClearDescription`,`When enabled, the scheduler waits for per-printer plate-clear confirmation before starting queued prints on printers with finished jobs. Disabling this also hides the plate status badge and the "Mark plate as cleared" button on printer cards.`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.require_plate_clear??!1,onChange:e=>$(`require_plate_clear`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:m(`settings.confirmDefaultGoodOnPlateClear`,`Count unanswered outcomes as good on plate release`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.confirmDefaultGoodOnPlateClearDescription`,`When the plate is released (manually or by the next queued print) and the print's outcome prompt is still unanswered, record it as a good part automatically. The print then counts as good as soon as the plate is released; a Telegram or link answer after that only shows the recorded result.`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.confirm_default_good_on_plate_clear??!1,onChange:e=>$(`confirm_default_good_on_plate_clear`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,Y.jsxs)(G,{id:`card-temp-fan-presets`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Fe,{className:`w-4 h-4 text-bambu-green`}),m(`settings.tempFanPresetsTitle`,`Temperature & Fan Presets`)]})}),(0,Y.jsxs)(W,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.tempFanPresetsDescription`,`Customize the quick-select values shown in printer-card temperature and fan-speed popovers. The Off button is always shown.`)}),Ce.map(e=>{let t=xe(H?.[e.key]??``,e.defaults,e.lo,e.hi),n=e.unit===`C`?`°C`:`%`;return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,Y.jsxs)(`label`,{className:`text-sm text-white`,children:[m(`settings.${{nozzle_temp_presets:`tempFanPresetsNozzle`,bed_temp_presets:`tempFanPresetsBed`,chamber_temp_presets:`tempFanPresetsChamber`,fan_speed_presets:`tempFanPresetsFan`}[e.key]}`,{nozzle_temp_presets:`Nozzle temperature`,bed_temp_presets:`Bed temperature`,chamber_temp_presets:`Chamber temperature`,fan_speed_presets:`Fan speed`}[e.key]),` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray text-xs`,children:[`(`,n,` · `,e.lo,`–`,e.hi,`)`]})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>$(e.key,``),title:m(`settings.tempFanPresetsReset`,`Reset to defaults`),className:`text-bambu-gray hover:text-white transition-colors p-1 rounded hover:bg-bambu-dark-tertiary`,children:(0,Y.jsx)(nt,{className:`w-3.5 h-3.5`})})]}),(0,Y.jsx)(`div`,{className:`flex gap-2`,children:[0,1,2].map(n=>(0,Y.jsx)(`input`,{type:`number`,min:e.lo,max:e.hi,value:t[n],onChange:r=>{let i=[t[0],t[1],t[2]],a=parseInt(r.target.value,10);i[n]=Math.max(e.lo,Math.min(e.hi,Number.isFinite(a)?a:e.lo)),$(e.key,JSON.stringify(i))},className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`},n))})]},e.key)})]})]}),(0,Y.jsxs)(G,{id:`card-staggered`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(At,{className:`w-4 h-4 text-bambu-green`}),m(`settings.staggeredStart`,`Staggered Start`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.staggeredStartDescription`,`Default group size and interval when staggering multi-printer batch starts. Can be overridden per batch in the print modal.`)}),(0,Y.jsxs)(`div`,{className:`flex gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.staggerGroupSize`,`Group size`)}),(0,Y.jsx)(ct,{min:1,max:50,value:H.stagger_group_size??2,onChange:e=>$(`stagger_group_size`,e),fallback:1,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.staggerGroupSizeHelp`,`Printers to start simultaneously per group`)})]}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.staggerInterval`,`Interval (minutes)`)}),(0,Y.jsx)(ct,{min:1,max:60,value:H.stagger_interval_minutes??5,onChange:e=>$(`stagger_interval_minutes`,e),fallback:1,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.staggerIntervalHelp`,`Delay between each group starting`)})]})]})]})]}),(0,Y.jsxs)(G,{id:`card-concurrent-uploads`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(yn,{className:`w-4 h-4 text-bambu-green`}),m(`settings.concurrentUploadsTitle`,`Concurrent Uploads`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.concurrentUploadsDescription`,`How many printers the queue may send files to at the same time. Printers receive files slowly (a large print can take several minutes), and each one waits its turn — so on a bigger fleet, raising this is what stops the last printer in a batch from waiting out every transfer before it. Lower it if your network or Bambuddy host struggles with parallel transfers.`)}),(0,Y.jsxs)(`div`,{className:`w-full sm:w-1/2`,children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.concurrentUploadsLabel`,`Printers uploaded to at once`)}),(0,Y.jsx)(ct,{min:1,max:16,value:H.queue_max_concurrent_uploads??4,onChange:e=>$(`queue_max_concurrent_uploads`,e),fallback:1,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.concurrentUploadsHelp`,`1 sends to one printer at a time (the old behaviour). Default is 4.`)})]})]})]}),(0,Y.jsxs)(G,{id:`card-preheat`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Dt,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),m(`settings.preheatTitle`,`Preheat & Heat Soak`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.preheatDescription`,`Heat the bed (and chamber, if supported) and hold at temperature before each queued print starts. Helpful for engineering filaments (PA, ABS) on printers without an active chamber heater — the bed warms the chamber by radiation while the soak timer runs. The bed target is read from the print file; chamber behaviour depends on printer model.`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:m(`settings.preheatEnabled`,`Enable preheat & soak`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.preheatEnabledDesc`,`When off, queued prints dispatch immediately.`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.preheat_enabled??!1,onChange:e=>$(`preheat_enabled`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.preheatMaxWait`,`Max wait (seconds)`)}),(0,Y.jsx)(ct,{min:60,max:3600,value:H.preheat_max_wait_seconds??900,onChange:e=>$(`preheat_max_wait_seconds`,e),fallback:900,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(H.preheat_enabled??!1)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.preheatMaxWaitHelp`,`Cap on the chamber warm-up phase before falling through.`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.preheatSoak`,`Soak (seconds)`)}),(0,Y.jsx)(ct,{min:0,max:1800,value:H.preheat_soak_seconds??300,onChange:e=>$(`preheat_soak_seconds`,e),fallback:0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(H.preheat_enabled??!1)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.preheatSoakHelp`,`Hold time after target reached or max-wait elapsed.`)})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t border-bambu-dark-tertiary/50`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:m(`settings.keepBedWarm`,`Keep bed warm between prints`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.keepBedWarmDesc`,`While awaiting plate-clear, hold the bed at the keep-warm temperature below so the chamber stays hot — or at the next print's own bed temperature when that is higher. Only applies when the next print needs chamber heating (ASA, ABS, PA, PC etc.). Requires plate-clear confirmation to be enabled.`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.queue_keep_bed_warm??!1,onChange:e=>$(`queue_keep_bed_warm`,e.target.checked),className:`sr-only peer`,disabled:!(H.preheat_enabled??!1)||!(H.require_plate_clear??!1)}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green peer-disabled:opacity-50 peer-disabled:cursor-not-allowed`})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mt-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.keepWarmBedTemp`,`Keep-warm bed temperature (°C)`)}),(0,Y.jsx)(ct,{min:40,max:110,value:H.queue_keep_warm_bed_temp??90,onChange:e=>$(`queue_keep_warm_bed_temp`,e),fallback:90,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(H.preheat_enabled??!1)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.keepWarmBedTempHelp`,`Used whenever the bed's job is to heat the chamber — the keep-warm hold, and preheat when the print file carries no bed temperature. A higher bed temperature from the print file always wins.`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.keepWarmMaxMinutes`,`Stop keeping warm after (minutes)`)}),(0,Y.jsx)(ct,{min:5,max:480,value:H.queue_keep_warm_max_minutes??120,onChange:e=>$(`queue_keep_warm_max_minutes`,e),fallback:120,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(H.queue_keep_bed_warm??!1)||!(H.preheat_enabled??!1)||!(H.require_plate_clear??!1)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.keepWarmMaxMinutesHelp`,`If the plate is not cleared within this time, the heaters are switched off rather than held indefinitely.`)})]})]}),(0,Y.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary/50`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,Y.jsx)(`label`,{className:`text-sm text-white`,children:m(`settings.preheatFilamentTargetsLabel`,`Per-filament chamber target (°C)`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>$(`preheat_filament_targets`,``),title:m(`settings.preheatFilamentTargetsReset`,`Reset to defaults`),className:`text-bambu-gray hover:text-white transition-colors p-1 rounded hover:bg-bambu-dark-tertiary`,children:(0,Y.jsx)(nt,{className:`w-3.5 h-3.5`})})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:m(`settings.preheatFilamentTargetsHint`,`Bambuddy picks the highest target across the loaded AMS slots; PLA-only prints derive 0 and skip the chamber phase automatically.`)}),(0,Y.jsx)(jn,{value:H.preheat_filament_targets??``,onChange:e=>$(`preheat_filament_targets`,e),disabled:!(H.preheat_enabled??!1)})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-bambu-gray pt-1 border-t border-bambu-dark-tertiary/50`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-bambu-gray/90`,children:m(`settings.preheatHardwareTitle`,`Per-printer behaviour:`)}),` `,m(`settings.preheatHardwareDetail`,`H2C/H2D/H2D Pro/H2S/X2D/X1E actively heat the chamber via M141. X1C/P2S read chamber temp but rely on bed-radiation heating. P1S/P1P/A1/A1 Mini have no chamber sensor — only the soak timer applies.`)]})]})]})]}),(0,Y.jsxs)(`div`,{className:`lg:w-1/2 space-y-3`,children:[(0,Y.jsxs)(G,{id:`card-pipelines`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Le,{className:`w-4 h-4 text-bambu-green`}),m(`settings.pipelineLimits.title`,`Slicer Pipeline limits`)]})}),(0,Y.jsx)(W,{className:`space-y-2`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white`,children:m(`settings.pipelineLimits.maxCopiesLabel`,`Max copies per run`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.pipelineLimits.maxCopiesDesc`,`Upper bound on the copies operators can request when running a pipeline. Server-side hard cap is 1000.`)})]}),(0,Y.jsx)(`input`,{type:`number`,min:1,max:1e3,value:H.pipeline_max_copies??50,onChange:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||$(`pipeline_max_copies`,Math.max(1,Math.min(1e3,t)))},"aria-label":m(`settings.pipelineLimits.maxCopiesLabel`,`Max copies per run`),className:`w-24 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm`})]})})]}),(0,Y.jsxs)(G,{id:`card-slicer`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(M,{className:`w-4 h-4 text-bambu-green`}),m(`settings.slicerCard`,`Slicer`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[Da()&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.sliceEngine`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`select`,{value:Oa(H.slice_engine),onChange:e=>$(`slice_engine`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:Ea().map(e=>(0,Y.jsx)(`option`,{value:e.id,children:m(e.labelKey)},e.id))}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(Ea().find(e=>e.id===Oa(H.slice_engine))?.descriptionKey??`settings.sliceEngineSidecarHint`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.preferredSlicer`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsxs)(`select`,{value:H.preferred_slicer??`bambu_studio`,onChange:e=>$(`preferred_slicer`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,Y.jsx)(`option`,{value:`bambu_studio`,children:m(`settings.slicerBambuStudio`)}),(0,Y.jsx)(`option`,{value:`orcaslicer`,children:m(`settings.slicerOrcaSlicer`)})]}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.preferredSlicerDescription`)}),(H.preferred_slicer??`bambu_studio`)===`orcaslicer`&&(0,Y.jsx)(`div`,{role:`alert`,className:`text-xs text-amber-800 dark:text-amber-200 bg-amber-50 dark:bg-amber-900/20 border border-amber-300 dark:border-amber-700/40 rounded p-2 mt-2`,children:m(`settings.orcaslicerKnownIssuesWarning`,`OrcaSlicer 2.3.2 / 2.4.0-dev have known CLI bugs that block slicing many Bambu-authored 3MFs — see upstream issues #12426 (segfault on painted multi-extruder files) and #13386 (parameter-range strict-validation reject). Bambu Studio is recommended until the upstream fixes land.`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.openInSlicerLabel`,`Open in Slicer`)}),(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsxs)(`select`,{value:H.open_in_slicer??``,onChange:e=>$(`open_in_slicer`,e.target.value===``?null:e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,Y.jsx)(`option`,{value:``,children:m(`settings.openInSlicerInherit`,`Same as API slicer`)}),(0,Y.jsx)(`option`,{value:`bambu_studio`,children:m(`settings.slicerBambuStudio`)}),(0,Y.jsx)(`option`,{value:`orcaslicer`,children:m(`settings.slicerOrcaSlicer`)})]}),(0,Y.jsx)(E,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.openInSlicerDescription`,`Desktop slicer used by the 'Open in Slicer' button. Leave on 'Same as API slicer' to inherit, or pick a different slicer to use locally.`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.useSlicerApi`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.useSlicerApiDescription`)})]}),(0,Y.jsxs)(`label`,{className:`flex items-center cursor-pointer shrink-0`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.use_slicer_api??!1,onChange:e=>$(`use_slicer_api`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`relative w-11 h-6 bg-bambu-dark-tertiary rounded-full peer peer-checked:bg-bambu-green peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-bambu-green/50 transition-colors after:content-[''] after:absolute after:top-0.5 after:left-0.5 after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-transform peer-checked:after:translate-x-5`})]})]}),(H.use_slicer_api??!1)&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:(H.preferred_slicer??`bambu_studio`)===`orcaslicer`?m(`settings.orcaslicerApiUrl`,`OrcaSlicer sidecar URL`):m(`settings.bambuStudioApiUrl`,`Bambu Studio sidecar URL`)}),(0,Y.jsx)(`input`,{type:`text`,value:((H.preferred_slicer??`bambu_studio`)===`orcaslicer`?H.orcaslicer_api_url:H.bambu_studio_api_url)??``,onChange:e=>$((H.preferred_slicer??`bambu_studio`)===`orcaslicer`?`orcaslicer_api_url`:`bambu_studio_api_url`,e.target.value),placeholder:(H.preferred_slicer??`bambu_studio`)===`orcaslicer`?`http://localhost:3003`:`http://localhost:3001`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none placeholder:text-bambu-gray/40`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.slicerApiUrlDescription`,`URL of the slicer-API sidecar container. Leave blank to use the SLICER_API_URL / BAMBU_STUDIO_API_URL env var defaults.`)})]}),(H.use_slicer_api??!1)&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.slicerStallTimeout`)}),(0,Y.jsx)(`input`,{type:`number`,min:1,max:240,value:H.slicer_stall_timeout_minutes??15,onChange:e=>$(`slicer_stall_timeout_minutes`,Number(e.target.value)),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:m(`settings.slicerStallTimeoutDescription`)})]})]})]}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-drying`,children:[(0,Y.jsx)(Dt,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),m(`settings.queueDrying`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.queueDryingDescription`)}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-white`,children:m(`settings.queueDryingEnabled`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.queueDryingEnabledDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.queue_drying_enabled??!1,onChange:e=>$(`queue_drying_enabled`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),H.queue_drying_enabled&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-white`,children:m(`settings.queueDryingBlock`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.queueDryingBlockDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.queue_drying_block??!1,onChange:e=>$(`queue_drying_block`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-amber-500`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-white`,children:m(`settings.ambientDryingEnabled`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.ambientDryingEnabledDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.ambient_drying_enabled??!1,onChange:e=>{Pe(null),$(`ambient_drying_enabled`,e.target.checked)},className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),H.ambient_drying_enabled&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-white`,children:m(`settings.ambientDryingSustainedEnabled`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.ambientDryingSustainedDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:(H.ambient_drying_sustained_minutes??0)>0,onChange:e=>{Pe(null),$(`ambient_drying_sustained_minutes`,e.target.checked?15:0)},className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),H.ambient_drying_enabled&&(H.ambient_drying_sustained_minutes??0)>0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.ambientDryingSustainedMinutes`)}),(0,Y.jsx)(`input`,{type:`number`,min:`5`,max:`240`,value:Ne??String(H.ambient_drying_sustained_minutes??15),onChange:e=>Pe(e.target.value),onBlur:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||$(`ambient_drying_sustained_minutes`,Math.max(5,Math.min(240,t))),Pe(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-white`,children:m(`settings.printDryingEnabled`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.printDryingEnabledDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.print_drying_enabled??!1,onChange:e=>$(`print_drying_enabled`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white font-medium`,children:m(`settings.dryingPresets`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.dryingPresetsDescription`)}),(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`th`,{className:`text-left py-1.5`,children:m(`settings.dryingFilament`)}),(0,Y.jsx)(`th`,{className:`text-center py-1.5`,colSpan:2,children:`AMS 2 Pro`}),(0,Y.jsx)(`th`,{className:`text-center py-1.5`,colSpan:2,children:`AMS-HT`})]})}),(0,Y.jsx)(`tbody`,{children:(()=>{let e={PLA:{n3f:45,n3s:45,n3f_hours:12,n3s_hours:12},PETG:{n3f:65,n3s:65,n3f_hours:12,n3s_hours:12},TPU:{n3f:65,n3s:75,n3f_hours:12,n3s_hours:18},ABS:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},ASA:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},PA:{n3f:65,n3s:85,n3f_hours:12,n3s_hours:12},PC:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},PVA:{n3f:65,n3s:85,n3f_hours:12,n3s_hours:18}},t={...e};try{if(H.drying_presets){let n=JSON.parse(H.drying_presets);typeof n==`object`&&n&&(t={...e,...n})}}catch{}let n=(e,n,r)=>{let i={...t,[e]:{...t[e],[n]:r}};$(`drying_presets`,JSON.stringify(i))};return Object.entries(t).map(([e,t])=>(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50`,children:[(0,Y.jsx)(`td`,{className:`py-1.5 pr-2 text-white font-medium`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 px-1`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,Y.jsx)(ct,{min:30,max:65,value:t.n3f,onChange:t=>n(e,`n3f`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})}),(0,Y.jsx)(`td`,{className:`py-1 px-1`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(ct,{min:1,max:24,value:t.n3f_hours,onChange:t=>n(e,`n3f_hours`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`h`})]})}),(0,Y.jsx)(`td`,{className:`py-1 px-1`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,Y.jsx)(ct,{min:30,max:85,value:t.n3s,onChange:t=>n(e,`n3s`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})}),(0,Y.jsx)(`td`,{className:`py-1 px-1`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(ct,{min:1,max:24,value:t.n3s_hours,onChange:t=>n(e,`n3s_hours`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`h`})]})})]},e))})()})]})})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-white font-medium`,children:m(`settings.humidityThresholds`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.humidityThresholdsDescription`)}),(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,Y.jsx)(`th`,{className:`text-left py-1.5`,children:m(`settings.dryingFilament`)}),(0,Y.jsx)(`th`,{className:`text-right py-1.5 pr-2`,children:m(`settings.humidityThresholdCol`)})]})}),(0,Y.jsx)(`tbody`,{children:(()=>{let e=H.ams_humidity_fair??60,t=[`PLA`,`PETG`,`TPU`,`ABS`,`ASA`,`PA`,`PC`,`PVA`],n={};try{if(H.ams_humidity_thresholds){let e=JSON.parse(H.ams_humidity_thresholds);typeof e==`object`&&e&&(n=e)}}catch{}let r=[{key:`default`,label:m(`settings.humidityThresholdDefault`),value:Number(n.default??e),isDefault:!0},...t.map(t=>({key:t,label:t,value:Number(n[t]??n.default??e),isDefault:!1}))],i=(e,t)=>{if(t.trim()===``){let t={...n};delete t[e],$(`ams_humidity_thresholds`,JSON.stringify(t));return}let r=parseInt(t,10);if(Number.isNaN(r))return;let i=Math.max(5,Math.min(95,r)),a={...n,[e]:i};$(`ams_humidity_thresholds`,JSON.stringify(a))};return r.map(e=>{let t=De[e.key],n=t===void 0?String(e.value):t;return(0,Y.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50`,children:[(0,Y.jsx)(`td`,{className:`py-1.5 pr-2 font-medium ${e.isDefault?`text-bambu-gray italic`:`text-white`}`,children:e.label}),(0,Y.jsx)(`td`,{className:`py-1 pr-2`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,Y.jsx)(`input`,{type:`number`,min:5,max:95,value:n,onChange:t=>je(n=>({...n,[e.key]:t.target.value})),onBlur:t=>{i(e.key,t.target.value),je(t=>{let n={...t};return delete n[e.key],n})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`%`})]})})]},e.key)})})()})]})})]})]})]}),(0,Y.jsxs)(G,{id:`card-gcode`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(Qe,{className:`w-4 h-4 text-bambu-green`}),m(`settings.gcodeInjection`,`G-code Injection`)]})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.gcodeInjectionDescription`,`Configure custom G-code to inject at the start and/or end of prints for auto-print systems like Farmloop, SwapMod, AutoClear, and Printflow 3D. Snippets are configured per printer model and applied when "Inject G-code" is enabled on a queue item.`)}),(()=>{let e=(()=>{try{return H.gcode_snippets?JSON.parse(H.gcode_snippets):{}}catch{return{}}})(),t=[...new Set((wi||[]).filter(e=>e.model).map(e=>e.model))].sort(),n=(t,n,r)=>{let i={...e};i[t]||(i[t]={start_gcode:``,end_gcode:``}),i[t][n]=r,!i[t].start_gcode&&!i[t].end_gcode&&delete i[t];let a=Object.keys(i).length>0?JSON.stringify(i):``;Ee(e=>e?{...e,gcode_snippets:a}:null),Za.current=a},r=()=>{Za.current!==null&&(to.mutate({gcode_snippets:Za.current}),Za.current=null)};return t.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray italic`,children:m(`settings.gcodeInjectionNoPrinters`,`No printers found. Add printers to configure G-code snippets.`)}):t.map(t=>{let i=e[t]||{start_gcode:``,end_gcode:``},a=!!(i.start_gcode||i.end_gcode);return(0,Y.jsx)(Rt,{defaultOpen:a,className:`border border-bambu-dark-tertiary rounded-lg px-3 py-2`,summary:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:t}),a&&(0,Y.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bambu-green/20 text-bambu-green`,children:m(`settings.gcodeConfigured`,`Configured`)})]}),children:(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.gcodeStartLabel`,`Start G-code`)}),(0,Y.jsx)(`textarea`,{value:i.start_gcode,onChange:e=>n(t,`start_gcode`,e.target.value),onBlur:r,placeholder:m(`settings.gcodeStartPlaceholder`,`G-code prepended before the print starts...`),rows:3,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono focus:outline-none focus:border-bambu-green resize-y`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:m(`settings.gcodeEndLabel`,`End G-code`)}),(0,Y.jsx)(`textarea`,{value:i.end_gcode,onChange:e=>n(t,`end_gcode`,e.target.value),onBlur:r,placeholder:m(`settings.gcodeEndPlaceholder`,`G-code appended after the print ends...`),rows:3,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono focus:outline-none focus:border-bambu-green resize-y`})]})]})},t)})})()]})]})]})]})]}),Tn===`filament`&&H&&(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,Y.jsxs)(`div`,{className:`lg:w-1/3 space-y-3`,children:[(0,Y.jsx)(hi,{}),(0,Y.jsxs)(G,{id:`card-filamentchecks`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.filamentChecks`)})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.disableFilamentWarnings`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.disableFilamentWarningsDesc`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.disable_filament_warnings,onChange:e=>$(`disable_filament_warnings`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.preferLowestFilament`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.preferLowestFilamentDesc`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1`,children:m(`settings.preferLowestFilamentBackupNote`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.prefer_lowest_filament,onChange:e=>$(`prefer_lowest_filament`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,Y.jsxs)(G,{id:`card-printmodal`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.printModal`)})}),(0,Y.jsx)(W,{className:`space-y-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.expandCustomMapping`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.expandCustomMappingDescription`)})]}),(0,Y.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.per_printer_mapping_expanded??!1,onChange:e=>$(`per_printer_mapping_expanded`,e.target.checked),className:`sr-only peer`}),(0,Y.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})})]}),(0,Y.jsxs)(G,{id:`card-amsthresholds`,children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.amsDisplayThresholds`)})}),(0,Y.jsxs)(W,{className:`space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.amsThresholdsDescription`)}),(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-white`,children:[(0,Y.jsx)(y,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,Y.jsx)(`span`,{className:`font-medium`,children:m(`settings.humidity`)})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[m(`settings.goodGreen`),` ≤`]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ct,{min:0,max:100,value:H.ams_humidity_good??40,onChange:e=>$(`ams_humidity_good`,e),fallback:40,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`%`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[m(`settings.fairOrange`),` ≤`]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ct,{min:0,max:100,value:H.ams_humidity_fair??60,onChange:e=>$(`ams_humidity_fair`,e),fallback:60,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`%`})]})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.aboveFairBad`)}),(0,Y.jsx)(`p`,{className:`text-xs text-amber-700/80 dark:text-amber-400/70`,children:m(`settings.fairAlsoDryingThreshold`)}),(H.ams_humidity_fair??60)$(`ams_temp_good`,e),integer:!1,fallback:28,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[m(`settings.fairOrange`),` ≤`]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ct,{step:`0.5`,min:0,max:60,value:H.ams_temp_fair??35,onChange:e=>$(`ams_temp_fair`,e),integer:!1,fallback:35,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.aboveFairHot`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.tempAlarmThreshold`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`number`,step:`0.5`,min:`0.5`,max:`120`,value:H.ams_temp_alarm??``,placeholder:String(H.ams_temp_fair??35),onChange:e=>{let t=e.target.value.trim(),n=parseFloat(t);$(`ams_temp_alarm`,t===``||Number.isNaN(n)?null:n)},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})]}),(H.ams_temp_alarm??1)<=0&&(0,Y.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:m(`settings.tempAlarmMustBePositive`)}),(0,Y.jsx)(`p`,{className:`text-xs text-amber-700/80 dark:text-amber-400/70`,children:m(`settings.tempAlarmSeparateFromBand`)})]}),(0,Y.jsxs)(`div`,{className:`space-y-3 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-white`,children:[(0,Y.jsx)(gt,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,Y.jsx)(`span`,{className:`font-medium`,children:m(`settings.historyRetention`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:m(`settings.keepSensorHistory`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ct,{min:1,max:365,value:H.ams_history_retention_days??30,onChange:e=>$(`ams_history_retention_days`,e),fallback:30,className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,Y.jsx)(`span`,{className:`text-bambu-gray`,children:m(`common.days`)})]})]}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m(`settings.historyRetentionDescription`)})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`lg:w-2/3 space-y-3`,children:[(0,Y.jsx)(gi,{}),(0,Y.jsx)(_i,{})]})]})}),Yn!==null&&(0,Y.jsx)(Tt,{title:m(`settings.deleteApiKeyTitle`),message:m(`settings.deleteApiKeyMessage`),confirmText:m(`settings.deleteKey`),variant:`danger`,onConfirm:()=>{Ci.mutate(Yn),Xn(null)},onCancel:()=>Xn(null)}),Be&&(0,Y.jsx)(pr,{plug:Ue,onClose:()=>{Ve(!1),We(null)}}),Ge&&(0,Y.jsx)(mr,{sensor:Ye,printers:wi??[],onClose:()=>{q(!1),Xe(null)}}),et&&(0,Y.jsx)(vr,{sensor:st,locations:Di??[],onClose:()=>{ot(!1),lt(null)}}),ut&&(0,Y.jsx)(Tr,{onClose:()=>ft(!1)}),Pt&&(0,Y.jsx)(Tt,{title:m(`locationHaSensors.deleteAllConfirm.title`),message:m(`locationHaSensors.deleteAllConfirm.message`,{location:Pt.locationName,count:Pt.sensorIds.length}),variant:`danger`,isLoading:ji.isPending,onConfirm:()=>ji.mutate(Pt.sensorIds),onCancel:()=>It(null)}),Lt&&(0,Y.jsx)(jr,{provider:Ut,onClose:()=>{Bt(!1),Wt(null)}}),qt&&(0,Y.jsx)(Mr,{template:qt,onClose:()=>Jt(null)}),J&&(0,Y.jsx)(Pr,{onClose:()=>dn(!1)}),$n&&(0,Y.jsx)(Tt,{title:m(`settings.clearNotificationLogs`),message:m(`settings.clearLogsMessage`),confirmText:m(`settings.clearLogs`),variant:`warning`,onConfirm:async()=>{tr(!1);try{v((await r.clearNotificationLogs(30)).message,`success`)}catch{v(m(`settings.toast.clearLogsFailed`),`error`)}},onCancel:()=>tr(!1)}),nr&&(0,Y.jsx)(Tt,{title:m(`settings.resetUiPreferences`),message:m(`settings.resetUiPreferencesMessage`),confirmText:m(`settings.resetPreferences`),variant:`default`,onConfirm:()=>{rr(!1),localStorage.clear(),v(m(`settings.toast.uiPreferencesReset`),`success`),setTimeout(()=>window.location.reload(),1e3)},onCancel:()=>rr(!1)}),ir&&(0,Y.jsx)(Tt,{title:`Turn All Plugs ${ir===`on`?`On`:`Off`}`,message:`This will turn ${ir===`on`?`ON`:`OFF`} all ${si?.filter(e=>e.enabled).length||0} enabled smart plugs. ${ir===`off`?`Any running printers may be affected!`:``}`,confirmText:`Turn All ${ir===`on`?`On`:`Off`}`,variant:ir===`off`?`danger`:`warning`,onConfirm:()=>{let e=ir;ar(null),Ya.mutate(e)},onCancel:()=>ar(null)}),or&&ra?.release_notes&&(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:()=>sr(!1),children:(0,Y.jsxs)(G,{className:`w-full max-w-2xl max-h-[80vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsxs)(U,{className:`flex flex-row items-center justify-between shrink-0`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[`Release Notes - v`,ra.latest_version]}),ra.release_name&&ra.release_name!==ra.latest_version&&(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:ra.release_name})]}),(0,Y.jsx)(`button`,{onClick:()=>sr(!1),className:`p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white`,children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]}),(0,Y.jsx)(W,{className:`overflow-y-auto flex-1`,children:(0,Y.jsx)(`pre`,{className:`text-sm text-bambu-gray whitespace-pre-wrap font-sans`,children:ra.release_notes})}),(0,Y.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary shrink-0 flex gap-2`,children:[ra.release_url&&(0,Y.jsx)(`a`,{href:ra.release_url,target:`_blank`,rel:`noopener noreferrer`,className:`flex-1`,children:(0,Y.jsxs)(K,{variant:`secondary`,className:`w-full`,children:[(0,Y.jsx)(Je,{className:`w-4 h-4`}),`View on GitHub`]})}),(0,Y.jsx)(K,{onClick:()=>sr(!1),className:`flex-1`,children:`Close`})]})]})}),Tn===`users`&&(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-1 border-b border-bambu-dark-tertiary`,children:[(0,Y.jsxs)(`button`,{onClick:()=>An(`users`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Mn===`users`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(Ze,{className:`w-4 h-4`}),m(`settings.tabs.users`)]}),x&&T&&(0,Y.jsxs)(`button`,{onClick:()=>An(`printer-access`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Mn===`printer-access`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(it,{className:`w-4 h-4`}),m(`printerAccess.tab`)]}),(0,Y.jsxs)(`button`,{onClick:()=>An(`email`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Mn===`email`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(Vt,{className:`w-4 h-4`}),m(`settings.tabs.emailAuth`)||`Email Authentication`,pa?.advanced_auth_enabled&&(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-green-400`})]}),(0,Y.jsxs)(`button`,{onClick:()=>An(`ldap`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Mn===`ldap`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(Me,{className:`w-4 h-4`}),m(`settings.tabs.ldap`)||`LDAP`,ma?.ldap_enabled&&(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-green-400`})]}),(0,Y.jsxs)(`button`,{onClick:()=>An(`twofa`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Mn===`twofa`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(Me,{className:`w-4 h-4`}),m(`settings.tabs.twoFa`),(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full ${ha?.totp_enabled||ha?.email_otp_enabled?`bg-green-400`:`bg-bambu-gray/40`}`})]}),T&&(0,Y.jsxs)(`button`,{onClick:()=>An(`oidc`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Mn===`oidc`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(zt,{className:`w-4 h-4`}),m(`settings.tabs.oidc`),(0,Y.jsx)(`span`,{className:`w-2 h-2 rounded-full ${_a.some(e=>e.is_enabled)?`bg-green-400`:`bg-bambu-gray/40`}`})]}),T&&(0,Y.jsxs)(`button`,{onClick:()=>An(`security`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Mn===`security`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,Y.jsx)(Me,{className:`w-4 h-4`}),m(`settings.tabs.security`)]})]}),Mn===`users`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${x?`bg-green-500/20`:`bg-gray-500/20`}`,children:x?(0,Y.jsx)(z,{className:`w-5 h-5 text-green-600 dark:text-green-400`}):(0,Y.jsx)(h,{className:`w-5 h-5 text-gray-400`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-white font-medium`,children:m(`settings.authentication`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(x?`settings.authEnabledDescription`:`settings.authDisabledDescription`)})]})]}),x?S?.is_admin&&(0,Y.jsxs)(K,{variant:`secondary`,onClick:()=>lr(!0),children:[(0,Y.jsx)(h,{className:`w-4 h-4`}),m(`common.disable`)]}):(0,Y.jsxs)(K,{onClick:()=>a(`/setup`),children:[(0,Y.jsx)(z,{className:`w-4 h-4`}),m(`common.enable`)]})]})})}),pa?.advanced_auth_enabled&&(0,Y.jsx)(G,{className:`border-blue-500/30 bg-blue-500/5`,children:(0,Y.jsx)(W,{className:`py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center bg-blue-500/20 flex-shrink-0`,children:(0,Y.jsx)(Vt,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-white font-medium`,children:m(`settings.email.advancedAuthEnabled`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:m(`settings.email.advancedAuthEnabledDesc`)})]})]})})}),x&&(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(G,{id:`card-session-policy`,children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,Y.jsx)(z,{className:`w-5 h-5 text-bambu-green`}),m(`settings.sessionPolicy.title`)]})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:m(`settings.sessionPolicy.description`)}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2 mb-4`,children:[[{hours:24,labelKey:`settings.sessionPolicy.preset24h`},{hours:168,labelKey:`settings.sessionPolicy.preset7d`},{hours:720,labelKey:`settings.sessionPolicy.preset30d`}].map(e=>{let t=(H?.session_max_hours??24)===e.hours;return(0,Y.jsx)(`button`,{type:`button`,onClick:()=>$(`session_max_hours`,e.hours),disabled:x&&!k(`settings:update`),className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${t?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark`} disabled:opacity-50 disabled:cursor-not-allowed`,children:m(e.labelKey)},e.hours)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`input`,{type:`number`,min:1,max:720,value:H?.session_max_hours??24,onChange:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||$(`session_max_hours`,Math.max(1,Math.min(720,t)))},disabled:x&&!k(`settings:update`),"aria-label":m(`settings.sessionPolicy.customHoursLabel`),className:`w-20 px-2 py-2 bg-bambu-dark-tertiary text-white text-sm rounded-lg border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:m(`settings.sessionPolicy.hoursSuffix`)})]})]}),(H?.session_max_hours??24)>24&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30`,children:[(0,Y.jsx)(Ie,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5`}),(0,Y.jsx)(`p`,{className:`text-xs text-yellow-800 dark:text-yellow-200`,children:m(`settings.sessionPolicy.warning`)})]})]})]}),S&&(0,Y.jsxs)(G,{children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-currentuser`,children:[(0,Y.jsx)(Ze,{className:`w-5 h-5 text-bambu-green`}),m(`settings.currentUser`)]}),S.auth_source!==`ldap`&&(0,Y.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:()=>hr(!0),children:[(0,Y.jsx)(Kt,{className:`w-4 h-4`}),m(`settings.changePassword`)]})]})}),(0,Y.jsx)(W,{children:(0,Y.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-white font-medium text-lg`,children:S.username}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:[S.is_admin&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`,children:m(`settings.admin`)}),S.groups?.map(e=>(0,Y.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium ${e.name===`Administrators`?`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`:e.name===`Operators`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-300`:e.name===`Viewers`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-300`:`bg-gray-500/20 text-gray-300`}`,children:e.name},e.id))]})]})})})]}),(0,Y.jsxs)(G,{children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-users`,children:[(0,Y.jsx)(Ze,{className:`w-5 h-5 text-bambu-green`}),m(`settings.users`)]}),k(`users:create`)&&(0,Y.jsxs)(K,{size:`sm`,onClick:()=>{wr(!0),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.addUser`)]})]})}),(0,Y.jsx)(W,{children:ba?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Y.jsx)(R,{className:`w-6 h-6 text-bambu-green animate-spin`})}):Q.length===0?(0,Y.jsx)(`p`,{className:`text-center text-bambu-gray py-8`,children:m(`settings.noUsersFound`)}):(0,Y.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:Q.map(e=>(0,Y.jsxs)(`div`,{className:`py-3 flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.username}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[e.auth_source===`ldap`&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-300`,children:`LDAP`}),e.is_admin&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`,children:m(`settings.admin`)}),e.groups?.map(e=>(0,Y.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium ${e.name===`Administrators`?`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`:e.name===`Operators`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-300`:e.name===`Viewers`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-300`:`bg-gray-500/20 text-gray-300`}`,children:e.name},e.id))]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 ml-4`,children:[k(`users:update`)&&(0,Y.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>Ua(e),children:(0,Y.jsx)(oe,{className:`w-4 h-4`})}),k(`users:delete`)&&e.id!==S?.id&&(0,Y.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>za(e.id),children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]})]},e.id))})})]})]}),(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-groups`,children:[(0,Y.jsx)(Me,{className:`w-5 h-5 text-bambu-green`}),m(`settings.groups`)]}),k(`groups:create`)&&(0,Y.jsxs)(K,{size:`sm`,onClick:()=>a(`/groups/new`),children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.addGroup`)]})]})}),(0,Y.jsx)(W,{children:Sa?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Y.jsx)(R,{className:`w-6 h-6 text-bambu-green animate-spin`})}):xa.length===0?(0,Y.jsx)(`p`,{className:`text-center text-bambu-gray py-8`,children:m(`settings.noGroupsFound`)}):(0,Y.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:xa.map(e=>(0,Y.jsxs)(`div`,{className:`py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Me,{className:`w-4 h-4 ${e.name===`Administrators`?`text-purple-600 dark:text-purple-400`:e.name===`Operators`?`text-blue-600 dark:text-blue-400`:e.name===`Viewers`?`text-green-600 dark:text-green-400`:`text-bambu-gray`}`}),(0,Y.jsx)(`span`,{className:`text-white font-medium`,children:e.name}),e.is_system&&(0,Y.jsx)(`span`,{className:`px-2 py-0.5 rounded text-xs bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`,children:m(`settings.system`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[k(`groups:update`)&&(0,Y.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>a(`/groups/${e.id}/edit`),children:(0,Y.jsx)(oe,{className:`w-4 h-4`})}),k(`groups:delete`)&&!e.is_system&&(0,Y.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>Wr(e.id),children:(0,Y.jsx)(qe,{className:`w-4 h-4`})})]})]}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1 ml-6`,children:e.description||m(`settings.noDescription`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 ml-6 text-xs text-bambu-gray`,children:[(0,Y.jsx)(`span`,{children:m(`settings.userCount`,{count:e.user_count})}),(0,Y.jsx)(`span`,{children:m(`settings.permissionCount`,{count:e.permissions.length})})]})]},e.id))})})]})})]}),!x&&(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`py-6`,children:(0,Y.jsxs)(`div`,{className:`text-center`,children:[(0,Y.jsx)(h,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,Y.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:m(`settings.authDisabledTitle`)}),(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4 max-w-md mx-auto`,children:m(`settings.authDisabledMessage`)}),(0,Y.jsxs)(`ul`,{className:`space-y-2 text-sm text-bambu-gray mb-6 text-left max-w-xs mx-auto`,children:[(0,Y.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(j,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,Y.jsx)(`span`,{children:m(`settings.authDisabledFeature1`)})]}),(0,Y.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(j,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,Y.jsx)(`span`,{children:m(`settings.authDisabledFeature2`)})]}),(0,Y.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(j,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,Y.jsx)(`span`,{children:m(`settings.authDisabledFeature3`)})]})]}),(0,Y.jsxs)(K,{onClick:()=>a(`/setup`),children:[(0,Y.jsx)(z,{className:`w-4 h-4`}),m(`settings.enableAuthentication`)]})]})})})]}),Mn===`printer-access`&&(0,Y.jsx)(ca,{}),Mn===`email`&&(0,Y.jsx)(`div`,{className:`max-w-5xl`,id:`card-smtp`,children:(0,Y.jsx)(Zi,{})}),Mn===`ldap`&&(0,Y.jsx)(`div`,{className:`max-w-5xl`,id:`card-ldap`,children:(0,Y.jsx)($i,{})}),Mn===`twofa`&&(0,Y.jsx)(`div`,{className:`max-w-2xl`,children:(0,Y.jsx)(fa,{})}),Mn===`oidc`&&T&&(0,Y.jsxs)(`div`,{className:`max-w-3xl space-y-4`,children:[(0,Y.jsx)(G,{children:(0,Y.jsx)(W,{className:`space-y-3 p-4`,children:(0,Y.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:H.local_login_enabled===!1,onChange:e=>$(`local_login_enabled`,!e.target.checked),className:`mt-1 h-4 w-4 rounded border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green/50 cursor-pointer`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-white`,children:m(`settings.localLogin.disable`)}),(0,Y.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:m(`settings.localLogin.disableHint`)})]})]})})}),(0,Y.jsx)(ga,{})]}),Mn===`security`&&T&&(0,Y.jsx)(`div`,{className:`max-w-3xl`,children:(0,Y.jsx)(ya,{})})]}),Cr&&!pa?.advanced_auth_enabled&&(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black flex items-center justify-center z-50 p-4`,onClick:()=>{wr(!1),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,Y.jsxs)(G,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Ze,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.createUser`)})]}),(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:()=>{wr(!1),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]})}),(0,Y.jsxs)(W,{children:[ma?.ldap_enabled&&(0,Y.jsxs)(`div`,{className:`mb-4 flex items-center gap-1 p-1 bg-bambu-dark-secondary rounded-lg`,role:`tablist`,"aria-label":m(`users.modal.tabsAriaLabel`),children:[(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":Er===`local`,onClick:()=>Dr(`local`),className:`flex-1 px-3 py-2 text-sm rounded-md transition-colors ${Er===`local`?`bg-bambu-green/15 text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:m(`users.modal.localTab`)}),(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":Er===`ldap`,onClick:()=>Dr(`ldap`),className:`flex-1 px-3 py-2 text-sm rounded-md transition-colors ${Er===`ldap`?`bg-bambu-green/15 text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:m(`users.modal.ldapTab`)})]}),Er===`ldap`&&ma?.ldap_enabled?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(fi,{onSuccess:e=>{wr(!1),Dr(`local`),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),v(m(`users.toast.ldapProvisioned`,{username:e.username}))}}),(0,Y.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>{wr(!1),Dr(`local`),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:m(`common.cancel`)})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:m(`settings.username`)}),(0,Y.jsx)(`input`,{type:`text`,value:Z.username,onChange:e=>Hr({...Z,username:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:m(`settings.enterUsername`),autoComplete:`username`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:m(`settings.password`)}),(0,Y.jsx)(`input`,{type:`password`,value:Z.password,onChange:e=>Hr({...Z,password:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:m(`settings.enterPassword`),autoComplete:`new-password`,minLength:8}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:m(`settings.passwordRequirements`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:m(`settings.confirmPassword`)}),(0,Y.jsx)(`input`,{type:`password`,value:Z.confirmPassword,onChange:e=>Hr({...Z,confirmPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${Z.confirmPassword&&Z.password!==Z.confirmPassword?`border-red-500`:`border-bambu-dark-tertiary`}`,placeholder:m(`settings.confirmPasswordPlaceholder`),autoComplete:`new-password`,minLength:6}),Z.confirmPassword&&Z.password!==Z.confirmPassword&&(0,Y.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:m(`settings.passwordsDoNotMatch`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:m(`settings.groups`)}),(0,Y.jsxs)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:[xa.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Z.group_ids.includes(e.id),onChange:()=>Wa(e.id),className:`w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:e.name}),e.is_system&&(0,Y.jsx)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:m(`settings.systemBadge`)})]},e.id)),xa.length===0&&(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`settings.noGroupsAvailable`)})]})]})]}),(0,Y.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>{wr(!1),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:m(`common.cancel`)}),(0,Y.jsx)(K,{onClick:Va,disabled:Ca.isPending||!Z.username||!Z.password||Z.password!==Z.confirmPassword||En(Z.password)!==null,children:Ca.isPending?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),m(`settings.creating`)]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(wt,{className:`w-4 h-4`}),m(`settings.createUser`)]})})]})]})]})]})}),Cr&&pa?.advanced_auth_enabled&&(0,Y.jsx)(mi,{formData:Z,setFormData:Hr,groups:xa,onClose:()=>{wr(!1),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},onCreate:Va,isCreating:Ca.isPending,isCreateButtonDisabled:Ca.isPending||!Z.username||!Z.email,ldapEnabled:ma?.ldap_enabled,onLdapProvisioned:e=>{wr(!1),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),v(m(`users.toast.ldapProvisioned`,{username:e.username}))}}),kr&&Nr!==null&&(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black flex items-center justify-center z-50 p-4`,onClick:()=>{Ar(!1),Fr(null),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,Y.jsxs)(G,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(oe,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.editUser`)})]}),(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:()=>{Ar(!1),Fr(null),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]})}),(0,Y.jsxs)(W,{children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[m(`settings.username`),` `,pa?.advanced_auth_enabled&&(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,Y.jsx)(`input`,{type:`text`,value:Z.username,onChange:e=>Hr({...Z,username:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:m(`settings.enterUsername`),autoComplete:`username`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[m(`users.form.email`)||`Email`,` `,pa?.advanced_auth_enabled?(0,Y.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`}):(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,m(`users.form.optional`)||`optional`,`)`]})]}),(0,Y.jsx)(`input`,{type:`email`,value:Z.email,onChange:e=>Hr({...Z,email:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:m(`users.form.emailPlaceholder`)||`user@example.com`,required:pa?.advanced_auth_enabled})]}),!pa?.advanced_auth_enabled&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[m(`users.form.password`)||`Password`,` `,(0,Y.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,m(`users.form.leaveBlankToKeep`)||`leave blank to keep current`,`)`]})]}),(0,Y.jsx)(`input`,{type:`password`,value:Z.password,onChange:e=>Hr({...Z,password:e.target.value,confirmPassword:``}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:m(`settings.enterNewPassword`),autoComplete:`new-password`,minLength:8}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:m(`settings.passwordRequirements`)})]}),Z.password&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:m(`settings.confirmPassword`)}),(0,Y.jsx)(`input`,{type:`password`,value:Z.confirmPassword,onChange:e=>Hr({...Z,confirmPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${Z.confirmPassword&&Z.password!==Z.confirmPassword?`border-red-500`:`border-bambu-dark-tertiary`}`,placeholder:m(`settings.confirmNewPassword`),autoComplete:`new-password`,minLength:6}),Z.confirmPassword&&Z.password!==Z.confirmPassword&&(0,Y.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:m(`settings.passwordsDoNotMatch`)})]})]}),pa?.advanced_auth_enabled&&(0,Y.jsxs)(`div`,{className:`bg-bambu-dark-secondary/50 border border-bambu-green/20 rounded-lg p-3 space-y-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:m(`users.form.passwordManagedByAdvancedAuth`)||`Password is managed by Advanced Authentication. Use "Reset Password" to send a new password to the user via email.`}),(0,Y.jsx)(K,{variant:`secondary`,size:`sm`,onClick:()=>Nr&&Na.mutate(Nr),disabled:Na.isPending||!Z.email,className:`w-full`,children:Na.isPending?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),m(`users.form.resettingPassword`)||`Resetting Password...`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(nt,{className:`w-4 h-4`}),m(`users.form.resetPassword`)||`Reset Password`]})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:m(`users.form.groups`)||`Groups`}),(0,Y.jsx)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:xa.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Z.group_ids.includes(e.id),onChange:()=>Wa(e.id),className:`w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark`}),(0,Y.jsx)(`span`,{className:`text-sm text-white`,children:e.name}),e.is_system&&(0,Y.jsxs)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:[`(`,m(`users.system`)||`System`,`)`]})]},e.id))})]})]}),(0,Y.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>{Ar(!1),Fr(null),Hr({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:m(`users.modal.cancel`)||`Cancel`}),(0,Y.jsx)(K,{onClick:()=>Ha(Nr),disabled:Ta.isPending||!Z.username||pa?.advanced_auth_enabled&&!Z.email||!!(!pa?.advanced_auth_enabled&&Z.password&&(Z.password!==Z.confirmPassword||En(Z.password)!==null)),children:Ta.isPending?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),m(`users.modal.saving`)||`Saving...`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_t,{className:`w-4 h-4`}),m(`users.modal.saveChanges`)||`Save Changes`]})})]})]})]})}),Ir!==null&&(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,onClick:()=>{Lr(null),zr(null)},children:(0,Y.jsxs)(G,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-red-700 dark:text-red-400`,children:[(0,Y.jsx)(qe,{className:`w-5 h-5`}),(0,Y.jsx)(`h3`,{className:`text-lg font-semibold`,children:m(`settings.deleteUserTitle`)})]})}),(0,Y.jsx)(W,{className:`space-y-3`,children:Br?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,Y.jsx)(`div`,{className:`animate-spin rounded-full h-6 w-6 border-2 border-bambu-green border-t-transparent`})}):Rr&&Rr.archives+Rr.queue_items+Rr.library_files>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.userHasCreated`)}),(0,Y.jsxs)(`ul`,{className:`list-disc list-inside text-bambu-gray space-y-1`,children:[Rr.archives>0&&(0,Y.jsxs)(`li`,{children:[Rr.archives,` archive`,Rr.archives===1?``:`s`]}),Rr.queue_items>0&&(0,Y.jsxs)(`li`,{children:[Rr.queue_items,` queue item`,Rr.queue_items===1?``:`s`]}),Rr.library_files>0&&(0,Y.jsxs)(`li`,{children:[Rr.library_files,` library file`,Rr.library_files===1?``:`s`]})]}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:m(`settings.userItemsQuestion`)}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(K,{variant:`danger`,onClick:()=>Ma.mutate({id:Ir,deleteItems:!0}),disabled:Ma.isPending,className:`justify-center`,children:m(`settings.deleteUserAndItems`)}),(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>Ma.mutate({id:Ir,deleteItems:!1}),disabled:Ma.isPending,className:`justify-center`,children:m(`settings.deleteUserKeepItems`)}),(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>{Lr(null),zr(null)},disabled:Ma.isPending,className:`justify-center`,children:m(`common.cancel`)})]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`text-white`,children:m(`settings.deleteUserConfirm`)}),(0,Y.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:m(`settings.actionCannotBeUndone`)}),(0,Y.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>{Lr(null),zr(null)},disabled:Ma.isPending,children:m(`common.cancel`)}),(0,Y.jsx)(K,{variant:`danger`,onClick:()=>Ma.mutate({id:Ir,deleteItems:!1}),disabled:Ma.isPending,children:m(`settings.deleteUserTitle`)})]})]})})]})}),Ur!==null&&(0,Y.jsx)(Tt,{title:m(`settings.deleteGroupTitle`),message:m(`settings.deleteGroupMessage`),confirmText:m(`settings.deleteGroup`),variant:`danger`,onConfirm:()=>{Ba.mutate(Ur),Wr(null)},onCancel:()=>Wr(null)}),Tn===`failure-detection`&&(0,Y.jsx)(`div`,{id:`card-failure-detection`,children:(0,Y.jsx)(Ji,{})}),Tn===`backup`&&(0,Y.jsxs)(`div`,{id:`card-backup`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 p-3 bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 rounded-lg flex items-start gap-2`,children:[(0,Y.jsx)(Me,{className:`text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`,size:16}),(0,Y.jsx)(`p`,{className:`text-sm text-amber-700 dark:text-amber-400`,children:m(`backup.includesEncryptionKey`)})]}),(0,Y.jsx)(Ki,{})]}),cr&&(0,Y.jsx)(Tt,{title:m(`settings.disableAuthenticationTitle`),message:m(`settings.disableAuthenticationMessage`),confirmText:m(`settings.disableAuthentication`),variant:`danger`,onConfirm:async()=>{try{await r.disableAuth(),v(m(`settings.toast.authDisabled`),`success`),await D(),lr(!1),window.location.href=`/`}catch(e){v(e instanceof Error?e.message:m(`settings.toast.authDisableFailed`),`error`)}},onCancel:()=>lr(!1)}),dr&&(0,Y.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:()=>{hr(!1),_r({currentPassword:``,newPassword:``,confirmPassword:``})},children:(0,Y.jsxs)(G,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(U,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Kt,{className:`w-5 h-5 text-bambu-green`}),(0,Y.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:m(`settings.changePassword`)})]}),(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:()=>{hr(!1),_r({currentPassword:``,newPassword:``,confirmPassword:``})},children:(0,Y.jsx)(Re,{className:`w-5 h-5`})})]})}),(0,Y.jsxs)(W,{children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:`Current Password`}),(0,Y.jsx)(`input`,{type:`password`,value:gr.currentPassword,onChange:e=>_r({...gr,currentPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:m(`settings.enterCurrentPassword`),autoComplete:`current-password`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:`New Password`}),(0,Y.jsx)(`input`,{type:`password`,value:gr.newPassword,onChange:e=>_r({...gr,newPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:m(`settings.enterNewPasswordMin6`),autoComplete:`new-password`,minLength:6})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:`Confirm New Password`}),(0,Y.jsx)(`input`,{type:`password`,value:gr.confirmPassword,onChange:e=>_r({...gr,confirmPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${gr.confirmPassword&&gr.newPassword!==gr.confirmPassword?`border-red-500`:`border-bambu-dark-tertiary`}`,placeholder:m(`settings.confirmNewPassword`),autoComplete:`new-password`,minLength:6}),gr.confirmPassword&&gr.newPassword!==gr.confirmPassword&&(0,Y.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:m(`settings.passwordsDoNotMatch`)})]})]}),(0,Y.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,Y.jsx)(K,{variant:`secondary`,onClick:()=>{hr(!1),_r({currentPassword:``,newPassword:``,confirmPassword:``})},children:m(`common.cancel`)}),(0,Y.jsx)(K,{onClick:async()=>{if(gr.newPassword!==gr.confirmPassword){v(m(`settings.toast.passwordsDoNotMatch`),`error`);return}if(gr.newPassword.length<6){v(m(`settings.toast.passwordTooShort`),`error`);return}br(!0);try{await r.changePassword(gr.currentPassword,gr.newPassword),v(m(`settings.toast.passwordChanged`),`success`),hr(!1),_r({currentPassword:``,newPassword:``,confirmPassword:``})}catch(e){v(e instanceof Error?e.message:`Failed to change password`,`error`)}finally{br(!1)}},disabled:yr||!gr.currentPassword||!gr.newPassword||gr.newPassword!==gr.confirmPassword||gr.newPassword.length<6,children:yr?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{className:`w-4 h-4 animate-spin`}),m(`settings.changing`)]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Kt,{className:`w-4 h-4`}),m(`settings.changePassword`)]})})]})]})]})})]})]})]})})}export{za as SettingsPage}; \ No newline at end of file diff --git a/static/assets/SetupPage-Dzw-F49q.js b/static/assets/SetupPage-Dzw-F49q.js new file mode 100644 index 000000000..45fb31417 --- /dev/null +++ b/static/assets/SetupPage-Dzw-F49q.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{t as a}from"./useMutation-B-Tr2hIP.js";import{t as o}from"./info-ROUoQhJR.js";import{n as s}from"./ToastContext-BRX0SW3C.js";import{Vn as c,vt as l,yt as u}from"./index-CovRLYqQ.js";var d=e(n(),1),f=t();function p(){let e=c(),{t}=i(),{showToast:n}=s(),{mode:p}=l(),{refreshAuth:m}=u(),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(``),C=a({mutationFn:()=>r.setupAuth({auth_enabled:h,admin_username:h?_:void 0,admin_password:h?y:void 0}),onSuccess:async r=>{await m(),r.auth_enabled?r.admin_created?(n(t(`setup.toast.authEnabledAdminCreated`)),e(`/login`)):(n(t(`setup.toast.authEnabledExistingAdmins`)),e(`/login`)):(n(t(`setup.toast.setupCompleted`)),e(`/`))},onError:e=>{n(e.message,`error`)}});return(0,f.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,f.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`div`,{className:`flex items-center justify-center mb-6`,children:(0,f.jsx)(`img`,{src:p===`dark`?`/img/bambuddy_logo_dark_transparent.png`:`/img/bambuddy_logo_light.png`,alt:`Bambuddy`,className:`h-16`})}),(0,f.jsx)(`h2`,{className:`text-3xl font-bold text-white`,children:t(`setup.title`)}),(0,f.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:t(`setup.subtitle`)})]}),(0,f.jsxs)(`form`,{className:`mt-8 space-y-6`,onSubmit:e=>{if(e.preventDefault(),h&&(_||y)){if(!_||!y){n(t(`setup.toast.enterBothCredentials`),`error`);return}if(y!==x){n(t(`setup.toast.passwordsDoNotMatch`),`error`);return}if(y.length<6){n(t(`setup.toast.passwordTooShort`),`error`);return}}C.mutate()},children:[(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center p-4 bg-bambu-dark-secondary/50 rounded-lg border border-bambu-dark-tertiary`,children:[(0,f.jsx)(`input`,{id:`auth-enabled`,type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`h-4 w-4 text-bambu-green focus:ring-bambu-green border-bambu-dark-tertiary rounded bg-bambu-dark-secondary`}),(0,f.jsx)(`label`,{htmlFor:`auth-enabled`,className:`ml-3 block text-sm font-medium text-white`,children:t(`setup.enableAuth`)})]}),h&&(0,f.jsxs)(`div`,{className:`space-y-4 mt-4`,children:[(0,f.jsx)(`div`,{className:`p-3 bg-bambu-dark-secondary/50 border border-bambu-dark-tertiary rounded-lg`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(o,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,f.jsxs)(`div`,{className:`text-sm text-bambu-gray`,children:[(0,f.jsx)(`p`,{className:`text-white font-medium mb-1`,children:t(`setup.adminAccount`)}),(0,f.jsx)(`p`,{children:t(`setup.adminAccountDesc`)})]})]})}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`label`,{htmlFor:`admin-username`,className:`block text-sm font-medium text-white mb-2`,children:[t(`setup.adminUsername`),` `,(0,f.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:t(`setup.optionalIfAdminExists`)})]}),(0,f.jsx)(`input`,{id:`admin-username`,type:`text`,value:_,onChange:e=>v(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:t(`setup.adminUsernamePlaceholder`),autoComplete:`username`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`label`,{htmlFor:`admin-password`,className:`block text-sm font-medium text-white mb-2`,children:[t(`setup.adminPassword`),` `,(0,f.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:t(`setup.optionalIfAdminExists`)})]}),(0,f.jsx)(`input`,{id:`admin-password`,type:`password`,value:y,onChange:e=>b(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:t(`setup.adminPasswordPlaceholder`),minLength:6,autoComplete:`new-password`})]}),y&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{htmlFor:`confirm-password`,className:`block text-sm font-medium text-white mb-2`,children:t(`setup.confirmPassword`)}),(0,f.jsx)(`input`,{id:`confirm-password`,type:`password`,value:x,onChange:e=>S(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:t(`setup.confirmPasswordPlaceholder`),minLength:6,autoComplete:`new-password`})]})]})]}),(0,f.jsx)(`div`,{children:(0,f.jsx)(`button`,{type:`submit`,disabled:C.isPending,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-bambu-green`,children:C.isPending?t(`setup.settingUp`):t(`setup.completeSetup`)})})]})]})})}export{p as SetupPage}; \ No newline at end of file diff --git a/static/assets/SliceModal-2Iz_Qz3v.js b/static/assets/SliceModal-2Iz_Qz3v.js new file mode 100644 index 000000000..438cc849d --- /dev/null +++ b/static/assets/SliceModal-2Iz_Qz3v.js @@ -0,0 +1,2 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i,x as a}from"./client-DnySrlFv.js";import{n as o}from"./QueryClientProvider-Ce8_sN3w.js";import{t as s}from"./useQuery-BBCjCezC.js";import{t as c}from"./useMutation-B-Tr2hIP.js";import{t as l}from"./createLucideIcon-DvBYJlWL.js";import{a as u}from"./info-ROUoQhJR.js";import{n as d}from"./ToastContext-BRX0SW3C.js";import{t as f}from"./cloud-off-DfYbNG2N.js";import{t as p}from"./cog-Dol1I0kq.js";import{t as m}from"./loader-circle-BEmFtawu.js";import{t as h}from"./search-0n0CBc74.js";import{t as g}from"./x-DR-Trv6U.js";import{o as _}from"./date-G9KUauqz.js";import{B as v,Gt as y,H as b,Kn as x,Kt as S,Q as C,U as w,W as T,cn as E,t as ee,tt as te,w as D}from"./index-CovRLYqQ.js";import{a as O,i as ne,n as k,t as A}from"./slicerPrinterMatch-CUdoNag2.js";var re=l(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),j=e(n(),1),M=1024;function ie(){let[e,t]=(0,j.useState)(()=>typeof window<`u`?window.innerWidth>=M:!1);return(0,j.useEffect)(()=>{let e=window.matchMedia(`(min-width: ${M}px)`),n=e=>{t(e.matches)};return t(e.matches),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var N=t();function ae({plates:e,onSelect:t,onClose:n}){let{t:r}=i();return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:n,children:(0,N.jsxs)(`div`,{className:`w-full max-w-3xl max-h-[85vh] flex flex-col rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary/60`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`flex-shrink-0 flex items-start justify-between gap-3 px-4 pt-4 pb-3 border-b border-bambu-dark-tertiary/40`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`h3`,{className:`text-white font-medium`,children:r(`archives.platePicker.title`)}),(0,N.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:r(`archives.platePicker.hint`)})]}),(0,N.jsx)(`button`,{onClick:n,className:`flex-shrink-0 text-bambu-gray hover:text-white transition-colors`,"aria-label":r(`common.close`,`Close`),children:(0,N.jsx)(g,{className:`w-5 h-5`})})]}),(0,N.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:(0,N.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:e.map(e=>(0,N.jsxs)(`button`,{type:`button`,onClick:()=>t(e.index),className:`flex items-center gap-2 p-2 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray transition-colors text-left`,children:[e.has_thumbnail&&e.thumbnail_url!=null?(0,N.jsx)(`img`,{src:a(e.thumbnail_url),alt:`Plate ${e.index}`,className:`w-12 h-12 rounded object-cover bg-bambu-dark-tertiary flex-shrink-0`}):(0,N.jsx)(`div`,{className:`w-12 h-12 rounded bg-bambu-dark-tertiary flex items-center justify-center flex-shrink-0`,children:(0,N.jsx)(E,{className:`w-5 h-5 text-bambu-gray`})}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`p`,{className:`text-sm text-white font-medium truncate`,children:e.name?`${r(`archives.platePicker.plateLabel`,{index:e.index})} — ${e.name}`:r(`archives.platePicker.plateLabel`,{index:e.index})}),(0,N.jsxs)(`p`,{className:`text-xs text-bambu-gray truncate`,children:[e.objects.length>0?e.objects.slice(0,3).join(`, `)+(e.objects.length>3?`…`:``):e.object_count!=null&&e.object_count>0?r(`archives.platePicker.objectCount`,{count:e.object_count}):`${e.filaments.length} filament${e.filaments.length===1?``:`s`}`,e.print_time_seconds==null?``:` • ${_(e.print_time_seconds)}`]})]})]},e.index))})})]})})}var P=[`local`,`orca_cloud`,`cloud`,`standard`],F={local:1.75,orca_cloud:1.5,cloud:1,standard:.5};function oe(e,t){for(let n of P){let r=e[n][t];if(r.length>0)return{source:r[0].source,id:r[0].id}}return null}function I(e,t,n){return t?e[t.source][n].find(e=>e.id===t.id)??null:null}function se(e,t,n){if(!n)return null;for(let r of P){let i=e[r][t].find(e=>e.name===n);if(i)return{source:i.source,id:i.id}}return null}function ce(e,t,n,r){let i=se(e,`process`,r);if(i){let r=I(e,i,`process`);if(r&&O(r,`process`,t,n)!==`mismatch`)return i}for(let r of[`match`,`unknown`])for(let i of P){let a=de(e[i].process.filter(e=>O(e,`process`,t,n)===r));if(a)return{source:a.source,id:a.id}}return oe(e,`process`)}var le=.2,ue=/^\s*([\d.]+)\s*mm\b/i;function de(e){let t=null,n=1/0,r=-1/0;for(let i of e){let e=ue.exec(i.name),a=e?Number.parseFloat(e[1]):NaN,o=Number.isFinite(a)&&a>0,s=o?Math.abs(a-le):1/0;(t==null||sr)&&(t=i,n=s,r=o?a:-1/0)}return t}function fe(e,t){let n=t.trim().toUpperCase(),r=(e.filament_type??``).trim().toUpperCase();return!!n&&!!r&&n!==r}function pe(e,t,n,r){let i=t.type.trim().toUpperCase(),a=C(t.color),o=null,s=null,c=null,l=null;for(let u of P)for(let d of e[u].filament){let e=0,f=(d.filament_type??``).trim().toUpperCase(),p=C(d.filament_colour??``);i&&f&&i===f&&(e+=10),a&&p&&(p===a?e+=5:v(d.filament_colour??``,t.color)&&(e+=2)),e+=F[u];let m={source:d.source,id:d.id};fe(d,i)?O(d,`filament`,n,r)===`mismatch`?(l==null||e>l.score)&&(l={ref:m,score:e}):(c==null||e>c.score)&&(c={ref:m,score:e}):O(d,`filament`,n,r)===`mismatch`?(s==null||e>s.score)&&(s={ref:m,score:e}):(o==null||e>o.score)&&(o={ref:m,score:e})}return o==null?s==null?c==null?l==null?oe(e,`filament`):l.ref:c.ref:s.ref:o.ref}function me(e){return`${e.source}:${e.id}`}function he(e,t){if(!e)return null;let n=e.replace(/^#\s*/,``).trim().match(/^Bambu Lab\s+(.+?)(?:\s+[\d.]+\s*nozzle)?$/i);if(!n)return null;let r=n[1].trim(),i=`bambu lab ${r}`.toLowerCase();for(let[e,n]of Object.entries(t))if(e.toLowerCase()===i)return n;return r}function ge(e,t){return!e||!t?!1:ne(e.trim(),t.trim())}function _e(e,t){return t?e.filter(e=>ge(e.model,t)):e}function ve(e,t,n={}){return e?he((Object.hasOwn(n,e)?n[e]:null)||e,t):null}function ye(e,t,n,r={}){let i=ve(e.name,n,r);return i===null?!0:t.some(e=>ge(e,i))}function be(e,t,n,r={}){let i=null;for(let a of P)for(let o of e[a].printer){let e=ve(o.name,n,r);if(e===null||!t.some(t=>ge(t,e)))continue;let s={source:a,id:o.id};if(/\b0\.4\s*nozzle\b/i.test(o.name))return s;i??=s}return i}function xe(e){let t=e.replace(/^#\s*/,``),n=t.lastIndexOf(`@`);return n>0&&(t=t.slice(0,n)),t.replace(/\s+/g,` `).trim().toLowerCase()}function Se(e){let t=e.replace(/^#\s*/,``),n=t.lastIndexOf(`@`);return n>0&&(t=t.slice(0,n)),t.replace(/\s+/g,` `).trim()}function Ce(e){return!!e.tray_type}function we(e){let t=e.saved_preset;return t&&te(t.preset_id,e.tray_info_idx,t.tray_info_idx)?t:null}function Te(e){if(e.preset_source===`local`){let t=e.preset_id.match(/^local_(\d+)$/);return t?{source:`local`,id:t[1]}:null}return(e.preset_source===`cloud`||e.preset_source===`orca_cloud`)&&e.preset_id?{source:e.preset_source,id:e.preset_id}:null}function Ee(e,t){let n=[];t?.preset_name&&n.push(t.preset_name);let r=(e.tray_sub_brands??``).trim();r?(/^GF/i.test(e.tray_info_idx??``)&&!/^bambu\b/i.test(r)&&n.push(`Bambu ${r}`),n.push(r)):e.tray_type&&n.push(`Generic ${e.tray_type}`);let i=new Set;return n.filter(e=>{let t=xe(e);return!t||i.has(t)?!1:(i.add(t),!0)})}function De(e){let t=new Map;for(let n of P)for(let r of e[n].filament){let e=xe(r.name),i=t.get(e);i?i.push({source:n,preset:r}):t.set(e,[{source:n,preset:r}])}return t}function Oe(e,t,n,r,i){if(!Ce(e))return null;let a=we(e),o=e=>O(e,`filament`,r,i);if(a){let e=Te(a),n=e?t[e.source].filament.find(t=>t.id===e.id):void 0;if(e&&n&&o(n)!==`mismatch`)return{ref:e,preset:n}}let s=a?Te(a)?.source:void 0;for(let t of Ee(e,a)){let r=n.get(xe(t))??[],i=s?[...r.filter(e=>e.source===s),...r.filter(e=>e.source!==s)]:r,a=null;for(let{source:t,preset:n}of i){if(fe(n,e.tray_type??``))continue;let r=o(n);if(r===`match`)return{ref:{source:t,id:n.id},preset:n};r===`unknown`&&!a&&(a={ref:{source:t,id:n.id},preset:n})}if(a)return a}return null}function ke(e){let t=[];for(let n of e){for(let e of n.ams)for(let n of e.trays)Ce(n)&&t.push(n);for(let e of n.external)Ce(e)&&t.push(e)}return t}function Ae(e,t,n,r,i){let a=new Set;for(let o of ke(e)){let e=Oe(o,t,n,r,i);e&&a.add(me(e.ref))}return a}function je(e){let t=(e.tray_color??``).replace(/^#/,``);return/^[0-9a-fA-F]{6}/.test(t)?`#${t.slice(0,6).toUpperCase()}`:null}function Me({printers:e,data:t,index:n,selectedPrinterName:r,compatIndex:a,slotLabel:o,onPick:s,onClose:c}){let{t:l}=i();return(0,j.useEffect)(()=>{let e=e=>{e.key===`Escape`&&c()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c]),(0,N.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:c,children:(0,N.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`slice-spool-picker-title`,className:`w-full max-w-3xl max-h-[85vh] flex flex-col rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary/60`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`flex-shrink-0 flex items-start justify-between gap-3 px-4 pt-4 pb-3 border-b border-bambu-dark-tertiary/40`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`h3`,{id:`slice-spool-picker-title`,className:`text-white font-medium`,children:l(`slice.loadedSpools.title`,`Loaded spools`)}),(0,N.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1 truncate`,children:o})]}),(0,N.jsx)(`button`,{type:`button`,onClick:c,className:`flex-shrink-0 text-bambu-gray hover:text-white transition-colors`,"aria-label":l(`common.close`),children:(0,N.jsx)(g,{className:`w-5 h-5`})})]}),(0,N.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-5`,children:e.length===0?(0,N.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:l(`slice.loadedSpools.none`,`No printer of this model is online.`)}):e.map(e=>(0,N.jsx)(Ne,{printer:e,matchFor:e=>Oe(e,t,n,r,a),onPick:s},e.id))})]})})}function Ne({printer:e,matchFor:t,onPick:n}){let{t:r}=i(),a=e.ams.filter(e=>!e.is_ams_ht),o=e.ams.filter(e=>e.is_ams_ht),s=e.ams.length>0||e.external.length>0,c=(e,r)=>(0,N.jsx)(Pe,{tray:e,label:r,match:t(e),onPick:n},`${e.ams_id}-${e.tray_id}`);return(0,N.jsxs)(`section`,{children:[(0,N.jsxs)(`h4`,{className:`text-sm text-white font-medium mb-2`,children:[e.name,e.model&&(0,N.jsx)(`span`,{className:`ml-2 text-xs text-bambu-gray font-normal`,children:e.model})]}),!s&&(0,N.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:r(`slice.loadedSpools.nothingLoaded`,`No AMS and no external spool.`)}),(0,N.jsxs)(`div`,{className:`space-y-3`,children:[a.map(e=>(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-xs text-bambu-gray mb-1`,children:w(e.id,e.trays.length)}),(0,N.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:e.trays.map(t=>c(t,b(e.id,t.tray_id,!1,!1)))})]},e.id)),o.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-xs text-bambu-gray mb-1`,children:`AMS-HT`}),(0,N.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:o.flatMap(e=>e.trays.map(t=>c(t,b(e.id,t.tray_id,!0,!1))))})]}),e.external.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-xs text-bambu-gray mb-1`,children:r(`printers.external`)}),(0,N.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:e.external.map(t=>c(t,e.external_holders>1?t.tray_id===0?r(`printers.extL`):r(`printers.extR`):r(`printers.ext`)))})]})]})]})}function Pe({tray:e,label:t,match:n,onPick:r}){let{t:a}=i(),o=T(e),s=je(e),c=(0,j.useMemo)(()=>{if(n)return Se(n.preset.name);let t=we(e);return t?.preset_name?Se(t.preset_name):e.tray_sub_brands||null},[n,e]);if(o!==null)return(0,N.jsxs)(`div`,{className:`rounded-md border border-dashed border-bambu-dark-tertiary px-2 py-2 text-xs text-bambu-gray/70`,children:[(0,N.jsx)(`div`,{className:`font-medium text-bambu-gray`,children:t}),(0,N.jsx)(`div`,{children:o===`reset`?a(`slice.loadedSpools.unknownSpool`,`Unidentified spool`):a(`slice.loadedSpools.empty`,`Empty`)})]});let l=n===null;return(0,N.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>n&&r(n,s),title:l?a(`slice.loadedSpools.noProfile`,`No profile for the selected printer`):c??void 0,className:`text-left rounded-md border border-bambu-dark-tertiary bg-bambu-dark px-2 py-2 text-xs transition-colors enabled:hover:border-bambu-green disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(D,{rgba:e.tray_color,className:`w-3.5 h-3.5 shrink-0`,effectSize:`table`}),(0,N.jsx)(`span`,{className:`font-medium text-white`,children:t}),(0,N.jsx)(`span`,{className:`ml-auto text-bambu-gray`,children:e.tray_type})]}),(0,N.jsx)(`div`,{className:`mt-1 truncate text-bambu-gray`,title:c??void 0,children:c??`—`}),l&&(0,N.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] text-amber-600 dark:text-amber-400`,children:a(`slice.loadedSpools.noProfileShort`,`No profile for this printer`)})]})}var L=e=>typeof e==`object`&&!!e&&`enumKey`in e,Fe=`enum:`;function R(e){if(typeof e==`number`)return e;if(typeof e==`boolean`)return+!!e;if(typeof e!=`string`)return;let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}function z(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e!==0;if(e===`1`||e===`true`)return!0;if(e===`0`||e===`false`)return!1}function Ie(e,t){return{get:n=>{let r=e[n];if((r===void 0||r===``)&&(r=t[n]?.default),Array.isArray(r)&&(r=r[0]),typeof r==`boolean`||typeof r==`number`||typeof r==`string`)return r},has:e=>e in t}}var B=[`->`,`||`,`&&`,`==`,`!=`,`<=`,`>=`,`(`,`)`,`,`,`<`,`>`,`!`];function Le(e){let t=[],n=0;for(;ne.startsWith(t,n));if(a){t.push({kind:`op`,value:a}),n+=a.length;continue}let o=/^[A-Za-z_][A-Za-z0-9_]*(::[A-Za-z_][A-Za-z0-9_]*)*/.exec(e.slice(n));if(o){t.push({kind:`id`,value:o[0]}),n+=o[0].length;continue}return}return t}var Re=new Set([`opt_bool`,`opt_int`,`opt_float`,`opt_float_nullable`,`opt_int_nullable`,`opt_bool_nullable`,`opt_enum`,`opt_string`,`option`,`has`]),ze=class e{tokens=[];pos=0;cfg;locals;schema;resolving;memo;constructor(e,t,n,r,i){this.cfg=e,this.locals=t,this.schema=n,this.resolving=r,this.memo=i}evaluate(e){let t=Le(e);if(!t||t.length===0)return;this.tokens=t,this.pos=0;let n=this.parseOr();if(this.pos===this.tokens.length)return n}peek(){return this.tokens[this.pos]}eatOp(e){let t=this.peek();return t&&t.kind===`op`&&t.value===e?(this.pos+=1,!0):!1}parseOr(){let e=this.parseAnd();for(;this.eatOp(`||`);){let t=this.parseAnd(),n=z(e),r=z(t);e=n===!0||r===!0?!0:n===void 0||r===void 0?void 0:n||r}return e}parseAnd(){let e=this.parseComparison();for(;this.eatOp(`&&`);){let t=this.parseComparison(),n=z(e),r=z(t);e=n===!1||r===!1?!1:n===void 0||r===void 0?void 0:n&&r}return e}parseComparison(){let e=this.parseUnary();for(let t of[`==`,`!=`,`<=`,`>=`,`<`,`>`])if(this.eatOp(t))return Be(e,this.parseUnary(),t,this.schema);return e}parseUnary(){if(this.eatOp(`!`)){let e=z(this.parseUnary());return e===void 0?void 0:!e}return this.parsePrimary()}parsePrimary(){let e=this.peek();if(!e)return;if(e.kind===`num`||e.kind===`str`)return this.pos+=1,e.value;if(e.kind===`op`&&e.value===`(`){this.pos+=1;let e=this.parseOr();return this.eatOp(`)`)?e:void 0}if(e.kind!==`id`)return;if(this.pos+=1,e.value===`true`)return!0;if(e.value===`false`)return!1;if(e.value===`config`)return this.parseConfigAccess();let t=this.locals[e.value];return t===void 0?`${Fe}${e.value}`:this.resolveLocal(e.value,t)}parseConfigAccess(){if(!this.eatOp(`->`))return;let e=this.peek();if(!e||e.kind!==`id`||!Re.has(e.value))return;if(this.pos+=1,this.eatOp(`<`)){let e=1;for(;e>0;){let t=this.peek();if(!t)return;this.pos+=1,t.kind===`op`&&t.value===`<`&&(e+=1),t.kind===`op`&&t.value===`>`&&--e}}if(!this.eatOp(`(`))return;let t=this.peek();if(!t||t.kind!==`str`)return;this.pos+=1;let n=t.value;for(;this.eatOp(`,`);){let e=0;for(;;){let t=this.peek();if(!t)return;if(t.kind===`op`&&t.value===`(`&&(e+=1),t.kind===`op`&&t.value===`)`){if(e===0)break;--e}if(t.kind===`op`&&t.value===`,`&&e===0)break;this.pos+=1}}if(!this.eatOp(`)`))return;if(this.eatOp(`->`)){let e=this.peek();if(!e||e.kind!==`id`)return;this.pos+=1}if(e.value===`has`)return this.cfg.has(n);let r=this.cfg.get(n);return this.schema[n]?.enum_values?{enumKey:n,value:typeof r==`string`?r:void 0}:r}resolveLocal(t,n){let r=this.memo.get(t);if(r!==void 0||this.memo.has(t))return r;if(this.resolving.has(t))return;this.resolving.add(t);let i=new e(this.cfg,this.locals,this.schema,this.resolving,this.memo).evaluate(n);return this.resolving.delete(t),this.memo.set(t,i),i}};function Be(e,t,n,r){let i=typeof e==`string`&&e.startsWith(Fe)?e:typeof t==`string`&&t.startsWith(Fe)?t:void 0;if(i!==void 0){if(n!==`==`&&n!==`!=`)return;let a=i===e?t:e;if(!L(a))return;let o=r[a.enumKey]?.enum_values;if(!o||a.value===void 0)return;let s=Ve(i.slice(5)).filter(e=>o.includes(e));if(s.length!==1)return;let c=s[0]===a.value;return n===`==`?c:!c}let a=L(e)?e.value:e,o=L(t)?t.value:t;if(n===`==`||n===`!=`){if(a===void 0||o===void 0)return;let e=typeof a==`string`||typeof o==`string`?String(a)===String(o):R(a)===R(o);return n===`==`?e:!e}let s=R(a),c=R(o);if(!(s===void 0||c===void 0)){if(n===`<`)return s`)return s>c;if(n===`>=`)return s>=c}}function Ve(e){let t=e.includes(`::`)?e.slice(e.lastIndexOf(`::`)+2):e,n=[t,/^[a-z]+([A-Z].*)$/.exec(t)?.[1]].filter(e=>!!e),r=new Set;for(let e of n){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toLowerCase();r.add(t),r.add(t.replace(/_/g,` `)),r.add(t.replace(/_/g,``))}return[...r]}function V(e,t,n){let r=Ie(e,t),i=new Map,a=new Set;for(let e of n.rules){let o=H(e.enable_if);if(o&&z(new ze(r,n.locals,t,new Set,i).evaluate(o))===!1)for(let t of e.fields)a.add(t)}return a}function H(e){let t=0;for(let n=0;nHe.has(e.type);function We(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`)return;let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}function Ge(e){let t=e.sidetext;if(!(!t||t.includes(`->`)||t.includes(`::`)))return t}function U(e,t){let n=t===void 0?e.default:t;return n===void 0?``:Array.isArray(n)?n.map(String).join(`, `):typeof n==`boolean`?n?`1`:`0`:String(n)}function W(e,t){if(Ue(e))return(Array.isArray(t)?t.map(String):String(t).split(`,`)).map(e=>e.trim()).filter(e=>e!==``);if(e.type===`coBool`)return typeof t==`boolean`?t?`1`:`0`:t===`1`||t===`true`||t===1?`1`:`0`;let n=String(t).trim();return e.type===`coPercent`?n.endsWith(`%`)?n:`${n}%`:n}function G(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e&&(n[r]=W(e,i))}return n}function K(e,t,n){if(t===void 0||t===``)return!1;let r=t=>{let n=W(e,Array.isArray(t)?t.map(String).join(`, `):t);return Array.isArray(n)?n.join(`, `):n},i=r(t),a=n===void 0?e.default:n;return a===void 0?i!==``:i!==r(a)}var Ke=new Set([`support_filament`,`support_interface_filament`,`outer_wall_filament_id`,`inner_wall_filament_id`,`top_surface_filament_id`,`bottom_surface_filament_id`,`internal_solid_filament_id`,`sparse_infill_filament_id`]),qe=[`simple`,`advanced`,`expert`],Je={simple:0,advanced:1,expert:2,develop:3};function Ye({values:e,onChange:t,disabled:n=!1,sourceOverrides:r=[],sourceSelected:a,onToggleSource:o,filamentChoices:s,presetValues:c,presetValuesResolved:l=!0,presetValuesReason:u}){let{t:d}=i(),[f,p]=(0,j.useState)(null),[g,_]=(0,j.useState)(`simple`),[v,b]=(0,j.useState)(null),[S,C]=(0,j.useState)(``);(0,j.useEffect)(()=>{let e=!1;return Promise.all([x(()=>import(`./process-schema-CzfeynAH.js`),[]),x(()=>import(`./process-ui-tree-BWrKRLV6.js`),[]),x(()=>import(`./process-toggle-rules-DDBax3G5.js`),[])]).then(([t,n,r])=>{e||p({schema:t.default??t,tree:n.default??n,toggles:r.default??r})}),()=>{e=!0}},[]);let w=(0,j.useMemo)(()=>{let t={...c??{}};for(let e of r)a?.has(e.key)&&(t[e.key]=e.value);for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&(t[n]=r);return t},[c,r,a,e]),T=(0,j.useMemo)(()=>f?V(w,f.schema,f.toggles):new Set,[f,w]),E=(0,j.useMemo)(()=>new Map(r.map(e=>[e.key,e])),[r]),ee=(0,j.useMemo)(()=>r.filter(e=>!e.printer_coupled&&!e.preset_defining),[r]),te=(0,j.useMemo)(()=>r.filter(e=>a?.has(e.key)).length,[r,a]),D=(0,j.useMemo)(()=>f?r.filter(e=>!f.schema[e.key]):[],[f,r]),O=e=>{if(!f)return;let n={};for(let[t,r]of Object.entries(e))f.schema[t]&&K(f.schema[t],r,c?.[t])&&(n[t]=r);t(e,G(n,f.schema))},ne=(t,n)=>{let r={...e};n===void 0?delete r[t]:r[t]=n,O(r)},k=(0,j.useMemo)(()=>{if(!f)return[];let e=e=>e.toLowerCase().replace(/[_\s]+/g,` `).trim(),t=e(S),n=e=>Je[f.schema[e]?.mode??`expert`]<=Je[g],r=(n,r,i)=>{if(!t)return!0;let a=f.schema[n];return[n,a?.label??``,a?.tooltip??``,r,i].some(n=>e(n).includes(t))};return f.tree.map(e=>({...e,groups:e.groups.map(t=>({...t,options:t.options.filter(i=>n(i)&&r(i,t.group,e.page))})).filter(e=>e.options.length>0)})).filter(e=>e.groups.length>0)},[f,g,S]),A=(0,j.useMemo)(()=>k.length===0||S.trim()?null:k.find(e=>e.page===v)??k[0],[k,v,S]),re=(0,j.useMemo)(()=>f?Object.keys(e).filter(t=>f.schema[t]&&K(f.schema[t],e[t],c?.[t])).length:0,[f,e,c]);if(!f)return(0,N.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-sm text-bambu-gray`,children:[(0,N.jsx)(m,{className:`w-4 h-4 animate-spin`}),d(`slicerSettings.loading`,`Loading slicer settings...`)]});let M=A?[A]:k;return(0,N.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`div`,{className:`flex overflow-hidden rounded border border-bambu-dark-tertiary`,children:qe.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>_(e),disabled:n,className:`px-2.5 py-1 text-xs capitalize transition-colors ${g===e?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:d(`slicerSettings.mode.${e}`,e)},e))}),(0,N.jsxs)(`div`,{className:`relative flex-1 min-w-[10rem]`,children:[(0,N.jsx)(h,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-bambu-gray`}),(0,N.jsx)(`input`,{type:`search`,value:S,onChange:e=>C(e.target.value),disabled:n,placeholder:d(`slicerSettings.searchPlaceholder`,`Search settings`),className:`w-full rounded border border-bambu-dark-tertiary bg-bambu-dark pl-7 pr-2 py-1 text-xs text-white placeholder:text-bambu-gray/60 focus:border-bambu-green focus:outline-none disabled:opacity-40`})]}),re>0&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>O({}),disabled:n,className:`flex items-center gap-1 text-xs text-bambu-gray hover:text-white`,children:[(0,N.jsx)(y,{className:`w-3 h-3`}),d(`slicerSettings.resetAll`,`Reset {{count}}`,{count:re})]})]}),!l&&(0,N.jsx)(`p`,{className:`rounded border border-amber-300 bg-amber-50 px-2 py-1 text-[0.7rem] text-amber-800 dark:border-amber-700/40 dark:bg-amber-900/20 dark:text-amber-200`,children:u===`sidecar_outdated`?d(`slicerSettings.presetValuesOutdatedSidecar`,`Showing slicer defaults: your slicer sidecar is older than this feature and can't report a preset's values. Update the sidecar image to see them. Anything you don't change still uses the preset.`):u===`not_configured`?d(`slicerSettings.presetValuesNotConfigured`,`Showing slicer defaults: no slicer sidecar is configured, so a preset's values can't be read. Anything you don't change still uses the preset.`):u===`sidecar_unavailable`?d(`slicerSettings.presetValuesSidecarUnavailable`,`Showing slicer defaults: the slicer sidecar did not answer, so a preset's values can't be read. Anything you don't change still uses the preset.`):d(`slicerSettings.presetValuesUnavailable`,`Showing slicer defaults: the picked preset's own values could not be read. Anything you don't change still uses the preset.`)}),r.length>0&&o&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded border border-bambu-dark-tertiary px-2 py-1.5 text-[0.7rem] text-bambu-gray`,children:[(0,N.jsx)(`span`,{className:`min-w-0 flex-1`,children:d(`slicerSettings.fromFileSummary`,`The designer changed {{count}} process settings in this file. Only the ones you tick are used.`,{count:r.length})}),(0,N.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>ee.forEach(e=>o(e.key,!0)),title:d(`slicerSettings.fromFileUseAllHint`,`Ticks the settings that carry across printers. The ones tuned for the designer's own printer, and the ones that define the preset you picked, stay off.`),className:`shrink-0 rounded border border-bambu-dark-tertiary px-1.5 py-0.5 hover:text-white disabled:opacity-40`,children:d(`slicerSettings.fromFileUseAll`,`Use the designer's settings`)}),te>0&&(0,N.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>r.forEach(e=>o(e.key,!1)),className:`shrink-0 rounded border border-bambu-dark-tertiary px-1.5 py-0.5 hover:text-white disabled:opacity-40`,children:d(`slicerSettings.fromFileClear`,`Clear {{count}}`,{count:te})})]}),!S.trim()&&(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:k.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>b(e.page),disabled:n,className:`px-2 py-1 text-xs rounded transition-colors ${A?.page===e.page?`bg-bambu-dark-tertiary text-white`:`text-bambu-gray hover:text-white`}`,children:e.page},e.page))}),M.length===0?(0,N.jsx)(`p`,{className:`py-6 text-center text-xs text-bambu-gray`,children:d(`slicerSettings.noMatches`,`No settings match this search.`)}):(0,N.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[22rem] lg:max-h-[58vh] overflow-y-auto pr-1`,children:[M.map(t=>(0,N.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[S.trim()&&(0,N.jsx)(`p`,{className:`text-[0.7rem] uppercase tracking-wide text-bambu-gray/70`,children:t.page}),t.groups.map(r=>(0,N.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,N.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-white`,children:r.group}),r.options.map(t=>(0,N.jsx)(Xe,{optionKey:t,option:f.schema[t],value:e[t],onChange:e=>ne(t,e),disabled:n||T.has(t),disabledBySlicer:T.has(t),formDisabled:n,source:E.get(t),sourceOn:a?.has(t)??!1,onToggleSource:o,filamentChoices:Ke.has(t)?s:void 0,presetValue:c?.[t]},t))]},`${t.page}:${r.group}`))]},t.page)),D.length>0&&!S.trim()&&(0,N.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,N.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-white`,children:d(`slicerSettings.otherFromFile`,`Other settings from this file`)}),D.map(e=>(0,N.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:a?.has(e.key)??!1,disabled:n||!o,onChange:t=>o?.(e.key,t.target.checked),className:`shrink-0 cursor-pointer disabled:opacity-40`}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,N.jsx)(`span`,{className:`font-mono text-bambu-gray`,children:e.key}),(0,N.jsx)(`span`,{className:`ml-1.5 text-white`,children:q(e.value)})]}),(e.printer_coupled||e.preset_defining)&&(0,N.jsx)(`span`,{className:`shrink-0 rounded bg-amber-100 px-1 py-0.5 text-[10px] text-amber-700 dark:bg-amber-500/20 dark:text-amber-400`,children:e.printer_coupled?d(`slicerSettings.fromFilePrinterCoupled`,`designer's printer`):d(`slicerSettings.fromFileOverridesPreset`,`overrides preset`)})]},e.key))]})]})]})}function Xe({optionKey:e,option:t,value:n,onChange:r,disabled:a,disabledBySlicer:o,formDisabled:s,source:c,sourceOn:l=!1,onToggleSource:u,filamentChoices:d,presetValue:f}){let{t:p}=i(),m=K(t,n,f),h=Ge(t),g=n===void 0?l&&c?q(c.value):U(t,f):String(n);return(0,N.jsxs)(`div`,{className:`flex items-center gap-2 group`,title:t.tooltip,children:[(0,N.jsxs)(`label`,{htmlFor:`slicer-opt-${e}`,className:`flex min-w-0 flex-1 items-center gap-1 text-xs ${o?`text-bambu-gray/40`:`text-bambu-gray`}`,children:[(0,N.jsx)(`span`,{className:`truncate`,title:t.label||e,children:t.label||e}),m&&(0,N.jsx)(`span`,{className:`shrink-0 text-bambu-green`,"aria-hidden":`true`,children:`•`}),c&&(0,N.jsx)(`span`,{className:`shrink-0 rounded px-1 py-0.5 text-[10px] ${c.printer_coupled||c.preset_defining?`bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400`:`bg-bambu-green/15 text-bambu-green`}`,title:c.printer_coupled?p(`slicerSettings.fromFilePrinterCoupledHint`,`Tuned for the printer this file was designed for -- may be wrong or out of range on yours.`):c.preset_defining?p(`slicerSettings.fromFileOverridesPresetHint`,`The file sets this to {{value}} where the preset you picked uses {{preset}}. Tick it only if the file should win.`,{value:q(c.value),preset:U(t,f)}):p(`slicerSettings.fromFileHint`,`The designer changed this in the source file. Its value is {{value}}.`,{value:q(c.value)}),children:c.printer_coupled?p(`slicerSettings.fromFilePrinterCoupled`,`designer's printer`):c.preset_defining?p(`slicerSettings.fromFileOverridesPreset`,`overrides preset`):p(`slicerSettings.fromFile`,`from file`)})]}),(0,N.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`flex w-3 shrink-0 justify-center`,children:c&&u&&(0,N.jsx)(`input`,{type:`checkbox`,checked:l,disabled:s,onChange:t=>u(e,t.target.checked),"aria-label":p(`slicerSettings.useFromFile`,`Use the source file's value for {{option}}`,{option:t.label||e}),title:p(`slicerSettings.useFromFile`,`Use the source file's value for {{option}}`,{option:t.label||e}),className:`w-3 h-3 cursor-pointer disabled:opacity-40`})}),(0,N.jsx)(`div`,{className:`w-40`,children:(0,N.jsx)(Ze,{id:`slicer-opt-${e}`,option:t,current:g,onChange:r,disabled:a,filamentChoices:d})}),(0,N.jsx)(`span`,{className:`w-16 shrink-0 whitespace-nowrap text-[0.65rem] text-bambu-gray/60`,children:h??``}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>r(void 0),disabled:a||!m,"aria-label":p(`slicerSettings.resetOption`,`Reset to default`),className:`p-0.5 transition-opacity ${m?`text-bambu-gray hover:text-white`:`opacity-0 pointer-events-none`}`,children:(0,N.jsx)(y,{className:`w-3 h-3`})})]})]})}function q(e){return Array.isArray(e)?e.map(e=>String(e)).join(`, `):e==null?``:String(e)}function Ze({id:e,option:t,current:n,onChange:r,disabled:a,filamentChoices:o}){let{t:s}=i(),c=`w-full rounded border border-bambu-dark-tertiary bg-bambu-dark px-1.5 py-0.5 text-xs text-white focus:border-bambu-green focus:outline-none disabled:opacity-40`;if(o&&o.length>0){let t=o.find(e=>String(e.index)===n);return(0,N.jsxs)(`div`,{className:`relative w-full`,children:[(0,N.jsxs)(`select`,{id:e,value:n,onChange:e=>r(e.target.value),disabled:a,className:`${c} w-full cursor-pointer appearance-none pr-5`,title:t?.label,children:[(0,N.jsx)(`option`,{value:`0`,children:s(`slicerSettings.filamentDefault`,`Default`)}),o.map(e=>(0,N.jsxs)(`option`,{value:String(e.index),children:[e.index,`: `,e.label]},e.index))]}),(0,N.jsx)(u,{className:`pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-bambu-gray`})]})}return t.type===`coBool`?(0,N.jsx)(`input`,{id:e,type:`checkbox`,checked:n===`1`||n===`true`,onChange:e=>r(e.target.checked),disabled:a,className:`w-3.5 h-3.5 cursor-pointer disabled:opacity-40`}):t.type===`coEnum`&&t.enum_values?(0,N.jsxs)(`div`,{className:`relative w-full`,children:[(0,N.jsx)(`select`,{id:e,value:n,onChange:e=>r(e.target.value),disabled:a,className:`${c} w-full cursor-pointer appearance-none pr-5`,children:t.enum_values.map((e,n)=>(0,N.jsx)(`option`,{value:e,children:t.enum_labels?.[n]??e},e))}),(0,N.jsx)(u,{className:`pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-bambu-gray`})]}):t.type===`coInt`||t.type===`coFloat`||t.type===`coPercent`?(0,N.jsx)(`input`,{id:e,type:`number`,value:n.replace(`%`,``),min:We(t.min),max:We(t.max),step:t.type===`coInt`?1:`any`,onChange:e=>r(e.target.value),disabled:a,className:c}):(0,N.jsx)(`input`,{id:e,type:`text`,value:n,onChange:e=>r(e.target.value),disabled:a,className:c})}var Qe=`bambuddy.slice.onlyConnectedModels`,$e=`bambuddy.slice.onlyLoadedSpools`;function et(e){try{return localStorage.getItem(e)===`true`}catch{return!1}}function tt(e,t){try{localStorage.setItem(e,String(t))}catch{}}var nt=[];function J(e){return e?`${e.source}:${e.id}`:``}function Y(e){if(!e)return null;let t=e.indexOf(`:`);if(t<0)return null;let n=e.slice(0,t),r=e.slice(t+1);return n!==`orca_cloud`&&n!==`cloud`&&n!==`local`&&n!==`standard`?null:{source:n,id:r}}function rt({requestId:e,sourceName:t}){let{t:n}=i(),{showPersistentToast:a,dismissToast:o}=d(),[s,c]=(0,j.useState)(0),[l,u]=(0,j.useState)(null),f=t;try{f=decodeURIComponent(t)}catch{}(0,j.useEffect)(()=>{let e=Date.now(),t=setInterval(()=>c(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[]),(0,j.useEffect)(()=>{let t=!1,n=setInterval(async()=>{if(t)return;let n=await r.getPreviewSliceProgress(e);!t&&n&&u(n)},1e3);return()=>{t=!0,clearInterval(n)}},[e]);let p=`slice-preview-${e}`;(0,j.useEffect)(()=>{let e=l&&l.stage&&l.total_percent>0,t=it(s);return e?a(p,n(`slice.previewWithProgress`,`Analyzing {{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,{name:f,stage:l.stage,percent:Math.min(100,Math.max(0,Math.round(l.total_percent))),elapsed:t}),`loading`):a(p,n(`slice.previewToast`,{name:f,elapsed:t}),`loading`),()=>{o(p)}},[s,l,f,a,o,n,p]);let h=l?.stage,g=l?.total_percent,_=h&&typeof g==`number`&&g>0?`${h} (${Math.min(100,Math.max(0,Math.round(g)))}%)`:n(`slice.analyzingPlateFilaments`);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-1 text-bambu-gray text-sm py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(m,{className:`w-4 h-4 animate-spin`}),_,(0,N.jsxs)(`span`,{className:`text-xs tabular-nums`,children:[s,`s`]})]}),s>=5&&(0,N.jsx)(`div`,{className:`text-xs text-bambu-gray/70 pl-6`,children:n(`slice.analyzingPlateFilamentsHint`,`Running a preview slice to discover which AMS slots this plate uses. Cached after — re-opening is instant.`)})]})}function it(e){let t=Math.max(0,Math.floor(e));if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}var at=`#00AE42`;function X(e){let t=(e||``).trim();return/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(t)?t.slice(0,7).toUpperCase():at}function ot({source:e,onClose:t,defaultAutoArrange:n=!1}){let{t:a}=i(),{trackJob:l}=ee(),u=o(),[f,h]=(0,j.useState)(null),[_,v]=(0,j.useState)(null),[y,b]=(0,j.useState)([]),x=(0,j.useRef)(new Set),C=(0,j.useRef)(!1),[w,T]=(0,j.useState)([]),[E,te]=(0,j.useState)(null),[D,ne]=(0,j.useState)(null),[A,re]=(0,j.useState)(!1),[M,P]=(0,j.useState)(null),[F,le]=(0,j.useState)(!1),[ue,de]=(0,j.useState)(!1),[me,he]=(0,j.useState)(n),[ge,xe]=(0,j.useState)(new Set),[Se,Ce]=(0,j.useState)({}),[we,Te]=(0,j.useState)({}),[Ee,Oe]=(0,j.useState)(!1),ke=ie(),je=ke||Ee,Ne=s({queryKey:[`slicer-pipelines`],queryFn:()=>r.listSlicerPipelines(),staleTime:6e4}),[Pe,L]=(0,j.useState)(!1),[Fe,R]=(0,j.useState)(``),{showToast:z}=d(),Ie=c({mutationFn:e=>r.createSlicerPipeline(e),onSuccess:()=>{u.invalidateQueries({queryKey:[`slicer-pipelines`]}),z(a(`slice.pipelines.toast.saved`,`Pipeline saved`),`success`),L(!1),R(``)},onError:e=>{z(e.message||a(`slice.pipelines.toast.saveFailed`,`Save failed`),`error`)}}),B=s({queryKey:[`slicePlates`,e.kind,e.id],queryFn:async()=>e.kind===`libraryFile`?r.getLibraryFilePlates(e.id):r.getArchivePlates(e.id),staleTime:6e4}),Le=!!B.data?.is_multi_plate&&(B.data?.plates?.length??0)>1,Re=Le&&D==null,ze=D??1,Be=(0,j.useMemo)(()=>{let t=typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`;return`${e.kind}-${e.id}-p${ze}-${t}`},[e.kind,e.id,ze]),Ve=s({queryKey:[`sliceFilamentReqs`,e.kind,e.id,ze],queryFn:async()=>e.kind===`libraryFile`?r.getLibraryFileFilamentRequirements(e.id,ze,Be,!0):r.getArchiveFilamentRequirements(e.id,ze,Be,!0),enabled:!Re,staleTime:6e4}),V=(0,j.useMemo)(()=>{let e=Ve.data?.filaments??[],t=e.length>0?e:[{slot_id:1,type:``,color:``,used_grams:0,used_meters:0}];return A?t.map(e=>({...e,used_in_plate:!0})):t},[A,Ve.data]),H=s({queryKey:[`slicerPresets`],queryFn:()=>r.getSlicerPresets(),staleTime:6e4,enabled:!B.isLoading&&!Re}),[He,Ue]=(0,j.useState)(!1),We=async()=>{if(!He){Ue(!0);try{let e=await r.getSlicerPresets({refresh:!0});u.setQueryData([`slicerPresets`],e)}catch{u.invalidateQueries({queryKey:[`slicerPresets`]})}finally{Ue(!1)}}},Ge=s({queryKey:[`slicerPrinterModels`],queryFn:r.getSlicerPrinterModels,staleTime:1/0}),U=(0,j.useMemo)(()=>!H.data||!f?null:I(H.data,f,`printer`)?.name??null,[H.data,f]),W=(0,j.useMemo)(()=>{let e={},t=H.data;if(!t)return e;for(let n of[t.local,t.orca_cloud,t.cloud,t.standard])for(let t of n.printer)t.inherits&&!Object.hasOwn(e,t.name)&&(e[t.name]=t.inherits);return e},[H.data]),G=(0,j.useMemo)(()=>k(Ge.data??{},W),[Ge.data,W]),[K,Ke]=(0,j.useState)(()=>et(Qe)),[qe,Je]=(0,j.useState)(()=>et($e)),[Xe,q]=(0,j.useState)(null),Ze=s({queryKey:[`slicerLoadedSpools`],queryFn:r.getSlicerLoadedSpools,staleTime:15e3,retry:!1,enabled:!Re}),J=Ze.data?.printers??nt,Y=(0,j.useMemo)(()=>Ge.data??{},[Ge.data]),it=(0,j.useMemo)(()=>_e(J,ve(U,Y,W)),[J,U,Y,W]),at=(0,j.useMemo)(()=>H.data?De(H.data):new Map,[H.data]),X=(0,j.useMemo)(()=>H.data?Ae(it,H.data,at,U,G):new Set,[it,H.data,at,U,G]),ot=(0,j.useMemo)(()=>{if(!K||J.length===0)return null;let e=J.map(e=>e.model);return t=>ye(t,e,Y,W)},[K,J,Y,W]),Z=(0,j.useMemo)(()=>!qe||X.size===0?null:e=>X.has(`${e.source}:${e.id}`),[qe,X]),ut=(0,j.useMemo)(()=>{let e=H.data;if(!e||!Z)return null;let t=e=>({...e,filament:e.filament.filter(Z)});return{...e,local:t(e.local),orca_cloud:t(e.orca_cloud),cloud:t(e.cloud),standard:t(e.standard)}},[H.data,Z]),dt=s({queryKey:[`slicer-preset-values`,_?.source,_?.id],queryFn:()=>r.getSlicerPresetValues(_),enabled:_!=null,staleTime:5*6e4}),ft=dt.data?.values,pt=dt.data?.resolved??dt.isLoading,mt=dt.data?.reason??(dt.isError?`sidecar_unavailable`:void 0),ht=(0,j.useMemo)(()=>{let e=H.data;return V.map((t,n)=>{let r=y[n]??null,i=e&&r?I(e,r,`filament`):null;return{index:n+1,label:i?.name||t.type||a(`slice.filamentSlotUnset`,`not set`),color:t.color||void 0}})},[V,y,H.data,a]),Q=B.data?.embedded_printer??null,gt=(0,j.useMemo)(()=>B.data?.design_overrides??[],[B.data]),_t=B.data?.embedded_process??null,vt=(0,j.useMemo)(()=>{if(!Q||!_t||!U)return!1;let e=e=>e.replace(/^#\s*/,``).trim().toLowerCase();return e(U)===e(Q)},[Q,_t,U]);(0,j.useEffect)(()=>{vt||le(!1)},[vt]),(0,j.useEffect)(()=>{xe(F?new Set(gt.map(e=>e.key)):new Set)},[gt,F]),(0,j.useEffect)(()=>{let e=H.data;e&&(f??h(se(e,`printer`,Q)??oe(e,`printer`)))},[H.data,Q]),(0,j.useEffect)(()=>{let e=H.data;if(!e||!ot||C.current||!f||F)return;let t=I(e,f,`printer`);if(t&&ot(t))return;let n=se(e,`printer`,Q),r=I(e,n,`printer`),i=r&&ot(r)?n:be(e,J.map(e=>e.model),Y,W);i&&h(i)},[H.data,ot,f,Q,J,Y,W,F]),(0,j.useEffect)(()=>{let e=H.data;e&&v(t=>{if(t){let n=I(e,t,`process`);if(n&&O(n,`process`,U,G)!==`mismatch`)return t}return ce(e,U,G,_t)})},[H.data,U,G,_t]),(0,j.useEffect)(()=>{let e=H.data;e&&b(t=>V.map((n,r)=>{let i=t[r]??null;if(i){let t=I(e,i,`filament`),a=t&&!x.current.has(r)&&fe(t,n.type),o=t&&Z!==null&&!x.current.has(r)&&!Z(t);if(t&&!a&&!o&&O(t,`filament`,U,G)!==`mismatch`)return i}let a={type:n.type,color:n.color},o=ut&&pe(ut,a,U,G),s=I(e,o??null,`filament`);return o&&s&&!fe(s,n.type)?o:pe(e,a,U,G)}))},[H.data,V,U,G,Z,ut]),(0,j.useEffect)(()=>{T(e=>e.length===V.length?e:(x.current=new Set,V.map(()=>null)))},[V]);let yt=c({mutationFn:async t=>{let n=bt(t);return e.kind===`libraryFile`?r.sliceLibraryFile(e.id,n):r.sliceArchive(e.id,n)},onSuccess:n=>{l(n.job_id,e.kind,e.filename),t()},onError:e=>{te(e instanceof Error?e.message:String(e))}});function bt(e){if(!f||!_||y.length===0||y.some(e=>e==null))throw Error(a(`slice.allPresetsRequired`));return{printer_preset:f,process_preset:_,filament_preset:y[0],filament_presets:y,filament_colours:V.map((e,t)=>w[t]??e.color??``),...e==null?{}:{plate:e},...M==null?{}:{bed_type:M},...F&&vt?{use_embedded_settings:!0}:{},...!F&>.length>0?{design_overrides:[...ge]}:{},...!F&&Object.keys(Se).length>0?{process_overrides:we}:{},...ue?{auto_orient:!0}:{},...me?{auto_arrange:!0}:{}}}let xt=f!=null&&_!=null&&Ve.isSuccess&&y.length>0&&y.every(e=>e!=null),$=yt.isPending,St=B.data?.plates?.length??0,Ct=Le&&St>1&&!Re;return Re&&B.data?(0,N.jsx)(ae,{plates:B.data.plates,onSelect:e=>ne(e),onClose:t}):(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:()=>{$||t()},children:[(0,N.jsxs)(`div`,{className:`w-full max-w-xl lg:max-w-5xl xl:max-w-7xl 2xl:max-w-[96rem] max-h-[85vh] flex flex-col rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary/60`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`flex-shrink-0 flex items-start justify-between gap-3 px-4 pt-4 pb-3 border-b border-bambu-dark-tertiary/40`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsxs)(`h3`,{className:`text-white font-medium flex items-center gap-2`,children:[(0,N.jsx)(p,{className:`w-4 h-4`}),a(`slice.title`)]}),(0,N.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1 truncate`,title:e.filename,children:[e.filename,D==null?``:` • ${a(`archives.platePicker.plateLabel`,{index:D})}`]})]}),(0,N.jsx)(`button`,{onClick:t,disabled:$,className:`flex-shrink-0 text-bambu-gray hover:text-white transition-colors disabled:opacity-50`,"aria-label":a(`common.close`),children:(0,N.jsx)(g,{className:`w-5 h-5`})})]}),(0,N.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[(B.isLoading||H.isLoading)&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-sm`,children:[(0,N.jsx)(m,{className:`w-4 h-4 animate-spin`}),a(`slice.loadingPresets`)]}),H.isError&&(0,N.jsx)(`div`,{className:`text-sm text-red-700 dark:text-red-400`,role:`alert`,children:a(`slice.presetsLoadFailed`,`Failed to load presets. Open Settings → Profiles to import them, or sign in to Bambu Cloud.`)}),H.data&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,N.jsx)(st,{status:H.data.cloud_status,cloudName:`bambu`}),(0,N.jsx)(st,{status:H.data.orca_cloud_status,cloudName:`orca`})]}),(0,N.jsxs)(`button`,{type:`button`,onClick:We,disabled:He||$,className:`flex-shrink-0 inline-flex items-center gap-1 px-2 py-1 rounded-md text-xs text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary/40 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:a(`slice.refreshPresetsTitle`),"aria-label":a(`slice.refreshPresets`),children:[(0,N.jsx)(S,{className:`w-3.5 h-3.5 ${He?`animate-spin`:``}`}),a(`slice.refreshPresets`)]})]}),(0,N.jsxs)(`div`,{className:`lg:grid lg:grid-cols-[minmax(20rem,2fr)_minmax(0,3fr)] lg:gap-5 lg:items-start`,children:[(0,N.jsxs)(`div`,{className:`space-y-4 min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-2 py-1.5 rounded-md bg-bambu-dark/40 border border-bambu-dark-tertiary`,children:[(0,N.jsxs)(`span`,{className:`text-xs font-medium text-bambu-gray flex items-center gap-1`,children:[(0,N.jsx)(p,{className:`w-3.5 h-3.5`}),` `,a(`slice.pipelines.label`,`Pipeline`)]}),(0,N.jsxs)(`select`,{value:``,disabled:$||(Ne.data?.pipelines.length??0)===0,onChange:e=>{let t=parseInt(e.target.value,10);if(Number.isNaN(t))return;let n=Ne.data?.pipelines.find(e=>e.id===t);n&&(C.current=!0,h(n.printer_preset),v(n.process_preset),P(n.bed_type),b(e=>{let t=e.length>0?[...e]:n.filament_presets.map(()=>null);for(let e=0;e(0,N.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),Pe?(0,N.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-[16ch]`,children:[(0,N.jsx)(`input`,{autoFocus:!0,value:Fe,onChange:e=>R(e.target.value),placeholder:a(`slice.pipelines.namePlaceholder`,`Pipeline name`),"aria-label":a(`slice.pipelines.nameAria`,`New pipeline name`),className:`flex-1 text-xs px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{let e=Fe.trim();if(!e||!f||!_)return;let t=y.filter(e=>e!==null);t.length!==0&&Ie.mutate({name:e,printer_preset:f,process_preset:_,filament_presets:t,bed_type:M})},disabled:Ie.isPending||!Fe.trim(),className:`text-xs px-2 py-1 bg-bambu-green hover:bg-bambu-green/80 text-white rounded disabled:opacity-50`,children:Ie.isPending?(0,N.jsx)(m,{className:`w-3 h-3 animate-spin`}):a(`common.save`,`Save`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{L(!1),R(``)},className:`text-xs px-2 py-1 text-bambu-gray hover:text-white`,children:a(`common.cancel`,`Cancel`)})]}):(0,N.jsx)(`button`,{type:`button`,onClick:()=>{R(``),L(!0)},disabled:$||!f||!_||y.length===0||y.some(e=>e===null),className:`text-xs px-2 py-1 bg-bambu-green/20 hover:bg-bambu-green/30 text-bambu-green border border-bambu-green/40 rounded disabled:opacity-50 disabled:cursor-not-allowed`,title:a(`slice.pipelines.saveTitle`,`Save the current four-slot selection as a reusable pipeline`),children:a(`slice.pipelines.saveButton`,`Save as pipeline`)})]}),Ze.isSuccess&&(0,N.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,N.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>{Ke(e.target.checked),tt(Qe,e.target.checked)},disabled:$,className:`mt-0.5 cursor-pointer`}),(0,N.jsxs)(`span`,{children:[a(`slice.filters.onlyConnectedModels`,`Only printers that are online`),(0,N.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:a(`slice.filters.onlyConnectedModelsHint`,`Printer profiles for the models online right now, at every nozzle size.`)})]})]}),(0,N.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:qe,onChange:e=>{Je(e.target.checked),tt($e,e.target.checked)},disabled:$,className:`mt-0.5 cursor-pointer`}),(0,N.jsxs)(`span`,{children:[a(`slice.filters.onlyLoadedSpools`,`Only spools that are loaded`),(0,N.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:a(`slice.filters.onlyLoadedSpoolsHint`,`Filament profiles of the spools in the online printers of the selected model. A profile you pick yourself stays.`)})]})]}),(K||qe)&&J.length===0&&(0,N.jsx)(`p`,{className:`text-xs text-bambu-gray/70`,role:`status`,children:a(`slice.filters.noneOnline`,`No printer is online, so every profile is shown.`)}),qe&&J.length>0&&X.size===0&&(0,N.jsx)(`p`,{className:`text-xs text-bambu-gray/70`,role:`status`,children:a(`slice.filters.noneLoaded`,`No loaded spool has a profile for this printer, so every filament profile is shown.`)})]}),(0,N.jsx)(lt,{label:a(`slice.printer`),slot:`printer`,data:H.data,value:f,onChange:e=>{C.current=!0,h(e)},allowed:ot,filteredLabel:a(`slice.filters.notOnline`,`Not online`),disabled:$||F}),vt&&(0,N.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:F,onChange:e=>le(e.target.checked),disabled:$,className:`mt-0.5 cursor-pointer`}),(0,N.jsxs)(`span`,{children:[a(`slice.useEmbedded`),(0,N.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:a(`slice.useEmbeddedHint`)})]})]}),(0,N.jsx)(lt,{label:a(`slice.process`),slot:`process`,data:H.data,value:_,onChange:v,disabled:$||F,selectedPrinterName:U,compatIndex:G}),(0,N.jsx)(ct,{value:M,onChange:P,disabled:$||F}),(0,N.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,N.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:ue,onChange:e=>de(e.target.checked),disabled:$,className:`mt-0.5 cursor-pointer`}),(0,N.jsxs)(`span`,{children:[a(`slice.autoOrient`),(0,N.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:a(`slice.autoOrientHint`)})]})]}),(0,N.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:me,onChange:e=>he(e.target.checked),disabled:$,className:`mt-0.5 cursor-pointer`}),(0,N.jsxs)(`span`,{children:[a(`slice.autoArrange`),(0,N.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:a(`slice.autoArrangeHint`)})]})]})]}),Ve.isLoading?(0,N.jsx)(rt,{requestId:Be,sourceName:e.filename}):V.map((e,t)=>{let n=e.used_in_plate!==!1,r=V.length>1?a(`slice.filamentSlot`,{index:t+1,type:e.type}):a(`slice.filament`);return(0,N.jsx)(lt,{label:n?r:`${r} ${a(`slice.notUsedByPlate`)}`,slot:`filament`,data:H.data,value:y[t]??null,onChange:e=>{x.current.add(t),b(n=>{let r=n.length===V.length?[...n]:V.map((e,t)=>n[t]??null);return r[t]=e,r})},disabled:$||!n||F,swatchColor:w[t]??e.color,swatchColorLabel:a(`slice.filamentColour`),onSwatchColorChange:e=>T(n=>{let r=n.length===V.length?[...n]:V.map((e,t)=>n[t]??null);return r[t]=e,r}),selectedPrinterName:U,compatIndex:G,allowed:Z,filteredLabel:a(`slice.filters.notLoaded`,`Not loaded`),onPick:J.length>0?()=>q(t):void 0},`filament-${t}`)})]}),(0,N.jsx)(`div`,{className:`mt-4 lg:mt-0 min-w-0`,children:(0,N.jsxs)(`div`,{className:`rounded border border-bambu-dark-tertiary p-3 ${F?`opacity-60`:``}`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>Oe(e=>!e),"aria-expanded":je,disabled:ke,className:`flex w-full items-center justify-between gap-2 text-left lg:cursor-default`,children:[(0,N.jsxs)(`span`,{className:`text-sm text-white`,children:[a(`slice.processSettings`,`Process settings`),(0,N.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:F?a(`slice.processSettingsEmbedded`,`Not used while "Use the file's built-in settings" is on -- the file's own settings drive this slice.`):a(`slice.processSettingsHint`,`Adjust the picked preset for this slice. Anything you don't touch stays as the preset defines it.`)})]}),(0,N.jsx)(`span`,{className:`shrink-0 text-xs text-bambu-gray`,children:F?a(`slice.processSettingsInactive`,`Inactive`):Object.keys(we).length>0?a(`slice.processSettingsChanged`,`{{count}} changed`,{count:Object.keys(we).length}):a(`slice.processSettingsUnchanged`,`Preset defaults`)})]}),je&&(0,N.jsx)(`div`,{className:`mt-3 border-t border-bambu-dark-tertiary pt-3`,children:(0,N.jsx)(Ye,{values:Se,onChange:(e,t)=>{Ce(e),Te(t)},disabled:$||F,filamentChoices:ht,presetValues:ft,presetValuesResolved:pt,presetValuesReason:mt,sourceOverrides:gt,sourceSelected:ge,onToggleSource:(e,t)=>xe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})})})]})})]})]}),E&&(0,N.jsx)(`div`,{className:`text-sm text-red-700 dark:text-red-400 bg-red-900/20 border border-red-900/40 rounded p-2`,role:`alert`,children:E})]}),(0,N.jsxs)(`div`,{className:`flex-shrink-0 flex justify-end gap-2 px-4 py-3 border-t border-bambu-dark-tertiary/40`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:t,disabled:$,className:`px-3 py-1.5 text-sm rounded-md border border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray transition-colors disabled:opacity-50`,children:a(`common.cancel`)}),Ct&&(0,N.jsxs)(`label`,{className:`flex items-center gap-2 mr-auto text-sm text-bambu-gray cursor-pointer select-none`,title:a(`slice.actionAllTitle`,{count:St}),children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:A,onChange:e=>re(e.target.checked),disabled:$,className:`cursor-pointer`}),a(`slice.allPlatesToggle`,{count:St})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{te(null);let e=A?0:D;yt.mutate(e)},disabled:!xt||$,className:`px-3 py-1.5 text-sm rounded-md bg-bambu-green hover:bg-bambu-green/90 text-bambu-dark font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2`,children:$?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(m,{className:`w-4 h-4 animate-spin`}),a(`slice.enqueuing`)]}):A?a(`slice.actionAll`,{count:St}):a(`slice.action`)})]})]}),Xe!==null&&H.data&&V[Xe]&&(0,N.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,N.jsx)(Me,{printers:it,data:H.data,index:at,selectedPrinterName:U,compatIndex:G,slotLabel:V.length>1?a(`slice.filamentSlot`,{index:Xe+1,type:V[Xe].type}):a(`slice.filament`),onClose:()=>q(null),onPick:(e,t)=>{let n=Xe;x.current.add(n),b(t=>{let r=t.length===V.length?[...t]:V.map((e,n)=>t[n]??null);return r[n]=e.ref,r}),t&&T(e=>{let r=e.length===V.length?[...e]:V.map((t,n)=>e[n]??null);return r[n]=t,r}),q(null)}})})]})}function st({status:e,cloudName:t=`bambu`}){let{t:n}=i();if(e===`ok`||e===`not_authenticated`)return null;let r=t===`orca`?{expired:{key:`slice.orcaCloud.expired`,fallback:`Orca Cloud session expired — sign in again to refresh your Orca presets.`},unreachable:{key:`slice.orcaCloud.unreachable`,fallback:`Orca Cloud is unreachable right now. Other presets still work.`}}:{expired:{key:`slice.cloud.expired`,fallback:`Bambu Cloud session expired — sign in again to refresh your cloud presets.`},unreachable:{key:`slice.cloud.unreachable`,fallback:`Bambu Cloud is unreachable right now. Local and standard presets still work.`}},{tone:a,icon:o}={expired:{tone:`border-amber-300 dark:border-amber-700/40 bg-amber-50 dark:bg-amber-900/20 text-amber-800 dark:text-amber-200`,icon:f},unreachable:{tone:`border-bambu-dark-tertiary/40 bg-bambu-dark text-bambu-gray`,icon:f}}[e],{key:s,fallback:c}=r[e];return(0,N.jsxs)(`div`,{className:`flex items-start gap-2 text-xs rounded-md border p-2 ${a}`,role:`status`,children:[(0,N.jsx)(o,{className:`w-4 h-4 flex-shrink-0 mt-0.5`}),(0,N.jsx)(`span`,{children:n(s,c)})]})}var Z=[{value:`Cool Plate`,labelKey:`slice.bedType.coolPlate`,fallback:`Cool Plate`},{value:`Cool Plate (SuperTack)`,labelKey:`slice.bedType.coolPlateSuperTack`,fallback:`Cool Plate SuperTack`},{value:`Engineering Plate`,labelKey:`slice.bedType.engineering`,fallback:`Engineering Plate`},{value:`High Temp Plate`,labelKey:`slice.bedType.highTemp`,fallback:`High Temp Plate`},{value:`Textured PEI Plate`,labelKey:`slice.bedType.texturedPEI`,fallback:`Textured PEI Plate`},{value:`Smooth PEI Plate`,labelKey:`slice.bedType.smoothPEI`,fallback:`Smooth PEI Plate`}];function ct({value:e,onChange:t,disabled:n}){let{t:r}=i();return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:r(`slice.bedType.label`)}),(0,N.jsxs)(`select`,{value:e??``,onChange:e=>t(e.target.value===``?null:e.target.value),disabled:n,className:`flex-1 min-w-0 px-3 py-2 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-white text-sm focus:outline-none focus:border-bambu-gray disabled:opacity-50`,children:[(0,N.jsx)(`option`,{value:``,children:r(`slice.bedType.auto`)}),Z.map(e=>(0,N.jsx)(`option`,{value:e.value,children:r(e.labelKey,e.fallback)},e.value))]})]})}function lt({label:e,slot:t,data:n,value:r,onChange:a,disabled:o,swatchColor:s,onSwatchColorChange:c,swatchColorLabel:l,selectedPrinterName:u,compatIndex:d,allowed:f,filteredLabel:p,onPick:m}){let{t:h}=i(),[g,_]=(0,j.useState)(!1),v=(0,j.useId)(),y=`${v}-colour`,{sections:b,otherEntries:x,filteredEntries:S}=(0,j.useMemo)(()=>{let e=[{key:`local`,label:`slice.tier.local`,fallback:`Imported`},{key:`orca_cloud`,label:`slice.tier.orcaCloud`,fallback:`Orca Cloud`},{key:`cloud`,label:`slice.tier.cloud`,fallback:`Bambu Cloud`},{key:`standard`,label:`slice.tier.standard`,fallback:`Standard`}],r=t!==`printer`,i=[],a=[],o=[];for(let{key:s,label:c,fallback:l}of e){let e=n[s][t];if(e.length>0&&a.push({tierLabel:h(c,l),entries:e}),!r){e.length>0&&i.push({tierLabel:h(c,l),entries:e});continue}let f=[];for(let n of e)O(n,t,u??null,d??A)===`mismatch`?o.push(n):f.push(n);f.length>0&&i.push({tierLabel:h(c,l),entries:f})}if(i.length===0&&o.length>0)return{sections:a,otherEntries:[],filteredEntries:[]};if(f){let e=[],t=[];for(let n of i){let r=n.entries.filter(e=>f(e)?!0:(t.push(e),!1));r.length>0&&e.push({tierLabel:n.tierLabel,entries:r})}if(e.length>0)return{sections:e,otherEntries:o,filteredEntries:t}}return{sections:i,otherEntries:o,filteredEntries:[]}},[n,t,h,u,d,f]),C=J(r),w=(0,j.useMemo)(()=>g?x:x.filter(e=>`${e.source}:${e.id}`===C),[g,x,C]),T=(0,j.useMemo)(()=>g?S:S.filter(e=>`${e.source}:${e.id}`===C),[g,S,C]),E=x.length-w.length+S.length-T.length,ee=b.reduce((e,t)=>e+t.entries.length,0)+w.length+T.length;return(0,N.jsxs)(`div`,{className:`block`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray mb-1`,children:[!c&&s&&(0,N.jsx)(`span`,{className:`inline-block w-3 h-3 rounded-full border border-bambu-dark-tertiary`,style:{backgroundColor:s},"aria-hidden":!0}),(0,N.jsx)(`label`,{htmlFor:v,children:e}),(E>0||g)&&(0,N.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 font-normal`,children:[E>0&&(0,N.jsx)(`span`,{className:`text-bambu-gray/60`,children:h(`slice.presetsHidden`,`{{count}} hidden`,{count:E})}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>_(e=>!e),disabled:o,className:`text-bambu-green hover:underline disabled:opacity-50 disabled:no-underline`,children:g?h(`slice.showFewerPresets`,`Show fewer`):h(`slice.showAllPresets`,`Show all`)})]})]}),(0,N.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,N.jsxs)(`select`,{id:v,value:J(r),onChange:e=>a(Y(e.target.value)),disabled:o||ee===0,className:`w-full px-3 py-2 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-white text-sm focus:outline-none focus:border-bambu-gray disabled:opacity-50`,children:[(0,N.jsx)(`option`,{value:``,children:h(ee===0?`slice.noPresetsForSlot`:`slice.selectPreset`)}),b.map(e=>(0,N.jsx)(`optgroup`,{label:e.tierLabel,children:e.entries.map(e=>(0,N.jsx)(`option`,{value:`${e.source}:${e.id}`,children:e.name},`${e.source}:${e.id}`))},e.tierLabel)),T.length>0&&(0,N.jsx)(`optgroup`,{label:p??h(`slice.otherPrinters`),children:T.map(e=>(0,N.jsx)(`option`,{value:`${e.source}:${e.id}`,children:e.name},`${e.source}:${e.id}`))}),w.length>0&&(0,N.jsx)(`optgroup`,{label:h(`slice.otherPrinters`),children:w.map(e=>(0,N.jsx)(`option`,{value:`${e.source}:${e.id}`,children:e.name},`${e.source}:${e.id}`))})]}),c&&(0,N.jsxs)(`label`,{htmlFor:y,title:l,className:`flex items-center gap-2 px-2.5 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-sm ${o?`opacity-50 cursor-not-allowed`:`cursor-pointer hover:border-bambu-gray transition-colors`}`,children:[(0,N.jsx)(`input`,{id:y,type:`color`,value:X(s),onChange:e=>c(e.target.value.toUpperCase()),disabled:o,"aria-label":l,style:{backgroundColor:X(s)},className:`slice-colour-swatch w-4 h-4 shrink-0 rounded-full border border-bambu-dark-tertiary p-0 disabled:cursor-not-allowed enabled:cursor-pointer`}),(0,N.jsx)(`span`,{className:`font-mono text-xs text-white tracking-tight`,children:X(s)})]}),m&&(0,N.jsxs)(`button`,{type:`button`,onClick:m,disabled:o,title:h(`slice.loadedSpools.pickTitle`,`Pick a spool loaded in a connected printer`),className:`flex items-center gap-1.5 px-2.5 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-sm text-bambu-gray transition-colors enabled:hover:text-white enabled:hover:border-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,N.jsx)(re,{className:`w-4 h-4`,"aria-hidden":!0}),h(`slice.loadedSpools.pick`,`Pick`)]})]})]})}export{ae as n,ot as t}; \ No newline at end of file diff --git a/static/assets/SpoolBuddyAmsPage-CbOxHSuL.js b/static/assets/SpoolBuddyAmsPage-CbOxHSuL.js new file mode 100644 index 000000000..59b1be67f --- /dev/null +++ b/static/assets/SpoolBuddyAmsPage-CbOxHSuL.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./useMutation-B-Tr2hIP.js";import{n as c}from"./ToastContext-BRX0SW3C.js";import{t as l}from"./link-2-MI-QCMh8.js";import{t as u}from"./package-BGUevlqS.js";import{t as ee}from"./settings-2-Cvn837lh.js";import{t as d}from"./unlink-C098nwOf.js";import{t as te}from"./x-DR-Trv6U.js";import{G as f,H as ne,Hn as re,J as ie,K as ae,X as oe,cn as se,et as ce,ft as p,lt as le,q as ue,tt as m}from"./index-CovRLYqQ.js";import{i as de,n as fe,r as pe,t as me}from"./AmsUnitCard-CRqkD3Lg.js";import{n as he}from"./spoolPaint-CrvpHqdD.js";import{t as ge}from"./printerModel-DrNvERGQ.js";import{n as _e,r as ve,t as ye}from"./ConfigureAmsSlotModal-CpOmPM3O.js";var h=e(n(),1),g=t();function _(e){let t=p(e.color_name,e.rgba,e.color_name_is_synthesized);return t?` - ${t}`:``}function be(e){return e<=3?`AMS ${String.fromCharCode(65+e)}`:e>=128&&e<=135?`AMS HT ${String.fromCharCode(65+e-128)}`:`AMS ${e}`}function v(e){return!e.tray_type||e.tray_type===``}function xe(e){return e?`#${e.slice(0,6)}`:`#808080`}function y(){let{selectedPrinterId:e,setAlert:t}=re(),{t:n}=i(),p=a(),{showToast:y}=c(),{data:b}=o({queryKey:[`printerStatus`,e],queryFn:()=>r.getPrinterStatus(e),enabled:e!==null,staleTime:30*1e3}),{data:x}=o({queryKey:[`printer`,e],queryFn:()=>r.getPrinter(e),enabled:e!==null,staleTime:60*1e3}),{data:S}=o({queryKey:[`slotPresets`,e],queryFn:()=>r.getSlotPresets(e),enabled:e!==null,staleTime:120*1e3}),{data:C}=o({queryKey:[`settings`],queryFn:()=>r.getSettings(),staleTime:300*1e3}),{data:Se}=o({queryKey:[`spoolman-status`],queryFn:r.getSpoolmanStatus,staleTime:60*1e3}),w=Se?.enabled&&Se?.connected,{data:Ce}=o({queryKey:[`linked-spools`],queryFn:r.getLinkedSpools,enabled:!!w,staleTime:30*1e3}),T=Ce?.linked,{data:E=[]}=o({queryKey:[`spoolman-slot-assignments-all`],queryFn:()=>r.getSpoolmanSlotAssignments(),enabled:!!w,staleTime:30*1e3}),{data:D=[]}=o({queryKey:[`spoolman-inventory-spools`],queryFn:()=>r.getSpoolmanInventorySpools(!1),enabled:!!w,staleTime:30*1e3}),{data:O}=o({queryKey:[`spool-assignments`,e],queryFn:()=>r.getAssignments(e),enabled:e!==null,staleTime:30*1e3}),k=(0,h.useMemo)(()=>{let e={};if(!O)return e;for(let t of O){let n=t.spool;if(n&&n.label_weight>0&&n.weight_used!=null){let r=Math.round(Math.max(0,n.label_weight-n.weight_used)/n.label_weight*100);e[`${t.ams_id}-${t.tray_id}`]=r}}return e},[O]),A=x?.serial_number??``,j=(0,h.useCallback)((t,n,r)=>{if(e!==null&&E.length&&D.length){let r=E.find(r=>r.printer_id===e&&r.ams_id===t&&r.tray_id===n);if(r){let e=D.find(e=>e.id===r.spoolman_spool_id);if(e&&(e.label_weight??0)>0)return Math.round(Math.max(0,e.label_weight-e.weight_used)/e.label_weight*100)}}if(T&&A){let e=(r?.tray_uuid||r?.tag_uid||f(A,t,n))?.toUpperCase(),i=ie(e?T[e]:void 0);if(i!==null)return i}return null},[T,A,e,E,D]),M=b?.connected??!1,N=(0,h.useRef)({});(0,h.useEffect)(()=>{e&&b?.ams&&b.ams.length>0&&(N.current[e]=b.ams)},[b?.ams,e]);let P=(0,h.useMemo)(()=>{let t=b?.ams;return t&&t.length>0?t:(e?N.current[e]:null)??[]},[b?.ams,e]),F=(0,h.useMemo)(()=>P.filter(e=>!e.is_ams_ht),[P]),we=(0,h.useMemo)(()=>P.filter(e=>e.is_ams_ht),[P]),Te=(0,h.useMemo)(()=>{let e={};if(!T||!A)return e;for(let t of F)for(let n=0;n<(t.tray?.length??0);n++){let r=t.tray[n],i=j(t.id,n,v(r)?null:r);i!==null&&(e[`${t.id}-${n}`]=i)}return e},[T,A,F,j]),I=(0,h.useRef)(void 0),L=b?.tray_now;L!==void 0&&L!==255?I.current=L:L===255&&(I.current=void 0);let R=L!==void 0&&L!==255?L:I.current,z=x?.nozzle_count===2||b?.temperatures?.nozzle_2!==void 0,B=(0,h.useMemo)(()=>[...b?.vt_tray??[]].sort((e,t)=>(e.id??254)-(t.id??254)),[b?.vt_tray]),V=C?{humidityGood:Number(C.ams_humidity_good)||40,humidityFair:Number(C.ams_humidity_fair)||60,tempGood:Number(C.ams_temp_good)||28,tempFair:Number(C.ams_temp_fair)||35}:void 0,H=(0,h.useRef)({});(0,h.useEffect)(()=>{b?.ams_extruder_map&&Object.keys(b.ams_extruder_map).length>0&&(H.current=b.ams_extruder_map)},[b?.ams_extruder_map]);let U=b?.ams_extruder_map&&Object.keys(b.ams_extruder_map).length>0?b.ams_extruder_map:H.current,W=(0,h.useCallback)(e=>{if(!z)return null;let t=U[String(e)],n=e>=128?e-128:e;return(t===void 0?n:t)===1?`L`:`R`},[z,U]),[G,Ee]=(0,h.useState)(null),[K,q]=(0,h.useState)(null),[J,De]=(0,h.useState)(null),[Y,X]=(0,h.useState)(null),Oe=(0,h.useCallback)((e,t)=>O?.find(n=>n.ams_id===Number(e)&&n.tray_id===Number(t)),[O]),ke=(0,h.useCallback)((e,t,n)=>{if(!T||!A)return;let r=(n?.tray_uuid||n?.tag_uid||f(A,e,t))?.toUpperCase();return r?T[r]:void 0},[T,A]),Z=s({mutationFn:({printerId:e,amsId:t,trayId:n})=>r.unassignSpool(e,t,n),onSuccess:()=>{p.invalidateQueries({queryKey:[`spool-assignments`,e]}),p.invalidateQueries({queryKey:[`spool-assignments`]}),y(n(`inventory.unassignSuccess`,`Spool unassigned`),`success`),q(null)}}),Ae=s({mutationFn:e=>r.unlinkSpool(e),onSuccess:e=>{y(n(`spoolman.unlinkSuccess`)||e?.message,`success`),p.invalidateQueries({queryKey:[`linked-spools`]}),p.invalidateQueries({queryKey:[`unlinked-spools`]}),p.invalidateQueries({queryKey:[`spoolman-slot-assignments`]}),p.invalidateQueries({queryKey:[`spoolman-slot-assignments-all`]}),p.invalidateQueries({queryKey:[`spoolman-inventory-spools`]}),q(null)},onError:e=>{y(e.message||n(`spoolman.unlinkFailed`),`error`)}}),je=s({mutationFn:e=>r.unassignSpoolmanSlot(e),onSuccess:()=>{y(n(`inventory.unassignSuccess`,`Spool unassigned`),`success`),p.invalidateQueries({queryKey:[`spoolman-slot-assignments`]}),p.invalidateQueries({queryKey:[`spoolman-slot-assignments-all`]}),p.invalidateQueries({queryKey:[`spoolman-inventory-spools`]}),p.invalidateQueries({queryKey:[`unlinked-spools`]}),p.invalidateQueries({queryKey:[`linked-spools`]}),q(null)},onError:e=>{y(e.message||n(`inventory.assignFailed`,`Failed to unassign spool`),`error`)}}),Q=(0,h.useCallback)(e=>R===void 0?null:e<=3&&Math.floor(R/4)===e?R%4:e>=128&&e<=135&&R===ue(e,0,!1)?0:null,[R]),$=(0,h.useCallback)((e,t,n)=>{let r=ue(e,t,!1),i=S?.[r],a=U[String(e)],o=e>=128?e-128:e,s=a===void 0?o:a;q({amsId:e,trayId:t,trayCount:n&&e>=128?1:4,tray:n,trayType:n?.tray_type||void 0,trayColor:n?.tray_color||void 0,traySubBrands:n?.tray_sub_brands||void 0,trayInfoIdx:n?.tray_info_idx||void 0,extruderId:z?s:void 0,caliIdx:n?.cali_idx,savedPresetId:m(i?.preset_id,n?.tray_info_idx,i?.tray_info_idx)?i?.preset_id:void 0,location:`${be(e)} Slot ${t+1}`})},[S,U,z]),Me=(0,h.useCallback)(e=>{let t=e.id??254,n=t-254,r=S?.[1020+n];q({amsId:255,trayId:n,trayCount:1,tray:v(e)?null:e,trayType:e.tray_type||void 0,trayColor:e.tray_color||void 0,traySubBrands:e.tray_sub_brands||void 0,trayInfoIdx:e.tray_info_idx||void 0,extruderId:z?+(t===254):void 0,caliIdx:e.cali_idx,savedPresetId:m(r?.preset_id,e.tray_info_idx,r?.tray_info_idx)?r?.preset_id:void 0,location:z?t===254?`Ext-L`:`Ext-R`:`External`})},[S,z]),Ne=(0,h.useCallback)(()=>{if(!K)return;let{tray:e,location:t,...n}=K;q(null),Ee(n)},[K]),Pe=(0,h.useCallback)(()=>{if(!K||!e)return;let{amsId:t,trayId:n,trayType:r,trayColor:i,location:a}=K;q(null),De({printerId:e,amsId:t,trayId:n,trayInfo:{type:r||``,material:r,color:i?.slice(0,6)||``,location:a}})},[K,e]),Fe=(0,h.useCallback)(()=>{if(!K||!e)return;let{amsId:t,trayId:n,tray:r}=K,i=(r?.tray_uuid||r?.tag_uid||f(A,t,n))?.toUpperCase()||``;q(null),X({tagUid:r?.tag_uid||i,trayUuid:r?.tray_uuid||``,printerId:e,amsId:t,trayId:n})},[K,e,A]),Ie=(0,h.useCallback)(()=>{if(!K||!e)return;let{amsId:t,trayId:n}=K;Z.mutate({printerId:e,amsId:t,trayId:n})},[K,e,Z]);(0,h.useEffect)(()=>{if(!M&&e){t({type:`warning`,message:n(`spoolbuddy.ams.printerDisconnected`,`Printer disconnected`)});return}for(let e of P){let n=e.tray||[];for(let r=0;r=0&&i.remain<15&&i.tray_type){let n=e.id===254||e.id===255,a=!n&&e.id>=128,o=ne(e.id,r,a,n);t({type:`warning`,message:`Low Filament: ${i.tray_type} (${o}) - ${i.remain}% remaining`});return}}}t(null)},[P,M,e,t,n]);let Le=(0,h.useMemo)(()=>{let e=[];for(let t of we){let n=t.tray?.[0]||{id:0,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},r=j(t.id,0,v(n)?null:n),i=k[`${t.id}-0`]??null,a=n.remain!=null&&n.remain>=0?n.remain:null,o=i===0&&a!==null&&a>0?null:i;e.push({key:`ht-${t.id}`,label:be(t.id),tray:n,isEmpty:v(n),isActive:Q(t.id)===0,temp:t.temp,humidity:t.humidity,nozzleSide:W(t.id),effectiveFill:r??o??a,onClick:()=>$(t.id,0,v(n)?null:n)})}for(let t of B){let r=t.id??254,i=z&&R===254?r===254&&b?.active_extruder===1||r===255&&b?.active_extruder===0:R===r,a=r-254,o=j(255,a,v(t)?null:t),s=k[`255-${a}`]??null,c=t.remain!=null&&t.remain>=0?t.remain:null,l=s===0&&c!==null&&c>0?null:s;e.push({key:`ext-${r}`,label:z?r===254?n(`printers.extL`,`Ext-L`):n(`printers.extR`,`Ext-R`):n(`printers.ext`,`Ext`),tray:t,isEmpty:v(t),isActive:i,nozzleSide:null,effectiveFill:o??l??c,onClick:()=>Me(t)})}return e},[we,B,z,R,b?.active_extruder,n,Q,W,$,Me,k,j]);return(0,g.jsxs)(`div`,{className:`h-full flex flex-col p-4`,children:[(0,g.jsx)(`div`,{className:`flex-1 min-h-0`,children:e?M?P.length===0&&B.length===0?(0,g.jsx)(`div`,{className:`flex-1 flex items-center justify-center h-full`,children:(0,g.jsxs)(`div`,{className:`text-center text-white/50`,children:[(0,g.jsx)(se,{className:`w-12 h-12 mx-auto mb-3 opacity-50`}),(0,g.jsx)(`p`,{className:`text-lg mb-2`,children:n(`spoolbuddy.ams.noData`,`No AMS detected`)}),(0,g.jsx)(`p`,{className:`text-sm`,children:n(`spoolbuddy.ams.connectAms`,`Connect an AMS to see filament slots`)})]})}):(0,g.jsxs)(`div`,{className:`flex flex-col gap-3 h-full`,children:[(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:F.map(e=>(0,g.jsx)(me,{unit:e,activeSlot:Q(e.id),onConfigureSlot:$,isDualNozzle:z,nozzleSide:W(e.id),thresholds:V,fillOverrides:k,spoolmanFillOverrides:Te},e.id))}),Le.length>0&&(0,g.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-3`,children:Le.map(({key:e,label:t,tray:n,isEmpty:r,isActive:i,temp:a,humidity:o,nozzleSide:s,effectiveFill:c,onClick:l})=>{let u=xe(n.tray_color);return(0,g.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg px-3 py-2 cursor-pointer hover:bg-bambu-dark-secondary/80 transition-all flex items-center gap-3 ${i?`ring-2 ring-bambu-green`:``}`,onClick:l,children:[(0,g.jsxs)(`div`,{className:`relative w-10 h-10 flex-shrink-0`,children:[r?(0,g.jsx)(`div`,{className:`w-full h-full rounded-full border-2 border-dashed border-gray-500 flex items-center justify-center`,children:(0,g.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-gray-600`})}):(0,g.jsxs)(`svg`,{viewBox:`0 0 56 56`,className:`w-full h-full`,children:[(0,g.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:u}),(0,g.jsx)(`circle`,{cx:`28`,cy:`28`,r:`20`,fill:u,style:{filter:`brightness(0.85)`}}),(0,g.jsx)(`ellipse`,{cx:`20`,cy:`20`,rx:`6`,ry:`4`,fill:`white`,opacity:`0.3`}),(0,g.jsx)(`circle`,{cx:`28`,cy:`28`,r:`8`,fill:`#2d2d2d`}),(0,g.jsx)(`circle`,{cx:`28`,cy:`28`,r:`5`,fill:`#1a1a1a`})]}),i&&(0,g.jsx)(`div`,{className:`absolute -bottom-0.5 left-1/2 -translate-x-1/2 w-1.5 h-1.5 bg-bambu-green rounded-full`})]}),(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(`span`,{className:`text-xs text-white/50 font-medium truncate`,children:t}),s&&(0,g.jsx)(pe,{side:s})]}),(0,g.jsx)(`div`,{className:`text-sm text-white/80 truncate`,children:r?`Empty`:n.tray_type||`?`}),(a!=null||o!=null)&&(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[a!=null&&(0,g.jsx)(de,{temp:a,goodThreshold:V?.tempGood,fairThreshold:V?.tempFair}),o!=null&&(0,g.jsx)(fe,{humidity:o,goodThreshold:V?.humidityGood,fairThreshold:V?.humidityFair})]})]}),!r&&c!=null&&c>=0&&(0,g.jsx)(`div`,{className:`w-1.5 h-8 bg-bambu-dark-tertiary rounded-full overflow-hidden flex-shrink-0 flex flex-col-reverse`,children:(0,g.jsx)(`div`,{className:`w-full rounded-full`,style:{height:`${c}%`,backgroundColor:ae(c)}})})]},e)})})]}):(0,g.jsx)(`div`,{className:`flex-1 flex items-center justify-center h-full`,children:(0,g.jsx)(`div`,{className:`text-center text-white/50`,children:(0,g.jsx)(`p`,{className:`text-lg mb-2`,children:n(`spoolbuddy.ams.printerDisconnected`,`Printer disconnected`)})})}):(0,g.jsx)(`div`,{className:`flex-1 flex items-center justify-center h-full`,children:(0,g.jsxs)(`div`,{className:`text-center text-white/50`,children:[(0,g.jsx)(`p`,{className:`text-lg mb-2`,children:n(`spoolbuddy.ams.noPrinter`,`No printer selected`)}),(0,g.jsx)(`p`,{className:`text-sm`,children:n(`spoolbuddy.ams.selectPrinter`,`Select a printer from the top bar`)})]})})}),G&&e&&(0,g.jsx)(ye,{isOpen:!!G,onClose:()=>Ee(null),printerId:e,slotInfo:G,printerModel:ge(x?.model??null)||void 0,nozzleDiameter:ce(b,G.amsId),fullScreen:!0,onSuccess:()=>{p.invalidateQueries({queryKey:[`slotPresets`,e]}),p.invalidateQueries({queryKey:[`printerStatus`,e]})}}),K&&e&&(()=>{let t=Oe(K.amsId,K.trayId),r=ke(K.amsId,K.trayId,K.tray),i=w?E.find(t=>t.printer_id===e&&t.ams_id===K.amsId&&t.tray_id===K.trayId):void 0,a=i?D.find(e=>e.id===i.spoolman_spool_id)??null:null;return(0,g.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,g.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:()=>q(null)}),(0,g.jsxs)(`div`,{className:`relative w-full max-w-sm mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[K.trayColor&&(0,g.jsx)(`span`,{className:`w-4 h-4 rounded-full border border-black/20`,style:{backgroundColor:`#${K.trayColor.slice(0,6)}`}}),(0,g.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:K.location}),K.traySubBrands&&(0,g.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[`(`,K.traySubBrands,`)`]})]}),(0,g.jsx)(`button`,{onClick:()=>q(null),className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,g.jsx)(te,{className:`w-5 h-5`})})]}),(0,g.jsxs)(`div`,{className:`p-4 space-y-2`,children:[!w&&t?.spool&&(0,g.jsxs)(`div`,{className:`p-2.5 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary mb-3`,children:[(0,g.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:n(`inventory.assignedSpool`,`Assigned spool`)}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t.spool.rgba&&(0,g.jsx)(`span`,{className:`w-3 h-3 rounded-full border border-black/20 flex-shrink-0`,style:he(t.spool)??le(t.spool.rgba)}),(0,g.jsxs)(`span`,{className:`text-sm text-white`,children:[t.spool.brand?`${t.spool.brand} `:``,t.spool.material,t.spool.subtype?` ${t.spool.subtype}`:``,_(t.spool)]}),(0,g.jsxs)(`span`,{className:`text-[10px] font-mono text-zinc-500 shrink-0 ml-auto`,children:[`#`,t.spool.id]})]})]}),w&&r&&!a&&(0,g.jsxs)(`div`,{className:`p-2.5 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary mb-3`,children:[(0,g.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:n(`spoolman.linkedSpool`,`Linked spool`)}),(0,g.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,g.jsxs)(`span`,{className:`text-sm text-white`,children:[`Spoolman #`,r.id,r.remaining_weight==null?``:` (${Math.round(r.remaining_weight)}g)`]})})]}),w&&a&&(0,g.jsxs)(`div`,{className:`p-2.5 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary mb-3`,children:[(0,g.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:n(`inventory.assignedSpool`,`Assigned spool`)}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.rgba&&(0,g.jsx)(`span`,{className:`w-3 h-3 rounded-full border border-black/20 flex-shrink-0`,style:he(a)??le(a.rgba)}),(0,g.jsxs)(`span`,{className:`text-sm text-white`,children:[a.brand?`${a.brand} `:``,a.material,a.subtype?` ${a.subtype}`:``,_(a)]})]})]}),(0,g.jsxs)(`button`,{onClick:Ne,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary hover:border-bambu-blue transition-colors text-left`,children:[(0,g.jsx)(ee,{className:`w-5 h-5 text-bambu-blue flex-shrink-0`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-white font-medium`,children:n(`configureAmsSlot.title`)}),(0,g.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`spoolbuddy.ams.configureDesc`,`Set filament preset, K-profile, and color`)})]})]}),!w&&(oe(K?.tray)?null:t?(0,g.jsxs)(`button`,{onClick:Ie,disabled:Z.isPending,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary hover:border-amber-500 transition-colors text-left`,children:[(0,g.jsx)(d,{className:`w-5 h-5 text-amber-400 flex-shrink-0`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-amber-400 font-medium`,children:n(`inventory.unassignSpool`,`Unassign`)}),(0,g.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`spoolbuddy.ams.unassignDesc`,`Remove inventory spool from this slot`)})]})]}):(0,g.jsxs)(`button`,{onClick:Pe,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary hover:border-bambu-green transition-colors text-left`,children:[(0,g.jsx)(u,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-white font-medium`,children:n(`inventory.assignSpool`)}),(0,g.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`spoolbuddy.ams.assignDesc`,`Track a spool from your inventory`)})]})]})),w&&(r?.id?(0,g.jsxs)(`button`,{onClick:()=>Ae.mutate(r.id),disabled:Ae.isPending,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary hover:border-amber-500 transition-colors text-left active:opacity-50`,children:[(0,g.jsx)(d,{className:`w-5 h-5 text-amber-400 flex-shrink-0`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-amber-400 font-medium`,children:n(`inventory.unassignSpool`)}),(0,g.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`spoolbuddy.ams.unlinkDesc`,`Remove Spoolman link from this slot`)})]})]}):a?(0,g.jsxs)(`button`,{onClick:()=>je.mutate(a.id),disabled:je.isPending,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary hover:border-amber-500 transition-colors text-left active:opacity-50`,children:[(0,g.jsx)(d,{className:`w-5 h-5 text-amber-400 flex-shrink-0`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-amber-400 font-medium`,children:n(`inventory.unassignSpool`)}),(0,g.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`spoolbuddy.ams.unassignDesc`,`Remove inventory spool from this slot`)})]})]}):(0,g.jsxs)(`button`,{onClick:Fe,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary hover:border-bambu-green transition-colors text-left`,children:[(0,g.jsx)(l,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-white font-medium`,children:n(`inventory.assignSpool`)}),(0,g.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`spoolbuddy.ams.linkDesc`,`Link a Spoolman spool to this slot`)})]})]}))]})]})]})})(),J&&(0,g.jsx)(_e,{isOpen:!!J,onClose:()=>{De(null),p.invalidateQueries({queryKey:[`spool-assignments`,e]}),p.invalidateQueries({queryKey:[`spool-assignments`]})},printerId:J.printerId,amsId:J.amsId,trayId:J.trayId,trayInfo:J.trayInfo,spoolmanEnabled:!!w}),Y&&(0,g.jsx)(ve,{isOpen:!!Y,onClose:()=>X(null),tagUid:Y.tagUid,trayUuid:Y.trayUuid,printerId:Y.printerId,amsId:Y.amsId,trayId:Y.trayId})]})}export{y as SpoolBuddyAmsPage}; \ No newline at end of file diff --git a/static/assets/SpoolBuddyCalibrationPage-CsuD4P08.js b/static/assets/SpoolBuddyCalibrationPage-CsuD4P08.js new file mode 100644 index 000000000..cb5310f26 --- /dev/null +++ b/static/assets/SpoolBuddyCalibrationPage-CsuD4P08.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,v as r,w as i}from"./client-DnySrlFv.js";import{t as a}from"./useQuery-BBCjCezC.js";import{Hn as o,Vn as s}from"./index-CovRLYqQ.js";var c=e(n(),1),l=t();function u({device:e,weight:t,weightStable:n,rawAdc:a}){let{t:o}=i(),[s,u]=(0,c.useState)(!1),[d,f]=(0,c.useState)(`idle`),[p,m]=(0,c.useState)(`500`),[h,g]=(0,c.useState)(null),[_,v]=(0,c.useState)(!1),y=e=>{e===`backspace`?m(e=>e.slice(0,-1)||``):e===`.`&&!p.includes(`.`)?m(e=>e+`.`):e>=`0`&&e<=`9`&&m(t=>t===`0`?e:t+e)};return(0,l.jsxs)(`div`,{className:`space-y-4`,children:[(0,l.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-4`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,l.jsx)(`span`,{className:`text-sm text-zinc-400`,children:o(`spoolbuddy.settings.currentWeight`,`Current weight`)}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`div`,{className:`w-2 h-2 rounded-full ${n?`bg-green-500`:`bg-amber-500 animate-pulse`}`}),(0,l.jsx)(`span`,{className:`text-lg font-mono text-zinc-200`,children:t===null?`-- g`:`${t.toFixed(1)} g`})]})]}),(0,l.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 mt-3 text-xs`,children:[(0,l.jsxs)(`div`,{className:`flex justify-between`,children:[(0,l.jsx)(`span`,{className:`text-zinc-500`,children:o(`spoolbuddy.settings.tareOffset`,`Tare offset`)}),(0,l.jsx)(`span`,{className:`text-zinc-400 font-mono`,children:e.tare_offset})]}),(0,l.jsxs)(`div`,{className:`flex justify-between`,children:[(0,l.jsx)(`span`,{className:`text-zinc-500`,children:o(`spoolbuddy.settings.calFactor`,`Cal. factor`)}),(0,l.jsx)(`span`,{className:`text-zinc-400 font-mono`,children:e.calibration_factor.toFixed(2)})]})]})]}),d===`idle`?(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsx)(`button`,{onClick:async()=>{v(!0);try{await r.tare(e.device_id)}catch(e){console.error(`Failed to tare:`,e)}finally{v(!1)}},disabled:_,className:`flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-200 hover:bg-zinc-600 disabled:opacity-40 transition-colors min-h-[44px]`,children:_?`...`:o(`spoolbuddy.weight.tare`,`Tare`)}),(0,l.jsx)(`button`,{onClick:()=>{f(`tare`)},className:`flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 transition-colors min-h-[44px]`,children:o(`spoolbuddy.weight.calibrate`,`Calibrate`)})]}):(0,l.jsxs)(`div`,{className:`bg-zinc-800 border border-zinc-700 rounded-lg p-3 space-y-2`,children:[(0,l.jsx)(`div`,{className:`text-sm font-medium text-zinc-200`,children:d===`tare`?o(`spoolbuddy.settings.calStep1`,`Step 1: Remove all items from the scale`):o(`spoolbuddy.settings.calStep2`,`Step 2: Place known weight on scale`)}),d===`weight`&&(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-xs text-zinc-400`,children:o(`spoolbuddy.settings.knownWeight`,`Known weight (g)`)}),(0,l.jsxs)(`div`,{className:`flex-1 bg-zinc-900 border border-zinc-600 rounded px-3 py-1.5 text-right text-base font-mono text-zinc-100`,children:[p||`0`,(0,l.jsx)(`span`,{className:`text-zinc-500 ml-1`,children:`g`})]})]}),(0,l.jsx)(`div`,{className:`grid grid-cols-4 gap-1`,children:[`7`,`8`,`9`,`backspace`,`4`,`5`,`6`,`.`,`1`,`2`,`3`,`0`].map(e=>(0,l.jsx)(`button`,{onClick:()=>y(e),className:`py-2 rounded text-sm font-medium transition-colors min-h-[36px] ${e===`backspace`?`bg-zinc-700 text-zinc-300 hover:bg-zinc-600`:`bg-zinc-800 text-zinc-100 hover:bg-zinc-700 border border-zinc-700`}`,children:e===`backspace`?`⌫`:e},e))})]}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsx)(`button`,{onClick:()=>f(`idle`),className:`flex-1 px-4 py-2 rounded-lg text-sm bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[40px]`,children:o(`common.cancel`,`Cancel`)}),(0,l.jsx)(`button`,{onClick:async()=>{if(d===`tare`){u(!0);try{g(a),await r.tare(e.device_id),f(`weight`)}catch(e){console.error(`Failed to tare:`,e)}finally{u(!1)}}else if(d===`weight`){let t=parseFloat(p);if(a===null||!t||t<=0)return;u(!0);try{await r.setCalibrationFactor(e.device_id,t,a,h??void 0),f(`idle`)}catch(e){console.error(`Failed to calibrate:`,e)}finally{u(!1)}}},disabled:s,className:`flex-1 px-4 py-2 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 transition-colors min-h-[40px]`,children:s?`...`:d===`tare`?o(`spoolbuddy.settings.setZero`,`Set Zero`):o(`spoolbuddy.settings.calibrateNow`,`Calibrate`)})]})]})]})}function d(){let{sbState:e}=o(),{t}=i(),n=s(),{data:c=[]}=a({queryKey:[`spoolbuddy-devices`],queryFn:()=>r.getDevices(),refetchInterval:1e4}),d=e.deviceId?c.find(t=>t.device_id===e.deviceId)??c[0]:c[0];return(0,l.jsxs)(`div`,{className:`h-full flex flex-col p-4`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,l.jsx)(`button`,{onClick:()=>n(`/spoolbuddy/settings`),className:`p-1.5 rounded-lg text-zinc-400 hover:text-zinc-200 hover:bg-zinc-800 transition-colors`,children:(0,l.jsx)(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 19l-7-7 7-7`})})}),(0,l.jsx)(`h1`,{className:`text-xl font-semibold text-zinc-100`,children:t(`spoolbuddy.settings.scaleCalibration`,`Scale Calibration`)})]}),(0,l.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:d?(0,l.jsx)(u,{device:d,weight:e.weight,weightStable:e.weightStable,rawAdc:e.rawAdc}):(0,l.jsx)(`div`,{className:`flex items-center justify-center h-32`,children:(0,l.jsx)(`div`,{className:`text-center text-zinc-500`,children:(0,l.jsx)(`p`,{className:`text-sm`,children:t(`spoolbuddy.settings.noDevice`,`No SpoolBuddy device found`)})})})})]})}export{d as SpoolBuddyCalibrationPage}; \ No newline at end of file diff --git a/static/assets/SpoolBuddyDashboard-1rrNfFCt.js b/static/assets/SpoolBuddyDashboard-1rrNfFCt.js new file mode 100644 index 000000000..56603efd2 --- /dev/null +++ b/static/assets/SpoolBuddyDashboard-1rrNfFCt.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,t as i,v as a,w as o}from"./client-DnySrlFv.js";import{n as s}from"./QueryClientProvider-Ce8_sN3w.js";import{t as c}from"./useQuery-BBCjCezC.js";import{t as l}from"./useMutation-B-Tr2hIP.js";import{t as u}from"./useQueries-Be6PMvSC.js";import{t as d}from"./check-Ck0cMLU4.js";import{n as f}from"./ToastContext-BRX0SW3C.js";import{t as p}from"./triangle-alert-Dt_1FcBy.js";import{t as m}from"./unlink-C098nwOf.js";import{t as h}from"./x-DR-Trv6U.js";import{Hn as g,Kt as ee,ft as _,pt as v}from"./index-CovRLYqQ.js";import{t as y}from"./AssignToAmsModal-DOax3BGf.js";import{t as b}from"./SpoolIcon-DE8TbEec.js";var x=e(n(),1),S=t(),C=`spoolbuddy-default-core-weight`;function w(){try{let e=localStorage.getItem(C);if(e){let t=parseInt(e,10);if(t>=0&&t<=500)return t}}catch{}return 250}function T({spool:e,scaleWeight:t,onClose:n,onSyncWeight:r,onAssignToAms:i,isAssigned:s,onUnassignFromAms:c}){let{t:l}=o(),[u,f]=(0,x.useState)(!1),[h,g]=(0,x.useState)(!1),y=v(e.rgba),C=_(e.color_name,e.rgba,e.color_name_is_synthesized),T=e.core_weight&&e.core_weight>0?e.core_weight:w(),E=t===null?null:Math.round(Math.max(0,t)),D=E===null?null:Math.round(Math.max(0,E-T)),O=Math.round(e.label_weight||1e3),k=D===null?null:Math.min(100,Math.round(D/O*100)),A=k===null?`#808080`:k>50?`#22c55e`:k>20?`#eab308`:`#ef4444`,te=Math.max(0,(e.label_weight||0)-(e.weight_used||0))+T,j=E===null?null:E-te,M=j===null?null:Math.abs(j)<=50,N=async()=>{if(t!==null){f(!0);try{await a.updateSpoolWeight(e.id,Math.round(t)),g(!0),r?.(),setTimeout(()=>g(!1),3e3)}catch(e){console.error(`Failed to sync weight:`,e)}finally{f(!1)}}};return(0,S.jsxs)(`div`,{className:`flex flex-col items-center space-y-4 max-w-md`,children:[(0,S.jsxs)(`div`,{className:`flex items-start gap-5`,children:[(0,S.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,S.jsx)(b,{color:y,isEmpty:!1,size:100,spool:e}),k!==null&&(0,S.jsxs)(`div`,{className:`absolute -bottom-2 -right-2 px-2 py-0.5 rounded-full text-xs font-bold text-white shadow-lg`,style:{backgroundColor:A},children:[k,`%`]})]}),(0,S.jsxs)(`div`,{className:`flex-1 min-w-0 pt-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`h3`,{className:`text-lg font-semibold text-zinc-100`,children:C||l(`spoolbuddy.spool.unknownColor`)}),(0,S.jsxs)(`span`,{className:`text-xs font-mono text-zinc-500 shrink-0`,children:[`#`,e.id]})]}),(0,S.jsxs)(`p`,{className:`text-sm text-zinc-400`,children:[e.brand,` • `,e.material,e.subtype&&` ${e.subtype}`]}),D!==null&&(0,S.jsxs)(`div`,{className:`mt-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsxs)(`span`,{className:`text-3xl font-bold font-mono text-zinc-100`,children:[D,`g`]}),(0,S.jsxs)(`span`,{className:`text-sm text-zinc-500`,children:[`/ `,O,`g`]})]}),(0,S.jsx)(`p`,{className:`text-xs text-zinc-500 mt-0.5`,children:l(`spoolbuddy.spool.remaining`,`Remaining`)}),(0,S.jsx)(`div`,{className:`mt-2 max-w-xs`,children:(0,S.jsx)(`div`,{className:`h-2 bg-zinc-700 rounded-full overflow-hidden`,children:(0,S.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${k}%`,backgroundColor:A}})})})]})]})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-2 text-sm bg-zinc-800 rounded-lg p-4 w-full`,children:[(0,S.jsxs)(`div`,{className:`flex justify-between`,children:[(0,S.jsx)(`span`,{className:`text-zinc-500`,children:l(`spoolbuddy.dashboard.grossWeight`,`Gross weight`)}),(0,S.jsx)(`span`,{className:`font-mono text-zinc-300`,children:E===null?`—`:`${E}g`})]}),(0,S.jsxs)(`div`,{className:`flex justify-between`,children:[(0,S.jsx)(`span`,{className:`text-zinc-500`,children:l(`spoolbuddy.spool.coreWeight`,`Core`)}),(0,S.jsxs)(`span`,{className:`font-mono text-zinc-300`,children:[T,`g`]})]}),(0,S.jsxs)(`div`,{className:`flex justify-between`,children:[(0,S.jsx)(`span`,{className:`text-zinc-500`,children:l(`spoolbuddy.dashboard.spoolSize`,`Spool size`)}),(0,S.jsxs)(`span`,{className:`font-mono text-zinc-300`,children:[O,`g`]})]}),(0,S.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,S.jsx)(`span`,{className:`text-zinc-500`,children:l(`spoolbuddy.spool.scaleWeight`,`Scale`)}),E===null?(0,S.jsx)(`span`,{className:`text-zinc-500`,children:`—`}):(0,S.jsxs)(`span`,{className:`flex items-center gap-1 font-mono ${M?`text-green-500`:`text-yellow-500`}`,children:[E,`g`,M?(0,S.jsx)(d,{className:`w-3.5 h-3.5`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{className:`w-3.5 h-3.5`}),(0,S.jsx)(`button`,{onClick:N,className:`p-1 hover:bg-green-500/20 rounded transition-colors text-green-500`,title:l(`spoolbuddy.dashboard.syncWeight`,`Sync Weight`),children:(0,S.jsx)(ee,{className:`w-4 h-4`})})]})]})]}),(0,S.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,S.jsx)(`span`,{className:`text-zinc-500`,children:l(`spoolbuddy.dashboard.tagId`,`Tag`)}),(0,S.jsx)(`span`,{className:`font-mono text-xs text-zinc-400 truncate max-w-[120px]`,title:e.tag_uid||``,children:e.tag_uid?e.tag_uid.slice(-8):`—`})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-2 justify-center`,children:[i&&(0,S.jsx)(`button`,{onClick:s?void 0:i,disabled:!!s,className:`px-5 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 transition-colors min-h-[44px] disabled:opacity-50 disabled:cursor-not-allowed`,children:l(`spoolbuddy.modal.assignToAms`,`Assign to AMS`)}),c&&(0,S.jsxs)(`button`,{onClick:c,className:`px-5 py-2.5 rounded-lg text-sm font-medium bg-red-600/20 text-red-400 hover:bg-red-600/30 transition-colors min-h-[44px]`,children:[(0,S.jsx)(m,{className:`w-4 h-4 inline mr-1`}),l(`inventory.unassignSpool`)]}),(0,S.jsx)(`button`,{onClick:N,disabled:t===null||u,className:`px-5 py-2.5 rounded-lg text-sm font-medium transition-colors min-h-[44px] ${h?`bg-green-600/20 text-green-400`:i?`bg-zinc-700 text-zinc-300 hover:bg-zinc-600 disabled:opacity-40 disabled:cursor-not-allowed`:`bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 disabled:cursor-not-allowed`}`,children:u?`...`:h?l(`spoolbuddy.dashboard.weightSynced`,`Synced!`):l(`spoolbuddy.dashboard.syncWeight`,`Sync Weight`)}),n&&(0,S.jsx)(`button`,{onClick:n,className:`px-5 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]`,children:l(`spoolbuddy.dashboard.close`,`Close`)})]})]})}function E({tagUid:e,scaleWeight:t,coreWeight:n,onLinkSpool:r,onAddToInventory:i,onClose:a}){let{t:s}=o(),c=n??w(),l=t===null?null:Math.round(Math.max(0,t)),u=l===null?null:Math.round(Math.max(0,l-c));return(0,S.jsxs)(`div`,{className:`flex flex-col items-center text-center space-y-5`,children:[(0,S.jsx)(`div`,{className:`w-20 h-20 rounded-2xl bg-green-500/15 flex items-center justify-center`,children:(0,S.jsx)(`svg`,{className:`w-10 h-10 text-green-500`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,S.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A2 2 0 013 12V7a4 4 0 014-4z`})})}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-lg font-semibold text-zinc-100`,children:s(`spoolbuddy.dashboard.newTag`,`New Tag Detected`)}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-500 font-mono mt-1`,children:e})]}),l!==null&&(0,S.jsxs)(`div`,{className:`text-sm text-zinc-400`,children:[(0,S.jsxs)(`span`,{className:`font-mono font-semibold`,children:[l,`g`]}),` `,s(`spoolbuddy.dashboard.onScale`,`on scale`),u!==null&&u>0&&(0,S.jsxs)(`span`,{className:`text-zinc-500`,children:[` • ~`,u,`g filament`]})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:[i&&(0,S.jsx)(`button`,{onClick:i,className:`px-5 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 transition-colors min-h-[44px]`,children:s(`spoolbuddy.modal.addToInventory`,`Add to Inventory`)}),r&&(0,S.jsxs)(`button`,{onClick:r,className:`px-5 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]`,children:[(0,S.jsx)(`svg`,{className:`w-4 h-4 inline-block mr-1.5 -mt-0.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,S.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1`})}),s(`inventory.assignSpool`,`Assign Spool`)]}),a&&(0,S.jsx)(`button`,{onClick:a,className:`px-5 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]`,children:s(`spoolbuddy.dashboard.close`,`Close`)})]})]})}function D({isOpen:e,onClose:t,tagId:n,untaggedSpools:r,onLink:i}){let{t:a}=o(),[s,c]=(0,x.useState)(null),l=(0,x.useCallback)(()=>{c(null),t()},[t]),u=(0,x.useCallback)(e=>{e.key===`Escape`&&l()},[l]);return(0,x.useEffect)(()=>(e&&(document.addEventListener(`keydown`,u),document.body.style.overflow=`hidden`),()=>{document.removeEventListener(`keydown`,u),document.body.style.overflow=``}),[e,u]),e?(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 animate-fade-in`,onClick:l,children:(0,S.jsxs)(`div`,{className:`bg-zinc-800 rounded-xl shadow-2xl w-full max-w-lg mx-4 animate-slide-up`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-zinc-700`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{className:`text-base font-semibold text-zinc-100`,children:a(`spoolbuddy.dashboard.linkTagTitle`,`Link Tag to Spool`)}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-500 font-mono`,children:n})]}),(0,S.jsx)(`button`,{onClick:l,className:`p-2 rounded-lg text-zinc-500 hover:text-zinc-300 hover:bg-zinc-700 transition-colors`,children:(0,S.jsx)(h,{className:`w-5 h-5`})})]}),(0,S.jsxs)(`div`,{className:`px-5 py-4 space-y-3 max-h-[400px] overflow-y-auto`,children:[(0,S.jsx)(`p`,{className:`text-sm text-zinc-400`,children:a(`spoolbuddy.dashboard.selectSpool`,`Select a spool to link this tag to:`)}),r.length===0?(0,S.jsx)(`div`,{className:`text-center py-8 text-zinc-500`,children:a(`spoolbuddy.dashboard.noUntagged`,`No spools without tags found`)}):(0,S.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,S.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:`w-full flex items-center gap-3 p-3 rounded-lg border-2 transition-all text-left ${s?.id===e.id?`border-green-500 bg-green-500/10`:`border-zinc-700 hover:border-green-500/50 hover:bg-zinc-700/50`}`,children:[(0,S.jsx)(b,{color:v(e.rgba),spool:e,isEmpty:!1,size:40}),(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`font-medium text-zinc-100 truncate`,children:_(e.color_name,e.rgba,e.color_name_is_synthesized)||a(`spoolbuddy.spool.unknownColor`)}),(0,S.jsxs)(`span`,{className:`text-[10px] font-mono text-zinc-500 shrink-0`,children:[`#`,e.id]})]}),(0,S.jsxs)(`div`,{className:`text-sm text-zinc-400 truncate`,children:[e.brand,` • `,e.material,e.subtype&&` ${e.subtype}`]})]}),(0,S.jsxs)(`div`,{className:`text-sm font-mono text-zinc-500`,children:[Math.max(0,e.label_weight-e.weight_used),`g`]})]},e.id))})]}),(0,S.jsxs)(`div`,{className:`flex justify-end gap-2 px-5 py-4 border-t border-zinc-700`,children:[(0,S.jsx)(`button`,{onClick:l,className:`px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]`,children:a(`common.cancel`,`Cancel`)}),(0,S.jsx)(`button`,{onClick:()=>{s&&(i(s),c(null))},disabled:!s,className:`px-4 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors min-h-[44px]`,children:a(`spoolbuddy.dashboard.linkTag`,`Link Tag`)})]})]})}):null}function O(e){return e?e.replace(/[^0-9a-f]/gi,``).toUpperCase():``}function k(e,t){let n=O(e),r=O(t);return!n||!r?!1:n===r?!0:n.endsWith(r)||r.endsWith(n)}var A=[`#00AE42`,`#FF6B35`,`#3B82F6`,`#EF4444`,`#A855F7`,`#FBBF24`,`#14B8A6`,`#EC4899`,`#F97316`,`#22C55E`];function te(){let{t:e}=o(),[t,n]=(0,x.useState)(0);(0,x.useEffect)(()=>{let e=setInterval(()=>{n(e=>(e+1)%A.length)},5e3);return()=>clearInterval(e)},[]);let r=A[t];return(0,S.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,S.jsxs)(`div`,{className:`relative mb-6 flex items-center justify-center`,style:{width:160,height:160},children:[(0,S.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:[0,1].map(e=>(0,S.jsx)(`div`,{className:`absolute rounded-full border spoolbuddy-optimized-ping`,style:{width:80,height:80,borderColor:`${r}4D`,transition:`border-color 140ms linear`,animationDelay:`${e*.8}s`}},e))}),(0,S.jsxs)(`div`,{className:`relative overflow-hidden rounded-full`,children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full opacity-30 spoolbuddy-spool-glow`,style:{background:`radial-gradient(circle, ${r} 0%, transparent 70%)`}}),(0,S.jsx)(`div`,{className:`relative`,style:{transition:`opacity 140ms linear`},children:(0,S.jsx)(b,{color:r,isEmpty:!1,size:100})})]})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`p`,{className:`text-xl font-medium text-zinc-300`,children:e(`spoolbuddy.dashboard.readyToScan`,`Ready to scan`)}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-500`,children:e(`spoolbuddy.dashboard.idleMessage`,`Place a spool on the scale to identify it`)})]}),(0,S.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-sm text-zinc-600`,children:[(0,S.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,S.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})}),(0,S.jsx)(`span`,{children:e(`spoolbuddy.dashboard.nfcHint`,`NFC tag will be read automatically`)})]})]})}function j(){let{t:e}=o();return(0,S.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,S.jsx)(`div`,{className:`relative mb-6 flex items-center justify-center`,style:{width:160,height:160},children:(0,S.jsx)(`div`,{className:`w-24 h-24 rounded-full bg-zinc-800 flex items-center justify-center`,children:(0,S.jsx)(`svg`,{className:`w-12 h-12 text-zinc-600`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,S.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,d:`M18.364 5.636a9 9 0 010 12.728m0 0l-12.728-12.728m12.728 12.728L5.636 5.636m12.728 0a9 9 0 00-12.728 0m0 12.728a9 9 0 010-12.728`})})})}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`p`,{className:`text-lg font-medium text-zinc-500`,children:e(`spoolbuddy.status.deviceOffline`,`Device Offline`)}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600`,children:e(`spoolbuddy.status.connectDisplay`,`Connect the SpoolBuddy display to scan spools`)})]}),(0,S.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-xs text-zinc-600`,children:[(0,S.jsx)(`svg`,{className:`w-4 h-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,S.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.14 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0`})}),(0,S.jsx)(`span`,{children:e(`spoolbuddy.status.waitingConnection`,`Waiting for device connection...`)})]})]})}function M(){let{sbState:e,selectedPrinterId:t}=g(),{t:n}=o(),{showToast:a}=f(),{data:d}=c({queryKey:[`spoolman-settings`],queryFn:r.getSpoolmanSettings,staleTime:300*1e3}),p=d?.spoolman_enabled===`true`&&!!d?.spoolman_url,{data:m=[],refetch:h}=c({queryKey:p?[`spoolman-inventory-spools`]:[`inventory-spools`],queryFn:()=>p?r.getSpoolmanInventorySpools(!1):r.getSpools(!1),enabled:d!==void 0}),{data:ee=[]}=c({queryKey:[`spoolman-slot-assignments`],queryFn:()=>r.getSpoolmanSlotAssignments(),enabled:p,staleTime:3*1e3,refetchInterval:3*1e3,refetchIntervalInBackground:!1}),{data:_=[]}=c({queryKey:[`printers`],queryFn:()=>r.getPrinters()}),v=u({queries:_.map(e=>({queryKey:[`printerStatus`,e.id],queryFn:()=>r.getPrinterStatus(e.id),refetchInterval:1e4,select:e=>({connected:e?.connected,awaiting_plate_clear:e?.awaiting_plate_clear===!0})}))}),b=_.map((e,t)=>({printer:e,pending:v[t]?.data?.awaiting_plate_clear===!0})).filter(e=>e.pending),C=s(),w=l({mutationFn:e=>r.clearPlate(e),onSuccess:(e,t)=>{C.setQueryData([`printerStatus`,t],e=>e&&{...e,awaiting_plate_clear:!1}),a(n(`spoolbuddy.dashboard.plateClearedToast`,`Plate marked as cleared`),`success`)},onError:()=>{a(n(`spoolbuddy.dashboard.plateClearFailed`,`Could not mark plate as cleared`),`error`)}}),O=l({mutationFn:e=>r.unassignSpoolmanSlot(e),onSuccess:()=>{C.invalidateQueries({queryKey:[`spoolman-slot-assignments`]}),C.invalidateQueries({queryKey:[`spoolman-inventory-spools`]})},onError:()=>a(n(`inventory.unassignFailed`,`Failed to unassign spool`),`error`)}),[A,M]=(0,x.useState)(null),[N,P]=(0,x.useState)(null),[F,I]=(0,x.useState)(null),[L,R]=(0,x.useState)(null),[ne,z]=(0,x.useState)(!1),[re,B]=(0,x.useState)(!1),[ie,V]=(0,x.useState)(!1),[ae,oe]=(0,x.useState)(!1),[H,U]=(0,x.useState)(null),W=e.matchedSpool?.tag_uid??e.unknownTagUid??null,G=e.unknownTagUid?e.unknownTrayUuid:null,K=e.weight,q=e.weightStable,J=(0,x.useRef)(null);K===null?J.current=null:(J.current===null||Math.abs(K-J.current)>=3||q)&&(J.current=K);let Y=J.current,X=(0,x.useMemo)(()=>{if(e.matchedSpool?.id){let t=m.find(t=>t.id===e.matchedSpool?.id);if(t)return t}if(!A)return null;let t=m.find(e=>k(e.tag_uid,A));if(t)return t;if(N){let e=m.find(e=>e.tray_uuid?.toUpperCase()===N);if(e)return e}return H||null},[A,N,e.matchedSpool,m,H]),Z=(0,x.useMemo)(()=>{if(X&&!H)return X;let t=e.matchedSpool;return t?{id:t.id,tag_uid:t.tag_uid,material:t.material,subtype:t.subtype,color_name:t.color_name,color_name_is_synthesized:t.color_name_is_synthesized,rgba:t.rgba,brand:t.brand,label_weight:t.label_weight,core_weight:t.core_weight,weight_used:t.weight_used}:null},[X,H,e.matchedSpool]),se=p&&Z!=null?ee.some(e=>e.spoolman_spool_id===Z.id):!1,Q=(0,x.useMemo)(()=>p?m.filter(e=>!e.tag_uid&&!e.tray_uuid&&!e.archived_at):m.filter(e=>!e.tag_uid&&!e.archived_at),[m,p]);(0,x.useEffect)(()=>{if(W){let e=L===W;(A!==null&&A!==W||!e&&A!==W)&&(M(W),P(G),I(null),R(null),U(null)),!e&&K!==null&&q&&I(Math.round(Math.max(0,K)))}else L&&(M(null),P(null),R(null),I(null),U(null))},[W,G,K,q,A,L]);let ce=()=>{R(A)},le=async e=>{if(A)try{if(p){let t=await r.linkTagToSpoolmanSpool(e.id,{tag_uid:A,tray_uuid:N||void 0});if(!t){a(n(`spoolman.linkFailed`),`error`);return}let{id:i,material:o,subtype:s,color_name:c,color_name_is_synthesized:l,rgba:u,brand:d,label_weight:f,core_weight:p,weight_used:m}=t;U({id:i,material:o,subtype:s,color_name:c,color_name_is_synthesized:l,rgba:u,brand:d,label_weight:f,core_weight:p,weight_used:m}),a(n(`spoolman.linkSuccess`),`success`)}else await r.linkTagToSpool(e.id,{tag_uid:A,...N?{tray_uuid:N}:{},tag_type:N?`bambulab`:`generic`,data_origin:`nfc_link`});h()}catch(e){console.error(`Failed to link tag:`,e);let t=e instanceof i&&e.status===409&&e.code===`tag_already_linked`?e.detail?.spool_id:void 0;a(typeof t==`number`?n(`inventory.tagAlreadyLinked`,{id:t}):n(`spoolman.linkFailed`),`error`)}finally{z(!1)}},ue=async()=>{if(A){oe(!0);try{let e=$??F;if(p){let t=await r.createSpoolmanInventorySpool({material:`PLA`,subtype:null,color_name:null,rgba:null,extra_colors:null,effect_type:null,brand:null,label_weight:1e3,weight_used:0,slicer_filament:null,slicer_filament_name:null,nozzle_temp_min:null,nozzle_temp_max:null,note:null,added_full:null,last_used:null,encode_time:null,tag_uid:null,tray_uuid:null,data_origin:null,tag_type:null,cost_per_kg:null,last_scale_weight:e===null?null:Math.round(e),last_weighed_at:e===null?null:new Date().toISOString(),category:null,low_stock_threshold_pct:null});await r.linkTagToSpoolmanSpool(t.id,{tag_uid:A,tray_uuid:N||void 0})}else await r.createSpool({material:`PLA`,subtype:null,color_name:null,rgba:null,extra_colors:null,effect_type:null,brand:null,label_weight:1e3,core_weight:250,core_weight_catalog_id:null,weight_used:0,slicer_filament:null,slicer_filament_name:null,nozzle_temp_min:null,nozzle_temp_max:null,note:null,added_full:null,last_used:null,encode_time:null,tag_uid:A,tray_uuid:N,data_origin:`spoolbuddy`,tag_type:N?`bambulab`:`generic`,cost_per_kg:null,last_scale_weight:e===null?null:Math.round(e),last_weighed_at:e===null?null:new Date().toISOString(),category:null,low_stock_threshold_pct:null,material_number:null})}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`Failed to quick-add spool:`,t),a(t||n(`spoolbuddy.errors.quickAddFailed`,`Failed to add spool`),`error`)}finally{V(!1),oe(!1),h()}}},$=K!==null&&(W===A||W===null&&A!==null)?K:null,de=m.length,fe=new Set(m.map(e=>e.material)).size,pe=new Set(m.filter(e=>e.brand).map(e=>e.brand)).size;return(0,S.jsxs)(`div`,{className:`h-full flex flex-col p-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-6 px-4 py-1.5 bg-zinc-800/50 rounded-xl border border-zinc-700/50 mb-3 shrink-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`text-xl font-bold text-zinc-100`,children:de}),(0,S.jsx)(`span`,{className:`text-sm text-zinc-500`,children:n(`spoolbuddy.inventory.spools`,`Spools`)})]}),(0,S.jsx)(`div`,{className:`w-px h-5 bg-zinc-700`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`text-xl font-bold text-zinc-100`,children:fe}),(0,S.jsx)(`span`,{className:`text-sm text-zinc-500`,children:n(`spoolbuddy.spool.material`,`Materials`)})]}),(0,S.jsx)(`div`,{className:`w-px h-5 bg-zinc-700`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`text-xl font-bold text-zinc-100`,children:pe}),(0,S.jsx)(`span`,{className:`text-sm text-zinc-500`,children:n(`spoolbuddy.spool.brand`,`Brands`)})]})]}),(0,S.jsxs)(`div`,{className:`flex-1 flex gap-4 min-h-0`,children:[(0,S.jsxs)(`div`,{className:`w-5/12 flex flex-col min-h-0`,children:[(0,S.jsxs)(`div`,{className:`border border-dashed border-zinc-700/50 rounded-xl p-4`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-400 uppercase tracking-wide mb-3`,children:n(`spoolbuddy.dashboard.device`,`Device`)}),(0,S.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full ${e.deviceOnline?`bg-green-500`:`bg-red-500`}`}),(0,S.jsx)(`span`,{className:`text-base text-zinc-400`,children:e.deviceOnline?n(`spoolbuddy.status.online`,`Online`):n(`spoolbuddy.status.offline`,`Disconnected`)})]}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-zinc-800/50 rounded-lg`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`svg`,{className:`w-4 h-4 ${e.deviceOnline?`text-green-500`:`text-zinc-500`}`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,S.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M3 6l3 1m0 0l-3 9a5.002 5.002 0 006.001 0M6 7l3 9M6 7l6-2m6 2l3-1m-3 1l-3 9a5.002 5.002 0 006.001 0M18 7l3 9m-3-9l-6-2m0-2v2m0 16V5m0 16H9m3 0h3`})}),(0,S.jsx)(`span`,{className:`text-sm text-zinc-500`,children:n(`spoolbuddy.spool.scaleWeight`,`Scale`)})]}),(0,S.jsx)(`span`,{className:`text-lg font-mono font-semibold text-zinc-100`,children:Y===null?`—`:`${Math.abs(Y)<=20?0:Math.round(Math.max(0,Y))}g`})]}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-zinc-800/50 rounded-lg`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`svg`,{className:`w-4 h-4 ${e.deviceOnline?`text-green-500`:`text-zinc-500`}`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,S.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A2 2 0 013 12V7a4 4 0 014-4z`})}),(0,S.jsx)(`span`,{className:`text-sm text-zinc-500`,children:`NFC`})]}),(0,S.jsx)(`span`,{className:`text-sm font-medium ${W?`text-green-500`:`text-zinc-500`}`,children:W?n(`spoolbuddy.dashboard.tagDetected`,`Tag detected`):n(`spoolbuddy.dashboard.noTag`,`No tag`)})]})]})]}),_.length>0&&(0,S.jsxs)(`div`,{className:`mt-3 border border-dashed border-zinc-700/50 rounded-xl p-4`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-400 uppercase tracking-wide mb-2.5`,children:n(`spoolbuddy.dashboard.printers`,`Printers`)}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2 overflow-hidden`,children:_.map((e,t)=>{let n=v[t]?.data?.connected??!1;return(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1 bg-zinc-800/50 rounded-lg`,title:`${e.name} — ${n?`Online`:`Offline`}`,children:[(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full shrink-0 ${n?`bg-green-500`:`bg-zinc-600`}`}),(0,S.jsx)(`span`,{className:`text-xs text-zinc-400 truncate max-w-[100px]`,children:e.name})]},e.id)})}),b.length>0&&(0,S.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,"data-testid":`plate-clear-section`,"aria-label":n(`spoolbuddy.dashboard.plateReadyLabel`,`Plates ready to clear`),children:b.map(({printer:e})=>(0,S.jsxs)(`button`,{type:`button`,onClick:()=>w.mutate(e.id),disabled:w.isPending,"data-testid":`plate-clear-button-${e.id}`,title:n(`spoolbuddy.dashboard.plateReady`,`Plate ready: {{name}}`,{name:e.name}),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-amber-500/10 hover:bg-amber-500/20 active:bg-amber-500/30 border border-amber-500/30 text-amber-200 transition-colors disabled:opacity-60 disabled:cursor-wait`,children:[(0,S.jsxs)(`svg`,{className:`w-3 h-3 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,S.jsx)(`path`,{d:`M12 9v4`}),(0,S.jsx)(`path`,{d:`M12 17h.01`}),(0,S.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`})]}),(0,S.jsx)(`span`,{className:`text-xs truncate max-w-[100px]`,children:e.name}),(0,S.jsx)(`span`,{className:`text-xs opacity-70`,"aria-hidden":`true`,children:`·`}),(0,S.jsx)(`span`,{className:`text-xs font-medium`,children:n(`spoolbuddy.dashboard.plateClearAction`,`Clear`)})]},e.id))})]})]}),(0,S.jsx)(`div`,{className:`w-7/12 min-h-0`,children:(0,S.jsxs)(`div`,{className:`border border-dashed border-zinc-700/50 rounded-xl p-6 h-full flex flex-col`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-400 uppercase tracking-wide mb-4 shrink-0`,children:n(`spoolbuddy.dashboard.currentSpool`,`Current Spool`)}),(0,S.jsx)(`div`,{className:`flex-1 flex items-center justify-center min-h-0`,children:e.deviceOnline?(X||e.matchedSpool)&&A&&L!==A?(0,S.jsx)(T,{spool:(()=>{let t=X??e.matchedSpool;return{id:t.id,tag_uid:A,material:t.material,subtype:t.subtype,color_name:t.color_name,color_name_is_synthesized:t.color_name_is_synthesized,rgba:t.rgba,brand:t.brand,label_weight:t.label_weight,core_weight:t.core_weight,weight_used:t.weight_used}})(),scaleWeight:$??F,onSyncWeight:()=>h(),onAssignToAms:()=>B(!0),isAssigned:se,onUnassignFromAms:se&&X?.id!=null?()=>O.mutate(X.id):void 0,onClose:ce}):W&&A&&!X&&!e.matchedSpool&&L!==A?(0,S.jsx)(E,{tagUid:A,scaleWeight:$??F,onLinkSpool:Q.length>0?()=>z(!0):void 0,onAddToInventory:()=>V(!0),onClose:ce}):(0,S.jsx)(te,{}):(0,S.jsx)(j,{})})]})})]}),Z&&!H&&A&&(0,S.jsx)(y,{isOpen:re,onClose:()=>B(!1),spool:Z,printerId:t,variant:`kiosk`,spoolmanMode:p}),A&&(0,S.jsx)(D,{isOpen:ne,onClose:()=>z(!1),tagId:A,untaggedSpools:Q,onLink:le}),ie&&A&&(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,S.jsxs)(`div`,{className:`bg-zinc-800 rounded-2xl p-6 mx-4 max-w-sm w-full border border-zinc-700`,children:[(0,S.jsx)(`h3`,{className:`text-lg font-semibold text-zinc-100 mb-3`,children:n(`spoolbuddy.modal.addToInventory`,`Add to Inventory`)}),(0,S.jsxs)(`div`,{className:`flex gap-2.5 p-3 bg-amber-500/10 border border-amber-500/20 rounded-lg mb-4`,children:[(0,S.jsx)(`svg`,{className:`w-5 h-5 text-amber-500 shrink-0 mt-0.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,S.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})}),(0,S.jsx)(`p`,{className:`text-sm text-amber-200/80`,children:n(`spoolbuddy.modal.quickAddHint`,`For best results, add the spool in the Bambuddy web interface first (with material, color, brand), then use "Assign Spool" here to assign the NFC tag.`)})]}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-400 mb-1`,children:n(`spoolbuddy.modal.quickAddDesc`,`This will create a basic PLA spool entry with this NFC tag. You can edit the details later in Bambuddy.`)}),(0,S.jsx)(`p`,{className:`text-xs text-zinc-500 font-mono mb-5`,children:A}),(0,S.jsxs)(`div`,{className:`flex gap-3`,children:[(0,S.jsx)(`button`,{onClick:()=>V(!1),className:`flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]`,children:n(`common.cancel`,`Cancel`)}),(0,S.jsx)(`button`,{onClick:ue,disabled:ae,className:`flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 disabled:opacity-50 transition-colors min-h-[44px]`,children:ae?n(`common.saving`,`Saving...`):n(`spoolbuddy.modal.addAnyway`,`Add Anyway`)})]})]})})]})}export{M as SpoolBuddyDashboard}; \ No newline at end of file diff --git a/static/assets/SpoolBuddyInventoryPage-C7DfINfT.js b/static/assets/SpoolBuddyInventoryPage-C7DfINfT.js new file mode 100644 index 000000000..6bf6e356e --- /dev/null +++ b/static/assets/SpoolBuddyInventoryPage-C7DfINfT.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,v as i,w as a}from"./client-DnySrlFv.js";import{n as o}from"./QueryClientProvider-Ce8_sN3w.js";import{t as s}from"./useQuery-BBCjCezC.js";import{t as c}from"./useMutation-B-Tr2hIP.js";import{t as l}from"./check-Ck0cMLU4.js";import{n as u}from"./ToastContext-BRX0SW3C.js";import{t as d}from"./package-BGUevlqS.js";import{t as f}from"./search-0n0CBc74.js";import{t as p}from"./triangle-alert-Dt_1FcBy.js";import{t as m}from"./unlink-C098nwOf.js";import{t as h}from"./x-DR-Trv6U.js";import{H as g,Hn as _,Kt as v,ft as y,lt as b,ot as x,pt as S}from"./index-CovRLYqQ.js";import{n as C,t as w}from"./spoolPaint-CrvpHqdD.js";import{t as T}from"./AssignToAmsModal-DOax3BGf.js";import{t as E}from"./inventorySearch-CtBW7_f5.js";import{n as D,r as O,t as k}from"./SpoolIcon-DE8TbEec.js";var A=e(n(),1),j=t(),M=`spoolbuddy-default-core-weight`;function N(){try{let e=localStorage.getItem(M);if(e){let t=parseInt(e,10);if(t>=0&&t<=500)return t}}catch{}return 250}function P({spool:e,liveScaleWeight:t,persistedGrossWeight:n,onClose:o,onSyncWeight:c,onAssignToAms:u,isAssigned:d,onUnassignFromAms:f,className:h}){let{t:g}=a(),[_,b]=(0,A.useState)(!1),[x,C]=(0,A.useState)(!1),[w,T]=(0,A.useState)(null),{data:E}=s({queryKey:[`spool-k-profiles`,e.id],queryFn:()=>r.getSpoolKProfiles(e.id),enabled:!e.k_profiles||e.k_profiles.length===0,staleTime:300*1e3}),D=e.k_profiles&&e.k_profiles.length>0?e.k_profiles:E,O=S(e.rgba),M=y(e.color_name,e.rgba,e.color_name_is_synthesized),P=e.core_weight&&e.core_weight>0?e.core_weight:N(),F=t===null?null:Math.round(Math.max(0,t)),I=w??(n===void 0?F:n===null?null:Math.round(Math.max(0,n))),L=Math.round(Math.max(0,(e.label_weight||0)-(e.weight_used||0))),R=F!==null&&F>=10?Math.round(Math.max(0,F-P)):L,z=Math.round(e.label_weight||1e3),B=z>0?Math.min(100,Math.round(R/z*100)):null,V=B===null?`#808080`:B>50?`#22c55e`:B>20?`#eab308`:`#ef4444`,H=Math.max(0,(e.label_weight||0)-(e.weight_used||0))+P,U=F===null?null:F-H,W=U===null?null:Math.abs(U)<=50,G=I??Math.round(H),K=e.nozzle_temp_min!=null&&e.nozzle_temp_max!=null?`${e.nozzle_temp_min}-${e.nozzle_temp_max}\u00B0C`:null,q=e.slicer_filament_name||e.slicer_filament||null,J=e.note?.trim()||null,Y=D&&D.length>0?Array.from(new Set(D.map(e=>e.k_value.toFixed(3)))).join(`, `):null,X=async()=>{if(t===null)return;let n=Math.round(Math.max(0,t));b(!0);try{await i.updateSpoolWeight(e.id,n),T(n),C(!0),c?.(),setTimeout(()=>C(!1),3e3)}catch(e){console.error(`Failed to sync weight:`,e)}finally{b(!1)}};return(0,j.jsxs)(`div`,{className:`flex flex-col items-center space-y-4 max-w-md ${h??``}`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-5`,children:[(0,j.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,j.jsx)(k,{color:O,isEmpty:!1,size:100,spool:e}),B!==null&&(0,j.jsxs)(`div`,{className:`absolute -bottom-2 -right-2 px-2 py-0.5 rounded-full text-xs font-bold text-white shadow-lg`,style:{backgroundColor:V},children:[B,`%`]})]}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0 pt-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`h3`,{className:`text-lg font-semibold text-zinc-100`,children:M||g(`spoolbuddy.spool.unknownColor`)}),(0,j.jsxs)(`span`,{className:`text-xs font-mono text-zinc-500 shrink-0`,children:[`#`,e.id]})]}),(0,j.jsxs)(`p`,{className:`text-sm text-zinc-400`,children:[e.brand,` • `,e.material,e.subtype&&` ${e.subtype}`]}),(0,j.jsxs)(`div`,{className:`mt-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-3xl font-bold font-mono text-zinc-100`,children:[R,`g`]}),(0,j.jsxs)(`span`,{className:`text-sm text-zinc-500`,children:[`/ `,z,`g`]})]}),(0,j.jsx)(`p`,{className:`text-xs text-zinc-500 mt-0.5`,children:g(`spoolbuddy.spool.remaining`,`Remaining`)}),(0,j.jsx)(`div`,{className:`mt-2 max-w-xs`,children:(0,j.jsx)(`div`,{className:`h-2 bg-zinc-700 rounded-full overflow-hidden`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${B??0}%`,backgroundColor:V}})})})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-2 text-sm bg-zinc-800 rounded-lg p-4 w-full`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between`,children:[(0,j.jsx)(`span`,{className:`text-zinc-500`,children:g(`spoolbuddy.dashboard.grossWeight`,`Gross weight`)}),(0,j.jsxs)(`span`,{className:`font-mono text-zinc-300`,children:[G,`g`]})]}),(0,j.jsxs)(`div`,{className:`flex justify-between`,children:[(0,j.jsx)(`span`,{className:`text-zinc-500`,children:g(`spoolbuddy.spool.coreWeight`,`Core`)}),(0,j.jsxs)(`span`,{className:`font-mono text-zinc-300`,children:[P,`g`]})]}),(0,j.jsxs)(`div`,{className:`flex justify-between`,children:[(0,j.jsx)(`span`,{className:`text-zinc-500`,children:g(`spoolbuddy.dashboard.spoolSize`,`Spool size`)}),(0,j.jsxs)(`span`,{className:`font-mono text-zinc-300`,children:[z,`g`]})]}),(0,j.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,j.jsx)(`span`,{className:`text-zinc-500`,children:g(`spoolbuddy.spool.scaleWeight`,`Scale`)}),F===null?(0,j.jsx)(`span`,{className:`text-zinc-500`,children:`—`}):(0,j.jsxs)(`span`,{className:`flex items-center gap-1 font-mono ${W?`text-green-500`:`text-yellow-500`}`,children:[F,`g`,W?(0,j.jsx)(l,{className:`w-3.5 h-3.5`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(p,{className:`w-3.5 h-3.5`}),(0,j.jsx)(`button`,{onClick:X,className:`p-1 hover:bg-green-500/20 rounded transition-colors text-green-500`,title:g(`spoolbuddy.dashboard.syncWeight`,`Sync Weight`),children:(0,j.jsx)(v,{className:`w-4 h-4`})})]})]})]}),(0,j.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,j.jsx)(`span`,{className:`text-zinc-500`,children:g(`spoolbuddy.dashboard.tagId`,`Tag`)}),(0,j.jsx)(`span`,{className:`font-mono text-xs text-zinc-400 truncate max-w-[120px]`,title:e.tag_uid||``,children:e.tag_uid?e.tag_uid.slice(-8):`—`})]}),K&&(0,j.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,j.jsx)(`span`,{className:`text-zinc-500`,children:g(`spoolbuddy.inventory.nozzleTemp`,`Nozzle`)}),(0,j.jsx)(`span`,{className:`font-mono text-zinc-300`,children:K})]}),e.cost_per_kg!=null&&e.cost_per_kg>0&&(0,j.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,j.jsx)(`span`,{className:`text-zinc-500`,children:g(`spoolbuddy.inventory.costPerKg`,`Cost/kg`)}),(0,j.jsxs)(`span`,{className:`font-mono text-zinc-300`,children:[e.cost_per_kg.toFixed(2),`/kg`]})]}),Y&&(0,j.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,j.jsx)(`span`,{className:`text-zinc-500`,children:g(`spoolbuddy.inventory.kProfiles`,`K-Profile`)}),(0,j.jsx)(`span`,{className:`font-mono text-zinc-300 truncate max-w-[220px] text-right`,title:Y,children:Y})]}),q&&(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-xs text-zinc-500 mb-1`,children:g(`spoolbuddy.inventory.slicerFilament`,`Slicer Filament`)}),(0,j.jsx)(`p`,{className:`text-sm text-zinc-300 whitespace-pre-wrap break-words`,children:q})]}),J&&(0,j.jsxs)(`div`,{className:`col-span-2`,children:[(0,j.jsx)(`p`,{className:`text-xs text-zinc-500 mb-1`,children:g(`spoolbuddy.inventory.note`,`Note`)}),(0,j.jsx)(`p`,{className:`text-sm leading-5 text-zinc-300 whitespace-pre-wrap break-words max-h-[3.75rem] overflow-y-auto pr-1`,children:J})]})]}),(0,j.jsxs)(`div`,{className:`flex gap-2 justify-center`,children:[u&&(0,j.jsx)(`button`,{onClick:d?void 0:u,disabled:!!d,className:`px-5 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 transition-colors min-h-[44px] disabled:opacity-50 disabled:cursor-not-allowed`,children:g(`spoolbuddy.modal.assignToAms`,`Assign to AMS`)}),f&&(0,j.jsxs)(`button`,{onClick:f,className:`px-5 py-2.5 rounded-lg text-sm font-medium bg-red-600/20 text-red-400 hover:bg-red-600/30 transition-colors min-h-[44px]`,children:[(0,j.jsx)(m,{className:`w-4 h-4 inline mr-1`}),g(`inventory.unassignSpool`)]}),(0,j.jsx)(`button`,{onClick:X,disabled:t===null||_,className:`px-5 py-2.5 rounded-lg text-sm font-medium transition-colors min-h-[44px] ${x?`bg-green-600/20 text-green-400`:u?`bg-zinc-700 text-zinc-300 hover:bg-zinc-600 disabled:opacity-40 disabled:cursor-not-allowed`:`bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 disabled:cursor-not-allowed`}`,children:_?`...`:x?g(`spoolbuddy.dashboard.weightSynced`,`Synced!`):g(`spoolbuddy.dashboard.syncWeight`,`Sync Weight`)}),o&&(0,j.jsx)(`button`,{onClick:o,className:`px-5 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]`,children:g(`spoolbuddy.dashboard.close`,`Close`)})]})]})}function F(e){return S(e.rgba)}function I(e){return Math.max(0,e.label_weight-e.weight_used)}function L(e){return e.label_weight<=0?0:Math.max(0,Math.min(100,(e.label_weight-e.weight_used)/e.label_weight*100))}function R(e){let t=[e.material];return e.subtype&&t.push(e.subtype),t.join(` `)}function z(e){let t=e.ams_id===254||e.ams_id===255,n=!t&&e.ams_id>=128;return g(e.ams_id,e.tray_id,n,t)}function B({color:e,spool:t,size:n=56}){return w(t)?(0,j.jsxs)(`div`,{className:`relative shrink-0`,style:{width:n,height:n},children:[(0,j.jsx)(D,{spool:t,size:n,inset:2/56}),(0,j.jsx)(O,{inset:8/56}),(0,j.jsxs)(`svg`,{className:`absolute inset-0`,width:n,height:n,viewBox:`0 0 56 56`,children:[(0,j.jsx)(`ellipse`,{cx:`20`,cy:`20`,rx:`6`,ry:`4`,fill:`white`,opacity:`0.3`}),(0,j.jsx)(`circle`,{cx:`28`,cy:`28`,r:`8`,fill:`#2d2d2d`}),(0,j.jsx)(`circle`,{cx:`28`,cy:`28`,r:`5`,fill:`#1a1a1a`})]})]}):(0,j.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 56 56`,children:[(0,j.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:e}),(0,j.jsx)(`circle`,{cx:`28`,cy:`28`,r:`20`,fill:e,style:{filter:`brightness(0.85)`}}),(0,j.jsx)(`ellipse`,{cx:`20`,cy:`20`,rx:`6`,ry:`4`,fill:`white`,opacity:`0.3`}),(0,j.jsx)(`circle`,{cx:`28`,cy:`28`,r:`8`,fill:`#2d2d2d`}),(0,j.jsx)(`circle`,{cx:`28`,cy:`28`,r:`5`,fill:`#1a1a1a`})]})}function V(){let{sbState:e,selectedPrinterId:t}=_(),{t:n}=a(),i=x(),{showToast:l}=u(),p=o(),[m,g]=(0,A.useState)(``),[v,y]=(0,A.useState)(`all`),[b,S]=(0,A.useState)(null),[C,w]=(0,A.useState)(!1),{data:D}=s({queryKey:[`spoolman-settings`],queryFn:r.getSpoolmanSettings,staleTime:300*1e3}),O=D?.spoolman_enabled===`true`&&!!D?.spoolman_url,{data:k=[],isLoading:M,refetch:N}=s({queryKey:O?[`spoolman-inventory-spools`]:[`inventory-spools`],queryFn:()=>O?r.getSpoolmanInventorySpools(!1):r.getSpools(!1),enabled:D!==void 0,refetchInterval:3e4}),{data:P=[]}=s({queryKey:[`spool-assignments`],queryFn:()=>r.getAssignments(),refetchInterval:3e4,enabled:!O}),{data:F=[]}=s({queryKey:[`spoolman-slot-assignments`],queryFn:()=>r.getSpoolmanSlotAssignments(),refetchInterval:3e4,enabled:O}),I=c({mutationFn:e=>r.unassignSpoolmanSlot(e),onSuccess:()=>{p.invalidateQueries({queryKey:[`spoolman-slot-assignments`]}),p.invalidateQueries({queryKey:[`spoolman-inventory-spools`]})},onError:()=>l(n(`inventory.unassignFailed`,`Failed to unassign spool`),`error`)}),L=(0,A.useMemo)(()=>{if(O){let e={};return F.forEach(t=>{e[t.spoolman_spool_id]={ams_id:t.ams_id,tray_id:t.tray_id}}),e}let e={};return P.forEach(t=>{e[t.spool_id]={ams_id:t.ams_id,tray_id:t.tray_id,printer_name:t.printer_name}}),e},[O,P,F]),R=(0,A.useMemo)(()=>k.filter(e=>!e.archived_at),[k]),z=(0,A.useMemo)(()=>new Set(Object.keys(L).map(Number)),[L]),B=(0,A.useMemo)(()=>R.filter(e=>z.has(e.id)).length,[R,z]),V=(0,A.useMemo)(()=>{let e=new Set;return R.forEach(t=>e.add(t.material)),Array.from(e).sort()},[R]),G=(0,A.useMemo)(()=>{let e=R;return v===`in_ams`?e=e.filter(e=>z.has(e.id)):v!==`all`&&(e=e.filter(e=>e.material===v)),e=E(e,m.trim()),[...e].sort((e,t)=>{let n=+!z.has(e.id),r=+!z.has(t.id);return n===r?new Date(t.updated_at).getTime()-new Date(e.updated_at).getTime():n-r})},[R,v,m,z,i]);return(0,j.jsxs)(`div`,{className:`h-full flex flex-col`,children:[(0,j.jsxs)(`div`,{className:`px-3 pt-3 pb-2 space-y-2.5`,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(f,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-white/40`}),(0,j.jsx)(`input`,{type:`text`,value:m,onChange:e=>g(e.target.value),placeholder:n(`spoolbuddy.inventory.searchPlaceholder`,`Search spools...`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-sm text-white placeholder-white/30 focus:outline-none focus:border-bambu-green`}),m&&(0,j.jsx)(`button`,{onClick:()=>g(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/60`,children:(0,j.jsx)(h,{className:`w-4 h-4`})})]}),(0,j.jsxs)(`div`,{className:`flex gap-1.5 overflow-x-auto no-scrollbar`,children:[(0,j.jsx)(H,{active:v===`all`,onClick:()=>y(`all`),label:`${n(`spoolbuddy.inventory.all`,`All`)} (${R.length})`,green:!0}),B>0&&(0,j.jsx)(H,{active:v===`in_ams`,onClick:()=>y(`in_ams`),label:`${n(`spoolbuddy.inventory.inAms`,`In AMS`)} (${B})`}),V.map(e=>(0,j.jsx)(H,{active:v===e,onClick:()=>y(v===e?`all`:e),label:e},e))]})]}),(0,j.jsx)(`div`,{className:`flex-1 overflow-y-auto px-3 pb-3`,children:M?(0,j.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,j.jsx)(`div`,{className:`w-8 h-8 border-2 border-bambu-green border-t-transparent rounded-full animate-spin`})}):G.length===0?(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-white/30`,children:[(0,j.jsx)(d,{className:`w-12 h-12 mb-3`}),(0,j.jsx)(`p`,{className:`text-sm`,children:m||v!==`all`?n(`spoolbuddy.inventory.noResults`,`No spools match your filters`):n(`spoolbuddy.inventory.empty`,`No spools in inventory`)})]}):(0,j.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(130px,1fr))] gap-2`,children:G.map(e=>(0,j.jsx)(U,{spool:e,assignment:L[e.id],onClick:()=>S(e.id)},e.id))})}),b!=null&&(()=>{let n=k.find(e=>e.id===b);return n?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(W,{spool:n,assignment:L[n.id],sbState:e,onSyncWeight:()=>{N()},onAssignToAms:()=>w(!0),onUnassignFromAms:O&&L[n.id]?()=>I.mutate(n.id):void 0,onClose:()=>{S(null),w(!1)}}),(0,j.jsx)(T,{isOpen:C,onClose:()=>w(!1),spool:n,printerId:t,variant:`kiosk`,spoolmanMode:O})]}):null})()]})}function H({active:e,onClick:t,label:n,green:r}){return(0,j.jsx)(`button`,{onClick:t,className:`px-4 py-1.5 rounded-full text-sm font-medium border whitespace-nowrap shrink-0 transition-colors ${e?r?`bg-bambu-green/20 text-bambu-green border-bambu-green/50`:`bg-white/10 text-white border-white/20`:`bg-transparent text-white/40 border-bambu-dark-tertiary hover:text-white/60`}`,children:n})}function U({spool:e,assignment:t,onClick:n}){let r=F(e),i=L(e),a=I(e),o=y(e.color_name,e.rgba,e.color_name_is_synthesized);return(0,j.jsxs)(`button`,{onClick:n,className:`bg-bambu-dark-secondary rounded-xl p-3 flex flex-col items-center text-center gap-1.5 border border-transparent hover:border-bambu-green/50 transition-colors`,children:[(0,j.jsx)(B,{color:r,spool:e,size:56}),(0,j.jsx)(`p`,{className:`text-xs font-semibold text-white leading-tight truncate w-full`,children:R(e)}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0 max-w-full`,children:[(0,j.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full shrink-0 border border-white/10`,style:C(e)??b(e.rgba)}),(0,j.jsx)(`span`,{className:`text-[11px] text-white/50 truncate`,children:o||`-`})]}),(0,j.jsxs)(`div`,{className:`w-full space-y-0.5`,children:[(0,j.jsx)(`div`,{className:`h-1.5 bg-bambu-dark-tertiary rounded-full overflow-hidden`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full ${i>50?`bg-bambu-green`:i>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(i,100)}%`}})}),(0,j.jsxs)(`p`,{className:`text-[11px] text-white/40`,children:[Math.round(a),`g (`,Math.round(i),`%)`]})]}),t&&(0,j.jsx)(`span`,{className:`px-2 py-0.5 rounded text-[10px] font-bold bg-bambu-green/20 text-bambu-green`,children:z(t)})]})}function W({spool:e,assignment:t,sbState:n,onSyncWeight:r,onAssignToAms:i,onUnassignFromAms:a,onClose:o}){let s=n.deviceOnline&&n.weight!==null?Math.round(n.weight):null,c=e.last_scale_weight==null?null:Math.round(e.last_scale_weight);return(0,j.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-4`,onClick:o,children:(0,j.jsx)(`div`,{className:`w-full max-w-md bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-2xl p-4 overflow-y-auto max-h-[90vh]`,onClick:e=>e.stopPropagation(),children:(0,j.jsxs)(`div`,{className:`space-y-3`,children:[t&&(0,j.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,j.jsx)(`span`,{className:`px-2.5 py-1 rounded-md text-xs font-bold bg-bambu-green/20 text-bambu-green`,children:z(t)}),t.printer_name&&(0,j.jsx)(`span`,{className:`text-xs text-zinc-400`,children:t.printer_name})]}),(0,j.jsx)(`div`,{className:`flex justify-center`,children:(0,j.jsx)(P,{spool:e,liveScaleWeight:s,persistedGrossWeight:c,onSyncWeight:r,onAssignToAms:i,isAssigned:!!t,onUnassignFromAms:a,onClose:o,className:`max-w-md`})})]})})})}export{V as SpoolBuddyInventoryPage}; \ No newline at end of file diff --git a/static/assets/SpoolBuddySettingsPage-C6SPF9Jm.js b/static/assets/SpoolBuddySettingsPage-C6SPF9Jm.js new file mode 100644 index 000000000..24ca7e1fe --- /dev/null +++ b/static/assets/SpoolBuddySettingsPage-C6SPF9Jm.js @@ -0,0 +1,2 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,v as r,w as i}from"./client-DnySrlFv.js";import{n as a}from"./QueryClientProvider-Ce8_sN3w.js";import{t as o}from"./useQuery-BBCjCezC.js";import{t as s}from"./play-DIDYtk2S.js";import{t as c}from"./x-DR-Trv6U.js";import{v as l}from"./date-G9KUauqz.js";import{Hn as u,Tt as d,Wt as f,bt as p,xn as m}from"./index-CovRLYqQ.js";var h=e(n(),1),g=t();function _({type:e,deviceId:t,onClose:n}){let{t:a}=i(),[o,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(``),[p,m]=(0,h.useState)(``),[_,v]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!o&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o,n]);let y=(0,h.useCallback)(async()=>{l(!0),d(``),m(``),v(!0);try{d(a(`spoolbuddy.diagnostic.queuing`,`Queuing diagnostic on device... +`)),await r.queueDiagnostics(t,e);let n=null,i=0;for(;i<60&&!n;){await new Promise(e=>setTimeout(e,500));try{n=await r.getDiagnosticResult(t,e);break}catch{i++,i%4==0&&d(e=>e+`.`)}}if(!n)throw Error(`Diagnostic timed out - device did not report results`);d(n.output),n.success||m(`Exit code: ${n.exit_code}`)}catch(e){m(e instanceof Error?e.message:`Unknown error`),d(``)}finally{l(!1)}},[e,t,a]);return(0,g.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 animate-fade-in`,onClick:n,children:(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg shadow-xl w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col animate-slide-up`,onClick:e=>e.stopPropagation(),children:[(0,g.jsxs)(`div`,{className:`flex justify-between items-center p-4 border-b border-zinc-700`,children:[(0,g.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e===`scale`?a(`spoolbuddy.diagnostic.scaleTitle`,`Scale Diagnostic`):e===`read_tag`?a(`spoolbuddy.diagnostic.readTagTitle`,`Read Tag Diagnostic`):a(`spoolbuddy.diagnostic.nfcTitle`,`NFC Reader Diagnostic`)}),(0,g.jsx)(`button`,{onClick:n,className:`text-zinc-400 hover:text-white transition-colors`,"aria-label":`Close`,children:(0,g.jsx)(c,{size:20})})]}),(0,g.jsx)(`div`,{className:`flex-1 overflow-auto p-4 bg-black/50 font-mono text-sm`,children:o?(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-green-400`,children:[(0,g.jsx)(`div`,{className:`animate-spin w-4 h-4 border-2 border-green-400 border-t-transparent rounded-full`}),(0,g.jsx)(`span`,{children:a(`spoolbuddy.diagnostic.running`,`Running diagnostic on device...`)})]}):u?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`text-green-400 whitespace-pre-wrap break-words`,children:u}),p&&(0,g.jsxs)(`div`,{className:`text-red-400 mt-2`,children:[`❌ `,p]})]}):_?(0,g.jsx)(`div`,{children:p?(0,g.jsxs)(`div`,{className:`text-red-400`,children:[`ERROR: `,p]}):(0,g.jsx)(`span`,{className:`text-green-400`,children:a(`spoolbuddy.diagnostic.completed`,`Diagnostic completed successfully.`)})}):(0,g.jsxs)(`div`,{className:`text-zinc-500`,children:[a(`spoolbuddy.diagnostic.clickStart`,`Click "Run Diagnostic" to start the hardware diagnostic on`),` `,t,`.`]})}),(0,g.jsxs)(`div`,{className:`flex gap-2 p-4 border-t border-zinc-700 bg-zinc-800`,children:[(0,g.jsx)(`button`,{onClick:y,disabled:o,className:`flex-1 flex items-center justify-center gap-2 bg-green-600 hover:bg-green-700 disabled:bg-gray-600 disabled:cursor-not-allowed px-4 py-2 rounded font-semibold text-white transition-colors`,children:o?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full`}),a(`spoolbuddy.diagnostic.runningBtn`,`Running...`)]}):_?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(f,{size:16}),a(`spoolbuddy.diagnostic.runAgain`,`Run Again`)]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s,{size:16}),a(`spoolbuddy.diagnostic.runBtn`,`Run Diagnostic`)]})}),(0,g.jsx)(`button`,{onClick:n,className:`px-4 py-2 rounded bg-zinc-700 hover:bg-zinc-600 text-white font-semibold transition-colors`,children:a(`spoolbuddy.diagnostic.close`,`Close`)})]})]})})}function v(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function y(e){if(!e)return`-`;let t=l(e);return t?t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})+` `+t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}):`-`}var b=[{label:`Off`,value:0},{label:`1m`,value:60},{label:`2m`,value:120},{label:`5m`,value:300},{label:`10m`,value:600},{label:`30m`,value:1800}];function x({device:e}){let{t}=i(),[n,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)(``),[u,f]=(0,h.useState)(!1),[y,b]=(0,h.useState)(null);return(0,h.useEffect)(()=>{!o&&e.backend_url&&s(e.backend_url)},[e.backend_url,o]),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300 mb-2`,children:t(`spoolbuddy.settings.nfcReader`,`NFC Reader`)}),(0,g.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.type`,`Type`)}),(0,g.jsx)(`span`,{className:`text-zinc-300 font-mono`,children:e.nfc_reader_type||`N/A`})]}),(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.connection`,`Connection`)}),(0,g.jsx)(`span`,{className:`text-zinc-300 font-mono`,children:e.nfc_connection||`N/A`})]}),(0,g.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.status.status`,`Status`)}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(`div`,{className:`w-2 h-2 rounded-full ${e.nfc_ok?`bg-green-500`:e.nfc_reader_type?`bg-red-500`:`bg-zinc-600`}`}),(0,g.jsx)(`span`,{className:e.nfc_ok?`text-green-400`:e.nfc_reader_type?`text-red-400`:`text-zinc-500`,children:e.nfc_ok?t(`spoolbuddy.status.nfcReady`,`Ready`):e.nfc_reader_type?t(`common.error`,`Error`):t(`spoolbuddy.settings.notConnected`,`N/A`)})]})]})]})]}),(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300 mb-2`,children:t(`spoolbuddy.settings.deviceInfo`,`Device Info`)}),(0,g.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.hostname`,`Host`)}),(0,g.jsx)(`span`,{className:`text-zinc-300 truncate ml-2`,children:e.hostname})]}),(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:`IP`}),(0,g.jsx)(`span`,{className:`text-zinc-300`,children:e.ip_address})]}),(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.uptime`,`Uptime`)}),(0,g.jsx)(`span`,{className:`text-zinc-300`,children:v(e.uptime_s)})]}),(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:`ID`}),(0,g.jsx)(`span`,{className:`text-zinc-400 font-mono truncate ml-2`,children:e.device_id})]})]})]})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3 space-y-2`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300`,children:t(`spoolbuddy.settings.systemConfig`,`Backend & Auth`)}),(0,g.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`http://192.168.1.100:5000`,className:`w-full px-2 py-1.5 rounded bg-zinc-900 border border-zinc-700 text-zinc-100 text-xs`}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(`input`,{type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:t(`spoolbuddy.settings.apiTokenPlaceholder`,`API token`),className:`flex-1 px-2 py-1.5 rounded bg-zinc-900 border border-zinc-700 text-zinc-100 text-xs`}),(0,g.jsx)(`button`,{onClick:async()=>{if(!o.trim()){b({type:`error`,text:t(`spoolbuddy.settings.systemFieldsRequired`,`Backend URL is required.`)});return}f(!0),b(null);try{await r.updateSystemConfig(e.device_id,o.trim(),c.trim()||void 0),b({type:`ok`,text:t(`spoolbuddy.settings.systemQueued`,`Config queued.`)})}catch(e){b({type:`error`,text:e instanceof Error?e.message:t(`common.error`,`Error`)})}finally{f(!1)}},disabled:u,className:`px-3 py-1.5 rounded bg-green-700 hover:bg-green-600 disabled:bg-zinc-700 text-xs font-medium text-zinc-100`,children:t(`spoolbuddy.settings.saveConfig`,`Save`)})]}),y&&(0,g.jsx)(`div`,{className:`text-xs ${y.type===`ok`?`text-green-400`:`text-red-400`}`,children:y.text})]}),(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3 flex flex-col gap-2`,children:[(0,g.jsxs)(`button`,{onClick:()=>a(`nfc`),className:`flex-1 bg-blue-700 hover:bg-blue-600 transition-colors rounded-lg p-2 flex items-center gap-2`,children:[(0,g.jsx)(d,{className:`w-4 h-4 text-blue-300 shrink-0`}),(0,g.jsx)(`span`,{className:`text-xs font-medium text-blue-100`,children:t(`spoolbuddy.settings.nfcDiagnostic`,`NFC Diagnostic`)})]}),(0,g.jsxs)(`button`,{onClick:()=>a(`scale`),className:`flex-1 bg-yellow-700 hover:bg-yellow-600 transition-colors rounded-lg p-2 flex items-center gap-2`,children:[(0,g.jsx)(p,{className:`w-4 h-4 text-yellow-300 shrink-0`}),(0,g.jsx)(`span`,{className:`text-xs font-medium text-yellow-100`,children:t(`spoolbuddy.settings.scaleDiagnostic`,`Scale Diagnostic`)})]}),(0,g.jsxs)(`button`,{onClick:()=>a(`read_tag`),className:`flex-1 bg-emerald-700 hover:bg-emerald-600 transition-colors rounded-lg p-2 flex items-center gap-2`,children:[(0,g.jsx)(m,{className:`w-4 h-4 text-emerald-300 shrink-0`}),(0,g.jsx)(`span`,{className:`text-xs font-medium text-emerald-100`,children:t(`spoolbuddy.settings.readTagDiagnostic`,`Read Tag`)})]})]})]}),n&&e&&(0,g.jsx)(_,{type:n,deviceId:e.device_id,onClose:()=>a(null)})]})}function S({device:e,onBrightnessChange:t}){let{t:n}=i(),[a,o]=(0,h.useState)(e.display_brightness),[s,c]=(0,h.useState)(e.display_blank_timeout),[l,u]=(0,h.useState)(!1),d=(0,h.useRef)(void 0),f=(0,h.useRef)(void 0);(0,h.useEffect)(()=>{o(e.display_brightness),c(e.display_blank_timeout)},[e.display_brightness,e.display_blank_timeout]);let p=(0,h.useCallback)(()=>{u(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>u(!1),1500)},[]),m=(0,h.useCallback)((t,n)=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{r.updateDisplay(e.device_id,t,n).then(()=>p()).catch(e=>console.error(`Failed to update display:`,e))},300)},[e.device_id,p]),_=e=>{o(e),t(e),m(e,s)},v=e=>{c(e),m(a,e)};return(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300`,children:n(`spoolbuddy.settings.brightness`,`Brightness`)}),l&&(0,g.jsxs)(`span`,{className:`text-xs text-green-400 flex items-center gap-1 animate-pulse`,children:[(0,g.jsx)(`svg`,{className:`w-3 h-3`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:3,children:(0,g.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})}),n(`spoolbuddy.settings.saved`,`Saved`)]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`svg`,{className:`w-4 h-4 text-zinc-500 flex-shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,g.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z`})}),(0,g.jsx)(`input`,{type:`range`,min:0,max:100,value:a,onChange:e=>_(parseInt(e.target.value)),className:`flex-1 h-2 bg-zinc-700 rounded-lg appearance-none cursor-pointer accent-green-500`}),(0,g.jsxs)(`span`,{className:`text-sm font-mono text-zinc-400 w-10 text-right`,children:[a,`%`]})]}),!e.has_backlight&&(0,g.jsx)(`p`,{className:`text-xs text-zinc-600 mt-2`,children:n(`spoolbuddy.settings.noBacklight`,`No DSI backlight detected. Brightness control requires a DSI display.`)})]}),(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-4`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300 mb-1`,children:n(`spoolbuddy.settings.screenBlank`,`Screen Blank Timeout`)}),(0,g.jsx)(`p`,{className:`text-xs text-zinc-500 mb-3`,children:n(`spoolbuddy.settings.screenBlankDesc`,`Screen turns off after inactivity. Touch to wake.`)}),(0,g.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:b.map(e=>(0,g.jsx)(`button`,{onClick:()=>v(e.value),className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors min-h-[40px] ${s===e.value?`bg-green-600 text-white`:`bg-zinc-700 text-zinc-300 hover:bg-zinc-600`}`,children:e.label},e.value))})]}),(0,g.jsx)(`p`,{className:`text-xs text-zinc-600 text-center`,children:n(`spoolbuddy.settings.displayNote`,`Brightness is applied as a software filter.`)})]})}function C({step:e,labels:t}){return(0,g.jsxs)(`div`,{className:`flex flex-col items-center w-16 shrink-0 pt-1`,children:[(0,g.jsx)(`div`,{className:`flex items-center justify-center w-7 h-7 rounded-full text-xs font-bold ${e===`tare`?`bg-green-600 text-white`:`bg-green-600/20 text-green-400`}`,children:e===`weight`?(0,g.jsx)(`svg`,{className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:3,children:(0,g.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})}):`1`}),(0,g.jsx)(`span`,{className:`text-[10px] mt-0.5 ${e===`tare`?`text-green-400 font-medium`:`text-green-400/60`}`,children:t.tare}),(0,g.jsx)(`div`,{className:`w-px h-5 my-1 ${e===`weight`?`bg-green-600/40`:`bg-zinc-700`}`}),(0,g.jsx)(`div`,{className:`flex items-center justify-center w-7 h-7 rounded-full text-xs font-bold ${e===`weight`?`bg-green-600 text-white`:`bg-zinc-700 text-zinc-500`}`,children:`2`}),(0,g.jsx)(`span`,{className:`text-[10px] mt-0.5 ${e===`weight`?`text-green-400 font-medium`:`text-zinc-600`}`,children:t.weight})]})}function w({device:e,weight:t,weightStable:n,rawAdc:o}){let{t:s}=i(),c=a(),[l,u]=(0,h.useState)(`idle`),[d,f]=(0,h.useState)(`500`),[p,m]=(0,h.useState)(null),[_,v]=(0,h.useState)(!1),[b,x]=(0,h.useState)(null),[S,w]=(0,h.useState)(null),T=(0,h.useRef)(null);(0,h.useEffect)(()=>()=>{T.current&&clearTimeout(T.current)},[]);let E=(0,h.useCallback)(e=>{T.current&&clearTimeout(T.current),T.current=setTimeout(()=>x(null),e)},[]);(0,h.useEffect)(()=>{if(!S)return;let e=()=>Date.now()-S.startedAtMs,t=setInterval(()=>{c.invalidateQueries({queryKey:[`spoolbuddy-devices`]})},1e3),n=setTimeout(()=>{w(null),x({type:`error`,msg:s(`spoolbuddy.settings.tareTimedOut`,`Tare timed out — is the SpoolBuddy daemon running?`)}),E(5e3)},Math.max(0,15e3-e()));return()=>{clearInterval(t),clearTimeout(n)}},[S,c,s,E]),(0,h.useEffect)(()=>{S&&(e?.last_calibrated_at??null)!==S.snapshot&&(w(null),x({type:`ok`,msg:s(`spoolbuddy.settings.tareComplete`,`Tare complete!`)}),E(3e3))},[e?.last_calibrated_at,S,s,E]);let D=e=>{e===`backspace`?f(e=>e.slice(0,-1)||``):e===`.`&&!d.includes(`.`)?f(e=>e+`.`):e>=`0`&&e<=`9`&&f(t=>t===`0`?e:t+e)};return l===`idle`?(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3 mb-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`div`,{className:`w-2 h-2 rounded-full ${n?`bg-green-500`:`bg-amber-500 animate-pulse`}`}),(0,g.jsx)(`span`,{className:`text-lg font-mono text-zinc-200`,children:t===null?`-- g`:`${t.toFixed(1)} g`})]}),(0,g.jsxs)(`div`,{className:`text-xs text-zinc-500 text-right`,children:[(0,g.jsxs)(`span`,{children:[s(`spoolbuddy.settings.tareOffset`,`Tare`),`: `,e.tare_offset]}),(0,g.jsx)(`span`,{className:`mx-1.5`,children:`·`}),(0,g.jsxs)(`span`,{children:[s(`spoolbuddy.settings.calFactor`,`Factor`),`: `,e.calibration_factor.toFixed(2)]})]})]}),e.last_calibrated_at&&(0,g.jsxs)(`div`,{className:`text-xs text-zinc-600 mt-1`,children:[s(`spoolbuddy.settings.lastCalibrated`,`Last calibrated`),`: `,y(e.last_calibrated_at)]})]}),b&&(0,g.jsx)(`div`,{className:`rounded-lg px-3 py-2 mb-3 text-sm ${b.type===`ok`?`bg-green-900/30 text-green-300 border border-green-800`:`bg-red-900/30 text-red-300 border border-red-800`}`,children:b.msg}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsxs)(`button`,{onClick:async()=>{v(!0),x(null),T.current&&=(clearTimeout(T.current),null);let t=e?.last_calibrated_at??null;try{await r.tare(e.device_id),x({type:`ok`,msg:s(`spoolbuddy.settings.tareSet`,`Tare command sent. Waiting for device...`)}),w({snapshot:t,startedAtMs:Date.now()})}catch{x({type:`error`,msg:s(`spoolbuddy.settings.tareFailed`,`Failed to send tare command`)}),E(5e3)}finally{v(!1)}},disabled:_,className:`flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-200 hover:bg-zinc-600 disabled:opacity-40 transition-colors min-h-[44px] flex items-center justify-center gap-2`,children:[_&&(0,g.jsxs)(`svg`,{className:`w-4 h-4 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,g.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,g.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),s(`spoolbuddy.weight.tare`,`Tare`)]}),(0,g.jsx)(`button`,{onClick:()=>{u(`tare`),x(null)},className:`flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 transition-colors min-h-[44px]`,children:s(`spoolbuddy.weight.calibrate`,`Calibrate`)})]})]}):(0,g.jsxs)(`div`,{className:`flex gap-3`,children:[(0,g.jsx)(C,{step:l,labels:{tare:s(`spoolbuddy.weight.tare`,`Tare`),weight:s(`spoolbuddy.settings.knownWeight`,`Known weight`)}}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 bg-zinc-800 rounded-lg px-3 py-1.5 mb-1.5`,children:[(0,g.jsx)(`div`,{className:`w-2 h-2 rounded-full shrink-0 ${n?`bg-green-500`:`bg-amber-500 animate-pulse`}`}),(0,g.jsx)(`span`,{className:`text-sm font-mono text-zinc-200`,children:t===null?`-- g`:`${t.toFixed(1)} g`}),(0,g.jsx)(`span`,{className:`text-xs ml-auto ${n?`text-green-400`:`text-amber-400`}`,children:n?s(`spoolbuddy.settings.stable`,`Stable`):s(`spoolbuddy.settings.settling`,`Settling...`)})]}),b&&(0,g.jsx)(`div`,{className:`rounded-lg px-3 py-1.5 mb-1.5 text-xs ${b.type===`ok`?`bg-green-900/30 text-green-300 border border-green-800`:`bg-red-900/30 text-red-300 border border-red-800`}`,children:b.msg}),l===`tare`?(0,g.jsx)(`p`,{className:`text-sm text-zinc-300 mb-3`,children:s(`spoolbuddy.settings.calStep1`,`Remove all items from the scale and press Set Zero.`)}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,g.jsx)(`span`,{className:`text-xs text-zinc-400 shrink-0`,children:s(`spoolbuddy.settings.knownWeight`,`Known weight`)}),(0,g.jsxs)(`div`,{className:`flex-1 bg-zinc-900 border border-zinc-600 rounded px-3 py-1 text-right text-lg font-mono text-zinc-100`,children:[d||`0`,(0,g.jsx)(`span`,{className:`text-zinc-500 ml-1`,children:`g`})]})]}),(0,g.jsx)(`div`,{className:`grid grid-cols-4 gap-1 mb-1.5`,children:[`7`,`8`,`9`,`backspace`,`4`,`5`,`6`,`.`,`1`,`2`,`3`,`0`].map(e=>(0,g.jsx)(`button`,{onClick:()=>D(e),className:`rounded text-lg font-medium transition-colors h-[48px] active:scale-95 ${e===`backspace`?`bg-zinc-700 text-zinc-300 hover:bg-zinc-600`:`bg-zinc-800 text-zinc-100 hover:bg-zinc-700 border border-zinc-700`}`,children:e===`backspace`?`⌫`:e},e))})]}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(`button`,{onClick:()=>{u(`idle`),x(null)},className:`flex-1 px-4 py-2 rounded-lg text-sm bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors h-[40px]`,children:s(`common.cancel`,`Cancel`)}),(0,g.jsxs)(`button`,{onClick:async()=>{if(l===`tare`){v(!0),x(null);try{m(o),await r.tare(e.device_id),x({type:`ok`,msg:s(`spoolbuddy.settings.zeroSet`,`Zero point set. Place known weight on scale.`)}),u(`weight`)}catch{x({type:`error`,msg:s(`spoolbuddy.settings.tareFailed`,`Failed to send tare command`)})}finally{v(!1)}}else if(l===`weight`){let t=parseFloat(d);if(o===null||!t||t<=0)return;v(!0),x(null);try{await r.setCalibrationFactor(e.device_id,t,o,p??void 0),x({type:`ok`,msg:s(`spoolbuddy.settings.calibrationDone`,`Calibration complete!`)}),E(3e3),u(`idle`)}catch{x({type:`error`,msg:s(`spoolbuddy.settings.calibrationFailed`,`Calibration failed`)}),E(5e3)}finally{v(!1)}}},disabled:_,className:`flex-1 px-4 py-2 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 transition-colors h-[40px] flex items-center justify-center gap-2`,children:[_&&(0,g.jsxs)(`svg`,{className:`w-4 h-4 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,g.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,g.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),l===`tare`?s(`spoolbuddy.settings.setZero`,`Set Zero`):s(`spoolbuddy.settings.calibrateNow`,`Calibrate`)]})]})]})]})}function T({device:e}){let{t}=i(),[n,a]=(0,h.useState)(null),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),[d,f]=(0,h.useState)(!1),p=e.update_status===`pending`||e.update_status===`updating`;(0,h.useEffect)(()=>{p&&n===`applying`&&a(null)},[p,n]),(0,h.useEffect)(()=>{let e=()=>{p&&setTimeout(()=>window.location.reload(),1e3)};return window.addEventListener(`spoolbuddy-online`,e),()=>window.removeEventListener(`spoolbuddy-online`,e)},[p]);let{data:m,refetch:_}=o({queryKey:[`spoolbuddy-update-check`,e.device_id],queryFn:()=>r.checkDaemonUpdate(e.device_id),staleTime:0}),{data:v}=o({queryKey:[`spoolbuddy-ssh-key`],queryFn:()=>r.getSSHPublicKey(),enabled:l,staleTime:1/0}),y=async()=>{a(`checking`),c(null);try{await _()}finally{a(null)}},b=async()=>{a(`applying`),c(null);try{await r.triggerUpdate(e.device_id)}catch(e){c(e instanceof Error?e.message:`Failed to trigger update`),a(null)}},x=n!=null||p,S=()=>{v?.public_key&&(navigator.clipboard.writeText(v.public_key),f(!0),setTimeout(()=>f(!1),2e3))},C=e.firmware_version||(m?.current_version&&m.current_version!==`0.0.0`?m.current_version:null);return(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3 space-y-3`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between items-center text-sm`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.currentVersion`,`Current Version`)}),(0,g.jsx)(`span`,{className:`text-zinc-200 font-mono`,children:C||(0,g.jsx)(`span`,{className:`text-zinc-500 italic text-xs`,children:t(`spoolbuddy.settings.versionPending`,`Waiting for daemon...`)})})]}),x?(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(`svg`,{className:`w-4 h-4 animate-spin text-green-400 flex-shrink-0`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,g.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,g.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),(0,g.jsx)(`span`,{className:`text-green-300 text-xs`,children:n===`checking`?t(`spoolbuddy.settings.checking`,`Checking for updates...`):e.update_message||t(`spoolbuddy.settings.updateWaiting`,`Updating...`)})]}):e.update_status===`error`?(0,g.jsx)(`p`,{className:`text-xs text-red-300`,children:e.update_message||t(`spoolbuddy.settings.updateFailed`,`Update failed`)}):s?(0,g.jsx)(`p`,{className:`text-xs text-red-300`,children:s}):m?.update_available?(0,g.jsxs)(`p`,{className:`text-xs text-green-300`,children:[t(`spoolbuddy.settings.updateAvailable`,`Update available`),`: `,C,` → `,m.latest_version]}):null,!x&&(m?.update_available?(0,g.jsx)(`button`,{onClick:b,disabled:!e.online,className:`w-full px-3 py-2 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 transition-colors`,children:e.online?t(`spoolbuddy.settings.applyUpdate`,`Apply Update`):t(`spoolbuddy.settings.deviceOffline`,`Device Offline`)}):(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(`button`,{onClick:y,className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors`,children:t(`spoolbuddy.settings.checkUpdates`,`Check for Updates`)}),(0,g.jsx)(`button`,{onClick:b,disabled:!e.online,className:`px-3 py-2 rounded-lg text-xs font-medium bg-zinc-700 text-zinc-400 hover:bg-zinc-600 hover:text-zinc-200 disabled:opacity-40 transition-colors`,children:t(`spoolbuddy.settings.forceUpdate`,`Force Update`)})]}))]}),(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3`,children:[(0,g.jsxs)(`button`,{onClick:()=>u(!l),className:`w-full flex justify-between items-center text-xs`,children:[(0,g.jsx)(`span`,{className:`font-medium text-zinc-400`,children:t(`spoolbuddy.settings.sshSetup`,`SSH Setup`)}),(0,g.jsx)(`svg`,{className:`w-3 h-3 text-zinc-500 transition-transform ${l?`rotate-180`:``}`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,g.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 9l-7 7-7-7`})})]}),l&&(0,g.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,g.jsx)(`p`,{className:`text-xs text-zinc-500`,children:t(`spoolbuddy.settings.sshDescription`,`SSH key is deployed automatically. For manual setup, add this key to ~/.ssh/authorized_keys on the device.`)}),v?.public_key?(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(`pre`,{className:`bg-zinc-900 rounded p-2 text-[10px] text-zinc-400 font-mono break-all whitespace-pre-wrap`,children:v.public_key}),(0,g.jsx)(`button`,{onClick:S,className:`absolute top-1 right-1 px-1.5 py-0.5 rounded text-[10px] bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors`,children:d?t(`common.copied`,`Copied!`):t(`common.copy`,`Copy`)})]}):(0,g.jsx)(`span`,{className:`text-[10px] text-zinc-500 italic`,children:t(`spoolbuddy.settings.sshKeyLoading`,`Loading...`)})]})]})]})}function E({percent:e,color:t}){return(0,g.jsx)(`div`,{className:`w-full h-2 bg-zinc-700 rounded-full overflow-hidden`,children:(0,g.jsx)(`div`,{className:`h-full rounded-full transition-all ${t}`,style:{width:`${Math.min(100,Math.max(0,e))}%`}})})}function D(e){let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function O({device:e}){let{t}=i(),n=e.system_stats;if(!n)return(0,g.jsx)(`div`,{className:`flex items-center justify-center h-32`,children:(0,g.jsx)(`p`,{className:`text-sm text-zinc-500`,children:t(`spoolbuddy.settings.systemStatsWaiting`,`Waiting for system stats...`)})});let r=n.memory,a=n.disk,o=(n.cpu_temp_c??0)>=80?`text-red-400`:(n.cpu_temp_c??0)>=65?`text-amber-400`:`text-green-400`,s=(r?.percent??0)>=90?`bg-red-500`:(r?.percent??0)>=70?`bg-amber-500`:`bg-green-500`,c=(a?.percent??0)>=90?`bg-red-500`:(a?.percent??0)>=70?`bg-amber-500`:`bg-green-500`;return(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300 mb-2`,children:`CPU`}),(0,g.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.cores`,`Cores`)}),(0,g.jsx)(`span`,{className:`text-zinc-300 font-mono`,children:n.cpu_count??`-`})]}),(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.loadAvg`,`Load Avg`)}),(0,g.jsx)(`span`,{className:`text-zinc-300 font-mono`,children:n.load_avg?n.load_avg.join(` / `):`-`})]}),(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.temp`,`Temp`)}),(0,g.jsx)(`span`,{className:`font-mono font-medium ${o}`,children:n.cpu_temp_c==null?`-`:`${n.cpu_temp_c}\u00B0C`})]})]})]}),(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300 mb-2`,children:t(`spoolbuddy.settings.memory`,`Memory`)}),r?(0,g.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,g.jsx)(E,{percent:r.percent??0,color:s}),(0,g.jsxs)(`div`,{className:`space-y-1 text-xs`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.used`,`Used`)}),(0,g.jsxs)(`span`,{className:`text-zinc-300 font-mono`,children:[r.used_mb,` / `,r.total_mb,` MB`]})]}),(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.available`,`Free`)}),(0,g.jsxs)(`span`,{className:`text-zinc-300 font-mono`,children:[r.available_mb,` MB`]})]})]})]}):(0,g.jsx)(`span`,{className:`text-xs text-zinc-500`,children:`-`})]})]}),(0,g.jsx)(`div`,{className:`bg-zinc-800 rounded-lg px-3 py-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300 shrink-0`,children:t(`spoolbuddy.settings.disk`,`Disk`)}),a?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`flex-1`,children:(0,g.jsx)(E,{percent:a.percent??0,color:c})}),(0,g.jsxs)(`span`,{className:`text-xs text-zinc-300 font-mono shrink-0`,children:[a.used_gb,` / `,a.total_gb,` GB`]})]}):(0,g.jsx)(`span`,{className:`text-xs text-zinc-500`,children:`-`})]})}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300 mb-1.5`,children:t(`spoolbuddy.settings.osInfo`,`OS`)}),(0,g.jsxs)(`div`,{className:`space-y-1 text-xs`,children:[n.os?.os&&(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.distro`,`Distro`)}),(0,g.jsx)(`span`,{className:`text-zinc-300 truncate ml-2`,children:n.os.os})]}),n.os?.kernel&&(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.kernel`,`Kernel`)}),(0,g.jsx)(`span`,{className:`text-zinc-300 font-mono truncate ml-2`,children:n.os.kernel})]}),n.os?.arch&&(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.arch`,`Arch`)}),(0,g.jsx)(`span`,{className:`text-zinc-300 font-mono`,children:n.os.arch})]})]})]}),(0,g.jsxs)(`div`,{className:`bg-zinc-800 rounded-lg p-3`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300 mb-1.5`,children:t(`spoolbuddy.settings.runtime`,`Runtime`)}),(0,g.jsxs)(`div`,{className:`space-y-1 text-xs`,children:[n.os?.python&&(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:`Python`}),(0,g.jsx)(`span`,{className:`text-zinc-300 font-mono`,children:n.os.python})]}),n.system_uptime_s!=null&&(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-zinc-500`,children:t(`spoolbuddy.settings.systemUptime`,`Uptime`)}),(0,g.jsx)(`span`,{className:`text-zinc-300`,children:D(n.system_uptime_s)})]})]})]})]})]})}function k(){let{sbState:e,setDisplayBrightness:t}=u(),{t:n}=i(),[a,s]=(0,h.useState)(`device`),{data:c=[]}=o({queryKey:[`spoolbuddy-devices`],queryFn:()=>r.getDevices(),refetchInterval:1e4}),l=e.deviceId?c.find(t=>t.device_id===e.deviceId)??c[0]:c[0],d=[{id:`device`,label:n(`spoolbuddy.settings.tabDevice`,`Device`)},{id:`display`,label:n(`spoolbuddy.settings.tabDisplay`,`Display`)},{id:`scale`,label:n(`spoolbuddy.settings.tabScale`,`Scale`)},{id:`updates`,label:n(`spoolbuddy.settings.tabUpdates`,`Updates`)},{id:`system`,label:n(`spoolbuddy.settings.tabSystem`,`System`)}];return(0,g.jsxs)(`div`,{className:`h-full flex flex-col p-4`,children:[(0,g.jsx)(`h1`,{className:`text-xl font-semibold text-zinc-100 mb-3`,children:n(`spoolbuddy.nav.settings`,`Settings`)}),(0,g.jsx)(`div`,{className:`flex gap-1 bg-zinc-800/50 rounded-lg p-1 mb-4`,children:d.map(e=>(0,g.jsx)(`button`,{onClick:()=>s(e.id),className:`flex-1 px-2 py-2 rounded-md text-sm font-medium transition-colors min-h-[36px] ${a===e.id?`bg-zinc-700 text-zinc-100`:`text-zinc-500 hover:text-zinc-300`}`,children:e.label},e.id))}),(0,g.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:l?(0,g.jsxs)(g.Fragment,{children:[a===`device`&&(0,g.jsx)(x,{device:l}),a===`display`&&(0,g.jsx)(S,{device:l,onBrightnessChange:t}),a===`scale`&&(0,g.jsx)(w,{device:l,weight:e.weight,weightStable:e.weightStable,rawAdc:e.rawAdc}),a===`updates`&&(0,g.jsx)(T,{device:l}),a===`system`&&(0,g.jsx)(O,{device:l})]}):(0,g.jsx)(`div`,{className:`flex items-center justify-center h-32`,children:(0,g.jsx)(`div`,{className:`text-center text-zinc-500`,children:(0,g.jsx)(`p`,{className:`text-sm`,children:n(`spoolbuddy.settings.noDevice`,`No SpoolBuddy device found`)})})})})]})}export{k as SpoolBuddySettingsPage}; \ No newline at end of file diff --git a/static/assets/SpoolBuddyWriteTagPage-DGVWhIOm.js b/static/assets/SpoolBuddyWriteTagPage-DGVWhIOm.js new file mode 100644 index 000000000..e72f51462 --- /dev/null +++ b/static/assets/SpoolBuddyWriteTagPage-DGVWhIOm.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,v as i,w as a}from"./client-DnySrlFv.js";import{t as o}from"./useQuery-BBCjCezC.js";import{a as s}from"./info-ROUoQhJR.js";import{n as c}from"./ToastContext-BRX0SW3C.js";import{t as l}from"./sparkles-DRqKNlhr.js";import{Hn as u,Mn as d,N as f,at as p,ft as m,lt as h,ot as g}from"./index-CovRLYqQ.js";import{n as _,o as v,r as y,s as ee,t as b}from"./AdditionalSection-ZKpgGfxh.js";import{c as x,f as S,i as te,m as C,n as ne,o as w,r as T,s as re,t as E,u as D,v as O}from"./utils-dMg0ogiz.js";import{n as k}from"./spoolPaint-CrvpHqdD.js";var A=e(n(),1),j=t();function ie({formData:e,printersWithCalibrations:t,selectedProfiles:n,setSelectedProfiles:r,expandedPrinters:i,setExpandedPrinters:o}){let{t:c}=a(),u=e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},f=(e,t,n)=>{let i=`${e}:${t}:${n??`null`}`,a=`${e}:${n??`null`}`;r(e=>{let t=new Set(e);if(t.has(i))t.delete(i);else{for(let e of Array.from(t)){let n=e.split(`:`);`${n[0]}:${n[2]}`===a&&t.delete(e)}t.add(i)}return t})},p=()=>{let n=new Set;for(let{printer:r,calibrations:i}of t){if(!r.connected)continue;let t=i.filter(t=>w(t,e)),a=new Map;for(let e of t){let t=`${e.extruder_id??`null`}`;a.has(t)||a.set(t,[]),a.get(t).push(e)}for(let[e,t]of a)if(t.length>0){let i=[...t].sort((e,t)=>t.k_value-e.k_value)[0];n.add(`${r.id}:${i.cali_idx}:${e}`)}}r(n)};if(!e.material)return(0,j.jsx)(`div`,{className:`p-6 bg-bambu-dark rounded-lg text-center`,children:(0,j.jsx)(`p`,{className:`text-bambu-gray`,children:c(`inventory.selectMaterialFirst`)})});if(t.length===0)return(0,j.jsx)(`div`,{className:`p-6 bg-bambu-dark rounded-lg text-center`,children:(0,j.jsx)(`p`,{className:`text-bambu-gray`,children:c(`inventory.noPrintersConfigured`)})});let m=t.reduce((t,{printer:n,calibrations:r})=>n.connected?t+r.filter(t=>w(t,e)).length:t,0),h=(e,t)=>{let r=`${e.id}:${t.cali_idx}:${t.extruder_id??`null`}`,i=n.has(r);return(0,j.jsxs)(`label`,{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer transition-all border ${i?`bg-bambu-green/10 border-bambu-green/30`:`bg-bambu-dark border-transparent hover:bg-bambu-dark/80`}`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:i,onChange:()=>f(String(e.id),t.cali_idx,t.extruder_id),className:`w-4 h-4 rounded border-bambu-dark-tertiary text-bambu-green focus:ring-bambu-green`}),(0,j.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,j.jsx)(`span`,{className:`text-sm font-medium ${i?`text-bambu-green`:`text-white`}`,children:t.name||t.filament_id})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[t.nozzle_diameter&&(0,j.jsxs)(`span`,{className:`text-xs font-mono px-2 py-0.5 rounded bg-bambu-dark text-bambu-gray`,children:[t.nozzle_diameter,`mm`]}),(0,j.jsxs)(`span`,{className:`text-xs font-mono px-2 py-0.5 rounded bg-bambu-dark text-bambu-gray`,children:[`K=`,t.k_value.toFixed(3)]})]})]},`${t.cali_idx}-${t.extruder_id}`)};return(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[c(`inventory.matchingFilter`),`: `,e.brand||c(`inventory.anyBrand`),` / `,e.material,` / `,e.subtype||c(`inventory.anyVariant`)]}),m>0&&(0,j.jsxs)(`button`,{type:`button`,onClick:p,className:`flex items-center gap-1.5 px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white hover:border-bambu-green transition-colors`,children:[(0,j.jsx)(l,{className:`w-3.5 h-3.5`}),c(`inventory.autoSelect`),` (`,m,`)`]})]}),(0,j.jsx)(`div`,{className:`space-y-3`,children:t.map(({printer:t,calibrations:n})=>{let r=i.has(String(t.id)),a=n.filter(t=>w(t,e)),o=a.length,l=a.some(e=>e.extruder_id!==void 0&&e.extruder_id!==null&&e.extruder_id>0),f=a.filter(e=>e.extruder_id===1),p=a.filter(e=>e.extruder_id===0||e.extruder_id===void 0||e.extruder_id===null);return(0,j.jsxs)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:()=>u(String(t.id)),className:`w-full px-4 py-3 flex items-center justify-between bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary transition-colors`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[r?(0,j.jsx)(s,{className:`w-4 h-4 text-bambu-gray`}):(0,j.jsx)(d,{className:`w-4 h-4 text-bambu-gray`}),(0,j.jsx)(`span`,{className:`font-medium text-white`,children:t.name}),o>0?(0,j.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-bambu-green/20 text-bambu-green`,children:[o,` `,c(o===1?`inventory.match`:`inventory.matches`)]}):(0,j.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray`,children:c(`inventory.noMatches`)})]}),(0,j.jsx)(`span`,{className:`text-xs px-2 py-1 rounded-full ${t.connected?`bg-green-500/20 text-green-500`:`bg-bambu-gray/20 text-bambu-gray`}`,children:t.connected?c(`inventory.connected`):c(`inventory.offline`)})]}),r&&(0,j.jsx)(`div`,{className:`px-4 py-3 space-y-3 bg-bambu-dark border-t border-bambu-dark-tertiary`,children:t.connected?o===0?(0,j.jsx)(`p`,{className:`text-sm text-bambu-gray italic py-2`,children:c(`inventory.noKProfilesMatch`)}):l?(0,j.jsxs)(j.Fragment,{children:[f.length>0&&(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:c(`inventory.leftNozzle`)}),(0,j.jsx)(`div`,{className:`space-y-2`,children:f.map(e=>h(t,e))})]}),p.length>0&&(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:c(`inventory.rightNozzle`)}),(0,j.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>h(t,e))})]})]}):(0,j.jsx)(`div`,{className:`space-y-2`,children:a.map(e=>h(t,e))}):(0,j.jsx)(`p`,{className:`text-sm text-bambu-gray italic py-2`,children:c(`inventory.printerOffline`)})})]},t.id)})}),n.size>0&&(0,j.jsx)(`div`,{className:`p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg`,children:(0,j.jsxs)(`p`,{className:`text-sm text-white`,children:[(0,j.jsx)(`span`,{className:`font-semibold`,children:n.size}),` `,c(`inventory.profilesSelected`)]})})]})}function M(e){return m(e.color_name,e.rgba,e.color_name_is_synthesized)}var N=[`PLA`,`PETG`,`ABS`,`ASA`,`TPU`,`PA`,`PC`,`PVA`,`HIPS`];function P(){let{t:e}=a(),t=g(),{showToast:n}=c(),{sbState:s}=u(),[l,d]=(0,A.useState)(`existing`),[f,m]=(0,A.useState)(null),[h,_]=(0,A.useState)(``),[v,y]=(0,A.useState)(`idle`),[ee,b]=(0,A.useState)(``),[x,S]=(0,A.useState)(!1),[te,C]=(0,A.useState)(!1),[ne,w]=(0,A.useState)(null),{data:T}=o({queryKey:[`spoolman-settings`],queryFn:r.getSpoolmanSettings,staleTime:300*1e3}),re=T!==void 0,E=T?.spoolman_enabled===`true`&&!!T?.spoolman_url,{data:D=[],refetch:O}=o({queryKey:[E?`spoolman-inventory-spools`:`inventory-spools`,`write-tag`],queryFn:()=>E?r.getSpoolmanInventorySpools(!1):r.getSpools(!1),refetchInterval:1e4,enabled:re}),{data:k=[]}=o({queryKey:[`spoolbuddy-devices`],queryFn:()=>i.getDevices(),refetchInterval:5e3}),{data:ie}=o({queryKey:[`settings`],queryFn:r.getSettings}),N=k[0],P=s.deviceOnline,R=p(ie?.currency||`USD`),z=(0,A.useMemo)(()=>{let e;if(l===`existing`)e=D.filter(e=>!e.tag_uid&&!e.archived_at);else if(l===`replace`)e=D.filter(e=>(e.tag_uid||e.tray_uuid)&&!e.archived_at);else return[];if(h){let t=h.toLowerCase();e=e.filter(e=>e.material?.toLowerCase().includes(t)||M(e)?.toLowerCase().includes(t)||e.color_name?.toLowerCase().includes(t)||e.brand?.toLowerCase().includes(t)||e.subtype?.toLowerCase().includes(t))}return e},[D,l,h,t]),B=(0,A.useCallback)(e=>{let t=e.detail;(t.sak??t.data?.sak)===0&&(C(!0),w(t.tag_uid??t.data?.tag_uid??null))},[]),V=(0,A.useCallback)(e=>{let t=e.detail;C(!0),w(t.tag_uid??t.data?.tag_uid??null)},[]),H=(0,A.useCallback)(()=>{C(!1),w(null)},[]),U=(0,A.useCallback)(t=>{let n=t.detail;(n.spool_id===f?.id||n.data?.spool_id===f?.id)&&(y(`success`),b(e(`spoolbuddy.writeTag.writeSuccess`,`Tag written successfully!`)),O(),setTimeout(()=>{y(`idle`),m(null),b(``)},5e3))},[f,e,O]),W=(0,A.useCallback)(t=>{let n=t.detail;(n.spool_id===f?.id||n.data?.spool_id===f?.id)&&(y(`error`),b(n.message??n.data?.message??e(`spoolbuddy.writeTag.writeFailed`,`Write failed`)))},[f,e]);(0,A.useEffect)(()=>(window.addEventListener(`spoolbuddy-unknown-tag`,B),window.addEventListener(`spoolbuddy-tag-matched`,V),window.addEventListener(`spoolbuddy-tag-removed`,H),window.addEventListener(`spoolbuddy-tag-written`,U),window.addEventListener(`spoolbuddy-tag-write-failed`,W),()=>{window.removeEventListener(`spoolbuddy-unknown-tag`,B),window.removeEventListener(`spoolbuddy-tag-matched`,V),window.removeEventListener(`spoolbuddy-tag-removed`,H),window.removeEventListener(`spoolbuddy-tag-written`,U),window.removeEventListener(`spoolbuddy-tag-write-failed`,W)}),[B,V,H,U,W]),(0,A.useEffect)(()=>{m(null),y(`idle`),b(``),_(``)},[l]);let G=async()=>{if(!(!f||!N)){y(`writing`),b(e(`spoolbuddy.writeTag.waiting`,`Waiting for SpoolBuddy...`));try{let e=await i.writeTag(N.device_id,f.id);if(e?.warnings?.length)for(let t of e.warnings)n(t,`warning`)}catch{y(`error`),b(e(`spoolbuddy.writeTag.queueFailed`,`Failed to queue write command`))}}},oe=async()=>{if(N){try{await i.cancelWrite(N.device_id)}catch{}y(`idle`),b(``)}},K=async()=>{if(!(!f||!F(f))){S(!0),y(`idle`),b(``);try{E?await r.linkTagToSpoolmanSpool(f.id,{tag_uid:``,tray_uuid:``}):await r.linkTagToSpool(f.id,{tag_uid:``,tray_uuid:``,data_origin:`manual`}),await O(),m(null),y(`success`),b(e(`spoolbuddy.writeTag.untagSuccess`,`Tag removed from spool`)),setTimeout(()=>{y(`idle`),b(``)},2500)}catch{y(`error`),b(e(`spoolbuddy.writeTag.untagFailed`,`Failed to remove tag from spool`))}finally{S(!1)}}},q=(0,A.useCallback)(e=>{m(e),y(`idle`),b(``),O()},[O]),se=f&&P&&v!==`writing`&&v!==`success`;return(0,j.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,j.jsx)(`div`,{className:`flex border-b border-bambu-dark-tertiary shrink-0`,children:[{key:`existing`,label:e(`spoolbuddy.writeTag.tabExisting`,`Existing Spool`)},{key:`new`,label:e(`spoolbuddy.writeTag.tabNew`,`New Spool`)},{key:`replace`,label:e(`spoolbuddy.writeTag.tabReplace`,`Replace Tag`)}].map(e=>(0,j.jsx)(`button`,{onClick:()=>d(e.key),className:`flex-1 py-3 text-sm font-medium transition-colors ${l===e.key?`text-bambu-green border-b-2 border-bambu-green bg-bambu-dark`:`text-zinc-400 hover:text-zinc-200 hover:bg-bambu-dark-tertiary`}`,children:e.label},e.key))}),(0,j.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,j.jsx)(`div`,{className:`flex-1 flex flex-col overflow-hidden border-r border-bambu-dark-tertiary`,children:l===`new`?(0,j.jsx)(L,{currencySymbol:R,onCreated:q,selectedSpool:f,spoolmanMode:E,t:e}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`p-3 shrink-0`,children:(0,j.jsx)(`input`,{type:`text`,value:h,onChange:e=>_(e.target.value),placeholder:e(`spoolbuddy.writeTag.searchPlaceholder`,`Search by material, color, brand...`),className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-bambu-green`})}),(0,j.jsx)(`div`,{className:`flex-1 overflow-y-auto px-3 pb-3 space-y-2`,children:z.length===0?(0,j.jsx)(`div`,{className:`text-center text-zinc-500 py-8 text-sm`,children:l===`existing`?e(`spoolbuddy.writeTag.noUntaggedSpools`,`No spools without tags`):e(`spoolbuddy.writeTag.noTaggedSpools`,`No spools with tags`)}):z.map(e=>(0,j.jsx)(I,{spool:e,selected:f?.id===e.id,showTag:l===`replace`,onClick:()=>{m(e),y(`idle`),b(``)}},e.id))})]})}),(0,j.jsx)(`div`,{className:`w-[340px] flex flex-col items-center justify-center p-6 shrink-0`,children:(0,j.jsx)(ae,{writeStatus:v,writeMessage:ee,selectedSpool:f,tagOnReader:te,tagUid:ne,deviceOnline:P,canWrite:!!se,isReplace:l===`replace`,canUntag:l===`replace`&&!!f&&F(f),untagging:x,onWrite:G,onUntag:K,onCancel:oe,onRetry:()=>{y(`idle`),b(``)},t:e})})]})]})}function F(e){return!!(e.tag_uid||e.tray_uuid)}function I({spool:e,selected:t,showTag:n,onClick:r}){let i=Math.max(0,e.label_weight-e.weight_used),a=e.label_weight>0?Math.round(i/e.label_weight*100):0;return(0,j.jsxs)(`button`,{onClick:r,className:`w-full flex items-center gap-3 p-3 rounded-lg text-left transition-colors ${t?`bg-bambu-green/15 border border-bambu-green/50`:`bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-transparent`}`,children:[(0,j.jsx)(`div`,{className:`w-8 h-8 rounded-full shrink-0 border border-white/10`,style:k(e)??(e.rgba?h(e.rgba):{backgroundColor:`#666`})}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-sm font-medium text-white truncate`,children:[e.brand?`${e.brand} `:``,e.material,e.subtype?` ${e.subtype}`:``]}),(0,j.jsxs)(`span`,{className:`text-[10px] font-mono text-zinc-500 shrink-0`,children:[`#`,e.id]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-zinc-400`,children:[M(e)&&(0,j.jsx)(`span`,{children:M(e)}),(0,j.jsxs)(`span`,{children:[i,`g / `,e.label_weight,`g (`,a,`%)`]})]}),n&&e.tag_uid&&(0,j.jsx)(`div`,{className:`text-xs text-zinc-500 mt-0.5 font-mono`,children:e.tag_uid})]}),t&&(0,j.jsx)(`svg`,{className:`w-5 h-5 text-bambu-green shrink-0`,fill:`currentColor`,viewBox:`0 0 20 20`,children:(0,j.jsx)(`path`,{fillRule:`evenodd`,d:`M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z`,clipRule:`evenodd`})})]})}function L({currencySymbol:e,onCreated:t,selectedSpool:n,spoolmanMode:i,t:a}){let{data:s=[]}=o({queryKey:[i?`spoolman-inventory-spools`:`inventory-spools`,`write-tag-form`],queryFn:()=>i?r.getSpoolmanInventorySpools(!0):r.getSpools(!0)}),{data:c}=o({queryKey:[`settings`],queryFn:r.getSettings}),[l,u]=(0,A.useState)(`simple`),[d,p]=(0,A.useState)(`filament`),[m,g]=(0,A.useState)(v),[w,P]=(0,A.useState)(!1),[F,I]=(0,A.useState)({}),[L,ae]=(0,A.useState)(!1),[R,z]=(0,A.useState)(1),[B,V]=(0,A.useState)(!1),[H,U]=(0,A.useState)(null),[W,G]=(0,A.useState)(!1),[oe,K]=(0,A.useState)(!1),[q,se]=(0,A.useState)([]),[J,ce]=(0,A.useState)([]),[le,ue]=(0,A.useState)([]),[de,fe]=(0,A.useState)([]),[Y,pe]=(0,A.useState)([]),[me,he]=(0,A.useState)(``),[ge,_e]=(0,A.useState)([]),[X,ve]=(0,A.useState)([]),[Z,ye]=(0,A.useState)(new Set),[be,xe]=(0,A.useState)(new Set);(0,A.useEffect)(()=>{_e(re())},[]),(0,A.useEffect)(()=>{let e=!1;return(async()=>{if(l===`full`){K(!0);try{let[t,n]=await Promise.allSettled([(async()=>(await r.getCloudStatus()).is_authenticated?{connected:!0,presets:await r.getFilamentPresets()}:{connected:!1,presets:[]})(),(async()=>(await r.orcaCloudStatus()).connected?{connected:!0,presets:(await r.orcaCloudListProfiles()).filament}:{connected:!1,presets:[]})()]);if(e)return;let i=t.status===`fulfilled`&&t.value.connected,a=n.status===`fulfilled`&&n.value.connected,o=t.status===`fulfilled`?t.value.presets:[],s=n.status===`fulfilled`?n.value.presets:[];G(i||a),se([...o,...s])}catch{e||G(!1)}finally{e||K(!1)}r.getSpoolCatalog().then(t=>{e||fe(t)}).catch(()=>void 0),r.getColorCatalog().then(t=>{e||pe(t)}).catch(()=>void 0),r.getLocalPresets().then(t=>{e||ce(t.filament)}).catch(()=>void 0),r.getBuiltinFilaments().then(t=>{e||ue(t)}).catch(()=>void 0);try{let t=await r.getPrinters(),n=await Promise.all(t.map(e=>r.getPrinterStatus(e.id).catch(()=>null))),i=[];for(let e=0;e{e=!0}},[l]),(0,A.useEffect)(()=>{X.length>0&&xe(new Set(X.map(e=>String(e.printer.id))))},[X]);let Se=(0,A.useMemo)(()=>E(q,new Set,J,le),[q,J,le]),Ce=(0,A.useMemo)(()=>te(m.slicer_filament,Se),[m.slicer_filament,Se]),we=(0,A.useMemo)(()=>{let e=ne(q,J),t=Y.map(e=>e.manufacturer?.trim()).filter(e=>!!e);return Array.from(new Set([...e,...t])).sort((e,t)=>e.localeCompare(t))},[q,J,Y]),Te=(0,A.useMemo)(()=>{let e=Y.map(e=>e.material?.trim()).filter(e=>!!e);return Array.from(new Set([...O,...e])).sort((e,t)=>e.localeCompare(t))},[Y]),Q=(0,A.useMemo)(()=>{let e=[];for(let t of Y){let n=t.manufacturer?.trim(),r=t.material?.trim();n&&r&&e.push({brand:n,material:r})}for(let t of q){let n=D(t.name);n.brand&&n.material&&e.push({brand:n.brand,material:n.material})}for(let t of J){let n=D(t.name),r=t.filament_vendor?.trim()||n.brand,i=n.material;r&&i&&e.push({brand:r,material:i})}return e},[q,Y,J]),Ee=(0,A.useMemo)(()=>{let e=new Map;for(let t of Q){let n=t.brand.toLowerCase(),r=t.material.toLowerCase();e.has(n)||e.set(n,new Set),e.get(n).add(r)}return e},[Q]),De=(0,A.useMemo)(()=>{let e=new Map;for(let t of Q){let n=t.brand.toLowerCase(),r=t.material.toLowerCase();e.has(r)||e.set(r,new Set),e.get(r).add(n)}return e},[Q]),Oe=(0,A.useMemo)(()=>C(we,m.brand),[we,m.brand]),ke=(0,A.useMemo)(()=>C(Te,m.material),[Te,m.material]),Ae=(0,A.useMemo)(()=>x(Oe,m.material,De),[Oe,m.material,De]),je=(0,A.useMemo)(()=>x(ke,m.brand,Ee),[ke,m.brand,Ee]),$=(e,t)=>{g(n=>({...n,[e]:t})),e===`core_weight`&&P(!0),F[e]&&I(t=>({...t,[e]:void 0}))},Me=e=>{_e(t=>S(e,t))},Ne=async e=>{let t=i?r.saveSpoolmanKProfiles:r.saveSpoolKProfiles;if(Z.size===0){try{await t(e,[])}catch{}return}let n=[];for(let e of Z){let[t,r,i]=e.split(`:`),a=parseInt(t),o=parseInt(r),s=i===`null`?0:parseInt(i),c=X.find(e=>e.printer.id===a);if(c){let e=c.calibrations.find(e=>e.cali_idx===o&&(e.extruder_id??0)===s);e&&n.push({printer_id:a,extruder:s,nozzle_diameter:e.nozzle_diameter||`0.4`,k_value:e.k_value,name:e.name||null,cali_idx:e.cali_idx,setting_id:e.setting_id||null})}}n.length>0&&await t(e,n)},Pe=async()=>{U(null);let e=ee(m,l===`simple`?!0:L);if(!e.isValid){I(e.errors),p(`filament`);return}let n=Ce?.displayName||me||null,o={material:m.material,subtype:m.subtype||null,brand:m.brand||null,color_name:m.color_name||null,rgba:m.rgba||null,extra_colors:m.extra_colors||null,effect_type:m.effect_type||null,label_weight:m.label_weight,...i?w?{core_weight:m.core_weight}:{}:{core_weight:m.core_weight,core_weight_catalog_id:m.core_weight_catalog_id},weight_used:m.weight_used,slicer_filament:m.slicer_filament||null,slicer_filament_name:n,nozzle_temp_min:null,nozzle_temp_max:null,note:m.note||null,cost_per_kg:m.cost_per_kg,added_full:null,last_used:null,encode_time:null,tag_uid:null,tray_uuid:null,data_origin:null,tag_type:null,last_scale_weight:null,last_weighed_at:null,category:m.category.trim()||null,low_stock_threshold_pct:m.low_stock_threshold_pct,material_number:m.material_number.trim()||null};V(!0);try{if(R>1){let e=i?await r.bulkCreateSpoolmanInventorySpools(o,R):await r.bulkCreateSpools(o,R),n=i&&e&&typeof e==`object`&&`created`in e?e.created:e;for(let e of n)await Ne(e.id);n.length>0&&t(n[0])}else{let e=i?await r.createSpoolmanInventorySpool(o):await r.createSpool(o);await Ne(e.id),t(e)}}catch{U(a(`spoolbuddy.writeTag.createFailed`,`Failed to create spool`))}finally{V(!1)}},Fe=`#${(m.rgba||`808080FF`).slice(0,6)}`;return(0,j.jsxs)(`div`,{className:`p-3 space-y-3 overflow-y-auto h-full`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-2 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary`,children:[(0,j.jsx)(`span`,{className:`text-sm text-zinc-200`,children:a(`spoolbuddy.writeTag.viewMode`,`View`)}),(0,j.jsxs)(`div`,{className:`flex rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:()=>u(`simple`),className:`px-3 py-1.5 text-xs font-medium ${l===`simple`?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark text-zinc-400`}`,children:a(`spoolbuddy.writeTag.simpleView`,`Simple`)}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>u(`full`),className:`px-3 py-1.5 text-xs font-medium ${l===`full`?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark text-zinc-400`}`,children:a(`spoolbuddy.writeTag.fullView`,`Full`)})]})]}),l===`simple`?n?(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-6 text-center bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:[(0,j.jsx)(`div`,{className:`w-12 h-12 rounded-full mb-4 border border-white/10`,style:k(n,`preview`)??(n.rgba?h(n.rgba):{backgroundColor:`#666`})}),(0,j.jsxs)(`p`,{className:`text-white font-medium`,children:[n.brand?`${n.brand} `:``,n.material]}),M(n)&&(0,j.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:M(n)}),(0,j.jsxs)(`p`,{className:`text-zinc-500 text-xs mt-1`,children:[n.label_weight,`g`]}),(0,j.jsx)(`p`,{className:`text-bambu-green text-sm mt-4`,children:a(`spoolbuddy.writeTag.spoolCreated`,`Spool created! Ready to write.`)})]}):(0,j.jsxs)(`div`,{className:`p-4 space-y-4 overflow-y-auto bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:a(`spoolbuddy.writeTag.material`,`Material`)}),(0,j.jsx)(`select`,{value:m.material,onChange:e=>$(`material`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,children:N.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))})]}),(0,j.jsxs)(`div`,{className:`flex gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex-1`,children:[(0,j.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:a(`spoolbuddy.writeTag.colorName`,`Color Name`)}),(0,j.jsx)(`input`,{type:`text`,value:m.color_name,onChange:e=>$(`color_name`,e.target.value),placeholder:`Jade White`,className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-bambu-green`})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:a(`spoolbuddy.writeTag.color`,`Color`)}),(0,j.jsx)(`input`,{type:`color`,value:Fe,onChange:e=>$(`rgba`,e.target.value.replace(`#`,``).toUpperCase()+`FF`),className:`w-10 h-9 bg-transparent border border-bambu-dark-tertiary rounded cursor-pointer`})]})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:a(`spoolbuddy.writeTag.brand`,`Brand`)}),(0,j.jsx)(`input`,{type:`text`,value:m.brand,onChange:e=>$(`brand`,e.target.value),placeholder:`Polymaker`,className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-bambu-green`})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:a(`spoolbuddy.writeTag.weight`,`Weight (g)`)}),(0,j.jsx)(f,{value:m.label_weight,onChange:e=>$(`label_weight`,e),fallback:0,min:0,max:1e4,className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`})]}),(0,j.jsx)(`button`,{onClick:Pe,disabled:B||!m.material,className:`w-full py-2.5 bg-bambu-green hover:bg-bambu-green/80 disabled:opacity-50 disabled:cursor-not-allowed text-white text-sm font-medium rounded transition-colors`,children:B?a(`spoolbuddy.writeTag.creating`,`Creating...`):a(`spoolbuddy.writeTag.createSpool`,`Create Spool`)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-2 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary`,children:[(0,j.jsx)(`span`,{className:`text-sm text-zinc-200`,children:a(`inventory.quickAdd`,`Quick Add`)}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>ae(e=>!e),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${L?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,children:(0,j.jsx)(`span`,{className:`inline-block h-4.5 w-4.5 rounded-full bg-white transition-transform ${L?`translate-x-6`:`translate-x-1`}`})})]}),(0,j.jsxs)(`div`,{className:`flex border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,j.jsx)(`button`,{onClick:()=>p(`filament`),className:`flex-1 py-2.5 text-sm font-medium ${d===`filament`?`bg-bambu-green/15 text-bambu-green`:`bg-bambu-dark-secondary text-zinc-400`}`,children:a(`inventory.filamentInfoTab`,`Filament`)}),!L&&(0,j.jsx)(`button`,{onClick:()=>p(`pa-profile`),className:`flex-1 py-2.5 text-sm font-medium ${d===`pa-profile`?`bg-bambu-green/15 text-bambu-green`:`bg-bambu-dark-secondary text-zinc-400`}`,children:a(`inventory.paProfileTab`,`PA Profile`)})]}),(0,j.jsx)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg p-3`,children:d===`filament`?(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(y,{formData:m,updateField:$,cloudAuthenticated:W,loadingCloudPresets:oe,presetInputValue:me,setPresetInputValue:he,selectedPresetOption:Ce,filamentOptions:Se,availableBrands:Oe,availableMaterials:ke,suggestedBrands:Ae,suggestedMaterials:je,quickAdd:L,detailsRequired:!L,quantity:R,onQuantityChange:z,errors:F}),(0,j.jsx)(_,{formData:m,updateField:$,recentColors:ge,onColorUsed:Me,catalogColors:Y}),(0,j.jsx)(b,{formData:m,updateField:$,spoolCatalog:de,currencySymbol:e,availableCategories:Array.from(new Set(s.map(e=>e.category?.trim()).filter(e=>!!e))).sort((e,t)=>e.localeCompare(t)),availableMaterialNumbers:Array.from(new Set(s.map(e=>e.material_number?.trim()).filter(e=>!!e))).sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0})),globalLowStockThreshold:c?.low_stock_threshold??20,spoolmanMode:i})]}):(0,j.jsx)(ie,{formData:m,updateField:$,printersWithCalibrations:X,selectedProfiles:Z,setSelectedProfiles:ye,expandedPrinters:be,setExpandedPrinters:xe})})]}),H&&(0,j.jsx)(`div`,{className:`text-sm text-red-400 bg-red-900/20 border border-red-900/40 rounded-lg px-3 py-2`,children:H}),l===`full`&&(0,j.jsx)(`button`,{onClick:Pe,disabled:B,className:`w-full py-3 bg-bambu-green hover:bg-bambu-green/80 disabled:opacity-50 disabled:cursor-not-allowed text-white text-sm font-medium rounded transition-colors`,children:B?a(`spoolbuddy.writeTag.creating`,`Creating...`):a(`spoolbuddy.writeTag.createSpool`,`Create Spool`)}),l===`full`&&n&&(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-4 text-center bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:[(0,j.jsx)(`div`,{className:`w-12 h-12 rounded-full mb-4 border border-white/10`,style:k(n,`preview`)??(n.rgba?h(n.rgba):{backgroundColor:`#666`})}),(0,j.jsxs)(`p`,{className:`text-white font-medium`,children:[n.brand?`${n.brand} `:``,n.material]}),M(n)&&(0,j.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:M(n)}),(0,j.jsxs)(`p`,{className:`text-zinc-500 text-xs mt-1`,children:[n.label_weight,`g`]}),(0,j.jsx)(`p`,{className:`text-bambu-green text-sm mt-4`,children:a(`spoolbuddy.writeTag.spoolCreated`,`Spool created! Ready to write.`)})]})]})}function ae({writeStatus:e,writeMessage:t,selectedSpool:n,tagOnReader:r,tagUid:i,deviceOnline:a,canWrite:o,isReplace:s,canUntag:c,untagging:l,onWrite:u,onUntag:d,onCancel:f,onRetry:p,t:m}){if(e===`success`)return(0,j.jsxs)(`div`,{className:`flex flex-col items-center text-center space-y-4`,children:[(0,j.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-green-500/20 flex items-center justify-center`,children:(0,j.jsx)(`svg`,{className:`w-8 h-8 text-green-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})})}),(0,j.jsx)(`p`,{className:`text-green-400 font-medium`,children:t}),n&&(0,j.jsxs)(`p`,{className:`text-zinc-400 text-sm`,children:[n.brand?`${n.brand} `:``,n.material,n.subtype?` ${n.subtype}`:``,M(n)?` - ${M(n)}`:``]})]});if(e===`error`)return(0,j.jsxs)(`div`,{className:`flex flex-col items-center text-center space-y-4`,children:[(0,j.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-red-500/20 flex items-center justify-center`,children:(0,j.jsx)(`svg`,{className:`w-8 h-8 text-red-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})}),(0,j.jsx)(`p`,{className:`text-red-400 font-medium`,children:t}),(0,j.jsx)(`button`,{onClick:p,className:`px-4 py-2 bg-bambu-dark-tertiary hover:bg-bambu-dark-secondary text-white text-sm rounded transition-colors`,children:m(`spoolbuddy.writeTag.tryAgain`,`Try Again`)})]});if(e===`writing`)return(0,j.jsxs)(`div`,{className:`flex flex-col items-center text-center space-y-4`,children:[(0,j.jsxs)(`div`,{className:`relative w-16 h-16`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-bambu-green/30 animate-ping`}),(0,j.jsx)(`div`,{className:`absolute inset-2 rounded-full border-2 border-bambu-green/50 animate-pulse`}),(0,j.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,j.jsx)(R,{className:`w-8 h-8 text-bambu-green`})})]}),(0,j.jsx)(`p`,{className:`text-bambu-green font-medium`,children:m(`spoolbuddy.writeTag.writing`,`Writing tag...`)}),(0,j.jsx)(`p`,{className:`text-zinc-500 text-xs`,children:t}),(0,j.jsx)(`button`,{onClick:f,className:`px-4 py-2 bg-bambu-dark-tertiary hover:bg-bambu-dark-secondary text-zinc-400 text-sm rounded transition-colors`,children:m(`spoolbuddy.writeTag.cancel`,`Cancel`)})]});if(!a)return(0,j.jsxs)(`div`,{className:`flex flex-col items-center text-center space-y-3`,children:[(0,j.jsx)(R,{className:`w-12 h-12 text-zinc-600`}),(0,j.jsx)(`p`,{className:`text-zinc-500 text-sm`,children:m(`spoolbuddy.writeTag.deviceOffline`,`SpoolBuddy is offline`)})]});if(!n)return(0,j.jsxs)(`div`,{className:`flex flex-col items-center text-center space-y-3`,children:[(0,j.jsx)(R,{className:`w-12 h-12 text-zinc-600`}),(0,j.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:m(`spoolbuddy.writeTag.selectSpool`,`Select a spool, then place a blank NTAG on the reader`)})]});let g=k(n,`preview`)??(n.rgba?h(n.rgba):{backgroundColor:`#666`});return(0,j.jsxs)(`div`,{className:`flex flex-col items-center text-center space-y-4 w-full`,children:[(0,j.jsx)(`div`,{className:`relative w-16 h-16`,children:r?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`absolute inset-0 rounded-full bg-bambu-green/10`}),(0,j.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,j.jsx)(R,{className:`w-8 h-8 text-bambu-green`})})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-zinc-600 animate-pulse`}),(0,j.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,j.jsx)(R,{className:`w-8 h-8 text-zinc-500`})})]})}),r?(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsx)(`p`,{className:`text-bambu-green text-sm font-medium`,children:m(`spoolbuddy.writeTag.tagReady`,`Tag detected — ready to write`)}),i&&(0,j.jsx)(`p`,{className:`text-zinc-500 text-xs font-mono`,children:i})]}):(0,j.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:m(`spoolbuddy.writeTag.placeTag`,`Place an NTAG on the reader`)}),(0,j.jsxs)(`div`,{className:`w-full bg-bambu-dark-secondary rounded-lg p-3 space-y-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`w-8 h-8 rounded-full border border-white/10 shrink-0`,style:g}),(0,j.jsxs)(`div`,{className:`text-left min-w-0`,children:[(0,j.jsxs)(`p`,{className:`text-white text-sm font-medium truncate`,children:[n.brand?`${n.brand} `:``,n.material]}),M(n)&&(0,j.jsx)(`p`,{className:`text-zinc-400 text-xs`,children:M(n)})]})]}),(0,j.jsxs)(`div`,{className:`text-xs text-zinc-500`,children:[n.label_weight,`g`]})]}),s&&n.tag_uid&&(0,j.jsx)(`p`,{className:`text-yellow-500/80 text-xs`,children:m(`spoolbuddy.writeTag.replaceWarning`,`Old tag will be unlinked. New tag will replace it.`)}),(0,j.jsx)(`button`,{onClick:u,disabled:!o,className:`w-full py-3 bg-bambu-green hover:bg-bambu-green/80 disabled:opacity-40 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors text-sm`,children:s?m(`spoolbuddy.writeTag.replaceTag`,`Replace Tag`):m(`spoolbuddy.writeTag.writeTag`,`Write Tag`)}),s&&c&&(0,j.jsx)(`button`,{onClick:d,disabled:l,className:`w-full py-2.5 bg-bambu-dark-tertiary hover:bg-bambu-dark-secondary disabled:opacity-40 disabled:cursor-not-allowed text-zinc-200 rounded-lg transition-colors text-sm`,children:l?m(`spoolbuddy.writeTag.untagging`,`Removing tag...`):m(`spoolbuddy.writeTag.untagSpool`,`Untag Selected Spool`)})]})}function R({className:e}){return(0,j.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,children:[(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8.288 15.038a5.25 5.25 0 017.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0`}),(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12.53 18.22l-.53.53-.53-.53a.75.75 0 011.06 0z`})]})}export{P as SpoolBuddyWriteTagPage}; \ No newline at end of file diff --git a/static/assets/SpoolIcon-DE8TbEec.js b/static/assets/SpoolIcon-DE8TbEec.js new file mode 100644 index 000000000..d11072a6b --- /dev/null +++ b/static/assets/SpoolIcon-DE8TbEec.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n}from"./client-DnySrlFv.js";import{n as r}from"./filamentSwatchHelpers-D3oXQSGk.js";import{t as i}from"./spoolPaint-CrvpHqdD.js";var a=e(n(),1),o=t();function s({spool:e,inset:t,size:n,border:i}){let s=n>=80?`card`:`preview`,c=(0,a.useMemo)(()=>r({effectSize:s,rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,subtype:e.subtype}),[s,e.rgba,e.extra_colors,e.effect_type,e.subtype]),l=`${t*100}%`;return(0,o.jsx)(`div`,{"data-testid":`spool-paint`,className:`absolute rounded-full box-border`,style:{top:l,left:l,right:l,bottom:l,...c,backgroundPosition:`center`,border:i}})}function c({inset:e}){let t=`${e*100}%`;return(0,o.jsx)(`div`,{"data-testid":`spool-shade`,className:`absolute rounded-full`,style:{top:t,left:t,right:t,bottom:t,backgroundColor:`rgba(0, 0, 0, 0.15)`}})}function l({color:e,isEmpty:t,size:n=32,spool:r}){return t?(0,o.jsx)(`div`,{className:`rounded-full border-2 border-dashed border-zinc-500 flex items-center justify-center`,style:{width:n,height:n},children:(0,o.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-zinc-600`})}):i(r)?(0,o.jsxs)(`div`,{className:`relative shrink-0`,style:{width:n,height:n},children:[(0,o.jsx)(s,{spool:r,size:n,inset:2/32,border:`${1.5*n/32}px solid rgba(255, 255, 255, 0.7)`}),(0,o.jsx)(c,{inset:5/32})]}):(0,o.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 32 32`,children:[(0,o.jsx)(`circle`,{cx:`16`,cy:`16`,r:`14`,fill:e,stroke:`white`,strokeWidth:`1.5`,strokeOpacity:`0.7`}),(0,o.jsx)(`circle`,{cx:`16`,cy:`16`,r:`11`,fill:e,style:{filter:`brightness(0.85)`}})]})}export{s as n,c as r,l as t}; \ No newline at end of file diff --git a/static/assets/SpreadsheetPreviewModal-CqoREJBx.js b/static/assets/SpreadsheetPreviewModal-CqoREJBx.js new file mode 100644 index 000000000..e3a41f570 --- /dev/null +++ b/static/assets/SpreadsheetPreviewModal-CqoREJBx.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/papaparse.min-CR43Mv99.js","assets/chunk-aKtaBQYM.js"])))=>i.map(i=>d[i]); +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,l as i,w as a}from"./client-DnySrlFv.js";import{t as o}from"./file-spreadsheet-WxOA9vYy.js";import{t as s}from"./loader-circle-BEmFtawu.js";import{t as c}from"./file-DDkFXH-b.js";import{Kn as l}from"./index-CovRLYqQ.js";import{n as u,t as d}from"./usePreviewFullscreen-ButueZqN.js";var f=e(n(),1),p=t(),m=500,h=40;function g(e){let t=``,n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}function _(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(!n)return Promise.resolve(null);let r=256/5,i=256/9;n.fillStyle=`#1a1a1a`,n.fillRect(0,0,256,256),n.fillStyle=`rgba(0, 174, 66, 0.25)`,n.fillRect(0,0,256,i),n.strokeStyle=`#333333`,n.lineWidth=1;for(let e=1;e<5;e++)n.beginPath(),n.moveTo(e*r+.5,0),n.lineTo(e*r+.5,256),n.stroke();for(let e=1;e<9;e++)n.beginPath(),n.moveTo(0,e*i+.5),n.lineTo(256,e*i+.5),n.stroke();n.fillStyle=`#d4d4d4`,n.font=`11px sans-serif`,n.textBaseline=`middle`;for(let t=0;t<9;t++)for(let a=0;a<5;a++){let o=e[t]?.[a];o&&n.fillText(String(o),a*r+4,t*i+i/2,r-8)}return new Promise(e=>t.toBlob(e,`image/png`))}function v({libraryFileId:t,filename:n,fileType:v,fileSize:y,onClose:b,onSnapshot:x}){let{t:S}=a(),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(0),[D,O]=(0,f.useState)(null),k=(0,f.useRef)(!1),A=(0,f.useRef)(x);(0,f.useEffect)(()=>{A.current=x});let j=d(),{isFullscreen:M,toggleFullscreen:N}=j;(0,f.useEffect)(()=>{let a=!1;if(w(null),O(null),E(0),y>20971520){O(S(`fileManager.preview.tooLarge`,{size:c(y)}));return}let o={},s=i();return s&&(o.Authorization=`Bearer ${s}`),(async()=>{let i=await fetch(r.getLibraryFileDownloadUrl(t),{headers:o});if(!i.ok)throw Error(`HTTP ${i.status}`);let s=await i.arrayBuffer(),c;if(v===`csv`){let t=(await l(async()=>{let{default:t}=await import(`./papaparse.min-CR43Mv99.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new TextDecoder().decode(s),i=[],a=0,o=0,u=[],d=e=>{a+=1,o=Math.max(o,e.length),i.lengthe??``))};t.parse(r,{skipEmptyLines:!1,step:({data:e})=>{if(Array.isArray(e)){if(e.every(e=>!e)){u.push(e);return}u.forEach(d),u=[],d(e)}}}),c=[{name:n,rows:i,totalRows:a,totalCols:o}]}else{let e=await l(()=>import(`./xlsx-CKkngM-o.js`),[]),t=e.read(s,{dense:!0});c=t.SheetNames.map(n=>{let r=t.Sheets[n],i=r?.[`!ref`];if(!r||!i)return{name:n,rows:[],totalRows:0,totalCols:0};let a=e.utils.decode_range(i),o=a.e.r-a.s.r+1,s=a.e.c-a.s.c+1,c={s:a.s,e:{r:Math.min(a.e.r,a.s.r+m-1),c:Math.min(a.e.c,a.s.c+h-1)}};return{name:n,rows:e.utils.sheet_to_json(r,{header:1,raw:!1,defval:``,range:e.utils.encode_range(c)}),totalRows:o,totalCols:s}})}if(!a&&(w(c),A.current&&!k.current)){let e=c.find(e=>e.rows.length>0);if(e){k.current=!0;let t=await _(e.rows);t&&!a&&A.current?.(t)}}})().catch(e=>{console.error(`[sheet-preview] load failed`,e),a||O(S(`fileManager.preview.error`))}),()=>{a=!0}},[t,v,y,n,S]);let P=C?.[T]??null,F=P!=null&&P.totalRows>P.rows.length,I=P!=null&&P.totalCols>h,L=P==null?0:Math.min(P.totalCols,h);return(0,p.jsxs)(u,{title:n,fullscreen:j,onClose:b,icon:(0,p.jsx)(o,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),children:[C&&C.length>1&&(0,p.jsx)(`div`,{className:`flex gap-1 px-4 pt-2 overflow-x-auto flex-shrink-0`,children:C.map((e,t)=>(0,p.jsx)(`button`,{onClick:()=>E(t),className:`px-3 py-1.5 text-sm rounded-t whitespace-nowrap transition-colors ${t===T?`bg-bambu-dark text-white border border-b-0 border-bambu-dark-tertiary`:`text-bambu-gray hover:text-white hover:bg-bambu-dark/50`}`,children:e.name},`${e.name}-${t}`))}),(0,p.jsx)(`div`,{"data-testid":`spreadsheet-preview-content`,className:`flex-1 min-h-0 overflow-auto bg-bambu-dark ${M?``:`rounded-b-lg`}`,onDoubleClick:N,children:D?(0,p.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,p.jsx)(`p`,{className:`text-bambu-gray text-center`,children:D})}):C?!P||P.rows.length===0?(0,p.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,p.jsx)(`p`,{className:`text-bambu-gray`,children:S(`fileManager.preview.emptySheet`)})}):(0,p.jsxs)(`table`,{className:`border-collapse text-xs min-w-full`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`sticky top-0 bg-bambu-dark-secondary border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray font-medium w-10`}),Array.from({length:L},(e,t)=>(0,p.jsx)(`th`,{className:`sticky top-0 bg-bambu-dark-secondary border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray font-medium text-left min-w-[80px]`,children:g(t)},t))]})}),(0,p.jsx)(`tbody`,{children:P.rows.map((e,t)=>(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`td`,{className:`border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray text-right bg-bambu-dark-secondary/50`,children:t+1}),Array.from({length:L},(t,n)=>(0,p.jsx)(`td`,{className:`border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray-light whitespace-nowrap max-w-[280px] overflow-hidden text-ellipsis`,title:e[n]||void 0,children:e[n]??``},n))]},t))})]}):(0,p.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,p.jsx)(s,{className:`w-8 h-8 text-bambu-green animate-spin`})})}),(F||I)&&P&&(0,p.jsxs)(`div`,{className:`px-4 py-2 border-t border-bambu-dark-tertiary text-xs text-bambu-gray flex gap-4 flex-shrink-0`,children:[F&&(0,p.jsx)(`span`,{children:S(`fileManager.preview.truncatedRows`,{shown:P.rows.length,total:P.totalRows})}),I&&(0,p.jsx)(`span`,{children:S(`fileManager.preview.truncatedCols`,{shown:L,total:P.totalCols})})]})]})}export{v as SpreadsheetPreviewModal}; \ No newline at end of file diff --git a/static/assets/StatsPage-CuJD7mWH.js b/static/assets/StatsPage-CuJD7mWH.js new file mode 100644 index 000000000..b659f263e --- /dev/null +++ b/static/assets/StatsPage-CuJD7mWH.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i}from"./client-DnySrlFv.js";import{t as a}from"./useQuery-BBCjCezC.js";import{t as o}from"./createLucideIcon-DvBYJlWL.js";import{a as s,d as c,f as l,h as u,i as d,l as f,m as p,n as m,p as h,r as g,s as _,t as v,u as y}from"./sortable.esm-D2bGix-3.js";import{t as b}from"./calendar-BLKPnWqV.js";import{a as x,n as S}from"./info-ROUoQhJR.js";import{n as C,r as w}from"./ToastContext-BRX0SW3C.js";import{t as T}from"./dollar-sign-Cj_Yhud4.js";import{t as E}from"./eye-off-6CkaxYwP.js";import{t as ee}from"./file-spreadsheet-WxOA9vYy.js";import{t as D}from"./grip-vertical-C_1RDxRw.js";import{t as O}from"./loader-circle-BEmFtawu.js";import{t as k}from"./maximize-2-kPQ77q72.js";import{t as A}from"./minimize-2-dqT-k7oI.js";import{t as j}from"./package-BGUevlqS.js";import{t as M}from"./target-B40GQtrA.js";import{$ as te,$t as ne,A as re,An as ie,At as ae,Bt as oe,C as se,Cn as ce,Ct as le,D as ue,Dn as N,Dt as de,E as fe,En as pe,Et as me,Fn as he,G as ge,H as _e,I as ve,In as ye,It as be,J as xe,K as Se,Kt as Ce,L as P,Ln as we,Lt as Te,M as Ee,Mn as F,N as De,Nt as Oe,O as ke,On as Ae,Ot as je,Pt as Me,Q as Ne,Qt as Pe,R as Fe,Rn as Ie,S as Le,Sn as I,St as Re,T as ze,U as Be,Ut as L,V as Ve,W as He,X as Ue,Xt as R,Y as We,Z as Ge,Zt as Ke,_t as qe,a as Je,at as Ye,bt as Xe,c as Ze,cn as z,ct as Qe,d as $e,dn as et,dt as tt,en as nt,et as rt,f as it,ft as at,gn as B,hn as ot,i as st,in as ct,j as lt,kt as ut,l as dt,lt as ft,mn as V,mt as pt,n as mt,nn as ht,nt as gt,o as _t,on as vt,ot as H,p as yt,pt as bt,q as xt,r as St,rn as Ct,rt as wt,s as Tt,sn as Et,st as Dt,t as Ot,tn as kt,tt as At,un as jt,ut as Mt,v as Nt,vn as Pt,vt as Ft,w as It,wn as Lt,wt as Rt,xn as U,xt as zt,yn as Bt,yt as Vt,z as Ht}from"./CartesianChart-BAcHzPFb.js";import{t as Ut}from"./triangle-alert-Dt_1FcBy.js";import{t as W}from"./Button-DDr6eAFy.js";import{h as Wt,o as Gt,v as Kt}from"./date-G9KUauqz.js";import{Dt as qt,Gt as Jt,Nn as Yt,On as Xt,Sn as Zt,at as Qt,bt as $t,xn as en,xt as tn,yt as nn}from"./index-CovRLYqQ.js";import{t as rn}from"./filamentTypes-Dysa4k6j.js";import{n as an,t as on}from"./ErrorBarContext-CcijMMkA.js";import{i as G,n as sn,r as K,t as cn}from"./AreaChart-DJpIJXxF.js";var ln=o(`calculator`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]),un=e=>null;un.displayName=`Cell`;var dn=e=>e.graphicalItems.polarItems,fn=V([dn,H,V([zt,Xe],gt)],te),pn=V([V([fn],Ne),ut],Ue),mn=V([pn,H,fn],xt);V([pn,H,fn],(e,t,n)=>n.length>0?e.flatMap(e=>n.flatMap(n=>({value:z(e,t.dataKey??n.dataKey),errorDomain:[]}))).filter(Boolean):t?.dataKey==null?e.map(e=>({value:e,errorDomain:[]})):e.map(e=>({value:z(e,t.dataKey),errorDomain:[]})));var hn=()=>void 0,gn=V([H,L,pn,mn,je,zt,V([H,Qe,ft,hn,V([pn,H,fn,wt,zt],Ge),hn,L,zt],At)],xe);V([Mt,V([H,gn,V([gn,tt,Mt],rt),zt],We)],qe);function _n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vn(e){for(var t=1;tt],(e,t)=>e.filter(e=>e.type===`pie`).find(e=>e.id===t)),Cn=[],wn=(e,t,n)=>n?.length===0?Cn:n,Tn=V([ut,Sn,wn],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i=t?.data!=null&&t.data.length>0?t.data:r;if((!i||!i.length)&&n!=null&&(i=n.map(e=>vn(vn({},t.presentationProps),e.props))),i!=null)return i}}),En=V([Tn,Sn,wn],(e,t,n)=>{if(!(e==null||t==null))return e.map((e,r)=>{var i,a=z(e,t.nameKey,t.name),o=n!=null&&(i=n[r])!=null&&(i=i.props)!=null&&i.fill?n[r].props.fill:typeof e==`object`&&e&&`fill`in e?e.fill:t.fill;return{value:Et(a,t.dataKey),color:o,payload:e,type:t.legendType}})}),Dn=V([Tn,Sn,wn,ne],(e,t,n,r)=>{if(!(t==null||e==null))return $n({offset:r,pieSettings:t,displayedData:e,cells:n})}),On=(e,t,n)=>{var r=ot();return(i,a)=>o=>{e?.(i,a,o),r(Se({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},kn=e=>{var t=ot();return(n,r)=>i=>{e?.(n,r,i),t(He())}},An=(e,t,n)=>{var r=ot();return(i,a)=>o=>{e?.(i,a,o),r(ge({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},q=e(n()),jn=e(ie()),Mn=[`key`],Nn=[`onMouseEnter`,`onClick`,`onMouseLeave`],Pn=[`id`],Fn=[`id`];function In(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;tke(e.children,un),[e.children]),n=B(n=>En(n,e.id,t));return n==null?null:q.createElement(fe,{legendPayload:n})}var Un=q.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:s,hide:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:r.map(e=>e.tooltipPayload),getPosition:e=>r[Number(e)]?.tooltipPosition,settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:Et(s,t),hide:c,type:l,color:o,unit:``,graphicalItemId:u}};return q.createElement(ue,{tooltipEntrySettings:d})}),Wn=(e,t)=>e>t?`start`:eU(typeof t==`function`?t(e):t,n,n*.8),Kn=(e,t,n)=>{var{top:r,left:i,width:a,height:o}=t,s=Oe(a,o);return{cx:i+U(e.cx,a,a/2),cy:r+U(e.cy,o,o/2),innerRadius:U(e.innerRadius,s,0),outerRadius:Gn(n,e.outerRadius,s),maxRadius:e.maxRadius||Math.sqrt(a*a+o*o)/2}},qn=(e,t)=>N(t-e)*Math.min(Math.abs(t-e),360),Jn=(e,t)=>{if(q.isValidElement(e))return q.cloneElement(e,t);if(typeof e==`function`)return e(t);var n=we(`recharts-pie-label-line`,typeof e==`boolean`?``:e.className),{key:r}=t,i=Bn(t,Mn);return q.createElement(oe,Y({},i,{type:`linear`,className:n}))},Yn=(e,t,n)=>{if(q.isValidElement(e))return q.cloneElement(e,t);var r=n;if(typeof e==`function`&&(r=e(t),q.isValidElement(r)))return r;var i=we(`recharts-pie-label-text`,re(e));return q.createElement(ve,Y({},t,{alignmentBaseline:`middle`,className:i}),r)};function Xn(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var s=he(n),c=ye(i),l=ye(a),u=typeof i==`object`&&`offsetRadius`in i&&typeof i.offsetRadius==`number`&&i.offsetRadius||20,d=t.map((e,t)=>{var n=(e.startAngle+e.endAngle)/2,r=Me(e.cx,e.cy,e.outerRadius+u,n),d=J(J(J(J({},s),e),{},{stroke:`none`},c),{},{index:t,textAnchor:Wn(r.x,e.cx)},r),f=J(J(J(J({},s),e),{},{fill:`none`,stroke:e.fill},l),{},{index:t,points:[Me(e.cx,e.cy,e.outerRadius,n),r],key:`line`});return q.createElement(Ht,{zIndex:Re.label,key:`label-${e.startAngle}-${e.endAngle}-${e.midAngle}-${t}`},q.createElement(F,null,a&&Jn(a,f),Yn(i,d,z(e,o))))});return q.createElement(F,{className:`recharts-pie-labels`},d)}function Zn(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i==`object`&&i&&`position`in i?q.createElement(Ee,{label:i}):q.createElement(Xn,{sectors:t,props:n,showLabels:r})}function Qn(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,s=B(Be),c=B(Ve),l=B(_e),{onMouseEnter:u,onClick:d,onMouseLeave:f}=i,p=Bn(i,Nn),m=On(u,i.dataKey,o),h=kn(f),g=An(d,i.dataKey,o);return t==null||t.length===0?null:q.createElement(q.Fragment,null,t.map((e,u)=>{if(e?.startAngle===0&&e?.endAngle===0&&t.length!==1)return null;var d=l==null||l===o,f=String(u)===s&&(c==null||i.dataKey===c)&&d,_=n&&f?n:s?r:null,v=J(J({},e),{},{stroke:e.stroke,tabIndex:-1,[kt]:u,[nt]:o});return q.createElement(F,Y({key:`sector-${e?.startAngle}-${e?.endAngle}-${e.midAngle}-${u}`,tabIndex:-1,className:`recharts-pie-sector`},Bt(p,e,u),{onMouseEnter:m(e,u),onMouseLeave:h(e,u),onClick:g(e,u)}),q.createElement(an,Y({option:a??_,index:u,shapeType:`sector`,isActive:f},v)))}))}function $n(e){var{pieSettings:t,displayedData:n,cells:r,offset:i}=e,{cornerRadius:a,startAngle:o,endAngle:s,dataKey:c,nameKey:l,tooltipType:u}=t,d=Math.abs(t.minAngle),f=qn(o,s),p=Math.abs(f),m=n.length<=1?0:t.paddingAngle??0,h=n.filter(e=>z(e,c,0)!==0).length,g=(p>=360?h:h-1)*m,_=p-h*d-g,v=n.reduce((e,t)=>{var n=z(t,c,0);return e+(pe(n)?n:0)},0),y;if(v>0){var b;y=n.map((e,n)=>{var s=z(e,c,0),p=z(e,l,n),h=Kn(t,i,e),g=(pe(s)?s:0)/v,y,x=J(J({},e),r&&r[n]&&r[n].props);y=n?b.endAngle+N(f)*m*(s===0?0:1):o;var S=y+N(f)*((s===0?0:d)+g*_),C=(y+S)/2,w=(h.innerRadius+h.outerRadius)/2,T=[{name:p,value:s,payload:x,dataKey:c,type:u,graphicalItemId:t.id}],E=Me(h.cx,h.cy,w,C);return b=J(J(J(J({},t.presentationProps),{},{percent:g,cornerRadius:typeof a==`string`?parseFloat(a):a,name:p,tooltipPayload:T,midAngle:C,middleRadius:w,tooltipPosition:E},x),h),{},{value:s,dataKey:c,startAngle:y,endAngle:S,payload:x,paddingAngle:N(f)*m}),b})}return y}function er(e){var{showLabels:t,sectors:n,children:r}=e,i=(0,q.useMemo)(()=>!t||!n?[]:n.map(e=>({value:e.value,payload:e.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:e.cx,cy:e.cy,innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,clockWise:!1},fill:e.fill})),[n,t]);return q.createElement(De,{value:t?i:void 0},r)}function tr(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:s,animationEasing:c,activeShape:l,inactiveShape:u,onAnimationStart:d,onAnimationEnd:f}=t,p=be(t,`recharts-pie-`),m=n.current,[h,g]=(0,q.useState)(!1),_=(0,q.useCallback)(()=>{typeof f==`function`&&f(),g(!1)},[f]),v=(0,q.useCallback)(()=>{typeof d==`function`&&d(),g(!0)},[d]);return q.createElement(er,{showLabels:!h,sectors:i},q.createElement(Te,{animationId:p,begin:o,duration:s,isActive:a,easing:c,onAnimationStart:v,onAnimationEnd:_,key:p},e=>{var a=[],o=(i&&i[0])?.startAngle??0;return i?.forEach((t,n)=>{var r=m&&m[n],i=n>0?(0,jn.default)(t,`paddingAngle`,0):0;if(r){var s=I(r.endAngle-r.startAngle,t.endAngle-t.startAngle,e),c=J(J({},t),{},{startAngle:o+i,endAngle:o+s+i});a.push(c),o=c.endAngle}else{var{endAngle:l,startAngle:u}=t,d=I(0,l-u,e),f=J(J({},t),{},{startAngle:o+i,endAngle:o+d+i});a.push(f),o=f.endAngle}}),n.current=a,q.createElement(F,null,q.createElement(Qn,{sectors:a,activeShape:l,inactiveShape:u,allOtherPieProps:t,shape:t.shape,id:r}))}),q.createElement(Zn,{showLabels:!h,sectors:i,props:t}),t.children)}var nr={animationBegin:400,animationDuration:1500,animationEasing:`ease`,cx:`50%`,cy:`50%`,dataKey:`value`,endAngle:360,fill:`#808080`,hide:!1,innerRadius:0,isAnimationActive:`auto`,label:!1,labelLine:!0,legendType:`rect`,minAngle:0,nameKey:`name`,outerRadius:`80%`,paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:`#fff`,zIndex:Re.area};function rr(e){var{id:t}=e,n=Bn(e,Pn),{hide:r,className:i,rootTabIndex:a}=e,o=(0,q.useMemo)(()=>ke(e.children,un),[e.children]),s=B(e=>Dn(e,t,o)),c=(0,q.useRef)(null),l=we(`recharts-pie`,i);return r||s==null?(c.current=null,q.createElement(F,{tabIndex:a,className:l})):q.createElement(Ht,{zIndex:e.zIndex},q.createElement(Un,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:s,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t}),q.createElement(F,{tabIndex:a,className:l},q.createElement(tr,{props:J(J({},n),{},{sectors:s}),previousSectorsRef:c,id:t})))}function ir(e){var t=Pt(e,nr),{id:n}=t,r=Bn(t,Fn),i=he(r);return q.createElement(It,{id:n,type:`pie`},e=>q.createElement(q.Fragment,null,q.createElement(se,{type:`pie`,id:e,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),q.createElement(Hn,Y({},r,{id:e})),q.createElement(rr,Y({},r,{id:e}))))}ir.displayName=`Pie`;var ar=(e,t,n)=>{var r=n??e;if(!Lt(r))return U(r,t,0)},or=(e,t,n)=>{var r={},i=e.filter(Ft),a=e.filter(e=>e.stackId==null),o=i.reduce((e,t)=>{var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},r),s=Object.entries(o).map(e=>{var[r,i]=e;return{stackId:r,dataKeys:i.map(e=>e.dataKey),barSize:ar(t,n,i[0]?.barSize)}}),c=a.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>e!=null),barSize:ar(t,n,e.barSize)}));return[...s,...c]};function sr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function cr(e){for(var t=1;te+(t.barSize||0),0);d+=(a-1)*o,d>=n&&(d-=(a-1)*o,o=0),d>=n&&u>0&&(l=!0,u*=.9,d=a*u);var f={offset:((n-d)/2>>0)-o,size:0};s=r.reduce((e,t)=>{var n={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:f.offset+f.size+o,size:l?u:t.barSize??0}},r=[...e,n];return f=n.position,r},c)}else{var p=U(t,n,0,!0);n-2*p-(a-1)*o<=0&&(o=0);var m=(n-2*p-(a-1)*o)/a;m>1&&(m>>=0);var h=et(i)?Math.min(m,i):m;s=r.reduce((e,t,n)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p+(m+o)*n+(m-h)/2,size:h}}],c)}return s}}var pr=(e,t,n,r,i,a,o)=>{var s=Lt(o)?t:o,c=fr(n,r,i===a?a:i,e,s);return i!==a&&c!=null&&(c=c.map(e=>cr(cr({},e),{},{position:cr(cr({},e.position),{},{offset:e.position.offset-i/2})}))),c},mr=(e,t)=>{var n=Vt(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var i=e[r];if(i){var{stackedData:a}=i;if(a)return a.find(e=>e.key===n)}}}},hr=(e,t)=>{if(!(e==null||t==null)){var n=e.find(e=>e.stackId===t.stackId&&t.dataKey!=null&&e.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function gr(e,t){return e&&typeof e==`object`&&`zIndex`in e&&typeof e.zIndex==`number`&&et(e.zIndex)?e.zIndex:t}var _r=!0,vr=`Invariant failed`;function yr(e,t){if(!e){if(_r)throw Error(vr);var n=typeof t==`function`?t():t,r=n?`${vr}: ${n}`:vr;throw Error(r)}}function br(){return br=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:0;return(n,r)=>{if(pe(e))return e;var i=pe(n)||Lt(n);return i?e(n,r):(!i&&yr(!1,`minPointSize callback function received a value with type of ${typeof n}. Currently only numbers or null/undefined are supported.`),t)}},Cr=(e,t,n)=>n,wr=V([pt,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`bar`).find(e=>e.id===t)),Tr=V([wr],e=>e?.maxBarSize),Er=(e,t,n,r)=>r,Dr=V([L,pt,K,G,Cr],(e,t,n,r,i)=>t.filter(t=>e===`horizontal`?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>e.hide===!1).filter(e=>e.type===`bar`)),Or=(e,t,n)=>{var r=L(e),i=K(e,t),a=G(e,t);if(!(i==null||a==null))return r===`horizontal`?at(e,`yAxis`,a,n):at(e,`xAxis`,i,n)},kr=V([Dr,me,(e,t)=>{var n=L(e),r=K(e,t),i=G(e,t);if(!(r==null||i==null))return n===`horizontal`?Dt(e,`xAxis`,r):Dt(e,`yAxis`,i)}],or),Ar=(e,t,n)=>{var r=wr(e,t);if(r==null)return 0;var i=K(e,t),a=G(e,t);if(i==null||a==null)return 0;var o=L(e),s=de(e),{maxBarSize:c}=r,l=Lt(c)?s:c,u,d;return o===`horizontal`?(u=Ye(e,`xAxis`,i,n),d=bt(e,`xAxis`,i,n)):(u=Ye(e,`yAxis`,a,n),d=bt(e,`yAxis`,a,n)),ht(u,d,!0)??l??0},jr=(e,t,n)=>{var r=L(e),i=K(e,t),a=G(e,t);if(!(i==null||a==null)){var o,s;return r===`horizontal`?(o=Ye(e,`xAxis`,i,n),s=bt(e,`xAxis`,i,n)):(o=Ye(e,`yAxis`,a,n),s=bt(e,`yAxis`,a,n)),ht(o,s)}},Mr=V([ne,Pe,(e,t,n)=>{var r=K(e,t);if(r!=null)return Ye(e,`xAxis`,r,n)},(e,t,n)=>{var r=G(e,t);if(r!=null)return Ye(e,`yAxis`,r,n)},(e,t,n)=>{var r=K(e,t);if(r!=null)return bt(e,`xAxis`,r,n)},(e,t,n)=>{var r=G(e,t);if(r!=null)return bt(e,`yAxis`,r,n)},V([V([kr,de,Rt,le,Ar,jr,Tr],pr),wr],hr),L,ae,jr,V([Or,wr],mr),wr,Er],(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{var{chartData:p,dataStartIndex:m,dataEndIndex:h}=c;if(!(d==null||o==null||t==null||s!==`horizontal`&&s!==`vertical`||n==null||r==null||i==null||a==null||l==null)){var{data:g}=d,_=g!=null&&g.length>0?g:p?.slice(m,h+1);if(_!=null)return fi({layout:s,barSettings:d,pos:o,parentViewBox:t,bandSize:l,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:_,offset:e,cells:f,dataStartIndex:m})}}),Nr=[`index`];function Pr(){return Pr=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=(0,q.useContext)(Lr);if(t!=null)return t.stackId;if(e!=null)return vt(e)},zr=(e,t)=>`recharts-bar-stack-clip-path-${e}-${t}`,Br=e=>{var t=(0,q.useContext)(Lr);if(t!=null){var{stackId:n}=t;return`url(#${zr(n,e)})`}},Vr=e=>{var{index:t}=e,n=Fr(e,Nr),r=Br(t);return q.createElement(F,Pr({className:`recharts-bar-stack-layer`,clipPath:r},n))},Hr=[`onMouseEnter`,`onMouseLeave`,`onClick`],Ur=[`value`,`background`,`tooltipPosition`],Wr=[`id`],Gr=[`onMouseEnter`,`onClick`,`onMouseLeave`];function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,fill:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:Et(n,t),payload:e}]},$r=q.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:a,hide:o,unit:s,tooltipType:c,id:l}=e,u={dataDefinedOnItem:void 0,getPosition:Ae,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:Et(a,t),hide:o,type:c,color:i,unit:s,graphicalItemId:l}};return q.createElement(ue,{tooltipEntrySettings:u})});function ei(e){var t=B(Be),{data:n,dataKey:r,background:i,allOtherBarProps:a}=e,{onMouseEnter:o,onMouseLeave:s,onClick:c}=a,l=Xr(a,Hr),u=On(o,r,a.id),d=kn(s),f=An(c,r,a.id);if(!i||n==null)return null;var p=ye(i);return q.createElement(Ht,{zIndex:gr(i,Re.barBackground)},n.map((e,n)=>{var{value:a,background:o,tooltipPosition:s}=e,c=Xr(e,Ur);if(!o)return null;var m=u(e,n),h=d(e,n),g=f(e,n),_=Z(Z(Z(Z(Z({option:i,isActive:String(n)===t},c),{},{fill:`#eee`},o),p),Bt(l,e,n)),{},{onMouseEnter:m,onMouseLeave:h,onClick:g,dataKey:r,index:n,className:`recharts-bar-background-rectangle`});return q.createElement(xr,X({key:`background-bar-${n}`},_))}))}function ti(e){var{showLabels:t,children:n,rects:r}=e,i=r?.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return Z(Z({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return q.createElement(lt,{value:t?i:void 0},n)}function ni(e){var{shape:t,activeBar:n,baseProps:r,entry:i,index:a,dataKey:o}=e,s=B(Be),c=B(Ve),l=n&&String(a)===s&&(c==null||o===c),u=l?n:t;return l?q.createElement(Ht,{zIndex:Re.activeBar},q.createElement(Vr,{index:a},q.createElement(xr,X({},r,{name:String(r.name)},i,{isActive:l,option:u,index:a,dataKey:o})))):q.createElement(xr,X({},r,{name:String(r.name)},i,{isActive:l,option:u,index:a,dataKey:o}))}function ri(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:a}=e;return q.createElement(xr,X({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a}))}function ii(e){var{data:t,props:n}=e,r=he(n)??{},{id:i}=r,a=Xr(r,Wr),{shape:o,dataKey:s,activeBar:c}=n,{onMouseEnter:l,onClick:u,onMouseLeave:d}=n,f=Xr(n,Gr),p=On(l,s,i),m=kn(d),h=An(u,s,i);return t?q.createElement(q.Fragment,null,t.map((e,t)=>q.createElement(Vr,X({index:t,key:`rectangle-${e?.x}-${e?.y}-${e?.value}-${t}`,className:`recharts-bar-rectangle`},Bt(f,e,t),{onMouseEnter:p(e,t),onMouseLeave:m(e,t),onClick:h(e,t)}),c?q.createElement(ni,{shape:o,activeBar:c,baseProps:a,entry:e,index:t,dataKey:s}):q.createElement(ri,{shape:o,baseProps:a,entry:e,index:t,dataKey:s})))):null}function ai(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:s,animationEasing:c,onAnimationEnd:l,onAnimationStart:u}=t,d=n.current,f=be(t,`recharts-bar-`),[p,m]=(0,q.useState)(!1),h=!p,g=(0,q.useCallback)(()=>{typeof l==`function`&&l(),m(!1)},[l]),_=(0,q.useCallback)(()=>{typeof u==`function`&&u(),m(!0)},[u]);return q.createElement(ti,{showLabels:h,rects:r},q.createElement(Te,{animationId:f,begin:o,duration:s,isActive:a,easing:c,onAnimationEnd:g,onAnimationStart:_,key:f},e=>{var a=e===1?r:r?.map((t,n)=>{var r=d&&d[n];if(r)return Z(Z({},t),{},{x:I(r.x,t.x,e),y:I(r.y,t.y,e),width:I(r.width,t.width,e),height:I(r.height,t.height,e)});if(i===`horizontal`){var a=I(0,t.height,e),o=I(t.stackedBarStart,t.y,e);return Z(Z({},t),{},{y:o,height:a})}var s=I(0,t.width,e),c=I(t.stackedBarStart,t.x,e);return Z(Z({},t),{},{width:s,x:c})});return e>0&&(n.current=a??null),a==null?null:q.createElement(F,null,q.createElement(ii,{props:t,data:a}))}),q.createElement(Ee,{label:t.label}),t.children)}function oi(e){var t=(0,q.useRef)(null);return q.createElement(ai,{previousRectanglesRef:t,props:e})}var si=0,ci=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:z(e,t)}},li=class extends q.PureComponent{render(){var{hide:e,data:t,dataKey:n,className:r,xAxisId:i,yAxisId:a,needClip:o,background:s,id:c}=this.props;if(e||t==null)return null;var l=we(`recharts-bar`,r),u=c;return q.createElement(F,{className:l,id:c},o&&q.createElement(`defs`,null,q.createElement($e,{clipPathId:u,xAxisId:i,yAxisId:a})),q.createElement(F,{className:`recharts-bar-rectangles`,clipPath:o?`url(#clipPath-${u})`:void 0},q.createElement(ei,{data:t,dataKey:n,background:s,allOtherBarProps:this.props}),q.createElement(oi,this.props)))}},ui={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:`ease`,background:!1,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`rect`,minPointSize:si,xAxisId:0,yAxisId:0,zIndex:Re.bar};function di(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u}=e,{needClip:d}=it(t,n),f=Ce(),p=Ke(),m=ke(e.children,un),h=B(t=>Mr(t,e.id,p,m));if(f!==`vertical`&&f!==`horizontal`)return null;var g,_=h?.[0];return g=_==null||_.height==null||_.width==null?0:f===`vertical`?_.height/2:_.width/2,q.createElement(on,{xAxisId:t,yAxisId:n,data:h,dataPointFormatter:ci,errorBarOffset:g},q.createElement(li,X({},e,{layout:f,needClip:d,data:h,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u})))}function fi(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r},pos:i,bandSize:a,xAxis:o,yAxis:s,xAxisTicks:c,yAxisTicks:l,stackedData:u,displayedData:d,offset:f,cells:p,parentViewBox:m,dataStartIndex:h}=e,g=t===`horizontal`?s:o,_=u?g.scale.domain():null,v=Ct({numericAxis:g}),y=g.scale.map(v);return d.map((e,d)=>{var g,b,x,S,C,w;if(u){var T=u[d+h];if(T==null)return null;g=jt(T,_)}else g=z(e,n),Array.isArray(g)||(g=[v,g]);var E=Sr(r,si)(g[1],d);if(t===`horizontal`){var ee=s.scale.map(g[0]),D=s.scale.map(g[1]);if(ee==null||D==null)return null;b=ct({axis:o,ticks:c,bandSize:a,offset:i.offset,entry:e,index:d}),x=D??ee??void 0,S=i.size;var O=ee-D;if(C=ce(O)?0:O,w={x:b,y:f.top,width:S,height:f.height},Math.abs(E)>0&&Math.abs(C)0&&Math.abs(S)q.createElement(q.Fragment,null,q.createElement(ze,{legendPayload:Qr(t)}),q.createElement($r,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),q.createElement(Le,{type:`bar`,id:e,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r}),q.createElement(Ht,{zIndex:t.zIndex},q.createElement(di,X({},t,{id:e})))))}var mi=q.memo(pi,dt);mi.displayName=`Bar`;var hi=[`axis`,`item`],gi=(0,q.forwardRef)((e,t)=>q.createElement(Ot,{chartName:`BarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:hi,tooltipPayloadSearcher:Fe,categoricalChartProps:e,ref:t}));function _i(e){var t=ot();return(0,q.useEffect)(()=>{t(_t(e))},[t,e]),null}var vi=[`layout`];function yi(){return yi=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=Pt(e,Ai);return q.createElement(Ci,{chartName:`PieChart`,defaultTooltipEventType:`item`,validateTooltipEventTypes:ki,tooltipPayloadSearcher:Fe,categoricalChartProps:n,ref:t})}),Q=t();function Mi({printDates:e,months:t=3}){let n=(0,q.useRef)(null),[r,i]=(0,q.useState)(0);(0,q.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(e=>{i(e[0]?.contentRect.width||0)});return t.observe(e),()=>t.disconnect()},[]);let{weeks:a,monthLabels:o,printCounts:s}=(0,q.useMemo)(()=>{let n={};e.forEach(e=>{let t=Wt(e);t&&(n[t]=(n[t]||0)+1)});let r=new Date,i=new Date(r);i.setMonth(i.getMonth()-t),i.setDate(i.getDate()-i.getDay());let a=[],o=[],s=[],c=-1,l=new Date(i),u=0;for(;l<=r;)l.getDay()===0&&s.length>0&&(a.push(s),s=[],u++),l.getMonth()!==c&&(o.push({month:l.toLocaleDateString(`en-US`,{month:`short`}),weekIndex:u}),c=l.getMonth()),s.push(new Date(l)),l.setDate(l.getDate()+1);return s.length>0&&a.push(s),{weeks:a,monthLabels:o,printCounts:n}},[e,t]),c=Math.max(1,...Object.values(s)),l=e=>{if(e===0)return`bg-bambu-dark`;let t=e/c;return t<=.25?`bg-bambu-green/30`:t<=.5?`bg-bambu-green/50`:t<=.75?`bg-bambu-green/75`:`bg-bambu-green`},u=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],d=a.length,f=r-32-16,p=d>0?Math.floor((f-(d-1)*2)/d):12,m=Math.max(8,Math.min(20,p)),h=m<=10?10:12;return(0,Q.jsx)(`div`,{ref:n,className:`w-full flex justify-center`,children:r>0&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`flex mb-1`,style:{marginLeft:36},children:o.map(({month:e,weekIndex:t},n)=>(0,Q.jsx)(`div`,{className:`text-bambu-gray`,style:{fontSize:h,marginLeft:n===0?0:`${(t-(o[n-1]?.weekIndex||0))*(m+2)-24}px`},children:e},n))}),(0,Q.jsxs)(`div`,{className:`flex`,style:{gap:2},children:[(0,Q.jsx)(`div`,{className:`flex flex-col`,style:{gap:2,marginRight:4,width:32},children:u.map((e,t)=>(0,Q.jsx)(`div`,{className:`text-bambu-gray flex items-center`,style:{width:32,height:m,fontSize:h,visibility:t%2==1?`visible`:`hidden`},children:e},e))}),a.map((e,t)=>(0,Q.jsx)(`div`,{className:`flex flex-col`,style:{gap:2},children:[0,1,2,3,4,5,6].map(t=>{let n=e.find(e=>e.getDay()===t);if(!n)return(0,Q.jsx)(`div`,{style:{width:m,height:m}},t);let r=Wt(n),i=s[r]||0,a=r===Wt(new Date);return(0,Q.jsx)(`div`,{className:`rounded-sm ${l(i)} ${a?`ring-1 ring-white`:``}`,style:{width:m,height:m},title:`${n.toLocaleDateString()}: ${i} print${i===1?``:`s`}`},t)})},t))]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mt-3 text-bambu-gray`,style:{fontSize:h},children:[(0,Q.jsx)(`span`,{children:`Less`}),(0,Q.jsxs)(`div`,{className:`flex`,style:{gap:2},children:[(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-dark`,style:{width:m,height:m}}),(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-green/30`,style:{width:m,height:m}}),(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-green/50`,style:{width:m,height:m}}),(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-green/75`,style:{width:m,height:m}}),(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-green`,style:{width:m,height:m}})]}),(0,Q.jsx)(`span`,{children:`More`})]})]})})}var Ni=[`weight`,`prints`,`time`];function Pi({value:e,onChange:t,exclude:n}){let{t:r}=i(),a={weight:r(`stats.filamentByWeight`),prints:r(`stats.filamentByPrints`),time:r(`stats.filamentByTime`)};return(0,Q.jsx)(`div`,{className:`flex gap-0.5 bg-bambu-dark rounded-lg p-0.5`,children:(n?Ni.filter(e=>!n.includes(e)):Ni).map(n=>(0,Q.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-0.5 text-xs rounded-md transition-colors ${e===n?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:a[n]},n))})}function $(e){if(e>=1e6){let t=e/1e6;return`${t%1==0?t.toFixed(0):t.toFixed(1)}t`}if(e>=1e3){let t=e/1e3;return`${t%1==0?t.toFixed(0):t.toFixed(1)}kg`}return`${Math.round(e)}g`}function Fi(e){let t=rn(e);return t.length?t:[`Unknown`]}var Ii=[`#00ae42`,`#3b82f6`,`#f59e0b`,`#ef4444`,`#8b5cf6`,`#ec4899`,`#14b8a6`,`#f97316`],Li=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Ri=[`12am`,`1am`,`2am`,`3am`,`4am`,`5am`,`6am`,`7am`,`8am`,`9am`,`10am`,`11am`,`12pm`,`1pm`,`2pm`,`3pm`,`4pm`,`5pm`,`6pm`,`7pm`,`8pm`,`9pm`,`10pm`,`11pm`];function zi({archives:e,currency:t=`$`,dateFrom:n,dateTo:r}){let{t:a}=i(),[o,s]=(0,q.useState)(`weight`),[c,l]=(0,q.useState)(`weight`),u=(0,q.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let n=Kt(e.completed_at||e.created_at)||new Date,r=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,`0`)}-${String(n.getDate()).padStart(2,`0`)}`,i=t.get(r)||{date:r,filament:0,cost:0,energy:0,prints:0};i.filament+=e.filament_used_grams||0,i.cost+=e.cost||0,i.energy+=e.energy_kwh||0,i.prints+=e.quantity??1,t.set(r,i)}),Array.from(t.values()).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>({...e,dateLabel:new Date(e.date).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}))},[e]),d=(0,q.useMemo)(()=>{if(n&&r)return Math.max((new Date(r).getTime()-new Date(n).getTime())/864e5,0)+1;if(n)return Math.max((Date.now()-new Date(n).getTime())/864e5,0)+1;if(e.length<2)return 0;let t=e.map(e=>new Date(e.completed_at||e.created_at).getTime());return(Math.max(...t)-Math.min(...t))/864e5},[e,n,r]),f=(0,q.useMemo)(()=>{if(d>7)return[];let t=new Map,n=d>1;return e.forEach(e=>{let n=Kt(e.completed_at||e.created_at)||new Date,r=n.getHours(),i=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,`0`)}-${String(n.getDate()).padStart(2,`0`)}T${String(r).padStart(2,`0`)}`,a=t.get(i)||{date:i,filament:0,cost:0,energy:0,prints:0};a.filament+=e.filament_used_grams||0,a.cost+=e.cost||0,a.energy+=e.energy_kwh||0,a.prints+=e.quantity??1,t.set(i,a)}),Array.from(t.values()).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{let[t,r]=e.date.split(`T`),i=new Date(t),a=parseInt(r,10),o=n?`${Li[i.getDay()]} ${Ri[a]}`:Ri[a];return{...e,dateLabel:o}})},[e,d]),p=(0,q.useMemo)(()=>{if(u.length<=60)return u;let e=new Map;return u.forEach(t=>{let n=new Date(t.date),r=new Date(n);r.setDate(n.getDate()-n.getDay());let i=`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,`0`)}-${String(r.getDate()).padStart(2,`0`)}`,a=e.get(i)||{week:i,filament:0,cost:0,energy:0,prints:0};a.filament+=t.filament,a.cost+=t.cost,a.energy+=t.energy,a.prints+=t.prints,e.set(i,a)}),Array.from(e.values()).sort((e,t)=>e.week.localeCompare(t.week)).map(e=>({date:e.week,dateLabel:`Week of ${new Date(e.week).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}`,...e}))},[u]),m=(0,q.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let n=Fi(e.filament_type);n.forEach(r=>{let i=(e.filament_used_grams||0)/n.length;t.set(r,(t.get(r)||0)+i)})}),Array.from(t.entries()).map(([e,t])=>({name:e,value:Math.round(t)})).sort((e,t)=>t.value-e.value)},[e]),h=(0,q.useMemo)(()=>{let t=new Map;return e.forEach(e=>{Fi(e.filament_type).forEach(e=>{t.set(e,(t.get(e)||0)+1)})}),Array.from(t.entries()).map(([e,t])=>({name:e,value:t})).sort((e,t)=>t.value-e.value)},[e]),g=(0,q.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let n=Fi(e.filament_type),r=(e.actual_time_seconds||e.print_time_seconds||0)/n.length;n.forEach(e=>{t.set(e,(t.get(e)||0)+r)})}),Array.from(t.entries()).map(([e,t])=>({name:e,value:Math.round(t/3600*10)/10})).sort((e,t)=>t.value-e.value)},[e]),_=(0,q.useMemo)(()=>{let t=new Map;return e.forEach(e=>{e.status!==`completed`&&e.status!==`failed`||Fi(e.filament_type).forEach(n=>{let r=t.get(n)||{completed:0,failed:0};e.status===`completed`?r.completed++:r.failed++,t.set(n,r)})}),Array.from(t.entries()).filter(([,e])=>e.completed+e.failed>=2).map(([e,t])=>{let n=t.completed+t.failed;return{name:e,rate:Math.round(t.completed/n*100),total:n}}).sort((e,t)=>t.rate-e.rate)},[e]),v=(0,q.useMemo)(()=>{let t=new Map;return e.forEach(e=>{if(!e.filament_color)return;let n=e.filament_color.split(`,`).map(e=>e.trim()),r=(e.filament_used_grams||0)/n.length;n.forEach(e=>{let n=t.get(e)||{count:0,weight:0};n.count++,n.weight+=r,t.set(e,n)})}),Array.from(t.entries()).map(([e,t])=>({hex:e,value:c===`prints`?t.count:Math.round(t.weight)})).sort((e,t)=>t.value-e.value)},[e,c]),y=o===`weight`?m:o===`prints`?h:g,b=d<=7&&f.length>0?f:p,x=e.reduce((e,t)=>e+(t.filament_used_grams||0),0),S=e.reduce((e,t)=>e+(t.cost||0),0),C=e.reduce((e,t)=>e+(t.energy_kwh||0),0),w=e.reduce((e,t)=>e+(t.energy_cost||0),0),T=e.reduce((e,t)=>e+(t.quantity??1),0),E=new Set(e.map(e=>e.printer_id).filter(Boolean)).size;return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 max-[640px]:grid-cols-1`,children:[(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-bambu-gray leading-none`,children:a(`stats.periodFilament`)}),(0,Q.jsx)(`p`,{className:`text-2xl font-bold text-white leading-none`,children:$(x)})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[E,` `,a(`nav.printers`).toLowerCase()]})]}),(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-bambu-gray leading-none`,children:a(`stats.periodCost`)}),(0,Q.jsxs)(`p`,{className:`text-2xl font-bold text-white leading-none`,children:[t,S.toFixed(2)]})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[T,` `,a(`common.prints`)]})]}),(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-bambu-gray leading-none`,children:a(`stats.avgPerPrint`)}),(0,Q.jsxs)(`p`,{className:`text-2xl font-bold text-white leading-none`,children:[T>0?(x/T).toFixed(0):0,`g`]})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[t,T>0?(S/T).toFixed(2):`0.00`,` avg`]})]})]}),b.length>0?(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray mb-4`,children:a(`stats.usageOverTime`)}),(0,Q.jsx)(R,{width:`100%`,height:250,children:(0,Q.jsxs)(cn,{data:b,children:[(0,Q.jsx)(`defs`,{children:(0,Q.jsxs)(`linearGradient`,{id:`colorFilament`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Q.jsx)(`stop`,{offset:`5%`,stopColor:`#00ae42`,stopOpacity:.3}),(0,Q.jsx)(`stop`,{offset:`95%`,stopColor:`#00ae42`,stopOpacity:0})]})}),(0,Q.jsx)(yt,{strokeDasharray:`3 3`,stroke:`#3d3d3d`}),(0,Q.jsx)(Ze,{dataKey:`dateLabel`,stroke:`#9ca3af`,tick:{fontSize:12},interval:`preserveStartEnd`}),(0,Q.jsx)(Tt,{stroke:`#9ca3af`,tick:{fontSize:12},tickFormatter:e=>`${e}g`}),(0,Q.jsx)(P,{contentStyle:{backgroundColor:`#2d2d2d`,border:`1px solid #3d3d3d`,borderRadius:`8px`},labelStyle:{color:`#fff`},formatter:e=>[`${Number(e??0).toFixed(0)}g`,`Filament`]}),(0,Q.jsx)(sn,{type:`monotone`,dataKey:`filament`,stroke:`#00ae42`,strokeWidth:2,fillOpacity:1,fill:`url(#colorFilament)`})]})})]}):(0,Q.jsx)(`div`,{className:`bg-bambu-dark rounded-lg p-8 text-center text-bambu-gray`,children:a(`stats.noPrintDataInRange`)}),C>0&&b.length>0&&(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray`,children:a(`stats.energyOverTime`)}),(0,Q.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[C.toFixed(3),` kWh · `,t,w.toFixed(2)]})]}),(0,Q.jsx)(R,{width:`100%`,height:250,children:(0,Q.jsxs)(cn,{data:b,children:[(0,Q.jsx)(`defs`,{children:(0,Q.jsxs)(`linearGradient`,{id:`colorEnergy`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Q.jsx)(`stop`,{offset:`5%`,stopColor:`#f59e0b`,stopOpacity:.3}),(0,Q.jsx)(`stop`,{offset:`95%`,stopColor:`#f59e0b`,stopOpacity:0})]})}),(0,Q.jsx)(yt,{strokeDasharray:`3 3`,stroke:`#3d3d3d`}),(0,Q.jsx)(Ze,{dataKey:`dateLabel`,stroke:`#9ca3af`,tick:{fontSize:12},interval:`preserveStartEnd`}),(0,Q.jsx)(Tt,{stroke:`#9ca3af`,tick:{fontSize:12},tickFormatter:e=>`${e}kWh`}),(0,Q.jsx)(P,{contentStyle:{backgroundColor:`#2d2d2d`,border:`1px solid #3d3d3d`,borderRadius:`8px`},labelStyle:{color:`#fff`},formatter:e=>[`${Number(e??0).toFixed(3)} kWh`,a(`stats.energyUsed`)]}),(0,Q.jsx)(sn,{type:`monotone`,dataKey:`energy`,stroke:`#f59e0b`,strokeWidth:2,fillOpacity:1,fill:`url(#colorEnergy)`})]})})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray`,children:a(`stats.byMaterial`)}),(0,Q.jsx)(Pi,{value:o,onChange:s})]}),y.length>0?(0,Q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Q.jsx)(R,{width:160,height:160,children:(0,Q.jsxs)(ji,{children:[(0,Q.jsx)(ir,{data:y,cx:`50%`,cy:`50%`,innerRadius:40,outerRadius:70,paddingAngle:2,dataKey:`value`,children:y.map((e,t)=>(0,Q.jsx)(un,{fill:Ii[t%Ii.length]},`cell-${t}`))}),(0,Q.jsx)(P,{contentStyle:{backgroundColor:`#2d2d2d`,border:`1px solid #3d3d3d`,borderRadius:`8px`},formatter:e=>[o===`weight`?$(Number(e??0)):o===`time`?`${Number(e??0)}h`:`${e??0}`,o===`weight`?`Usage`:o===`time`?`Time`:`Prints`]})]})}),(0,Q.jsx)(`div`,{className:`flex-1 space-y-2 overflow-hidden`,children:y.map((e,t)=>{let n=y.reduce((e,t)=>e+t.value,0),r=n>0?(e.value/n*100).toFixed(0):0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 rounded-sm flex-shrink-0`,style:{backgroundColor:Ii[t%Ii.length]}}),(0,Q.jsx)(`span`,{className:`text-white truncate flex-1`,children:e.name}),(0,Q.jsxs)(`span`,{className:`text-bambu-gray flex-shrink-0`,children:[o===`weight`?$(e.value):o===`time`?`${e.value}h`:e.value,` · `,r,`%`]})]},e.name)})})]}):(0,Q.jsx)(`div`,{className:`h-[160px] flex items-center justify-center text-bambu-gray`,children:a(`stats.noFilamentData`)})]}),(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray mb-4`,children:a(`stats.filamentSuccess`)}),_.length>0?(0,Q.jsx)(`div`,{className:`space-y-1.5`,children:_.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-white truncate w-20 flex-shrink-0`,children:e.name}),(0,Q.jsx)(`div`,{className:`flex-1 h-1.5 bg-bambu-dark-secondary rounded-full`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full transition-all ${e.rate>=90?`bg-status-ok`:e.rate>=70?`bg-status-warning`:`bg-status-error`}`,style:{width:`${e.rate}%`}})}),(0,Q.jsxs)(`span`,{className:`font-medium flex-shrink-0 tabular-nums ${e.rate>=90?`text-status-ok`:e.rate>=70?`text-status-warning`:`text-status-error`}`,children:[e.rate,`%`]}),(0,Q.jsxs)(`span`,{className:`text-bambu-gray flex-shrink-0 text-xs`,children:[`(`,e.total,`)`]})]},e.name))}):(0,Q.jsx)(`div`,{className:`h-[160px] flex items-center justify-center text-bambu-gray`,children:a(`stats.noArchiveData`)})]}),(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray`,children:a(`stats.colorDistribution`)}),(0,Q.jsx)(Pi,{value:c,onChange:l,exclude:[`time`]})]}),v.length>0?(()=>{let e=v.reduce((e,t)=>e+t.value,0);return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`relative mx-auto`,style:{width:160,height:160},children:[(0,Q.jsx)(R,{width:`100%`,height:`100%`,children:(0,Q.jsxs)(ji,{children:[(0,Q.jsx)(ir,{data:v,cx:`50%`,cy:`50%`,innerRadius:45,outerRadius:70,paddingAngle:2,dataKey:`value`,children:v.map((e,t)=>(0,Q.jsx)(un,{fill:e.hex,stroke:`#1a1a1a`,strokeWidth:1},`color-${t}`))}),(0,Q.jsx)(P,{contentStyle:{backgroundColor:`#2d2d2d`,border:`1px solid #3d3d3d`,borderRadius:`8px`},formatter:e=>[c===`weight`?$(Number(e??0)):`${e??0}`,a(c===`weight`?`stats.filamentByWeight`:`stats.filamentByPrints`)]})]})}),(0,Q.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center`,children:[(0,Q.jsx)(`span`,{className:`text-lg font-bold text-white`,children:c===`weight`?$(e):e}),(0,Q.jsxs)(`span`,{className:`text-[10px] text-bambu-gray`,children:[v.length,` `,v.length===1?`color`:`colors`]})]})]}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 mt-2`,children:v.slice(0,8).map(t=>{let n=e>0?(t.value/e*100).toFixed(0):0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs min-w-0`,children:[(0,Q.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 border border-black/20`,style:{backgroundColor:t.hex}}),(0,Q.jsxs)(`span`,{className:`text-bambu-gray truncate`,children:[n,`%`]})]},t.hex)})}),v.length>8&&(0,Q.jsxs)(`p`,{className:`text-[10px] text-bambu-gray mt-1 text-center`,children:[`+`,v.length-8,` more`]})]})})():(0,Q.jsx)(`div`,{className:`h-[160px] flex items-center justify-center text-bambu-gray`,children:a(`stats.noColorData`)})]})]})]})}function Bi(e){return Math.abs(e)>=1e3?`${(e/1e3).toFixed(2)} kg`:`${Math.round(e)} g`}function Vi({currency:e,dateFrom:t,dateTo:n}){let{t:o}=i(),{data:s,isLoading:c,isError:l}=a({queryKey:[`supplier-stats`,t??`all`,n??`all`],queryFn:()=>r.getSupplierStats(t,n)});return c?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(O,{className:`w-6 h-6 text-bambu-green animate-spin`})}):l?(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-red-400 py-4`,children:[(0,Q.jsx)(Ut,{className:`w-4 h-4`}),o(`stats.suppliers.error`)]}):!s||s.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-bambu-gray py-4`,children:o(`stats.suppliers.empty`)}):(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`text-left text-xs text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,Q.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:o(`stats.suppliers.supplier`)}),(0,Q.jsx)(`th`,{className:`py-2 pr-4 font-medium text-right`,children:o(`stats.suppliers.spools`)}),(0,Q.jsx)(`th`,{className:`py-2 pr-4 font-medium text-right`,children:o(`stats.suppliers.remaining`)}),(0,Q.jsx)(`th`,{className:`py-2 pr-4 font-medium text-right`,children:o(`stats.suppliers.consumed`)}),(0,Q.jsx)(`th`,{className:`py-2 font-medium text-right`,children:o(`stats.suppliers.cost`)})]})}),(0,Q.jsx)(`tbody`,{children:s.map(t=>(0,Q.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 last:border-b-0`,children:[(0,Q.jsx)(`td`,{className:`py-2 pr-4 text-white font-medium`,children:t.supplier_name}),(0,Q.jsx)(`td`,{className:`py-2 pr-4 text-bambu-gray text-right`,children:t.spool_count}),(0,Q.jsx)(`td`,{className:`py-2 pr-4 text-bambu-gray text-right`,children:Bi(t.remaining_g)}),(0,Q.jsx)(`td`,{className:`py-2 pr-4 text-bambu-gray text-right`,children:Bi(t.consumed_g)}),(0,Q.jsxs)(`td`,{className:`py-2 text-bambu-gray text-right`,children:[e,` `,t.cost.toFixed(2)]})]},t.supplier_id))})]})})}function Hi(e){return Math.abs(e)>=1e3?`${(e/1e3).toFixed(2)} kg`:`${Math.round(e)} g`}function Ui({currency:e,dateFrom:t,dateTo:n}){let{t:o}=i(),{data:s,isLoading:c,isError:l}=a({queryKey:[`material-number-stats`,t??null,n??null],queryFn:()=>r.getMaterialNumberStats({dateFrom:t,dateTo:n})});return c?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(O,{className:`w-6 h-6 text-bambu-green animate-spin`})}):l?(0,Q.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-400 py-4`,children:o(`stats.materialNumbers.loadFailed`)}):!s||s.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-bambu-gray py-4`,children:o(`stats.materialNumbers.empty`)}):(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`text-left text-xs text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,Q.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:o(`inventory.materialNumber`)}),(0,Q.jsx)(`th`,{className:`py-2 pr-4 font-medium text-right`,children:o(`stats.materialNumbers.spools`)}),(0,Q.jsx)(`th`,{className:`py-2 pr-4 font-medium text-right`,children:o(`stats.materialNumbers.remaining`)}),(0,Q.jsx)(`th`,{className:`py-2 pr-4 font-medium text-right`,children:o(`stats.materialNumbers.consumed`)}),(0,Q.jsx)(`th`,{className:`py-2 font-medium text-right`,children:o(`stats.materialNumbers.cost`)})]})}),(0,Q.jsx)(`tbody`,{children:s.map(t=>(0,Q.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 last:border-b-0`,children:[(0,Q.jsx)(`td`,{className:`py-2 pr-4 text-white font-medium`,children:t.material_number}),(0,Q.jsx)(`td`,{className:`py-2 pr-4 text-bambu-gray text-right`,children:t.spool_count}),(0,Q.jsx)(`td`,{className:`py-2 pr-4 text-bambu-gray text-right`,children:Hi(t.remaining_g)}),(0,Q.jsx)(`td`,{className:`py-2 pr-4 text-bambu-gray text-right`,children:Hi(t.consumed_g)}),(0,Q.jsxs)(`td`,{className:`py-2 text-bambu-gray text-right`,children:[e,` `,t.cost.toFixed(2)]})]},t.material_number))})]})})}function Wi({id:e,title:t,component:n,isHidden:r,size:i,columnSpan:a,onToggleVisibility:o,onToggleSize:c}){let{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:m,isDragging:h}=s({id:e}),g={transform:p.Transform.toString(f),transition:m,opacity:h?.5:1};return r?null:(0,Q.jsxs)(`div`,{ref:d,style:{...g,gridColumn:`span ${a}`},className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary overflow-hidden ${h?`ring-2 ring-bambu-green shadow-lg`:``}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary bg-bambu-dark/30`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`button`,{...l,...u,className:`cursor-grab active:cursor-grabbing p-1 hover:bg-bambu-dark-tertiary rounded transition-colors`,title:`Drag to reorder`,children:(0,Q.jsx)(D,{className:`w-6 h-6 md:w-4 md:h-4 text-bambu-gray`})}),(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:t})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{onClick:c,className:`p-1 hover:bg-bambu-dark-tertiary rounded transition-colors`,title:`Size: ${i===1?`1/4`:i===2?`1/2`:`Full`} - Click to cycle`,children:i===4?(0,Q.jsx)(A,{className:`w-4 h-4 text-bambu-gray hover:text-white`}):(0,Q.jsx)(k,{className:`w-4 h-4 text-bambu-gray hover:text-white`})}),(0,Q.jsx)(`button`,{onClick:o,className:`p-1 hover:bg-bambu-dark-tertiary rounded transition-colors`,title:`Hide widget`,children:(0,Q.jsx)(E,{className:`w-4 h-4 text-bambu-gray hover:text-white`})})]})]}),(0,Q.jsx)(`div`,{className:`p-4`,children:typeof n==`function`?n(i):n})]})}function Gi({widgets:e,storageKey:t,columns:n=4,stackBelow:r,hideControls:i=!1,onResetLayout:a,renderControls:o}){let s=()=>{let t={};return e.forEach(e=>{t[e.id]=e.defaultSize||4}),t},[u,p]=(0,q.useState)(()=>{let n=localStorage.getItem(t);if(n)try{let e=JSON.parse(n);if(!e.sizes)e.sizes=s();else{let t=s();for(let n in t)n in e.sizes||(e.sizes[n]=t[n])}return e}catch{}return{order:e.map(e=>e.id),hidden:e.filter(e=>e.defaultVisible===!1).map(e=>e.id),sizes:s()}}),[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(!1);(0,q.useEffect)(()=>{if(!r)return;let e=window.matchMedia(`(max-width: ${r}px)`),t=e=>{C(e.matches)};t(e);let n=e=>t(e);return e.addEventListener?e.addEventListener(`change`,n):e.addListener(n),()=>{e.removeEventListener?e.removeEventListener(`change`,n):e.removeListener(n)}},[r]);let w=r&&S?1:n;(0,q.useEffect)(()=>{let e=()=>x(e=>!e);return window.addEventListener(`toggle-hidden-panel`,e),()=>window.removeEventListener(`toggle-hidden-panel`,e)},[]),(0,q.useEffect)(()=>{localStorage.setItem(t,JSON.stringify(u))},[u,t]),(0,q.useEffect)(()=>{let t=e.map(e=>e.id).filter(e=>!u.order.includes(e));t.length>0&&p(e=>({...e,order:[...e.order,...t]}))},[e,u.order]);let T=h(l(y,{activationConstraint:{distance:8}}),l(f,{coordinateGetter:d})),E=e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&p(e=>{let r=e.order.indexOf(t.id),i=e.order.indexOf(n.id);return{...e,order:m(e.order,r,i)}})},ee=e=>{p(t=>({...t,hidden:t.hidden.includes(e)?t.hidden.filter(t=>t!==e):[...t.hidden,e]}))},D=e=>{p(t=>{let n=t.sizes[e]||4,r=n===1?2:n===2?4:1;return{...t,sizes:{...t.sizes,[e]:r}}})},O=()=>{p({order:e.map(e=>e.id),hidden:e.filter(e=>e.defaultVisible===!1).map(e=>e.id),sizes:s()}),a?.()},k=u.order.map(t=>e.find(e=>e.id===t)).filter(Boolean),A=k.filter(e=>!u.hidden.includes(e.id)),j=k.filter(e=>u.hidden.includes(e.id)),M=o?.({hiddenCount:j.length,showHiddenPanel:b,setShowHiddenPanel:x,resetLayout:O});return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[M,!i&&!o&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,Q.jsxs)(W,{variant:`secondary`,size:`sm`,onClick:O,children:[(0,Q.jsx)(Jt,{className:`w-4 h-4`}),`Reset Layout`]}),j.length>0&&(0,Q.jsxs)(W,{variant:`secondary`,size:`sm`,onClick:()=>x(!b),children:[(0,Q.jsx)(Zt,{className:`w-4 h-4`}),j.length,` Hidden`]})]}),b&&j.length>0&&(0,Q.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-xl border border-bambu-dark-tertiary`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:`Hidden widgets (click to show):`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:j.map(e=>(0,Q.jsxs)(`button`,{onClick:()=>ee(e.id),className:`px-3 py-1.5 bg-bambu-dark-tertiary hover:bg-bambu-green/20 rounded-lg text-sm text-white transition-colors flex items-center gap-2`,children:[(0,Q.jsx)(Zt,{className:`w-3 h-3`}),e.title]},e.id))})]}),(0,Q.jsx)(_,{sensors:T,collisionDetection:c,onDragEnd:E,children:(0,Q.jsx)(v,{items:A.map(e=>e.id),strategy:g,children:(0,Q.jsx)(`div`,{className:`grid gap-6`,style:{gridTemplateColumns:`repeat(${w}, minmax(0, 1fr))`},children:A.map(e=>{let t=u.sizes[e.id]||2,n=Math.min(t,w);return(0,Q.jsx)(Wi,{id:e.id,title:e.title,component:e.component,isHidden:u.hidden.includes(e.id),size:t,columnSpan:n,onToggleVisibility:()=>ee(e.id),onToggleSize:()=>D(e.id)},e.id)})})})}),A.length===0&&(0,Q.jsxs)(`div`,{className:`text-center py-12 text-bambu-gray`,children:[(0,Q.jsx)(`p`,{children:`All widgets are hidden.`}),(0,Q.jsx)(W,{className:`mt-4`,onClick:O,children:`Reset Layout`})]})]})}function Ki(e){let t=new Date,n=t.getUTCFullYear(),r=t.getUTCMonth(),i=t.getUTCDate(),a=e=>e.toISOString().split(`T`)[0],o=a(t);switch(e){case`today`:return{dateFrom:o,dateTo:o};case`this-week`:{let e=t.getUTCDay();return{dateFrom:a(new Date(Date.UTC(n,r,i-(e===0?6:e-1)))),dateTo:o}}case`this-month`:return{dateFrom:a(new Date(Date.UTC(n,r,1))),dateTo:o};case`last-7`:return{dateFrom:a(new Date(Date.UTC(n,r,i-6))),dateTo:o};case`last-30`:return{dateFrom:a(new Date(Date.UTC(n,r,i-29))),dateTo:o};case`last-90`:return{dateFrom:a(new Date(Date.UTC(n,r,i-89))),dateTo:o};case`this-year`:return{dateFrom:a(new Date(Date.UTC(n,0,1))),dateTo:o};case`all-time`:return{dateFrom:void 0,dateTo:void 0};case`custom`:return{}}}var qi=[`today`,`this-week`,`this-month`,`last-7`,`last-30`,`last-90`,`this-year`,`all-time`],Ji=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Yi=[`12am`,`1am`,`2am`,`3am`,`4am`,`5am`,`6am`,`7am`,`8am`,`9am`,`10am`,`11am`,`12pm`,`1pm`,`2pm`,`3pm`,`4pm`,`5pm`,`6pm`,`7pm`,`8pm`,`9pm`,`10pm`,`11pm`],Xi=[{key:`<30m`,max:1800},{key:`30m-1h`,max:3600},{key:`1-2h`,max:7200},{key:`2-4h`,max:14400},{key:`4-8h`,max:28800},{key:`8-12h`,max:43200},{key:`12-24h`,max:86400},{key:`24h+`,max:1/0}],Zi={backgroundColor:`#2d2d2d`,border:`1px solid #3d3d3d`,borderRadius:`8px`};function Qi({stats:e,currency:t}){let{t:n}=i(),r=e?.energy_data_warming_up===!0,a=r?n(`stats.energyWarmingUpTooltip`):void 0;return(0,Q.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-4`,children:[{icon:j,color:`text-bambu-green`,label:n(`stats.totalPrints`),value:`${e?.total_prints||0}`},{icon:Xt,color:`text-blue-600 dark:text-blue-400`,label:n(`stats.printTime`),value:`${e?.total_print_time_hours?.toFixed(1)??`0`}h`},{icon:j,color:`text-orange-600 dark:text-orange-400`,label:n(`stats.filamentUsed`),value:$(e?.total_filament_grams||0)},{icon:T,color:`text-green-600 dark:text-green-400`,label:n(`stats.filamentCost`),value:`${t} ${e?.total_cost?.toFixed(2)??`0.00`}`},{icon:$t,color:`text-yellow-600 dark:text-yellow-400`,label:n(`stats.energyUsed`),value:`${e?.total_energy_kwh?.toFixed(3)??`0.000`} kWh`,warning:r,tooltip:a},{icon:T,color:`text-yellow-500`,label:n(`stats.energyCost`),value:`${t} ${e?.total_energy_cost?.toFixed(2)??`0.00`}`,warning:r,tooltip:a},...(e?.total_wear_cost??0)>0?[{icon:tn,color:`text-slate-500 dark:text-slate-300`,label:n(`stats.wearCost`),value:`${t} ${e?.total_wear_cost?.toFixed(2)??`0.00`}`,warning:!1,tooltip:void 0}]:[]].map(e=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,title:e.tooltip,children:[(0,Q.jsx)(`div`,{className:`p-2 rounded-lg bg-bambu-dark ${e.color}`,children:(0,Q.jsx)(e.icon,{className:`w-5 h-5`})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`p`,{className:`text-xs text-bambu-gray flex items-center gap-1`,children:[e.label,e.warning&&(0,Q.jsx)(Ut,{className:`w-3 h-3 text-yellow-600 dark:text-yellow-400`,"aria-label":e.tooltip})]}),(0,Q.jsx)(`p`,{className:`text-xl font-bold text-white`,children:e.value})]})]},e.label))})}function $i({stats:e,printerMap:t,size:n=1}){let{t:r}=i(),a=(e?.successful_prints||0)+(e?.failed_prints||0),o=a?Math.round((e?.successful_prints||0)/a*100):0,s=n===1?112:n===2?128:144,c=s/2-8,l=c*2*Math.PI;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,Q.jsxs)(`div`,{className:`relative flex-shrink-0`,style:{width:s,height:s},children:[(0,Q.jsxs)(`svg`,{className:`w-full h-full -rotate-90`,children:[(0,Q.jsx)(`circle`,{cx:s/2,cy:s/2,r:c,fill:`none`,stroke:`#3d3d3d`,strokeWidth:`10`}),(0,Q.jsx)(`circle`,{cx:s/2,cy:s/2,r:c,fill:`none`,stroke:`#00ae42`,strokeWidth:`10`,strokeLinecap:`round`,strokeDasharray:`${o/100*l} ${l}`})]}),(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,Q.jsxs)(`span`,{className:`font-bold text-white ${n>=2?`text-2xl`:`text-xl`}`,children:[o,`%`]})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(w,{className:`w-4 h-4 text-status-ok flex-shrink-0`}),(0,Q.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:r(`stats.successful`)}),(0,Q.jsx)(`span`,{className:`text-sm text-white font-medium`,children:e?.successful_prints||0})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(S,{className:`w-4 h-4 text-status-error flex-shrink-0`}),(0,Q.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:r(`stats.failed`)}),(0,Q.jsx)(`span`,{className:`text-sm text-white font-medium`,children:e?.failed_prints||0})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(u,{className:`w-4 h-4 text-status-warning flex-shrink-0`}),(0,Q.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:r(`stats.cancelled`)}),(0,Q.jsx)(`span`,{className:`text-sm text-white font-medium`,children:e?.cancelled_prints||0})]})]}),n>=2&&e?.prints_by_printer&&Object.keys(e.prints_by_printer).length>0&&(0,Q.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-bambu-gray font-medium mb-2`,children:r(`stats.printsByPrinter`)}),(0,Q.jsx)(`div`,{className:`grid gap-x-6 gap-y-1 ${n===4?`grid-cols-3`:`grid-cols-2`}`,style:{width:`fit-content`},children:Object.entries(e.prints_by_printer).map(([e,n])=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-bambu-gray truncate max-w-[120px]`,children:t.get(e)||`${r(`common.printer`)} ${e}`}),(0,Q.jsx)(`span`,{className:`text-white font-medium`,children:n})]},e))})]})]})]})}function ea({stats:e,printerMap:t,size:n=1}){let{t:r}=i(),a=e?.average_time_accuracy;if(a==null)return(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Q.jsx)(`p`,{className:`text-bambu-gray text-center py-4`,children:r(`stats.noTimeAccuracyData`)})});let o=(Math.min(150,Math.max(50,a))-50)/100*100,s=(e=>e>=95&&e<=105?`#00ae42`:e>105?`#3b82f6`:`#f97316`)(a),c=a-100,l=n===1?112:n===2?128:144,u=l/2-8,d=u*2*Math.PI,f=n===1?3:n===2?6:999,p=e?.time_accuracy_by_printer?Object.entries(e.time_accuracy_by_printer).slice(0,f):[];return(0,Q.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,Q.jsxs)(`div`,{className:`relative flex-shrink-0`,style:{width:l,height:l},children:[(0,Q.jsxs)(`svg`,{className:`w-full h-full -rotate-90`,children:[(0,Q.jsx)(`circle`,{cx:l/2,cy:l/2,r:u,fill:`none`,stroke:`#3d3d3d`,strokeWidth:`10`}),(0,Q.jsx)(`circle`,{cx:l/2,cy:l/2,r:u,fill:`none`,stroke:s,strokeWidth:`10`,strokeLinecap:`round`,strokeDasharray:`${o/100*d} ${d}`})]}),(0,Q.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center`,children:[(0,Q.jsxs)(`span`,{className:`font-bold text-white ${n>=2?`text-2xl`:`text-xl`}`,children:[a.toFixed(0),`%`]}),(0,Q.jsxs)(`span`,{className:`text-xs ${c>=0?`text-blue-700 dark:text-blue-400`:`text-orange-700 dark:text-orange-400`}`,children:[c>=0?`+`:``,c.toFixed(0),`%`]})]})]}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray`,children:[(0,Q.jsx)(M,{className:`w-3 h-3 flex-shrink-0`}),(0,Q.jsx)(`span`,{children:r(`stats.perfectEstimate`)})]}),p.length>0&&(0,Q.jsx)(`div`,{className:`mt-2 ${n===4?`grid grid-cols-3 gap-x-6 gap-y-1`:n===2?`grid grid-cols-2 gap-x-6 gap-y-1`:`space-y-1`}`,style:{width:`fit-content`},children:p.map(([e,n])=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`span`,{className:`text-bambu-gray truncate max-w-[100px]`,children:t.get(e)||`${r(`common.printer`)} ${e}`}),(0,Q.jsxs)(`span`,{className:`font-medium ${n>=95&&n<=105?`text-status-ok`:n>105?`text-blue-700 dark:text-blue-400`:`text-status-warning`}`,children:[n.toFixed(0),`%`]})]},e))})]})]})}function ta({printDates:e,dateFrom:t,dateTo:n}){let{days:r,hourlyCounts:i,maxCount:a}=(0,q.useMemo)(()=>{let r=new Date(t+`T00:00:00`),i=new Date(n+`T00:00:00`),a=[],o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`,s=new Date(r);for(;s<=i;)a.push({key:o(s),label:s.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})}),s.setDate(s.getDate()+1);let c={},l=0;return e.forEach(e=>{let t=Kt(e);if(!t)return;let n=`${`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}-${t.getHours()}`;c[n]=(c[n]||0)+1,c[n]>l&&(l=c[n])}),{days:a,hourlyCounts:c,maxCount:Math.max(1,l)}},[e,t,n]),o=e=>{if(e===0)return`bg-bambu-dark`;let t=e/a;return t<=.25?`bg-bambu-green/30`:t<=.5?`bg-bambu-green/50`:t<=.75?`bg-bambu-green/75`:`bg-bambu-green`};return(0,Q.jsxs)(`div`,{className:`w-full overflow-x-auto`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex flex-col`,style:{gap:2},children:[(0,Q.jsx)(`div`,{className:`flex`,style:{gap:2,marginLeft:84},children:Yi.map((e,t)=>(0,Q.jsx)(`div`,{className:`text-bambu-gray text-[10px] text-center`,style:{width:20,visibility:t%2==0?`visible`:`hidden`},children:e},t))}),r.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center`,style:{gap:2},children:[(0,Q.jsx)(`div`,{className:`text-bambu-gray text-[10px] flex-shrink-0 truncate`,style:{width:80},children:e.label}),Array.from({length:24},(t,n)=>{let r=i[`${e.key}-${n}`]||0;return(0,Q.jsx)(`div`,{className:`rounded-sm ${o(r)}`,style:{width:20,height:20},title:`${e.label} ${Yi[n]}: ${r} print${r===1?``:`s`}`},n)})]},e.key))]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mt-3 text-bambu-gray text-xs`,children:[(0,Q.jsx)(`span`,{children:`Less`}),(0,Q.jsxs)(`div`,{className:`flex`,style:{gap:2},children:[(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-dark`,style:{width:20,height:20}}),(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-green/30`,style:{width:20,height:20}}),(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-green/50`,style:{width:20,height:20}}),(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-green/75`,style:{width:20,height:20}}),(0,Q.jsx)(`div`,{className:`rounded-sm bg-bambu-green`,style:{width:20,height:20}})]}),(0,Q.jsx)(`span`,{children:`More`})]})]})}function na({printDates:e,size:t=2,dateFrom:n,dateTo:r}){let i=(0,q.useMemo)(()=>n&&r?Math.max((new Date(r).getTime()-new Date(n).getTime())/864e5,0)+1:n?Math.max((Date.now()-new Date(n).getTime())/864e5,0)+1:1/0,[n,r]);return i<=7&&n&&r?(0,Q.jsx)(ta,{printDates:e,dateFrom:n,dateTo:r}):(0,Q.jsx)(Mi,{printDates:e,months:i===1/0?t===1?3:t===2?6:12:Math.max(1,Math.ceil(i/30))})}function ra({stats:e,archives:t,printerMap:n}){let{t:r}=i(),[a,o]=(0,q.useState)(`weight`),[s,c]=(0,q.useState)(`weight`),l=(0,q.useMemo)(()=>{let i=new Map;return e?.prints_by_printer&&Object.entries(e.prints_by_printer).forEach(([e,t])=>{let n=i.get(e)||{prints:0,weight:0,time:0};n.prints=t,i.set(e,n)}),t.forEach(t=>{if(!t.printer_id)return;let n=String(t.printer_id),r=i.get(n)||{prints:0,weight:0,time:0};r.weight+=t.filament_used_grams||0,r.time+=t.actual_time_seconds||t.print_time_seconds||0,e?.prints_by_printer||r.prints++,i.set(n,r)}),Array.from(i.entries()).map(([e,t])=>({name:n.get(e)||`${r(`common.printer`)} ${e}`,value:a===`prints`?t.prints:a===`weight`?Math.round(t.weight):Math.round(t.time/3600*10)/10})).sort((e,t)=>t.value-e.value)},[e,t,n,a,r]),u=(0,q.useMemo)(()=>{let e=Array.from({length:24},(e,t)=>({hour:t,label:Yi[t],total:0,failures:0}));return t.forEach(t=>{if(!t.started_at)return;let n=Kt(t.started_at);if(!n)return;let r=n.getHours();e[r].total++,t.status===`failed`&&e[r].failures++}),e},[t]),d=(0,q.useMemo)(()=>{let e=Xi.map(e=>({name:e.key,count:0}));return t.forEach(t=>{let n=t.actual_time_seconds||t.print_time_seconds;if(!(!n||n<=0)){for(let t=0;t{let e=[0,0,0,0,0,0,0],n=new Set;t.forEach(t=>{let r=Kt(t.created_at)||new Date(t.created_at),i=r.getDay()-1;i<0&&(i=6),s===`prints`?e[i]++:s===`weight`?e[i]+=t.filament_used_grams||0:e[i]+=(t.actual_time_seconds||t.print_time_seconds||0)/3600;let a=new Date(r);a.setDate(r.getDate()-(r.getDay()+6)%7),n.add(`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,`0`)}-${String(a.getDate()).padStart(2,`0`)}`)});let r=Math.max(n.size,1);return Ji.map((t,n)=>({name:t,avg:Math.round(e[n]/r*10)/10}))},[t,s]),p=e=>({unit:e===`weight`?`g`:e===`time`?`h`:``,color:e===`weight`?`#00ae42`:e===`time`?`#3b82f6`:`#f59e0b`}),m=p(a),h=r(a===`weight`?`stats.filamentByWeight`:a===`time`?`stats.hours`:`common.prints`),g=p(s),_=r(s===`weight`?`stats.avgWeight`:s===`time`?`stats.avgTime`:`stats.avgPrints`);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray`,children:r(`stats.printsByPrinter`)}),(0,Q.jsx)(Pi,{value:a,onChange:o})]}),l.length>0?(0,Q.jsx)(R,{width:`100%`,height:Math.max(140,l.length*40),children:(0,Q.jsxs)(gi,{data:l,layout:`vertical`,margin:{left:10},children:[(0,Q.jsx)(yt,{strokeDasharray:`3 3`,stroke:`#3d3d3d`}),(0,Q.jsx)(Ze,{type:`number`,stroke:`#9ca3af`,tick:{fontSize:11},unit:m.unit}),(0,Q.jsx)(Tt,{type:`category`,dataKey:`name`,stroke:`#9ca3af`,tick:{fontSize:11},width:100}),(0,Q.jsx)(P,{contentStyle:Zi,formatter:e=>[a===`weight`?$(Number(e??0)):`${e??0}${m.unit}`,h]}),(0,Q.jsx)(mi,{dataKey:`value`,fill:m.color,radius:[0,4,4,0]})]})}):(0,Q.jsx)(`p`,{className:`text-bambu-gray text-center py-4`,children:r(`stats.noPrinterData`)})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray mb-3`,children:r(`stats.printDuration`)}),t.length>0?(0,Q.jsx)(R,{width:`100%`,height:160,children:(0,Q.jsxs)(gi,{data:d,children:[(0,Q.jsx)(yt,{strokeDasharray:`3 3`,stroke:`#3d3d3d`}),(0,Q.jsx)(Ze,{dataKey:`name`,stroke:`#9ca3af`,tick:{fontSize:11}}),(0,Q.jsx)(Tt,{stroke:`#9ca3af`,tick:{fontSize:11},allowDecimals:!1}),(0,Q.jsx)(P,{contentStyle:Zi}),(0,Q.jsx)(mi,{dataKey:`count`,name:r(`common.prints`),fill:`#00ae42`,radius:[4,4,0,0]})]})}):(0,Q.jsx)(`p`,{className:`text-bambu-gray text-center py-4`,children:r(`stats.noArchiveData`)})]}),(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray`,children:r(`stats.printHabits`)}),(0,Q.jsx)(Pi,{value:s,onChange:c})]}),t.length>0?(0,Q.jsx)(R,{width:`100%`,height:160,children:(0,Q.jsxs)(gi,{data:f,children:[(0,Q.jsx)(yt,{strokeDasharray:`3 3`,stroke:`#3d3d3d`}),(0,Q.jsx)(Ze,{dataKey:`name`,stroke:`#9ca3af`,tick:{fontSize:11}}),(0,Q.jsx)(Tt,{stroke:`#9ca3af`,tick:{fontSize:11},unit:g.unit}),(0,Q.jsx)(P,{contentStyle:Zi,formatter:e=>[`${e??0}${g.unit}`,_]}),(0,Q.jsx)(mi,{dataKey:`avg`,fill:g.color,radius:[4,4,0,0]})]})}):(0,Q.jsx)(`p`,{className:`text-bambu-gray text-center py-4`,children:r(`stats.noArchiveData`)})]}),(0,Q.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-bambu-gray mb-3`,children:r(`stats.printTimeOfDay`)}),t.length>0?(0,Q.jsx)(R,{width:`100%`,height:160,children:(0,Q.jsxs)(gi,{data:u,children:[(0,Q.jsx)(yt,{strokeDasharray:`3 3`,stroke:`#3d3d3d`}),(0,Q.jsx)(Ze,{dataKey:`label`,stroke:`#9ca3af`,tick:{fontSize:10},interval:5}),(0,Q.jsx)(Tt,{stroke:`#9ca3af`,tick:{fontSize:11},allowDecimals:!1}),(0,Q.jsx)(P,{contentStyle:Zi}),(0,Q.jsx)(mi,{dataKey:`total`,name:r(`stats.totalPrints`),fill:`#00ae42`,radius:[2,2,0,0]}),(0,Q.jsx)(mi,{dataKey:`failures`,name:r(`stats.failed`),fill:`#ef4444`,radius:[2,2,0,0]})]})}):(0,Q.jsx)(`p`,{className:`text-bambu-gray text-center py-4`,children:r(`stats.noArchiveData`)})]})]})]})}function ia({archives:e,currency:t,dateFrom:n,dateTo:r}){let{t:a}=i();return!e||e.length===0?(0,Q.jsx)(`p`,{className:`text-bambu-gray text-center py-4`,children:a(`stats.noPrintData`)}):(0,Q.jsx)(zi,{archives:e,currency:t,dateFrom:n,dateTo:r})}function aa({size:e=1,dateFrom:t,dateTo:n,createdById:o}){let{t:s}=i(),c=!!(t||n),{data:l,isLoading:u}=a({queryKey:[`failureAnalysis`,t,n,o??`all`],queryFn:()=>r.getFailureAnalysis({...c?{dateFrom:t,dateTo:n}:{days:30},createdById:o})});if(u)return(0,Q.jsx)(`div`,{className:`flex justify-center py-4`,children:(0,Q.jsx)(O,{className:`w-6 h-6 text-bambu-green animate-spin`})});if(!l||l.total_prints===0)return(0,Q.jsx)(`p`,{className:`text-bambu-gray text-center py-4`,children:s(c?`stats.noPrintDataInRange`:`stats.noPrintDataLast30Days`)});let d=e===1?5:e===2?8:999,f=Object.entries(l.failures_by_reason).sort(([,e],[,t])=>t-e),p=f.slice(0,d),m=f.length>d;return(0,Q.jsxs)(`div`,{className:`${e>=2?`flex gap-8`:`space-y-4`}`,children:[(0,Q.jsxs)(`div`,{className:e>=2?`flex-shrink-0`:``,children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ut,{className:`w-5 h-5 ${l.failure_rate>20?`text-status-error`:l.failure_rate>10?`text-status-warning`:`text-status-ok`}`}),(0,Q.jsxs)(`span`,{className:`font-bold text-white ${e>=2?`text-3xl`:`text-2xl`}`,children:[l.failure_rate.toFixed(1),`%`]})]})}),(0,Q.jsx)(`div`,{className:`text-sm text-bambu-gray mt-1`,children:s(`stats.failedPrintsCount`,{failed:l.failed_prints,total:l.total_prints})}),(l.rejected_prints??0)>0&&(0,Q.jsxs)(`div`,{className:`text-sm mt-1`,children:[(0,Q.jsx)(`span`,{className:`text-status-warning`,children:s(`stats.rejectedPrintsCount`,{rejected:l.rejected_prints})}),(0,Q.jsx)(`span`,{className:`text-bambu-gray ml-2`,children:s(`stats.yieldRate`,{rate:(l.yield_rate??0).toFixed(1)})})]}),l.trend&&l.trend.length>=2&&(0,Q.jsx)(`div`,{className:`${e>=2?`mt-4`:`mt-2 pt-2 border-t border-bambu-dark-tertiary`}`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(Ie,{className:`w-4 h-4 ${l.trend[l.trend.length-1].failure_rate0&&(0,Q.jsxs)(`div`,{className:`flex-1 ${e>=2?`border-l border-bambu-dark-tertiary pl-8`:`pt-2`}`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-bambu-gray font-medium mb-2`,children:s(e>=2?`stats.failureReasons`:`stats.topFailureReasons`)}),(0,Q.jsx)(`div`,{className:`${e===4?`grid grid-cols-2 gap-x-6 gap-y-1`:`space-y-1`}`,children:p.map(([t,n])=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-white truncate ${e===4?`max-w-[200px]`:`max-w-[160px]`}`,children:t?s(`editArchive.failureReasons.${t}`,{defaultValue:t}):s(`common.unknown`)}),(0,Q.jsx)(`span`,{className:`text-bambu-gray ml-2`,children:n})]},t))}),m&&(0,Q.jsx)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:s(`common.more`,{count:f.length-d})})]})]})}function oa({archives:e,currency:t}){let{t:n}=i(),r=(0,q.useMemo)(()=>{let r=[];if(e.length===0)return r;let i=t=>{let n=null,r=0;return e.forEach(e=>{let i=t(e);i&&i>r&&(r=i,n=e)}),{archive:n,value:r}},a=i(e=>e.status===`completed`?e.actual_time_seconds:null);a.archive&&r.push({icon:Xt,iconColor:`text-blue-600 dark:text-blue-400`,label:n(`stats.longestPrint`),value:Gt(a.value),detail:a.archive.print_name||null});let o=i(e=>e.filament_used_grams);o.archive&&r.push({icon:j,iconColor:`text-orange-600 dark:text-orange-400`,label:n(`stats.heaviestPrint`),value:$(o.value),detail:o.archive.print_name||null});let s=i(e=>(e.cost??0)+(e.energy_cost??0)+(e.wear_cost??0));s.archive&&r.push({icon:T,iconColor:`text-green-600 dark:text-green-400`,label:n(`stats.mostExpensivePrint`),value:`${t}${s.value.toFixed(2)}`,detail:s.archive.print_name||null});let c=new Map;e.forEach(e=>{let t=Kt(e.created_at)||new Date(e.created_at),n=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`;c.set(n,(c.get(n)||0)+1)});let l=``,u=0;c.forEach((e,t)=>{e>u&&(u=e,l=t)}),u>1&&r.push({icon:b,iconColor:`text-purple-600 dark:text-purple-400`,label:n(`stats.busiestDay`),value:`${u} ${n(`common.prints`)}`,detail:(()=>{let[e,t,n]=l.split(`-`).map(Number);return new Date(e,t-1,n).toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})})()});let d=[...e].filter(e=>e.status===`completed`||e.status===`failed`).sort((e,t)=>new Date(t.completed_at||t.created_at).getTime()-new Date(e.completed_at||e.created_at).getTime()),f=0;for(let e of d)if(e.status===`completed`)f++;else break;return f>0&&r.push({icon:$t,iconColor:`text-yellow-600 dark:text-yellow-400`,label:n(`stats.successStreak`),value:`${f}`,detail:f===1?n(`stats.streakPrint`):n(`stats.streakPrints`,{count:f})}),r},[e,t,n]);return r.length===0?(0,Q.jsx)(`p`,{className:`text-bambu-gray text-center py-4`,children:n(`stats.noArchiveData`)}):(0,Q.jsx)(`div`,{className:`space-y-3`,children:r.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`div`,{className:`p-1.5 rounded-lg bg-bambu-dark ${e.iconColor}`,children:(0,Q.jsx)(e.icon,{className:`w-4 h-4`})}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:e.label}),(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-bold text-white`,children:e.value}),e.detail&&(0,Q.jsx)(`span`,{className:`text-xs text-bambu-gray truncate`,children:e.detail})]})]})]},t))})}function sa(){let{t:e}=i(),{showToast:t}=C(),{hasPermission:n,authEnabled:o}=nn(),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(0),[p,m]=(0,q.useState)(0),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(null),[y,S]=(0,q.useState)(!1),w=o&&n(`stats:filter_by_user`),[T,E]=(0,q.useState)(()=>{try{let e=localStorage.getItem(`bambusy-stats-timeframe`);if(e){let t=JSON.parse(e);if(t.preset)return t}}catch{}return{preset:`all-time`,dateFrom:void 0,dateTo:void 0}}),[D,k]=(0,q.useState)(!1);(0,q.useEffect)(()=>{localStorage.setItem(`bambusy-stats-timeframe`,JSON.stringify(T))},[T]);let A=(0,q.useMemo)(()=>T.preset===`custom`?{dateFrom:T.dateFrom,dateTo:T.dateTo}:Ki(T.preset),[T]);(0,q.useEffect)(()=>{let e=()=>{try{let e=localStorage.getItem(`bambusy-dashboard-layout-v2`);e&&m(JSON.parse(e).hidden?.length||0)}catch{m(0)}};e(),window.addEventListener(`storage`,e);let t=setInterval(e,2e3);return()=>{window.removeEventListener(`storage`,e),clearInterval(t)}},[d]);let j=_===null?void 0:_,{data:M,isLoading:te,isFetching:ne,refetch:re}=a({queryKey:[`archiveStats`,A.dateFrom,A.dateTo,j??`all`],queryFn:()=>r.getArchiveStats({dateFrom:A.dateFrom,dateTo:A.dateTo,createdById:j})}),{data:ie}=a({queryKey:[`printers`],queryFn:r.getPrinters}),{data:ae,isFetching:oe,refetch:se}=a({queryKey:[`archivesSlim`,A.dateFrom,A.dateTo,j??`all`],queryFn:()=>r.getArchivesSlim(A.dateFrom,A.dateTo,j)}),{data:ce}=a({queryKey:[`settings`],queryFn:r.getSettings}),{data:le,isPending:ue}=a({queryKey:[`spoolman-settings`],queryFn:r.getSpoolmanSettings,staleTime:300*1e3}),N=!ue,de=le?.spoolman_enabled===`true`&&!!le?.spoolman_url,{data:fe}=a({queryKey:[`users`,`slim`],queryFn:r.getUsersSlim,enabled:w}),pe=(0,q.useMemo)(()=>_===null?e(`stats.allUsers`,`All Users`):_===-1?e(`stats.noUser`,`No User (System)`):fe?.find(e=>e.id===_)?.username??`?`,[_,fe,e]),me=async n=>{u(!1),c(!0);try{let{blob:i,filename:a}=await r.exportStats({format:n,days:90,createdById:j}),o=URL.createObjectURL(i),s=document.createElement(`a`);s.href=o,s.download=a,s.click(),URL.revokeObjectURL(o),t(e(`stats.exportDownloaded`))}catch{t(e(`stats.exportFailed`),`error`)}finally{c(!1)}},he=async()=>{g(!0);try{let n=await r.recalculateCosts();await Promise.all([re(),se()]),t(e(`stats.recalculatedCosts`,{count:n.updated}))}catch{t(e(`stats.recalculateFailed`),`error`)}finally{g(!1)}},ge=(ne||oe)&&!te,_e=Qt(ce?.currency||`USD`),ve=(0,q.useMemo)(()=>new Map([...Object.entries(M?.printer_names||{}),...ie?.map(e=>[String(e.id),e.name])||[]]),[M?.printer_names,ie]),ye=(0,q.useMemo)(()=>ae?.map(e=>e.created_at)||[],[ae]);if(te)return(0,Q.jsx)(`div`,{className:`p-4 md:p-8`,children:(0,Q.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`stats.loadingStats`)})});let be=[{id:`quick-stats`,title:e(`stats.quickStats`),component:(0,Q.jsx)(Qi,{stats:M,currency:_e}),defaultSize:2},{id:`success-rate`,title:e(`stats.successRate`),component:e=>(0,Q.jsx)($i,{stats:M,printerMap:ve,size:e}),defaultSize:1},{id:`time-accuracy`,title:e(`stats.timeAccuracy`),component:e=>(0,Q.jsx)(ea,{stats:M,printerMap:ve,size:e}),defaultSize:1},{id:`failure-analysis`,title:e(`stats.failureAnalysis`),component:e=>(0,Q.jsx)(aa,{size:e,dateFrom:A.dateFrom,dateTo:A.dateTo,createdById:j}),defaultSize:1},{id:`print-activity`,title:e(`stats.printActivity`),component:e=>(0,Q.jsx)(na,{printDates:ye,size:e,dateFrom:A.dateFrom,dateTo:A.dateTo}),defaultSize:2},{id:`records`,title:e(`stats.records`),component:(0,Q.jsx)(oa,{archives:ae||[],currency:_e}),defaultSize:1},{id:`printer-stats`,title:e(`stats.printerStats`),component:(0,Q.jsx)(ra,{stats:M,archives:ae||[],printerMap:ve}),defaultSize:4},{id:`filament-trends`,title:e(`stats.filamentTrends`),component:(0,Q.jsx)(ia,{archives:ae||[],currency:_e,dateFrom:A.dateFrom,dateTo:A.dateTo}),defaultSize:4},...!N||de?[]:[{id:`suppliers`,title:e(`stats.suppliers.title`),component:(0,Q.jsx)(Vi,{currency:_e,dateFrom:A.dateFrom,dateTo:A.dateTo}),defaultSize:2}],...!N||de?[]:[{id:`material-numbers`,title:e(`stats.materialNumbers.title`),component:(0,Q.jsx)(Ui,{currency:_e,dateFrom:A.dateFrom,dateTo:A.dateTo}),defaultSize:2}]];return(0,Q.jsxs)(`div`,{className:`p-4 md:p-8`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,Q.jsx)(Yt,{className:`w-7 h-7 text-bambu-green`}),e(`stats.title`)]}),ge&&(0,Q.jsx)(O,{className:`w-5 h-5 text-bambu-green animate-spin`})]}),(0,Q.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`stats.subtitle`)})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[p>0&&(0,Q.jsxs)(W,{variant:`secondary`,onClick:()=>{window.dispatchEvent(new CustomEvent(`toggle-hidden-panel`))},children:[(0,Q.jsx)(Zt,{className:`w-4 h-4`}),e(`stats.hiddenCount`,{count:p})]}),(0,Q.jsxs)(W,{variant:`secondary`,onClick:()=>{localStorage.removeItem(`bambusy-dashboard-layout-v2`),f(e=>e+1),t(e(`stats.layoutReset`))},disabled:!n(`settings:update`),title:n(`settings:update`)?void 0:e(`stats.noPermissionResetLayout`),children:[(0,Q.jsx)(Jt,{className:`w-4 h-4`}),e(`stats.resetLayout`)]}),(0,Q.jsxs)(W,{variant:`secondary`,onClick:he,disabled:h||!n(`archives:update_all`),title:n(`archives:update_all`)?e(`stats.recalculateCostsHint`):e(`stats.noPermissionRecalculate`),children:[h?(0,Q.jsx)(O,{className:`w-4 h-4 animate-spin`}):(0,Q.jsx)(ln,{className:`w-4 h-4`}),e(`stats.recalculateCosts`)]}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsxs)(W,{variant:`secondary`,onClick:()=>u(!l),disabled:s,children:[s?(0,Q.jsx)(O,{className:`w-4 h-4 animate-spin`}):(0,Q.jsx)(ee,{className:`w-4 h-4`}),e(`stats.exportStats`)]}),l&&(0,Q.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20`,children:[(0,Q.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-t-lg`,onClick:()=>me(`csv`),children:[(0,Q.jsx)(en,{className:`w-4 h-4`}),e(`stats.exportAsCsv`)]}),(0,Q.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-b-lg`,onClick:()=>me(`xlsx`),children:[(0,Q.jsx)(ee,{className:`w-4 h-4`}),e(`stats.exportAsExcel`)]})]})]}),w&&fe&&fe.length>0&&(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsxs)(W,{variant:`secondary`,onClick:()=>S(!y),children:[(0,Q.jsx)(qt,{className:`w-4 h-4`}),pe,(0,Q.jsx)(x,{className:`w-3 h-3`})]}),y&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>S(!1)}),(0,Q.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20 p-2 max-h-64 overflow-y-auto`,children:[(0,Q.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm rounded-md transition-colors ${_===null?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,onClick:()=>{v(null),S(!1)},children:e(`stats.allUsers`,`All Users`)}),(0,Q.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm rounded-md transition-colors ${_===-1?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,onClick:()=>{v(-1),S(!1)},children:e(`stats.noUser`,`No User (System)`)}),(0,Q.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary my-1`}),fe.map(e=>(0,Q.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm rounded-md transition-colors ${_===e.id?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,onClick:()=>{v(e.id),S(!1)},children:e.username},e.id))]})]})]}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsxs)(W,{variant:`secondary`,onClick:()=>k(!D),children:[(0,Q.jsx)(b,{className:`w-4 h-4`}),e(`stats.timeframe.${T.preset}`),(0,Q.jsx)(x,{className:`w-3 h-3`})]}),D&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>k(!1)}),(0,Q.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-64 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20 p-2`,children:[qi.map(t=>(0,Q.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm rounded-md transition-colors ${T.preset===t?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,onClick:()=>{E({preset:t,dateFrom:void 0,dateTo:void 0}),k(!1)},children:e(`stats.timeframe.${t}`)},t)),(0,Q.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary my-2`}),(0,Q.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm rounded-md transition-colors ${T.preset===`custom`?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,onClick:()=>E(e=>({...e,preset:`custom`})),children:e(`stats.timeframe.custom`)}),T.preset===`custom`&&(0,Q.jsxs)(`div`,{className:`mt-2 px-1 pb-1 space-y-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`text-xs text-bambu-gray block mb-1`,children:e(`stats.timeframe.from`)}),(0,Q.jsx)(`input`,{type:`date`,value:T.dateFrom||``,max:T.dateTo||new Date().toISOString().split(`T`)[0],onChange:e=>E(t=>({...t,dateFrom:e.target.value||void 0})),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-sm text-white`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`text-xs text-bambu-gray block mb-1`,children:e(`stats.timeframe.to`)}),(0,Q.jsx)(`input`,{type:`date`,value:T.dateTo||``,min:T.dateFrom,max:new Date().toISOString().split(`T`)[0],onChange:e=>E(t=>({...t,dateTo:e.target.value||void 0})),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-sm text-white`})]}),(0,Q.jsx)(W,{variant:`primary`,onClick:()=>k(!1),className:`w-full`,children:e(`common.apply`)})]})]})]})]})]})]}),(0,Q.jsx)(Gi,{widgets:be,storageKey:`bambusy-dashboard-layout-v2`,stackBelow:640,hideControls:!0},d)]})}export{sa as StatsPage}; \ No newline at end of file diff --git a/static/assets/StreamOverlayPage-CA9KpVK8.css b/static/assets/StreamOverlayPage-CA9KpVK8.css new file mode 100644 index 000000000..569e90a09 --- /dev/null +++ b/static/assets/StreamOverlayPage-CA9KpVK8.css @@ -0,0 +1 @@ +.classic-overlay[data-layout]{--text-primary:#fff;height:var(--overlay-height);min-height:var(--overlay-height)}.classic-overlay[data-layout=portrait]{--classic-scale:1}.classic-overlay[data-layout=portrait][data-size=small]{--classic-scale:.8}.classic-overlay[data-layout=portrait][data-size=large]{--classic-scale:1.2}.classic-overlay[data-layout=portrait] .classic-overlay__text{font-size:calc(30px * var(--classic-scale));line-height:1.4}.classic-overlay[data-layout=portrait] .classic-overlay__filename{font-size:calc(42px * var(--classic-scale));white-space:normal;overflow-wrap:anywhere;line-height:1.2}.classic-overlay[data-layout=portrait] .classic-overlay__panel{padding:32px}.classic-overlay[data-layout=portrait] .classic-overlay__icon{flex-shrink:0;width:30px;height:30px}.classic-overlay[data-layout=portrait] .classic-overlay__logo{height:120px}.updated-overlay{--overlay-scale:1;--overlay-space:clamp(12px, calc(2.5 * var(--overlay-vmin,1vmin)), 32px);isolation:isolate;min-height:var(--overlay-height,100vh);color:#fff;background:rgb(16 23 27/var(--overlay-background-alpha,1));font-size:calc(clamp(14px, calc(2.2 * var(--overlay-vmin,1vmin)), 28px) * var(--overlay-scale));font-variant-numeric:tabular-nums;flex-direction:column;justify-content:space-between;line-height:1.3;display:flex;position:relative}.updated-overlay[data-size=small]{--overlay-scale:.8}.updated-overlay[data-size=large]{--overlay-scale:1.2}.updated-overlay__header{justify-content:space-between;align-items:flex-start;gap:var(--overlay-space);padding:var(--overlay-space);z-index:1;display:flex}.updated-overlay__identity{background:rgb(12 19 23/var(--overlay-identity-alpha,.9));border-radius:.7em;align-items:center;gap:.7em;min-width:0;padding:.65em .9em;display:flex}.updated-overlay__identity svg{flex-shrink:0;width:2em;height:2em}.updated-overlay__identity div{overflow-wrap:anywhere;min-width:0}.updated-overlay__identity strong{font-size:1.35em;display:block}.updated-overlay__identity span{color:#b8c0c7;display:block}.updated-overlay__logo{flex-shrink:0;margin-left:auto}.updated-overlay__logo>a img{width:clamp(100px, calc(19 * var(--overlay-vmin,1vmin)), 230px);height:auto}.updated-overlay__camera{z-index:-1;position:absolute;inset:0;overflow:hidden}.updated-overlay__camera img{object-fit:cover;width:100%;max-width:none;height:100%;position:absolute;top:50%;left:50%}.updated-overlay__panel{padding:var(--overlay-space);background:rgb(12 19 23/var(--overlay-panel-alpha,.88))}.updated-overlay__summary{justify-content:space-between;align-items:center;gap:1em;margin-bottom:.8em;display:flex}.updated-overlay__summary h1{overflow-wrap:anywhere;min-width:0;font-size:1.65em;font-weight:700;line-height:1.2}.updated-overlay__status{color:#b8c0c7;align-items:center;gap:.5em;font-size:1.15em;font-weight:600;display:flex}.updated-overlay__status>span{background:currentColor;border-radius:50%;flex-shrink:0;width:.75em;height:.75em}.updated-overlay[data-state=RUNNING] .updated-overlay__status,.updated-overlay[data-state=FINISH] .updated-overlay__status{color:#00d76a}.updated-overlay[data-state=PAUSE] .updated-overlay__status{color:#fbbf24}.updated-overlay[data-state=FAILED] .updated-overlay__status{color:#f87171}.updated-overlay__progress{align-items:center;gap:1em;display:flex}.updated-overlay__progress>span{color:#b8c0c7;text-transform:uppercase;font-size:.8em}.updated-overlay__progress>strong{color:#00d76a;font-size:1.4em}.updated-overlay__progress>div{background:#3c454c;border-radius:1em;flex:1;height:.65em;overflow:hidden}.updated-overlay__progress>div>div{border-radius:inherit;background:#00d76a;height:100%;transition:width .5s}.updated-overlay__readings{border-top:1px solid #ffffff35;flex-wrap:wrap;gap:1em;margin-top:.8em;padding-top:.8em;display:flex}.updated-overlay__stats,.updated-overlay__temperatures{flex-wrap:wrap;flex:auto;gap:1em;display:flex}.updated-overlay__reading{flex:auto;align-items:center;gap:.6em;min-width:0;display:flex}.updated-overlay__reading svg{flex-shrink:0;width:1.8em;height:1.8em}.updated-overlay__reading>div>span{color:#b8c0c7;text-transform:uppercase;font-size:.7em;display:block}.updated-overlay__reading strong{overflow-wrap:anywhere;font-size:1.3em;display:block}.updated-overlay__reading small{color:#b8c0c7;font-size:.65em}.updated-overlay[data-layout=portrait]{font-size:calc(clamp(14px, calc(3 * var(--overlay-vmin,1vmin)), 36px) * var(--overlay-scale));min-height:var(--overlay-height,100vh);grid-template-rows:auto 1fr auto;grid-template-columns:minmax(0,1fr);display:grid}.updated-overlay[data-layout=portrait] .updated-overlay__header{background:rgb(16 23 27/var(--overlay-background-alpha,1));grid-row:1;align-items:center}.updated-overlay[data-layout=portrait] .updated-overlay__identity{background:0 0;padding:0}.updated-overlay[data-layout=portrait] .updated-overlay__camera{min-height:calc(var(--overlay-height,100vh) * .3);z-index:0;grid-row:2;position:relative}.updated-overlay[data-layout=portrait] .updated-overlay__panel{background:rgb(16 23 27/var(--overlay-background-alpha,1));grid-row:3}.updated-overlay[data-layout=portrait] .updated-overlay__summary{flex-direction:column-reverse;align-items:stretch;gap:.65em}.updated-overlay[data-layout=portrait] .updated-overlay__progress{flex-wrap:wrap;justify-content:space-between;gap:.3em}.updated-overlay[data-layout=portrait] .updated-overlay__progress>div{flex:0 0 100%;order:1}.updated-overlay[data-layout=portrait] .updated-overlay__readings{flex-direction:column}.updated-overlay[data-layout=portrait] .updated-overlay__temperatures:not(:first-child){border-top:1px solid #ffffff35;padding-top:.8em}@media (prefers-reduced-motion:reduce){.updated-overlay__progress>div>div{transition:none}} diff --git a/static/assets/StreamOverlayPage-Ck7DNYWg.js b/static/assets/StreamOverlayPage-Ck7DNYWg.js new file mode 100644 index 000000000..93a22789d --- /dev/null +++ b/static/assets/StreamOverlayPage-Ck7DNYWg.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,S as r,a as i,t as a,w as o}from"./client-DnySrlFv.js";import{n as s}from"./QueryClientProvider-Ce8_sN3w.js";import{t as c}from"./useQuery-BBCjCezC.js";import{t as l}from"./box-DAdKb9s5.js";import{t as u}from"./timer-GUTR9dAu.js";import{c as d,o as f}from"./date-G9KUauqz.js";import{Jt as ee,Lt as p,On as m,Un as h,Wn as g,bn as _,cn as te}from"./index-CovRLYqQ.js";import{t as v}from"./printerModel-DrNvERGQ.js";import{a as y,n as b,o as x,s as S,t as C}from"./OverlayFrame-fLmufrTC.js";var w=e(n(),1),T=t();function E(e,t){let[n,r]=(0,w.useState)(null);return(0,w.useLayoutEffect)(()=>{let n=e.current;if(!t||!n)return;let i=()=>{let e=n.clientWidth,t=n.clientHeight;e>0&&t>0&&r(n=>n&&n.width===e&&n.height===t?n:{width:e,height:t})};if(i(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,i),()=>window.removeEventListener(`resize`,i);let a=new ResizeObserver(i);return a.observe(n),()=>a.disconnect()},[e,t]),t?n:null}function D(e){let[t,n]=(0,w.useState)(()=>window.matchMedia(`(orientation: portrait)`).matches);return(0,w.useEffect)(()=>{if(e)return;let t=window.matchMedia(`(orientation: portrait)`),r=e=>n(e.matches);return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),e??(t?`portrait`:`landscape`)}function O(e){let{t}=o(),n=1-(e.backgroundTransparency??0)/100,r={"--overlay-background-alpha":n,"--overlay-identity-alpha":n*.9,"--overlay-panel-alpha":n*.88};(0,w.useLayoutEffect)(()=>{if(n===1)return;let e=document.body.style.backgroundColor;return document.body.style.backgroundColor=`transparent`,()=>{document.body.style.backgroundColor=e}},[n]);let i=D(e.layout),{camera:a,name:s,model:c,filename:l,status:d,state:f,progress:p,layers:h,remaining:g,eta:_,temperatures:v}=e,y=x(e.progressBackground),b=l||d||p!=null||h||g||_||v.length>0,S=a?.rotation??0,C=Math.abs(S%180)===90,O=(0,w.useRef)(null),k=E(O,C&&a!=null),A=[{key:`layers`,icon:(0,T.jsx)(te,{}),label:t(`streamOverlay.layer`),value:h},{key:`remaining`,icon:(0,T.jsx)(u,{}),label:t(`streamOverlay.remaining`),value:g},{key:`eta`,icon:(0,T.jsx)(m,{}),label:t(`streamOverlay.eta`),value:_}].filter(e=>e.value!=null);return(0,T.jsxs)(`div`,{className:`updated-overlay`,"data-size":e.size,"data-layout":i,"data-state":f,style:r,children:[(0,T.jsxs)(`header`,{className:`updated-overlay__header`,children:[(s||c)&&(0,T.jsxs)(`div`,{className:`updated-overlay__identity`,children:[(0,T.jsx)(ee,{"aria-hidden":`true`}),(0,T.jsxs)(`div`,{children:[s&&(0,T.jsx)(`strong`,{children:s}),c&&(0,T.jsx)(`span`,{children:c})]})]}),(0,T.jsxs)(`div`,{className:`updated-overlay__logo flex flex-col items-end`,children:[e.customLogo,(0,T.jsx)(`a`,{href:`https://github.com/maziggy/bambuddy`,target:`_blank`,rel:`noopener noreferrer`,children:(0,T.jsx)(`img`,{src:`/img/bambuddy_logo_powered_by.png`,alt:`Bambuddy`})})]})]}),a&&(0,T.jsx)(`div`,{className:`updated-overlay__camera`,ref:O,children:(0,T.jsx)(`img`,{src:a.url,alt:t(`streamOverlay.cameraStream`),style:{transform:`translate(-50%, -50%) rotate(${S}deg)`,...C&&k?{width:k.height,height:k.width}:{}},onError:a.onError},a.url)}),b&&(0,T.jsxs)(`section`,{className:`updated-overlay__panel`,children:[(l||d)&&(0,T.jsxs)(`div`,{className:`updated-overlay__summary`,children:[l&&(0,T.jsx)(`h1`,{children:l}),d&&(0,T.jsxs)(`div`,{className:`updated-overlay__status`,children:[(0,T.jsx)(`span`,{"aria-hidden":`true`}),d]})]}),p!=null&&(0,T.jsxs)(`div`,{className:`updated-overlay__progress`,children:[(0,T.jsx)(`span`,{style:y,children:t(`streamOverlay.progress`)}),(0,T.jsx)(`div`,{role:`progressbar`,"aria-label":t(`streamOverlay.progress`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":p,children:(0,T.jsx)(`div`,{style:{width:`${p}%`,background:e.progressBackground}})}),(0,T.jsxs)(`strong`,{style:y,children:[Math.round(p),`%`]})]}),(A.length>0||v.length>0)&&(0,T.jsxs)(`div`,{className:`updated-overlay__readings`,children:[A.length>0&&(0,T.jsx)(`div`,{className:`updated-overlay__stats`,children:A.map(e=>(0,T.jsxs)(`div`,{className:`updated-overlay__reading`,children:[e.icon,(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{children:e.label}),(0,T.jsx)(`strong`,{children:e.value})]})]},e.key))}),v.length>0&&(0,T.jsx)(`div`,{className:`updated-overlay__temperatures`,children:v.map(e=>(0,T.jsxs)(`div`,{className:`updated-overlay__reading`,children:[e.icon,(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{children:e.label}),(0,T.jsxs)(`strong`,{children:[Math.round(e.current),`°C`,e.target!=null&&e.target>0&&Math.round(e.target)!==Math.round(e.current)&&(0,T.jsxs)(`small`,{children:[` / `,Math.round(e.target),`°C`]})]})]})]},e.key))})]})]})]})}var k=6e4,A=3e3;function ne(e){let[t,n]=(0,w.useState)(Date.now),r=(0,w.useRef)(null),i=(0,w.useCallback)(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null),n(e=>e+1)},[]);return(0,w.useEffect)(()=>{if(!e)return;let t=setTimeout(i,k);return()=>{clearTimeout(t),r.current!==null&&(clearTimeout(r.current),r.current=null)}},[e,t,i]),{imageKey:t,handleStreamError:(0,w.useCallback)(()=>{!e||r.current!==null||(r.current=setTimeout(i,A))},[e,i])}}function j(e,t,n){if(!e)return``;if(!t)return e;let r=t.match(/plate_(\d+)\.gcode/);return r&&parseInt(r[1],10)>1?`${e} — ${n(`printers.plateNumber`,`Plate {{number}}`,{number:r[1]})}`:e}function re(e){let t=e.get(`show`)?.split(`,`)||[`progress`,`layers`,`eta`,`filename`,`status`],n=parseInt(e.get(`fps`)||`15`,10),r=Math.min(Math.max(isNaN(n)?15:n,1),30),i=e.get(`camera`),a=i!==`false`&&i!==`0`,o=Number(e.get(`backgroundTransparency`)),s=Number.isFinite(o)?Math.min(100,Math.max(0,o)):0,c=e.get(`layout`);return{layout:c===`portrait`||c===`landscape`?c:null,backgroundTransparency:s,size:e.get(`size`)||`medium`,fps:r,updatedArtwork:e.get(`artwork`)===`2`,showCamera:a,showProgress:t.includes(`progress`),showLayers:t.includes(`layers`),showEta:t.includes(`eta`),showFilename:t.includes(`filename`),showStatus:t.includes(`status`),showPrinter:t.includes(`printer`),showModel:t.includes(`model`),showNozzle:t.includes(`nozzle`),showBed:t.includes(`bed`),showChamber:t.includes(`chamber`)}}function M(e,t){if(e.stg_cur_name)return e.stg_cur_name;switch(e.state){case`RUNNING`:return t(`streamOverlay.status.printing`);case`PAUSE`:return t(`streamOverlay.status.paused`);case`FINISH`:return t(`streamOverlay.status.finished`);case`FAILED`:return t(`streamOverlay.status.failed`);case`IDLE`:return t(`streamOverlay.status.idle`);default:return e.state||t(`streamOverlay.status.unknown`)}}function N(e,t){let n=e[t];return typeof n==`number`?n:null}function ie({icon:e,label:t,current:n,target:r,sizes:i}){let a=r!=null&&r>0&&Math.round(r)!==Math.round(n);return(0,T.jsxs)(`div`,{className:`flex items-center ${i.gap} text-white/70`,children:[e,(0,T.jsxs)(`span`,{className:`classic-overlay__text ${i.text}`,children:[(0,T.jsx)(`span`,{className:`mr-1`,children:t}),(0,T.jsxs)(`span`,{className:`text-white`,children:[Math.round(n),`°C`]}),a&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`mx-1`,children:`/`}),(0,T.jsxs)(`span`,{children:[Math.round(r),`°C`]})]})]})]})}function ae(e){switch(e){case`small`:return{container:`p-3`,text:`text-sm`,textLarge:`text-lg`,progressHeight:`h-2`,icon:`w-3 h-3`,gap:`gap-2`,logoHeight:`h-12`};case`large`:return{container:`p-6`,text:`text-xl`,textLarge:`text-3xl`,progressHeight:`h-4`,icon:`w-6 h-6`,gap:`gap-4`,logoHeight:`h-24`};default:return{container:`p-4`,text:`text-base`,textLarge:`text-xl`,progressHeight:`h-3`,icon:`w-4 h-4`,gap:`gap-3`,logoHeight:`h-16`}}}function P(){let{printerId:e}=h(),[t]=g(),{t:n}=o(),E=s(),D=parseInt(e||`0`,10),k=(0,w.useMemo)(()=>re(t),[t]),A=ae(k.size),P=t.get(`token`),F=P!=null&&P!==``,I=S(t.get(`logo`)===`1`,P),L=y(t.get(`progressFrom`),t.get(`progressTo`)),R=x(L),z=I?(0,T.jsx)(`img`,{src:I,alt:n(`streamOverlay.branding.logo`),className:`mb-2 object-contain`,style:{maxHeight:k.layout?b[k.layout].height*.14:`14vh`,maxWidth:k.layout?b[k.layout].width*.2:`20vw`}}):null,{data:B}=c({queryKey:[`overlayStatus`,D,P],queryFn:()=>i.getOverlayStatus(D,P??void 0),enabled:D>0&&F,refetchInterval:2e3}),{data:V}=c({queryKey:[`printer`,D],queryFn:()=>i.getPrinter(D),enabled:D>0&&!F}),{data:oe}=c({queryKey:[`printerStatus`,D],queryFn:()=>i.getPrinterStatus(D),enabled:D>0&&!F,refetchInterval:2e3}),{data:se}=c({queryKey:[`settings`],queryFn:i.getSettings,enabled:!F}),H=(0,w.useMemo)(()=>F?B&&{name:B.name,model:B.model,camera_rotation:B.camera_rotation}:V,[F,B,V]),U=[k.showPrinter?H?.name:null,k.showModel?v(H?.model??null):null].filter(Boolean).join(` · `),W=F?B:oe,{imageKey:G,handleStreamError:K}=ne(D>0&&k.showCamera&&W!=null),q=(F?B?.time_format:se?.time_format)||`system`;if((0,w.useEffect)(()=>{if(!D||F)return;let e=null,t=!1;return(async()=>{let n;try{n=(await i.getWebSocketToken()).token}catch(e){let t=e instanceof a?e.status:0;if(t===401||t===403)return}if(t)return;let r=window.location.protocol===`https:`?`wss:`:`ws:`,o=n?`?token=${encodeURIComponent(n)}`:``,s=`${r}//${window.location.host}/api/v1/ws${o}`;e=new WebSocket(s),e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`printer_status`&&t.printer_id===D&&E.setQueryData([`printerStatus`,D],t.status)}catch{}},e.onerror=()=>{}})(),()=>{t=!0,e&&e.close()}},[D,F,E]),(0,w.useEffect)(()=>(document.title=H?`${H.name} - ${n(`streamOverlay.title`)}`:n(`streamOverlay.title`),()=>{document.title=`Bambuddy`}),[H,n]),!D)return(0,T.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center`,children:(0,T.jsx)(`p`,{className:`text-white`,children:n(`streamOverlay.invalidPrinterId`)})});if(!W)return(0,T.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center`,children:(0,T.jsx)(`p`,{className:`text-gray-400`,children:n(`common.loading`)})});let J=W.connected&&(W.state===`RUNNING`||W.state===`PAUSE`),Y=W.progress||0,X=W.temperatures??{},Z=[];if(k.showNozzle){let e=N(X,`nozzle`),t=N(X,`nozzle_2`);e!=null&&Z.push({key:`nozzle`,icon:(0,T.jsx)(_,{className:`classic-overlay__icon ${A.icon}`}),label:n(`printers.heaterHistory.nozzle`,`Nozzle`),current:e,target:N(X,`nozzle_target`)}),t!=null&&Z.push({key:`nozzle_2`,icon:(0,T.jsx)(_,{className:`classic-overlay__icon ${A.icon}`}),label:n(`printers.heaterHistory.nozzle2`,`Nozzle 2`),current:t,target:N(X,`nozzle_2_target`)})}if(k.showBed){let e=N(X,`bed`);e!=null&&Z.push({key:`bed`,icon:(0,T.jsx)(p,{className:`classic-overlay__icon ${A.icon}`}),label:n(`printers.heaterHistory.bed`,`Bed`),current:e,target:N(X,`bed_target`)})}if(k.showChamber){let e=N(X,`chamber`);e!=null&&Z.push({key:`chamber`,icon:(0,T.jsx)(l,{className:`classic-overlay__icon ${A.icon}`}),label:n(`printers.heaterHistory.chamber`,`Chamber`),current:e,target:N(X,`chamber_target`)})}let ce=`/api/v1/printers/${D}/camera/stream?fps=${k.fps}&t=${G}`,le=F&&P?`${ce}&token=${encodeURIComponent(P)}`:r(ce);if(k.updatedArtwork){let e=W.connected&&J,t=W.remaining_time,r=e&&k.showEta&&t!=null&&t>0,i=(0,T.jsx)(O,{layout:k.layout??void 0,backgroundTransparency:k.backgroundTransparency,customLogo:z,progressBackground:L,size:k.size,camera:k.showCamera?{url:le,rotation:H?.camera_rotation??0,onError:K}:null,name:k.showPrinter?H?.name??null:null,model:k.showModel&&v(H?.model??null)||null,filename:k.showFilename&&W.current_print?j(W.current_print.replace(/\.gcode\.3mf$|\.3mf$|\.gcode$/i,``),W.gcode_file,n):null,status:k.showStatus?W.connected?M(W,n):n(`streamOverlay.printerOffline`):null,state:W.connected?W.state:null,progress:e&&k.showProgress?Math.min(100,Math.max(0,Number.isFinite(Y)?Y:0)):null,layers:e&&k.showLayers&&W.layer_num!=null&&W.total_layers!=null&&W.total_layers>0?`${W.layer_num} / ${W.total_layers}`:null,remaining:r?f(t*60):null,eta:r?d(t,q,n):null,temperatures:W.connected?Z:[]});return k.layout?(0,T.jsx)(C,{layout:k.layout,children:i}):i}let Q=k.layout?b[k.layout]:null,$=H?.camera_rotation??0,ue=Math.abs($%180)===90,de=(0,T.jsxs)(`div`,{className:`classic-overlay min-h-screen bg-black relative overflow-hidden`,"data-layout":k.layout??void 0,"data-size":k.size,children:[k.showCamera&&(0,T.jsx)(`img`,{src:le,alt:n(`streamOverlay.cameraStream`),className:`absolute inset-0 w-full h-full object-contain`,style:Q?{left:`50%`,top:`50%`,maxWidth:`none`,width:ue?Q.height:Q.width,height:ue?Q.width:Q.height,transform:`translate(-50%, -50%) rotate(${$}deg)`}:$?{transform:`rotate(${$}deg)`}:void 0,onError:K},G),(0,T.jsxs)(`div`,{className:`absolute top-4 right-4 z-10 flex flex-col items-end`,children:[z,(0,T.jsx)(`a`,{href:`https://github.com/maziggy/bambuddy`,target:`_blank`,rel:`noopener noreferrer`,children:(0,T.jsx)(`img`,{src:`/img/bambuddy_logo_dark_transparent.png`,alt:`Bambuddy`,className:`classic-overlay__logo ${A.logoHeight} object-contain drop-shadow-lg hover:scale-105 transition-transform`})})]}),(0,T.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 z-10 bg-gradient-to-t from-black/80 via-black/60 to-transparent`,children:(0,T.jsxs)(`div`,{className:`classic-overlay__panel ${A.container}`,children:[U&&(0,T.jsxs)(`div`,{className:`flex items-center ${A.gap} mb-2`,children:[(0,T.jsx)(ee,{className:`classic-overlay__icon ${A.icon} shrink-0 text-white/70`}),(0,T.jsx)(`span`,{className:`classic-overlay__text ${A.text} min-w-0 truncate text-white font-medium`,children:U})]}),k.showFilename&&W.current_print&&(0,T.jsx)(`div`,{className:`classic-overlay__filename ${A.textLarge} text-white font-semibold mb-2 truncate drop-shadow-md`,children:j(W.current_print.replace(/\.gcode\.3mf$|\.3mf$|\.gcode$/i,``),W.gcode_file,n)}),k.showStatus&&(0,T.jsx)(`div`,{className:`classic-overlay__text ${A.text} text-white/70 mb-2`,children:W.connected?M(W,n):n(`streamOverlay.printerOffline`)}),k.showProgress&&J&&(0,T.jsxs)(`div`,{className:`mb-3`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between mb-1 classic-overlay__text ${A.text}`,children:[(0,T.jsx)(`span`,{className:`text-white/70`,style:R,children:n(`streamOverlay.progress`)}),(0,T.jsxs)(`span`,{className:`text-white font-bold`,style:R,children:[Math.round(Y),`%`]})]}),(0,T.jsx)(`div`,{className:`w-full bg-white/20 rounded-full ${A.progressHeight}`,children:(0,T.jsx)(`div`,{className:`bg-bambu-green ${A.progressHeight} rounded-full transition-all duration-500`,style:{width:`${Y}%`,background:L}})})]}),J&&(k.showLayers||k.showEta)&&(0,T.jsxs)(`div`,{className:`flex items-center ${A.gap} flex-wrap`,children:[k.showLayers&&W.layer_num!=null&&W.total_layers!=null&&W.total_layers>0&&(0,T.jsxs)(`div`,{className:`flex items-center ${A.gap} text-white/70`,children:[(0,T.jsx)(te,{className:`classic-overlay__icon ${A.icon}`}),(0,T.jsxs)(`span`,{className:`classic-overlay__text ${A.text}`,children:[(0,T.jsx)(`span`,{className:`text-white`,children:W.layer_num}),(0,T.jsx)(`span`,{className:`mx-1`,children:`/`}),(0,T.jsx)(`span`,{children:W.total_layers})]})]}),k.showEta&&W.remaining_time!=null&&W.remaining_time>0&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`flex items-center ${A.gap} text-white/70`,children:[(0,T.jsx)(u,{className:`classic-overlay__icon ${A.icon}`}),(0,T.jsx)(`span`,{className:`classic-overlay__text ${A.text} text-white`,children:f(W.remaining_time*60)})]}),(0,T.jsxs)(`div`,{className:`flex items-center ${A.gap} text-white/70`,children:[(0,T.jsx)(m,{className:`classic-overlay__icon ${A.icon}`}),(0,T.jsxs)(`span`,{className:`classic-overlay__text ${A.text} text-white`,children:[n(`streamOverlay.eta`),` `,d(W.remaining_time,q,n)]})]})]})]}),Z.length>0&&W.connected&&(0,T.jsx)(`div`,{className:`flex items-center ${A.gap} flex-wrap mt-2`,children:Z.map(e=>(0,T.jsx)(ie,{icon:e.icon,label:e.label,current:e.current,target:e.target,sizes:A},e.key))})]})})]});return k.layout?(0,T.jsx)(C,{layout:k.layout,children:de}):de}export{P as StreamOverlayPage}; \ No newline at end of file diff --git a/static/assets/SystemInfoPage-Btg_r_Hv.js b/static/assets/SystemInfoPage-Btg_r_Hv.js new file mode 100644 index 000000000..89f831484 --- /dev/null +++ b/static/assets/SystemInfoPage-Btg_r_Hv.js @@ -0,0 +1,3 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,a as r,w as i,y as a}from"./client-DnySrlFv.js";import{n as o}from"./QueryClientProvider-Ce8_sN3w.js";import{t as s}from"./useQuery-BBCjCezC.js";import{t as c}from"./useMutation-B-Tr2hIP.js";import{t as l}from"./createLucideIcon-DvBYJlWL.js";import{a as u,i as d,n as f,r as p,t as m}from"./info-ROUoQhJR.js";import{t as h}from"./cpu-BKWEtc8k.js";import{t as g}from"./hard-drive-CgXAHN37.js";import{t as _}from"./loader-circle-BEmFtawu.js";import{t as v}from"./play-DIDYtk2S.js";import{t as y}from"./search-0n0CBc74.js";import{t as b}from"./triangle-alert-Dt_1FcBy.js";import{t as x}from"./x-DR-Trv6U.js";import{t as S}from"./Card-Bzc64K35.js";import{a as C}from"./date-G9KUauqz.js";import{An as w,At as T,Fn as E,Ft as D,Ht as O,Jt as k,Kt as A,Ln as j,Lt as M,On as N,Qt as P,Tn as F,_ as I,en as L,g as R,vn as z,wn as B,yn as V}from"./index-CovRLYqQ.js";var H=l(`headphones`,[[`path`,{d:`M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3`,key:`1xhozi`}]]),U=l(`heart-pulse`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]),ee=l(`memory-stick`,[[`path`,{d:`M6 19v-3`,key:`1nvgqn`}],[`path`,{d:`M10 19v-3`,key:`iu8nkm`}],[`path`,{d:`M14 19v-3`,key:`kcehxu`}],[`path`,{d:`M18 19v-3`,key:`1vh91z`}],[`path`,{d:`M8 11V9`,key:`63erz4`}],[`path`,{d:`M16 11V9`,key:`fru6f3`}],[`path`,{d:`M12 11V9`,key:`ha00sb`}],[`path`,{d:`M2 15h20`,key:`16ne18`}],[`path`,{d:`M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z`,key:`lhddv3`}]]),W=e(n(),1),G=t(),K=[`DEBUG`,`INFO`,`WARNING`,`ERROR`],q={DEBUG:`text-gray-400`,INFO:`text-blue-400`,WARNING:`text-yellow-400`,ERROR:`text-red-400`},J={DEBUG:E,INFO:m,WARNING:b,ERROR:p};function te(){let e=o(),[t,n]=(0,W.useState)(!0),[r,i]=(0,W.useState)(new Set),[l,f]=(0,W.useState)(``),[p,h]=(0,W.useState)(`ALL`),[g,_]=(0,W.useState)(!1),[b,S]=(0,W.useState)(!1),C=(0,W.useRef)(null),{data:w,isLoading:D,refetch:O}=s({queryKey:[`application-logs`,p,l],queryFn:()=>a.getLogs({limit:200,level:p===`ALL`?void 0:p,search:l||void 0}),refetchInterval:b?2e3:!1,enabled:g});(0,W.useEffect)(()=>{g||S(!1)},[g]);let k=c({mutationFn:()=>a.clearLogs(),onSuccess:()=>{e.invalidateQueries({queryKey:[`application-logs`]})}});(0,W.useEffect)(()=>{t&&C.current&&w?.entries&&(C.current.scrollTop=C.current.scrollHeight)},[w?.entries,t]);let j=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},N=e=>{let t=e.split(` `);return t.length>=2?t[1]:e},P=(0,W.useMemo)(()=>w?.entries??[],[w?.entries]),F=(0,W.useMemo)(()=>[...P].reverse(),[P]),I=({level:e})=>(0,G.jsx)(J[e]||m,{className:`w-3.5 h-3.5 ${q[e]||`text-gray-400`}`});return(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg overflow-hidden`,children:[(0,G.jsxs)(`button`,{onClick:()=>_(!g),className:`w-full flex items-center justify-between p-4 hover:bg-bambu-dark-tertiary/50 transition-colors`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${b?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:(0,G.jsx)(E,{className:`w-5 h-5`})}),(0,G.jsxs)(`div`,{className:`text-left`,children:[(0,G.jsx)(`p`,{className:`font-medium text-white`,children:`Application Logs`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:b?`Live streaming - ${w?.filtered_count??0} entries`:`View and filter application logs`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 px-2 py-1 bg-bambu-green/20 rounded text-bambu-green text-xs`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 bg-bambu-green rounded-full animate-pulse`}),`Live`]}),g?(0,G.jsx)(d,{className:`w-5 h-5 text-bambu-gray`}):(0,G.jsx)(u,{className:`w-5 h-5 text-bambu-gray`})]})]}),g&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[b?(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),S(!1)},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-500/30 rounded transition-colors`,children:[(0,G.jsx)(M,{className:`w-4 h-4`}),`Stop`]}):(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),S(!0),O()},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30 rounded transition-colors`,children:[(0,G.jsx)(v,{className:`w-4 h-4`}),`Start`]}),(0,G.jsxs)(`button`,{onClick:()=>k.mutate(),disabled:k.isPending||P.length===0,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-secondary rounded transition-colors disabled:opacity-50`,children:[(0,G.jsx)(T,{className:`w-4 h-4`}),`Clear`]}),(0,G.jsx)(`button`,{onClick:()=>O(),disabled:D,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-secondary rounded transition-colors disabled:opacity-50`,children:(0,G.jsx)(A,{className:`w-4 h-4 ${D?`animate-spin`:``}`})}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-bambu-gray cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark-tertiary`}),`Auto-scroll`]}),(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[w?.filtered_count??0,`/`,w?.total_in_file??0]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(y,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,placeholder:`Search message or logger name...`,value:l,onChange:e=>f(e.target.value),className:`w-full pl-8 pr-8 py-1.5 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`}),l&&(0,G.jsx)(`button`,{onClick:()=>f(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,G.jsx)(x,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 bg-bambu-dark-secondary rounded border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`button`,{onClick:()=>h(`ALL`),className:`px-2 py-1.5 text-xs rounded-l transition-colors ${p===`ALL`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:`All`}),K.map((e,t)=>(0,G.jsx)(`button`,{onClick:()=>h(e),className:`px-2 py-1.5 text-xs transition-colors flex items-center gap-1 ${t===K.length-1?`rounded-r`:``} ${p===e?`${q[e]} bg-bambu-dark-tertiary`:`text-bambu-gray hover:text-white`}`,children:e},e))]})]})]}),(0,G.jsx)(`div`,{ref:C,className:`overflow-auto font-mono text-xs bg-black min-h-[300px] max-h-[500px]`,children:P.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[300px] text-bambu-gray`,children:[(0,G.jsx)(`p`,{className:`mb-2`,children:`No log entries found`}),(0,G.jsx)(`p`,{className:`text-sm`,children:`Log file may be empty or cleared`})]}):(0,G.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary/30`,children:F.map((e,t)=>{let n=r.has(t),i=e.message.includes(` +`);return(0,G.jsx)(`div`,{className:`p-2 cursor-pointer hover:bg-bambu-dark-secondary/50 transition-colors ${n?`bg-bambu-dark-secondary/30`:``}`,onClick:()=>i&&j(t),children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray/70 shrink-0 w-20`,children:N(e.timestamp)}),(0,G.jsx)(`span`,{className:`shrink-0`,children:(0,G.jsx)(I,{level:e.level})}),(0,G.jsxs)(`span`,{className:`text-purple-400/80 shrink-0 max-w-[200px] truncate`,title:e.logger_name,children:[`[`,e.logger_name,`]`]}),(0,G.jsx)(`span`,{className:`flex-1 ${q[e.level]||`text-white/80`} ${!n&&i?`truncate`:``}`,children:n?(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-all`,children:e.message}):e.message.split(` +`)[0]}),i&&(0,G.jsx)(`span`,{className:`text-bambu-gray/50 shrink-0`,children:n?(0,G.jsx)(d,{className:`w-3.5 h-3.5`}):(0,G.jsx)(u,{className:`w-3.5 h-3.5`})})]})},t)})})}),(0,G.jsx)(`div`,{className:`flex items-center justify-between p-3 border-t border-bambu-dark-tertiary text-sm text-bambu-gray`,children:b?(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 bg-green-500 rounded-full animate-pulse`}),`Auto-refreshing every 2 seconds`]}):(0,G.jsx)(`span`,{children:`Click Start to enable live log streaming`})})]})]})}function ne(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Y({icon:e,label:t,value:n,subValue:r,color:i=`text-bambu-green`}){return(0,G.jsxs)(`div`,{className:`flex items-start gap-3 p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg bg-bambu-dark-tertiary ${i}`,children:(0,G.jsx)(e,{className:`w-5 h-5`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t}),(0,G.jsx)(`p`,{className:`text-lg font-semibold text-white truncate`,children:n}),r&&(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:r})]})]})}function X({percent:e,color:t=`bg-bambu-green`}){return(0,G.jsx)(`div`,{className:`w-full h-2 bg-bambu-dark rounded-full overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full ${t} transition-all duration-300`,style:{width:`${Math.min(100,e)}%`}})})}function Z({title:e,icon:t,children:n}){return(0,G.jsxs)(S,{className:`p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,G.jsx)(t,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e})]}),n]})}function Q(){let{t:e}=i(),t=o(),[n,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),[d,p]=(0,W.useState)(!1),[m,v]=(0,W.useState)(null),{data:y,isLoading:b,refetch:x,isFetching:S}=s({queryKey:[`systemInfo`],queryFn:r.getSystemInfo,refetchInterval:3e4}),{data:T}=s({queryKey:[`debugLogging`],queryFn:a.getDebugLoggingState,staleTime:10*1e3,refetchInterval:10*1e3}),{data:M}=s({queryKey:[`settings`],queryFn:r.getSettings}),{data:K}=s({queryKey:[`library-stats`],queryFn:r.getLibraryStats}),{data:q}=s({queryKey:[`printers`],queryFn:r.getPrinters}),{data:J,refetch:Q,isFetching:$}=s({queryKey:[`systemHealth`],queryFn:r.getSystemHealth,staleTime:60*1e3}),re=M?.time_format||`system`,ie=async()=>{p(!0);try{let e=await a.setDebugLogging(!T?.enabled);t.setQueryData([`debugLogging`],e)}catch(e){console.error(`Failed to toggle debug logging:`,e)}finally{p(!1)}},ae=async()=>{c(null),u(!0);try{await a.downloadSupportBundle()}catch(e){c(e instanceof Error?e.message:`Failed to download support bundle`)}finally{u(!1)}};if(b)return(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,G.jsx)(_,{className:`w-8 h-8 text-bambu-green animate-spin`})});if(!y)return(0,G.jsx)(`div`,{className:`p-6 text-center text-bambu-gray`,children:e(`system.failedToLoad`,`Failed to load system information`)});let oe=y.storage.disk_percent_used>90?`bg-red-500`:y.storage.disk_percent_used>75?`bg-yellow-500`:`bg-bambu-green`,se=y.memory.percent_used>90?`bg-red-500`:y.memory.percent_used>75?`bg-yellow-500`:`bg-bambu-green`;return(0,G.jsxs)(`div`,{className:`p-6 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col items-start gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`system.title`,`System Information`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`system.subtitle`,`Monitor system resources and database statistics`)})]}),(0,G.jsxs)(`button`,{onClick:()=>x(),disabled:S,className:`flex items-center gap-2 px-4 py-2 bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary rounded-lg transition-colors disabled:opacity-50`,children:[(0,G.jsx)(A,{className:`w-4 h-4 ${S?`animate-spin`:``}`}),e(`common.refresh`,`Refresh`)]})]}),(0,G.jsx)(Z,{title:e(`system.application`,`Application`),icon:O,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,G.jsx)(Y,{icon:O,label:e(`system.version`,`Version`),value:`v${y.app.version}`}),(0,G.jsx)(Y,{icon:N,label:e(`system.uptime`,`System Uptime`),value:y.system.uptime_formatted}),(0,G.jsx)(Y,{icon:O,label:e(`system.hostname`,`Hostname`),value:y.system.hostname})]})}),(0,G.jsx)(Z,{title:e(`support.title`,`Support & Troubleshooting`),icon:H,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`support.description`,`Enable debug logging to capture detailed information, then download a support bundle to share when reporting issues.`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${T?.enabled?`bg-amber-500/20 text-amber-500`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:(0,G.jsx)(E,{className:`w-5 h-5`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium text-white`,children:e(`support.debugLogging`,`Debug Logging`)}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[T?.enabled?e(`support.debugLoggingEnabled`,`Capturing detailed logs`):e(`support.debugLoggingDisabled`,`Normal logging level`),T?.enabled&&T.duration_seconds!==null&&(0,G.jsxs)(`span`,{className:`text-amber-700 dark:text-amber-400 ml-2`,children:[`(`,Math.floor(T.duration_seconds/60),`m `,T.duration_seconds%60,`s)`]})]})]})]}),(0,G.jsxs)(`button`,{onClick:ie,disabled:d,className:`px-4 py-2 rounded-lg font-medium transition-colors flex items-center gap-2 ${T?.enabled?`bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-500/20 dark:text-amber-400 dark:hover:bg-amber-500/30`:`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30`} disabled:opacity-50`,children:[d&&(0,G.jsx)(_,{className:`w-4 h-4 animate-spin`}),T?.enabled?e(`support.disableDebug`,`Disable`):e(`support.enableDebug`,`Enable`)]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg bg-bambu-dark-tertiary text-bambu-green`,children:(0,G.jsx)(B,{className:`w-5 h-5`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium text-white`,children:e(`support.supportBundle`,`Support Bundle`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`support.supportBundleDescription`,`Download system info and logs as a ZIP file`)})]})]}),(0,G.jsxs)(`button`,{onClick:ae,disabled:l||!T?.enabled,className:`px-4 py-2 rounded-lg font-medium bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30 transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,title:T?.enabled?void 0:e(`support.enableDebugFirst`,`Enable debug logging first`),children:[l&&(0,G.jsx)(_,{className:`w-4 h-4 animate-spin`}),l?e(`support.bundleGenerating`,`Generating...`):e(`common.download`,`Download`)]})]}),l&&(0,G.jsxs)(`div`,{className:`p-3 bg-bambu-dark-tertiary/40 rounded-lg space-y-1`,children:[(0,G.jsxs)(`p`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[(0,G.jsx)(_,{className:`w-3.5 h-3.5 animate-spin text-bambu-green`}),e(`support.bundleGenerating`,`Generating...`)]}),(0,G.jsxs)(`ul`,{className:`text-xs text-bambu-gray list-disc list-inside space-y-0.5 pl-1`,children:[(0,G.jsx)(`li`,{children:e(`support.bundleStepConnection`,`Running printer connectivity checks`)}),(0,G.jsx)(`li`,{children:e(`support.bundleStepVirtualPrinters`,`Running virtual-printer setup checks`)}),(0,G.jsx)(`li`,{children:e(`support.bundleStepLogScan`,`Scanning recent logs for known issues`)}),(0,G.jsx)(`li`,{children:e(`support.bundleStepBuild`,`Building the support bundle ZIP`)})]})]}),n&&(0,G.jsx)(`div`,{className:`p-3 bg-red-100 border border-red-300 rounded-lg text-red-700 dark:bg-red-500/20 dark:border-red-500/30 dark:text-red-400 text-sm`,children:n}),!T?.enabled&&(0,G.jsx)(`div`,{className:`p-4 bg-bambu-dark-tertiary/50 rounded-lg`,children:(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[(0,G.jsx)(`span`,{className:`text-amber-700 dark:text-amber-400 font-medium`,children:e(`support.instructions`,`To report an issue:`)}),(0,G.jsx)(`br`,{}),`1. `,e(`support.step1`,`Enable debug logging`),(0,G.jsx)(`br`,{}),`2. `,e(`support.step2`,`Reproduce the issue`),(0,G.jsx)(`br`,{}),`3. `,e(`support.step3`,`Download the support bundle`),(0,G.jsx)(`br`,{}),`4. `,e(`support.step4`,`Attach the ZIP file to your issue report`)]})}),(0,G.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-white`,children:e(`support.privacyTitle`,`What's in the support bundle?`)}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-bambu-green font-medium mb-1`,children:e(`support.collected`,`Collected:`)}),(0,G.jsxs)(`ul`,{className:`text-bambu-gray space-y-0.5`,children:[(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem1`,`App version and debug mode`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem2`,`OS, architecture, Python version`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem3`,`Database statistics (counts only)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem4`,`Printer models and nozzle counts`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem5`,`Non-sensitive settings (themes, formats)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem6`,`Debug logs (sanitized)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem7`,`Printer connectivity and firmware versions`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem8`,`Integration status (Spoolman, MQTT, HA)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem9`,`Network interfaces (subnets only)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem10`,`Python package versions`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem11`,`Database health checks`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem12`,`Docker environment details`)]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 font-medium mb-1`,children:e(`support.notCollected`,`NOT collected:`)}),(0,G.jsxs)(`ul`,{className:`text-bambu-gray space-y-0.5`,children:[(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem1`,`Printer names and serial numbers`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem2`,`Access codes and passwords`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem3`,`Email addresses`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem4`,`API keys and tokens`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem5`,`Webhook URLs`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem6`,`Your hostname or username`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem7`,`IP addresses`)]})]})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray/70`,children:e(`support.privacyNote`,`Email addresses in logs are replaced with [EMAIL], printer names with [PRINTER], serial numbers with [SERIAL], and IP addresses with [IP].`)})]}),(0,G.jsx)(te,{})]})}),(0,G.jsxs)(Z,{title:e(`diagnostic.sectionTitle`,`Connection Diagnostic`),icon:D,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:e(`diagnostic.sectionDescription`,`Check why a printer won't connect or won't print — port reachability, LAN developer mode, Docker network mode, and credentials.`)}),q&&q.length>0?(0,G.jsx)(`div`,{className:`space-y-2`,children:q.map(t=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-medium text-white`,children:t.name}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray ml-2`,children:t.ip_address})]}),(0,G.jsxs)(`button`,{onClick:()=>v(t),className:`flex items-center gap-2 px-3 py-1.5 text-sm bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary text-white rounded-lg transition-colors flex-shrink-0`,children:[(0,G.jsx)(D,{className:`w-4 h-4`}),e(`diagnostic.runButton`,`Run diagnostic`)]})]},t.id))}):(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`diagnostic.noPrinters`,`No printers configured.`)})]}),(0,G.jsxs)(Z,{title:e(`systemHealth.sectionTitle`),icon:U,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 mb-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`systemHealth.sectionDescription`)}),(0,G.jsxs)(`button`,{onClick:()=>Q(),disabled:$,className:`flex items-center gap-2 px-3 py-1.5 text-sm bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary text-white rounded-lg transition-colors flex-shrink-0 disabled:opacity-50`,children:[(0,G.jsx)(A,{className:`w-4 h-4 ${$?`animate-spin`:``}`}),e(`systemHealth.rescan`)]})]}),J?(0,G.jsx)(R,{result:J}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`)})]}),(0,G.jsxs)(Z,{title:e(`system.database`,`Database`),icon:F,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mb-4`,children:[(0,G.jsx)(Y,{icon:F,label:e(`system.dbEngine`,`Database Engine`),value:y.database.engine||`SQLite`}),(0,G.jsx)(Y,{icon:F,label:e(`system.dbVersion`,`Version`),value:y.database.version||`unknown`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4 mb-4`,children:[(0,G.jsx)(Y,{icon:j,label:e(`system.totalArchives`,`Total Archives`),value:y.database.archives}),(0,G.jsx)(Y,{icon:w,label:e(`system.completed`,`Completed`),value:y.database.archives_completed,color:`text-green-500`}),(0,G.jsx)(Y,{icon:f,label:e(`system.failed`,`Failed`),value:y.database.archives_failed,color:`text-red-500`}),(0,G.jsx)(Y,{icon:_,label:e(`system.printing`,`Printing`),value:y.database.archives_printing,color:`text-yellow-500`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsx)(Y,{icon:k,label:e(`system.printers`,`Printers`),value:y.database.printers}),(0,G.jsx)(Y,{icon:L,label:e(`system.filaments`,`Filaments`),value:y.database.filaments}),(0,G.jsx)(Y,{icon:V,label:e(`system.projects`,`Projects`),value:y.database.projects}),(0,G.jsx)(Y,{icon:P,label:e(`system.smartPlugs`,`Smart Plugs`),value:y.database.smart_plugs})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mt-4`,children:[(0,G.jsx)(Y,{icon:N,label:e(`system.totalPrintTime`,`Total Print Time`),value:y.database.total_print_time_formatted}),(0,G.jsx)(Y,{icon:j,label:e(`system.totalFilament`,`Total Filament Used`),value:`${y.database.total_filament_kg} kg`,subValue:`${y.database.total_filament_grams.toLocaleString()} g`})]})]}),(0,G.jsxs)(Z,{title:e(`system.connectedPrinters`,`Connected Printers`),icon:k,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4 mb-4`,children:[(0,G.jsx)(`div`,{className:`text-3xl font-bold text-bambu-green`,children:y.printers.connected}),(0,G.jsx)(`div`,{className:`text-bambu-gray`,children:e(`system.ofTotal`,`of {{total}} printers connected`,{total:y.printers.total})})]}),y.printers.connected_list.length>0?(0,G.jsx)(`div`,{className:`space-y-2`,children:y.printers.connected_list.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-bambu-green`}),(0,G.jsx)(`span`,{className:`font-medium text-white`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:e.model}),(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded ${e.state===`RUNNING`?`bg-bambu-green/20 text-bambu-green`:e.state===`IDLE`?`bg-blue-100 text-blue-700 dark:bg-blue-500/20 dark:text-blue-400`:`bg-bambu-dark-tertiary`}`,children:e.state})]})]},e.id))}):(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`system.noPrintersConnected`,`No printers connected`)})]}),(0,G.jsx)(Z,{title:e(`system.storage`,`Storage`),icon:g,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-sm mb-1`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:e(`system.diskUsage`,`Disk Usage`)}),(0,G.jsxs)(`span`,{className:`text-white`,children:[y.storage.disk_used_formatted,` / `,y.storage.disk_total_formatted]})]}),(0,G.jsx)(X,{percent:y.storage.disk_percent_used,color:oe}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:[y.storage.disk_free_formatted,` `,e(`system.free`,`free`),` (`,(100-y.storage.disk_percent_used).toFixed(1),`%)`]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,G.jsx)(Y,{icon:j,label:e(`system.archiveStorage`,`Archive Storage`),value:y.storage.archive_size_formatted}),(0,G.jsx)(Y,{icon:F,label:e(`system.databaseSize`,`Database Size`),value:y.storage.database_size_formatted}),K&&(0,G.jsx)(Y,{icon:z,label:e(`system.fileManagerStorage`,`File Manager`),value:ne(K.total_size_bytes),subValue:`${K.total_files} files, ${K.total_folders} folders`})]})]})}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,G.jsx)(Z,{title:e(`system.memory`,`Memory`),icon:ee,children:(0,G.jsx)(`div`,{className:`space-y-4`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-sm mb-1`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:e(`system.memoryUsage`,`Memory Usage`)}),(0,G.jsxs)(`span`,{className:`text-white`,children:[y.memory.used_formatted,` / `,y.memory.total_formatted]})]}),(0,G.jsx)(X,{percent:y.memory.percent_used,color:se}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:[y.memory.available_formatted,` `,e(`system.available`,`available`)]})]})})}),(0,G.jsx)(Z,{title:e(`system.cpu`,`CPU`),icon:h,children:(0,G.jsx)(`div`,{className:`space-y-4`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,G.jsx)(Y,{icon:h,label:e(`system.cores`,`Cores`),value:y.cpu.count,subValue:`${y.cpu.count_logical} logical`}),(0,G.jsx)(Y,{icon:h,label:e(`system.usage`,`Usage`),value:`${y.cpu.percent}%`})]})})})]}),(0,G.jsx)(Z,{title:e(`system.systemDetails`,`System Details`),icon:O,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsx)(Y,{icon:O,label:e(`system.os`,`Operating System`),value:y.system.platform,subValue:y.system.platform_release}),(0,G.jsx)(Y,{icon:h,label:e(`system.architecture`,`Architecture`),value:y.system.architecture}),(0,G.jsx)(Y,{icon:O,label:e(`system.python`,`Python`),value:y.system.python_version}),(0,G.jsx)(Y,{icon:N,label:e(`system.bootTime`,`Boot Time`),value:C(y.system.boot_time,re)})]})}),m&&(0,G.jsx)(I,{printerId:m.id,printerName:m.name,onClose:()=>v(null)})]})}export{Q as SystemInfoPage}; \ No newline at end of file diff --git a/static/assets/ToastContext-BRX0SW3C.js b/static/assets/ToastContext-BRX0SW3C.js new file mode 100644 index 000000000..7726ac0af --- /dev/null +++ b/static/assets/ToastContext-BRX0SW3C.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,D as n,w as r}from"./client-DnySrlFv.js";import{t as i}from"./createLucideIcon-DvBYJlWL.js";import{a,i as o,n as s,r as c,t as l}from"./info-ROUoQhJR.js";import{t as u}from"./loader-circle-BEmFtawu.js";import{t as d}from"./x-DR-Trv6U.js";import{t as f}from"./file-DDkFXH-b.js";var p=i(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),m=e(n(),1),h=t(),g=(0,m.createContext)(void 0);function _(){let e=(0,m.useContext)(g);if(!e)throw Error(`useToast must be used within a ToastProvider`);return e}var v={success:(0,h.jsx)(p,{className:`w-5 h-5 text-green-400`}),error:(0,h.jsx)(s,{className:`w-5 h-5 text-red-400`}),warning:(0,h.jsx)(c,{className:`w-5 h-5 text-yellow-400`}),info:(0,h.jsx)(l,{className:`w-5 h-5 text-blue-400`}),loading:(0,h.jsx)(u,{className:`w-5 h-5 text-bambu-green animate-spin`})},y={success:`bg-green-500/10 border-green-500/30`,error:`bg-red-500/10 border-red-500/30`,warning:`bg-yellow-500/10 border-yellow-500/30`,info:`bg-blue-500/10 border-blue-500/30`,loading:`bg-bambu-green/10 border-bambu-green/30`},b=`background-dispatch`,x=3500,S=3e3,C=2*S,w=new Set([`error`,`warning`]);function T(e){return e.status===`processing`&&typeof e.uploadProgressPct==`number`&&e.uploadProgressPct>=99.9}function E(e){return{total:e.length,processing:e.filter(e=>e.status===`processing`).length,completed:e.filter(e=>e.status===`completed`).length,failed:e.filter(e=>e.status===`failed`).length,jobs:e}}function D({children:e}){let{t}=r(),[n,i]=(0,m.useState)([]),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(!1),p=(0,m.useRef)(new Map),_=(0,m.useRef)(!0);(0,m.useEffect)(()=>{_.current=!0;let e=p.current;return()=>{_.current=!1,e.forEach(e=>clearTimeout(e)),e.clear()}},[]);let D=(0,m.useCallback)((e,t=`success`)=>{if(!_.current)return;let n=Math.random().toString(36).substr(2,9);i(r=>[...r,{id:n,message:e,type:t}]);let r=setTimeout(()=>{_.current&&(i(e=>e.filter(e=>e.id!==n)),p.current.delete(n))},w.has(t)?C:S);p.current.set(n,r)},[]),O=(0,m.useCallback)((e,t,n=`info`,r)=>{_.current&&i(i=>i.find(t=>t.id===e)?i.map(i=>i.id===e?{...i,message:t,type:n,persistent:!0,action:r?.action}:i):[...i,{id:e,message:t,type:n,persistent:!0,action:r?.action}])},[]),k=(0,m.useCallback)(e=>{if(!_.current)return;let t=p.current.get(e);t&&(clearTimeout(t),p.current.delete(e)),i(t=>t.filter(t=>t.id!==e))},[]);return(0,m.useEffect)(()=>{let e=e=>{if(!_.current)return;let n=e.detail;if(!n||typeof n.queue_item_id!=`number`)return;let r=n.queue_item_id;i(e=>{let i=e.find(e=>e.id===b),a=i?.dispatchData?.jobs??[],o=a.findIndex(e=>e.jobId===r),s=o>=0?a[o]:void 0,c=null,l=n.file_name||s?.sourceName||t(`dispatchToast.untitled`),u=n.printer_name||s?.printerName||(n.printer_id?`Printer ${n.printer_id}`:``);switch(n.type){case`queue_item_uploading`:c={jobId:r,sourceName:l,printerName:u,status:`processing`,uploadBytes:0,uploadTotalBytes:n.total_bytes,uploadProgressPct:0};break;case`queue_item_upload_progress`:if(!s)return e;c={...s,uploadBytes:n.bytes_transferred,uploadTotalBytes:n.total_bytes??s.uploadTotalBytes,uploadProgressPct:n.pct};break;case`queue_item_acked`:if(!s)return e;c={...s,status:`completed`,uploadProgressPct:100};break;case`queue_item_failed`:if(!s)return e;c={...s,status:`failed`,failReason:n.reason};break;default:return e}let d;s?(d=[...a],d[o]=c):d=[...a,c];let f=E(d),p={id:b,message:t(`dispatchToast.startingPrints`),type:`loading`,persistent:!0,dispatchData:f};return i?e.map(e=>e.id===b?p:e):[...e,p]})};return window.addEventListener(`bambuddy:dispatch-toast`,e),()=>window.removeEventListener(`bambuddy:dispatch-toast`,e)},[t]),(0,m.useEffect)(()=>{let e=n.find(e=>e.id===b);if(!e?.dispatchData)return;let t=e.dispatchData;if(t.total===0||t.processing!==0)return;let r=p.current.get(b);r&&clearTimeout(r);let a=setTimeout(()=>{_.current&&(i(e=>e.filter(e=>e.id!==b)),p.current.delete(b))},x);p.current.set(b,a)},[n]),(0,h.jsxs)(g.Provider,{value:{showToast:D,showPersistentToast:O,dismissToast:k,setViewportSuppressed:c},children:[e,(0,h.jsx)(`div`,{"data-testid":`toast-viewport`,className:`fixed z-[60] flex flex-col items-end gap-2 ${s?`hidden`:``}`,style:{bottom:`calc(1rem + env(safe-area-inset-bottom))`,right:`calc(5rem + env(safe-area-inset-right))`},children:n.map(e=>(0,h.jsx)(`div`,{className:`rounded-lg border shadow-lg backdrop-blur-sm animate-slide-in ${y[e.type]} ${e.dispatchData?`w-[420px] p-3`:`flex items-center gap-3 px-4 py-3`}`,style:{maxWidth:`calc(100vw - 6rem - env(safe-area-inset-left) - env(safe-area-inset-right))`},"data-testid":e.dispatchData?`dispatch-toast-wrapper`:void 0,children:e.dispatchData?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex items-start gap-2`,children:[v[e.type],(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:`text-white text-sm font-medium`,children:t(`dispatchToast.startingPrints`)}),(0,h.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:t(`dispatchToast.progressSummary`,{complete:e.dispatchData.completed+e.dispatchData.failed,total:e.dispatchData.total,processing:e.dispatchData.processing})})]})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`button`,{onClick:()=>u(e=>!e),className:`text-bambu-gray hover:text-white transition-colors`,"aria-label":t(l?`dispatchToast.expandDetails`:`dispatchToast.collapseDetails`),"data-testid":`dispatch-toast-collapse`,children:l?(0,h.jsx)(o,{className:`w-4 h-4`}):(0,h.jsx)(a,{className:`w-4 h-4`})}),(0,h.jsx)(`button`,{onClick:()=>k(e.id),className:`text-bambu-gray hover:text-white transition-colors`,"aria-label":t(`dispatchToast.dismiss`),"data-testid":`dispatch-toast-dismiss`,children:(0,h.jsx)(d,{className:`w-4 h-4`})})]})]}),!l&&(0,h.jsx)(`div`,{className:`mt-3 space-y-2 max-h-64 overflow-y-auto pr-1`,children:e.dispatchData.jobs.map(e=>{let n=T(e);return(0,h.jsxs)(`div`,{className:`rounded border border-white/10 bg-black/15 p-2`,"data-testid":`dispatch-toast-job-${e.jobId}`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,h.jsx)(`span`,{className:`text-xs text-white truncate min-w-0 flex-1`,title:e.sourceName,children:e.sourceName}),(0,h.jsx)(`span`,{className:`text-[11px] uppercase tracking-wide text-bambu-gray shrink-0`,"data-testid":`dispatch-toast-status-${e.jobId}`,children:t(`dispatchToast.status.${e.status}`)})]}),e.printerName&&(0,h.jsx)(`div`,{className:`text-[11px] text-bambu-gray truncate`,title:e.printerName,children:e.printerName}),e.status===`processing`?n?(0,h.jsx)(`div`,{className:`text-[11px] text-bambu-gray truncate`,children:t(`dispatchToast.awaitingPrinter`)}):typeof e.uploadBytes==`number`&&typeof e.uploadTotalBytes==`number`&&e.uploadTotalBytes>0?(0,h.jsxs)(`div`,{className:`text-[11px] text-bambu-gray truncate`,children:[f(e.uploadBytes),` / `,f(e.uploadTotalBytes),typeof e.uploadProgressPct==`number`?` (${e.uploadProgressPct.toFixed(1)}%)`:``]}):null:e.status===`failed`&&e.failReason?(0,h.jsx)(`div`,{className:`text-[11px] text-red-400 truncate`,children:t(`dispatchToast.failed.${e.failReason}`,{defaultValue:t(`dispatchToast.failed.generic`)})}):null,(0,h.jsx)(`div`,{className:`mt-1 h-1.5 w-full rounded bg-white/10 overflow-hidden`,children:(0,h.jsx)(`div`,{className:`h-full ${{processing:`bg-bambu-green`,completed:`bg-green-500`,failed:`bg-red-500`}[e.status]} transition-all duration-300 ${n?`animate-pulse`:``}`,style:{width:`${e.status===`processing`&&typeof e.uploadProgressPct==`number`?Math.max(0,Math.min(100,e.uploadProgressPct)):{processing:60,completed:100,failed:100}[e.status]}%`}})})]},e.jobId)})})]}):(0,h.jsxs)(h.Fragment,{children:[v[e.type],(0,h.jsx)(`span`,{className:`text-white text-sm`,children:e.message}),e.action&&(0,h.jsx)(`a`,{href:e.action.href,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{e.action?.onClick?.(),k(e.id)},className:`ml-2 px-2 py-1 rounded text-xs font-medium bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30 whitespace-nowrap`,children:e.action.label}),(0,h.jsx)(`button`,{onClick:()=>k(e.id),className:`ml-2 text-bambu-gray hover:text-white transition-colors`,children:(0,h.jsx)(d,{className:`w-4 h-4`})})]})},e.id))})]})}export{_ as n,p as r,D as t}; \ No newline at end of file diff --git a/static/assets/Toggle-KiqA_5fU.js b/static/assets/Toggle-KiqA_5fU.js new file mode 100644 index 000000000..aa6795a33 --- /dev/null +++ b/static/assets/Toggle-KiqA_5fU.js @@ -0,0 +1 @@ +import{C as e}from"./client-DnySrlFv.js";var t=e();function n({checked:e,onChange:n,disabled:r}){return(0,t.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,disabled:r,onClick:t=>{t.preventDefault(),t.stopPropagation(),r||n(!e)},className:`relative inline-flex w-11 h-7 md:w-9 md:h-5 rounded-full transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${r?`bg-bambu-dark-tertiary/50 cursor-not-allowed opacity-50`:e?`bg-bambu-green cursor-pointer`:`bg-bambu-dark-tertiary cursor-pointer hover:bg-bambu-dark-tertiary/80`}`,children:(0,t.jsx)(`span`,{className:`pointer-events-none absolute top-[3px] md:top-[2px] left-[3px] md:left-[2px] w-5 h-5 md:w-4 md:h-4 bg-white rounded-full shadow transition-transform duration-200 ease-in-out ${e?`translate-x-4`:`translate-x-0`}`})})}export{n as t}; \ No newline at end of file diff --git a/static/assets/arrow-down-Cj0DZhNf.js b/static/assets/arrow-down-Cj0DZhNf.js new file mode 100644 index 000000000..a43c279f7 --- /dev/null +++ b/static/assets/arrow-down-Cj0DZhNf.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/arrow-left-0Q6F2rjC.js b/static/assets/arrow-left-0Q6F2rjC.js new file mode 100644 index 000000000..9c8ae060e --- /dev/null +++ b/static/assets/arrow-left-0Q6F2rjC.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/arrow-right-DedpIMhP.js b/static/assets/arrow-right-DedpIMhP.js new file mode 100644 index 000000000..33fc95d59 --- /dev/null +++ b/static/assets/arrow-right-DedpIMhP.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/arrow-up-D-pfJ3WZ.js b/static/assets/arrow-up-D-pfJ3WZ.js new file mode 100644 index 000000000..0101b9159 --- /dev/null +++ b/static/assets/arrow-up-D-pfJ3WZ.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/arrow-up-down-BdyOV_2F.js b/static/assets/arrow-up-down-BdyOV_2F.js new file mode 100644 index 000000000..75cd55fb0 --- /dev/null +++ b/static/assets/arrow-up-down-BdyOV_2F.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/box-DAdKb9s5.js b/static/assets/box-DAdKb9s5.js new file mode 100644 index 000000000..82feee90f --- /dev/null +++ b/static/assets/box-DAdKb9s5.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/briefcase-Dau7xqMY.js b/static/assets/briefcase-Dau7xqMY.js new file mode 100644 index 000000000..8de8fe223 --- /dev/null +++ b/static/assets/briefcase-Dau7xqMY.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`briefcase`,[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/calendar-BLKPnWqV.js b/static/assets/calendar-BLKPnWqV.js new file mode 100644 index 000000000..a441b3677 --- /dev/null +++ b/static/assets/calendar-BLKPnWqV.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/check-Ck0cMLU4.js b/static/assets/check-Ck0cMLU4.js new file mode 100644 index 000000000..c650a6274 --- /dev/null +++ b/static/assets/check-Ck0cMLU4.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/chevrons-right-DTJgqnxZ.js b/static/assets/chevrons-right-DTJgqnxZ.js new file mode 100644 index 000000000..4410bee59 --- /dev/null +++ b/static/assets/chevrons-right-DTJgqnxZ.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),n=e(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/static/assets/chunk-aKtaBQYM.js b/static/assets/chunk-aKtaBQYM.js new file mode 100644 index 000000000..8e7d30717 --- /dev/null +++ b/static/assets/chunk-aKtaBQYM.js @@ -0,0 +1 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),u=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});export{l as i,s as n,u as r,o as t}; \ No newline at end of file diff --git a/static/assets/client-DnySrlFv.js b/static/assets/client-DnySrlFv.js new file mode 100644 index 000000000..6a23b873a --- /dev/null +++ b/static/assets/client-DnySrlFv.js @@ -0,0 +1 @@ +import{i as e,t}from"./chunk-aKtaBQYM.js";var n=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=n()})),i=e(r()),a=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);f(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},o={},s=(e,t,n,r)=>{f(n)&&o[n]||(f(n)&&(o[n]=new Date),a(e,t,n,r))},c=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},l=(e,t,n)=>{e.loadNamespaces(t,c(e,n))},u=(e,t,n,r)=>{if(f(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return l(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,c(e,r))},d=(e,t,n={})=>!t.languages||!t.languages.length?(s(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),f=e=>typeof e==`string`,p=e=>typeof e==`object`&&!!e,m=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,h={"&":`&`,"&":`&`,"<":`<`,"<":`<`,">":`>`,">":`>`,"'":`'`,"'":`'`,""":`"`,""":`"`," ":` `," ":` `,"©":`©`,"©":`©`,"®":`®`,"®":`®`,"…":`…`,"…":`…`,"/":`/`,"/":`/`},g=e=>h[e],_={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:e=>e.replace(m,g),transDefaultProps:void 0},v=(e={})=>{_={..._,...e}},y=()=>_,b,x=e=>{b=e},S=()=>b,C={type:`3rdParty`,init(e){v(e.options.react),x(e)}},w=(0,i.createContext)(),T=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},E=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),D=t(((e,t)=>{t.exports=E()})),O=D(),k={t:(e,t)=>f(t)?t:p(t)&&f(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,ready:!1},A=()=>()=>{},j=(e,t={})=>{let{i18n:n}=t,{i18n:r,defaultNS:a}=(0,i.useContext)(w)||{},o=n||r||S();o&&!o.reportNamespaces&&(o.reportNamespaces=new T),o||s(o,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next`);let c=(0,i.useMemo)(()=>({...y(),...o?.options?.react,...t}),[o,t]),{useSuspense:p,keyPrefix:m}=c,h=e||a||o?.options?.defaultNS,g=f(h)?[h]:h||[`translation`],_=(0,i.useMemo)(()=>g,g);o?.reportNamespaces?.addUsedNamespaces?.(_);let v=(0,i.useRef)(0),b=(0,i.useCallback)(e=>{if(!o)return A;let{bindI18n:t,bindI18nStore:n}=c,r=()=>{v.current+=1,e()};return t&&o.on(t,r),n&&o.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>o.off(e,r)),n&&n.split(` `).forEach(e=>o.store.off(e,r))}},[o,c]),x=(0,i.useRef)(),C=(0,i.useCallback)(()=>{if(!o)return k;let e=!!(o.isInitialized||o.initializedStoreOnce)&&_.every(e=>d(e,o,c)),n=t.lng||o.language,r=v.current,i=x.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===m&&i.revision===r)return i;let a={t:o.getFixedT(n,c.nsMode===`fallback`?_:_[0],m),ready:e,lng:n,keyPrefix:m,revision:r};return x.current=a,a},[o,_,m,c,t.lng]),[E,D]=(0,i.useState)(0),{t:j,ready:M}=(0,O.useSyncExternalStore)(b,C,C);(0,i.useEffect)(()=>{if(o&&!M&&!p){let e=()=>D(e=>e+1);t.lng?u(o,t.lng,_,e):l(o,_,e)}},[o,t.lng,_,M,p,E]);let N=o||{},P=(0,i.useRef)(null),F=(0,i.useRef)(),I=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},L=(0,i.useMemo)(()=>{let e=N,t=e?.language,n=e;e&&(P.current&&P.current.__original===e&&F.current===t?n=P.current:(n=I(e),P.current=n,F.current=t));let r=[j,n,M];return r.t=j,r.i18n=n,r.ready=M,r},[j,N,M,N.resolvedLanguage,N.language,N.languages]);if(o&&p&&!M)throw new Promise(e=>{let n=()=>e();t.lng?u(o,t.lng,_,n):l(o,_,n)});return L},M=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),N=t(((e,t)=>{t.exports=M()})),P=`/api/v1`,F=class extends Error{status;code;detail;constructor(e,t,n=null,r=null){super(e),this.name=`ApiError`,this.status=t,this.code=n,this.detail=r}},I=sessionStorage.getItem(`auth_token`)??localStorage.getItem(`auth_token`);function L(e,t=`session`){I=e;try{e?sessionStorage.setItem(`auth_token`,e):sessionStorage.removeItem(`auth_token`)}catch(e){console.warn(`setAuthToken: sessionStorage unavailable, token kept in-memory only`,e)}try{e?t===`persistent`&&localStorage.setItem(`auth_token`,e):localStorage.removeItem(`auth_token`)}catch(e){console.warn(`setAuthToken: localStorage operation failed`,e)}}function R(){return I}var z=null,B=null;function ee(e){z=e}function V(){return z}function H(e){B=e}function U(){return B}function W(e){return z?`${e}${e.includes(`?`)?`&`:`?`}token=${encodeURIComponent(z)}`:e}function G(e){return B?`${e}${e.includes(`?`)?`&`:`?`}token=${encodeURIComponent(B)}`:e}function K(e){if(!e)return null;let t=e.match(/filename\*=(?:UTF-8|utf-8)''(.+?)(?:;|$)/);if(t)try{return decodeURIComponent(t[1])}catch{}return e.match(/filename="?([^";\n]+)"?/)?.[1]||null}function q(e){let t=e.replace(/[/\\?#]/g,`_`);return t.toLowerCase().endsWith(`.3mf`)?t:`${t}.3mf`}async function J(e,t,n){let r={"Content-Type":`application/json`};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}${e}`,{method:`POST`,headers:r,body:JSON.stringify(t),signal:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(typeof e.detail==`string`?e.detail:`HTTP ${i.status}`)}return i.blob()}async function Y(e,t={}){let n={"Content-Type":`application/json`,...t.headers};I&&(n.Authorization=`Bearer ${I}`);let r=await fetch(`${P}${e}`,{...t,cache:`no-store`,credentials:`include`,headers:n});if(!r.ok){let e=(await r.json().catch(()=>({}))).detail,t,n=null;typeof e==`string`?t=e:Array.isArray(e)?t=e.map(e=>(e.msg??``).replace(/^Value error,\s*/i,``)).filter(Boolean).join(`; `)||JSON.stringify(e)||`HTTP ${r.status}`:e&&typeof e==`object`?(n=typeof e.code==`string`?e.code:null,t=typeof e.message==`string`?e.message:`HTTP ${r.status}`):t=`HTTP ${r.status}`;let i=e&&typeof e==`object`&&!Array.isArray(e)?e:null;throw r.status===401&&[`Could not validate credentials`,`Token has expired`,`User not found or inactive`,`Invalid API key`,`API key has expired`].some(e=>t.includes(e))&&(L(null),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:expired`))),new F(t,r.status,n,i)}let i=r.headers.get(`content-length`);if(!(r.status===204||i===`0`))return await r.json()}async function X(e,t){let n=new FormData;n.append(`file`,e);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/inventory/spools/import${t?`?dry_run=true`:``}`,{method:`POST`,headers:r,body:n});if(!i.ok){let e=(await i.json().catch(()=>({})))?.detail,t=typeof e==`string`?e:e?.message;throw Error(t||`HTTP ${i.status}`)}return i.json()}var Z=[`brand`,`material`,`hex`,`name`,`location`,`material_number`,`temps`,`weight`,`note`,`added`,`qr`,`spool_id`],Q=[`brand`,`material`,`hex`,`name`,`location`,`qr`,`spool_id`],te={getOverlayLogo:async(e,t)=>{let n=e?`/overlay-branding/logo?token=${encodeURIComponent(e)}`:`/settings/overlay-logo`,r=await fetch(`${P}${n}`,{signal:t,cache:`no-store`,headers:!e&&I?{Authorization:`Bearer ${I}`}:{}});if(r.status===404)return null;if(!r.ok)throw Error(`HTTP ${r.status}`);return r.blob()},uploadOverlayLogo:async e=>{let t=new FormData;t.append(`file`,e);let n=await fetch(`${P}/settings/overlay-logo`,{method:`POST`,body:t,headers:I?{Authorization:`Bearer ${I}`}:{}});if(!n.ok){let e=(await n.json().catch(()=>({})))?.detail,t=typeof e==`string`?e:e?.message;throw Error(typeof t==`string`&&t?t:`HTTP ${n.status}`)}},deleteOverlayLogo:()=>Y(`/settings/overlay-logo`,{method:`DELETE`}),getAuthStatus:()=>Y(`/auth/status`),setupAuth:e=>Y(`/auth/setup`,{method:`POST`,body:JSON.stringify(e)}),login:e=>Y(`/auth/login`,{method:`POST`,body:JSON.stringify(e)}),logout:()=>Y(`/auth/logout`,{method:`POST`}),getCurrentUser:()=>Y(`/auth/me`),disableAuth:()=>Y(`/auth/disable`,{method:`POST`}),testSMTP:e=>Y(`/auth/smtp/test`,{method:`POST`,body:JSON.stringify(e)}),getSMTPSettings:()=>Y(`/auth/smtp`),saveSMTPSettings:e=>Y(`/auth/smtp`,{method:`POST`,body:JSON.stringify(e)}),enableAdvancedAuth:()=>Y(`/auth/advanced-auth/enable`,{method:`POST`}),disableAdvancedAuth:()=>Y(`/auth/advanced-auth/disable`,{method:`POST`}),getAdvancedAuthStatus:()=>Y(`/auth/advanced-auth/status`),getLDAPStatus:()=>Y(`/auth/ldap/status`),getEncryptionStatus:()=>Y(`/auth/encryption-status`),testLDAP:()=>Y(`/auth/ldap/test`,{method:`POST`}),searchLDAPDirectory:e=>Y(`/auth/ldap/search?q=${encodeURIComponent(e)}`),provisionLDAPUser:e=>Y(`/auth/ldap/provision`,{method:`POST`,body:JSON.stringify({username:e})}),forgotPassword:e=>Y(`/auth/forgot-password`,{method:`POST`,body:JSON.stringify(e)}),forgotPasswordConfirm:(e,t)=>Y(`/auth/forgot-password/confirm`,{method:`POST`,body:JSON.stringify({token:e,new_password:t})}),resetUserPassword:e=>Y(`/auth/reset-password`,{method:`POST`,body:JSON.stringify(e)}),get2FAStatus:()=>Y(`/auth/2fa/status`),setupTOTP:()=>Y(`/auth/2fa/totp/setup`,{method:`POST`}),enableTOTP:e=>Y(`/auth/2fa/totp/enable`,{method:`POST`,body:JSON.stringify({code:e})}),disableTOTP:e=>Y(`/auth/2fa/totp/disable`,{method:`POST`,body:JSON.stringify({code:e})}),regenerateBackupCodes:e=>Y(`/auth/2fa/totp/regenerate-backup-codes`,{method:`POST`,body:JSON.stringify({code:e})}),enableEmailOTP:()=>Y(`/auth/2fa/email/enable`,{method:`POST`}),confirmEnableEmailOTP:(e,t)=>Y(`/auth/2fa/email/enable/confirm`,{method:`POST`,body:JSON.stringify({setup_token:e,code:t})}),disableEmailOTP:e=>Y(`/auth/2fa/email/disable`,{method:`POST`,body:JSON.stringify({password:e})}),sendEmailOTP:e=>Y(`/auth/2fa/email/send`,{method:`POST`,body:JSON.stringify({pre_auth_token:e})}),verify2FA:e=>Y(`/auth/2fa/verify`,{method:`POST`,body:JSON.stringify(e)}),admin2FADisable:e=>Y(`/auth/2fa/admin/${e}`,{method:`DELETE`}),getOIDCProviders:()=>Y(`/auth/oidc/providers`),getOIDCProvidersAll:()=>Y(`/auth/oidc/providers/all`),createOIDCProvider:e=>Y(`/auth/oidc/providers`,{method:`POST`,body:JSON.stringify(e)}),updateOIDCProvider:(e,t)=>Y(`/auth/oidc/providers/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteOIDCProvider:e=>Y(`/auth/oidc/providers/${e}`,{method:`DELETE`}),oidcProviderIconUrl:e=>`/api/v1/auth/oidc/providers/${e}/icon`,deleteOIDCProviderIcon:e=>Y(`/auth/oidc/providers/${e}/icon`,{method:`DELETE`}),refreshOIDCProviderIcon:e=>Y(`/auth/oidc/providers/${e}/icon/refresh`,{method:`POST`}),getOIDCAuthorizeUrl:e=>Y(`/auth/oidc/authorize/${e}`),exchangeOIDCToken:e=>Y(`/auth/oidc/exchange`,{method:`POST`,body:JSON.stringify({oidc_token:e})}),getOIDCLinks:()=>Y(`/auth/oidc/links`),deleteOIDCLink:e=>Y(`/auth/oidc/links/${e}`,{method:`DELETE`}),getUsers:()=>Y(`/users/`),getUsersSlim:()=>Y(`/users/slim`),getUser:e=>Y(`/users/${e}`),createUser:e=>Y(`/users/`,{method:`POST`,body:JSON.stringify(e)}),updateUser:(e,t)=>Y(`/users/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteUser:(e,t=!1)=>Y(`/users/${e}?delete_items=${t}`,{method:`DELETE`}),getUserItemsCount:e=>Y(`/users/${e}/items-count`),changePassword:(e,t)=>Y(`/users/me/change-password`,{method:`POST`,body:JSON.stringify({current_password:e,new_password:t})}),getUserEmailPreferences:()=>Y(`/user-notifications/preferences`),updateUserEmailPreferences:e=>Y(`/user-notifications/preferences`,{method:`PUT`,body:JSON.stringify(e)}),getPermissions:()=>Y(`/groups/permissions`),getGroups:()=>Y(`/groups/`),getGroup:e=>Y(`/groups/${e}`),createGroup:e=>Y(`/groups/`,{method:`POST`,body:JSON.stringify(e)}),updateGroup:(e,t)=>Y(`/groups/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteGroup:e=>Y(`/groups/${e}`,{method:`DELETE`}),addUserToGroup:(e,t)=>Y(`/groups/${e}/users/${t}`,{method:`POST`}),removeUserFromGroup:(e,t)=>Y(`/groups/${e}/users/${t}`,{method:`DELETE`}),getPrinters:()=>Y(`/printers/`),getPrinter:e=>Y(`/printers/${e}`),createPrinter:e=>Y(`/printers/`,{method:`POST`,body:JSON.stringify(e)}),updatePrinter:(e,t)=>Y(`/printers/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deletePrinter:(e,t=!0)=>Y(`/printers/${e}?delete_archives=${t}`,{method:`DELETE`}),getDeveloperModeWarnings:()=>Y(`/printers/developer-mode-warnings`),getAvailableFilaments:(e,t)=>{let n=new URLSearchParams({model:e});return t&&n.set(`location`,t),Y(`/printers/available-filaments?${n}`)},getPrinterLocations:()=>Y(`/printer-locations/`),createPrinterLocation:e=>Y(`/printer-locations/`,{method:`POST`,body:JSON.stringify(e)}),updatePrinterLocation:e=>Y(`/printer-locations/`,{method:`PATCH`,body:JSON.stringify(e)}),deletePrinterLocations:e=>Y(`/printer-locations/delete`,{method:`POST`,body:JSON.stringify({names:e})}),assignPrinterLocation:(e,t)=>Y(`/printer-locations/assign`,{method:`POST`,body:JSON.stringify({printer_ids:e,location:t})}),getPrinterStatus:e=>Y(`/printers/${e}/status`),refreshPrinterStatus:e=>Y(`/printers/${e}/refresh-status`,{method:`POST`}),connectPrinter:e=>Y(`/printers/${e}/connect`,{method:`POST`}),disconnectPrinter:e=>Y(`/printers/${e}/disconnect`,{method:`POST`}),testExternalCamera:(e,t,n)=>Y(`/printers/${e}/camera/external/test?url=${encodeURIComponent(t)}&camera_type=${encodeURIComponent(n)}`,{method:`POST`}),stopPrint:e=>Y(`/printers/${e}/print/stop`,{method:`POST`}),pausePrint:e=>Y(`/printers/${e}/print/pause`,{method:`POST`}),resumePrint:e=>Y(`/printers/${e}/print/resume`,{method:`POST`}),clearPlate:e=>Y(`/printers/${e}/clear-plate`,{method:`POST`}),getCurrentPrintUser:e=>Y(`/printers/${e}/current-print-user`),setPrintSpeed:(e,t)=>Y(`/printers/${e}/print-speed?mode=${t}`,{method:`POST`}),setNozzleTemperature:(e,t,n=0)=>Y(`/printers/${e}/temperature/nozzle?target=${t}&nozzle=${n}`,{method:`POST`}),setBedTemperature:(e,t)=>Y(`/printers/${e}/temperature/bed?target=${t}`,{method:`POST`}),setChamberTemperature:(e,t)=>Y(`/printers/${e}/temperature/chamber?target=${t}`,{method:`POST`}),setFanSpeed:(e,t,n)=>Y(`/printers/${e}/fan-speed?fan=${t}&speed=${n}`,{method:`POST`}),selectExtruder:(e,t)=>Y(`/printers/${e}/select-extruder?extruder=${t}`,{method:`POST`}),setAirductMode:(e,t)=>Y(`/printers/${e}/airduct-mode?mode=${t}`,{method:`POST`}),bedJog:(e,t)=>Y(`/printers/${e}/bed-jog?distance=${t}`,{method:`POST`}),xyJog:(e,t,n)=>Y(`/printers/${e}/xy-jog?x=${t}&y=${n}`,{method:`POST`}),extruderJog:(e,t)=>Y(`/printers/${e}/extruder-jog?distance=${t}`,{method:`POST`}),homeAxes:(e,t=`z`)=>Y(`/printers/${e}/home-axes?axes=${t}`,{method:`POST`}),setChamberLight:(e,t)=>Y(`/printers/${e}/chamber-light?on=${t}`,{method:`POST`}),startDrying:(e,t,n,r,i=``,a=!1)=>Y(`/printers/${e}/drying/start?ams_id=${t}&temp=${n}&duration=${r}&filament=${encodeURIComponent(i)}&rotate_tray=${a}`,{method:`POST`}),stopDrying:(e,t)=>Y(`/printers/${e}/drying/stop?ams_id=${t}`,{method:`POST`}),createScheduledDrying:e=>Y(`/scheduled-dryings`,{method:`POST`,body:JSON.stringify(e)}),listScheduledDryings:e=>Y(e===void 0?`/scheduled-dryings`:`/scheduled-dryings?printer_id=${e}`),cancelScheduledDrying:e=>Y(`/scheduled-dryings/${e}`,{method:`DELETE`}),setAmsFilamentBackup:(e,t)=>Y(`/printers/${e}/ams-backup?enabled=${t}`,{method:`POST`}),getInventoryRemain:e=>Y(`/printers/${e}/inventory-remain`),getPrintableObjects:e=>Y(`/printers/${e}/print/objects`),skipObjects:(e,t)=>Y(`/printers/${e}/print/skip-objects`,{method:`POST`,body:JSON.stringify(t)}),clearHMSErrors:e=>Y(`/printers/${e}/hms/clear`,{method:`POST`}),executeHMSAction:(e,t)=>Y(`/printers/${e}/hms/execute-action`,{method:`POST`,body:JSON.stringify(t)}),refreshAmsSlot:(e,t,n)=>Y(`/printers/${e}/ams/${t}/slot/${n}/refresh`,{method:`POST`}),loadAmsTray:(e,t,n)=>Y(`/printers/${e}/ams/load?tray_id=${t}`+(n===void 0?``:`&extruder_id=${n}`),{method:`POST`}),unloadAms:(e,t)=>Y(`/printers/${e}/ams/unload`+(t===void 0?``:`?tray_id=${t}`),{method:`POST`}),enableMQTTLogging:e=>Y(`/printers/${e}/logging/enable`,{method:`POST`}),disableMQTTLogging:e=>Y(`/printers/${e}/logging/disable`,{method:`POST`}),getMQTTLogs:e=>Y(`/printers/${e}/logging`),clearMQTTLogs:e=>Y(`/printers/${e}/logging`,{method:`DELETE`}),getPrinterFiles:(e,t=`/`)=>Y(`/printers/${e}/files?path=${encodeURIComponent(t)}`),getPrinterFileDownloadUrl:(e,t)=>`${P}/printers/${e}/files/download?path=${encodeURIComponent(t)}`,getPrinterFileGcodeUrl:(e,t)=>`${P}/printers/${e}/files/gcode?path=${encodeURIComponent(t)}`,getPrinterFilePlates:(e,t)=>Y(`/printers/${e}/files/plates?path=${encodeURIComponent(t)}`),getPrinterFilePlateThumbnail:(e,t,n)=>G(`${P}/printers/${e}/files/plate-thumbnail/${t}?path=${encodeURIComponent(n)}`),downloadPrinterFilesAsZip:async(e,t,n,r=`printer-files.zip`,i=!0,a,o)=>{let s=null;try{if(a?.aborted)throw new DOMException(`Download cancelled`,`AbortError`);let c=await Y(`/printers/${e}/files/download-job`,{method:`POST`,body:JSON.stringify({paths:t,sizes:n,filename:r,as_zip:i}),signal:a});s=c.job_id;let l=0;for(;c.state===`queued`||c.state===`preparing`;){o?.(c.successful+c.failed,c.requested);let t=l<10?500:2e3;l+=1,await new Promise((e,n)=>{if(a?.aborted){n(new DOMException(`Download cancelled`,`AbortError`));return}let r=()=>{window.clearTimeout(i),n(new DOMException(`Download cancelled`,`AbortError`))},i=window.setTimeout(()=>{a?.removeEventListener(`abort`,r),e()},t);a?.addEventListener(`abort`,r,{once:!0})}),c=await Y(`/printers/${e}/files/download-jobs/${s}`,{signal:a})}if(o?.(c.successful+c.failed,c.requested),c.state!==`ready`||!c.token)throw Error(c.message||(c.state===`cancelled`?`Download cancelled`:`Printer download preparation failed`));let u=document.createElement(`a`);return u.href=`${P}/printers/${e}/files/dl/${encodeURIComponent(c.token)}/${encodeURIComponent(r)}`,u.download=r,document.body.appendChild(u),u.click(),u.remove(),{requested:c.requested,successful:c.successful,failed:c.failed}}catch(t){throw s&&await Y(`/printers/${e}/files/download-jobs/${s}`,{method:`DELETE`}).catch(()=>void 0),t}},deletePrinterFile:(e,t)=>Y(`/printers/${e}/files?path=${encodeURIComponent(t)}`,{method:`DELETE`}),getPrinterStorage:e=>Y(`/printers/${e}/storage`),getArchives:(e,t,n=1e4,r=0,i,a)=>{let o=new URLSearchParams;return e&&o.set(`printer_id`,String(e)),t&&o.set(`project_id`,String(t)),o.set(`limit`,String(n)),o.set(`offset`,String(r)),i&&o.set(`date_from`,i),a&&o.set(`date_to`,a),Y(`/archives/?${o}`)},getLastArchivePerPrinter:()=>Y(`/archives/last-per-printer`),getArchivesSlim:(e,t,n)=>{let r=new URLSearchParams;e&&r.set(`date_from`,e),t&&r.set(`date_to`,t),n!==void 0&&r.set(`created_by_id`,String(n));let i=r.toString();return Y(`/archives/slim${i?`?${i}`:``}`)},getArchive:e=>Y(`/archives/${e}`),getArchiveRuns:e=>Y(`/archives/${e}/runs`),getArchiveDeleteImpact:e=>Y(`/archives/${e}/delete-impact`),searchArchives:(e,t)=>{let n=new URLSearchParams;return n.set(`q`,e),t?.printerId&&n.set(`printer_id`,String(t.printerId)),t?.projectId&&n.set(`project_id`,String(t.projectId)),t?.status&&n.set(`status`,t.status),t?.limit&&n.set(`limit`,String(t.limit)),t?.offset&&n.set(`offset`,String(t.offset)),Y(`/archives/search?${n}`)},rebuildSearchIndex:()=>Y(`/archives/search/rebuild-index`,{method:`POST`}),getNo3MFWarning:()=>Y(`/archives/no-3mf-warning`),updateArchive:(e,t)=>Y(`/archives/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),toggleFavorite:e=>Y(`/archives/${e}/favorite`,{method:`POST`}),deleteArchive:(e,t=!1)=>Y(`/archives/${e}${t?`?purge_stats=true`:``}`,{method:`DELETE`}),previewArchivePurge:(e,t=!1)=>Y(`/archives/purge/preview?older_than_days=${e}&purge_stats=${t}`),executeArchivePurge:(e,t=!1)=>Y(`/archives/purge`,{method:`POST`,body:JSON.stringify({older_than_days:e,purge_stats:t})}),getArchivePurgeSettings:()=>Y(`/archives/purge/settings`),updateArchivePurgeSettings:e=>Y(`/archives/purge/settings`,{method:`PUT`,body:JSON.stringify(e)}),getArchiveStats:e=>{let t=new URLSearchParams;e?.dateFrom&&t.set(`date_from`,e.dateFrom),e?.dateTo&&t.set(`date_to`,e.dateTo),e?.createdById!==void 0&&t.set(`created_by_id`,String(e.createdById));let n=t.toString();return Y(`/archives/stats${n?`?${n}`:``}`)},getTags:()=>Y(`/archives/tags`),renameTag:(e,t)=>Y(`/archives/tags/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify({new_name:t})}),deleteTag:e=>Y(`/archives/tags/${encodeURIComponent(e)}`,{method:`DELETE`}),recalculateCosts:()=>Y(`/archives/recalculate-costs`,{method:`POST`}),getFailureAnalysis:e=>{let t=new URLSearchParams;e?.days&&t.set(`days`,String(e.days)),e?.dateFrom&&t.set(`date_from`,e.dateFrom),e?.dateTo&&t.set(`date_to`,e.dateTo),e?.printerId&&t.set(`printer_id`,String(e.printerId)),e?.projectId&&t.set(`project_id`,String(e.projectId)),e?.createdById!==void 0&&t.set(`created_by_id`,String(e.createdById));let n=t.toString();return Y(`/archives/analysis/failures${n?`?${n}`:``}`)},compareArchives:e=>Y(`/archives/compare?archive_ids=${e.join(`,`)}`),findSimilarArchives:(e,t=10)=>Y(`/archives/${e}/similar?limit=${t}`),exportArchives:async e=>{let t=new URLSearchParams;e?.format&&t.set(`format`,e.format),e?.fields&&t.set(`fields`,e.fields.join(`,`)),e?.printerId&&t.set(`printer_id`,String(e.printerId)),e?.projectId&&t.set(`project_id`,String(e.projectId)),e?.status&&t.set(`status`,e.status),e?.dateFrom&&t.set(`date_from`,e.dateFrom),e?.dateTo&&t.set(`date_to`,e.dateTo),e?.search&&t.set(`search`,e.search);let n={};I&&(n.Authorization=`Bearer ${I}`);let r=await fetch(`${P}/archives/export?${t}`,{headers:n});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.detail||`HTTP ${r.status}`)}let i=r.headers.get(`Content-Disposition`),a=e?.format===`xlsx`?`archives_export.xlsx`:`archives_export.csv`;if(i){let e=i.match(/filename="?([^"]+)"?/);e&&(a=e[1])}return{blob:await r.blob(),filename:a}},exportStats:async e=>{let t=new URLSearchParams;e?.format&&t.set(`format`,e.format),e?.days&&t.set(`days`,String(e.days)),e?.printerId&&t.set(`printer_id`,String(e.printerId)),e?.projectId&&t.set(`project_id`,String(e.projectId)),e?.createdById!==void 0&&t.set(`created_by_id`,String(e.createdById));let n={};I&&(n.Authorization=`Bearer ${I}`);let r=await fetch(`${P}/archives/stats/export?${t}`,{headers:n});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.detail||`HTTP ${r.status}`)}let i=r.headers.get(`Content-Disposition`),a=e?.format===`xlsx`?`stats_export.xlsx`:`stats_export.csv`;if(i){let e=i.match(/filename="?([^"]+)"?/);e&&(a=e[1])}return{blob:await r.blob(),filename:a}},getArchiveDuplicates:e=>Y(`/archives/${e}/duplicates`),backfillContentHashes:()=>Y(`/archives/backfill-hashes`,{method:`POST`}),getArchiveThumbnail:e=>G(`${P}/archives/${e}/thumbnail?v=${Date.now()}`),getArchivePlateThumbnail:(e,t)=>G(`${P}/archives/${e}/plate-thumbnail/${t}`),getArchiveDownload:e=>`${P}/archives/${e}/download`,downloadArchive:async(e,t)=>{let n={};I&&(n.Authorization=`Bearer ${I}`);let r=await fetch(`${P}/archives/${e}/download`,{headers:n});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.detail||`HTTP ${r.status}`)}let i=K(r.headers.get(`Content-Disposition`))||t||`archive_${e}.3mf`,a=await r.blob(),o=window.URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=i,document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(o)},getArchiveGcode:e=>`${P}/archives/${e}/gcode`,getArchivePlatePreview:e=>G(`${P}/archives/${e}/plate-preview`),getArchiveTimelapse:e=>G(`${P}/archives/${e}/timelapse?v=${Date.now()}`),downloadArchiveTimelapse:async(e,t)=>{let n=await Y(`/archives/${e}/media-download-token`,{method:`POST`}),r=document.createElement(`a`);r.href=`${P}/archives/${e}/media/dl/${encodeURIComponent(n.token)}/${encodeURIComponent(t)}`,r.download=t,document.body.appendChild(r),r.click(),r.remove()},getArchivePrinterMedia:e=>Y(`/archives/${e}/printer-media`),scanArchiveTimelapse:e=>Y(`/archives/${e}/timelapse/scan`,{method:`POST`}),selectArchiveTimelapse:(e,t)=>Y(`/archives/${e}/timelapse/select?filename=${encodeURIComponent(t)}`,{method:`POST`}),deleteArchiveTimelapse:e=>Y(`/archives/${e}/timelapse`,{method:`DELETE`}),uploadArchiveTimelapse:async(e,t)=>{let n=new FormData;n.append(`file`,t);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/archives/${e}/timelapse/upload`,{method:`POST`,headers:r,body:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}return i.json()},getTimelapseInfo:e=>Y(`/archives/${e}/timelapse/info`),getTimelapseThumbnails:(e,t=10)=>Y(`/archives/${e}/timelapse/thumbnails?count=${t}`),processTimelapse:async(e,t,n)=>{let r=new FormData;r.append(`trim_start`,String(t.trimStart??0)),t.trimEnd!==void 0&&r.append(`trim_end`,String(t.trimEnd)),r.append(`speed`,String(t.speed??1)),r.append(`save_mode`,t.saveMode),t.outputFilename&&r.append(`output_filename`,t.outputFilename),n&&r.append(`audio`,n);let i={};I&&(i.Authorization=`Bearer ${I}`);let a=await fetch(`${P}/archives/${e}/timelapse/process`,{method:`POST`,headers:i,body:r});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.detail||`HTTP ${a.status}`)}return a.json()},getArchivePhotoUrl:(e,t)=>G(`${P}/archives/${e}/photos/${encodeURIComponent(t)}`),uploadArchivePhoto:async(e,t)=>{let n=new FormData;n.append(`file`,t);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/archives/${e}/photos`,{headers:r,method:`POST`,body:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}return i.json()},deleteArchivePhoto:(e,t)=>Y(`/archives/${e}/photos/${encodeURIComponent(t)}`,{method:`DELETE`}),getSource3mfDownloadUrl:e=>`${P}/archives/${e}/source`,downloadSource3mf:async e=>{let t={};I&&(t.Authorization=`Bearer ${I}`);let n=await fetch(`${P}/archives/${e}/source`,{headers:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.detail||`HTTP ${n.status}`)}let r=K(n.headers.get(`Content-Disposition`))||`source_${e}.3mf`,i=await n.blob(),a=window.URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=r,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(a)},getSource3mfForSlicer:(e,t)=>{let n=t.replace(/[/\\?#]/g,`_`);return`${P}/archives/${e}/source/${encodeURIComponent(n.endsWith(`.3mf`)?n:n+`.3mf`)}`},createSourceSlicerToken:e=>Y(`/archives/${e}/source-slicer-token`,{method:`POST`}),getSourceSlicerDownloadUrl:(e,t,n)=>{let r=n.replace(/[/\\?#]/g,`_`);return`${P}/archives/${e}/source-dl/${t}/${encodeURIComponent(r.endsWith(`.3mf`)?r:r+`.3mf`)}`},uploadSource3mf:async(e,t)=>{let n=new FormData;n.append(`file`,t);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/archives/${e}/source`,{method:`POST`,headers:r,body:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}return i.json()},deleteSource3mf:e=>Y(`/archives/${e}/source`,{method:`DELETE`}),getF3dDownloadUrl:e=>`${P}/archives/${e}/f3d`,downloadF3d:async e=>{let t={};I&&(t.Authorization=`Bearer ${I}`);let n=await fetch(`${P}/archives/${e}/f3d`,{headers:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.detail||`HTTP ${n.status}`)}let r=K(n.headers.get(`Content-Disposition`))||`archive_${e}.f3d`,i=await n.blob(),a=window.URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=r,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(a)},uploadF3d:async(e,t)=>{let n=new FormData;n.append(`file`,t);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/archives/${e}/f3d`,{method:`POST`,headers:r,body:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}return i.json()},deleteF3d:e=>Y(`/archives/${e}/f3d`,{method:`DELETE`}),getArchiveQRCodeUrl:(e,t=200)=>G(`${P}/archives/${e}/qrcode?size=${t}`),getArchiveCapabilities:e=>Y(`/archives/${e}/capabilities`),getArchiveProjectPage:e=>Y(`/archives/${e}/project-page`),updateArchiveProjectPage:(e,t)=>Y(`/archives/${e}/project-page`,{method:`PATCH`,body:JSON.stringify(t)}),getArchiveProjectImageUrl:(e,t)=>G(`${P}/archives/${e}/project-image/${encodeURIComponent(t)}`),getArchiveForSlicer:(e,t)=>{let n=t.replace(/[/\\?#]/g,`_`);return`${P}/archives/${e}/file/${encodeURIComponent(n.endsWith(`.3mf`)?n:n+`.3mf`)}`},createArchiveSlicerToken:e=>Y(`/archives/${e}/slicer-token`,{method:`POST`}),getArchiveSlicerDownloadUrl:(e,t,n)=>{let r=n.replace(/[/\\?#]/g,`_`);return`${P}/archives/${e}/dl/${t}/${encodeURIComponent(r.endsWith(`.3mf`)?r:r+`.3mf`)}`},getArchivePlates:e=>Y(`/archives/${e}/plates`),getArchiveFilamentRequirements:(e,t,n,r)=>{let i=new URLSearchParams;return t!==void 0&&i.set(`plate_id`,String(t)),n&&i.set(`request_id`,n),r&&i.set(`full_slots`,`true`),Y(`/archives/${e}/filament-requirements${i.toString()?`?${i}`:``}`)},uploadArchive:async(e,t)=>{let n=new FormData;n.append(`file`,e);let r=t?`${P}/archives/upload?printer_id=${t}`:`${P}/archives/upload`,i={};I&&(i.Authorization=`Bearer ${I}`);let a=await fetch(r,{method:`POST`,headers:i,body:n});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.detail||`HTTP ${a.status}`)}return a.json()},uploadArchivesBulk:async(e,t)=>{let n=new FormData;e.forEach(e=>n.append(`files`,e));let r=t?`${P}/archives/upload-bulk?printer_id=${t}`:`${P}/archives/upload-bulk`,i={};I&&(i.Authorization=`Bearer ${I}`);let a=await fetch(r,{method:`POST`,headers:i,body:n});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.detail||`HTTP ${a.status}`)}return a.json()},getPrintLog:e=>{let t=new URLSearchParams;return e?.search&&t.set(`search`,e.search),e?.printerId&&t.set(`printer_id`,String(e.printerId)),e?.username&&t.set(`created_by_username`,e.username),e?.status&&t.set(`status`,e.status),e?.dateFrom&&t.set(`date_from`,e.dateFrom),e?.dateTo&&t.set(`date_to`,e.dateTo),e?.limit&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset)),e?.sortBy&&t.set(`sort_by`,e.sortBy),e?.sortDir&&t.set(`sort_dir`,e.sortDir),Y(`/print-log/?${t}`)},getPrintLogThumbnail:e=>G(`${P}/print-log/${e}/thumbnail`),clearPrintLog:()=>Y(`/print-log/`,{method:`DELETE`}),deletePrintLogEntry:e=>Y(`/print-log/${e}`,{method:`DELETE`}),updatePrintLogEntry:(e,t)=>Y(`/print-log/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),getSettings:()=>Y(`/settings/`),getDefaultSidebarOrder:()=>Y(`/settings/default-sidebar-order`),getUiPreferences:()=>Y(`/settings/ui-preferences`),getUiFlags:()=>Y(`/settings/ui-flags`),updateSettings:e=>Y(`/settings/`,{method:`PUT`,body:JSON.stringify(e)}),getMQTTStatus:()=>Y(`/settings/mqtt/status`),resetSettings:()=>Y(`/settings/reset`,{method:`POST`}),exportBackup:async()=>{let e=`${P}/settings/backup`,t={};I&&(t.Authorization=`Bearer ${I}`);let n=await fetch(e,{headers:t});if(!n.ok){let e=await n.text();throw Error(e||`Backup failed with status ${n.status}`)}let r=n.headers.get(`Content-Disposition`),i=`bambuddy-backup.zip`;if(r){let e=r.match(/filename=([^;]+)/);e&&(i=e[1].trim().replace(/^"(.*)"$/,`$1`))}return{blob:await n.blob(),filename:i}},importBackup:async e=>{let t=new FormData;t.append(`file`,e);let n=`${P}/settings/restore`,r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(n,{method:`POST`,headers:r,body:t}),a=await i.json().catch(()=>null);return i.ok?a??{success:!1,message:``}:{success:!1,message:a?.detail??a?.message??``}},checkFfmpeg:()=>Y(`/settings/check-ffmpeg`),getNetworkInterfaces:()=>Y(`/settings/network-interfaces`),getCloudStatus:()=>Y(`/cloud/status`),cloudLogin:(e,t,n=`global`)=>Y(`/cloud/login`,{method:`POST`,body:JSON.stringify({email:e,password:t,region:n})}),cloudVerify:(e,t,n,r=`global`)=>Y(`/cloud/verify`,{method:`POST`,body:JSON.stringify({email:e,code:t,tfa_key:n,region:r})}),cloudSetToken:(e,t=`global`)=>Y(`/cloud/token`,{method:`POST`,body:JSON.stringify({access_token:e,region:t})}),cloudLogout:()=>Y(`/cloud/logout`,{method:`POST`}),orcaCloudDeviceStart:()=>Y(`/orca-cloud/device/start`,{method:`POST`}),orcaCloudDevicePoll:()=>Y(`/orca-cloud/device/poll`,{method:`POST`}),orcaCloudStatus:()=>Y(`/orca-cloud/status`),orcaCloudLogout:()=>Y(`/orca-cloud/logout`,{method:`POST`}),orcaCloudListProfiles:()=>Y(`/orca-cloud/profiles`),orcaCloudGetProfile:e=>Y(`/orca-cloud/profiles/${e}`),getCloudSettings:(e=`02.04.00.70`)=>Y(`/cloud/settings?version=${e}`),getBuiltinFilaments:()=>Y(`/cloud/builtin-filaments`),getFilamentIdMap:()=>Y(`/cloud/filament-id-map`),getColorByMaterial:(e,t)=>{let n=new URLSearchParams({hex:e});return t&&n.set(`material`,t),Y(`/inventory/colors/by-material?${n.toString()}`)},getMakerworldStatus:()=>Y(`/makerworld/status`),resolveMakerworldUrl:e=>Y(`/makerworld/resolve`,{method:`POST`,body:JSON.stringify({url:e})}),getMakerworldRecentImports:(e=10)=>Y(`/makerworld/recent-imports?limit=${e}`),importMakerworldInstance:(e,t,n,r)=>Y(`/makerworld/import`,{method:`POST`,body:JSON.stringify({model_id:e,instance_id:t??null,profile_id:n??null,folder_id:r??null})}),getManyfoldConfig:()=>Y(`/manyfold/config`),updateManyfoldConfig:e=>Y(`/manyfold/config`,{method:`PUT`,body:JSON.stringify(e)}),deleteManyfoldConfig:()=>Y(`/manyfold/config`,{method:`DELETE`}),testManyfoldConfig:e=>Y(`/manyfold/config/test`,{method:`POST`,body:JSON.stringify(e)}),getManyfoldStatus:()=>Y(`/manyfold/status`),listManyfoldModels:(e,t)=>{let n=new URLSearchParams({page:String(t)});return e&&n.set(`q`,e),Y(`/manyfold/models?${n.toString()}`)},getManyfoldModel:e=>Y(`/manyfold/models/${encodeURIComponent(e)}`),getManyfoldPreview:async e=>{let t={};I&&(t.Authorization=`Bearer ${I}`);let n=await fetch(`${P}/manyfold/models/${encodeURIComponent(e)}/preview`,{headers:t});return n.ok?n.blob():null},importManyfoldFile:(e,t,n)=>Y(`/manyfold/import`,{method:`POST`,body:JSON.stringify({model_id:e,file_id:t,folder_id:n})}),getCloudSettingDetail:e=>Y(`/cloud/settings/${e}`),createCloudSetting:e=>Y(`/cloud/settings`,{method:`POST`,body:JSON.stringify(e)}),updateCloudSetting:(e,t)=>Y(`/cloud/settings/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteCloudSetting:e=>Y(`/cloud/settings/${e}`,{method:`DELETE`}),getCloudDevices:()=>Y(`/cloud/devices`),getCloudFields:e=>Y(`/cloud/fields/${e}`),getAllCloudFields:()=>Y(`/cloud/fields`),getFilamentInfo:e=>Y(`/cloud/filament-info`,{method:`POST`,body:JSON.stringify(e)}),getSmartPlugs:()=>Y(`/smart-plugs/`),getSmartPlug:e=>Y(`/smart-plugs/${e}`),getSmartPlugByPrinter:e=>Y(`/smart-plugs/by-printer/${e}`),getScriptPlugsByPrinter:e=>Y(`/smart-plugs/by-printer/${e}/scripts`),createSmartPlug:e=>Y(`/smart-plugs/`,{method:`POST`,body:JSON.stringify(e)}),updateSmartPlug:(e,t)=>Y(`/smart-plugs/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteSmartPlug:e=>Y(`/smart-plugs/${e}`,{method:`DELETE`}),controlSmartPlug:(e,t)=>Y(`/smart-plugs/${e}/control`,{method:`POST`,body:JSON.stringify({action:t})}),getSmartPlugStatus:e=>Y(`/smart-plugs/${e}/status`),testSmartPlugConnection:(e,t,n)=>Y(`/smart-plugs/test-connection`,{method:`POST`,body:JSON.stringify({ip_address:e,username:t,password:n})}),startTasmotaScan:()=>Y(`/smart-plugs/discover/scan`,{method:`POST`}),getTasmotaScanStatus:()=>Y(`/smart-plugs/discover/status`),stopTasmotaScan:()=>Y(`/smart-plugs/discover/stop`,{method:`POST`}),getDiscoveredTasmotaDevices:()=>Y(`/smart-plugs/discover/devices`),testHAConnection:(e,t)=>Y(`/smart-plugs/ha/test-connection`,{method:`POST`,body:JSON.stringify({url:e,token:t})}),getHAEntities:e=>Y(`/smart-plugs/ha/entities${e?`?search=${encodeURIComponent(e)}`:``}`),getHASensorEntities:()=>Y(`/smart-plugs/ha/sensors`),getHASensors:e=>Y(`/ha-sensors/${e?`?printer_id=${e}`:``}`),getHASensorReadings:e=>Y(`/ha-sensors/by-printer/${e}/readings`),getBindableHAEntities:e=>Y(`/ha-sensors/entities${e?`?search=${encodeURIComponent(e)}`:``}`),createHASensor:e=>Y(`/ha-sensors/`,{method:`POST`,body:JSON.stringify(e)}),updateHASensor:(e,t)=>Y(`/ha-sensors/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteHASensor:e=>Y(`/ha-sensors/${e}`,{method:`DELETE`}),getLocationHASensors:e=>Y(`/location-ha-sensors/${e?`?location_id=${e}`:``}`),getLocationHASensorReadings:(e,t=!0)=>Y(`/location-ha-sensors/by-location/${e}/readings?show_on_card=${t}`),getBindableLocationHAEntities:e=>Y(`/location-ha-sensors/entities${e?`?search=${encodeURIComponent(e)}`:``}`),createLocationHASensor:e=>Y(`/location-ha-sensors/`,{method:`POST`,body:JSON.stringify(e)}),updateLocationHASensor:(e,t)=>Y(`/location-ha-sensors/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteLocationHASensor:e=>Y(`/location-ha-sensors/${e}`,{method:`DELETE`}),testRESTConnection:(e,t=`GET`,n)=>Y(`/smart-plugs/rest/test-connection`,{method:`POST`,body:JSON.stringify({url:e,method:t,headers:n})}),getQueue:(e,t,n)=>{let r=new URLSearchParams;return e&&r.set(`printer_id`,String(e)),t&&r.set(`status`,t),n&&r.set(`target_model`,n),Y(`/queue/?${r}`)},getQueueItem:e=>Y(`/queue/${e}`),addToQueue:e=>Y(`/queue/`,{method:`POST`,body:JSON.stringify(e)}),updateQueueItem:(e,t)=>Y(`/queue/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),removeFromQueue:e=>Y(`/queue/${e}`,{method:`DELETE`}),reorderQueue:e=>Y(`/queue/reorder`,{method:`POST`,body:JSON.stringify({items:e})}),cancelQueueItem:e=>Y(`/queue/${e}/cancel`,{method:`POST`}),stopQueueItem:e=>Y(`/queue/${e}/stop`,{method:`POST`}),startQueueItem:(e,t)=>Y(`/queue/${e}/start${t?.skipFilamentCheck?`?skip_filament_check=true`:``}`,{method:`POST`}),resumeQueueAfterFailure:e=>Y(`/queue/printer/${e}/resume`,{method:`POST`}),bulkUpdateQueue:e=>Y(`/queue/bulk`,{method:`PATCH`,body:JSON.stringify(e)}),getBatches:e=>Y(`/queue/batches${e?`?status=${e}`:``}`),getBatch:e=>Y(`/queue/batches/${e}`),cancelBatch:e=>Y(`/queue/batches/${e}`,{method:`DELETE`}),createBatch:e=>Y(`/queue/batches`,{method:`POST`,body:JSON.stringify(e)}),updateBatch:(e,t)=>Y(`/queue/batches/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),dispatchBatch:(e,t={})=>Y(`/queue/batches/${e}/dispatch`,{method:`POST`,body:JSON.stringify(t)}),ungroupBatch:e=>Y(`/queue/batches/${e}/ungroup`,{method:`POST`}),getKProfiles:(e,t=`0.4`)=>Y(`/printers/${e}/kprofiles/?nozzle_diameter=${t}`),setKProfile:(e,t)=>Y(`/printers/${e}/kprofiles/`,{method:`POST`,body:JSON.stringify(t)}),deleteKProfile:(e,t)=>Y(`/printers/${e}/kprofiles/`,{method:`DELETE`,body:JSON.stringify(t)}),setKProfilesBatch:(e,t)=>Y(`/printers/${e}/kprofiles/batch`,{method:`POST`,body:JSON.stringify(t)}),getMyBalance:()=>Y(`/finance/me/balance`),getMyTransactions:(e=50,t=0)=>Y(`/finance/me/transactions?limit=${e}&offset=${t}`),getAllTransactions:(e=50,t=0,n)=>{let r=new URLSearchParams;return r.set(`limit`,String(e)),r.set(`offset`,String(t)),n!==void 0&&r.set(`user_id`,String(n)),Y(`/finance/transactions?${r.toString()}`)},deleteTransaction:e=>Y(`/finance/transactions/${e}`,{method:`DELETE`}),editTransaction:(e,t)=>Y(`/finance/transactions/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),createManualPrint:e=>Y(`/finance/transactions/manual`,{method:`POST`,body:JSON.stringify(e)}),getMyCostCenters:()=>Y(`/finance/cost-centers/mine`),listCostCenters:(e=!1)=>Y(`/finance/cost-centers?include_inactive=${e?`true`:`false`}`),createCostCenter:e=>Y(`/finance/cost-centers`,{method:`POST`,body:JSON.stringify(e)}),updateCostCenter:(e,t)=>Y(`/finance/cost-centers/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),updateCostCenterBudgets:(e,t)=>Y(`/finance/cost-centers/${e}/budgets`,{method:`PATCH`,body:JSON.stringify(t)}),deleteCostCenter:e=>Y(`/finance/cost-centers/${e}`,{method:`DELETE`}),getCostCenter:e=>Y(`/finance/cost-centers/${e}`),upsertCostCenterMember:(e,t)=>Y(`/finance/cost-centers/${e}/members`,{method:`POST`,body:JSON.stringify(t)}),removeCostCenterMember:(e,t)=>Y(`/finance/cost-centers/${e}/members/${t}`,{method:`DELETE`}),depositUserBalance:(e,t)=>Y(`/finance/users/${e}/deposit`,{method:`POST`,body:JSON.stringify(t)}),withdrawUserBalance:(e,t)=>Y(`/finance/users/${e}/withdraw`,{method:`POST`,body:JSON.stringify(t)}),rebuildBalanceLedger:()=>Y(`/finance/rebuild-balance-ledger`,{method:`POST`}),getKProfileNotes:e=>Y(`/printers/${e}/kprofiles/notes`),setKProfileNote:(e,t,n)=>Y(`/printers/${e}/kprofiles/notes`,{method:`PUT`,body:JSON.stringify({setting_id:t,note:n})}),deleteKProfileNote:(e,t)=>Y(`/printers/${e}/kprofiles/notes/${encodeURIComponent(t)}`,{method:`DELETE`}),getSlotPresets:e=>Y(`/printers/${e}/slot-presets`),getSlotPreset:(e,t,n)=>Y(`/printers/${e}/slot-presets/${t}/${n}`),saveSlotPreset:(e,t,n,r,i,a=`cloud`,o)=>Y(`/printers/${e}/slot-presets/${t}/${n}?preset_id=${encodeURIComponent(r)}&preset_name=${encodeURIComponent(i)}&preset_source=${encodeURIComponent(a)}${o?`&tray_info_idx=${encodeURIComponent(o)}`:``}`,{method:`PUT`}),deleteSlotPreset:(e,t,n)=>Y(`/printers/${e}/slot-presets/${t}/${n}`,{method:`DELETE`}),getAmsLabels:e=>Y(`/printers/${e}/ams-labels`),saveAmsLabel:(e,t,n,r=``)=>Y(`/printers/${e}/ams-labels/${t}`,{method:`PUT`,body:JSON.stringify({label:n,ams_serial:r})}),deleteAmsLabel:(e,t,n=``)=>Y(`/printers/${e}/ams-labels/${t}?ams_serial=${encodeURIComponent(n)}`,{method:`DELETE`}),configureAmsSlot:(e,t,n,r)=>{let i=new URLSearchParams({tray_info_idx:r.tray_info_idx,tray_type:r.tray_type,tray_sub_brands:r.tray_sub_brands,tray_color:r.tray_color,nozzle_temp_min:r.nozzle_temp_min.toString(),nozzle_temp_max:r.nozzle_temp_max.toString(),cali_idx:r.cali_idx.toString(),nozzle_diameter:r.nozzle_diameter});return r.setting_id&&i.set(`setting_id`,r.setting_id),r.kprofile_filament_id&&i.set(`kprofile_filament_id`,r.kprofile_filament_id),r.kprofile_setting_id&&i.set(`kprofile_setting_id`,r.kprofile_setting_id),r.k_value!==void 0&&r.k_value>0&&i.set(`k_value`,r.k_value.toString()),r.orca_profile_id&&i.set(`orca_profile_id`,r.orca_profile_id),Y(`/printers/${e}/slots/${t}/${n}/configure?${i}`,{method:`POST`})},resetAmsSlot:(e,t,n)=>Y(`/printers/${e}/ams/${t}/tray/${n}/reset`,{method:`POST`}),listFilaments:()=>Y(`/filament-catalog/`),getFilament:e=>Y(`/filament-catalog/${e}`),getFilamentsByType:e=>Y(`/filament-catalog/by-type/${e}`),getNotificationProviders:()=>Y(`/notifications/`),getNotificationProvider:e=>Y(`/notifications/${e}`),createNotificationProvider:e=>Y(`/notifications/`,{method:`POST`,body:JSON.stringify(e)}),updateNotificationProvider:(e,t)=>Y(`/notifications/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteNotificationProvider:e=>Y(`/notifications/${e}`,{method:`DELETE`}),testNotificationProvider:e=>Y(`/notifications/${e}/test`,{method:`POST`}),testNotificationConfig:e=>Y(`/notifications/test-config`,{method:`POST`,body:JSON.stringify(e)}),testAllNotificationProviders:()=>Y(`/notifications/test-all`,{method:`POST`}),getNotificationTemplates:()=>Y(`/notification-templates`),getNotificationTemplate:e=>Y(`/notification-templates/${e}`),updateNotificationTemplate:(e,t)=>Y(`/notification-templates/${e}`,{method:`PUT`,body:JSON.stringify(t)}),resetNotificationTemplate:e=>Y(`/notification-templates/${e}/reset`,{method:`POST`}),getTemplateVariables:()=>Y(`/notification-templates/variables`),previewTemplate:e=>Y(`/notification-templates/preview`,{method:`POST`,body:JSON.stringify(e)}),getNotificationLogs:e=>{let t=new URLSearchParams;return e?.limit&&t.set(`limit`,String(e.limit)),e?.offset&&t.set(`offset`,String(e.offset)),e?.provider_id&&t.set(`provider_id`,String(e.provider_id)),e?.event_type&&t.set(`event_type`,e.event_type),e?.success!==void 0&&t.set(`success`,String(e.success)),e?.days&&t.set(`days`,String(e.days)),Y(`/notifications/logs?${t}`)},getNotificationLogStats:(e=7)=>Y(`/notifications/logs/stats?days=${e}`),clearNotificationLogs:(e=30)=>Y(`/notifications/logs?older_than_days=${e}`,{method:`DELETE`}),getSpoolmanStatus:()=>Y(`/spoolman/status`),migrateSpoolmanTags:e=>Y(`/spoolman/inventory/tags/migrate?dry_run=${e}`,{method:`POST`}),connectSpoolman:()=>Y(`/spoolman/connect`,{method:`POST`}),disconnectSpoolman:()=>Y(`/spoolman/disconnect`,{method:`POST`}),syncPrinterAms:e=>Y(`/spoolman/sync/${e}`,{method:`POST`}),syncAllPrintersAms:()=>Y(`/spoolman/sync-all`,{method:`POST`}),getSpoolmanSpools:()=>Y(`/spoolman/spools`),getSpoolmanFilaments:()=>Y(`/spoolman/filaments`),getSpoolmanInventoryFilaments:()=>Y(`/spoolman/inventory/filaments`),patchSpoolmanFilament:(e,t)=>Y(`/spoolman/inventory/filaments/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),getUnlinkedSpools:()=>Y(`/spoolman/spools/unlinked`),getLinkedSpools:()=>Y(`/spoolman/spools/linked`),linkSpool:(e,t)=>Y(`/spoolman/spools/${e}/link`,{method:`POST`,body:JSON.stringify({spool_tag:t.spoolTag,printer_id:t.printerId,ams_id:t.amsId,tray_id:t.trayId})}),unlinkSpool:e=>Y(`/spoolman/spools/${e}/unlink`,{method:`POST`}),createSpoolmanSpoolFromSlot:e=>Y(`/spoolman/spools/from-slot`,{method:`POST`,body:JSON.stringify(e)}),createSpoolFromSlot:e=>Y(`/inventory/spools/from-slot`,{method:`POST`,body:JSON.stringify(e)}),getSpoolmanSettings:()=>Y(`/settings/spoolman`),updateSpoolmanSettings:e=>Y(`/settings/spoolman`,{method:`PUT`,body:JSON.stringify(e)}),getSpools:(e=!1)=>Y(`/inventory/spools?include_archived=${e}`),getSpool:e=>Y(`/inventory/spools/${e}`),createSpool:e=>Y(`/inventory/spools`,{method:`POST`,body:JSON.stringify(e)}),bulkCreateSpools:(e,t)=>Y(`/inventory/spools/bulk`,{method:`POST`,body:JSON.stringify({spool:e,quantity:t})}),importSpoolsCsvPreview:e=>X(e,!0),importSpoolsCsv:e=>X(e,!1),exportSpoolsCsv:async()=>{let e={};I&&(e.Authorization=`Bearer ${I}`);let t=await fetch(`${P}/inventory/spools/export`,{headers:e});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.detail||`HTTP ${t.status}`)}let n=K(t.headers.get(`Content-Disposition`))||`bambuddy_inventory.csv`,r=await t.blob(),i=window.URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(i)},updateSpool:(e,t)=>Y(`/inventory/spools/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteSpool:e=>Y(`/inventory/spools/${e}`,{method:`DELETE`}),archiveSpool:e=>Y(`/inventory/spools/${e}/archive`,{method:`POST`}),restoreSpool:e=>Y(`/inventory/spools/${e}/restore`,{method:`POST`}),resetSpoolConsumedCounter:e=>Y(`/inventory/spools/${e}/reset-consumed-counter`,{method:`POST`}),bulkResetSpoolConsumedCounter:e=>Y(`/inventory/spools/reset-consumed-counter-bulk`,{method:`POST`,body:JSON.stringify({spool_ids:e})}),bulkUpdateSpools:(e,t)=>Y(`/inventory/spools/bulk-update`,{method:`POST`,body:JSON.stringify({ids:e,update:t})}),bulkDeleteSpools:e=>Y(`/inventory/spools/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:e})}),bulkArchiveSpools:e=>Y(`/inventory/spools/bulk-archive`,{method:`POST`,body:JSON.stringify({ids:e})}),bulkRestoreSpools:e=>Y(`/inventory/spools/bulk-restore`,{method:`POST`,body:JSON.stringify({ids:e})}),getSpoolKProfiles:e=>Y(`/inventory/spools/${e}/k-profiles`),saveSpoolKProfiles:(e,t)=>Y(`/inventory/spools/${e}/k-profiles`,{method:`PUT`,body:JSON.stringify(t)}),getSlotSpoolDefaults:(e,t,n)=>Y(`/printers/${e}/slots/${t}/${n}/spool-defaults`),getSpoolFilamentPresets:e=>Y(`/inventory/spools/${e}/filament-presets`),saveSpoolFilamentPresets:(e,t)=>Y(`/inventory/spools/${e}/filament-presets`,{method:`PUT`,body:JSON.stringify(t)}),getAssignments:e=>Y(`/inventory/assignments${e?`?printer_id=${e}`:``}`),assignSpool:e=>Y(`/inventory/assignments`,{method:`POST`,body:JSON.stringify(e)}),unassignSpool:(e,t,n)=>Y(`/inventory/assignments/${e}/${t}/${n}`,{method:`DELETE`}),printSpoolLabels:e=>J(`/inventory/labels`,e),printSpoolmanSpoolLabels:e=>J(`/spoolman/labels`,e),previewSpoolLabel:(e,t)=>J(`/inventory/labels/preview`,e,t),previewSpoolmanSpoolLabel:(e,t)=>J(`/spoolman/labels/preview`,e,t),getSpoolCatalog:()=>Y(`/inventory/catalog`),addCatalogEntry:e=>Y(`/inventory/catalog`,{method:`POST`,body:JSON.stringify(e)}),updateCatalogEntry:(e,t)=>Y(`/inventory/catalog/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteCatalogEntry:e=>Y(`/inventory/catalog/${e}`,{method:`DELETE`}),bulkDeleteCatalogEntries:e=>Y(`/inventory/catalog/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:e})}),resetSpoolCatalog:()=>Y(`/inventory/catalog/reset`,{method:`POST`}),getSuppliers:()=>Y(`/inventory/suppliers`),createSupplier:e=>Y(`/inventory/suppliers`,{method:`POST`,body:JSON.stringify(e)}),updateSupplier:(e,t)=>Y(`/inventory/suppliers/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteSupplier:e=>Y(`/inventory/suppliers/${e}`,{method:`DELETE`}),setSpoolSuppliers:(e,t)=>Y(`/inventory/spools/${e}/suppliers`,{method:`PUT`,body:JSON.stringify(t)}),setSpoolmanSpoolSuppliers:(e,t)=>Y(`/spoolman/inventory/spools/${e}/suppliers`,{method:`PUT`,body:JSON.stringify(t)}),getSupplierStats:(e,t)=>{let n=new URLSearchParams;e&&n.set(`date_from`,e),t&&n.set(`date_to`,t);let r=n.toString();return Y(`/inventory/stats/suppliers${r?`?${r}`:``}`)},getLocations:()=>Y(`/inventory/locations`),createLocation:e=>Y(`/inventory/locations`,{method:`POST`,body:JSON.stringify(e)}),updateLocation:(e,t)=>Y(`/inventory/locations/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteLocation:e=>Y(`/inventory/locations/${e}`,{method:`DELETE`}),getColorCatalog:()=>Y(`/inventory/colors`),getColorNameMap:()=>Y(`/inventory/colors/map`),addColorEntry:e=>Y(`/inventory/colors`,{method:`POST`,body:JSON.stringify(e)}),updateColorEntry:(e,t)=>Y(`/inventory/colors/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteColorEntry:e=>Y(`/inventory/colors/${e}`,{method:`DELETE`}),bulkDeleteColorEntries:e=>Y(`/inventory/colors/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:e})}),resetColorCatalog:()=>Y(`/inventory/colors/reset`,{method:`POST`}),lookupColor:(e,t,n)=>Y(`/inventory/colors/lookup?manufacturer=${encodeURIComponent(e)}&color_name=${encodeURIComponent(t)}${n?`&material=${encodeURIComponent(n)}`:``}`),searchColors:(e,t)=>Y(`/inventory/colors/search?${e?`manufacturer=${encodeURIComponent(e)}`:``}${e&&t?`&`:``}${t?`material=${encodeURIComponent(t)}`:``}`),linkTagToSpool:(e,t)=>Y(`/inventory/spools/${e}/link-tag`,{method:`PATCH`,body:JSON.stringify(t)}),getMaterialNumberStats:e=>{let t=new URLSearchParams;e?.dateFrom&&t.set(`date_from`,e.dateFrom),e?.dateTo&&t.set(`date_to`,e.dateTo);let n=t.toString();return Y(`/inventory/stats/material-numbers${n?`?${n}`:``}`)},getSpoolUsageHistory:(e,t=50)=>Y(`/inventory/spools/${e}/usage?limit=${t}`),getAllUsageHistory:(e=100,t)=>Y(`/inventory/usage?limit=${e}${t?`&printer_id=${t}`:``}`),clearSpoolUsageHistory:e=>Y(`/inventory/spools/${e}/usage`,{method:`DELETE`}),syncWeightsFromAms:()=>Y(`/inventory/sync-ams-weights`,{method:`POST`}),getSkuSettings:()=>Y(`/inventory/sku-settings`),upsertSkuSettings:e=>Y(`/inventory/sku-settings`,{method:`POST`,body:JSON.stringify(e)}),getShoppingList:()=>Y(`/inventory/shopping-list`),addToShoppingList:e=>Y(`/inventory/shopping-list`,{method:`POST`,body:JSON.stringify(e)}),removeFromShoppingList:e=>Y(`/inventory/shopping-list/${e}`,{method:`DELETE`}),clearShoppingList:()=>Y(`/inventory/shopping-list`,{method:`DELETE`}),updateShoppingListStatus:(e,t)=>Y(`/inventory/shopping-list/${e}/status`,{method:`PATCH`,body:JSON.stringify({status:t})}),getFilamentPresets:()=>Y(`/cloud/filaments`),getSpoolmanInventorySpools:(e=!1)=>Y(`/spoolman/inventory/spools?include_archived=${e}`),getSpoolmanInventorySpool:e=>Y(`/spoolman/inventory/spools/${e}`),createSpoolmanInventorySpool:e=>Y(`/spoolman/inventory/spools`,{method:`POST`,body:JSON.stringify(e)}),bulkCreateSpoolmanInventorySpools:(e,t)=>Y(`/spoolman/inventory/spools/bulk`,{method:`POST`,body:JSON.stringify({spool:e,quantity:t})}),updateSpoolmanInventorySpool:(e,t)=>Y(`/spoolman/inventory/spools/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteSpoolmanInventorySpool:e=>Y(`/spoolman/inventory/spools/${e}`,{method:`DELETE`}),archiveSpoolmanInventorySpool:e=>Y(`/spoolman/inventory/spools/${e}/archive`,{method:`POST`}),restoreSpoolmanInventorySpool:e=>Y(`/spoolman/inventory/spools/${e}/restore`,{method:`POST`}),resetSpoolmanInventorySpoolConsumedCounter:e=>Y(`/spoolman/inventory/spools/${e}/reset-consumed-counter`,{method:`POST`}),bulkResetSpoolmanInventorySpoolConsumedCounter:e=>Y(`/spoolman/inventory/spools/reset-consumed-counter-bulk`,{method:`POST`,body:JSON.stringify({spool_ids:e})}),bulkUpdateSpoolmanInventorySpools:(e,t)=>Y(`/spoolman/inventory/spools/bulk-update`,{method:`POST`,body:JSON.stringify({ids:e,update:t})}),bulkDeleteSpoolmanInventorySpools:e=>Y(`/spoolman/inventory/spools/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:e})}),bulkArchiveSpoolmanInventorySpools:e=>Y(`/spoolman/inventory/spools/bulk-archive`,{method:`POST`,body:JSON.stringify({ids:e})}),bulkRestoreSpoolmanInventorySpools:e=>Y(`/spoolman/inventory/spools/bulk-restore`,{method:`POST`,body:JSON.stringify({ids:e})}),linkTagToSpoolmanSpool:(e,t)=>Y(`/spoolman/inventory/spools/${e}/tag`,{method:`PATCH`,body:JSON.stringify(t)}),syncSpoolmanSpoolWeight:(e,t)=>Y(`/spoolman/inventory/spools/${e}/weight`,{method:`PATCH`,body:JSON.stringify({weight_grams:t})}),assignSpoolmanSlot:e=>Y(`/spoolman/inventory/slot-assignments`,{method:`POST`,body:JSON.stringify(e)}),unassignSpoolmanSlot:e=>Y(`/spoolman/inventory/slot-assignments/${e}`,{method:`DELETE`}),getSpoolmanSlotAssignment:(e,t,n)=>Y(`/spoolman/inventory/slot-assignments?printer_id=${e}&ams_id=${t}&tray_id=${n}`),getSpoolmanSlotAssignments:e=>Y(e===void 0?`/spoolman/inventory/slot-assignments/all`:`/spoolman/inventory/slot-assignments/all?printer_id=${e}`),syncSpoolmanAmsWeights:()=>Y(`/spoolman/inventory/sync-ams-weights`,{method:`POST`}),getSpoolmanKProfiles:e=>Y(`/spoolman/inventory/spools/${e}/k-profiles`),saveSpoolmanKProfiles:(e,t)=>Y(`/spoolman/inventory/spools/${e}/k-profiles`,{method:`PUT`,body:JSON.stringify(t)}),getSpoolmanFilamentPresets:e=>Y(`/spoolman/inventory/spools/${e}/filament-presets`),saveSpoolmanFilamentPresets:(e,t)=>Y(`/spoolman/inventory/spools/${e}/filament-presets`,{method:`PUT`,body:JSON.stringify(t)}),getVersion:()=>Y(`/updates/version`),checkForUpdates:()=>Y(`/updates/check`),applyUpdate:()=>Y(`/updates/apply`,{method:`POST`}),getUpdateStatus:()=>Y(`/updates/status`),getMaintenanceTypes:()=>Y(`/maintenance/types`),createMaintenanceType:e=>Y(`/maintenance/types`,{method:`POST`,body:JSON.stringify(e)}),updateMaintenanceType:(e,t)=>Y(`/maintenance/types/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteMaintenanceType:e=>Y(`/maintenance/types/${e}`,{method:`DELETE`}),restoreDefaultMaintenanceTypes:()=>Y(`/maintenance/types/restore-defaults`,{method:`POST`}),getMaintenanceOverview:()=>Y(`/maintenance/overview`),getPrinterMaintenance:e=>Y(`/maintenance/printers/${e}`),updateMaintenanceItem:(e,t)=>Y(`/maintenance/items/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),performMaintenance:(e,t)=>Y(`/maintenance/items/${e}/perform`,{method:`POST`,body:JSON.stringify({notes:t})}),getMaintenanceHistory:e=>Y(`/maintenance/items/${e}/history`),getMaintenanceSummary:()=>Y(`/maintenance/summary`),setPrinterHours:(e,t)=>Y(`/maintenance/printers/${e}/hours?total_hours=${t}`,{method:`PATCH`}),assignMaintenanceType:(e,t)=>Y(`/maintenance/printers/${e}/assign/${t}`,{method:`POST`}),removeMaintenanceItem:e=>Y(`/maintenance/items/${e}`,{method:`DELETE`}),getCameraStreamToken:()=>Y(`/printers/camera/stream-token`,{method:`POST`}),getMediaToken:()=>Y(`/auth/media-token`,{method:`POST`}),getWebSocketToken:()=>Y(`/auth/ws-token`,{method:`POST`}),listConnectedApps:()=>Y(`/connect/apps`),createConnectedApp:e=>Y(`/connect/apps`,{method:`POST`,body:JSON.stringify(e)}),updateConnectedApp:(e,t)=>Y(`/connect/apps/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),rotateConnectedAppSecret:e=>Y(`/connect/apps/${e}/rotate-secret`,{method:`POST`}),deleteConnectedApp:e=>Y(`/connect/apps/${e}`,{method:`DELETE`}),getConnectAuthorizeInfo:(e,t)=>Y(`/connect/authorize/info?client_id=${encodeURIComponent(e)}&redirect_uri=${encodeURIComponent(t)}`),connectAuthorize:e=>Y(`/connect/authorize`,{method:`POST`,body:JSON.stringify(e)}),createLongLivedCameraToken:e=>Y(`/auth/tokens`,{method:`POST`,body:JSON.stringify({scope:`camera_stream`,...e})}),listMyLongLivedCameraTokens:()=>Y(`/auth/tokens`),listAllLongLivedCameraTokens:()=>Y(`/auth/tokens/all`),listLongLivedCameraTokensForUser:e=>Y(`/auth/tokens?user_id=${e}`),revokeLongLivedCameraToken:e=>Y(`/auth/tokens/${e}`,{method:`DELETE`}),getCamWallPrinters:e=>Y(e?`/camwall/printers?token=${encodeURIComponent(e)}`:`/camwall/printers`),getOverlayStatus:(e,t)=>Y(t?`/printers/${e}/overlay-status?token=${encodeURIComponent(t)}`:`/printers/${e}/overlay-status`),getCameraStreamUrl:(e,t=10)=>W(`${P}/printers/${e}/camera/stream?fps=${t}`),getCameraSnapshotUrl:e=>W(`${P}/printers/${e}/camera/snapshot`),testCameraConnection:e=>Y(`/printers/${e}/camera/test`),getCameraStatus:e=>Y(`/printers/${e}/camera/status`),diagnoseCamera:e=>Y(`/printers/${e}/camera/diagnose`,{method:`POST`}),diagnosePrinter:e=>Y(`/printers/${e}/diagnostic`),diagnoseConnection:e=>Y(`/printers/diagnostic`,{method:`POST`,body:JSON.stringify(e)}),checkPlateEmpty:(e,t)=>{let n=new URLSearchParams;return t?.useExternal!==void 0&&n.set(`use_external`,String(t.useExternal)),n.set(`include_debug_image`,String(t?.includeDebugImage??!1)),Y(`/printers/${e}/camera/check-plate?${n.toString()}`)},getPlateDetectionStatus:e=>Y(`/printers/${e}/camera/plate-detection/status`),calibratePlateDetection:(e,t)=>{let n=new URLSearchParams;return t?.label&&n.set(`label`,t.label),t?.useExternal!==void 0&&n.set(`use_external`,String(t.useExternal)),Y(`/printers/${e}/camera/plate-detection/calibrate?${n.toString()}`,{method:`POST`})},deletePlateCalibration:e=>Y(`/printers/${e}/camera/plate-detection/calibrate`,{method:`DELETE`}),getPlateReferences:e=>Y(`/printers/${e}/camera/plate-detection/references`),getPlateReferenceThumbnailUrl:(e,t)=>W(`${P}/printers/${e}/camera/plate-detection/references/${t}/thumbnail`),updatePlateReferenceLabel:(e,t,n)=>{let r=new URLSearchParams;return r.set(`label`,n),Y(`/printers/${e}/camera/plate-detection/references/${t}?${r.toString()}`,{method:`PUT`})},deletePlateReference:(e,t)=>Y(`/printers/${e}/camera/plate-detection/references/${t}`,{method:`DELETE`}),getExternalLinks:()=>Y(`/external-links/`),getExternalLink:e=>Y(`/external-links/${e}`),createExternalLink:e=>Y(`/external-links/`,{method:`POST`,body:JSON.stringify(e)}),updateExternalLink:(e,t)=>Y(`/external-links/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteExternalLink:e=>Y(`/external-links/${e}`,{method:`DELETE`}),reorderExternalLinks:e=>Y(`/external-links/reorder`,{method:`PUT`,body:JSON.stringify({ids:e})}),uploadExternalLinkIcon:async(e,t)=>{let n=new FormData;n.append(`file`,t);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/external-links/${e}/icon`,{method:`POST`,headers:r,body:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}return i.json()},deleteExternalLinkIcon:e=>Y(`/external-links/${e}/icon`,{method:`DELETE`}),getExternalLinkIconUrl:e=>G(`${P}/external-links/${e}/icon`),getProjects:e=>{let t=new URLSearchParams;return e&&t.set(`status`,e),Y(`/projects/?${t}`)},getProject:e=>Y(`/projects/${e}`),createProject:e=>Y(`/projects/`,{method:`POST`,body:JSON.stringify(e)}),updateProject:(e,t)=>Y(`/projects/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteProject:e=>Y(`/projects/${e}`,{method:`DELETE`}),getProjectArchives:(e,t=100,n=0)=>Y(`/projects/${e}/archives?limit=${t}&offset=${n}`),getProjectFileProgress:e=>Y(`/projects/${e}/file-progress`),addArchivesToProject:(e,t)=>Y(`/projects/${e}/add-archives`,{method:`POST`,body:JSON.stringify({archive_ids:t})}),removeArchivesFromProject:(e,t)=>Y(`/projects/${e}/remove-archives`,{method:`POST`,body:JSON.stringify({archive_ids:t})}),addQueueItemsToProject:(e,t)=>Y(`/projects/${e}/add-queue`,{method:`POST`,body:JSON.stringify({queue_item_ids:t})}),uploadProjectAttachment:async(e,t)=>{let n=new FormData;n.append(`file`,t);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/projects/${e}/attachments`,{method:`POST`,headers:r,body:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}return i.json()},getProjectAttachmentUrl:(e,t)=>`${P}/projects/${e}/attachments/${encodeURIComponent(t)}`,deleteProjectAttachment:(e,t)=>Y(`/projects/${e}/attachments/${encodeURIComponent(t)}`,{method:`DELETE`}),getProjectCoverImageUrl:(e,t)=>G(`${P}/projects/${e}/cover-image${t===void 0?``:`?v=${encodeURIComponent(String(t))}`}`),uploadProjectCoverImage:async(e,t)=>{let n=new FormData;n.append(`file`,t);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/projects/${e}/cover-image`,{method:`POST`,headers:r,body:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}return i.json()},deleteProjectCoverImage:e=>Y(`/projects/${e}/cover-image`,{method:`DELETE`}),getProjectBOM:e=>Y(`/projects/${e}/bom`),createBOMItem:(e,t)=>Y(`/projects/${e}/bom`,{method:`POST`,body:JSON.stringify(t)}),updateBOMItem:(e,t,n)=>Y(`/projects/${e}/bom/${t}`,{method:`PATCH`,body:JSON.stringify(n)}),deleteBOMItem:(e,t)=>Y(`/projects/${e}/bom/${t}`,{method:`DELETE`}),getTemplates:()=>Y(`/projects/templates/`),createTemplateFromProject:e=>Y(`/projects/${e}/create-template`,{method:`POST`}),createProjectFromTemplate:(e,t)=>Y(`/projects/from-template/${e}${t?`?name=${encodeURIComponent(t)}`:``}`,{method:`POST`}),getProjectTimeline:(e,t=50)=>Y(`/projects/${e}/timeline?limit=${t}`),exportProjectJson:e=>Y(`/projects/${e}/export?format=json`),importProject:e=>Y(`/projects/import`,{method:`POST`,body:JSON.stringify(e)}),importProjectFile:async e=>{let t=new FormData;t.append(`file`,e);let n={};I&&(n.Authorization=`Bearer ${I}`);let r=await fetch(`${P}/projects/import/file`,{method:`POST`,headers:n,body:t});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.detail||`HTTP ${r.status}`)}return r.json()},exportProjectZip:async e=>{let t={};I&&(t.Authorization=`Bearer ${I}`);let n=await fetch(`${P}/projects/${e}/export`,{headers:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.detail||`HTTP ${n.status}`)}let r=K(n.headers.get(`Content-Disposition`))||`project_${e}.zip`;return{blob:await n.blob(),filename:r}},getAPIKeys:()=>Y(`/api-keys/`),createAPIKey:e=>Y(`/api-keys/`,{method:`POST`,body:JSON.stringify(e)}),updateAPIKey:(e,t)=>Y(`/api-keys/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteAPIKey:e=>Y(`/api-keys/${e}`,{method:`DELETE`}),getAMSHistory:(e,t,n=24)=>Y(`/ams-history/${e}/${t}?hours=${n}`),getPrinterSensorHistory:(e,t=24,n)=>{let r=new URLSearchParams({hours:String(t)});return n&&n.length>0&&r.set(`kinds`,n.join(`,`)),Y(`/printer-sensor-history/${e}?${r.toString()}`)},getSystemInfo:()=>Y(`/system/info`),getSystemHealth:()=>Y(`/system/health`),getStorageUsage:e=>{let t=new URLSearchParams;e?.refresh&&t.set(`refresh`,`true`);let n=t.toString();return Y(`/system/storage-usage${n?`?${n}`:``}`)},getLibraryFolders:()=>Y(`/library/folders`),createLibraryFolder:e=>Y(`/library/folders`,{method:`POST`,body:JSON.stringify(e)}),updateLibraryFolder:(e,t)=>Y(`/library/folders/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteLibraryFolder:e=>Y(`/library/folders/${e}`,{method:`DELETE`}),createExternalFolder:e=>Y(`/library/folders/external`,{method:`POST`,body:JSON.stringify(e)}),scanExternalFolder:e=>Y(`/library/folders/${e}/scan`,{method:`POST`}),getLibraryFoldersByProject:e=>Y(`/library/folders/by-project/${e}`),getLibraryFoldersByArchive:e=>Y(`/library/folders/by-archive/${e}`),getLibraryFiles:(e,t=!0,n,r,i=!1,a=[])=>{let o=new URLSearchParams;e!=null&&o.set(`folder_id`,String(e)),n!==void 0&&o.set(`project_id`,String(n)),o.set(`include_root`,String(t)),r===`internal`?o.set(`internal_only`,`true`):r===`external`&&o.set(`external_only`,`true`),i&&o.set(`recursive`,`true`);for(let e of a)o.append(`tag_ids`,String(e));return Y(`/library/files?${o}`)},getLibraryFolderReadme:e=>Y(`/library/folders/${e}/readme`),getLibraryTags:()=>Y(`/library/tags`),createLibraryTag:e=>Y(`/library/tags`,{method:`POST`,body:JSON.stringify({name:e})}),updateLibraryTag:(e,t)=>Y(`/library/tags/${e}`,{method:`PATCH`,body:JSON.stringify({name:t})}),deleteLibraryTag:e=>Y(`/library/tags/${e}`,{method:`DELETE`}),bulkAssignLibraryTags:(e,t,n)=>Y(`/library/tags/bulk-assign`,{method:`POST`,body:JSON.stringify({file_ids:e,tag_ids:t,action:n})}),createVariantGroup:(e,t)=>Y(`/library/variant-groups`,{method:`POST`,body:JSON.stringify({members:e,...t?{name:t}:{}})}),getVariantGroup:e=>Y(`/library/variant-groups/${e}`),getVariantGroupForFile:async e=>{try{return await Y(`/library/variant-groups/by-file/${e}`)}catch{return null}},updateVariantGroup:(e,t)=>Y(`/library/variant-groups/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),addVariantGroupMember:(e,t,n)=>Y(`/library/variant-groups/${e}/members`,{method:`POST`,body:JSON.stringify({library_file_id:t,...n?{target_model:n}:{}})}),removeVariantGroupMember:(e,t)=>Y(`/library/variant-groups/${e}/members/${t}`,{method:`DELETE`}),deleteVariantGroup:e=>Y(`/library/variant-groups/${e}`,{method:`DELETE`}),getLibraryFile:e=>Y(`/library/files/${e}`),uploadLibraryFile:async(e,t,n=!0)=>{let r=new FormData;r.append(`file`,e);let i=new URLSearchParams;t&&i.set(`folder_id`,String(t)),i.set(`generate_stl_thumbnails`,String(n));let a={};I&&(a.Authorization=`Bearer ${I}`);let o=await fetch(`${P}/library/files?${i}`,{method:`POST`,headers:a,body:r});if(!o.ok){let e=await o.json().catch(()=>({}));throw Error(e.detail||`HTTP ${o.status}`)}return o.json()},extractZipFile:async(e,t,n=!0,r=!1,i=!0)=>{let a=new FormData;a.append(`file`,e);let o=new URLSearchParams;t&&o.set(`folder_id`,String(t)),o.set(`preserve_structure`,String(n)),o.set(`create_folder_from_zip`,String(r)),o.set(`generate_stl_thumbnails`,String(i));let s={};I&&(s.Authorization=`Bearer ${I}`);let c=await fetch(`${P}/library/files/extract-zip?${o}`,{method:`POST`,headers:s,body:a});if(!c.ok){let e=await c.json().catch(()=>({}));throw Error(e.detail||`HTTP ${c.status}`)}return c.json()},updateLibraryFile:(e,t)=>Y(`/library/files/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteLibraryFile:e=>Y(`/library/files/${e}`,{method:`DELETE`}),previewLibraryPurge:(e,t=!0)=>Y(`/library/purge/preview?older_than_days=${e}&include_never_printed=${t}`),executeLibraryPurge:(e,t=!0)=>Y(`/library/purge`,{method:`POST`,body:JSON.stringify({older_than_days:e,include_never_printed:t})}),listLibraryTrash:(e=100,t=0)=>Y(`/library/trash?limit=${e}&offset=${t}`),restoreLibraryTrash:e=>Y(`/library/trash/${e}/restore`,{method:`POST`}),hardDeleteLibraryTrash:e=>Y(`/library/trash/${e}`,{method:`DELETE`}),emptyLibraryTrash:()=>Y(`/library/trash`,{method:`DELETE`}),getLibraryTrashSettings:()=>Y(`/library/trash/settings`),updateLibraryTrashSettings:e=>Y(`/library/trash/settings`,{method:`PUT`,body:JSON.stringify(e)}),getLibraryFileDownloadUrl:e=>`${P}/library/files/${e}/download`,createLibrarySlicerToken:e=>Y(`/library/files/${e}/slicer-token`,{method:`POST`}),getLibrarySlicerDownloadUrl:(e,t,n)=>`${P}/library/files/${e}/dl/${t}/${encodeURIComponent(q(n))}`,downloadLibraryFile:async(e,t)=>{let n={};I&&(n.Authorization=`Bearer ${I}`);let r=await fetch(`${P}/library/files/${e}/download`,{headers:n});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.detail||`HTTP ${r.status}`)}let i=K(r.headers.get(`Content-Disposition`))||t||`file_${e}`,a=await r.blob(),o=window.URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=i,document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(o)},getLibraryFileThumbnailUrl:e=>G(`${P}/library/files/${e}/thumbnail`),uploadLibraryPreviewThumbnail:async(e,t)=>{let n=new FormData;n.append(`thumbnail`,t,`preview.png`);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/library/files/${e}/preview-thumbnail`,{method:`POST`,headers:r,body:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}return i.json()},getLibraryFilePlateThumbnail:(e,t)=>G(`${P}/library/files/${e}/plate-thumbnail/${t}`),getLibraryFilePhotoUrl:(e,t)=>G(`${P}/library/files/${e}/photos/${encodeURIComponent(t)}`),uploadLibraryFilePhoto:async(e,t)=>{let n=new FormData;n.append(`file`,t);let r={};I&&(r.Authorization=`Bearer ${I}`);let i=await fetch(`${P}/library/files/${e}/photos`,{method:`POST`,headers:r,body:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}return i.json()},deleteLibraryFilePhoto:(e,t)=>Y(`/library/files/${e}/photos/${encodeURIComponent(t)}`,{method:`DELETE`}),getLibraryFileGcodeUrl:e=>`${P}/library/files/${e}/gcode`,moveLibraryFiles:(e,t)=>Y(`/library/files/move`,{method:`POST`,body:JSON.stringify({file_ids:e,folder_id:t})}),bulkDeleteLibrary:(e,t)=>Y(`/library/bulk-delete`,{method:`POST`,body:JSON.stringify({file_ids:e,folder_ids:t})}),getLibraryStats:()=>Y(`/library/stats`),batchGenerateStlThumbnails:e=>Y(`/library/generate-stl-thumbnails`,{method:`POST`,body:JSON.stringify(e)}),combineLibraryFiles:(e,t,n)=>Y(`/library/files/combine`,{method:`POST`,body:JSON.stringify({items:e,filename:t,folder_id:n})}),addLibraryFilesToQueue:e=>Y(`/library/files/add-to-queue`,{method:`POST`,body:JSON.stringify({file_ids:e})}),getLibraryFilePlates:e=>Y(`/library/files/${e}/plates`),getLibraryFileFilamentRequirements:(e,t,n,r)=>{let i=new URLSearchParams;return t!==void 0&&i.set(`plate_id`,String(t)),n&&i.set(`request_id`,n),r&&i.set(`full_slots`,`true`),Y(`/library/files/${e}/filament-requirements${i.toString()?`?${i}`:``}`)},getPreviewSliceProgress:async e=>{try{return await Y(`/slicer/preview-progress/${encodeURIComponent(e)}`)}catch{return null}},getGitHubBackupConfig:()=>Y(`/github-backup/config`),getGitHubBackupCloudAccounts:()=>Y(`/github-backup/cloud-accounts`),saveGitHubBackupConfig:e=>Y(`/github-backup/config`,{method:`POST`,body:JSON.stringify(e)}),updateGitHubBackupConfig:e=>Y(`/github-backup/config`,{method:`PATCH`,body:JSON.stringify(e)}),deleteGitHubBackupConfig:()=>Y(`/github-backup/config`,{method:`DELETE`}),testGitHubConnection:(e,t,n=`github`)=>Y(`/github-backup/test?repo_url=${encodeURIComponent(e)}&token=${encodeURIComponent(t)}&provider=${encodeURIComponent(n)}`,{method:`POST`}),testGitHubStoredConnection:()=>Y(`/github-backup/test-stored`,{method:`POST`}),triggerGitHubBackup:()=>Y(`/github-backup/run`,{method:`POST`}),getGitHubBackupStatus:()=>Y(`/github-backup/status`),getGitHubBackupLogs:(e=50)=>Y(`/github-backup/logs?limit=${e}`),clearGitHubBackupLogs:(e=10)=>Y(`/github-backup/logs?keep_last=${e}`,{method:`DELETE`}),getGitHubBackupCommits:(e=20)=>Y(`/github-backup/commits?limit=${e}`),getGitHubRestorePreview:(e=`HEAD`)=>Y(`/github-backup/restore/preview?ref=${encodeURIComponent(e)}`),restoreFromGitHub:e=>Y(`/github-backup/restore`,{method:`POST`,body:JSON.stringify(e)}),getLocalBackupStatus:()=>Y(`/local-backup/status`),triggerLocalBackup:()=>Y(`/local-backup/run`,{method:`POST`}),checkLocalBackupPath:()=>Y(`/local-backup/path-check`),getLocalBackups:()=>Y(`/local-backup/backups`),downloadLocalBackup:async e=>{let t=await fetch(`${P}/local-backup/backups/${encodeURIComponent(e)}/download`,{headers:I?{Authorization:`Bearer ${I}`}:{}});if(!t.ok)throw Error(`Download failed`);return{blob:await t.blob(),filename:e}},restoreLocalBackup:e=>Y(`/local-backup/backups/${encodeURIComponent(e)}/restore`,{method:`POST`}),deleteLocalBackup:e=>Y(`/local-backup/backups/${encodeURIComponent(e)}`,{method:`DELETE`}),getObicoStatus:()=>Y(`/obico/status`),getObicoPrinterStatus:()=>Y(`/obico/printer-status`),testObicoConnection:(e,t)=>Y(`/obico/test-connection`,{method:`POST`,body:JSON.stringify(t===void 0?{url:e}:{url:e,token:t})}),sliceLibraryFile:(e,t)=>Y(`/library/files/${e}/slice`,{method:`POST`,body:JSON.stringify(t)}),sliceArchive:(e,t)=>Y(`/archives/${e}/slice`,{method:`POST`,body:JSON.stringify(t)}),getSliceJob:e=>Y(`/slice-jobs/${e}`),getSlicerPresets:e=>Y(e?.refresh?`/slicer/presets?refresh=true`:`/slicer/presets`),listSlicerPipelines:()=>Y(`/slicer-pipelines/`),getSlicerPipeline:e=>Y(`/slicer-pipelines/${e}`),createSlicerPipeline:e=>Y(`/slicer-pipelines/`,{method:`POST`,body:JSON.stringify(e)}),updateSlicerPipeline:(e,t)=>Y(`/slicer-pipelines/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteSlicerPipeline:e=>Y(`/slicer-pipelines/${e}`,{method:`DELETE`}),checkPipelineEligibility:(e,t)=>Y(`/slicer-pipelines/${e}/check-eligibility`,{method:`POST`,body:JSON.stringify(t.kind===`libraryFile`?{source_library_file_id:t.id}:{source_archive_id:t.id})}),runPipeline:(e,t,n=!1,r=1)=>Y(`/slicer-pipelines/${e}/run`,{method:`POST`,body:JSON.stringify({...t.kind===`libraryFile`?{source_library_file_id:t.id}:{source_archive_id:t.id},force:n,copies:r})}),listPipelineRuns:(e,t=5)=>Y(`/slicer-pipelines/${e}/runs?limit=${t}`),listAllPipelineRuns:(e={})=>{let t=new URLSearchParams;e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.pipelineId&&t.set(`pipeline_id`,String(e.pipelineId)),e.status&&t.set(`status`,e.status),e.targetPrinterId&&t.set(`target_printer_id`,String(e.targetPrinterId)),e.targetModelClass&&t.set(`target_model_class`,e.targetModelClass);let n=t.toString();return Y(`/pipeline-runs${n?`?`+n:``}`)},clearTerminalPipelineRuns:()=>Y(`/pipeline-runs/clear`,{method:`POST`}),getPipelineRun:e=>Y(`/pipeline-runs/${e}`),cancelPipelineRun:e=>Y(`/pipeline-runs/${e}/cancel`,{method:`POST`}),retryFailedPipelineRun:e=>Y(`/pipeline-runs/${e}/retry-failed`,{method:`POST`}),getSlicerPrinterModels:()=>Y(`/slicer/printer-models`),getSlicerLoadedSpools:()=>Y(`/slicer/loaded-spools`),getSlicerPresetValues:e=>Y(`/slicer/preset-values?source=${encodeURIComponent(e.source)}&id=${encodeURIComponent(e.id)}`),getLocalPresets:()=>Y(`/local-presets/`),getLocalPresetDetail:e=>Y(`/local-presets/${e}`),importLocalPresets:e=>fetch(`${P}/local-presets/import`,{method:`POST`,headers:I?{Authorization:`Bearer ${I}`}:{},body:e}).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.detail||`HTTP ${e.status}`)}return e.json()}),createLocalPreset:e=>Y(`/local-presets/`,{method:`POST`,body:JSON.stringify(e)}),updateLocalPreset:(e,t)=>Y(`/local-presets/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteLocalPreset:e=>Y(`/local-presets/${e}`,{method:`DELETE`}),refreshBaseProfileCache:()=>Y(`/local-presets/base-cache/refresh`,{method:`POST`})},ne={getInfo:()=>Y(`/discovery/info`),getStatus:()=>Y(`/discovery/status`),startDiscovery:(e=10)=>Y(`/discovery/start?duration=${e}`,{method:`POST`}),stopDiscovery:()=>Y(`/discovery/stop`,{method:`POST`}),getDiscoveredPrinters:()=>Y(`/discovery/printers`),startSubnetScan:(e,t=1)=>Y(`/discovery/scan`,{method:`POST`,body:JSON.stringify({subnet:e,timeout:t})}),getScanStatus:()=>Y(`/discovery/scan/status`),stopSubnetScan:()=>Y(`/discovery/scan/stop`,{method:`POST`})},$={getSettings:()=>Y(`/settings/virtual-printer`),getModels:()=>Y(`/settings/virtual-printer/models`),updateSettings:e=>{let t=new URLSearchParams;return e.enabled!==void 0&&t.set(`enabled`,String(e.enabled)),e.access_code!==void 0&&t.set(`access_code`,e.access_code),e.mode!==void 0&&t.set(`mode`,e.mode),e.model!==void 0&&t.set(`model`,e.model),e.target_printer_id!==void 0&&t.set(`target_printer_id`,String(e.target_printer_id)),e.remote_interface_ip!==void 0&&t.set(`remote_interface_ip`,e.remote_interface_ip),e.tailscale_disabled!==void 0&&t.set(`tailscale_disabled`,String(e.tailscale_disabled)),e.archive_name_source!==void 0&&t.set(`archive_name_source`,e.archive_name_source),Y(`/settings/virtual-printer?${t.toString()}`,{method:`PUT`})}},re={list:()=>Y(`/virtual-printers`),get:e=>Y(`/virtual-printers/${e}`),create:e=>Y(`/virtual-printers`,{method:`POST`,body:JSON.stringify(e)}),update:(e,t)=>Y(`/virtual-printers/${e}`,{method:`PUT`,body:JSON.stringify(t)}),remove:e=>Y(`/virtual-printers/${e}`,{method:`DELETE`}),getTailscaleStatus:()=>Y(`/virtual-printers/tailscale-status`),getCaCertificate:()=>Y(`/virtual-printers/ca-certificate`),diagnose:e=>Y(`/virtual-printers/${e}/diagnostic`)},ie={list:()=>Y(`/pending-uploads/`),getCount:()=>Y(`/pending-uploads/count`),get:e=>Y(`/pending-uploads/${e}`),archive:(e,t)=>Y(`/pending-uploads/${e}/archive`,{method:`POST`,body:JSON.stringify(t||{})}),discard:e=>Y(`/pending-uploads/${e}`,{method:`DELETE`}),archiveAll:()=>Y(`/pending-uploads/archive-all`,{method:`POST`}),discardAll:()=>Y(`/pending-uploads/discard-all`,{method:`DELETE`})},ae={checkUpdates:()=>Y(`/firmware/updates`),checkPrinterUpdate:e=>Y(`/firmware/updates/${e}`),prepareUpload:(e,t)=>Y(`/firmware/updates/${e}/prepare${t?`?version=${encodeURIComponent(t)}`:``}`),startUpload:(e,t)=>Y(`/firmware/updates/${e}/upload${t?`?version=${encodeURIComponent(t)}`:``}`,{method:`POST`}),getUploadStatus:e=>Y(`/firmware/updates/${e}/upload/status`)},oe={getDebugLoggingState:()=>Y(`/support/debug-logging`),setDebugLogging:e=>Y(`/support/debug-logging`,{method:`POST`,body:JSON.stringify({enabled:e})}),downloadSupportBundle:async()=>{let e={};I&&(e.Authorization=`Bearer ${I}`);let t=await fetch(`${P}/support/bundle`,{headers:e});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.detail||`HTTP ${t.status}`)}let n=K(t.headers.get(`Content-Disposition`))||`bambuddy-support.zip`,r=await t.blob(),i=window.URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(i)},getLogs:e=>{let t=new URLSearchParams;e?.limit&&t.set(`limit`,e.limit.toString()),e?.level&&t.set(`level`,e.level),e?.search&&t.set(`search`,e.search);let n=t.toString();return Y(`/support/logs${n?`?${n}`:``}`)},clearLogs:()=>Y(`/support/logs`,{method:`DELETE`})},se={getDevices:()=>Y(`/spoolbuddy/devices`),deleteDevice:e=>Y(`/spoolbuddy/devices/${e}`,{method:`DELETE`}),tare:e=>Y(`/spoolbuddy/devices/${e}/calibration/tare`,{method:`POST`,body:`{}`}),getCalibration:e=>Y(`/spoolbuddy/devices/${e}/calibration`),setCalibrationFactor:(e,t,n,r)=>Y(`/spoolbuddy/devices/${e}/calibration/set-factor`,{method:`POST`,body:JSON.stringify({known_weight_grams:t,raw_adc:n,tare_raw_adc:r})}),updateSpoolWeight:(e,t)=>Y(`/spoolbuddy/scale/update-spool-weight`,{method:`POST`,body:JSON.stringify({spool_id:e,weight_grams:t})}),updateDisplay:(e,t,n)=>Y(`/spoolbuddy/devices/${e}/display`,{method:`PUT`,body:JSON.stringify({brightness:t,blank_timeout:n})}),updateSystemConfig:(e,t,n)=>Y(`/spoolbuddy/devices/${e}/system/config`,{method:`POST`,body:JSON.stringify({backend_url:t,...n?{api_key:n}:{}})}),checkDaemonUpdate:e=>Y(`/spoolbuddy/devices/${e}/update-check`),triggerUpdate:e=>Y(`/spoolbuddy/devices/${e}/update`,{method:`POST`,body:`{}`}),getSSHPublicKey:()=>Y(`/spoolbuddy/ssh/public-key`),writeTag:(e,t)=>Y(`/spoolbuddy/nfc/write-tag`,{method:`POST`,body:JSON.stringify({device_id:e,spool_id:t})}),cancelWrite:e=>Y(`/spoolbuddy/devices/${e}/cancel-write`,{method:`POST`,body:`{}`}),systemCommand:(e,t)=>Y(`/spoolbuddy/devices/${e}/system/command`,{method:`POST`,body:JSON.stringify({command:t})}),queueDiagnostics:(e,t)=>Y(`/spoolbuddy/diagnostics/${e}/run?diagnostic=${t}`,{method:`POST`,body:`{}`}),getDiagnosticResult:(e,t)=>Y(`/spoolbuddy/diagnostics/${e}/result?diagnostic=${t}`,{method:`GET`})},ce={submit:e=>Y(`/bug-report/submit`,{method:`POST`,body:JSON.stringify(e)}),startLogging:()=>Y(`/bug-report/start-logging`,{method:`POST`}),stopLogging:e=>Y(`/bug-report/stop-logging?was_debug=${e}`,{method:`POST`})},le={list:()=>Y(`/announcements`),markRead:e=>Y(`/announcements/${encodeURIComponent(e)}/read`,{method:`POST`})},ue={check:()=>Y(`/sponsor-prompt/check`),dismiss:e=>Y(`/sponsor-prompt/dismiss`,{method:`POST`,body:JSON.stringify({milestone:e})})};export{N as C,r as D,C as E,W as S,D as T,ue as _,te as a,$ as b,ae as c,V as d,re as f,ee as g,H as h,le as i,R as l,L as m,Q as n,ce as o,ie as p,Z as r,ne as s,F as t,U as u,se as v,j as w,G as x,oe as y}; \ No newline at end of file diff --git a/static/assets/cloud-off-DfYbNG2N.js b/static/assets/cloud-off-DfYbNG2N.js new file mode 100644 index 000000000..943acf7f4 --- /dev/null +++ b/static/assets/cloud-off-DfYbNG2N.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`cloud-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193`,key:`yfwify`}],[`path`,{d:`M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07`,key:`jlfiyv`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/cog-Dol1I0kq.js b/static/assets/cog-Dol1I0kq.js new file mode 100644 index 000000000..9ebe75c02 --- /dev/null +++ b/static/assets/cog-Dol1I0kq.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/coins-4u6IPkR-.js b/static/assets/coins-4u6IPkR-.js new file mode 100644 index 000000000..5743da5e6 --- /dev/null +++ b/static/assets/coins-4u6IPkR-.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`coins`,[[`circle`,{cx:`8`,cy:`8`,r:`6`,key:`3yglwk`}],[`path`,{d:`M18.09 10.37A6 6 0 1 1 10.34 18`,key:`t5s6rm`}],[`path`,{d:`M7 6h1v4`,key:`1obek4`}],[`path`,{d:`m16.71 13.88.7.71-2.82 2.82`,key:`1rbuyh`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/columns-2-DVEObeDC.js b/static/assets/columns-2-DVEObeDC.js new file mode 100644 index 000000000..97900c23b --- /dev/null +++ b/static/assets/columns-2-DVEObeDC.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/copy-Cu_0GKCU.js b/static/assets/copy-Cu_0GKCU.js new file mode 100644 index 000000000..78f7df398 --- /dev/null +++ b/static/assets/copy-Cu_0GKCU.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/cpu-BKWEtc8k.js b/static/assets/cpu-BKWEtc8k.js new file mode 100644 index 000000000..404085ec6 --- /dev/null +++ b/static/assets/cpu-BKWEtc8k.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/createLucideIcon-DvBYJlWL.js b/static/assets/createLucideIcon-DvBYJlWL.js new file mode 100644 index 000000000..3cd006550 --- /dev/null +++ b/static/assets/createLucideIcon-DvBYJlWL.js @@ -0,0 +1 @@ +import{i as e}from"./chunk-aKtaBQYM.js";import{D as t}from"./client-DnySrlFv.js";var n=e(t()),r=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),i=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),a=e=>{let t=i(e);return t.charAt(0).toUpperCase()+t.slice(1)},o=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),s=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},c={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},l=(0,n.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:a=``,children:l,iconNode:u,...d},f)=>(0,n.createElement)(`svg`,{ref:f,...c,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:o(`lucide`,a),...!l&&!s(d)&&{"aria-hidden":`true`},...d},[...u.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])),u=(e,t)=>{let i=(0,n.forwardRef)(({className:i,...s},c)=>(0,n.createElement)(l,{ref:c,iconNode:t,className:o(`lucide-${r(a(e))}`,`lucide-${e}`,i),...s}));return i.displayName=a(e),i};export{u as t}; \ No newline at end of file diff --git a/static/assets/date-G9KUauqz.js b/static/assets/date-G9KUauqz.js new file mode 100644 index 000000000..a440a275d --- /dev/null +++ b/static/assets/date-G9KUauqz.js @@ -0,0 +1 @@ +function e(e=`system`){let t=e===`system`?a():e;switch(t){case`us`:return`MM/DD/YYYY`;case`eu`:return`DD/MM/YYYY`;case`iso`:return`YYYY-MM-DD`;default:return t}}function t(e=`system`){switch(e){case`12h`:return`HH:MM AM/PM`;case`24h`:return`HH:MM`;default:{let e=new Date(2e3,0,1,14,30).toLocaleTimeString();return e.includes(`PM`)||e.includes(`AM`)?`HH:MM AM/PM`:`HH:MM`}}}function n(e,t=`system`){let n=String(e.getDate()).padStart(2,`0`),r=String(e.getMonth()+1).padStart(2,`0`),i=e.getFullYear();switch(t){case`us`:return`${r}/${n}/${i}`;case`eu`:return`${n}/${r}/${i}`;case`iso`:return`${i}-${r}-${n}`;default:return e.toLocaleDateString()}}function r(e,t=`system`){let n=e.getHours(),r=String(e.getMinutes()).padStart(2,`0`);switch(t){case`12h`:return`${n%12||12}:${r} ${n<12?`AM`:`PM`}`;case`24h`:return`${String(n).padStart(2,`0`)}:${r}`;default:return e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}}function i(e){for(let t of[`/`,`.`,`-`]){let n=e.split(t);if(n.length===3)return n}return null}function a(){let e=new Date(2e3,11,31).toLocaleDateString();return e.startsWith(`12`)?`us`:e.startsWith(`31`)?`eu`:`iso`}function o(e,t=`system`){if(!e)return null;let n=i(e);if(!n)return null;let r=t===`system`?a():t,o,s,c;switch(r){case`us`:s=parseInt(n[0],10),o=parseInt(n[1],10),c=parseInt(n[2],10);break;case`eu`:o=parseInt(n[0],10),s=parseInt(n[1],10),c=parseInt(n[2],10);break;case`iso`:c=parseInt(n[0],10),s=parseInt(n[1],10),o=parseInt(n[2],10);break}return isNaN(o)||isNaN(s)||isNaN(c)||s<1||s>12||o<1||o>31||c<1900||c>2100?null:new Date(c,s-1,o)}function s(e){if(!e)return null;let t=e.trim().match(/^(\d{1,2}):(\d{2})\s*(AM|PM)?$/i);if(!t)return null;let n=parseInt(t[1],10),r=parseInt(t[2],10),i=t[3]?.toUpperCase();return i===`PM`&&n<12&&(n+=12),i===`AM`&&n===12&&(n=0),n<0||n>23||r<0||r>59?null:{hours:n,minutes:r}}function c(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}T${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`}function l(e,t=`system`){return t===`12h`?e.hour12=!0:t===`24h`&&(e.hour12=!1),e}function u(e){return e?e.endsWith(`Z`)||/[+-]\d{2}:\d{2}$/.test(e)?new Date(e):new Date(e+`Z`):null}function d(e,t){let n=u(e);return n?n.toLocaleString(void 0,t??{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``}function f(e,t){let n=u(e);return n?n.toLocaleDateString(void 0,t??{year:`numeric`,month:`short`,day:`numeric`}):``}function p(e,t=`system`,n){let r=u(e);if(!r)return``;let i=l(n??{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`},t);return r.toLocaleString(void 0,i)}function m(e,t=`system`,n){let r=l({hour:`2-digit`,minute:`2-digit`,...n},t);return e.toLocaleTimeString([],r)}function h(e,t=`system`,n,r){let i=r==null?new Date:new Date(r),a=new Date(i.getTime()+e*60*1e3),o=new Date(i);o.setHours(0,0,0,0);let s=new Date(a);s.setHours(0,0,0,0);let c=l({hour:`2-digit`,minute:`2-digit`},t),u=a.toLocaleTimeString([],c),d=Math.floor((s.getTime()-o.getTime())/864e5);return d===0?u:d===1?`${n?.(`common.tomorrow`)??`Tomorrow`} ${u}`:`${a.toLocaleDateString([],{weekday:`short`})} ${u}`}function g(e){if(e==null||e<0)return`--`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`}function _(e,t=`system`,n){if(!e)return n?.(`time.unknown`)??`-`;let r=u(e);if(!r)return n?.(`time.unknown`)??`-`;let i=new Date,a=r.getTime()-i.getTime(),o=a<0,s=Math.abs(a),c=Math.floor(s/6e4),l=Math.floor(s/36e5),d=Math.floor(s/864e5);return c<1?o?n?.(`time.justNow`)??`Just now`:n?.(`time.now`)??`Now`:l<1?o?n?.(`time.minsAgo`,{count:c})??`${c}m ago`:n?.(`time.inMins`,{count:c})??`in ${c}m`:d<1?o?n?.(`time.hoursAgo`,{count:l})??`${l}h ago`:n?.(`time.inHours`,{count:l})??`in ${l}h`:d<7?o?n?.(`time.daysAgo`,{count:d})??`${d}d ago`:n?.(`time.inDays`,{count:d})??`in ${d}d`:p(e,t)}function v(e){return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`}function y(e){if(e<1)return`${Math.round(e*60)}m`;let t=Math.floor(e),n=Math.round((e-t)*60);return n>0?`${t}h ${n}m`:`${t}h`}function b(e){let t=typeof e==`string`?u(e):e;return t?`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`:``}export{s as _,p as a,h as c,r as d,m as f,o as g,b as h,f as i,v as l,t as m,d as n,g as o,e as p,n as r,y as s,l as t,_ as u,u as v,c as y}; \ No newline at end of file diff --git a/static/assets/de-CL7dVdMY.js b/static/assets/de-CL7dVdMY.js new file mode 100644 index 000000000..f99241f64 --- /dev/null +++ b/static/assets/de-CL7dVdMY.js @@ -0,0 +1,4 @@ +var e={nav:{printers:`Drucker`,archives:`Archiv`,queue:`Druckwarteschlange`,stats:`Statistiken`,profiles:`Profile`,maintenance:`Wartung`,projects:`Projekte`,finance:`Finanzen`,inventory:`Filament`,files:`Dateimanager`,makerworld:`MakerWorld`,modelSources:`Modellquellen`,notifications:`Benachrichtigungen`,settings:`Einstellungen`,system:`System`,collapseSidebar:`Seitenleiste einklappen`,expandSidebar:`Seitenleiste ausklappen`,update:`Aktualisieren`,updateAvailable:`Update verfügbar: v{{version}}`,updateAvailableBanner:`Version {{version}} ist verfügbar!`,viewUpdate:`Update anzeigen`,viewOnGithub:`Auf GitHub ansehen`,keyboardShortcuts:`Tastaturkürzel (?)`,switchToLight:`Zum hellen Modus wechseln`,switchToDark:`Zum dunklen Modus wechseln`,switchToSystem:`Zum Systemmodus wechseln`,smartSwitches:`Smart Switches`,logout:`Abmelden`,installApp:`App installieren`,installAppSuccess:`Bambuddy wurde installiert`},announcements:{title:`Ankündigungen`,unread:`Ungelesene Ankündigungen: {{count}}`,empty:`Derzeit keine Ankündigungen.`,earlier:`Frühere ({{count}})`,new:`Neu`,readMore:`Mehr erfahren`,readMoreCount:`Mehr erfahren (+{{count}})`,gotIt:`Verstanden`,source:`Von den Bambuddy-Entwicklern, abgerufen von GitHub. Du kannst sie in den Einstellungen abschalten.`,level:{info:`Hinweis`,important:`Wichtig`,critical:`Kritisch`}},common:{plusNMore:`+{{count}} weitere`,save:`Speichern`,saving:`Speichern...`,cancel:`Abbrechen`,delete:`Löschen`,edit:`Bearbeiten`,add:`Hinzufügen`,close:`Schließen`,confirm:`Bestätigen`,loading:`Lädt...`,error:`Fehler`,errorLoading:`Fehler beim Laden`,retry:`Erneut versuchen`,success:`Erfolg`,warning:`Warnung`,enabled:`Aktiviert`,disabled:`Deaktiviert`,yes:`Ja`,no:`Nein`,on:`An`,off:`Aus`,all:`Alle`,none:`Keine`,search:`Suchen`,filter:`Filtern`,sort:`Sortieren`,refresh:`Aktualisieren`,download:`Herunterladen`,upload:`Hochladen`,uploading:`Hochladen...`,uploadFailed:`Hochladen fehlgeschlagen`,actions:`Aktionen`,status:`Status`,name:`Name`,user:`Benutzer`,description:`Beschreibung`,date:`Datum`,time:`Zeit`,hours:`Stunden`,minutes:`Minuten`,seconds:`Sekunden`,days:`Tage`,enable:`Aktivieren`,disable:`Deaktivieren`,permissions:`Berechtigungen`,noPrinters:`Keine Drucker konfiguriert`,noData:`Keine Daten verfügbar`,linkNotFound:`Link nicht gefunden`,required:`Erforderlich`,optional:`Optional`,dismiss:`Schließen`,apply:`Anwenden`,reset:`Zurücksetzen`,export:`Exportieren`,import:`Importieren`,clear:`Leeren`,selectAll:`Alle auswählen`,deselectAll:`Auswahl aufheben`,noChange:`— Keine Änderung —`,unchanged:`Unverändert`,unassigned:`Nicht zugewiesen`,unknown:`Unbekannt`,unknownError:`Unbekannter Fehler`,today:`Heute`,tomorrow:`Morgen`,asap:`Sofort`,overdue:`Überfällig`,now:`Jetzt`,collapse:`Einklappen`,expand:`Ausklappen`,previous:`Zurück`,next:`Weiter`,viewArchive:`Archiv anzeigen`,viewInFileManager:`Im Dateimanager anzeigen`,addedBy:`Hinzugefügt von {{username}}`,prints:`Drucke`,more:`+{{count}} weitere`,ascending:`Aufsteigend`,descending:`Absteigend`,back:`Zurück`,copy:`Kopieren`,copied:`Kopiert!`,printer:`Drucker`,remove:`Entfernen`,type:`Typ`,print:`Drucken`,rename:`Umbenennen`,move:`Verschieben`,create:`Erstellen`,duplicate:`Duplizieren`,left:`Links`,right:`Rechts`,run:`Ausführen`,running:`Wird ausgeführt...`},finance:{allTypes:`Alle Typen`,allCostCenters:`Alle Kostenstellen`,title:`Finanzen`,subtitle:`Wallet, persönliche Transaktionen und Kostenstellen`,noAccess:`Du hast keine Berechtigung, Finanzdaten anzuzeigen.`,personalView:`Persönliche Ansicht`,adminView:`Admin-Ansicht`,createCostCenter:`Kostenstelle erstellen`,adjustWallet:`Wallet anpassen`,addManualPrint:`Manuellen Druck nachtragen`,manageMembers:`Mitglieder der Kostenstelle verwalten`,currentBalance:`Persönlicher Kontostand`,transactions:`Transaktionen`,personalTransactions:`Persönliche Transaktionen`,costCenters:`Kostenstellen`,availableForPrinting:`Für Druckzuordnung verfügbar`,costCenterName:`Name`,budgetType:`Budgettyp`,monthlyBudget:`Monatsbudget`,totalBudget:`Gesamtbudget`,noBudget:`kein Budget gesetzt`,create:`Erstellen`,selectUser:`Benutzer auswählen`,transactionType:`Typ`,amount:`Betrag`,noCostCenter:`Keine Kostenstelle`,descriptionOptional:`Beschreibung (optional)`,applyAdjustment:`Anpassung anwenden`,memberCanPrint:`Mitglied darf drucken`,addMember:`Mitglied hinzufügen`,canPrint:`Darf drucken`,noMembers:`Keine Mitglieder zugewiesen.`,editCostCenter:`Kostenstelle bearbeiten`,myCostCenters:`Meine Kostenstellen`,costCentersHint:`Budgetgrenzen prüfen und Kosten im Blick behalten`,noCostCenters:`Keine Kostenstellen gefunden.`,owner:`Besitzer`,balance:`Kontostand`,unlimited:`Unbegrenzt`,budgetPolicyHint:`Kontostände dienen der Kostenübersicht. Drucke werden ausschließlich durch das Budget der ausgewählten Kostenstelle begrenzt; ohne Budget kann unbegrenzt gedruckt werden.`,budget:`Budget`,shared:`Geteilt`,cannotEditPrivateCostCenter:`Private Kostenstellen können hier nicht bearbeitet werden`,recentTransactions:`Aktuelle Transaktionen`,transactionsHint:`Nach Typ und Kostenstelle filtern`,first:`Erste`,prev:`Zurück`,next:`Weiter`,last:`Letzte`,pageNumberOf:`Seite {{page}} von {{total}}`,noTransactions:`Keine Transaktionen verfügbar.`,noTransactionsForFilter:`Keine Transaktionen entsprechen den ausgewählten Filtern.`,costCenter:`Kostenstelle`,balanceAfter:`Kontostand danach`,userWithId:`Benutzer #{{id}}`,partial:`Teilweise`,editTransaction:`Transaktion bearbeiten`,selectCostCenter:`Kostenstelle auswählen...`,costCenterRequired:`Bitte eine Kostenstelle auswählen`,amountExample:`z. B. 4,00`,manualAdjustmentExample:`z. B. Manuelle Anpassung`,userRequired:`Bitte einen Benutzer auswählen`,amountInvalid:`Betrag muss eine gültige Zahl sein`,createdCostCenter:`Kostenstelle erstellt`,createCostCenterFailed:`Kostenstelle konnte nicht erstellt werden`,transactionDeleted:`Transaktion gelöscht`,deleteTransactionFailed:`Transaktion konnte nicht gelöscht werden`,transactionEdited:`Transaktion aktualisiert und Ledger neu berechnet`,editTransactionFailed:`Transaktion konnte nicht bearbeitet werden`,manualPrintCreated:`Manueller Druck hinzugefügt und Ledger neu berechnet`,manualPrintFailed:`Manueller Druck konnte nicht erstellt werden`,memberSaved:`Mitglied gespeichert`,memberSaveFailed:`Mitglied konnte nicht gespeichert werden`,memberRemoved:`Mitglied entfernt`,memberRemoveFailed:`Mitglied konnte nicht entfernt werden`,costCenterNameRequired:`Kostenstellenname ist erforderlich`,costCenterUpdated:`Kostenstelle aktualisiert`,costCenterUpdateFailed:`Kostenstelle konnte nicht aktualisiert werden`,confirmDeleteCostCenter:`Kostenstelle "{{name}}" löschen?`,costCenterDeleted:`Kostenstelle gelöscht`,costCenterDeleteFailed:`Kostenstelle konnte nicht gelöscht werden`,deleteTransactionConfirm:`Diese Transaktion löschen? Die Salden werden automatisch neu berechnet.`,deposit:`Einzahlung`,withdraw:`Auszahlung`,printCharge:`Druckkosten`,deleteTransaction:`Transaktion löschen`},printers:{locations:{title:`Druckerstandorte`,backToPrinters:`Zurück zu den Druckern`,subtitle:`{{grouped}} mit Standort, {{ungrouped}} ohne`,search:`Standorte durchsuchen...`,showEmpty:`Leere anzeigen`,hideEmpty:`Leere ausblenden`,select:`Auswählen`,done:`Fertig`,sortNameAsc:`Nach Name A→Z`,sortNameDesc:`Nach Name Z→A`,sortCountAsc:`Wenigste Drucker`,sortCountDesc:`Meiste Drucker`,create:`Neuer Standort`,createTitle:`Standort anlegen`,editTitle:`Standort bearbeiten`,namePlaceholder:`Name des Standorts`,icon:`Symbol`,color:`Farbe`,noColor:`Keine Farbe`,none:`Noch keine Druckerstandorte`,noResults:`Kein Standort passt zur Suche`,printerCount:`Drucker: {{count}}`,noPrinters:`Keine Drucker an diesem Standort`,selectPrinter:`Drucker auswählen`,move:`An einen anderen Standort verschieben`,moveButton:`Verschieben`,removeFromLocation:`Vom Standort entfernen`,ungroupedPrinters:`Drucker ohne Standort: {{count}}`,selected:`Ausgewählt: {{count}}`,deleteSelected:`Auswahl löschen`,moveTitle:`Drucker verschieben`,moveTitleMany:`Drucker verschieben ({{count}})`,targetPlaceholder:`Standort auswählen...`,noLocation:`Kein Standort`,deleteTitle:`Standort löschen`,deleteTitleMany:`Standorte löschen ({{count}})`,deleteMessage:`{{names}} löschen? Drucker danach ohne Standort: {{count}}.`,created:`Standort angelegt`,saved:`Standort aktualisiert`,deleted:`Standorte gelöscht: {{count}}`,moved:`Drucker verschoben: {{count}}`,failed:`Die Änderung konnte nicht gespeichert werden: {{error}}`},addPreflight:{checking:`Verbindung wird geprüft...`,warning:`Einige Verbindungsprüfungen sind fehlgeschlagen. Dieser Drucker wird möglicherweise als offline angezeigt. Prüfe die Punkte unten, behebe was möglich ist, oder speichere trotzdem.`,back:`Zurück`,saveAnyway:`Trotzdem speichern`},title:`Drucker`,addPrinter:`Drucker hinzufügen`,editPrinter:`Drucker bearbeiten`,deletePrinter:`Drucker löschen`,printerName:`Druckername`,serialNumber:`Seriennummer`,ipAddress:`IP-Adresse / Hostname`,accessCode:`Zugangscode`,model:`Modell`,nozzleCount:`Düsenanzahl`,autoArchive:`Automatische Archivierung`,status:{available:`Verfügbar`,idle:`Bereit`,printing:`Druckt`,paused:`Pausiert`,offline:`Offline`,problem:`Problem`,error:`Fehler`,finished:`Fertig`,unknown:`Unbekannt`},temperatures:{nozzle:`Düse`,bed:`Druckbett`,chamber:`Kammer`},heaterHistory:{title:`Heizungsverlauf`,openLabel:`Heizungsverlauf anzeigen`,nozzle:`Düse`,nozzle2:`Düse 2`,bed:`Druckbett`,chamber:`Kammer`,error:`Verlauf konnte nicht geladen werden`,empty:`Noch keine Daten aufgezeichnet`},progress:`{{percent}}% abgeschlossen`,timeRemaining:`Noch {{time}}`,deleteConfirm:`Möchten Sie "{{name}}" wirklich löschen?`,maintenanceOk:`Wartung OK`,maintenanceWarning:`{{count}} Warnung`,maintenanceWarning_plural:`{{count}} Warnungen`,maintenanceDue:`{{count}} fällig`,maintenanceDue_plural:`{{count}} fällig`,sort:{name:`Name`,status:`Status`,model:`Modell`,location:`Standort`,eta:`Restzeit`,ascending:`Aufsteigend sortieren`,descending:`Absteigend sortieren`},cardSize:{small:`Kleine Karten`,medium:`Mittlere Karten`,large:`Große Karten`,extraLarge:`Extra große Karten`},pageView:{openCamWallPage:`Kamera-Wand als Seite öffnen`,cards:`Karten`,camWall:`Kamera-Wand`},camWall:{page:{tokenRejected:`Dieser Kamera-Wand-Link ist nicht mehr gültig. Das Token ist möglicherweise abgelaufen oder wurde widerrufen.`,loadFailed:`Die Drucker konnten nicht geladen werden.`},tileSize:{small:`Kleine Kacheln`,medium:`Mittlere Kacheln`,large:`Große Kacheln`,extraLarge:`Extra große Kacheln`},noPrinters:`Keine Drucker anzuzeigen`,noSignal:`Kein Signal`,live:`Live`,snap:`Foto`,off:`Aus`,summary:`{{live}} live, {{snap}} Schnappschüsse, {{total}} insgesamt`,layer:`Schicht {{cur}}/{{total}}`,timeLeft:`noch {{time}}`,statusMode:{off:`Aus`,compact:`Kompakt`,full:`Voll`},settings:{title:`Kamera-Wand-Einstellungen`,maxLive:`Max. Live-Streams`,maxLiveHint:`Wie viele Kacheln gleichzeitig live streamen. Andere aktualisieren als Schnappschüsse.`,snapshotInterval:`Schnappschuss-Intervall (Sekunden)`,snapshotIntervalHint:`Wie oft Nicht-Live-Kacheln einen neuen Schnappschuss abrufen.`,statusOverlay:`Status-Overlay`,statusOverlayHint:`Kompakt: nur Status-Plakette. Voll: + Fortschritt, Schicht, Restzeit.`}},hideOffline:`Offline ausblenden`,nextAvailable:`Nächster verfügbar`,powerOn:`Einschalten`,offlinePrintersWithPlugs:`Offline-Drucker mit Smart-Plugs`,noPrintersConfigured:`Noch keine Drucker konfiguriert`,search:`Drucker suchen...`,noSearchResults:`Keine Drucker entsprechen deiner Suche oder deinen Filtern`,filter:{allStatuses:`Alle Status`,allLocations:`Alle Standorte`},toolbar:{filters:`Filter`,view:`Ansicht`,actions:`Aktionen`},readyToPrint:`Druckbereit`,external:`Extern`,ext:`Extern`,extL:`Ext-L`,extR:`Ext-R`,deleteArchives:`Druckarchive löschen`,noLabel:`Keine Bezeichnung`,printPreview:`Druckvorschau`,width:`Breite`,height:`Höhe`,noObjectsFound:`Keine Objekte gefunden`,objectsLoadedOnPrintStart:`Objekte werden beim Druckstart geladen`,willBeSkipped:`Wird übersprungen`,name:`Name`,serialCannotBeChanged:`Seriennummer kann nicht geändert werden`,locationHelp:`Dient zur Gruppierung von Druckern und zum Filtern von Warteschlangenaufträgen`,wifiSignal:{veryWeak:`Sehr schwach`,weak:`Schwach`,fair:`Ausreichend`,good:`Gut`,excellent:`Ausgezeichnet`},maintenanceUpToDate:`Alle Wartungen aktuell - Klicken zum Anzeigen`,maintenance:{title:`In Wartung`,subtitle:`Dieser Drucker ist pausiert — keine Verbindung, nicht für die Warteschlange verfügbar, keine Benachrichtigungen.`,pillLabel:`Wartung`,exitButton:`Wartung beenden`,menuEnter:`In den Wartungsmodus wechseln`,menuExit:`Wartungsmodus beenden`,toastEntered:`{{name}} ist jetzt im Wartungsmodus`,toastExited:`{{name}} ist wieder online`,confirmMidPrintTitle:`Wartungsmodus während des Drucks aktivieren?`,confirmMidPrintMessage:`{{name}} druckt gerade. Der Wartungsmodus trennt die MQTT-Verbindung und beendet das Fortschritts-Tracking sowie Abschlussbenachrichtigungen für diesen Auftrag. Fortfahren?`,editFieldLabel:`Wartungsmodus`,editFieldHelp:`Wenn aktiviert, ist dieser Drucker von MQTT, Warteschlangenversand und Benachrichtigungen pausiert — nützlich für Reparaturen, parallele Bambuddy-Installationen oder temporäre Außerbetriebnahme.`},chamberLightOn:`Kammerbeleuchtung einschalten`,chamberLightOff:`Kammerbeleuchtung ausschalten`,files:`Dateien`,browseFiles:`Druckerdateien durchsuchen`,autoOffAfterPrint:`Automatisches Ausschalten nach Druck`,autoOffExecuted:`Auto-off wurde ausgeführt - Drucker einschalten zum Zurücksetzen`,hmsErrors:`HMS-Fehler`,viewHmsErrors:`{{count}} HMS-Fehler anzeigen`,resume:`Fortsetzen`,pause:`Pausieren`,stop:`Stoppen`,camera:`Kamera`,skipObject:`Objekt überspringen`,reconnect:`Neu verbinden`,forceRefresh:`Aktualisierung erzwingen`,forceRefreshSuccess:`Aktualisierung angefordert`,mqttDebug:`MQTT-Debug`,printerInformation:`Druckerinformationen`,copyToClipboard:`Kopieren`,copied:`Kopiert!`,state:`Zustand`,wifiSignalLabel:`WLAN-Signal`,developerMode:`Entwicklermodus`,enabled:`Aktiviert`,disabled:`Deaktiviert`,addedOn:`Hinzugefügt`,sdCard:`SD-Karte`,inserted:`Eingelegt`,notInserted:`Nicht eingelegt`,totalPrintHours:`Druckstunden`,activeNozzle:`Aktiv: {{nozzle}} Düse`,amsSwitchInletTooltip:`Filamentweiche IN-{{inlet}} ({{side}}) — versorgt beide Düsen`,nozzleRack:`Düsenhalter`,nozzleDocked:`Angedockt`,nozzleMounted:`Montiert`,nozzleActive:`Aktiv`,nozzleIdle:`Inaktiv`,nozzleDiameter:`Durchmesser`,nozzleType:`Typ`,nozzleStatus:`Status`,nozzleFilament:`Filament`,nozzleWear:`Verschleiß`,nozzleMaxTemp:`Max. Temp`,nozzleSerial:`Seriennr.`,nozzleHardenedSteel:`Gehärteter Stahl`,nozzleStainlessSteel:`Edelstahl`,nozzleTungstenCarbide:`Wolframkarbid`,nozzleFlow:`Durchfluss`,nozzleHighFlow:`Hoher Durchfluss`,nozzleStandardFlow:`Standard`,firmwareUpdate:`Firmware-Update`,firmwareInstructions:`Gehen Sie auf dem Touchscreen des Druckers zu`,firmwareNav:`Navigieren Sie zu`,settings:`Einstellungen`,firmware:`Firmware`,discoverPrinters:`Drucker entdecken`,searching:`Suche...`,manualEntry:`Manuelle Eingabe`,addFromCloud:`Aus Cloud hinzufügen`,toast:{printerDeleted:`Drucker gelöscht`,missingSpoolAssignment:`Druck gestartet auf {{printer}}. Fehlende Spulenzuordnung für: {{slots}}`,killSwitchTriggered:`Der Billing-Kill-Switch hat einen nicht autorisierten Druck auf {{printer}} gestoppt: {{filename}}`,billingChargeFailed:`Die Abrechnung für {{filename}} auf {{printer}} ist fehlgeschlagen. Die Budgetreservierung bleibt bestehen; prüfe die Serverprotokolle.`,assignmentVerified:`Filament in Slot {{slot}} geladen ({{printer}})`,assignmentVerifiedNoKprofile:`Slot {{slot}} auf {{printer}} geladen, aber das Fluss-Kalibrierungsprofil (K-Profil) wurde nicht übernommen`,assignmentNotConfirmed:`Zuordnung für Slot {{slot}} auf {{printer}} konnte nicht bestätigt werden – bitte den AMS-Slot prüfen`,printerAdded:`Drucker hinzugefügt`,printerUpdated:`Drucker aktualisiert`,failedToDelete:`Drucker konnte nicht gelöscht werden`,failedToAdd:`Drucker konnte nicht hinzugefügt werden`,connectionFailedNotAdded:`Keine Verbindung zum Drucker möglich. Prüfen Sie IP-Adresse, Seriennummer und Zugangscode und stellen Sie sicher, dass der Nur-LAN-Modus aktiv ist. Der Drucker wurde nicht hinzugefügt.`,failedToUpdate:`Drucker konnte nicht aktualisiert werden`,commandSent:`Befehl gesendet`,failedToSendCommand:`Befehl konnte nicht gesendet werden`,turnedOn:`{{name}} eingeschaltet`,failedToPowerOn:`{{name}} konnte nicht eingeschaltet werden`,scriptTriggered:`Skript ausgelöst`,printStopped:`Druck gestoppt`,printPaused:`Druck pausiert`,printResumed:`Druck fortgesetzt`,referenceDeleted:`Referenz gelöscht`,detectionAreaSaved:`Erkennungsbereich gespeichert`,failedToRunScript:`Skript konnte nicht ausgeführt werden`,failedToStopPrint:`Druck konnte nicht gestoppt werden`,failedToPausePrint:`Druck konnte nicht pausiert werden`,failedToResumePrint:`Druck konnte nicht fortgesetzt werden`,failedToControlChamberLight:`Kammerbeleuchtung konnte nicht gesteuert werden`,failedToSetSpeed:`Druckgeschwindigkeit konnte nicht eingestellt werden`,failedToUpdateSetting:`Einstellung konnte nicht aktualisiert werden`,failedToSkipObjects:`Objekte konnten nicht übersprungen werden`,failedToRereadRfid:`RFID konnte nicht erneut gelesen werden`,failedToCheckPlate:`Platte konnte nicht überprüft werden`,failedToUpdateLabel:`Bezeichnung konnte nicht aktualisiert werden`,failedToDeleteReference:`Referenz konnte nicht gelöscht werden`,failedToSaveDetectionArea:`Erkennungsbereich konnte nicht gespeichert werden`,plateCheckEnabled:`Plattenprüfung aktiviert`,plateCheckDisabled:`Plattenprüfung deaktiviert`,calibrationSaved:`Kalibrierung gespeichert!`,calibrationFailed:`Kalibrierung fehlgeschlagen`,rfidRereadInitiated:`RFID-Neueinlesen gestartet`,loadInitiated:`Filament wird geladen…`,unloadInitiated:`Filament wird entladen…`,failedToLoad:`Filament konnte nicht geladen werden`,failedToUnload:`Filament konnte nicht entladen werden`},connection:{connected:`Verbunden`,offline:`Offline`},plateStatus:{markCleared:`Platte als freigegeben markieren`,cleared:`Platte freigegeben`,notCleared:`Platte nicht freigegeben`,inUse:`Platte in Benutzung`},queue:{inQueue:`{{count}} Druck in Warteschlange`,inQueue_plural:`{{count}} Drucke in Warteschlange`},controls:`Steuerung`,rfid:{reread:`RFID neu lesen`},ams:{load:`Laden`,unload:`Entladen`,feedTitle:`{{slot}} in welche Düse laden?`,feedPrompt:`Der Filament Track Switch kann diesen Slot zu beiden Hotends leiten. Wähle, welches beschickt werden soll.`,feedLeft:`Linke Düse`,feedRight:`Rechte Düse`,feedAlreadyLoaded:`Bereits geladen`,switchNotReady:`Der Filament Track Switch ist noch nicht eingerichtet. Weise am Drucker jedem AMS einen Eingang zu und versuche es erneut.`},bedJog:{limitWarning:`Verfahrwege werden bei manuellen Bewegungen nicht begrenzt – ein Firmware-Fehler von Bambu ignoriert die Software-Endschalter bei Remote-Befehlen. Bewegen Sie vorsichtig, um Kollisionen zu vermeiden.`,title:`Jog-Steuerung`,bed:`Bett`,step:`Schritt (mm)`,up:`Platte hoch`,down:`Platte runter`,toolheadUp:`Druckkopf hoch`,toolheadDown:`Druckkopf runter`,disabledWhilePrinting:`Während des Drucks deaktiviert`,notHomedTitle:`Drucker ist nicht referenziert`,notHomedMessage:`Der Drucker wurde seit dem letzten Druck nicht referenziert. Führen Sie zuerst die automatische Referenzfahrt aus (parkt den Werkzeugkopf und referenziert dann X, Y und Z) oder bewegen Sie trotzdem — die Software-Endschalter werden dabei umgangen.`,homeZ:`Automatische Referenzfahrt`,moveAnyway:`Trotzdem bewegen`,homingStarted:`Drucker wird automatisch referenziert…`},permission:{noAdd:`Sie haben keine Berechtigung, Drucker hinzuzufügen`,noEdit:`Sie haben keine Berechtigung, Drucker zu bearbeiten`,noDelete:`Sie haben keine Berechtigung, Drucker zu löschen`,noControl:`Sie haben keine Berechtigung, Drucker zu steuern`,noFiles:`Sie haben keine Berechtigung, auf Druckerdateien zuzugreifen`,noAmsRfid:`Sie haben keine Berechtigung, AMS-RFID erneut zu lesen`,noSmartPlugControl:`Sie haben keine Berechtigung, Smart Plugs zu steuern`,noCamera:`Sie haben keine Berechtigung, Kameras anzuzeigen`},modal:{addTitle:`Drucker hinzufügen`,editTitle:`Drucker bearbeiten`,myPrinter:`Mein Drucker`,selectModel:`Modell auswählen...`,locationGroup:`Standort / Gruppe (optional)`,locationPlaceholder:`z.B. Werkstatt, Büro, Keller`,autoArchiveLabel:`Abgeschlossene Drucke automatisch archivieren`,wearCostLabel:`Verschleißkosten pro Druckstunde ({{currency}})`,wearCostHelp:`Was eine Druckstunde diesen Drucker an Verschleiß und Ersatzteilen kostet. Wird ab jetzt zu den Kosten jedes Drucks addiert; frühere Drucke bleiben unverändert. Leer lassen zum Abschalten.`,fromPrinterSettings:`Aus Druckereinstellungen`,modelOptional:`Modell (optional)`,saveChanges:`Änderungen speichern`},skipObjects:{tooltip:`Objekte überspringen`,onlyWhilePrinting:`Objekte überspringen (nur während des Drucks)`,requiresMultiple:`Objekte überspringen (erfordert 2+ Objekte)`,title:`Objekte überspringen`,matchIdsInfo:`IDs mit Drucker-Display abgleichen`,printerShowsIds:`Der Druckerbildschirm zeigt Objekt-IDs auf der Bauplatte`,skipSelected:`Ausgewählte überspringen`,skipping:`Überspringe...`,noObjectsSelected:`Keine Objekte ausgewählt`,selectObjectsToSkip:`Wählen Sie Objekte aus, die Sie vom aktuellen Druck überspringen möchten`,skipped:`übersprungen`,objectsSkipped:`Objekte übersprungen`,activeCount:`{{count}} aktiv`,waitForLayer:`Warten Sie auf Schicht 2+ zum Überspringen von Objekten (aktuell Schicht {{layer}})`,skip:`Überspringen`,confirmTitle:`Objekt überspringen?`,confirmMessage:`Möchten Sie "{{name}}" wirklich überspringen? Dies kann nicht rückgängig gemacht werden.`,confirmAllMessage:`Alle verbleibenden Objekte sind ausgewählt. Dadurch wird der Druckauftrag beendet. Fortfahren?`,confirmMultipleMessage:`{{count}} ausgewählte Objekte überspringen? Dies kann nicht rückgängig gemacht werden.`},confirm:{deleteTitle:`Drucker löschen`,deleteMessage:`Möchten Sie "{{name}}" wirklich löschen? Alle Verbindungseinstellungen werden entfernt.`,deleteArchivesNote:`Der gesamte Druckverlauf für diesen Drucker wird dauerhaft gelöscht.`,keepArchivesNote:`Der Druckverlauf wird beibehalten, aber nicht mehr mit diesem Drucker verknüpft.`,stopTitle:`Druck stoppen`,stopMessage:`Möchten Sie den aktuellen Druck auf "{{name}}" wirklich stoppen? Der Druckauftrag wird abgebrochen.`,stopButton:`Druck stoppen`,pauseTitle:`Druck pausieren`,pauseMessage:`Möchten Sie den aktuellen Druck auf "{{name}}" wirklich pausieren?`,pauseButton:`Druck pausieren`,resumeTitle:`Druck fortsetzen`,resumeMessage:`Möchten Sie den Druck auf "{{name}}" fortsetzen?`,resumeButton:`Druck fortsetzen`,powerOnTitle:`Drucker einschalten`,powerOnMessage:`Möchten Sie die Stromversorgung für "{{name}}" wirklich EINSCHALTEN?`,powerOnButton:`Einschalten`,powerOffTitle:`Drucker ausschalten`,powerOffMessage:`Möchten Sie die Stromversorgung für "{{name}}" wirklich AUSSCHALTEN?`,powerOffWarning:`WARNUNG: "{{name}}" druckt gerade! Möchten Sie die Stromversorgung wirklich AUSSCHALTEN? Dies unterbricht den Druck und kann den Drucker beschädigen.`,powerOffButton:`Ausschalten`,haToggleTitle:`"{{name}}" umschalten`,haToggleMessage:`Home-Assistant-Entität {{entity}} umschalten? Das kann die Stromversorgung ausschalten, falls sie gerade an ist.`,haToggleWarning:`WARNUNG: "{{name}}" druckt gerade! Umschalten von {{entity}} kann die Stromversorgung trennen und den Druck abbrechen. Fortfahren?`,haToggleButton:`Umschalten`},bulk:{select:`Auswählen`,selectAll:`Alle auswählen`,selectByLocation:`Nach Standort auswählen`,selected:`{{count}} ausgewählt`,actions:{stop:`Stoppen`,pause:`Pausieren`,resume:`Fortsetzen`,clearPlate:`Druckbett leeren`,clearHMS:`Benachrichtigungen löschen`},confirm:{stopTitle:`{{count}} Drucke stoppen`,stopMessage:`Dies wird aktive Drucke auf {{count}} Drucker(n) abbrechen. Diese Aktion kann nicht rückgängig gemacht werden.`,stopButton:`Alle stoppen`,pauseTitle:`{{count}} Drucke pausieren`,pauseMessage:`Dies wird aktive Drucke auf {{count}} Drucker(n) pausieren.`,pauseButton:`Alle pausieren`,clearPlateTitle:`{{count}} Druckbetten leeren`,clearPlateMessage:`Dies wird das Druckbett auf {{count}} Drucker(n) leeren und kann wartende Aufträge starten.`,clearPlateButton:`Alle leeren`},success:`{{action}} auf {{count}} Drucker(n) abgeschlossen`,partial:`{{succeeded}} erfolgreich, {{failed}} fehlgeschlagen`,noneApplicable:`Keine ausgewählten Drucker sind im richtigen Zustand für diese Aktion`,selectByState:`Nach Status auswählen`},discovery:{title:`Drucker entdecken`,searching:`Suche...`,scanning:`Scanne...`,scanProgress:`Scanne... {{scanned}}/{{total}}`,foundPrinters:`{{count}} Drucker gefunden`,noPrintersFound:`Keine Drucker gefunden`,noPrintersFoundSubnet:`Keine Drucker im angegebenen Subnetz gefunden.`,noPrintersFoundNetwork:`Keine Drucker im Netzwerk gefunden.`,allConfigured:`Alle erkannten Drucker sind bereits konfiguriert.`,alreadyAdded:`Bereits hinzugefügt`,select:`Auswählen`,manualEntry:`Manuelle Eingabe`,addFromCloud:`Aus Cloud hinzufügen`,subnetToScan:`Zu scannendes Subnetz`,dockerNote:`Docker erkannt. Geben Sie das Subnetz Ihres Druckers in CIDR-Notation ein. Erfordert network_mode: host in docker-compose.yml.`,scanSubnet:`Subnetz nach Druckern scannen`,discoverNetwork:`Drucker im Netzwerk suchen`,scanningSubnet:`Subnetz wird nach Bambu-Druckern gescannt...`,scanningNetwork:`Netzwerk wird gescannt...`,serialRequired:`Seriennummer erforderlich`,unknown:`Unbekannt`,failedToStart:`Erkennung konnte nicht gestartet werden`,customSubnetOption:`Eigenes Subnetz...`,customSubnetLabel:`Eigenes Subnetz (CIDR)`,customSubnetNote:`Wähle ein eigenes Subnetz, wenn dein Drucker in einem anderen Netzwerk als dieser Server steht. Die Ports FTP (990) und MQTT (8883) müssen über die Routinggrenze erreichbar sein.`},drying:{start:`Trocknung starten`,stop:`Trocknung stoppen`,temperature:`Temperatur`,duration:`Dauer`,hours:`Stunden`,timeRemaining:`{{time}} verbleibend`,active:`Trocknung`,notRunning:`Trocknung läuft nicht`,notRunningHint:`Der Drucker hat einen Trocknungstimer gesetzt, aber der Countdown steht still und das AMS meldet keine Trocknungsphase. Der Zyklus wurde nie gestartet oder unterbrochen, zum Beispiel durch die Stromgrenze oder den laufenden Druck.`,targetSummary:`{{filament}} @ {{temp}}°C`,notSupported:`Trocknung nicht unterstützt`,powerRequired:`AMS-Netzteil anschließen, um Trocknung zu aktivieren`,cannotDryNow:`AMS kann das Trocknen gerade nicht starten`,startingDrying:`Trocknung wird gestartet...`,toastCommandSent:`Trocknungsbefehl gesendet`,toastStopped:`Trocknung gestoppt`,toastNotStarted:`Der Drucker hat den Befehl angenommen, aber das AMS hat die Trocknung nicht gestartet. Prüfe, ob das AMS-Netzteil angeschlossen ist und der Drucker im Leerlauf ist.`,screenOnly:`Die AMS-Trocknung kann bei diesem Drucker nur am Bildschirm des Druckers selbst gesteuert werden (Einschränkung von Bambu)`,stoppingDrying:`Trocknung wird gestoppt...`,rotateTray:`Spule während der Trocknung drehen`,rotateUnavailableReason:`Nicht verfügbar — in diesem AMS ist ein Slot zum Druckkopf hin geladen. Die Spule ist durch den Zuführschlauch blockiert und kann nicht rotieren. Filament zuerst zurückziehen.`,startMode:`Startzeit`,modeNow:`Jetzt`,modeDelay:`Nach Verzögerung`,modeAtTime:`Zu Uhrzeit`,schedule:`Planen`,scheduledFor:`Trocknung geplant für {{time}}`,scheduledAsap:`Trocknung geplant (wartet auf Drucker)`,cancelScheduled:`Geplante Trocknung abbrechen`,scheduleFailed:`Trocknung konnte nicht geplant werden`,retractFilament:`Filament am AMS-Ausgang zurückziehen, um die Trocknung zu starten`,waitingAmsNotFound:`Warten, bis das AMS erkannt wird`,waitingOffline:`Warten, bis der Drucker online ist`,waitingPrinterBusy:`Warten, bis der Drucker frei ist`,waitingAlreadyDrying:`Warten, bis der laufende Trocknungszyklus beendet ist`,waitingInterrupted:`Unterbrochen, startet erneut, sobald der Drucker frei ist`,scheduleFailedReason:`Geplante Trocknung fehlgeschlagen: {{reason}}`,scheduleFailedUnknown:`Unbekannter Fehler`,scheduleFailedDidNotStart:`Der Drucker hat den Befehl angenommen, aber das AMS hat nicht mit dem Trocknen begonnen`,dismissFailed:`Ausblenden`},amsBackup:{titleOn:`AMS Filament Backup ist EIN. Zum Deaktivieren klicken.`,titleOff:`AMS Filament Backup ist AUS. Zum Aktivieren klicken.`,titleUnknown:`AMS-Filament-Backup-Status auf diesem Drucker nicht verfügbar.`,toastEnabled:`AMS Filament Backup aktiviert`,toastDisabled:`AMS Filament Backup deaktiviert`,modalTitle:`AMS Filament Backup`,modalHelp:`Wenn der aktive Slot leer wird, wechselt der Drucker in dieser Reihenfolge zu Slots mit demselben Preset und derselben Farbe.`,modalNoSlots:`Kein Filament geladen.`,modalNoPairs:`Keine Backup-Paare — keine zwei Slots teilen sich Filament-Preset und Farbe.`,extruderRightShort:`R`,extruderLeftShort:`L`,stateOn:`Aktiviert`,stateOff:`Deaktiviert`,stateUnknown:`Auf diesem Drucker nicht unterstützt`},activeJobSlot:{title:`Dieser Slot ist Filament {{n}} im aktiven Druck`,ariaLabel:`Aktiver Druck-Slot {{n}}`},expectedSlot:{title:`Der Drucker wartet auf Filament in diesem Slot`,ariaLabel:`Erwarteter Filament-Slot {{n}}`,label:`{{ams}} · Slot {{slot}}`,external:`Externe Spule`},filaments:`Filamente`,externalSpool:{hide:`Externe Spule ausblenden`,show:`Externe Spule einblenden`},openCameraOverlay:`Kamera-Overlay öffnen`,openCameraWindow:`Kamera in neuem Fenster öffnen`,firmwareUpdateAvailable:`Firmware-Update verfügbar: {{current}} → {{latest}}`,firmwareUpToDate:`Firmware {{version}} — Aktuell`,firmwareUpdateButton:`Aktualisieren`,plateDetection:{noPermission:`Sie haben keine Berechtigung, Drucker zu aktualisieren`,enabledClick:`Plattenprüfung aktiviert - Klicken zum Deaktivieren`,disabledClick:`Plattenprüfung deaktiviert - Klicken zum Aktivieren`,manageCalibration:`Platten-Erkennungskalibrierung verwalten`,calibrationRequired:`Kalibrierung erforderlich`,calibrationInstructions:`Bitte stellen Sie sicher, dass die Druckplatte vollständig leer ist, und klicken Sie dann auf Kalibrieren.`,calibrationDescription:`Die Kalibrierung erfasst ein Referenzbild der leeren Platte. Zukünftige Prüfungen vergleichen mit dieser Referenz, um Objekte zu erkennen.`,calibrationTip:`Tipp: Sie können bis zu 5 Kalibrierungen für verschiedene Platten speichern. Das System verwendet automatisch die beste Übereinstimmung bei der Prüfung.`,plateEmpty:`Platte erscheint leer`,objectsDetected:`Objekte auf Platte erkannt`,confidence:`Konfidenz`,difference:`Differenz`,analysisPreview:`Analysevorschau:`,analysisLegend:`Grüner Rahmen = Erkennungsbereich, Rote Überlagerung = Unterschiede zur Kalibrierung`,savedReferences:`Gespeicherte Referenzen ({{count}}/{{max}})`,deleteReference:`Referenz löschen`,labelPlaceholder:`Bezeichnung...`,clickToEdit:`{{label}} - Zum Bearbeiten klicken`,clickToAddLabel:`Zum Hinzufügen einer Bezeichnung klicken`},speed:{title:`Druckgeschwindigkeit`,silent:`Leise (50%)`,standard:`Standard (100%)`,sport:`Sport (124%)`,ludicrous:`Ludicrous (166%)`},airduct:{title:`Luftkanal-Modus`,cooling:`Kühlen`,heating:`Heizen`},noSdCard:`Keine SD`,door:{open:`Offen`,closed:`Zu`},fans:{partCooling:`Bauteilkühlung`,auxiliary:`Hilfsventilator`,leftAuxiliary:`Linker Hilfsventilator`,exhaust:`Abluft`,chamber:`Kammerventilator`},clickToViewHmsErrors:`Klicken, um HMS-Fehler anzuzeigen`,aiDetection:{safe:`Sicher`,warning:`Warnung`,failure:`Fehldruck`,idle:`Bereit`,error:`Prüft nicht`,unknown:`Startet`,tooltipError:`KI-Fehlererkennung prüft diesen Druck nicht: {{reason}} - klicken für Details`,tooltipUnknown:`KI-Fehlererkennung: warte auf das erste Ergebnis - klicken für Details`,errorHint:`Dieser Druck wird nicht geprüft. Die Erkennung läuft automatisch weiter, sobald das Problem unten behoben ist.`,tooltip:`KI-Fehlererkennung: {{status}} (Score {{score}}) - klicken für Details`,tooltipIdle:`KI-Fehlererkennung aktiviert - Überwachung startet mit dem nächsten Druck - klicken für Details`,modalTitle:`KI-Fehlererkennung - {{name}}`,currentStatus:`Status`,score:`Score`,framesAnalyzed:`Analysierte Bilder`,idleHint:`Derzeit wird kein Druck überwacht. Die Überwachung startet automatisch mit dem nächsten Druck.`,lastError:`Letzter Fehler`,openSettings:`Einstellungen öffnen`},estimatedCompletion:`Geschätzte Fertigstellungszeit`,plateNumber:`Platte {{number}}`,slotOptions:`Slot-Optionen`,amsPopup:{friendlyName:`AMS-Name`,friendlyNamePlaceholder:`z. B. AMS-Anzeigename`,serialNumber:`Seriennummer`,firmwareVersion:`Firmware`,save:`Speichern`,clear:`Löschen`,noEditPermission:`Sie haben keine Berechtigung, AMS-Einheiten umzubenennen`},firmwareModal:{title:`Firmware-Update`,titleUpToDate:`Firmware-Info`,currentVersion:`Aktuell:`,latestVersion:`Neueste:`,releaseNotes:`Versionshinweise`,checkingPrereqs:`Prüfe Voraussetzungen...`,sdCardReady:`SD-Karte bereit. Klicken Sie unten, um die Firmware hochzuladen.`,uploadedSuccess:`Firmware auf SD-Karte hochgeladen!`,applyInstructions:`So wenden Sie das Update auf Ihrem Drucker an:`,step1:`Gehen Sie auf dem Touchscreen des Druckers zu Einstellungen`,step2:`Navigieren Sie zu Firmware`,step3:`Wählen Sie Update von SD-Karte`,step4:`Das Update dauert 10-20 Minuten`,done:`Fertig`,starting:`Starte...`,uploadFirmware:`Firmware hochladen`,uploadFailed:`Upload fehlgeschlagen: {{error}}`,uploadedToast:`Firmware hochgeladen! Starten Sie das Update vom Druckerbildschirm.`,availableVersions:`Verfügbare Versionen`,usable:`Installierbar`,unavailable:`Nicht verfügbar`,installed:`Installiert`,newerBadge:`neuer`,olderBadge:`älter`,currentBadge:`aktuell`},accessCodePlaceholder:`Leer lassen, um den aktuellen zu behalten`,roi:{title:`Erkennungsbereich (ROI)`,xStart:`X-Start`,yStart:`Y-Start`,width:`Breite`,height:`Höhe`,instruction:`Passen Sie den Erkennungsbereich an, um sich auf die Druckplatte zu konzentrieren. Der grüne Rahmen in der Vorschau zeigt den aktuellen Bereich.`},developerModeWarning:`Der Entwickler-LAN-Modus ist nicht aktiviert auf: {{names}}. Einige Funktionen funktionieren möglicherweise nicht.`,howToEnable:`Aktivieren`,incompatibleFile:`Diese Datei wurde für {{slicedFor}} geslicet, aber dieser Drucker ist ein {{printerModel}}`,dropNotPrintable:`Nur .gcode- und .gcode.3mf-Dateien können gedruckt werden`,dropToPrint:`Zum Drucken ablegen`,dropToQueue:`Zum Einreihen ablegen`},archives:{media:{title:`Druckvideos`,download:`Druckvideos herunterladen`,searching:`Der Drucker wird nach Videos durchsucht…`,searchFailed:`Der Drucker konnte nicht nach Videos durchsucht werden.`,none:`Für diesen Druck wurden keine Zeitraffer- oder IP-Kamera-Clips gefunden.`,attachedTimelapse:`Angehängter Zeitraffer`,printerFiles:`Noch auf dem Drucker vorhandene Dateien`,downloadSelected:`Auswahl herunterladen`,printerMissing:`Der Drucker ist nicht mehr konfiguriert`,timelapseUnavailable:`Das Zeitrafferverzeichnis konnte nicht gelesen werden`,ipcamUnavailable:`Das IP-Kamera-Verzeichnis konnte nicht gelesen werden`},title:`Druckarchiv`,no3mfBanner:{title:`Einige kürzliche Drucke konnten nicht mit Vorschaubild archiviert werden`,body:`Der Slicer hat die .gcode.3mf-Datei nicht auf der SD-Karte des Druckers hinterlegt, daher konnte Bambuddy weder Vorschaubild noch Slicer-Metadaten abrufen. Üblicherweise liegt das daran, dass "Gesendete Dateien auf externem Speicher speichern" im Slicer (Geräte-Tab in Bambu Studio / OrcaSlicer) deaktiviert ist.`,docsLink:`Installationsschritt 4 anzeigen`,docsLinkInternalStorage:`Warum das passiert`,titleInternalStorage:`Einige kürzliche Drucke blieben im internen Speicher des Druckers`,bodyInternalStorage:`Bambu Studio hat die geslicte Datei im internen Speicher des Druckers statt auf der Karte abgelegt, daher gab es für Bambuddy nichts über FTP zu lesen. Bei der H2-Serie, dem P2S und dem X2D macht die Schaltfläche "Drucken" das immer — nur "Senden" bietet eine Auswahl, und auch die steht standardmäßig auf "Cache". Diese Drucke werden weiterhin mit Namen und Zeiten archiviert, nur ohne Vorschaubild und Slicer-Metadaten. Für vollständige Archive den Druck aus Bambuddy starten oder in OrcaSlicer slicen — oder in Bambu Studio "Senden" mit "Extern" verwenden und den Druck danach starten. Alle setzen eine Karte oder einen Stick im Drucker voraus.`,titleNoExternalStorage:`Einige kürzliche Drucke konnten nicht archiviert werden — kein Speicher im Drucker`,bodyNoExternalStorage:`Der Drucker meldet weder Karte noch Stick im Steckplatz, daher hatte die geslicte Datei keinen Ablageort und Bambuddy nichts zu lesen. Legen Sie einen ein, dann wird der nächste Druck vollständig archiviert.`,titleInternalHistory:`Einige kürzliche Drucke wurden aus einer Datei gestartet, die bereits auf dem Drucker lag`,bodyInternalHistory:`Diese Drucke liefen aus der eigenen Bibliothek des Druckers — ein erneuter Druck über sein Display, ein Start aus Handy oder eine früher gesendete und später gedruckte Datei. Bambuddy liest Druckdateien über FTP, und das bedient nur Karte oder Stick, während der Drucker diese Bibliothek in einem Bereich ablegt, den FTP nicht erreicht — es gab also keine 3MF zu lesen. Keine Slicer-Einstellung ändert das, denn für diese Drucke wurde nichts gesendet. Sie werden weiterhin mit Namen und Zeiten archiviert, und unter "Archiv bearbeiten" lässt sich das verbrauchte Filament von Hand eintragen. Für ein vollständiges Archiv starten Sie den Druck stattdessen aus Bambuddy oder aus Ihrem Slicer.`,titleFtpsCooloff:`Einige kürzliche Drucke konnten nicht archiviert werden — der Drucker hat die Dateiverbindung abgewiesen`,bodyFtpsCooloff:`Bambuddy hat den Dateiübertragungs-Port des Druckers (FTPS 990) geöffnet, und der Drucker hat mit etwas geantwortet, das kein TLS ist. Deshalb ließ sich nichts von ihm lesen. Diese Drucke sind weiterhin mit Namen und Zeiten archiviert, nur ohne Vorschaubild und Slicer-Metadaten. Das ist keine Slicer-Einstellung und nichts, was Sie geändert haben — dieselben Modelle und Firmware-Stände laufen auf anderen Installationen normal, und ein betroffener Drucker arbeitet später meist von selbst wieder. Nach einem solchen Fehler pausiert Bambuddy die Übertragungen zu diesem Drucker fünf Minuten lang und holt die Datei nach Ablauf der Pause erneut; eine kurze Episode behebt sich damit von selbst, eine weiterhin leere Karte bedeutet, dass die Abweisung länger anhielt als der zweite Versuch. Was das auslöst, ist noch nicht bekannt. Wenn es wiederholt auftritt, aktivieren Sie auf der Seite System die Debug-Protokollierung und hängen Sie ein Support-Paket an Ihre Meldung an.`,titleFtpTransferFailed:`Einige aktuelle Drucke konnten nicht archiviert werden — die Dateiübertragung hat zu lange gedauert`,bodyFtpTransferFailed:`Die geslicete Datei lag auf der Karte des Druckers und der Drucker hat sie auch ausgeliefert, aber die Übertragung wurde nicht in der erlaubten Zeit fertig. Zum Druckstart bedient der Drucker gleichzeitig seine Kamera, seine Statusmeldungen und den Auftrags-Upload, und eine große 3MF kommt dagegen nicht immer durch. Diese Drucke sind weiterhin mit Name und Zeiten archiviert, nur ohne Vorschaubild und Slicer-Daten. Das ist keine Slicer-Einstellung und nichts, was Sie geändert haben. Bambuddy holt die Datei in den folgenden zehn Minuten noch dreimal nach, die meisten Fälle erledigen sich also von selbst; eine weiterhin leere Karte bedeutet, dass auch jeder dieser Versuche zu lange gedauert hat. Wenn es häufiger vorkommt, erhöhen Sie Verbindungs-Timeout unter Einstellungen > Netzwerk > FTP-Wiederholung.`,dismissLabel:`Hinweis schließen`},searchPlaceholder:`Archiv durchsuchen...`,filterByPrinter:`Nach Drucker filtern`,filterByStatus:`Nach Status filtern`,sortBy:`Sortieren nach`,sortNewest:`Neueste zuerst`,sortOldest:`Älteste zuerst`,sortName:`Name`,sortDuration:`Dauer`,sortLargest:`Größte zuerst`,sortSmallest:`Kleinste zuerst`,sortSize:`Größe`,noArchives:`Keine Archive gefunden`,noArchivesSearch:`Keine Archive entsprechen Ihrer Suche`,originalPrintNotVisible:`Ursprünglicher Druck nicht sichtbar - versuchen Sie, die Filter zu löschen`,noArchivesYet:`Noch keine Archive`,prints:`Drucke`,pagination:{showing:`Zeige`,to:`bis`,of:`von`,show:`Zeige`,page:`Seite`,all:`Alle`},loadingArchives:`Lade Archive...`,releaseToUpload:`Loslassen zum Hochladen`,showAll:`Alle anzeigen`,showFavoritesOnly:`Nur Favoriten anzeigen`,gridView:`Rasteransicht`,listView:`Listenansicht`,calendarView:`Kalenderansicht`,logView:`Druckprotokoll`,manageTags:`Tags verwalten`,showFailedPrints:`Fehlgeschlagene Drucke anzeigen`,hideFailedPrints:`Fehlgeschlagene Drucke ausblenden`,hideDuplicates:`Duplikate ausblenden`,filterUnconfirmed:`Unbestätigt`,filterUnconfirmedTitle:`Nur Drucke anzeigen, die noch auf ihre Ergebnis-Bewertung warten`,viewOriginalPrint:`Klicken, um den ursprünglichen Druck anzuzeigen (#{{id}})`,printTime:`Druckzeit`,filamentUsed:`Verbrauchtes Filament`,cost:`Kosten`,preview:`Vorschau`,deleteArchive:`Archiv löschen`,deleteConfirm:`Möchten Sie dieses Archiv wirklich löschen?`,favorite:`Favorit`,unfavorite:`Aus Favoriten entfernen`,viewDetails:`Details anzeigen`,status:{completed:`Abgeschlossen`,failed:`Fehlgeschlagen`,stopped:`Gestoppt`},toast:{source3mfAttached:`Quell-3MF angehängt: {{filename}}`,failedUploadSource3mf:`Fehler beim Hochladen der Quell-3MF`,source3mfRemoved:`Quell-3MF entfernt`,failedRemoveSource3mf:`Fehler beim Entfernen der Quell-3MF`,f3dAttached:`F3D angehängt: {{filename}}`,failedUploadF3d:`Fehler beim Hochladen der F3D`,f3dRemoved:`F3D entfernt`,failedRemoveF3d:`Fehler beim Entfernen der F3D`,timelapseAttached:`Zeitraffer angehängt: {{filename}}`,timelapseAlreadyAttached:`Zeitraffer bereits angehängt`,noMatchingTimelapse:`Kein passender Zeitraffer gefunden`,failedScanTimelapse:`Fehler beim Suchen nach Zeitraffer`,failedAttachTimelapse:`Fehler beim Anhängen des Zeitraffers`,timelapseRemoved:`Zeitraffer entfernt`,failedRemoveTimelapse:`Fehler beim Entfernen des Zeitraffers`,timelapseUploaded:`Zeitraffer hochgeladen: {{filename}}`,failedUploadTimelapse:`Fehler beim Hochladen des Zeitraffers`,archiveDeleted:`Archiv gelöscht`,failedDeleteArchive:`Fehler beim Löschen des Archivs`,addedToFavorites:`Zu Favoriten hinzugefügt`,removedFromFavorites:`Aus Favoriten entfernt`,projectUpdated:`Projekt aktualisiert`,failedUpdateProject:`Fehler beim Aktualisieren des Projekts`,linkCopied:`Link in die Zwischenablage kopiert`,failedCopyLink:`Fehler beim Kopieren des Links`,photoDeleted:`Foto gelöscht`,failedDeletePhoto:`Fehler beim Löschen des Fotos`,failedDeleteArchives:`Fehler beim Löschen der Archive`,failedUpdateFavorites:`Fehler beim Aktualisieren der Favoriten`,exportDownloaded:`Export heruntergeladen`,exportFailed:`Export fehlgeschlagen`},menu:{print:`Drucken`,openInBambuStudio:`Im Slicer öffnen`,slice:`Slicen`,externalLink:`Externer Link`,viewOnMakerWorld:`Auf MakerWorld ansehen`,confirmOutcome:`Ergebnis bestätigen`,preview3d:`3D-Vorschau`,viewTimelapse:`Zeitraffer ansehen`,scanForTimelapse:`Nach Zeitraffer suchen`,uploadTimelapse:`Zeitraffer hochladen`,removeTimelapse:`Zeitraffer entfernen`,downloadSource3mf:`Quell-3MF herunterladen`,uploadSource3mf:`Quell-3MF hochladen`,replaceSource3mf:`Quell-3MF ersetzen`,removeSource3mf:`Quell-3MF entfernen`,uploadF3d:`F3D hochladen`,replaceF3d:`F3D ersetzen`,downloadF3d:`F3D herunterladen`,removeF3d:`F3D entfernen`,download:`Herunterladen`,copyDownloadLink:`Download-Link kopieren`,qrCode:`QR-Code`,viewPhotos:`Fotos ansehen`,viewPhotosCount:`Fotos ansehen ({{count}})`,projectPage:`Projektseite`,addToFavorites:`Zu Favoriten hinzufügen`,removeFromFavorites:`Aus Favoriten entfernen`,edit:`Bearbeiten`,printLog:`Druckprotokoll`,goToProject:`Zum Projekt: {{name}}`,addToProject:`Zu Projekt hinzufügen`,removeFromProject:`Aus Projekt entfernen`,loading:`Laden...`,noProjectsAvailable:`Keine Projekte verfügbar`,searchProjects:`Projekte suchen…`,select:`Auswählen`,deselect:`Abwählen`,delete:`Löschen`},permission:{noReprint:`Sie haben keine Berechtigung, dieses Archiv erneut zu drucken`,noAddToQueue:`Sie haben keine Berechtigung, zur Warteschlange hinzuzufügen`,noUpdateArchives:`Sie haben keine Berechtigung, Archive zu aktualisieren`,noUploadFiles:`Sie haben keine Berechtigung, Dateien hochzuladen`,noDownload:`Sie haben keine Berechtigung, Archive herunterzuladen`,noCopyLink:`Sie haben keine Berechtigung, Download-Links zu kopieren`,noDelete:`Sie haben keine Berechtigung, dieses Archiv zu löschen`,noEdit:`Sie haben keine Berechtigung, diesen Eintrag zu bearbeiten`,noCreate:`Sie haben keine Berechtigung, Archive zu erstellen`},platePicker:{title:`Platte zur Vorschau auswählen`,hint:`Dieses Archiv enthält mehrere Platten. Wähle eine, um sie im GCode-Viewer zu öffnen.`,plateLabel:`Platte {{index}}`,objectCount:`{{count}} Objekt`,objectCount_plural:`{{count}} Objekte`,noGcode:`Dieses Archiv enthält keinen geschnittenen G-Code zur Vorschau. Öffne es zuerst in Bambu Studio zum Slicen.`},card:{previousPlate:`Vorherige Platte`,nextPlate:`Nächste Platte`,plateNumber:`Platte {{index}}`,moreOptions:`Rechtsklick für mehr Optionen`,addToFavorites:`Zu Favoriten hinzufügen`,removeFromFavorites:`Aus Favoriten entfernen`,cancelled:`abgebrochen`,failed:`fehlgeschlagen`,confirmPending:`Ergebnis?`,confirmPendingTitle:`Dieser Druck wartet auf eine Ergebnis-Bewertung — zum Antworten klicken`,rejected:`Ausschuss`,rejectedTitle:`Auf dem Drucker abgeschlossen, vom Benutzer als Ausschuss markiert`,confirmedGood:`Gutteil`,confirmedGoodTitle:`Vom Benutzer als Gutteil bestätigt`,duplicate:`Duplikat`,duplicateTitle:`Dieses Modell wurde bereits zuvor gedruckt`,openSource3mf:`Quell-3MF in Bambu Studio öffnen (Rechtsklick für mehr Optionen)`,downloadF3d:`Fusion 360 Designdatei herunterladen`,viewTimelapse:`Zeitraffer ansehen`,viewPhoto:`1 Foto ansehen`,viewPhotos:`{{count}} Fotos ansehen`,openFolder:`Ordner öffnen: {{name}}`,slicedFile:`Geslicte Datei - druckbereit`,sourceFile:`Nur Quelldatei - keine AMS-Zuordnung verfügbar`,gcode:`GCODE`,source:`QUELLE`,project:`Projekt: {{name}}`,runsBadge:`{{count}} Drucke`,runsBadgeTitle:`Insgesamt {{count}} Drucke — {{successful}} erfolgreich, {{failed}} fehlgeschlagen. Klicken, um das vollständige Druckprotokoll zu öffnen.`,estimated:`Geschätzt: {{time}}`,actual:`Tatsächlich: {{time}}`,accuracy:`Genauigkeit: {{percent}}%`,filament:`{{weight}} g`,layer:`{{count}} Schicht`,layers:`{{count}} Schichten`,wearCost:`Druckerverschleiß`,costEstimate:`Schätzung – die endgültigen Kosten stehen fest, wenn der Druck abgeschlossen ist`,object:`{{count}} Objekt`,objects:`{{count}} Objekte`,slicedFor:`Geslict für {{model}}`,uploadedBy:`Hochgeladen von`,noPermissionReprint:`Sie haben keine Berechtigung, erneut zu drucken`,noFileForReprint:`Keine 3MF-Datei verfügbar — die Datei konnte beim Aufzeichnen des Drucks nicht vom Drucker heruntergeladen werden`,slicerAmsMapping:`AMS-Zuordnung gespeichert ({{printer}})`,slicerAmsMappingTooltip:`Die AMS-Steckplatzwahl des Slicers wurde für {{printer}} gespeichert. Steckplatznummern gelten nur für diesen Drucker, daher wird sie bei einem erneuten Druck nur wiederverwendet, wenn er wieder an {{printer}} geht.`,noPermissionEdit:`Sie haben keine Berechtigung, Archive zu bearbeiten`,noPermissionDelete:`Sie haben keine Berechtigung, Archive zu löschen`,openInBambuStudio:`Im Slicer öffnen`,openInBambuStudioToSlice:`Im Slicer öffnen zum Slicen`,slice:`Slicen`,externalLink:`Externer Link`,makerWorld:`MakerWorld – {{designer}}`,viewProject:`Projekt ansehen`,noExternalLink:`Kein externer Link`,preview3d:`3D-Vorschau`,download:`Herunterladen`,edit:`Bearbeiten`,delete:`Löschen`},runLog:{title:`Druckprotokoll`,modalTitle:`Druckprotokoll — {{name}}`,modalTitleFallback:`dieses Archiv`,empty:`Für dieses Archiv wurden noch keine Druckereignisse aufgezeichnet.`,col:{date:`Datum`,status:`Status`,duration:`Dauer`,filament:`Filament`,cost:`Kosten`},status:{completed:`Abgeschlossen`,failed:`Fehlgeschlagen`,cancelled:`Abgebrochen`,stopped:`Gestoppt`,skipped:`Übersprungen`,printing:`Druckt`}},modal:{deleteArchive:`Archiv löschen`,deleteConfirm:`Möchten Sie "{{name}}" wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.`,deleteButton:`Löschen`,deletePurgeStats:`Diesen Druck auch aus den Quick Stats entfernen (Filament, Zeit, Kosten, Energie)`,deleteQueueItemsWarning:`{{count}} mit diesem Archiv verknüpfte Warteschlangeneinträge werden ebenfalls entfernt.`,deleteBlockedByPrinting:`Löschen nicht möglich — {{count}} Warteschlangeneinträge werden derzeit gedruckt. Druck zuerst stoppen und erneut versuchen.`,removeSource3mf:`Quell-3MF entfernen`,removeSource3mfConfirm:`Möchten Sie die Quell-3MF-Datei wirklich von "{{name}}" entfernen? Die ursprüngliche Slicer-Projektdatei wird gelöscht.`,removeButton:`Entfernen`,removeF3d:`F3D entfernen`,removeF3dConfirm:`Möchten Sie die Fusion 360 Designdatei wirklich von "{{name}}" entfernen?`,removeTimelapse:`Zeitraffer entfernen`,removeTimelapseConfirm:`Möchten Sie das Zeitraffervideo wirklich von "{{name}}" entfernen?`,timelapse:`{{name}} - Zeitraffer`,selectTimelapse:`Zeitraffer auswählen`,selectTimelapseDesc:`Keine automatische Übereinstimmung gefunden. Wählen Sie den Zeitraffer für diesen Druck:`,deleteArchives:`Archive löschen`,deleteArchivesConfirm:`Möchten Sie wirklich {{count}} Archiv(e) löschen? Diese Aktion kann nicht rückgängig gemacht werden.`,deleteCount:`{{count}} löschen`},page:{title:`Archive`,printsCount:`{{filtered}} von {{total}} Drucken`,dropFilesHere:`.3mf-Dateien hier ablegen`,releaseToUpload:`Loslassen zum Hochladen`,only3mfSupported:`Nur .3mf-Dateien werden unterstützt`,close:`Schließen`,selected:`{{count}} ausgewählt`,selectAll:`Alle auswählen`,tags:`Tags`,project:`Projekt`,favorite:`Favorit`,delete:`Löschen`,toggledFavorites:`Favoriten für {{count}} Archiv(e) umgeschaltet`,failedUpdateFavorites:`Fehler beim Aktualisieren der Favoriten`,archivesDeleted:`{{count}} Archiv(e) gelöscht`,failedDeleteArchives:`Fehler beim Löschen der Archive`,photoDeleted:`Foto gelöscht`,failedDeletePhoto:`Fehler beim Löschen des Fotos`},list:{name:`Name`,printer:`Drucker`,date:`Datum`,size:`Größe`,actions:`Aktionen`,hasTimelapse:`Hat Zeitraffer`},log:{date:`Datum`,printName:`Druckname`,printer:`Drucker`,user:`Benutzer`,status:`Status`,duration:`Dauer`,filament:`Filament`,filamentUsed:`Filamentverbrauch`,cost:`Kosten`,energy:`Energie`,energyCost:`Energiekosten`,wearCost:`Verschleißkosten`,completedAt:`Beendet`,columns:`Spalten`,sortBy:`Nach {{column}} sortieren`,allPrinters:`Alle Drucker`,allUsers:`Alle Benutzer`,allStatuses:`Alle Status`,cancelled:`Abgebrochen`,skipped:`Übersprungen`,dateFrom:`Von`,dateTo:`Bis`,noEntries:`Keine Druckprotokolleinträge gefunden`,showing:`{{count}} von {{total}} Einträgen`,rowsPerPage:`Zeilen`,page:`Seite`,prev:`Zurück`,next:`Weiter`,clearLog:`Protokoll löschen`,clearLogTitle:`Druckprotokoll löschen`,clearLogConfirm:`Alle Druckprotokolleinträge werden dauerhaft gelöscht. Archive und Warteschlangeneinträge sind nicht betroffen. Diese Aktion kann nicht rückgängig gemacht werden. Sind Sie sicher?`,clearLogButton:`Alle löschen`,cleared:`{{count}} Protokolleinträge gelöscht`,clearFailed:`Druckprotokoll konnte nicht gelöscht werden`,deleteEntryTitle:`Druckprotokoll-Eintrag löschen`,deleteEntryConfirm:`Dieser Eintrag wird aus dem Protokoll entfernt und sein Filament-, Zeit- und Kostenbeitrag verschwindet aus den Schnellstatistiken. Das zugehörige Archiv (falls vorhanden) ist nicht betroffen. Diese Aktion kann nicht rückgängig gemacht werden.`,entryDeleted:`Druckprotokoll-Eintrag gelöscht`,entryDeleteFailed:`Druckprotokoll-Eintrag konnte nicht gelöscht werden`,editEntryTitle:`Druckprotokoll-Eintrag bearbeiten`,editEntryDescription:`Diesen Druckdurchlauf klassifizieren. Das Fehleranalyse-Widget gruppiert nach diesen Werten, sodass Aktualisierungen sofort in die Statistik einfließen.`,entryUpdated:`Druckprotokoll-Eintrag aktualisiert`,entryUpdateFailed:`Druckprotokoll-Eintrag konnte nicht aktualisiert werden`,statuses:{completed:`Abgeschlossen`,failed:`Fehlgeschlagen`,stopped:`Gestoppt`,cancelled:`Abgebrochen`,skipped:`Übersprungen`}}},dispatchToast:{untitled:`Druckjob`,startingPrints:`Drucke starten`,progressSummary:`{{complete}}/{{total}} fertig • Verarbeitung: {{processing}}`,expandDetails:`Versanddetails ausklappen`,collapseDetails:`Versanddetails einklappen`,awaitingPrinter:`Warte auf Drucker…`,status:{processing:`Verarbeitung`,completed:`Fertig`,failed:`Fehlgeschlagen`},failed:{generic:`Versand fehlgeschlagen`,upload_failed:`Upload zum Drucker fehlgeschlagen`,start_command_failed:`Drucker hat Startbefehl abgelehnt`},dismiss:`Schließen`},pipelineRuns:{title:`Pipeline-Läufe`,loading:`Wird geladen…`,empty:`Noch keine Pipeline-Läufe.`,filter:{pipeline:`Pipeline`,status:`Status`,target:`Ziel`,all:`Alle`,allPipelines:`Alle Pipelines`,allStatus:`Alle Status`,allTargets:`Alle Ziele`,clear:`Filter zurücksetzen`,noMatches:`Keine Läufe entsprechen den aktuellen Filtern.`},totalCount_one:`{{n}} Lauf`,totalCount_other:`{{n}} Läufe`,copies:`{{n}} Kopien`,failedCount:`{{n}} fehlgeschlagen`,copyN:`Kopie {{n}}`,retryFailed:`Fehlgeschlagene wiederholen`,retryOf:`Wiederholung von #{{n}}`,pagination:`{{start}}–{{end}} von {{total}}`,toast:{cancelled:`Lauf abgebrochen`,cancelFailed:`Abbruch fehlgeschlagen`,retryStarted:`Wiederholung gestartet`,retryFailed:`Wiederholung fehlgeschlagen`,cleared:`{{n}} Läufe gelöscht`,clearFailed:`Löschen fehlgeschlagen`},clearLog:`Verlauf löschen`,clearConfirmTitle:`Verlauf löschen?`,clearConfirmBody:`Jeden abgeschlossenen, fehlgeschlagenen, abgebrochenen und teilweise fehlgeschlagenen Pipeline-Lauf löschen? Laufende Läufe bleiben erhalten. Dies kann nicht rückgängig gemacht werden.`,clearConfirmAction:`Löschen`,jobStatus:{pending:`ausstehend`,awaiting_printer:`wartet auf Drucker`,queued:`in Warteschlange`,printing:`druckt`,completed:`abgeschlossen`,failed:`fehlgeschlagen`,cancelled:`abgebrochen`},cancelledByUser:`Vom Benutzer abgebrochen`},queue:{filamentShort:{rowBadge:`Filament fuer die zugewiesene Spule reicht nicht`,rowTooltip:`Der Dispatcher hat diese Position markiert. Klicke auf Play, um den Pro-Slot-Fehlbestand zu sehen und zu entscheiden, ob trotzdem gedruckt werden soll.`,confirmTitle:`Filament reicht nicht`,confirmIntro:`Die zugewiesene Spule kann mindestens einen Slot nicht versorgen. Trotzdem drucken?`,lineItem:`Slot {{slot}}: benoetigt {{required}} g, {{remaining}} g verbleibend`,unknown:`unbekannt`,printAnyway:`Trotzdem drucken`},filamentMissing:{confirmTitle:`Filament nicht geladen`,confirmIntro:`Der Drucker hat kein Fach mit diesem Filament. Legen Sie es ein und drücken Sie erneut auf Start, oder drucken Sie trotzdem:`},slicerAmsMapping:{rowBadge:`AMS-Steckplätze für diesen Drucker gespeichert`,rowTooltip:`Dieses Archiv enthält die genauen AMS-Steckplätze, die der Slicer ausgewählt hat, gespeichert für den Drucker dieses Eintrags. Ein erneuter Druck darauf kann diese Fächer wiederverwenden, statt erneut nach Typ und Farbe zuzuordnen.`},title:`Druckwarteschlange`,subtitle:`Planen und verwalten Sie Ihre Druckaufträge`,editQueueItem:`Warteschlangeneintrag bearbeiten`,selectAllPlates:`Alle {{count}} Platten auswählen`,deselectAll:`Alle abwählen`,printQueued:`Druck in Warteschlange`,printQueuedWillStartWhenIdle:`Startet, sobald der Drucker im Leerlauf ist`,itemsQueued:`{{count}} Einträge in Warteschlange`,sending:`Wird gesendet...`,sendingProgress:`Sende {{current}}/{{total}}...`,adding:`Wird hinzugefügt...`,addingProgress:`Füge hinzu {{current}}/{{total}}...`,savingProgress:`Speichere {{current}}/{{total}}...`,clearQueue:`Warteschlange leeren`,clearHistory:`Verlauf löschen`,emptyQueue:`Warteschlange ist leer`,position:`Position`,scheduledTime:`Geplante Zeit`,moveUp:`Nach oben`,moveDown:`Nach unten`,startNow:`Jetzt starten`,printingInProgress:`Druck läuft...`,viewArchive:`Archiv anzeigen`,viewInFileManager:`Im Dateimanager anzeigen`,itemCount:`{{count}} Element`,itemCount_plural:`{{count}} Elemente`,dragToReorder:`Ziehen zum Neuordnen (nur Sofort)`,reorderHint:`Position betrifft nur Sofort-Elemente. Geplante Elemente werden zur festgelegten Zeit ausgeführt.`,sjf:{label:`SJF`,tooltip:`Kürzester Auftrag zuerst — Scheduler bevorzugt kürzere Drucke`},addedBy:`Hinzugefügt von {{name}}`,nextInQueue:`Nächster in der Warteschlange`,clearPlateSuccess:`Druckplatte freigegeben — bereit für nächsten Druck`,plateNumber:`Platte {{index}}`,quantity:`Menge`,quantityHint:`Erstellt {{count}} Warteschlangeneinträge`,plateQuantityLabel:`Durchläufe von {{plate}}`,plateQuantityTotal_one:`{{count}} Durchlauf insgesamt`,plateQuantityTotal_other:`{{count}} Durchläufe insgesamt`,batchOrders:{title:`Stapelaufträge`,emptyTitle:`Keine Stapelaufträge`,emptyDescription:`Stelle eine Datei mit mehreren Druckplatten oder mehrere Kopien einer Platte in die Warteschlange — der Auftrag erscheint hier mit seinem Fortschritt.`,filter:{active:`Aktiv`,completed:`Abgeschlossen`,cancelled:`Abgebrochen`,all:`Alle`},status:{active:`Aktiv`,completed:`Abgeschlossen`,cancelled:`Abgebrochen`},noTargets:`Nur Gruppierung`,noTargetsHint:`Vor der Einführung von Zielmengen pro Platte erstellt; verfolgt daher die eingereihten Durchläufe statt einer Zielmenge.`,dispatchRemaining:`{{count}} verbleibende einreihen`,dispatchPlate:`Rest einreihen`,strandedPlate:`Keine Vorlage mehr zum Kopieren`,strandedNotice:`Von den {{owed}} noch offenen Durchläufen lassen sich {{runs}} nicht einreihen: Für diese Platte gibt es keinen eingereihten oder abgeschlossenen Durchlauf mehr, von dem sich die Einstellungen kopieren lassen. Reihe die Platte einmal aus der Datei ein oder brich den Auftrag ab.`,dispatched:`Verbleibende Durchläufe für {{name}} eingereiht`,plateProgress:`{{completed}} von {{target}} fertig`,remaining:`{{count}} noch offen`,failed:`{{count}} fehlgeschlagen`,printing:`{{count}} im Druck`,wholeFile:`Gesamte Datei`,due:`Fällig {{date}}`,costSoFar:`{{amount}} bisher`,costRemaining:`({{amount}} verbleibend)`},activeBatches:`Aktive Stapel`,batchProgress:`{{completed}} von {{total}} abgeschlossen`,cancelBatch:`Verbleibende abbrechen`,batchCancelled:`Verbleibende Stapeleinträge abgebrochen`,cancelBatchConfirmTitle:`Stapel abbrechen`,cancelBatchConfirmMessage:`Diesen Auftrag schließen? Noch eingereihte Durchläufe werden abgebrochen, und er fordert nicht länger, was er nicht produziert hat.`,batch:{defaultName:`Stapel`,label:`{{count}} Eintrag`,label_plural:`{{count}} Einträge`,pendingCount:`{{count}} ausstehend`,pendingCount_plural:`{{count}} ausstehend`,expand:`Stapel ausklappen`,collapse:`Stapel einklappen`,groupAsBatch:`Als Stapel gruppieren…`,groupAsBatchDescription:`Fasse die {{count}} ausgewählten Einträge zu einem einklappbaren Stapel zusammen.`,nameLabel:`Stapelname`,namePlaceholder:`z. B. Freitagsgeschenke`,create:`Stapel erstellen`,ungroup:`Gruppierung aufheben`,ungroupConfirmTitle:`Stapel auflösen?`,ungroupConfirmMessage:`Die Einträge bleiben in der Warteschlange, sind aber nicht mehr gruppiert.`,dragGroup:`Gruppe ziehen`},tabs:{batches:`Stapel`,queue:`Warteschlange`,history:`Verlauf`,timeline:`Zeitachse`,pipelines:`Druckabläufe`},layout:{flatList:`Liste`,byPrinter:`Nach Drucker`,groupByPrinter:`Nach Drucker gruppieren`},history:{emptyTitle:`Noch kein Verlauf`,emptyDescription:`Abgeschlossene, abgebrochene und fehlgeschlagene Drucke erscheinen hier.`,showMore:`Mehr anzeigen`,showingCount:`{{shown}} von {{total}} werden angezeigt`},dragGhost:{multiCount:`{{count}} Einträge`,batch:`{{name}} ({{count}} Kopie)`,batch_plural:`{{name}} ({{count}} Kopien)`},sections:{currentlyPrinting:`Aktuell druckend`,queued:`In Warteschlange`,history:`Verlauf`},status:{pending:`Ausstehend`,waiting:`Wartend`,printing:`Druckt`,paused:`Pausiert`,completed:`Abgeschlossen`,failed:`Fehlgeschlagen`,skipped:`Übersprungen`,cancelled:`Abgebrochen`},summary:{printing:`Druckt`,queued:`In Warteschlange`,totalTime:`Gesamte Wartezeit`,totalWeight:`Gesamtgewicht der Warteschlange`,history:`Verlauf`},filter:{allPrinters:`Alle Drucker`,unassigned:`Nicht zugewiesen`,allStatus:`Alle Status`,allLocations:`Alle Standorte`,any:`Beliebig`},sort:{byPosition:`Nach Position sortieren`,byName:`Nach Name sortieren`,byPrinter:`Nach Drucker sortieren`,bySchedule:`Nach Zeitplan sortieren`,byDate:`Nach Datum sortieren`,ascendingOldest:`Aufsteigend (älteste zuerst)`,descendingNewest:`Absteigend (neueste zuerst)`},badges:{awaitingReview:`Wartet auf Freigabe`,staged:`Bereitgestellt`,requiresPrevious:`Erfordert vorherigen Erfolg`,autoPowerOff:`Automatisch ausschalten`,gcodeInjection:`G-Code`,confirmOutcome:`Ergebnisabfrage`,confirmOutcomeTitle:`Fragt nach Abschluss, wie der Druck geworden ist`},empty:{title:`Keine Drucke geplant`,description:`Planen Sie einen Druck von der Archivseite über die Option "Planen" im Kontextmenü oder ziehen Sie Dateien hierher.`},time:{etaIfStartedNow:`Fertigstellungszeit, wenn dieser Auftrag jetzt starten würde`,whenFree:`Sobald ein Drucker frei ist`,overdue:`Überfällig`,now:`Jetzt`,lessThanMinute:`In weniger als einer Minute`,inMinutes:`In {{count}} Min`,inHours:`In {{count}} Stunden`},actions:{startPrint:`Druck starten`,stopPrint:`Druck stoppen`,requeue:`Erneut einreihen`},bulkEdit:{title:`{{count}} Element bearbeiten`,title_plural:`{{count}} Elemente bearbeiten`,description:`Nur geänderte Einstellungen werden auf ausgewählte Elemente angewendet.`,printer:`Drucker`,noChange:`— Keine Änderung —`,queueOptions:`Warteschlangenoptionen`,staged:`Bereitgestellt (manueller Start)`,autoPowerOff:`Nach Druck automatisch ausschalten`,requirePrevious:`Vorherigen Erfolg erfordern`,gcodeInjection:`G-Code einfügen`,printOptions:`Druckoptionen`,bedLevelling:`Bett-Nivellierung`,flowCalibration:`Fluss-Kalibrierung`,vibrationCalibration:`Vibrations-Kalibrierung`,layerInspection:`Erste-Schicht-Prüfung`,timelapse:`Zeitraffer`,useAms:`AMS verwenden`,confirmOutcome:`Nach Ergebnis fragen`,nozzleOffsetCali:`Düsenversatz-Kalibrierung`,applyChanges:`Änderungen übernehmen`,selectAll:`Alle auswählen`,deselectAll:`Auswahl aufheben`,selected:`{{count}} ausgewählt`,editSelected:`Ausgewählte bearbeiten`,cancelSelected:`Ausgewählte abbrechen`},confirm:{cancelTitle:`Geplanten Druck abbrechen`,cancelMessage:`Möchten Sie "{{name}}" wirklich abbrechen?`,stopTitle:`Druck stoppen`,stopMessage:`Möchten Sie den aktuellen Druck "{{name}}" wirklich stoppen? Der Druckauftrag wird am Drucker abgebrochen.`,removeTitle:`Aus Verlauf entfernen`,removeMessage:`Möchten Sie "{{name}}" wirklich aus dem Warteschlangenverlauf entfernen?`,clearHistoryTitle:`Verlauf löschen`,clearHistoryMessage:`Möchten Sie alle {{count}} Element(e) aus dem Verlauf entfernen?`,cancelButton:`Druck abbrechen`,stopButton:`Druck stoppen`,thisPrint:`diesen Druck`,thisItem:`dieses Element`},toast:{cancelled:`Warteschlangenelement abgebrochen`,cancelFailed:`Element konnte nicht abgebrochen werden`,removed:`Warteschlangenelement entfernt`,keptForOrder:`Abgebrochen statt entfernt: Nur aus diesem Durchlauf kann der Stapelauftrag diese Platte erneut einreihen`,historyKeptForOrders:`{{kept}} behalten, die Stapelaufträge noch brauchen.`,removeFailed:`Element konnte nicht entfernt werden`,stopped:`Druck gestoppt`,stopFailed:`Druck konnte nicht gestoppt werden`,released:`Druck in Warteschlange freigegeben`,startFailed:`Druck konnte nicht gestartet werden`,reorderFailed:`Warteschlange konnte nicht neu geordnet werden`,historyCleared:`{{count}} Verlaufselement(e) gelöscht`,clearHistoryFailed:`Verlauf konnte nicht gelöscht werden`,updateFailed:`Elemente konnten nicht aktualisiert werden`,bulkCancelled:`{{count}} Element(e) abgebrochen`,bulkCancelFailed:`Elemente konnten nicht abgebrochen werden`,batchCreated:`Stapel „{{name}}“ erstellt`,batchCreateFailed:`Stapel konnte nicht erstellt werden`,batchUngrouped:`{{count}} Eintrag/Einträge aus Stapel gelöst`,batchUngroupFailed:`Stapel konnte nicht aufgelöst werden`,resumedAfterFailure:`Warteschlange fortgesetzt — {{restored}} Auftrag/Aufträge wieder eingereiht`,resumeAfterFailureFailed:`Warteschlange konnte nicht fortgesetzt werden`},resumeAfterFailure:{banner:`{{printer}} ist durch einen vorherigen Druckfehler blockiert — {{count}} Auftrag/Aufträge übersprungen`,bannerHint:`Behebe das Druckerproblem und setze die Warteschlange dann fort, um die übersprungenen Aufträge wiederherzustellen und die Sperre aufzuheben.`,button:`Nach Fehler fortsetzen`,confirmTitle:`Warteschlange nach Fehler fortsetzen?`,confirmMessage:`Setze {{count}} übersprungenen Auftrag/Aufträge auf {{printer}} wieder auf „Ausstehend“ und hebe die Vorgängersperre auf. Stelle vorher sicher, dass der Drucker bereit ist.`},timeline:{listView:`Liste`,timelineView:`Zeitstrahl`,unassigned:`Nicht zugewiesen`,noData:`Keine geplanten Drucke für diesen Tag`,nothingCommitted:`Keine festgelegten Pläne in diesem Zeitfenster. Vorgemerkte Einträge, wartende Einträge und ASAP-Aufträge auf inaktiven Druckern werden nicht angezeigt — leg eine geplante Zeit fest oder gib einen vorgemerkten Eintrag frei, damit er hier erscheint.`,allDoneBy:`Alle Drucke voraussichtlich fertig um {{time}}`,staged:`Bereitgestellt`,filterAll:`Alle anzeigen`,filterPrinting:`Druckend`,filterQueued:`Warteschlange`,time:{anyMoment:`jeden Moment`,minutesLeft:`{{minutes}}m übrig`,hoursLeft:`{{hours}}h übrig`,hoursMinutesLeft:`{{hours}}h {{minutes}}m übrig`},day:{previous:`Vorheriger Tag`,next:`Nächster Tag`,today:`Heute`},window:{back12h:`12 Stunden zurück`,forward12h:`12 Stunden vor`,now:`Jetzt`},printerColumnHeader:`Drucker`},permissions:{noStopPrint:`Sie haben keine Berechtigung, Drucke zu stoppen`,noStartPrint:`Sie haben keine Berechtigung, Drucke zu starten`,awaitingReview:`Wartet auf Freigabe: Jemand, der die Warteschlange verwaltet, startet diesen Auftrag`,noEdit:`Sie haben keine Berechtigung, dieses Warteschlangenelement zu bearbeiten`,noCancel:`Sie haben keine Berechtigung, dieses Warteschlangenelement abzubrechen`,noRequeue:`Sie haben keine Berechtigung, Elemente erneut einzureihen`,noRemove:`Sie haben keine Berechtigung, dieses Warteschlangenelement zu entfernen`,noClearHistory:`Sie haben keine Berechtigung, den gesamten Verlauf zu löschen`,noEditItems:`Sie haben keine Berechtigung, Warteschlangenelemente zu bearbeiten`,noCancelItems:`Sie haben keine Berechtigung, Warteschlangenelemente abzubrechen`}},stats:{title:`Statistiken`,subtitle:`Widgets zum Neuanordnen ziehen. Auf das Augensymbol klicken zum Ausblenden.`,overview:`Übersicht`,totalPrints:`Gesamtdrucke`,successRate:`Erfolgsrate`,totalPrintTime:`Gesamtdruckzeit`,printTime:`Druckzeit`,totalFilament:`Gesamtverbrauch Filament`,filamentUsed:`Filamentverbrauch`,filamentCost:`Filamentkosten`,totalCost:`Gesamtkosten`,energyUsed:`Energieverbrauch`,energyCost:`Energiekosten`,wearCost:`Verschleißkosten`,energyWarmingUpTooltip:`Die Energieerfassung sammelt noch stündliche Snapshots. Zeitraumwerte werden genau, sobald vor dem gewählten Bereich mindestens ein Snapshot vorliegt. Frühe Werte können zu niedrig sein.`,averagePrintTime:`Durchschnittliche Druckzeit`,printsPerDay:`Drucke pro Tag`,byPrinter:`Nach Drucker`,printsByPrinter:`Drucke nach Drucker`,byMaterial:`Nach Material`,byMonth:`Nach Monat`,last7Days:`Letzte 7 Tage`,last30Days:`Letzte 30 Tage`,last90Days:`Letzte 90 Tage`,allTime:`Gesamt`,quickStats:`Schnellstatistiken`,printActivity:`Druckaktivität`,filamentTypes:`Filamenttypen`,filamentTrends:`Filamenttrends`,materialNumbers:{title:`Nach Materialnummer`,empty:`Noch keine Materialnummern vergeben. Weise sie Spulen im Bestand zu, um Verbrauch und Kosten hier zu gruppieren.`,loadFailed:`Die Materialnummern-Statistik konnte nicht geladen werden.`,spools:`Spulen`,remaining:`Verbleibend`,consumed:`Verbraucht`,cost:`Kosten`},suppliers:{title:`Nach Lieferant`,empty:`Noch keine Käufe erfasst. Markieren Sie an einer Spule, bei welchem Lieferanten sie gekauft wurde, um Verbrauch und Kosten hier zu gruppieren.`,error:`Lieferantenstatistik konnte nicht geladen werden`,supplier:`Lieferant`,spools:`Spulen`,remaining:`Verbleibend`,consumed:`Verbraucht`,cost:`Kosten`},failureAnalysis:`Fehleranalyse`,timeAccuracy:`Zeitgenauigkeit`,successful:`Erfolgreich:`,failed:`Fehlgeschlagen:`,cancelled:`Abgebrochen:`,perfectEstimate:`100% = perfekte Schätzung`,noTimeAccuracyData:`Noch keine Zeitgenauigkeitsdaten`,noFilamentData:`Keine Filamentdaten verfügbar`,noPrinterData:`Keine Druckerdaten verfügbar`,noPrintData:`Keine Druckdaten verfügbar`,noPrintDataLast30Days:`Keine Druckdaten in den letzten 30 Tagen`,failureReasons:`Fehlerursachen`,topFailureReasons:`Häufigste Fehlerursachen`,failedPrintsCount:`{{failed}} / {{total}} Drucke fehlgeschlagen`,rejectedPrintsCount:`{{rejected}} nach Abschluss als Ausschuss markiert`,yieldRate:`Ausbeute: {{rate}}%`,lastWeekRate:`Letzte Woche: {{rate}}%`,resetLayout:`Layout zurücksetzen`,recalculateCosts:`Kosten neu berechnen`,recalculateCostsHint:`Alle Archivkosten mit aktuellen Filamentpreisen neu berechnen`,exportStats:`Statistiken exportieren`,exportAsCsv:`Als CSV exportieren`,exportAsExcel:`Als Excel exportieren`,hiddenCount:`{{count}} ausgeblendet`,exportDownloaded:`Export heruntergeladen`,exportFailed:`Export fehlgeschlagen`,layoutReset:`Layout zurückgesetzt`,recalculatedCosts:`Kosten für {{count}} Archive neu berechnet`,recalculateFailed:`Kosten konnten nicht neu berechnet werden`,loadingStats:`Statistiken werden geladen...`,noPermissionResetLayout:`Sie haben keine Berechtigung, das Layout zurückzusetzen`,noPermissionRecalculate:`Sie haben keine Berechtigung, Kosten neu zu berechnen`,noPrintDataInRange:`Keine Druckdaten im ausgewählten Zeitraum`,periodFilament:`Filamentverbrauch`,periodCost:`Kosten`,avgPerPrint:`Durchschnitt pro Druck`,usageOverTime:`Verbrauch im Zeitverlauf`,energyOverTime:`Energie im Zeitverlauf`,filamentByWeight:`Gewicht`,printDuration:`Druckdauer`,printerUtilization:`Druckerauslastung`,filamentSuccess:`Erfolg nach Material`,printHabits:`Druckgewohnheiten`,printTimeOfDay:`Druck-Tageszeit`,colorDistribution:`Farbverteilung`,noColorData:`Keine Farbdaten verfügbar`,records:`Rekorde`,longestPrint:`Längster Druck`,heaviestPrint:`Schwerster Druck`,mostExpensivePrint:`Teuerster Druck`,busiestDay:`Aktivster Tag`,successStreak:`Erfolgsserie`,streakPrint:`aufeinanderfolgender Druck`,streakPrints:`{{count}} aufeinanderfolgende Drucke`,printerStats:`Druckerstatistiken`,hours:`Stunden`,avgPrints:`Ø Drucke`,noArchiveData:`Keine Druckdaten verfügbar`,filamentByTime:`Zeitverlauf`,avgWeight:`Ø Gewicht`,avgTime:`Ø Zeit`,filamentByPrints:`Drucke`,timeframe:{today:`Heute`,"this-week":`Diese Woche`,"this-month":`Dieser Monat`,"last-7":`Letzte 7 Tage`,"last-30":`Letzte 30 Tage`,"last-90":`Letzte 90 Tage`,"this-year":`Dieses Jahr`,"all-time":`Gesamt`,custom:`Benutzerdefiniert`,from:`Von`,to:`Bis`},allUsers:`Alle Benutzer`,noUser:`Kein Benutzer (System)`,filterByUser:`Nach Benutzer filtern`},maintenance:{title:`Wartung`,overview:`Übersicht`,allOk:`Alle Wartungen aktuell`,dueCount:`{{count}} Aufgabe fällig`,dueCount_plural:`{{count}} Aufgaben fällig`,warningCount:`{{count}} Warnung`,warningCount_plural:`{{count}} Warnungen`,totalPrintTime:`Gesamtdruckzeit`,nextMaintenance:`Nächste Wartung`,nothingDue:`Nichts fällig`,tasks:`Aufgaben`,lastPerformed:`Zuletzt durchgeführt`,interval:`Intervall`,hoursRemaining:`{{hours}}h verbleibend`,hoursOverdue:`{{hours}}h überfällig`,markDone:`Als erledigt markieren`,performMaintenance:`Wartung durchführen`,history:`Verlauf`,noHistory:`Kein Wartungsverlauf`,editPrintHours:`Druckstunden bearbeiten`,currentHours:`Aktuelle Stunden`,statusTab:`Status`,settingsTab:`Einstellungen`,overdueCount:`{{count}} überfällig`,dueSoonCount:`{{count}} bald fällig`,dueSoon:`Bald fällig`,allGood:`Alles in Ordnung`,overdueBy:`Überfällig um {{duration}}`,dueIn:`Fällig in {{duration}}`,timeLeft:`{{duration}} verbleibend`,day:`1 Tag`,days:`{{count}} Tage`,week:`1 Woche`,weeks:`{{count}} Wochen`,month:`1 Monat`,months:`{{count}} Monate`,year:`1 Jahr`,maintenanceTypes:`Wartungstypen`,maintenanceTypesDescription:`Systemtypen und Ihre benutzerdefinierten Wartungsaufgaben`,addCustomType:`Benutzerdefinierten Typ hinzufügen`,restoreDefaults:`Standardaufgaben wiederherstellen`,intervalType:`Intervalltyp`,intervalValue:`Intervall ({{type}})`,icon:`Symbol`,documentationLink:`Dokumentationslink (optional)`,assignToPrinters:`Druckern zuweisen`,selectAtLeastOnePrinter:`Wählen Sie mindestens einen Drucker`,addType:`Typ hinzufügen`,custom:`Benutzerdefiniert`,printHours:`Druckstunden`,calendarDays:`Kalendertage`,exampleName:`z.B. HEPA-Filter ersetzen`,viewDocumentation:`Dokumentation anzeigen`,timeBasedInterval:`Zeitbasiertes Intervall`,intervalOverrides:`Intervall-Überschreibungen`,intervalOverridesDescription:`Intervalle für bestimmte Drucker anpassen`,assignedToPrinters:`Druckern zugewiesen:`,noPrintersAssigned:`Keine Drucker zugewiesen`,addPrinterShort:`Hinzufügen:`,printersAssignedClick:`{{count}} Drucker zugewiesen - klicken zum Verwalten`,removeFromPrinter:`Von diesem Drucker entfernen`,types:{lubricateCarbonRods:`Karbonstäbe schmieren`,lubricateRails:`Linearschienen schmieren`,cleanNozzle:`Düse/Hotend reinigen`,checkBelts:`Riemenspannung prüfen`,cleanBuildPlate:`Druckbett reinigen`,checkExtruder:`Extruderzahnräder prüfen`,checkCooling:`Kühlungslüfter prüfen`,generalInspection:`Allgemeine Inspektion`,cleanCarbonRods:`Kohlenstoffstangen reinigen`,lubricateSteelRods:`Stahlstangen schmieren`,cleanSteelRods:`Stahlstangen reinigen`,cleanLinearRails:`Linearschienen reinigen`,checkPtfeTube:`PTFE-Schlauch prüfen`,replaceHepaFilter:`HEPA-Filter ersetzen`,replaceCarbonFilter:`Aktivkohlefilter ersetzen`,lubricateLeftNozzleRail:`Linke Düsenschiene schmieren`},maintenanceComplete:`Wartung als abgeschlossen markiert`,typeUpdated:`Wartungstyp aktualisiert`,typeDeleted:`Wartungstyp gelöscht`,defaultsRestored:`{{count}} Standardaufgabe(n) wiederhergestellt`,printHoursUpdated:`Druckstunden aktualisiert`,printerAssigned:`Drucker zugewiesen`,printerRemoved:`Drucker entfernt`,deleteTypeConfirm:`"{{name}}" löschen?`,deleteSystemTypeTitle:`Standard-Wartungsaufgabe löschen?`,deleteSystemTypeMessage:`Möchten Sie die Standard-Wartungsaufgabe "{{name}}" wirklich löschen?`,noPermissionUpdate:`Sie haben keine Berechtigung, Wartungselemente zu aktualisieren`,noPermissionPerform:`Sie haben keine Berechtigung, Wartungen durchzuführen`,noPermissionEditTypes:`Sie haben keine Berechtigung, Wartungstypen zu bearbeiten`,noPermissionDeleteTypes:`Sie haben keine Berechtigung, Wartungstypen zu löschen`,noPermissionEditHours:`Sie haben keine Berechtigung, Druckstunden zu bearbeiten`,noPermissionRemovePrinter:`Sie haben keine Berechtigung, Druckerzuweisungen zu entfernen`,noPermissionAssignPrinter:`Sie haben keine Berechtigung, Drucker zuzuweisen`,noPermissionEditIntervals:`Sie haben keine Berechtigung, Intervalle zu bearbeiten`,configureSettings:`Wartungstypen und Intervalle konfigurieren`},settings:{sliceEngine:`Slice-Engine`,sliceEngineSidecar:`Server-Sidecar`,sliceEngineSidecarHint:`Das Slicing läuft auf dem Server im Slicer-Sidecar-Container.`,sliceEngineBrowser:`Im Browser`,sliceEngineBrowserHint:`Das Slicing läuft auf diesem Gerät, ohne Server.`,title:`Einstellungen`,general:`Allgemein`,tabs:{general:`Allgemein`,smartPlugs:`Smart Plugs`,sensors:`Sensoren`,notifications:`Benachrichtigungen`,queue:`Workflow`,queueDispatch:`Warteschlange & Dispatch`,queuePipelines:`Pipelines`,filament:`Filament`,camera:`Kamera`,network:`Netzwerk`,apiKeys:`API-Schlüssel`,virtualPrinter:`Virtueller Drucker`,spoolbuddy:`SpoolBuddy`,failureDetection:`Fehlererkennung`,users:`Authentifizierung`,backup:`Sicherung`,emailAuth:`E-Mail-Authentifizierung`,ldap:`LDAP`,twoFa:`Zwei-Faktor-Auth`,oidc:`SSO / OIDC`,security:`Sicherheit`},spoolbuddy:{infoTitle:`SpoolBuddy-Geräte`,infoBody:`SpoolBuddy-Kioske registrieren sich automatisch per Heartbeat. Ein Gerät hier abmelden, wenn es nicht mehr verwendet wird oder wenn ein veralteter Eintrag nach einem Daemon-Absturz übrig geblieben ist.`,duplicatesTitle:`{{count}} Geräte registriert`,duplicatesBody:`Die Kiosk-Oberfläche verwendet nur das zuerst registrierte Gerät. Falls eines davon ein veralteter Doppeleintrag nach einem Absturz ist, kann es hier entfernt werden — ein laufendes Gerät registriert sich beim nächsten Heartbeat automatisch neu.`,empty:`Noch keine SpoolBuddy-Geräte registriert.`,online:`Online`,offline:`Offline`,unregister:`Abmelden`,unregisterSuccess:`Gerät abgemeldet`,unregisterError:`Gerät konnte nicht abgemeldet werden`,confirmTitle:`SpoolBuddy-Gerät abmelden?`,confirmBody:`Dies entfernt „{{hostname}}" ({{deviceId}}) aus der Datenbank. Ein laufendes Gerät registriert sich beim nächsten Heartbeat automatisch neu.`,ipAddress:`IP-Adresse`,firmware:`Firmware`,lastSeen:`Zuletzt gesehen`,daemonUptime:`Daemon-Laufzeit`,systemUptime:`System-Laufzeit`,never:`nie`,nfc:`NFC`,scale:`Waage`,cpuTemp:`CPU-Temp.`,cpuLoad:`CPU-Last`,memory:`Speicher`,disk:`Festplatte`,update:`Aktualisieren`,updateConfirmTitle:`Spoolbuddy-Daemon aktualisieren?`,updateConfirmBody:`Software-Update auf „{{hostname}}" auslösen? Der Daemon startet nach dem Update neu.`,restartBrowser:`Browser neu starten`,restartBrowserConfirmTitle:`Kiosk-Browser neu starten?`,restartBrowserConfirmBody:`Kiosk-Browser auf „{{hostname}}" neu starten? Die Anzeige wird kurz schwarz.`,restartDaemon:`Daemon neu starten`,restartDaemonConfirmTitle:`Spoolbuddy-Daemon neu starten?`,restartDaemonConfirmBody:`Spoolbuddy-Daemon auf „{{hostname}}" neu starten? Das Gerät ist für einige Sekunden offline.`,reboot:`Neustart`,rebootConfirmTitle:`Gerät neu starten?`,rebootConfirmBody:`„{{hostname}}" neu starten? Das Gerät ist für etwa eine Minute offline.`,shutdown:`Herunterfahren`,shutdownConfirmTitle:`Gerät herunterfahren?`,shutdownConfirmBody:`„{{hostname}}" herunterfahren? Physischer Zugriff ist nötig, um es wieder einzuschalten.`,commandConfirm:`Bestätigen`,commandQueued:`Befehl eingereiht`,commandError:`Befehl konnte nicht gesendet werden`},ldap:{title:`LDAP-Authentifizierung`,enabledDesc:`LDAP-Authentifizierung ist aktiviert`,disabledDesc:`LDAP-Authentifizierung ist deaktiviert`,disabledHint:`LDAP-Einstellungen unten konfigurieren und speichern, dann aktivieren.`,enabled:`LDAP-Authentifizierung aktiviert`,disabled:`LDAP-Authentifizierung deaktiviert`,feature1:`Benutzer können sich mit LDAP-Anmeldedaten anmelden`,feature2:`Lokales Admin-Konto bleibt als Fallback erhalten`,feature3:`LDAP-Gruppen werden bei der Anmeldung BamBuddy-Gruppen zugeordnet`,serverConfig:`LDAP-Server-Konfiguration`,serverUrl:`Server-URL`,serverUrlHint:`Verwenden Sie ldap:// für Standard oder ldaps:// für SSL-Verbindungen`,security:`Sicherheit`,securityHint:`StartTLS aktualisiert eine einfache Verbindung auf TLS. LDAPS verwendet TLS von Anfang an.`,bindDn:`Bind-DN (Dienstkonto)`,bindPassword:`Bind-Passwort`,searchBase:`Such-Basis-DN`,userFilter:`Benutzer-Suchfilter`,userFilterHint:`{username} wird durch den Anmeldenamen ersetzt. Verwenden Sie (uid={username}) für OpenLDAP.`,advanced:`Erweitert`,autoProvision:`Benutzer automatisch anlegen`,autoProvisionHint:`Automatisch ein BamBuddy-Konto bei der ersten LDAP-Anmeldung erstellen`,defaultGroup:`Standardgruppe`,defaultGroupNone:`— Keine (kein Fallback) —`,defaultGroupHint:`Fallback-Gruppe, die zugewiesen wird, wenn sich ein LDAP-Benutzer authentifiziert, aber in keiner zugeordneten LDAP-Gruppe enthalten ist. Leer lassen, um nicht zugeordnete Benutzer ohne Berechtigungen zu belassen.`,groupMapping:`Gruppenzuordnung (JSON)`,groupMappingHint:`LDAP-Gruppen-DNs BamBuddy-Gruppen zuordnen. Verfügbare Gruppen: `,testConnection:`Verbindung testen`,settingsSaved:`LDAP-Einstellungen gespeichert`,errors:{serverRequired:`LDAP-Server-URL ist erforderlich`,searchBaseRequired:`Such-Basis-DN ist erforderlich`,enableAuthFirst:`Authentifizierung zuerst aktivieren`,configureLdapFirst:`LDAP-Einstellungen zuerst speichern`}},email:{smtpSettings:`SMTP-Konfiguration`,smtpHost:`SMTP-Server`,smtpPort:`SMTP-Port`,security:`Sicherheit`,authentication:`Authentifizierung`,username:`Benutzername`,password:`Passwort`,fromEmail:`Absender-E-Mail`,fromName:`Absendername`,testConnection:`SMTP-Verbindung testen`,testRecipient:`Test-Empfänger-E-Mail`,sendTest:`Test-E-Mail senden`,sending:`Wird gesendet...`,save:`Einstellungen speichern`,saving:`Wird gespeichert...`,advancedAuth:`Erweiterte Authentifizierung`,advancedAuthEnabled:`Erweiterte Authentifizierung ist aktiviert`,advancedAuthEnabledDesc:`E-Mail-basierte Benutzerverwaltungsfunktionen sind aktiv. Neue Benutzer erhalten automatisch generierte Passwörter per E-Mail und können ihr Passwort über die Passwort vergessen Funktion zurücksetzen.`,advancedAuthDisabled:`Erweiterte Authentifizierung ist deaktiviert`,advancedAuthDisabledDesc:`Aktivieren Sie die erweiterte Authentifizierung, um E-Mail-basierte Funktionen für die Benutzerverwaltung zu aktivieren.`,enable:`Aktivieren`,disable:`Deaktivieren`,feature1:`Passwörter werden automatisch generiert und an neue Benutzer gesendet`,feature2:`Benutzer können sich mit Benutzername oder E-Mail anmelden`,feature3:`Passwort vergessen Funktion ist verfügbar`,feature4:`Administratoren können Benutzerpasswörter per E-Mail zurücksetzen`,errors:{requiredFields:`Bitte füllen Sie alle Pflichtfelder aus`,usernameRequired:`Benutzername ist erforderlich, wenn Authentifizierung aktiviert ist`,enterTestEmail:`Bitte geben Sie eine Test-E-Mail-Adresse ein`,smtpServerAndEmail:`Bitte füllen Sie SMTP-Server und Absender-E-Mail aus, bevor Sie testen`,usernamePasswordRequired:`Benutzername und Passwort sind erforderlich, wenn Authentifizierung aktiviert ist`,configureSmtpFirst:`Bitte konfigurieren und testen Sie zuerst die SMTP-Einstellungen`,enableAuthFirst:`Bitte aktivieren Sie zuerst die Authentifizierung, um E-Mail-basierte Funktionen nutzen zu können.`},success:{settingsSaved:`SMTP-Einstellungen erfolgreich gespeichert`},securityOptions:{starttls:`STARTTLS (Port 587)`,ssl:`SSL/TLS (Port 465)`,none:`Keine (Port 25)`},authOptions:{enabled:`Aktiviert`,disabled:`Deaktiviert`}},appearance:`Erscheinungsbild`,notifications:`Benachrichtigungen`,smartPlugs:`Smart Plugs`,spoolman:`Spoolman`,updates:`Aktualisierungen`,language:`Sprache`,languageDescription:`Wählen Sie Ihre bevorzugte Sprache`,theme:`Design`,themeLight:`Hell`,themeDark:`Dunkel`,themeSystem:`System`,defaultView:`Standardansicht`,defaultViewDescription:`Seite, die beim Öffnen der App angezeigt wird`,checkForUpdates:`Nach Updates suchen`,autoUpdate:`Automatische Updates`,currentVersion:`Aktuelle Version`,latestVersion:`Neueste Version`,upToDate:`Sie sind auf dem neuesten Stand`,updateAvailable:`Update verfügbar`,notificationLanguage:`Benachrichtigungssprache`,notificationLanguageDescription:`Sprache für Push-Benachrichtigungen`,bedCooledThreshold:`Bett-Abkühlung Schwellenwert`,bedCooledThresholdDescription:`Temperatur, unter der das Bett nach einem Druck als abgekühlt gilt`,userNotificationsEnabled:`Benutzerbenachrichtigungen`,userNotificationsEnabledDescription:`Aktiviert das Benutzerbenachrichtigungsmenü und E-Mail-Benachrichtigungen für Druckereignisse. Erfordert Erweiterte Authentifizierung.`,userNotificationsDisabledHint:`Erweiterte Authentifizierung aktivieren, um Benutzerbenachrichtigungen zu verwenden.`,notificationProviders:`Benachrichtigungsanbieter`,addProvider:`Anbieter hinzufügen`,editProvider:`Anbieter bearbeiten`,providerType:`Anbietertyp`,testNotification:`Testbenachrichtigung`,testSuccess:`Testbenachrichtigung erfolgreich gesendet`,testFailed:`Testbenachrichtigung konnte nicht gesendet werden`,quietHours:`Ruhezeiten`,quietHoursDescription:`Keine Störungen während dieser Zeiten`,quietHoursStart:`Beginn`,quietHoursEnd:`Ende`,events:{title:`Benachrichtigungsereignisse`,printStart:`Druck gestartet`,printComplete:`Druck abgeschlossen`,printFailed:`Druck fehlgeschlagen`,printStopped:`Druck gestoppt`,printProgress:`Fortschrittsmeldungen`,printProgressDescription:`Bei 25%, 50%, 75% benachrichtigen`,printerOffline:`Drucker offline`,printerError:`Druckerfehler`,filamentLow:`Filament niedrig`,maintenanceDue:`Wartung fällig`,maintenanceDueDescription:`Benachrichtigen, wenn Wartung erforderlich`},smartPlug:{title:`Smart Plugs`,add:`Smart Plug hinzufügen`,edit:`Smart Plug bearbeiten`,name:`Name`,ipAddress:`IP-Adresse`,linkedPrinter:`Verknüpfter Drucker`,autoOn:`Automatisch einschalten`,autoOnDescription:`Einschalten beim Druckstart`,autoOff:`Automatisch ausschalten`,autoOffDescription:`Ausschalten nach Druckende`,offDelay:`Ausschaltverzögerung`,offDelayMinutes:`Minuten nach Druck`,offDelayTemp:`Wenn Düse unter Temperatur`,currentState:`Aktueller Status`,turnOn:`Einschalten`,turnOff:`Ausschalten`},filamentTracking:`Filament-Verfolgung`,filamentTrackingDesc:`Wählen Sie, wie Sie Ihre Filamentspulen verfolgen möchten. Sie können das integrierte Inventar oder einen externen Spoolman-Server verwenden.`,autoAddUnknownRfid:`Unbekannte RFID-Spulen automatisch hinzufügen`,autoAddUnknownRfidDesc:`Erstellt automatisch einen Inventareintrag, wenn eine Spule mit unbekanntem RFID-Tag erkannt wird. Deaktivieren, wenn Sie neue Spulen vorab manuell anlegen, um Duplikate zu vermeiden.`,filamentChecks:`Filament-Prüfungen`,disableFilamentWarnings:`Filament-Warnungen deaktivieren`,disableFilamentWarningsDesc:`Keine Warnungen über unzureichendes Filament beim Drucken oder Einreihen anzeigen`,preferLowestFilament:`Niedrigsten Filamentrest bevorzugen`,preferLowestFilamentDesc:`Bei mehreren passenden Spulen die mit dem geringsten Restfilament verwenden`,preferLowestFilamentBackupNote:`Wirkt nur, wenn AMS Filament Backup am Drucker aktiviert ist — sonst kann der Drucker beim Aufbrauchen der ersten Spule nicht auf eine zweite Spule wechseln.`,trackingModeBuiltIn:`Integriertes Inventar`,trackingModeBuiltInDesc:`RFID-Erkennung und Verbrauchserfassung inklusive`,trackingModeSpoolmanDesc:`Externer Filament-Management-Server`,builtInFeatureRfid:`Erkennt automatisch Bambu Lab RFID-Spulen im AMS`,builtInFeatureUsage:`Erfasst den Filamentverbrauch pro Druck`,builtInFeatureCatalog:`Spulen, Farben und K-Faktor-Profile verwalten`,builtInFeatureThirdParty:`Drittanbieter-Spulen können Inventarspulen zugewiesen werden`,amsSyncButton:`Gewichte vom AMS synchronisieren`,amsSyncTitle:`Spulengewichte vom AMS synchronisieren`,amsSyncMessage:`Alle Inventar-Spulengewichte werden mit den aktuellen AMS-Restwerten der verbundenen Drucker überschrieben. Verwenden Sie dies zur Wiederherstellung beschädigter Gewichtsdaten. Drucker müssen online sein.`,amsSyncing:`Synchronisiere...`,amsSyncSuccess:`{{synced}} Spule(n) synchronisiert, {{skipped}} übersprungen`,amsSyncError:`Synchronisierung der Gewichte vom AMS fehlgeschlagen`,spoolmanAmsSyncButton:`Spoolman-Gewichte vom AMS synchronisieren`,spoolmanAmsSyncTitle:`Spoolman-Spulengewichte vom AMS synchronisieren`,spoolmanAmsSyncMessage:`Dabei werden alle Spoolman-Spulengewichte anhand der aktuellen AMS-Füllstandswerte der verbundenen Drucker aktualisiert. Die Drucker müssen online sein.`,spoolmanAmsSyncing:`Synchronisiere...`,spoolmanAmsSyncSuccess:`{{synced}} Spule(n) synchronisiert, {{skipped}} übersprungen`,spoolmanAmsSyncError:`Synchronisierung der Spoolman-Gewichte vom AMS fehlgeschlagen`,spoolmanAmsSyncErrorUnreachable:`Synchronisierung fehlgeschlagen (Spoolman nicht erreichbar)`,spoolmanAmsSyncErrorNotConfigured:`Synchronisierung fehlgeschlagen (Spoolman nicht konfiguriert)`,nativeTagsTitle:`Native Tags in Spoolman`,nativeTagsDesc:`Spoolman 0.27 verknüpft NFC-Tags selbst. Kopiert die Tags, die Bambuddy in extra.tag führt, dorthin, damit Spoolman und andere Lesegeräte die Spulen ebenfalls finden. extra.tag bleibt unverändert.`,nativeTagsCheck:`Tags prüfen`,nativeTagsToMove:`Zu kopieren`,nativeTagsAlready:`Schon in Spoolman`,nativeTagsSlotIds:`AMS-Slot-IDs (bleiben in extra.tag)`,nativeTagsConflicts:`Konflikte`,nativeTagsConflictSpool:`Spule #{{spool}}: Tag {{tag}} gehört bereits zu Spule #{{holder}}`,nativeTagsConflictElsewhere:`Spule #{{spool}}: Tag {{tag}} gehört bereits zu einem Filament oder Lagerort`,nativeTagsMove:`Tags kopieren`,nativeTagsMoved:`Nach Spoolman kopierte Tags: {{count}}`,nativeTagsNothing:`Alle Tags sind in Spoolman.`,nativeTagsError:`Tags konnten nicht nach Spoolman kopiert werden`,spoolmanNotConfigured:`Spoolman nicht konfiguriert`,spoolmanFilamentCatalogTitle:`Spoolman-Filamentkatalog`,spoolmanFilamentCatalogDesc:`Filamentnamen und Leergewichte aus deiner Spoolman-Instanz. Name und Spulengewicht sind hier editierbar; alle anderen Eigenschaften werden direkt in Spoolman verwaltet.`,spoolmanUrl:`Spoolman URL`,spoolmanUrlHint:`URL Ihres Spoolman-Servers (z.B. http://localhost:7912)`,spoolmanConnected:`Verbunden`,spoolmanDisconnected:`Nicht verbunden`,status:`Status`,connect:`Verbinden`,disconnect:`Trennen`,howSyncWorks:`So funktioniert die Synchronisierung`,syncInfoRfidOnly:`Nur offizielle Bambu Lab Spulen mit RFID werden synchronisiert`,syncInfoAutoCreate:`Neue Spulen werden bei der ersten Synchronisierung automatisch in Spoolman erstellt`,syncInfoThirdPartySkipped:`Nicht-Bambu-Lab-Spulen (Drittanbieter, nachgefüllt) werden übersprungen`,linkingExistingSpools:`Vorhandene Spulen verknüpfen`,linkingExistingSpoolsDesc:`Um vorhandene Spoolman-Spulen mit Ihrem AMS zu verknüpfen, fahren Sie über einen AMS-Slot und klicken Sie auf "Mit Spoolman verknüpfen".`,syncMode:`Synchronisierungsmodus`,syncModeAuto:`Automatisch`,syncModeManual:`Nur manuell`,syncModeAutoDesc:`AMS-Daten werden automatisch synchronisiert, wenn Änderungen erkannt werden`,syncModeManualDesc:`Nur bei manueller Auslösung synchronisieren`,syncAmsData:`AMS-Daten synchronisieren`,syncAmsDataDesc:`AMS-Daten des Druckers manuell mit Spoolman synchronisieren`,allPrinters:`Alle Drucker`,noDefaultPrinter:`Kein Standard (jedes Mal fragen)`,sidebarOrder:`Seitenleisten-Reihenfolge`,saveThumbnails:`Vorschaubilder speichern`,captureFinishPhoto:`Abschlussfoto aufnehmen`,noPrintersConfigured:`Keine Drucker konfiguriert`,archiveMode:{always:`Immer Archiveintrag erstellen`,never:`Nie Archiveintrag erstellen`,ask:`Jedes Mal fragen`},checkForUpdatesLabel:`Nach Updates suchen`,checkPrinterFirmware:`Drucker-Firmware prüfen`,includeBetaUpdates:`Beta-Versionen einschließen`,includeBetaUpdatesDesc:`Über Beta- und Vorabversionen bei der Updateprüfung benachrichtigen`,announcementsEnabled:`Ankündigungen empfangen`,announcementsEnabledDesc:`Nachrichten der Bambuddy-Entwickler, etwa zu Sicherheitskorrekturen und inkompatiblen Änderungen. Bambuddy lädt alle paar Stunden eine signierte Datei von GitHub; über diese Installation wird nichts gesendet.`,announcementsLearnMore:`Mehr dazu`,announcementsAllUsers:`Allen Benutzern anzeigen`,announcementsAllUsersDesc:`Aus: Nur Administratoren sehen sie. Ohne Wirkung, solange die Authentifizierung aus ist.`,localLogin:{disable:`Lokale Benutzername-/Passwort-Anmeldung deaktivieren`,disableHint:`Wenn aktiviert, ist nur die Anmeldung über SSO möglich. LDAP ist davon nicht betroffen. Setzen Sie BAMBUDDY_LOCAL_LOGIN=true auf dem Server, um einen Wiederherstellungsweg offen zu halten.`},enableRetry:`Wiederholung aktivieren`,homeAssistantDescription:`Smart Plugs über Home Assistant steuern`,environmentManagedLabel:`(Umgebungsvariable)`,autoEnabledViaEnv:`Automatisch über Umgebungsvariablen aktiviert`,urlFromEnvReadOnly:`Wert wird über HA_URL Umgebungsvariable gesetzt (schreibgeschützt)`,tokenFromEnvReadOnly:`Wert wird über HA_TOKEN Umgebungsvariable gesetzt (schreibgeschützt)`,mqttConnectedTo:`Verbunden mit`,prometheusDescription:`Druckerdaten im Prometheus-Format bereitstellen`,noSmartPlugsTitle:`Keine Smart Plugs konfiguriert`,noSmartPlugsDescription:`Fügen Sie einen Tasmota-basierten Smart Plug hinzu, um den Energieverbrauch zu verfolgen und die Stromsteuerung zu automatisieren.`,noProvidersTitle:`Keine Anbieter konfiguriert`,noProvidersDescription:`Fügen Sie einen Anbieter hinzu, um Benachrichtigungen zu erhalten.`,noTemplatesAvailable:`Keine Vorlagen verfügbar. Starten Sie das Backend neu, um Standardvorlagen zu laden.`,apiPermissionView:`Druckerstatus und Warteschlange anzeigen`,apiPermissionEdit:`Elemente zur Druckwarteschlange hinzufügen und entfernen`,apiKeysEmptyTitle:`Keine API-Schlüssel`,apiKeysEmptyDescription:`Erstellen Sie einen API-Schlüssel zur Integration mit externen Diensten.`,noUsersFound:`Keine Benutzer gefunden`,noGroupsFound:`Keine Gruppen gefunden`,noGroupsAvailable:`Keine Gruppen verfügbar`,passwordsDoNotMatch:`Passwörter stimmen nicht überein`,systemGroupWarning:`System-Gruppennamen können nicht geändert werden`,authDisabledTitle:`Authentifizierung ist deaktiviert`,authDisabledFeature1:`Anmeldung zum Zugriff auf das System erforderlich`,authDisabledFeature2:`Mehrere Benutzer mit gruppenbasierten Berechtigungen erstellen`,authDisabledFeature3:`Zugriff mit über 50 granularen Berechtigungen steuern`,userHasCreated:`Dieser Benutzer hat erstellt:`,userItemsQuestion:`Was möchten Sie mit diesen Elementen tun?`,deleteUserConfirm:`Möchten Sie diesen Benutzer wirklich löschen?`,actionCannotBeUndone:`Diese Aktion kann nicht rückgängig gemacht werden.`,addFirstSmartPlug:`Ersten Smart Plug hinzufügen`,providers:`Anbieter`,log:`Protokoll`,testAll:`Alle testen`,testResults:`Testergebnisse`,testPassedCount:`{{count}} bestanden`,testFailedCount:`{{count}} fehlgeschlagen`,messageTemplates:`Nachrichtenvorlagen`,messageTemplatesDescription:`Passen Sie Benachrichtigungen für jedes Ereignis an.`,apiKeys:`API-Schlüssel`,apiKeysDescription:`Erstellen Sie API-Schlüssel für externe Integrationen und Webhooks.`,createKey:`Schlüssel erstellen`,apiKeyCreated:`API-Schlüssel erfolgreich erstellt`,apiKeyCopyWarning:`Kopieren Sie diesen Schlüssel jetzt - er wird nicht mehr angezeigt!`,useInApiBrowser:`Im API-Browser verwenden`,apiKeyQrButton:`QR-Code`,apiKeyQrTitle:`Zum Einrichten scannen`,apiKeyQrCaption:`Mit deiner mobilen App scannen, um diesen Server und API-Schlüssel hinzuzufügen.`,apiKeyQrWarning:`Enthält deinen geheimen API-Schlüssel – nicht teilen oder dort abfotografieren, wo andere ihn sehen können.`,createNewApiKey:`Neuen API-Schlüssel erstellen`,keyName:`Schlüsselname`,keyNamePlaceholder:`z.B. Home Assistant, OctoPrint`,readStatus:`Status lesen`,readStatusDescription:`Druckerstatus, Warteschlange, Bibliothek, Archive und Slicer-Pipelines anzeigen`,manageQueue:`Warteschlange verwalten`,manageQueueDescription:`Elemente zur Druckwarteschlange hinzufügen und entfernen. Zusammen mit "Bibliothek verwalten" Slicer-Pipelines ausführen`,controlPrinter:`Drucker steuern`,controlPrinterDescription:`Drucke pausieren, fortsetzen und stoppen`,manageLibrary:`Bibliothek verwalten`,manageLibraryDescription:`Bibliotheksdateien hochladen, umbenennen, löschen und slicen; Modelle aus MakerWorld importieren. Zusammen mit "Warteschlange verwalten" Slicer-Pipelines ausführen`,manageInventory:`Bestand verwalten`,manageInventoryDescription:`Spulen und Bestandseinträge anlegen, ändern und löschen. Erforderlich für SpoolBuddy-Kioske (NFC-Scan, Waagenmessungen, Kiosk-Systembefehle).`,manageMaintenance:`Wartung verwalten`,manageMaintenanceDescription:`Abgeschlossene Wartungen protokollieren, Zähler zurücksetzen, Intervalle bearbeiten und den Wartungstyp-Katalog verwalten. Geeignet für Home-Assistant-Automatisierungen, die „Düse gereinigt" protokollieren, ohne umfassendere Druckersteuerung zu gewähren.`,manageArchives:`Archive verwalten`,manageArchivesDescription:`Druckarchive bearbeiten und löschen, einschließlich des Entfernens alter Drucke und ihres Statistikbeitrags. Geeignet für Automatisierungen, die den Druckverlauf ausdünnen.`,manageProjects:`Projekte verwalten`,manageProjectsDescription:`Projekte erstellen, aktualisieren und löschen sowie Archive zu ihnen hinzufügen. Geeignet für Automatisierungen, die Drucke in Projekten organisieren.`,maintenanceBadge:`Wartung`,archivesBadge:`Archive`,projectsBadge:`Projekte`,libraryBadge:`Bibliothek`,inventoryBadge:`Bestand`,cloudAccess:`Cloud-Zugriff erlauben`,cloudAccessDescription:`Liest Bambu-Cloud-Presets und -Filamente in Ihrem Namen. Erfordert eine Anmeldung in Bambu Cloud.`,cloudBadge:`Cloud`,updateEnergyCost:`Strompreis aktualisieren`,updateEnergyCostDescription:`Erlaubt diesem Schlüssel, einen neuen Strompreis pro kWh an /settings/electricity-price zu senden. Nützlich für Home-Assistant-Automatisierungen mit dynamischen Tarifen (Tibber, Octopus usw.). Dies ist das einzige Einstellungsfeld, das per API-Schlüssel schreibbar ist.`,energyCostBadge:`Energie`,sendNotifications:`Benachrichtigungen senden`,sendNotificationsDescription:`Erlaubt diesem Schlüssel, Nachrichten über die Benachrichtigungskanäle zu senden, die Nachrichten verbundener Apps annehmen (POST /notifications/app-message). Für Apps wie Bambuddy Orders. Sonst nichts: Der Schlüssel kann die Kanäle weder lesen noch ändern.`,sendNotificationsBadge:`Benachr.`,legacyKey:`Alt`,legacyKeyTooltip:`Wurde vor der nutzerbezogenen Eigentümerschaft erstellt; neu erstellen, um Cloud-Zugriff zu nutzen`,unnamedKey:`Unbenannter Schlüssel`,lastUsed:`Zuletzt verwendet`,read:`Lesen`,control:`Steuern`,createFirstKey:`Ersten Schlüssel erstellen`,webhookEndpoints:`Webhook-Endpunkte`,webhookApiKeyHint:`Verwenden Sie Ihren API-Schlüssel im X-API-Key-Header.`,webhook:{getAllStatus:`Alle Druckerstatus abrufen`,getSpecificStatus:`Spezifischen Druckerstatus abrufen`,addToQueue:`Zur Druckwarteschlange hinzufügen`,pausePrint:`Druck pausieren`,resumePrint:`Druck fortsetzen`,stopPrint:`Druck stoppen`},apiBrowser:`API-Browser`,apiBrowserDescription:`Erkunden und testen Sie alle verfügbaren API-Endpunkte.`,apiKeyForTesting:`API-Schlüssel zum Testen`,apiKeyPlaceholder:`Fügen Sie hier Ihren API-Schlüssel ein, um authentifizierte Endpunkte zu testen...`,apiKeyHint:`Dieser Schlüssel wird als X-API-Key-Header mit Anfragen gesendet.`,deleteApiKeyTitle:`API-Schlüssel löschen`,deleteApiKeyMessage:`Möchten Sie diesen API-Schlüssel wirklich löschen? Alle Integrationen, die diesen Schlüssel verwenden, funktionieren nicht mehr.`,deleteKey:`Schlüssel löschen`,amsDisplayThresholds:`AMS-Anzeigeschwellenwerte`,amsThresholdsDescription:`Konfigurieren Sie Farbschwellenwerte für AMS-Feuchtigkeits- und Temperaturanzeigen.`,humidity:`Luftfeuchtigkeit`,goodGreen:`Gut (grün)`,fairOrange:`Mittel (orange)`,aboveFairBad:`Über dem mittleren Schwellenwert wird rot angezeigt (schlecht)`,fairAlsoDryingThreshold:`Dieser Schwellenwert wird auch für die automatische Trocknung verwendet`,fairBelowDryingFloor:`Die automatische Trocknung kann diesen Wert nicht erreichen: Ein AMS meldet bei laufender Heizung {{floor}} % oder mehr, sodass jeder Zyklus enden und sofort neu starten würde. Setzen Sie ihn über {{floor}} %, wenn die automatische Trocknung aktiv ist.`,temperature:`Temperatur`,goodBlue:`Gut (blau)`,aboveFairHot:`Über dem mittleren Schwellenwert wird rot angezeigt (heiß)`,tempAlarmThreshold:`Alarm über`,tempAlarmSeparateFromBand:`Nur der Alarm-Schwellenwert löst Benachrichtigungen aus — Gut und Mittel färben nur die Anzeige. Leer lassen, um wie bisher beim mittleren Schwellenwert zu alarmieren.`,tempAlarmMustBePositive:`Ein Schwellenwert von 0 oder weniger wird ignoriert — der Alarm nutzt dann den mittleren Schwellenwert.`,historyRetention:`Verlaufsaufbewahrung`,keepSensorHistory:`Sensorverlauf behalten für`,historyRetentionDescription:`Ältere Feuchtigkeits- und Temperaturdaten werden automatisch gelöscht`,defaultPrintOptions:`Standard-Druckoptionen`,defaultPrintOptionsDescription:`Standardwerte für Druckoptionen bei neuen Drucken festlegen. Diese können im Druckdialog pro Druck überschrieben werden.`,defaultBedLevelling:`Bett-Nivellierung`,defaultBedLevellingDesc:`Bett vor dem Druck automatisch nivellieren`,defaultFlowCali:`Fluss-Kalibrierung`,defaultFlowCaliDesc:`Extrusionsfluss kalibrieren`,defaultVibrationCali:`Vibrationskalibrierung`,defaultVibrationCaliDesc:`Ringing-Artefakte reduzieren`,defaultLayerInspect:`Erste-Schicht-Inspektion`,defaultLayerInspectDesc:`KI-Inspektion der ersten Schicht`,defaultTimelapse:`Zeitraffer`,defaultTimelapseDesc:`Zeitraffervideo aufnehmen`,defaultConfirmOutcome:`Nach Ergebnis fragen`,defaultConfirmOutcomeDesc:`Nach Abschluss fragen, ob der Druck gut geworden ist`,confirmOutcomeExternalPrints:`Auch bei Drucken fragen, die nicht über Bambuddy gestartet wurden`,confirmOutcomeExternalPrintsDesc:`Drucke, die am Drucker, in Bambu Studio oder in der Handy-App gestartet wurden, landen ebenfalls im Archiv. Mit dieser Option bekommen sie dieselbe Ergebnisabfrage wie Aufträge aus der Warteschlange.`,confirmDefaultGoodOnPlateClear:`Unbeantwortete Ergebnisse bei Druckplatten-Freigabe als gut zählen`,confirmDefaultGoodOnPlateClearDescription:`Wenn die Druckplatte freigegeben wird (manuell oder durch den nächsten geplanten Druck) und die Ergebnisabfrage des Drucks noch unbeantwortet ist, wird er automatisch als Gutteil erfasst. Der Druck gilt dann als gut, sobald die Druckplatte freigegeben wird; eine Telegram- oder Link-Antwort danach zeigt nur noch das gespeicherte Ergebnis.`,defaultNozzleOffsetCali:`Düsenversatz-Kalibrierung`,defaultNozzleOffsetCaliDesc:`Düsenversatz zwischen Extrudern kalibrieren`,tempFanPresetsTitle:`Temperatur- und Lüfter-Vorgaben`,tempFanPresetsDescription:`Passen Sie die Schnellwahlwerte in den Temperatur- und Lüfter-Popovers der Druckerkarte an. Die Aus-Schaltfläche wird immer angezeigt.`,tempFanPresetsNozzle:`Düsentemperatur`,tempFanPresetsBed:`Betttemperatur`,tempFanPresetsChamber:`Kammertemperatur`,tempFanPresetsFan:`Lüftergeschwindigkeit`,tempFanPresetsReset:`Auf Standardwerte zurücksetzen`,concurrentUploadsTitle:`Gleichzeitige Uploads`,concurrentUploadsDescription:`Wie viele Drucker die Warteschlange gleichzeitig mit Dateien versorgen darf. Drucker nehmen Dateien nur langsam entgegen (ein großer Druck kann mehrere Minuten dauern), und jeder wartet, bis er an der Reihe ist — bei größeren Farmen verhindert ein höherer Wert also, dass der letzte Drucker eines Stapels erst alle anderen Übertragungen abwarten muss. Verringern Sie ihn, wenn Ihr Netzwerk oder der Bambuddy-Host mit parallelen Übertragungen Probleme hat.`,concurrentUploadsLabel:`Gleichzeitig belieferte Drucker`,concurrentUploadsHelp:`1 beliefert immer nur einen Drucker (das bisherige Verhalten). Standard ist 4.`,staggeredStart:`Versetzter Start`,staggeredStartDescription:`Standard-Gruppengröße und -Intervall beim Staffeln von Mehrdrucker-Batchstarts. Pro Batch im Druck-Dialog überschreibbar.`,preheatTitle:`Vorheizen & Heat Soak`,preheatDescription:`Heizt das Bett (und die Kammer, sofern unterstützt) auf und hält die Temperatur, bevor jeder Druck aus der Warteschlange startet. Hilfreich für technische Filamente (PA, ABS) auf Druckern ohne aktive Kammerheizung — das Bett wärmt die Kammer per Abstrahlung, während der Soak-Timer läuft. Die Bett-Zieltemperatur wird aus der Druckdatei gelesen; das Kammerverhalten hängt vom Druckermodell ab.`,preheatEnabled:`Vorheizen & Soak aktivieren`,preheatEnabledDesc:`Wenn aus, starten Drucke aus der Warteschlange sofort. Jeder Warteschlangeneintrag kann das pro Druck überschreiben.`,preheatFilamentTargetsLabel:`Kammer-Ziel je Filament (°C)`,preheatFilamentTargetsHint:`Bambuddy wählt das höchste Ziel über die geladenen AMS-Slots. Ein Druck, dessen Slots alle 0 ergeben – PLA, PETG, TPU, PVA –, überspringt das Vorheizen vollständig und startet sofort.`,preheatFilamentTargetsReset:`Auf Standardwerte zurücksetzen`,preheatFilamentTargetsDefaultRow:`Sonstige / nicht zugeordnet`,preheatMaxWait:`Max. Wartezeit (Sekunden)`,preheatMaxWaitHelp:`Obergrenze für die Aufwärmphase, bevor in den Soak gewechselt wird.`,preheatSoak:`Soak (Sekunden)`,preheatSoakHelp:`Haltezeit nach Erreichen des Ziels oder nach Ablauf der Max-Wartezeit.`,preheatHardwareTitle:`Verhalten je Drucker:`,preheatHardwareDetail:`H2C/H2D/H2D Pro/H2S/X2D/X1E heizen die Kammer aktiv per M141. X1C/P2S lesen die Kammertemperatur, heizen sie aber nur per Bett-Abstrahlung. P1S/P1P/A1/A1 Mini haben keinen Kammersensor — nur der Soak-Timer greift.`,preheatPerItemDesc:`Bett und Kammer vor diesem Druck aufheizen. Standardmäßig wird der globale Umschalter aus Einstellungen → Workflow verwendet.`,preheatOverride_inherit:`Übernehmen`,preheatOverride_on:`An`,preheatOverride_off:`Aus`,calibrationMode_off:`Aus`,calibrationMode_on:`An`,calibrationMode_auto:`Auto`,preheatTargetOverride:`Kammer-Ziel überschreiben (°C, leer = Filament-Standard)`,preheatTargetOverrideHelp:`0 heizt das Bett und führt das Halten ohne Kammer aus. Bleibt das Feld leer, überspringt ein Druck ohne Kammerbedarf das Vorheizen vollständig.`,plateClear:`Druckplatte-Bestätigung`,requirePlateClear:`Druckplatte-Bestätigung erforderlich`,requirePlateClearDescription:`Wenn aktiviert, wartet der Scheduler auf eine Druckplatten-Bestätigung pro Drucker, bevor geplante Drucke auf Druckern mit abgeschlossenen Aufträgen gestartet werden. Wenn dies deaktiviert ist, werden auch das Druckplatten-Status-Badge und die Schaltfläche "Druckplatte als freigegeben markieren" auf den Druckerkarten ausgeblendet.`,keepBedWarm:`Heizbett zwischen Drucken warmhalten`,keepBedWarmDesc:`Während auf die Druckplatten-Bestätigung gewartet wird, wird das Heizbett auf der unten eingestellten Warmhalte-Temperatur gehalten, damit die Kammer warm bleibt — oder auf der Betttemperatur des nächsten Drucks, falls diese höher ist. Gilt nur, wenn der nächste Druck Kammerwärme benötigt (ASA, ABS, PA, PC usw.). Erfordert aktivierte Druckplatten-Bestätigung.`,keepWarmBedTemp:`Warmhalte-Temperatur des Heizbetts (°C)`,keepWarmBedTempHelp:`Wird verwendet, wenn das Bett die Kammer heizen soll — beim Warmhalten und beim Vorheizen, wenn die Druckdatei keine Betttemperatur enthält. Eine höhere Betttemperatur aus der Druckdatei hat immer Vorrang.`,keepWarmMaxMinutes:`Warmhalten beenden nach (Minuten)`,keepWarmMaxMinutesHelp:`Wird die Druckplatte nicht innerhalb dieser Zeit geleert, werden die Heizungen abgeschaltet statt dauerhaft zu heizen.`,gcodeInjection:`G-Code-Injektion`,gcodeInjectionDescription:`Konfigurieren Sie benutzerdefinierten G-code, der am Anfang und/oder Ende von Drucken für Auto-Print-Systeme wie Farmloop, SwapMod, AutoClear und Printflow 3D eingefügt wird. Snippets werden pro Druckermodell konfiguriert und angewendet, wenn "G-code einfügen" bei einem Warteschlangen-Element aktiviert ist.`,gcodeInjectionNoPrinters:`Keine Drucker gefunden. Fügen Sie Drucker hinzu, um G-code-Snippets zu konfigurieren.`,gcodeStartLabel:`Start-G-Code`,gcodeEndLabel:`End-G-Code`,gcodeStartPlaceholder:`G-code, der vor dem Druckstart eingefügt wird...`,gcodeEndPlaceholder:`G-code, der nach dem Druckende angefügt wird...`,staggerGroupSize:`Gruppengröße`,staggerGroupSizeHelp:`Anzahl gleichzeitig zu startender Drucker pro Gruppe`,staggerInterval:`Intervall (Minuten)`,staggerIntervalHelp:`Verzögerung zwischen Gruppenstart`,queueDrying:`Automatische Trocknung`,queueDryingDescription:`AMS-Filament automatisch trocknen, wenn der Drucker zwischen Warteschlangen-Drucken im Leerlauf ist. Verwendet den Feuchtigkeitsschwellenwert oben.`,queueDryingEnabled:`Automatische Trocknung aktivieren`,queueDryingEnabledDescription:`AMS-Trocknung automatisch starten, wenn der Drucker im Leerlauf ist und die Feuchtigkeit über dem Schwellenwert liegt`,queueDryingBlock:`Auf Trocknung warten`,queueDryingBlockDescription:`Druckwarteschlange blockieren, bis die Trocknung abgeschlossen ist. Wenn aus, haben Drucke Vorrang.`,ambientDryingEnabled:`Umgebungstrocknung`,ambientDryingEnabledDescription:`Filament auf inaktiven Druckern automatisch trocknen, wenn die Luftfeuchtigkeit den Schwellenwert überschreitet — auch ohne Warteschlange.`,ambientDryingSustainedEnabled:`Anhaltende Luftfeuchtigkeit erforderlich`,ambientDryingSustainedDescription:`Warten, bis die Luftfeuchtigkeit für eine festgelegte Zeit über dem Schwellenwert geblieben ist, bevor eine Umgebungstrocknung startet — überbrückt den Anstieg durch das Öffnen des AMS-Deckels.`,ambientDryingSustainedMinutes:`Wartezeit (Minuten)`,printDryingEnabled:`Trocknen während des Drucks`,printDryingEnabledDescription:`Automatische Trocknung auch während eines laufenden Drucks auf unterstützter Hardware (H2D, H2C, H2S, P2S, H2D Pro, X2D, X1C, A2L mit aktueller Firmware). Die Trocknungstemperatur wird zum Schutz der Spulen automatisch um 5°C unter dem Leerlaufwert begrenzt.`,dryingPresets:`Trocknungsvoreinstellungen`,dryingPresetsDescription:`Temperatur und Dauer pro Filamenttyp. AMS 2 Pro verwendet niedrigere Temperaturen, AMS-HT unterstützt höhere.`,dryingFilament:`Filament`,humidityThresholds:`Feuchtigkeitsschwellen`,humidityThresholdsDescription:`Feuchtigkeitsauslöser pro Filamenttyp für Auto-Trocknung und Alarme. Bei gemischter Bestückung gilt der niedrigste Wert.`,humidityThresholdCol:`Schwellenwert`,humidityThresholdDefault:`Standard (unbekannte Typen)`,printModal:`Druckdialog`,expandCustomMapping:`Benutzerdefinierte Zuordnung standardmäßig erweitern`,expandCustomMappingDescription:`Bei Druck auf mehrere Drucker die AMS-Zuordnung pro Drucker erweitert anzeigen`,authentication:`Authentifizierung`,authEnabledDescription:`Ihre Instanz ist mit Benutzerauthentifizierung gesichert`,authDisabledDescription:`Aktivieren Sie die Anmeldepflicht und verwalten Sie den Benutzerzugriff`,authDisabledMessage:`Aktivieren Sie die Authentifizierung, um Benutzerkonten zu erstellen, Berechtigungen zu verwalten und Ihre Bambuddy-Instanz zu sichern.`,enableAuthentication:`Authentifizierung aktivieren`,currentUser:`Aktueller Benutzer`,changePassword:`Passwort ändern`,admin:`Admin`,users:`Benutzer`,addUser:`Benutzer hinzufügen`,groups:`Gruppen`,addGroup:`Gruppe hinzufügen`,system:`System`,noDescription:`Keine Beschreibung`,userCount:`{{count}} Benutzer`,permissionCount:`{{count}} Berechtigungen`,createUser:`Benutzer erstellen`,username:`Benutzername`,enterUsername:`Benutzername eingeben`,password:`Passwort`,enterPassword:`Passwort eingeben`,passwordRequirements:`Mindestens 8 Zeichen, davon ein Großbuchstabe, ein Kleinbuchstabe, eine Ziffer und ein Sonderzeichen.`,confirmPassword:`Passwort bestätigen`,confirmPasswordPlaceholder:`Passwort bestätigen`,viewReleaseOnGitHub:`Release auf GitHub anzeigen`,turnAllPlugsOn:`Alle Stecker einschalten`,turnAllPlugsOff:`Alle Stecker ausschalten`,clearNotificationLogs:`Benachrichtigungsprotokolle löschen`,clearLogsMessage:`Dadurch werden alle Benachrichtigungsprotokolle, die älter als 30 Tage sind, dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.`,clearLogs:`Protokolle löschen`,resetUiPreferences:`UI-Einstellungen zurücksetzen`,resetUiPreferencesMessage:`Dadurch werden alle UI-Einstellungen auf Standardwerte zurückgesetzt: Seitenleisten-Reihenfolge, Theme, Dashboard-Layout, Ansichtsmodi und Sortiereinstellungen. Ihre Drucker, Archive und Servereinstellungen werden NICHT beeinträchtigt. Die Seite wird nach dem Löschen neu geladen.`,resetPreferences:`Einstellungen zurücksetzen`,deleteGroupTitle:`Gruppe löschen`,deleteGroupMessage:`Möchten Sie diese Gruppe wirklich löschen? Benutzer in dieser Gruppe verlieren diese Berechtigungen.`,deleteGroup:`Gruppe löschen`,disableAuthenticationTitle:`Authentifizierung deaktivieren`,disableAuthenticationMessage:`Möchten Sie die Authentifizierung wirklich deaktivieren? Dadurch wird Ihre Bambuddy-Instanz ohne Anmeldung zugänglich. Alle Benutzer bleiben in der Datenbank, aber die Authentifizierung wird deaktiviert.`,disableAuthentication:`Authentifizierung deaktivieren`,configureBambuddy:`Bambuddy konfigurieren`,systemDefault:`Systemstandard`,archiveSettings:`Archiv-Einstellungen`,newWindow:`Neues Fenster`,embeddedOverlay:`Eingebettetes Overlay`,preferredSlicer:`Bevorzugter Slicer`,preferredSlicerDescription:`Slicer für das In-App-Slicen über das API-Sidecar`,openInSlicerLabel:`Im Slicer öffnen`,openInSlicerInherit:`Wie API-Slicer`,openInSlicerDescription:`Desktop-Slicer, der vom „Im Slicer öffnen"-Button verwendet wird. Auf „Wie API-Slicer" belassen, um zu erben, oder einen anderen Slicer für die lokale Nutzung wählen.`,orcaslicerKnownIssuesWarning:`OrcaSlicer 2.3.2 / 2.4.0-dev haben bekannte CLI-Bugs, die das Slicen vieler von BambuStudio erstellter 3MF-Dateien blockieren — siehe Upstream-Issues #12426 (Segfault bei bemalten Multi-Extruder-Dateien) und #13386 (zu strikte Parameter-Range-Validierung). Bis die Upstream-Fixes verfügbar sind, wird Bambu Studio empfohlen.`,useSlicerApi:`Slicer-API verwenden`,useSlicerApiDescription:`Wenn aktiv, öffnen "Slice"-Aktionen das in-App Slicer-Modal und rufen den Slicer-API-Sidecar. Aus (Standard): Übergabe an den Desktop-Slicer per URI-Schema.`,slicerCard:`Slicer`,orcaslicerApiUrl:`OrcaSlicer Sidecar-URL`,bambuStudioApiUrl:`Bambu Studio Sidecar-URL`,slicerStallTimeout:`Zeitlimit bei Slicer-Stillstand (Minuten)`,slicerStallTimeoutDescription:`Bricht einen Slice-Vorgang ab, wenn der Sidecar so lange keinen Fortschritt meldet. Aufwendige Modelle, die weiter Fortschritt melden, werden nie abgebrochen, egal wie lange sie brauchen. Sidecars ohne Fortschrittsmeldung nutzen diesen Wert stattdessen als Gesamtzeitlimit.`,slicerApiUrlDescription:`URL des Slicer-API-Sidecar-Containers. Leer lassen, um die SLICER_API_URL- bzw. BAMBU_STUDIO_API_URL-Umgebungsvariablen zu nutzen.`,externalCameras:`Externe Kameras`,costTracking:`Kostenverfolgung`,billingEnabled:`Abrechnung aktivieren`,billingEnabledDescription:`Kostenstellen aktivieren und Drucke verbuchen`,printerKillSwitch:`Automatischer Druckstopp`,printerKillSwitchDescription:`Drucke ohne Authorisierung sofort abbrechen`,financeBudgetReset:`Finanzbudget monatlich zurücksetzen`,financeBudgetResetDay:`Reset-Tag`,financeBudgetResetDayHelp:`Für kurze Monate verwendet der Reset den letzten Tag des Monats.`,financeBudgetResetTimezone:`Reset-Zeitzone`,financeBudgetResetTimezoneHelp:`Der Budget-Fenster-Start wird in dieser Zeitzone berechnet.`,rebuildLedger:`Ledger wiederaufbauen`,rebuildLedgerStarted:`Ledger-Wiederaufbau gestartet`,rebuildLedgerConfirmTitle:`Ledger wiederaufbauen?`,rebuildLedgerConfirmMessage:`Dies baut das Wallet-Ledger neu auf, um historische Saldenwerte zu reparieren. Führen Sie dies nur aus, wenn Sie genau wissen, was Sie tun.`,rebuildLedgerInProgress:`Wiederaufbau wird gestartet...`,printsOnly:`Nur Drucke`,totalConsumption:`Gesamtverbrauch`,dataManagement:`Datenverwaltung`,storageUsage:`Speichernutzung`,storageUsageDescription:`Aufschlüsselung der Datennutzung nach Kategorie`,storageUsageTotal:`Gesamt`,storageUsageErrors:`Fehler`,storageUsageOtherBreakdown:`Sonstiges (enthält statische Assets, Skripte und Konfigurationsdateien)`,storageUsageSystem:`System`,storageUsageData:`Daten`,storageUsageUnavailable:`Speichernutzungsinformationen nicht verfügbar`,clearNotificationLogsDescription:`Benachrichtigungsprotokolle älter als 30 Tage löschen`,resetUiPreferencesDescription:`Seitenleisten-Reihenfolge, Theme, Ansichtsmodi und Layout-Einstellungen zurücksetzen. Drucker, Archive und Einstellungen werden nicht beeinflusst.`,enableHomeAssistant:`Home Assistant aktivieren`,enableMqtt:`MQTT aktivieren`,useTls:`TLS verwenden`,enableMetricsEndpoint:`Metrik-Endpunkt aktivieren`,availableMetrics:`Verfügbare Metriken`,editUser:`Benutzer bearbeiten`,deleteUserTitle:`Benutzer löschen`,groupName:`Gruppenname`,leaveEmptyForAnonymous:`Leer lassen für anonym`,leaveEmptyForNoAuth:`Leer lassen für keine Authentifizierung`,enterNewPassword:`Neues Passwort eingeben`,confirmNewPassword:`Neues Passwort bestätigen`,enterGroupName:`Gruppenname eingeben`,enterDescriptionOptional:`Beschreibung eingeben (optional)`,enterCurrentPassword:`Aktuelles Passwort eingeben`,enterNewPasswordMin6:`Neues Passwort eingeben (min. 6 Zeichen)`,toast:{keyCopied:`Schlüssel in Zwischenablage kopiert`,copyFailed:`Schlüssel konnte nicht kopiert werden`,keyAddedToBrowser:`Schlüssel zum API-Browser hinzugefügt`,clearLogsFailed:`Protokolle konnten nicht gelöscht werden`,uiPreferencesReset:`UI-Einstellungen zurückgesetzt. Wird neu geladen...`,authDisabled:`Authentifizierung erfolgreich deaktiviert`,authDisableFailed:`Authentifizierung konnte nicht deaktiviert werden`,apiKeyCreated:`API-Schlüssel erstellt`,apiKeyDeleted:`API-Schlüssel gelöscht`,userCreated:`Benutzer erfolgreich erstellt`,userUpdated:`Benutzer erfolgreich aktualisiert`,userDeleted:`Benutzer erfolgreich gelöscht`,groupCreated:`Gruppe erfolgreich erstellt`,groupUpdated:`Gruppe erfolgreich aktualisiert`,groupDeleted:`Gruppe erfolgreich gelöscht`,fillRequiredFields:`Bitte füllen Sie alle erforderlichen Felder aus`,passwordsDoNotMatch:`Passwörter stimmen nicht überein`,passwordTooShort:`Passwort muss mindestens 8 Zeichen lang sein`,passwordNeedsUppercase:`Passwort muss mindestens einen Großbuchstaben enthalten`,passwordNeedsLowercase:`Passwort muss mindestens einen Kleinbuchstaben enthalten`,passwordNeedsDigit:`Passwort muss mindestens eine Ziffer enthalten`,passwordNeedsSpecial:`Passwort muss mindestens ein Sonderzeichen enthalten`,enterGroupName:`Bitte geben Sie einen Gruppennamen ein`,settingsSaved:`Einstellungen gespeichert`,noPermissionUpdate:`Sie haben keine Berechtigung, Einstellungen zu ändern`,cameraSettingsSaved:`Kamera-Einstellungen gespeichert`,enterCameraUrl:`Bitte geben Sie eine Kamera-URL ein`,passwordChanged:`Passwort erfolgreich geändert`,connectionFailed:`Verbindung fehlgeschlagen`,testFailed:`Test fehlgeschlagen`,cameraConnected:`Kamera verbunden{{resolution}}`,cameraConnectedCoalesced:`Kamera verbunden{{resolution}} (geteilt mit einer bereits laufenden Aufnahme)`},testConnection:`Verbindung testen`,catalog:{spoolCatalog:`Spulenkatalog`,spoolCatalogDescription:`Leerspulengewichte nach Marke/Typ. Wird für die automatische Gewichtssuche beim Hinzufügen von Spulen verwendet.`,searchCatalog:`Katalog durchsuchen...`,addNewEntry:`Neuen Eintrag hinzufügen`,namePlaceholder:`Name (z.B. Bambu Lab - Plastik)`,weight:`Gewicht`,type:`Typ`,default:`Standard`,custom:`Benutzerdefiniert`,noMatch:`Keine Einträge entsprechen Ihrer Suche`,empty:`Keine Einträge im Katalog`,deleteEntry:`Eintrag löschen`,deleteConfirm:`Möchten Sie "{{name}}" wirklich löschen?`,resetCatalog:`Katalog zurücksetzen`,resetConfirm:`Katalog auf Standardwerte zurücksetzen? Alle benutzerdefinierten Einträge werden entfernt.`,loadFailed:`Spulenkatalog konnte nicht geladen werden`,nameWeightRequired:`Name und Gewicht sind erforderlich`,entryAdded:`Eintrag hinzugefügt`,addFailed:`Eintrag konnte nicht hinzugefügt werden`,entryUpdated:`Eintrag aktualisiert`,updateFailed:`Eintrag konnte nicht aktualisiert werden`,entryDeleted:`Eintrag gelöscht`,deleteFailed:`Eintrag konnte nicht gelöscht werden`,resetSuccess:`Katalog auf Standardwerte zurückgesetzt`,resetFailed:`Katalog konnte nicht zurückgesetzt werden`,exported:`{{count}} Einträge exportiert`,imported:`{{added}} Einträge importiert ({{skipped}} übersprungen)`,importFailed:`Import fehlgeschlagen: ungültiges JSON-Format`,exportTooltip:`Katalog als JSON exportieren`,importTooltip:`Katalog aus JSON importieren`,resetTooltip:`Auf Standardwerte zurücksetzen`,selectedCount:`{{count}} ausgewählt`,deleteSelected:`Ausgewählte löschen`,bulkDeleteConfirm:`Möchten Sie {{count}} Einträge wirklich löschen?`,bulkDeleted:`{{count}} Einträge gelöscht`,bulkDeleteFailed:`Fehler beim Löschen der Einträge`,material:`Material`,spoolWeight:`Spulengewicht`,color:`Farbe`,updateSpoolWeight:`Spulengewicht aktualisieren`,filamentUpdated:`Filament aktualisiert`,filamentUpdateFailed:`Filament konnte nicht aktualisiert werden`,filamentUpdateInvalid:`Ungültige Filamentdaten`,keepExistingSpoolWeight:`Altes Gewicht für bestehende Spulen behalten`,keepExistingSpoolWeightDesc:`Bereits erstellte Spulen dieses Filamenttyps behalten das alte Leergewicht. Neue Spulen nutzen den neuen Wert.`,applyToAllSpools:`Auf alle Spulen anwenden`,applyToAllSpoolsDesc:`Alle Gewichtsberechnungen für diesen Filamenttyp nutzen sofort das neue Leergewicht.`},colorCatalog:{title:`Farbkatalog`,description:`Filamentfarben nach Hersteller/Material. Wird für die automatische Farbsuche beim Hinzufügen von Spulen verwendet.`,searchColors:`Farben durchsuchen...`,allManufacturers:`Alle Hersteller`,addNewColor:`Neue Farbe hinzufügen`,manufacturer:`Hersteller`,colorName:`Farbname`,hex:`Hex`,materialOptional:`Material (optional)`,showing:`{{filtered}} von {{total}} Farben angezeigt`,noMatch:`Keine Farben entsprechen Ihrer Suche`,empty:`Keine Farben im Katalog`,deleteColor:`Farbe löschen`,deleteConfirm:`Möchten Sie "{{name}}" wirklich löschen?`,resetCatalog:`Farbkatalog zurücksetzen`,resetConfirm:`Katalog auf Standardwerte zurücksetzen? Alle benutzerdefinierten Farben werden entfernt.`,sync:`Synchron.`,starting:`Starten...`,syncTooltip:`Von FilamentColors.xyz synchronisieren (2000+ Farben)`,loadFailed:`Farbkatalog konnte nicht geladen werden`,fieldsRequired:`Hersteller, Farbname und Hex-Farbe sind erforderlich`,colorAdded:`Farbe hinzugefügt`,addFailed:`Farbe konnte nicht hinzugefügt werden`,colorUpdated:`Farbe aktualisiert`,updateFailed:`Farbe konnte nicht aktualisiert werden`,colorDeleted:`Farbe gelöscht`,deleteFailed:`Farbe konnte nicht gelöscht werden`,resetSuccess:`Farbkatalog auf Standardwerte zurückgesetzt`,resetFailed:`Katalog konnte nicht zurückgesetzt werden`,syncUpToDate:`Bereits aktuell ({{count}} Farben geprüft)`,syncComplete:`{{added}} neue Farben hinzugefügt ({{skipped}} bereits vorhanden)`,syncError:`Sync-Fehler`,syncFailed:`Synchronisierung von FilamentColors.xyz fehlgeschlagen`,exported:`{{count}} Farben exportiert`,imported:`{{added}} Farben importiert ({{skipped}} übersprungen)`,importFailed:`Import fehlgeschlagen: ungültiges JSON-Format`,selectedCount:`{{count}} ausgewählt`,deleteSelected:`Ausgewählte löschen`,bulkDeleteConfirm:`Möchten Sie {{count}} Farben wirklich löschen?`,bulkDeleted:`{{count}} Farben gelöscht`,bulkDeleteFailed:`Fehler beim Löschen der Farben`},dateFormat:`Datumsformat`,dateFormatUs:`US (MM/TT/JJJJ)`,dateFormatEu:`EU (TT/MM/JJJJ)`,dateFormatIso:`ISO (JJJJ-MM-TT)`,timeFormat:`Zeitformat`,timeFormat12:`12-Stunden (3:30 PM)`,timeFormat24:`24-Stunden (15:30)`,defaultPrinter:`Standarddrucker`,defaultPrinterDescription:`Diesen Drucker für Uploads, Nachdrucke und andere Vorgänge vorauswählen.`,slicerBambuStudio:`Bambu Studio`,slicerOrcaSlicer:`OrcaSlicer`,sidebarOrderDescription:`Nutze das Seitenleisten-Layout, um Elemente neu anzuordnen, Sichtbarkeit zurückzusetzen und benutzerdefinierte Links zu verwalten.`,setDefault:`Standard setzen`,sidebarOrderSetDefaultHint:`Standard setzen übernimmt die aktuelle Menüreihenfolge für Benutzer, die ihre noch nicht angepasst haben.`,sidebarDefaultSet:`Standard-Menüreihenfolge wurde festgelegt.`,sidebarDefaultCleared:`Standard-Menüreihenfolge gelöscht.`,sidebarDefaultFailed:`Festlegen der Standard-Menüreihenfolge fehlgeschlagen.`,reset:`Zurücksetzen`,darkMode:`Dunkelmodus`,lightMode:`Hellmodus`,active:`(aktiv)`,background:`Hintergrund`,accent:`Akzent`,style:`Stil`,bgNeutral:`Neutral`,bgWarm:`Warm`,bgCool:`Kühl`,bgOled:`OLED Schwarz`,bgSlate:`Schieferblau`,bgForest:`Waldgrün`,accentGreen:`Grün`,accentTeal:`Türkis`,accentBlue:`Blau`,accentOrange:`Orange`,accentPurple:`Lila`,accentRed:`Rot`,styleClassic:`Klassisch`,styleGlow:`Leuchtend`,styleVibrant:`Lebendig`,themeToggleHint:`Zwischen Dunkel-, Hell- und Systemmodus mit dem Symbol in der Seitenleiste wechseln.`,progressInTitle:`Druckfortschritt im Tab`,progressInTitleDescription:`Zeigt den Prozentsatz des aktiven Drucks und einen Fortschrittsring im Browser-Tab an.`,autoArchivePrints:`Drucke automatisch archivieren`,autoArchiveDescription:`3MF-Dateien automatisch speichern, wenn Drucke abgeschlossen sind`,saveThumbnailsDescription:`Vorschaubilder aus 3MF-Dateien extrahieren und speichern`,captureFinishPhotoDescription:`Foto von der Druckerkamera aufnehmen, wenn der Druck abgeschlossen ist. Bambuddy zeichnet während des Drucks einen kurzen Zeitraffer auf, damit das Foto aus dem Moment vor dem Absenken der Druckplatte stammen kann. Die Zeitraffer-Datei bleibt erhalten, wenn du den Zeitraffer für diesen Druck aktiviert hast, andernfalls wird sie nach Aufnahme des Fotos automatisch gelöscht.`,finishPhotoRestorePlate:`Druckplatte für Abschlussfoto anheben`,finishPhotoRestorePlateDescription:`Der Drucker senkt die Druckplatte am Druckende um etwa 100 mm ab, wodurch der fertige Druck unterhalb des Kamerabildausschnitts liegt. Bambuddy hebt sie wieder bis knapp über die zuletzt gedruckte Schicht an, nimmt das Foto auf und senkt sie danach wieder ab. Wird übersprungen, wenn die Druckhöhe unbekannt ist oder ein weiterer Auftrag in der Warteschlange steht.`,ffmpegNotInstalled:`ffmpeg nicht installiert`,ffmpegRequired:`Kameraaufnahme benötigt ffmpeg. Installieren über brew install ffmpeg (macOS) oder apt install ffmpeg (Linux).`,camera:`Kamera`,cameraViewMode:`Kamera-Ansichtsmodus`,cameraOverlayDescription:`Kamera öffnet sich als größenveränderbares Overlay auf dem Hauptbildschirm`,cameraWindowDescription:`Kamera öffnet sich in einem separaten Browserfenster`,externalCamerasDescription:`Externe Kameras konfigurieren, um die eingebaute Druckerkamera zu ersetzen. Unterstützt MJPEG-Streams, RTSP, HTTP-Snapshots und USB-Kameras (V4L2). Wenn aktiviert, wird die externe Kamera für Live-Ansicht und Abschlussfotos verwendet.`,cameraPlaceholderUsb:`Gerätepfad (/dev/video0)`,cameraPlaceholderUrl:`Kamera-URL (rtsp://... oder http://...)`,cameraTypeMjpeg:`MJPEG-Stream`,cameraTypeRtsp:`RTSP-Stream`,cameraTypeSnapshot:`HTTP-Snapshot`,cameraTypeUsb:`USB-Kamera (V4L2)`,cameraSnapshotUrl:`Snapshot-URL (optional)`,cameraSnapshotUrlPlaceholder:`http://192.168.1.61:1984/api/frame.jpeg?src=printer`,cameraSnapshotUrlHelp:`URL für Einzelbildaufnahmen — wird für Benachrichtigungs-Vorschaubilder, Abschlussfotos, Schicht-Zeitraffer und Plattenerkennung verwendet. Zeitraffer und Plattenerkennung benötigen jeweils eigene drucker-spezifische Schalter — diese URL ist nur die Bildquelle, die sie verwenden, wenn sie aktiv sind. Leer lassen, um Bilder aus dem oben konfigurierten Live-Stream zu verwenden. Nützlich für go2rtc (/api/frame.jpeg) und IP-Kameras mit dediziertem Snapshot-Endpunkt.`,cameraRotation:`Drehung`,cameraLight:`Kammerbeleuchtung für die Kamera einschalten`,cameraLightHint:`Schaltet das Licht ein, solange jemand die Kamera ansieht, und für automatische Aufnahmen wie Fotos in Benachrichtigungen, Abschlussfotos und Bilder für Home Assistant. Schaltet es danach wieder aus, aber nur, wenn Bambuddy es eingeschaltet hat.`,cameraLightDelay:`Wartezeit vor der Aufnahme`,cameraLightDelayHint:`Nur wenn das Licht aus war. Gibt dem Licht und damit gekoppelten Lampen Zeit zum Angehen.`,cameraLightMode_off:`Aus`,cameraLightMode_all:`Alle Drucker`,cameraLightMode_selected:`Ausgewählte Drucker`,cameraLightDelayUnit:`Sekunden`,cameraLightNoneSelected:`Noch kein Drucker ausgewählt.`,cameraLightAddPrinter:`Drucker hinzufügen`,cameraLightRemovePrinter:`{{name}} entfernen`,externalCameraAdd:`Externe Kamera hinzufügen`,externalCameraRemove:`Externe Kamera von {{name}} entfernen`,printerPickerSearch:`Drucker suchen`,printerPickerNoMatch:`Kein Drucker gefunden.`,cameraShowSettings:`Kamera-Einstellungen`,test:`Testen`,connected:`Verbunden`,disconnected:`Getrennt`,currency:`Währung`,defaultFilamentCost:`Standard-Filamentkosten (pro kg)`,electricityCost:`Stromkosten pro kWh`,energyPriceSource:`Quelle des Strompreises`,energyPriceSourceFixed:`Fester Preis`,energyPriceSourceHomeAssistant:`Home-Assistant-Sensor`,energyPriceHaEntity:`Preissensor`,energyPriceLastRead:`Zuletzt gelesener Preis pro kWh`,energyPriceFixedHint:`Ein neuer Preis gilt für den Strom, der ab dann verbraucht wird; bereits verbrauchter Strom behält den Preis, zu dem er verbraucht wurde.`,energyPriceHaHint:`Wird stündlich sowie zu Beginn und Ende jedes Drucks gelesen, und jede Stunde Verbrauch wird mit ihrem eigenen Preis berechnet. Der Sensor muss den Preis pro kWh liefern (pro MWh und pro Wh wird umgerechnet).`,energyPriceHaNotConfigured:`Home Assistant ist nicht eingerichtet. Verbinde es unter Einstellungen → Netzwerk → Home Assistant.`,energyDisplayMode:`Energieanzeige-Modus`,energyModePrintDescription:`Dashboard zeigt Summe der während Drucken verbrauchten Energie`,energyModeTotalDescription:`Dashboard zeigt Gesamtenergie der Smart Plugs`,fileManager:`Dateimanager`,createArchiveEntry:`Archiveintrag beim Drucken erstellen`,createArchiveEntryDescription:`Beim Drucken aus dem Dateimanager optional einen Archiveintrag erstellen`,lowDiskSpaceWarning:`Warnung bei wenig Speicherplatz`,lowDiskSpaceDescription:`Warnung anzeigen, wenn freier Speicherplatz unter diesen Schwellenwert fällt`,printerFirmware:`Drucker-Firmware`,checkFirmwareDescription:`Nach Firmware-Updates von Bambu Lab suchen`,bambuddySoftware:`Bambuddy-Software`,autoCheckDescription:`Automatisch beim Start nach neuen Versionen suchen`,checkNow:`Jetzt prüfen`,updateAvailableVersion:`Update verfügbar: v{{version}}`,releaseNotes:`Versionshinweise`,updateViaDocker:`Update über Docker Compose:`,composeDirectory:`Compose-Verzeichnis`,composeDirectoryHint:`Verzeichnis, in dem deine docker-compose.yml liegt. Leer lassen, um das cd wegzulassen.`,copyUpdateCommand:`Update-Befehl kopieren`,updateViaHomeAssistant:`Updates werden vom Home Assistant Supervisor verwaltet. Öffne Einstellungen → Add-ons → Bambuddy in Home Assistant, um die neue Version zu installieren.`,updateViaWindowsInstaller:`Windows-Installationen werden durch erneutes Ausführen des Installers aktualisiert. Lade die neue Version unten herunter — deine Daten, Einstellungen und Drucker bleiben erhalten.`,downloadWindowsInstaller:`Installer für v{{version}} herunterladen`,installUpdate:`Update installieren`,latestVersionRunning:`Sie verwenden die neueste Version`,failedToCheckUpdates:`Update-Prüfung fehlgeschlagen: {{error}}`,backupRestore:`Sicherung & Wiederherstellung`,backupRestoreDescription:`Einstellungen exportieren/importieren und GitHub-Backup konfigurieren`,goToBackup:`Zur Sicherung`,externalUrl:`Externe URL`,externalUrlDescription:`Die externe URL, unter der Bambuddy erreichbar ist. Wird für Benachrichtigungsbilder und externe Integrationen verwendet.`,bambuddyUrl:`Bambuddy-URL`,externalUrlHint:`Protokoll und Port angeben (z.B. http://192.168.1.100:8000)`,ftpRetry:`FTP-Wiederholung`,ftpRetryDescription:`FTP-Operationen bei unzuverlässigem Drucker-WLAN wiederholen. Gilt für 3MF-Downloads, Druck-Uploads, Zeitraffer-Downloads und Firmware-Updates.`,autoRetryDescription:`Fehlgeschlagene FTP-Operationen automatisch wiederholen`,retryAttempts:`Wiederholungsversuche`,retryDelay:`Wiederholungsverzögerung`,connectionTimeout:`Verbindungs-Timeout`,time_one:`{{count}} Mal`,time_other:`{{count}} Mal`,second_one:`{{count}} Sekunde`,second_other:`{{count}} Sekunden`,nSeconds:`{{count}} Sekunden`,increaseForWeakWifi:`Erhöhen für Drucker mit schwachem WLAN`,homeAssistant:`Home Assistant`,homeAssistantFullDescription:`Mit Home Assistant verbinden, um Smart Plugs über die HA REST-API zu steuern. Unterstützt Switch-, Light-, Input_Boolean- und Script-Entitäten.`,homeAssistantUrl:`Home Assistant URL`,longLivedAccessToken:`Langlebiges Zugriffstoken`,haTokenHint:`Token in HA erstellen: Profil → Langlebige Zugriffstoken → Token erstellen`,connectionSuccessful:`Verbindung erfolgreich`,connectionFailed:`Verbindung fehlgeschlagen`,haConnectionSuccess:`Erfolgreich mit Home Assistant verbunden.`,haConnectionFailed:`Verbindung zu Home Assistant fehlgeschlagen.`,mqttPublishing:`MQTT-Veröffentlichung`,mqttDescription:`BamBuddy-Ereignisse an einen externen MQTT-Broker zur Integration mit Node-RED, Home Assistant und anderen Automatisierungssystemen veröffentlichen.`,mqttEnableDescription:`Ereignisse an externen MQTT-Broker veröffentlichen`,brokerHostname:`Broker-Hostname`,port:`Port`,usernameOptional:`Benutzername (optional)`,passwordOptional:`Passwort (optional)`,topicPrefix:`Topic-Präfix`,topicPrefixHint:`Topics werden sein: {{prefix}}/printers//status, etc.`,prometheusMetrics:`Prometheus-Metriken`,prometheusEndpointDescription:`Druckermetriken unter /api/v1/metrics für Prometheus/Grafana-Überwachung bereitstellen.`,bearerTokenOptional:`Bearer-Token (optional)`,bearerTokenHint:`Wenn gesetzt, müssen Anfragen Authorization: Bearer enthalten`,metricsConnectionStatus:`Verbindungsstatus`,metricsPrinterState:`Druckerstatus (idle/printing/etc)`,metricsPrintProgress:`Druckfortschritt 0-100%`,metricsBedTemp:`Betttemperatur`,metricsNozzleTemp:`Düsentemperatur`,metricsPrintsTotal:`Gesamtdrucke nach Ergebnis`,metricsMore:`...und mehr (Schichten, Lüfter, Warteschlange, Filamentverbrauch)`,smartPlugsDescription:`Smart Plugs (Tasmota oder Home Assistant) verbinden, um Stromsteuerung zu automatisieren und Energieverbrauch für Ihre Drucker zu verfolgen.`,allOn:`Alle Ein`,allOff:`Alle Aus`,addSmartPlug:`Smart Plug hinzufügen`,energySummary:`Energieübersicht`,currentPower:`Aktuelle Leistung`,plugsOnline:`{{reachable}}/{{total}} Plugs online`,today:`Heute`,yesterday:`Gestern`,total:`Gesamt`,enablePlugsForSummary:`Plugs aktivieren, um Energieübersicht zu sehen`,addNotificationProvider:`Hinzufügen`,systemBadge:`(System)`,creating:`Erstellen...`,changing:`Ändern...`,deleteUserAndItems:`Benutzer UND dessen Elemente löschen`,deleteUserKeepItems:`Benutzer löschen, Elemente behalten (werden herrenlos)`,ok:`OK`,twoFa:{totpTitle:`Authenticator-App (TOTP)`,totpDesc:`Verwende eine Authenticator-App wie Google Authenticator, Aegis oder Authy.`,emailOtpTitle:`E-Mail OTP`,emailOtpDesc:`Sende einen Einmalcode an {{email}} beim Einloggen.`,emailOtpNoEmail:`Füge eine E-Mail-Adresse zu deinem Konto hinzu, um diese Methode zu aktivieren.`,addEmailFirst:`Dein Konto hat keine E-Mail-Adresse. Bitte einen Administrator, eine hinzuzufügen.`,setupTotp:`Authenticator-App einrichten`,setupAuthApp:`Authenticator-App einrichten`,setupInstructions:`Scanne den QR-Code mit deiner Authenticator-App und bestätige mit einem Code.`,manualEntry:`Kein Scanner? Gib dieses Secret manuell ein:`,scannedContinue:`Code gescannt — weiter`,enterCodeToConfirm:`Gib den 6-stelligen Code aus deiner Authenticator-App ein, um die Einrichtung zu bestätigen.`,activate:`Aktivieren`,disableTotp:`Authenticator deaktivieren`,disableConfirmHint:`Gib einen gültigen TOTP-Code oder einen Backup-Code ein, um den Authenticator zu deaktivieren.`,totpDisabled:`Authenticator-App deaktiviert.`,emailOtpEnabled:`E-Mail OTP aktiviert.`,emailOtpDisabled:`E-Mail OTP deaktiviert.`,smtpRequired:`Bitte konfigurieren und testen Sie zuerst die SMTP-Einstellungen.`,invalidCode:`Ungültiger Code. Bitte erneut versuchen.`,enableEmailOtp:`E-Mail OTP aktivieren`,disableEmailOtp:`E-Mail OTP deaktivieren`,emailSetupEnterCode:`Ein Bestätigungscode wurde an Ihre E-Mail-Adresse gesendet. Geben Sie ihn unten ein, um zu bestätigen, dass Ihnen dieses Postfach gehört.`,verifyAndEnable:`Verifizieren & Aktivieren`,emailDisablePasswordHint:`Geben Sie Ihr Kontopasswort ein, um die Deaktivierung des E-Mail OTP zu bestätigen.`,passwordPlaceholder:`Passwort eingeben`,backupCodesTitle:`Backup-Codes sichern`,backupCodesWarning:`Speichere diese Codes sicher. Jeder Code kann nur einmal verwendet werden und wird nicht erneut angezeigt.`,backupCodesRemaining:`{{count}} Backup-Codes verbleibend`,savedCodes:`Codes gespeichert`,regenBackup:`Backup-Codes neu generieren`,regenBackupHint:`Gib deinen aktuellen TOTP-Code ein, um 10 neue Backup-Codes zu generieren. Alle bestehenden Codes werden ungültig.`,newBackupCodes:`Neue Backup-Codes`,linkedAccounts:`Verknüpfte SSO-Konten`,linkedAccountsDesc:`Diese externen Identitätsanbieter sind mit deinem Konto verknüpft.`,oidcUnlinked:`Konto getrennt.`},sessionPolicy:{title:`Sitzungsrichtlinie`,description:`Maximale Sitzungsdauer für neue Benutzeranmeldungen. Bereits ausgegebene Token behalten ihren ursprünglichen Ablauf.`,preset24h:`24 Stunden`,preset7d:`7 Tage`,preset30d:`30 Tage`,customHoursLabel:`Individuelle Sitzungsdauer in Stunden`,hoursSuffix:`Stunden`,warning:`Längere Sitzungen reduzieren den automatischen Abmeldeschutz. Nur für vertrauenswürdige Einzelnutzer-Installationen empfohlen.`},oidc:{title:`SSO / OIDC-Anbieter`,desc:`Konfiguriere OpenID Connect-Anbieter für Single Sign-On.`,addProvider:`Anbieter hinzufügen`,newProvider:`Neuer Anbieter`,empty:`Noch keine OIDC-Anbieter konfiguriert.`,created:`Anbieter erstellt.`,updated:`Anbieter aktualisiert.`,deleted:`Anbieter gelöscht.`,refreshIcon:`Icon neu laden`,removeIcon:`Icon entfernen`,iconRefreshed:`Icon aktualisiert.`,iconRemoved:`Icon entfernt.`,iconFetchFailed:`Icon konnte von der Anbieter-URL nicht geladen werden.`,deleteTitle:`Anbieter löschen`,deleteMessage:`"{{name}}" löschen? Alle verknüpften Benutzerkonten werden getrennt.`,form:{name:`Anzeigename`,issuerUrl:`Aussteller-URL`,clientId:`Client-ID`,clientSecret:`Client-Secret`,scopes:`Bereiche`,iconUrl:`Symbol-URL (optional)`,enabled:`Aktiviert`,autoCreate:`Benutzer automatisch anlegen`,autoCreateDesc:`Erstellt beim ersten Login automatisch ein lokales Konto.`,autoLink:`Bestehende Konten automatisch verknüpfen`,autoLinkDesc:`Verknüpft beim ersten Login vorhandene lokale Konten anhand der E-Mail-Adresse.`,secretHint:`leer lassen zum Beibehalten`,secretPlaceholder:`neues Secret`,emailClaim:`E-Mail-Claim`,emailClaimDesc:`JWT-Claim für die E-Mail-Identität. Für Azure Entra ID 'preferred_username' oder 'upn' verwenden (sendet kein email_verified). Nur vertrauenswürdige Claim-Namen verwenden.`,emailClaimPlaceholder:`E-Mail`,emailClaimCustomClaimAutoLinkWarning:`Benutzerdefinierte Claims sind für die Auto-Verknüpfung nur sicher, wenn der Wert vom Mandanten verwaltet wird (z. B. Azure Entra ID upn / preferred_username). Aktiviere Auto-Verknüpfung nicht, wenn dein IdP Benutzern erlaubt, diesen Claim selbst zu setzen.`,requireEmailVerified:`E-Mail-Verifizierung erforderlich`,requireEmailVerifiedDesc:`E-Mail-Claim nur akzeptieren, wenn der Provider ihn als verifiziert markiert.`,requireEmailVerifiedWarning:`Warnung: E-Mail wird auch ohne Verifizierung akzeptiert. Nur bei vertrauenswürdigen Providern verwenden.`,requireEmailVerifiedAutoLink:`Auto-Verknüpfung zuerst deaktivieren, um diese Einstellung zu ändern.`,defaultGroup:`Standardgruppe`,defaultGroupDesc:`Gruppe, der automatisch erstellte Benutzer zugewiesen werden. Fallback auf Viewers, wenn nicht gesetzt.`,defaultGroupViewersFallback:`Viewers (Standard)`,autologin:`Automatische Anmeldung`,autologinDesc:`Nicht angemeldete Besucher direkt zu diesem Anbieter weiterleiten. Diese Option kann nur für einen Anbieter aktiv sein.`,groupClaim:`Gruppen-Claim`,groupClaimDesc:`JWT-Claim, der die Gruppen des Benutzers beim Identitätsanbieter enthält. Die meisten Anbieter verwenden 'groups'; der Wert kann ein JSON-Array oder ein String sein.`,groupMapping:`Gruppen-Mapping`,groupMappingDesc:`Gemappte Gruppen werden bei jeder Anmeldung synchronisiert. Gruppen, die hier nicht genannt sind, bleiben unangetastet, damit manuelle Zuweisungen erhalten bleiben. Leer lassen, um die Gruppensynchronisierung zu deaktivieren.`,groupSync:`Gruppen-Sync`,groupSyncOn:`Aktiv`,groupMappingIdpGroupPlaceholder:`Gruppenname beim Identitätsanbieter`,groupMappingSelectGroup:`Bambuddy-Gruppe wählen…`,groupMappingAddRow:`Zuordnung hinzufügen`,groupMappingDeletedGroupOption:`{{group}} (gelöscht)`,groupMappingDeletedGroupWarning:`Diese Bambuddy-Gruppe wurde gelöscht. Wählen Sie einen Ersatz oder entfernen Sie diese Zuordnung.`,groupMappingIncompleteRow:`Geben Sie die Gruppe beim Identitätsanbieter ein und wählen Sie eine Bambuddy-Gruppe, oder entfernen Sie diese Zuordnung.`,groupMappingDuplicateRow:`Diese Gruppe des Identitätsanbieters ist oben bereits zugeordnet. Gruppennamen werden ohne Beachtung der Groß-/Kleinschreibung verglichen.`}},encryption:{title:`MFA-Verschlüsselungsstatus`,enabledFromEnv:`At-Rest-Verschlüsselung aktiv (Schlüssel aus Umgebungsvariable MFA_ENCRYPTION_KEY)`,enabledFromFile:`At-Rest-Verschlüsselung aktiv (Schlüssel aus dem Datenverzeichnis geladen)`,enabledGenerated:`At-Rest-Verschlüsselung aktiv mit automatisch generiertem Schlüssel`,notConfigured:`At-Rest-Verschlüsselung nicht konfiguriert`,notConfiguredDesc:`TOTP-Geheimnisse und OIDC-Client-Secrets werden im Klartext gespeichert. Setze MFA_ENCRYPTION_KEY oder starte Bambuddy mit beschreibbarem Datenverzeichnis neu, damit ein Schlüssel automatisch erzeugt wird.`,allEncrypted:`Alle MFA-Geheimnisse sind verschlüsselt gespeichert.`,legacyRowsLabel:`Klartext-Zeilen (Altbestand)`,encryptedRowsLabel:`Verschlüsselte Zeilen`,legacyRowsWarning:`{{count}} Klartext-Zeile(n) erkannt. Den OIDC-Provider neu speichern oder den Authenticator des Benutzers neu einrichten, um die Daten verschlüsselt abzulegen.`,backupHint:`Der automatisch erzeugte Schlüssel liegt unter DATA_DIR/.mfa_encryption_key und wird in lokalen Backup-ZIPs mitgesichert. Backups sicher aufbewahren oder MFA_ENCRYPTION_KEY explizit setzen.`,decryptionBrokenTitle:`Verschlüsselungsschlüssel fehlt`,decryptionBrokenError:`{{count}} verschlüsselte Datensätze können nicht entschlüsselt werden, weil der Schlüssel nicht mehr verfügbar ist. Den vorherigen MFA_ENCRYPTION_KEY oder DATA_DIR/.mfa_encryption_key wiederherstellen.`,migrationErrorWarning:`{{count}} Legacy-Eintrag/Einträge konnten beim Start nicht verschlüsselt werden. Prüfen Sie die Server-Logs und starten Sie Bambuddy neu.`},pipelineLimits:{title:`Slicer-Pipeline-Limits`,maxCopiesLabel:`Max. Kopien pro Lauf`,maxCopiesDesc:`Obergrenze für die Anzahl an Kopien, die Operatoren beim Ausführen einer Pipeline anfordern können. Serverseitige Obergrenze ist 1000.`},pipelines:{title:`Slicer-Pipelines`,subtitle:`Wiederverwendbare Preset-Bundles (Drucker + Prozess + Filamente + Druckplatte). Speichere eines aus dem Slice-Dialog und wende es beim nächsten Datei-Slice mit einem Klick an.`,loading:`Pipelines werden geladen…`,loadError:`Pipelines konnten nicht geladen werden.`,confirmDelete:`Diese Pipeline löschen? Das kann nicht rückgängig gemacht werden.`,staleWarning:`Eines oder mehrere referenzierte Presets existieren nicht mehr. Speichere diese Pipeline erneut aus dem Slice-Dialog, um sie zu reparieren.`,empty:{title:`Noch keine Pipelines.`,howto:`Öffne den Slice-Dialog für eine beliebige Datei, wähle Drucker / Prozess / Filamente / Druckplatte und klicke „Als Pipeline speichern“. Deine gespeicherten Pipelines erscheinen hier.`},field:{name:`Pipeline-Name`,description:`Beschreibung`,targetPrinter:`Zieldrucker`,noTarget:`— Kein Ziel —`,targetKind:`Zielart`,targetKindSpecific:`Spezifischer Drucker`,targetKindClass:`Druckerklasse`,targetModelClass:`Druckermodell`,fanoutStrategy:`Verteilungsstrategie`,fanout:{max_parallel:`Max parallel — auf alle verfügbaren passenden Drucker verteilen`,round_robin:`Reihum — durch geeignete Drucker rotieren`,fill_one_first:`Erst einen füllen — alle Kopien an einen Drucker binden`},fanoutShort:{max_parallel:`parallel`,round_robin:`Reihum`,fill_one_first:`einer zuerst`}},action:{save:`Speichern`,cancel:`Abbrechen`,rename:`Umbenennen`,delete:`Löschen`},slot:{printer:`Drucker`,process:`Prozess`,filament:`Filament`,filamentN:`Filament {{n}}`,filamentAll:`Alle {{n}} Slots`,bed:`Druckplatte`},group:{profiles:`Profile`,filaments:`Filamente`},searchPlaceholder:`Pipelines durchsuchen…`,filterTargetType:`Nach Zielart filtern`,filterTarget:`Nach Ziel filtern`,filter:{all:`Alle Ziele`,noTarget:`Kein Ziel festgelegt`,count:`{{shown}} / {{total}}`,noMatches:`Keine Pipelines entsprechen den aktuellen Filtern.`},toast:{saved:`Pipeline gespeichert`,saveFailed:`Speichern fehlgeschlagen`,deleted:`Pipeline gelöscht`,deleteFailed:`Löschen fehlgeschlagen`},noTargetHint:`Lege einen Zieldrucker fest, um diese auszuführen`,noTargetWarning:`Lege einen Zieldrucker fest, bevor du diese Pipeline ausführst.`,runs:{lastRun:`Letzter Lauf`,status:{queued:`in Warteschlange`,slicing:`wird geschnitten`,dispatching:`wird gesendet`,in_progress:`druckt`,completed:`abgeschlossen`,failed:`fehlgeschlagen`,partial_failure:`teilweise fehlgeschlagen`,cancelled:`abgebrochen`}}}},notification:{printStarted:{title:`Druck gestartet`,body:`{{printer}}: {{filename}} wird gedruckt`},printCompleted:{title:`Druck abgeschlossen`,body:`{{printer}}: {{filename}} erfolgreich abgeschlossen`},printFailed:{title:`Druck fehlgeschlagen`,body:`{{printer}}: {{filename}} ist fehlgeschlagen`},printStopped:{title:`Druck gestoppt`,body:`{{printer}}: {{filename}} wurde gestoppt`},printProgress:{title:`Druckfortschritt`,body:`{{printer}}: {{filename}} ist zu {{percent}}% abgeschlossen`},printerOffline:{title:`Drucker offline`,body:`{{printer}} ist offline`},printerError:{title:`Druckerfehler`,body:`{{printer}} – {{error}}`},filamentLow:{title:`Filament niedrig`,body:`{{printer}}: Filament geht zur Neige`},maintenanceDue:{title:`Wartung fällig`,body:`{{printer}}: {{items}} benötigen Aufmerksamkeit`}},errors:{generic:`Etwas ist schiefgelaufen`,networkError:`Netzwerkfehler. Bitte überprüfen Sie Ihre Verbindung.`,notFound:`Nicht gefunden`,unauthorized:`Nicht autorisiert`,serverError:`Serverfehler`,validationError:`Bitte überprüfen Sie Ihre Eingabe`,printerConnectionFailed:`Verbindung zum Drucker fehlgeschlagen`,saveFailed:`Speichern fehlgeschlagen`,deleteFailed:`Löschen fehlgeschlagen`,loadFailed:`Laden der Daten fehlgeschlagen`},hmsErrors:{title:`Fehler - {{name}}`,noErrors:`Keine Fehler`,viewOnWiki:`Im Bambu Lab Wiki ansehen`,mqttVerifyFailedRemedy:`Aktiviere den Entwicklermodus am Drucker, starte den Drucker neu und starte den Auftrag dann erneut.`,mqttVerifyFailedDescription:`Der Drucker hat einen Befehl abgelehnt, weil er ihn nicht verifizieren konnte. Drucke, Temperaturänderungen und Filamentladevorgänge von Bambuddy werden ignoriert, bis das behoben ist.`,severityError:`Fehler`,severityWarning:`Warnung`,severityNotice:`Hinweis`,severityUnknown:`Unbekannte Stufe`,uncountedSummary:`Außerdem gemeldet, nicht gezählt ({{n}})`,uncountedHint:`Hinweise, die kein Eingreifen brauchen, und Codes, zu denen Bambu keinen Text veröffentlicht. Sie zählen auf der Druckerkarte nicht als Problem und lösen keine Benachrichtigung aus.`,unknownCode:`Unbekannter HMS-Code — Details siehe Bambu Lab Wiki.`,clearInstructions:`Löschen Sie die Fehler am Drucker, um sie hier zu entfernen.`,clearErrors:`Fehler löschen`,clearSuccess:`HMS-Fehler gelöscht`,clearFailed:`HMS-Fehler konnten nicht gelöscht werden`,actionSuccess:`Aktion an Drucker gesendet`,actionFailed:`Aktion konnte nicht gesendet werden`,runoutExpectedSlot:`Das Filament in {{ranOut}} ist aufgebraucht. Der Drucker wartet jetzt auf kompatibles Filament in {{expected}}. Legen Sie eine Spule in {{expected}} ein und wählen Sie dann Wiederholen.`,runoutExpectedSlotOnly:`Der Drucker wartet auf kompatibles Filament in {{expected}}. Legen Sie dort eine Spule ein und wählen Sie dann Wiederholen.`,runoutSlotUnknown:`Das Filament ist aufgebraucht und der Druck ist pausiert. Bambuddy konnte nicht ermitteln, welchen Slot der Drucker jetzt erwartet — prüfen Sie am Druckerdisplay, welcher Slot angefordert wird.`,actions:{RESUME_PRINTING:`Druck fortsetzen`,RESUME_PRINTING_DEFECTS:`Fortsetzen (Mängel akzeptabel)`,RESUME_PRINTING_PROBELM_SOLVED:`Fortsetzen (Problem gelöst)`,STOP_PRINTING:`Druck stoppen`,CHECK_ASSISTANT:`Assistent öffnen`,FILAMENT_EXTRUDED:`Filament extrudiert, weiter`,RETRY_FILAMENT_EXTRUDED:`Noch nicht extrudiert, erneut`,CONTINUE:`Fertig, weiter`,LOAD_VIRTUAL_TRAY:`Filament laden`,OK_BUTTON:`OK`,FILAMENT_LOAD_RESUME:`Filament geladen, fortsetzen`,JUMP_TO_LIVEVIEW:`Live-Ansicht öffnen`,NO_REMINDER_NEXT_TIME:`Nicht mehr erinnern`,REFRESH_NOZZLE:`Erneut prüfen`,IGNORE_NO_REMINDER_NEXT_TIME:`Ignorieren und nicht mehr erinnern`,IGNORE_RESUME:`Ignorieren und fortsetzen`,PROBLEM_SOLVED_RESUME:`Problem gelöst, fortsetzen`,TURN_OFF_FIRE_ALARM:`Verstanden, Brandalarm ausschalten`,RETRY_PROBLEM_SOLVED:`Erneut versuchen (Problem gelöst)`,CANCLE:`Abbrechen`,STOP_DRYING:`Trocknen stoppen`,PROCEED:`Fortfahren`,OK_JUMP_RACK:`OK`,ABORT:`Abbrechen`,DISABLE_PURIFICATION:`Luftreinigung für diesen Druck deaktivieren`,DONT_REMIND_NEXT_TIME:`Nicht mehr erinnern`,DBL_CHECK_CANCEL:`Abbrechen`,DBL_CHECK_DONE:`Fertig`,DBL_CHECK_RETRY:`Erneut versuchen`,DBL_CHECK_RESUME:`Fortsetzen`,DBL_CHECK_OK:`Bestätigen`,REMOVE_CLOSE_BTN:`Schließen`}},mqttDebug:{title:`MQTT-Debug-Protokoll`,searchPlaceholder:`Topic oder Payload suchen...`,noMessages:`Noch keine Nachrichten protokolliert`,startLoggingHint:`Klicken Sie auf "Protokollierung starten", um MQTT-Nachrichten aufzuzeichnen`,noMessagesMatch:`Keine Nachrichten entsprechen Ihrem Filter`,adjustFilterHint:`Versuchen Sie, Ihre Such- oder Filterkriterien anzupassen`,incoming:`Eingehend`,outgoing:`Ausgehend`,loggingStopped:`Protokollierung gestoppt`,loggingActive:`Protokollierung aktiv - Nachrichten werden automatisch aktualisiert`,startLogging:`Protokollierung starten`,stopLogging:`Protokollierung stoppen`,clearLog:`Protokoll löschen`,topic:`Thema`,timestamp:`Zeitstempel`,direction:`Richtung`,all:`Alle`},printerFiles:{zipStarted_one:`ZIP-Download für {{count}} Datei gestartet`,zipStarted_other:`ZIP-Download für {{count}} Dateien gestartet`,zipPartial:`ZIP-Download mit {{successful}} von {{total}} Dateien gestartet; die übrigen konnten nicht abgerufen werden`,downloadFailed:`Download fehlgeschlagen: {{error}}`,unknownError:`Unbekannter Fehler`,shiftSelectHint:`Umschalttaste gedrückt halten, um einen Bereich auszuwählen`,selectFile:`{{name}} auswählen`,deselectFile:`Auswahl von {{name}} aufheben`,title:`Dateimanager`,storageUsed:`Belegt:`,storageFree:`Frei:`,filterPlaceholder:`Dateien filtern...`,deleteButton:`Löschen`,deleteFiles:`{{count}} Dateien löschen`,deleteFileConfirm:`"{{name}}" löschen? Dies kann nicht rückgängig gemacht werden.`,deleteFilesConfirm:`{{count}} ausgewählte Dateien löschen? Dies kann nicht rückgängig gemacht werden.`,noFiles:`Keine Dateien auf dem Drucker`,printerUnavailable:`Der Dateidienst des Druckers ist nicht erreichbar. Versuchen Sie es erneut, wenn der Drucker verfügbar ist.`,loadingFiles:`Dateien werden geladen...`,failedToLoad:`Dateien konnten nicht geladen werden`,toast:{filesDeleted:`{{count}} Datei(en) gelöscht`,deleteFailed:`Löschen fehlgeschlagen: {{error}}`}},confirm:{delete:`Möchten Sie dies wirklich löschen?`,unsavedChanges:`Sie haben ungespeicherte Änderungen. Möchten Sie wirklich verlassen?`,clearQueue:`Möchten Sie die Warteschlange wirklich leeren?`},login:{title:`Bambuddy Anmeldung`,subtitle:`Melden Sie sich bei Ihrem Konto an`,username:`Benutzername`,usernamePlaceholder:`Benutzername eingeben`,usernameOrEmail:`Benutzername oder E-Mail`,usernameOrEmailPlaceholder:`Benutzername oder @ E-Mail`,password:`Passwort`,passwordPlaceholder:`Passwort eingeben`,signIn:`Anmelden`,signingIn:`Anmeldung läuft...`,rememberMe:`Angemeldet bleiben`,forgotPassword:`Passwort vergessen?`,autologinFailed:`Automatische SSO-Anmeldung fehlgeschlagen. Bitte wählen Sie unten einen Anbieter.`,localDisabledNotice:`Lokale Anmeldung ist deaktiviert. Bitte verwenden Sie einen der SSO-Anbieter unten.`,loginSuccess:`Erfolgreich angemeldet`,loginFailed:`Anmeldung fehlgeschlagen`,enterCredentials:`Bitte Benutzername und Passwort eingeben`,enterEmail:`Bitte geben Sie Ihre E-Mail-Adresse ein`,oidcLoginFailed:`OIDC-Anmeldung fehlgeschlagen`,oidcErrors:{providerError:`Der Identity-Provider hat einen Fehler zurückgegeben`,missingParameters:`Dem OIDC-Callback fehlen erforderliche Parameter`,invalidState:`OIDC-State ist ungültig oder wurde bereits verwendet`,stateExpired:`OIDC-Sitzung abgelaufen — bitte erneut versuchen`,providerNotFound:`OIDC-Provider nicht gefunden`,discoveryFailed:`OIDC-Discovery-Dokument konnte nicht abgerufen werden`,invalidDiscovery:`OIDC-Discovery-Dokument ist ungültig`,networkError:`Netzwerkfehler beim OIDC-Token-Austausch`,badResponse:`Unerwartete Antwort beim OIDC-Token-Austausch`,noIdToken:`OIDC-Provider hat kein ID-Token zurückgegeben`,validationFailed:`OIDC-Token-Validierung fehlgeschlagen`,nonceMismatch:`OIDC-Nonce stimmt nicht überein — möglicher Replay-Angriff`,missingSubClaim:`OIDC-Token enthält keinen Sub-Claim`,noLinkedAccount:`Kein lokales Konto mit dieser OIDC-Identität verknüpft`,accountInactive:`Ihr Konto ist inaktiv`,userResolutionFailed:`Ihr Konto konnte nicht aufgelöst werden`,internalError:`Interner Fehler beim OIDC-Login`,tokenExchangeFailed:`OIDC-Token-Austausch fehlgeschlagen`},forgotPasswordTitle:`Passwort vergessen`,forgotPasswordMessage:`Wenn Sie Ihr Passwort vergessen haben, wenden Sie sich bitte an Ihren Systemadministrator.`,forgotPasswordEmailMessage:`Geben Sie Ihre E-Mail-Adresse ein und wir senden Ihnen ein neues Passwort.`,emailAddress:`E-Mail-Adresse`,emailPlaceholder:`ihre.email@beispiel.de`,cancel:`Abbrechen`,sending:`Wird gesendet...`,sendResetEmail:`Zurücksetzungs-E-Mail senden`,howToReset:`So setzen Sie Ihr Passwort zurück:`,resetStep1:`Kontaktieren Sie Ihren Bambuddy-Administrator`,resetStep2:`Bitten Sie ihn, Ihr Passwort in der Benutzerverwaltung zurückzusetzen`,resetStep3:`Er kann ein neues temporäres Passwort für Sie festlegen`,resetStep4:`Melden Sie sich mit dem neuen Passwort an und ändern Sie es in den Einstellungen`,gotIt:`Verstanden`,resetPassword:{title:`Neues Passwort festlegen`,subtitle:`Geben Sie unten Ihr neues Passwort ein und bestätigen Sie es.`,newPassword:`Neues Passwort`,newPasswordPlaceholder:`Mindestens 8 Zeichen`,confirmPassword:`Passwort bestätigen`,confirmPasswordPlaceholder:`Neues Passwort wiederholen`,saving:`Wird gespeichert…`,submit:`Neues Passwort festlegen`,backToLogin:`Zurück zur Anmeldung`,passwordsDoNotMatch:`Passwörter stimmen nicht überein`,passwordTooShort:`Passwort muss mindestens 8 Zeichen lang sein`,resetFailed:`Passwort zurücksetzen fehlgeschlagen. Der Link ist möglicherweise abgelaufen.`},twoFA:{title:`Zwei-Faktor-Authentifizierung`,subtitle:`Ihr Konto ist mit 2FA geschützt. Geben Sie unten den Bestätigungscode ein.`,methodAuthenticator:`Authenticator-App`,methodEmail:`E-Mail-Code`,methodBackup:`Wiederherstellungscode`,instructionsTotp:`Öffnen Sie Ihre Authenticator-App und geben Sie den 6-stelligen Code für Bambuddy ein.`,instructionsEmail:`Ein 6-stelliger Code wurde an Ihre E-Mail-Adresse gesendet. Er ist 10 Minuten gültig.`,instructionsEmailNotSent:`Klicken Sie unten, um einen Bestätigungscode per E-Mail zu erhalten.`,instructionsBackup:`Geben Sie einen Ihrer 8-stelligen Wiederherstellungscodes ein. Jeder Code kann nur einmal verwendet werden.`,sendCodeButton:`Code per E-Mail senden`,sendingCode:`Wird gesendet...`,resendCode:`Code erneut senden`,codeLabel:`Bestätigungscode`,backupCodeLabel:`Wiederherstellungscode`,codePlaceholder:`000000`,backupCodePlaceholder:`XXXXXXXX`,verifyButton:`Bestätigen`,verifyingButton:`Wird überprüft...`,backToLogin:`← Zurück zur Anmeldung`,orContinueWith:`oder anmelden mit`,signInWith:`Anmelden mit {{provider}}`,enterCode:`Bitte geben Sie den Bestätigungscode ein`,sendCodeFailed:`Bestätigungscode konnte nicht gesendet werden`,invalidCode:`Ungültiger Code. Bitte erneut versuchen.`}},setup:{title:`Bambuddy Einrichtung`,subtitle:`Konfigurieren Sie die Authentifizierung für Ihre Bambuddy-Instanz`,enableAuth:`Authentifizierung aktivieren`,adminAccount:`Admin-Konto`,adminAccountDesc:`Wenn bereits Admin-Benutzer existieren, wird die Authentifizierung mit den vorhandenen Admin-Konten aktiviert. Lassen Sie die Felder unten leer, um vorhandene Admins zu verwenden, oder geben Sie neue Anmeldedaten ein, um einen neuen Admin-Benutzer zu erstellen.`,adminUsername:`Admin-Benutzername`,adminPassword:`Admin-Passwort`,optionalIfAdminExists:`(optional, wenn Admin-Benutzer existieren)`,adminUsernamePlaceholder:`Admin-Benutzernamen eingeben (optional)`,adminPasswordPlaceholder:`Admin-Passwort eingeben (optional)`,confirmPassword:`Passwort bestätigen`,confirmPasswordPlaceholder:`Admin-Passwort bestätigen`,settingUp:`Einrichtung läuft...`,completeSetup:`Einrichtung abschließen`,toast:{authEnabledAdminCreated:`Authentifizierung aktiviert und Admin-Benutzer erstellt`,authEnabledExistingAdmins:`Authentifizierung mit vorhandenen Admin-Benutzern aktiviert`,setupCompleted:`Einrichtung abgeschlossen`,enterBothCredentials:`Bitte geben Sie sowohl Admin-Benutzernamen als auch Passwort ein, oder lassen Sie beide leer, um vorhandene Admin-Benutzer zu verwenden`,passwordsDoNotMatch:`Passwörter stimmen nicht überein`,passwordTooShort:`Passwort muss mindestens 6 Zeichen lang sein`}},changePassword:{title:`Passwort ändern`,currentPassword:`Aktuelles Passwort`,currentPasswordPlaceholder:`Aktuelles Passwort eingeben`,newPassword:`Neues Passwort`,newPasswordPlaceholder:`Neues Passwort eingeben (min. 6 Zeichen)`,confirmPassword:`Neues Passwort bestätigen`,confirmPasswordPlaceholder:`Neues Passwort bestätigen`,passwordsDoNotMatch:`Passwörter stimmen nicht überein`,passwordTooShort:`Passwort muss mindestens 6 Zeichen lang sein`,changing:`Wird geändert...`,success:`Passwort erfolgreich geändert`,failed:`Passwortänderung fehlgeschlagen`},plateAlert:{title:`Druck pausiert!`,message:`Objekte auf dem Druckbett erkannt. Der Druck wurde automatisch pausiert. Bitte räumen Sie das Druckbett und setzen Sie den Druck fort.`,understand:`Verstanden`},camera:{title:`Kameraansicht`,invalidPrinterId:`Ungültige Drucker-ID`,live:`Live`,snapshot:`Schnappschuss`,restartStream:`Stream neu starten`,refreshSnapshot:`Schnappschuss aktualisieren`,fullscreen:`Vollbild`,exitFullscreen:`Vollbild beenden`,connectingToCamera:`Verbinde mit Kamera...`,capturingSnapshot:`Schnappschuss wird aufgenommen...`,connectionLost:`Verbindung verloren`,connectionFailed:`Kameraverbindung fehlgeschlagen`,reconnecting:`Neuverbindung in {{countdown}}s... (Versuch {{attempt}}/{{max}})`,reconnectNow:`Jetzt verbinden`,cameraUnavailable:`Kamera nicht verfügbar`,cameraUnavailableDesc:`Stellen Sie sicher, dass der Drucker eingeschaltet und verbunden ist.`,noCamera:`Keine Kamera verfügbar`,retry:`Erneut versuchen`,cameraStream:`Kamera-Stream`,zoomOut:`Verkleinern`,zoomIn:`Vergrößern`,resetZoom:`Zoom zurücksetzen`,recording:`Aufnahme`,startRecording:`Aufnahme starten`,stopRecording:`Aufnahme stoppen`,chamberLight:`Kammerbeleuchtung umschalten`,unavailable:`Kamera nicht verfügbar`,diagnose:{button:`Diagnose`,modalTitle:`Kamera-Diagnose`,running:`Diagnose läuft...`,runFailed:`Diagnose konnte nicht ausgeführt werden: {{error}}`,retry:`Erneut ausführen`,stage:{tcp_reachable:`Netzwerk-Erreichbarkeit`,first_frame:`Bilderfassung`,live_stream_active:`Live-Stream aktiv`},summary:{all_ok:`Kamera funktioniert. Die Diagnose hat alle Phasen erfolgreich abgeschlossen.`,live_stream_active_healthy:`Kamera streamt gerade mit aktuellen Bildern — kein Test nötig.`,printer_unreachable:`Drucker ist nicht erreichbar. Prüfe IP-Adresse, Netzwerkverbindung und ob der Drucker eingeschaltet ist.`,camera_port_closed:`Drucker ist erreichbar, aber der Kamera-Port ist geschlossen. Stelle sicher, dass LAN-Modus und Entwicklermodus in den Druckereinstellungen aktiviert sind.`,no_frame:`Verbindung zur Kamera hergestellt, aber keine Bilder empfangen. Versuche es erneut oder prüfe, ob die Kamera in den Druckereinstellungen aktiviert ist.`,unknown_failure:`Kamera-Diagnose aus unbekanntem Grund fehlgeschlagen. Prüfe das Support-Log für Details.`},meta:{protocol:`Protokoll`,port:`Port`,profile:`Profil`}}},groups:{title:`Gruppenverwaltung`,subtitle:`Berechtigungsgruppen für Zugriffskontrolle verwalten`,backToSettings:`Zurück zu Einstellungen`,createGroup:`Gruppe erstellen`,noPermission:`Sie haben keine Berechtigung, auf diese Seite zuzugreifen.`,system:`System`,noDescription:`Keine Beschreibung`,usersCount:`{{count}} Benutzer`,permissionsCount:`{{count}} Berechtigungen`,edit:`Bearbeiten`,delete:`Löschen`,toast:{created:`Gruppe erfolgreich erstellt`,updated:`Gruppe erfolgreich aktualisiert`,deleted:`Gruppe erfolgreich gelöscht`,enterGroupName:`Bitte geben Sie einen Gruppennamen ein`},modal:{editGroup:`Gruppe bearbeiten`,createGroup:`Gruppe erstellen`,cancel:`Abbrechen`,saving:`Speichern...`,creating:`Erstellen...`,saveChanges:`Änderungen speichern`},form:{groupName:`Gruppenname`,groupNamePlaceholder:`Gruppennamen eingeben`,systemGroupWarning:`Systemgruppennamen können nicht geändert werden`,description:`Beschreibung`,descriptionPlaceholder:`Beschreibung eingeben (optional)`,permissions:`Berechtigungen ({{count}} ausgewählt)`},deleteModal:{title:`Gruppe löschen`,message:`Sind Sie sicher, dass Sie diese Gruppe löschen möchten? Benutzer in dieser Gruppe verlieren diese Berechtigungen.`,confirm:`Gruppe löschen`},editor:{title:`Gruppe bearbeiten`,createTitle:`Gruppe erstellen`,search:`Berechtigungen suchen...`,selectAll:`Alle auswählen`,clearAll:`Alle abwählen`,permissionsSelected:`{{count}} ausgewählt`,noResults:`Keine Berechtigungen entsprechen Ihrer Suche`,websocketHint:`Erforderlich für Live-Aktualisierungen. Ohne diese Berechtigung greift die Oberfläche auf regelmäßiges Abrufen zurück.`,printerAccess:`Druckerzugriff`,adminsSeeAllPrinters:`Administratoren sehen immer alle Drucker.`,printerAccessAfterCreate:`Sobald die Gruppe erstellt ist, wählen Sie ihre Drucker unter Einstellungen → Authentifizierung → Druckerzugriff.`,printerAccessLimited:`Eingeschränkt: {{printers}} Drucker ausgewählt, {{locations}} Standorte`,printerAccessOpen:`Nicht eingeschränkt: Mitglieder sehen alle Drucker.`,managePrinterAccess:`Druckerzugriff verwalten`}},printerAccess:{tab:`Druckerzugriff`,intro:`Legen Sie fest, welche Drucker die Mitglieder jeder Gruppe sehen und steuern dürfen. Eine nicht eingeschränkte Gruppe schränkt nichts ein: Ein Benutzer, der in keiner eingeschränkten Gruppe ist, sieht alle Drucker, und Administratoren sowieso.`,byGroup:`Nach Gruppe`,byPrinter:`Nach Drucker`,searchGroups:`Gruppen durchsuchen`,groupFilter:{all:`Alle`,limited:`Eingeschränkt`,open:`Nicht eingeschränkt`},noGroupsMatch:`Keine passenden Gruppen.`,alwaysAll:`Immer alle Drucker`,notLimited:`Alle Drucker`,reachShort:`{{count}} von {{total}} Druckern`,unsaved:`Ungespeicherte Änderungen`,pickGroup:`Wählen Sie eine Gruppe, um ihre Drucker festzulegen.`,memberCount:`Mitglieder: {{count}}`,editGroup:`Gruppe bearbeiten`,adminsSeeAll:`Administratoren sehen immer alle Drucker.`,limit:`Mitglieder auf die hier gewählten Drucker und Standorte beschränken`,limitHint:`Aus: Diese Gruppe schränkt nicht ein, welche Drucker ihre Mitglieder sehen.`,reach:`Mitglieder können {{count}} von {{total}} Druckern nutzen.`,noneGranted:`Nichts ausgewählt: Mitglieder dieser Gruppe sehen keinen Drucker.`,noPrinters:`Es wurden noch keine Drucker hinzugefügt.`,searchPrinters:`Name, Modell, Seriennummer oder Standort suchen`,allLocations:`Alle Standorte`,noLocation:`Kein Standort`,allModels:`Alle Modelle`,accessFilter:`Zugriff`,accessAll:`Mit und ohne Zugriff`,accessWith:`Mit Zugriff`,accessWithout:`Ohne Zugriff`,tickShown:`Alle angezeigten auswählen`,untickShown:`Alle angezeigten abwählen`,emptyLocation:`derzeit ist hier kein Drucker`,wholeLocation:`Ganzer Standort`,wholeLocationHint:`Alle Drucker in {{location}}, auch später dort hinzugefügte`,noPrintersMatch:`Keine passenden Drucker.`,viaLocation:`über Standort`,alsoVisible:`Neben den hier aufgeführten Gruppen ist jeder Drucker für Administratoren und für Benutzer sichtbar, die in keiner eingeschränkten Gruppe sind.`,openUsers:`Benutzer in keiner eingeschränkten Gruppe: {{names}}`,noOpenUsers:`Alle Benutzer außer Administratoren sind in einer eingeschränkten Gruppe.`,noLimitedGroups:`Noch ist keine Gruppe eingeschränkt, daher sieht jeder Benutzer alle Drucker. Schränken Sie eine Gruppe unter „Nach Gruppe“ ein.`,noLimitedGroupReaches:`Keine eingeschränkte Gruppe`,showingOne:`Es wird ein Drucker angezeigt.`,showAll:`Alle Drucker anzeigen`,viaLocationTitle:`Über den Standort {{location}}. Ändern Sie dies unter „Nach Gruppe“.`,removeGroup:`Zugriff für {{group}} entfernen`,addGroup:`Zugriff gewähren für…`,changedGroups:`Ungespeicherte Änderungen: {{names}}`,discard:`Verwerfen`,saved:`Druckerzugriff gespeichert`,whoHasAccess:`Wer hat Zugriff`,moveWarning:`Wenn Sie diesen Drucker an einen anderen Standort verschieben, ändert sich, wer ihn nutzen kann: {{groups}}.`},users:{title:`Benutzerverwaltung`,subtitle:`Benutzer und deren Zugriff auf Ihre Bambuddy-Instanz verwalten`,backToSettings:`Zurück zu Einstellungen`,createUser:`Benutzer erstellen`,noPermission:`Sie haben keine Berechtigung, auf diese Seite zuzugreifen.`,admin:`Admin`,noGroups:`Keine Gruppen`,active:`Aktiv`,inactive:`Inaktiv`,edit:`Bearbeiten`,delete:`Löschen`,system:`System`,noGroupsAvailable:`Keine Gruppen verfügbar`,table:{username:`Benutzername`,groups:`Gruppen`,status:`Status`,actions:`Aktionen`},toast:{created:`Benutzer erfolgreich erstellt`,updated:`Benutzer erfolgreich aktualisiert`,deleted:`Benutzer erfolgreich gelöscht`,fillRequired:`Bitte füllen Sie alle Pflichtfelder aus`,passwordsDoNotMatch:`Passwörter stimmen nicht überein`,passwordTooShort:`Passwort muss mindestens 6 Zeichen lang sein`,ldapProvisioned:`LDAP-Benutzer „{{username}}" bereitgestellt`},modal:{createUser:`Benutzer erstellen`,editUser:`Benutzer bearbeiten`,cancel:`Abbrechen`,creating:`Erstellen...`,saving:`Speichern...`,saveChanges:`Änderungen speichern`,advancedAuthSubtitle:`mit erweiterter Authentifizierung`,tabsAriaLabel:`Benutzerquelle`,localTab:`Lokal`,ldapTab:`LDAP`,ldapSearchLabel:`Verzeichnis durchsuchen`,ldapSearchPlaceholder:`Benutzername, Name oder E-Mail eingeben...`,ldapMinChars:`Mindestens 2 Zeichen für die Suche eingeben`,ldapTypeToSearch:`Tippen, um das LDAP-Verzeichnis zu durchsuchen`,ldapSearching:`Verzeichnis wird durchsucht...`,ldapNoResults:`Keine passenden Benutzer im Verzeichnis`,ldapSearchError:`Verzeichnissuche fehlgeschlagen. Bitte LDAP-Server-Status prüfen.`,ldapAlreadyProvisioned:`Bereits bereitgestellt`,ldapSelectedLabel:`Ausgewählt`,ldapProvision:`Benutzer bereitstellen`,ldapProvisioning:`Wird bereitgestellt...`,ldapErrorProvision:`Bereitstellung fehlgeschlagen. Bitte LDAP-Server-Status prüfen und erneut versuchen.`},form:{username:`Benutzername`,usernamePlaceholder:`Benutzernamen eingeben`,email:`E-Mail`,emailPlaceholder:`benutzer@beispiel.de`,password:`Passwort`,passwordPlaceholder:`Passwort eingeben`,confirmPassword:`Passwort bestätigen`,confirmPasswordPlaceholder:`Passwort bestätigen`,newPasswordPlaceholder:`Neues Passwort eingeben`,confirmNewPasswordPlaceholder:`Neues Passwort bestätigen`,leaveBlankToKeep:`leer lassen, um das aktuelle zu behalten`,groups:`Gruppen`,optional:`optional`,autoGeneratedPassword:`Ein sicheres Passwort wird automatisch generiert und per E-Mail an den Benutzer gesendet.`,passwordManagedByAdvancedAuth:`Das Passwort wird durch erweiterte Authentifizierung verwaltet. Verwenden Sie "Passwort zurücksetzen", um ein neues Passwort per E-Mail an den Benutzer zu senden.`,resetPassword:`Passwort zurücksetzen`,resettingPassword:`Passwort wird zurückgesetzt...`},deleteModal:{title:`Benutzer löschen`,message:`Sind Sie sicher, dass Sie diesen Benutzer löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.`,confirm:`Benutzer löschen`}},streamOverlay:{branding:{title:`Markenauftritt`,hint:`Ein gemeinsames Logo für diese Installation. PNG oder WebP, bis zu 2 MiB und 4 Millionen Pixel. Ersetzen oder Entfernen betrifft alle Overlays, die es verwenden.`,upload:`Logo hochladen`,logo:`Eigenes Logo`,from:`Startfarbe`,to:`Endfarbe`,reset:`Farben zurücksetzen`,failed:`Logo konnte nicht gespeichert werden. Bildformat und Größe prüfen.`},title:`Stream-Overlay`,invalidPrinterId:`Ungültige Drucker-ID`,cameraStream:`Kamera-Stream`,progress:`Fortschritt`,eta:`ETA`,printerIdle:`Drucker ist inaktiv`,printerOffline:`Drucker offline`,layer:`Schicht`,remaining:`Verbleibend`,builder:{backgroundTransparency:`Hintergrundtransparenz`,backgroundTransparencyHint:`Nur die dunklen Hintergründe ausblenden. Text, Logos und Kamera bleiben sichtbar.`,layout:`Anordnung`,landscape:`Querformat`,portrait:`Hochformat`,both:`Beide`,orientationUrl:`URL für {{orientation}}`,orientationPreview:`Vorschau: {{orientation}}`,sourceDimensions:`Browserquelle: {{width}} × {{height}} px`,artwork:`Gestaltung`,artworkClassic:`Klassisch`,artworkV2:`Version 2`,createToken:`Overlay-Token erstellen`,showToken:`Token anzeigen`,hideToken:`Token ausblenden`,credentialHint:`Erstelle oben ein Token, gib ein vorhandenes ein oder importiere eine Overlay-URL. Kopiere die URL vor dem Verlassen: Tokens bleiben nur im Arbeitsspeicher und lassen sich aus ihrem gespeicherten Hash nicht wiederherstellen.`,importUrl:`Vorhandene Overlay-URL`,importAction:`URL importieren`,importHint:`Importiere eine URL lokal, um ihr Token und ihre Einstellungen auf diesem Server zu verwenden. Einstellungen, die Bambuddy nicht kennt, werden ignoriert.`,rememberedHint:`Deine Auswahl wird in diesem Browser gespeichert, das Token nicht.`,resetChoices:`Auswahl zurücksetzen`,importError:`Gib eine gültige HTTP(S)-Overlay-URL mit positiver Druckernummer, höchstens einem Token und ohne Benutzername oder Passwort ein.`,manualToken:`Token manuell eingeben`,title:`Stream-Overlay`,description:`Erstellt die URL für ein Stream-Overlay — eine bildschirmfüllende Kameraansicht mit eingeblendeten Live-Druckdaten, für OBS, ein Wanddisplay oder jede andere Browserquelle. Felder auswählen und URL kopieren.`,printer:`Drucker`,size:`Textgröße`,sizeSmall:`Klein`,sizeMedium:`Mittel`,sizeLarge:`Groß`,fps:`Bildrate`,fpsHint:`A1- und P1-Kameras liefern höchstens etwa 5 Bilder pro Sekunde, unabhängig vom eingestellten Wert.`,tokenWarning:`Diese URL enthält ein Token — wer sie lesen kann, sieht den Stream und den Dateinamen. Token widerrufen, um den Zugriff zu beenden.`,fields:`Anzuzeigende Felder`,fieldPrinter:`Druckername`,fieldModel:`Druckermodell`,fieldFilename:`Dateiname`,fieldStatus:`Status`,fieldProgress:`Fortschrittsbalken`,fieldLayers:`Schichtanzahl`,fieldEta:`Restzeit und ETA`,fieldCamera:`Kamerabild`,chamberHint:`Die Kammertemperatur erscheint nur bei Modellen mit echtem Kammersensor — P1- und A1-Drucker melden einen bedeutungslosen Wert und lassen sie deshalb weg.`,urlTitle:`Overlay-URL`,open:`Öffnen`,showPreview:`Vorschau anzeigen`,hidePreview:`Vorschau ausblenden`,previewTitle:`Overlay-Vorschau`},status:{printing:`Druckt`,paused:`Pausiert`,finished:`Fertig`,failed:`Fehlgeschlagen`,idle:`Inaktiv`,unknown:`Unbekannt`}},profiles:{title:`Profile`,subtitle:`Verwalten Sie Ihre Slicer-Voreinstellungen und Druckvorschub-Kalibrierungen`,tabs:{bambuCloud:`Bambu Cloud`,orcaCloud:`Orca Cloud`,local:`Lokale Profile`,kprofiles:`K-Profile`},orcaCloud:{connectedAs:`Verbunden als`,connectedShort:`Mit Orca Cloud verbunden`,logout:`Trennen`,noLogoutPermission:`Sie haben keine Berechtigung zum Trennen`,noConnectPermission:`Sie haben keine Berechtigung, sich mit Orca Cloud zu verbinden`,retry:`Erneut versuchen`,connectButton:`Orca Cloud verbinden`,connect:{title:`Mit Orca Cloud verbinden`,description:`Melden Sie sich bei Ihrem Orca Cloud-Konto an, um Ihre Slicer-Profile in Bambuddy zu synchronisieren.`},device:{title:`Bambuddy in Orca Cloud genehmigen`,instruction:`Öffnen Sie Orca Cloud und genehmigen Sie diesen Code. Bambuddy verbindet sich automatisch, sobald Sie genehmigt haben.`,codeLabel:`Ihr Kopplungscode`,openButton:`Orca Cloud-Genehmigungsseite öffnen`,manualHint:`Oder gehen Sie zu {{url}} und geben Sie den obigen Code ein.`,waiting:`Warte auf Ihre Genehmigung…`,cancel:`Abbrechen`},profiles:{title:`Ihre Orca Cloud-Profile ({{count}})`,refresh:`Aktualisieren`,empty:`Noch keine Profile in Ihrem Orca Cloud-Konto gefunden.`},toast:{disconnected:`Verbindung zu Orca Cloud getrennt`},errors:{startFailed:`Anmeldevorgang für Orca Cloud konnte nicht gestartet werden.`,denied:`Die Kopplung wurde in Orca Cloud abgelehnt.`,expired:`Der Kopplungscode ist abgelaufen. Klicken Sie auf Verbinden, um es erneut zu versuchen.`,pollFailed:`Die Verbindung ging beim Warten auf die Genehmigung verloren. Bitte versuchen Sie es erneut.`}},localProfiles:{title:`Lokale Profile`,subtitle:`Slicer-Voreinstellungen aus OrcaSlicer importieren und verwalten`,import:`Profile importieren`,importDesc:`.bbscfg-, .bbsflmt-, .orca_filament-, .zip- oder .json-Dateien hier ablegen`,importing:`Importiere...`,search:`Lokale Voreinstellungen durchsuchen...`,noPresets:`Noch keine lokalen Voreinstellungen`,noSearchResults:`Keine Voreinstellungen entsprechen deiner Suche`,badge:`Lokal`,edit:`Bearbeiten`,delete:`Löschen`,cancel:`Abbrechen`,deleteConfirmTitle:`Voreinstellung löschen`,deleteConfirm:`Möchten Sie diese Voreinstellung wirklich löschen? Dies kann nicht rückgängig gemacht werden.`,source:`Quelle`,inheritsFrom:`Erbt von`,filamentType:`Typ`,vendor:`Hersteller`,compatiblePrinters:`Drucker`,nozzleTemp:`Düsentemperatur`,cost:`Kosten`,density:`Dichte`,pressureAdvance:`Druckvorschub`,filament:`Filament`,process:`Prozess`,printer:`Drucker`,toast:{importSuccess:`{{count}} Voreinstellung(en) importiert`,importSkipped:`{{count}} Voreinstellung(en) übersprungen (Duplikate)`,importError:`{{count}} Fehler beim Import`,deleted:`Voreinstellung gelöscht`,updated:`Voreinstellung aktualisiert`}},connectedAs:`Verbunden als`,signInExpiredTitle:`Bambu-Cloud-Anmeldung abgelaufen`,signInExpiredBody:`Bambu Lab akzeptiert das gespeicherte Token nicht mehr. Melden Sie sich erneut an, um Cloud-Profile, MakerWorld-Importe und Firmware-Prüfungen wiederherzustellen.`,logout:`Abmelden`,noLogoutPermission:`Sie haben keine Berechtigung zum Abmelden`,failedToLoad:`Profile konnten nicht geladen werden`,retry:`Erneut versuchen`,time:{justNow:`Gerade eben`,minsAgo:`vor {{count}}m`,hoursAgo:`vor {{count}}h`,daysAgo:`vor {{count}}d`},toast:{loggedOut:`Abgemeldet`},login:{title:`Mit Bambu Cloud verbinden`,subtitle:`Synchronisieren Sie Ihre Slicer-Voreinstellungen geräteübergreifend`,email:`E-Mail`,password:`Passwort`,region:`Region`,regionGlobal:`Global`,regionChina:`China`,verificationCode:`Bestätigungscode`,totpCode:`Authenticator-Code`,checkEmail:`Prüfen Sie Ihre E-Mail ({{email}}) für einen 6-stelligen Code`,enterTotpHint:`Geben Sie den 6-stelligen Code aus Ihrer Authenticator-App ein`,accessToken:`Zugriffstoken`,accessTokenHint:`Fügen Sie Ihr Bambu-Cloud-Zugriffstoken ein. Konten der Region China müssen diesen Weg nutzen (telefonnummerngebunden — kein E-Mail-Login). Im Wiki steht, wie Sie das Token aus den MakerWorld-Cookies auslesen.`,back:`Zurück`,loginButton:`Anmelden`,verifyButton:`Bestätigen`,setTokenButton:`Token setzen`,useToken:`Stattdessen Zugriffstoken verwenden`,captchaTitle:`Bambu Cloud verlangt ein CAPTCHA`,captchaBody:`Bambu fordert für dein Netzwerk eine CAPTCHA-Prüfung, bevor eine Anmeldung akzeptiert wird, und diese Prüfung lässt sich aus Bambuddy heraus nicht beantworten. E-Mail und Passwort sind nicht das Problem. Die Sperre hängt an deiner öffentlichen IP-Adresse und löst sich normalerweise innerhalb weniger Stunden von selbst — wiederholte Versuche verlängern sie. Um dich jetzt anzumelden, verwende stattdessen ein Zugriffstoken aus einer Browser-Sitzung.`,useEmail:`Stattdessen mit E-Mail anmelden`,toast:{loggedIn:`Erfolgreich angemeldet`,codeSent:`Bestätigungscode an Ihre E-Mail gesendet`,enterTotp:`Geben Sie den Code aus Ihrer Authenticator-App ein`,tokenSet:`Token erfolgreich gesetzt`}},presets:{myPreset:`Mein Profil (bearbeitbar)`,duplicate:`Duplizieren`,editable:`Bearbeitbar`,failedToLoadDetails:`Profil-Details konnten nicht geladen werden`,deleteConfirm:`Dieses Profil löschen?`,deleteWarning:`"{{name}}" wird dauerhaft aus Bambu Cloud gelöscht. Dies kann nicht rückgängig gemacht werden.`,noDuplicatePermission:`Sie haben keine Berechtigung zum Duplizieren von Profilen`,noEditPermission:`Sie haben keine Berechtigung zum Bearbeiten von Profilen`,noDeletePermission:`Sie haben keine Berechtigung zum Löschen von Profilen`,types:{filament:`Filament-Profil`,printer:`Drucker-Profil`,process:`Prozess-Profil`},toast:{deleted:`Profil gelöscht`,created:`Profil erstellt`,updated:`Profil aktualisiert`,duplicated:`Profil dupliziert`,fieldAdded:`Feld "{{key}}" hinzugefügt`,exported:`Profil exportiert`},baseLabel:`Basis: {{name}}`,currentLabel:`Aktuell: {{name}}`,newPreset:`Neues Profil`,editPreset:`Profil bearbeiten`,duplicatePreset:`Profil duplizieren`,createNewPreset:`Neues Profil erstellen`,customizeSettings:`Passen Sie die Einstellungen für Ihr neues Profil an`,compareWithBase:`Mit Basis-Profil vergleichen`,compare:`Vergleichen`,basePreset:`Basis-Profil`,selectBasePreset:`Basis-Profil auswählen...`,presetName:`Profilname`,myCustomPreset:`Mein eigenes Profil`,inheritsFrom:`Erbt von`,dropJsonToImport:`JSON zum Importieren ablegen`,tabs:{common:`Allgemein`,allFields:`Alle Felder`},availableFields:`Verfügbare Felder`,searchFieldsPlaceholder:`Felder suchen...`,noMatchingFields:`Keine passenden Felder`,allFieldsAdded:`Alle Felder hinzugefügt`,addCustomField:`Eigenes Feld hinzufügen`,yourOverrides:`Ihre Überschreibungen`,noOverridesYet:`Noch keine Überschreibungen`,clickFieldsToAdd:`Klicken Sie links auf Felder, um sie hinzuzufügen`,saveAsTemplate:`Als Vorlage speichern`,jsonTip:`Tipp: Ziehen Sie eine .json-Datei auf dieses Fenster, um Einstellungen zu importieren`},cloudView:{searchPlaceholder:`Profile suchen...`,templates:`Vorlagen`,refresh:`Aktualisieren`,newPreset:`Neues Profil`,clearFilters:`Filter zurücksetzen`,compareMode:`Vergleichsmodus`,selectAnotherPreset:`Wählen Sie ein weiteres {{type}}-Profil`,clickTwoPresets:`Klicken Sie auf zwei Profile des gleichen Typs zum Vergleichen`,selectFirst:`1. Erstes auswählen`,selectSecond:`2. Zweites auswählen`,compareNow:`Jetzt vergleichen`,lastSynced:`Zuletzt synchronisiert:`,showingCount:`{{showing}} von {{total}} Profilen`,noPresetsFound:`Keine Profile gefunden`,columns:{filament:`Filament`,process:`Prozess`,printer:`Drucker`},noFilamentPresets:`Keine Filament-Profile`,noProcessPresets:`Keine Prozess-Profile`,noPrinterPresets:`Keine Drucker-Profile`,filters:{type:`Typ`,owner:`Besitzer`,printer:`Drucker`,nozzle:`Düse`,filament:`Filament`,layer:`Schicht`,all:`Alle`,myPresets:`Meine Profile`,builtIn:`Voreingestellt`,process:`Prozess`},noTemplatesPermission:`Sie haben keine Berechtigung, Vorlagen zu verwalten`,noRefreshPermission:`Sie haben keine Berechtigung, Profile zu aktualisieren`,noCreatePermission:`Sie haben keine Berechtigung, Profile zu erstellen`},templates:{title:`Schnellvorlagen`,noTemplates:`Noch keine Vorlagen`,createFirst:`Erstellen Sie Vorlagen aus dem Preset-Editor`,typeFilter:`Typ:`,deleteTitle:`Vorlage löschen`,deleteWarning:`Diese Aktion kann nicht rückgängig gemacht werden`,deleteConfirm:`Möchten Sie "{{name}}" wirklich löschen?`,namePlaceholder:`Vorlagenname`,descriptionPlaceholder:`Beschreibung`,settingsJson:`Einstellungen (JSON)`,fieldsCount:`{{count}} Felder`,shownInModals:`In Dialogen angezeigt`,hiddenInModals:`In Dialogen ausgeblendet`,apply:`Anwenden`,toast:{deleted:`Vorlage gelöscht`,updated:`Vorlage aktualisiert`,created:`Vorlage erstellt`,applied:`Vorlage angewendet`}}},support:{debugLoggingActive:`Debug-Protokollierung ist aktiv`,manageLogs:`Verwalten`,collectItem7:`Drucker-Verbindungsstatus und Firmware-Versionen`,collectItem8:`Integrationsstatus (Spoolman, MQTT, HA)`,collectItem9:`Netzwerkschnittstellen (nur Subnetze)`,collectItem10:`Python-Paketversionen`,collectItem11:`Datenbankzustandsprüfungen`,collectItem12:`Docker-Umgebungsdetails`,bundleGenerating:`Bundle wird erstellt...`,bundleStepConnection:`Drucker-Verbindungsprüfungen werden ausgeführt`,bundleStepVirtualPrinters:`Setup-Prüfungen für virtuelle Drucker werden ausgeführt`,bundleStepLogScan:`Aktuelle Protokolle werden auf bekannte Probleme überprüft`,bundleStepBuild:`Support-Bundle-ZIP wird erstellt`},fileManager:{combine:{action:`Zu 3MF kombinieren`,tooltip:`Die ausgewählten STLs zu einer 3MF kombinieren, um sie auf einer Platte zu slicen`,title:`Zu 3MF kombinieren`,description:`Erstellt eine 3MF mit allen unten aufgeführten Modellen, bereit zum Slicen auf einer Platte. Aktiviere beim Slicen das automatische Anordnen, um sie auf dem Druckbett zu verteilen.`,nameLabel:`Dateiname`,defaultName:`{{name}} + {{count}} weitere`,model:`Modell`,copies:`Kopien`,copiesFor:`Kopien von {{filename}}`,total:`Objekte auf der Platte: {{count}}`,tooMany:`Höchstens {{max}} Objekte pro Platte`,sliceNext:`Danach den Slicer öffnen`,submit:`Kombinieren`,done:`{{filename}} mit {{count}} Objekten erstellt`},variants:{badge:`{{count}} Versionen`,groupAction:`Als Versionen gruppieren`,groupTooltip:`Diese Dateien als denselben Auftrag markieren, gesliced für verschiedene Drucker`,grouped:`{{count}} Dateien als Versionen gruppiert`,printAlternatives:`Drucken ({{count}} Alternativen)`},title:`Dateimanager`,subtitle:`Organisieren und verwalten Sie Ihre Druckdateien`,uploadFiles:`Dateien hochladen`,newFolder:`Neuer Ordner`,folderName:`Ordnername`,folderNamePlaceholder:`z.B. Funktionsteile`,renameFile:`Datei umbenennen`,renameFolder:`Ordner umbenennen`,invalidFilenameChar:`Das Zeichen "{{char}}" ist in Druck-Dateinamen nicht erlaubt. Die SD-Karte des Druckers lehnt folgende Zeichen ab: < > : " / \\ | ? *`,moveFiles:`{{count}} Datei(en) verschieben`,rootNoFolder:`Stammverzeichnis (Kein Ordner)`,current:`aktuell`,linkFolder:`Ordner verknüpfen`,linkFolderDescription:`"{{name}}" mit einem Projekt oder Archiv verknüpfen für schnellen Zugriff.`,project:`Projekt`,archive:`Archiv`,noProjectsFound:`Keine Projekte gefunden`,noArchivesFound:`Keine Archive gefunden`,unlink:`Verknüpfung aufheben`,link:`Verknüpfen`,dragDropFiles:`Dateien hierher ziehen`,dropFilesHere:`Dateien hier ablegen`,releaseToUpload:`Loslassen zum Hochladen`,orClickToBrowse:`oder klicken zum Durchsuchen`,allFileTypesSupported:`Alle Dateitypen werden unterstützt. ZIP-Dateien werden extrahiert.`,zipFilesDetected:`ZIP-Dateien erkannt`,zipExtractOptions:`ZIP-Dateien werden extrahiert. Wählen Sie, wie die Ordnerstruktur behandelt werden soll:`,preserveZipStructure:`Ordnerstruktur aus ZIP beibehalten`,createFolderFromZip:`Ordner aus ZIP-Dateiname erstellen`,stlThumbnailGeneration:`STL-Vorschaubildgenerierung`,zipMayContainStl:`ZIP-Dateien können STL-Dateien enthalten. Vorschaubilder können während der Extraktion generiert werden.`,thumbnailsCanBeGenerated:`Vorschaubilder können für STL-Dateien generiert werden. Große Modelle benötigen möglicherweise mehr Zeit.`,generateThumbnailsForStl:`Vorschaubilder für STL-Dateien generieren`,threemfDetected:`3MF-Dateien erkannt`,threemfExtractionInfo:`Druckermodell, Material, Farbe und Druckeinstellungen werden automatisch aus 3MF-Dateien extrahiert.`,willBeExtracted:`Wird extrahiert`,filesExtracted:`{{count}} Dateien extrahiert`,uploadComplete:`Upload abgeschlossen: {{succeeded}} erfolgreich`,uploadFailed:`Hochladen fehlgeschlagen`,zipFilesFailed:`{{count}} Dateien fehlgeschlagen`,uploading:`Hochladen...`,changeLink:`Verknüpfung ändern...`,linkTo:`Verknüpfen mit...`,linkToProjectOrArchive:`Mit Projekt oder Archiv verknüpfen`,generateThumbnail:`Vorschaubild generieren`,generateThumbnails:`Vorschaubilder generieren`,generateThumbnailsForMissing:`Vorschaubilder für STL- und PDF-Dateien ohne Vorschau generieren`,gridView:`Rasteransicht`,listView:`Listenansicht`,columnsView:`Spaltenansicht`,lowDiskSpaceWarning:`Warnung: Wenig Speicherplatz`,lowDiskSpaceDetails:`Nur {{free}} frei von {{total}} gesamt. Schwellenwert ist auf {{threshold}} GB eingestellt.`,files:`Dateien`,folders:`Ordner`,size:`Größe`,free:`Frei`,allFiles:`Alle Dateien`,allExternal:`Extern`,externalIsEmpty:`Keine externen Dateien`,externalEmptyDescription:`Dateien aus deinen verknüpften externen Ordnern erscheinen hier.`,wrap:`Umbrechen`,enableTextWrapping:`Textumbruch aktivieren`,disableTextWrapping:`Textumbruch deaktivieren`,collapse:`Einklappen`,collapseFoldersByDefault:`Ordner standardmäßig einklappen`,expandFoldersByDefault:`Ordner standardmäßig ausklappen`,folderSort:`Ordner sortieren`,folderSortByName:`Nach Name`,folderSortByActivity:`Nach letzter Aktivität`,dragToResizeTooltip:`Ziehen zum Ändern der Größe, Doppelklick zum Zurücksetzen`,searchFiles:`Dateien suchen...`,searchSubfoldersHint:`Inklusive Unterordner`,readme:{truncated:`Gekürzt`,show:`README anzeigen`,hide:`README ausblenden`,label:`README`},tags:{title:`Tags`,subtitle:`Dateien mit Labels versehen — Spielzeug, kindersicher, nur PETG, was immer du willst.`,manage:`Tags`,manageTitle:`Tag-Katalog verwalten`,add:`Neuer Tag`,edit:`Tag umbenennen`,name:`Name`,fileCount:`Dateien`,empty:`Noch keine Tags. Erstelle einen, um Dateien zu kennzeichnen.`,noMatches:`Keine passenden Tags.`,createPlaceholder:`z. B. Spielzeug, kindersicher, petg`,createButton:`Erstellen`,nameRequired:`Name ist erforderlich.`,searchPlaceholder:`Tags filtern...`,created:`Tag erstellt.`,updated:`Tag umbenannt.`,deleted:`Tag entfernt.`,saveFailed:`Tag konnte nicht gespeichert werden.`,deleteFailed:`Tag konnte nicht entfernt werden.`,applyFailed:`Tags konnten nicht angewendet werden.`,applyAdd:`Tags hinzufügen`,applyRemove:`Tags entfernen`,applyAddSuccess:`{{count}} Tag(s) zu {{files}} Datei(en) hinzugefügt.`,applyRemoveSuccess:`{{count}} Tag(s) von {{files}} Datei(en) entfernt.`,actionAdd:`Zu ausgewählten Dateien hinzufügen`,actionRemove:`Von ausgewählten Dateien entfernen`,tagAction:`Tag`,bulkTitle:`{{count}} ausgewählte Datei(en) taggen`,bulkTooltip:`Tags für alle ausgewählten Dateien hinzufügen oder entfernen.`,noPermission:`Du hast keine Berechtigung, Dateien zu taggen.`,filterLabel:`Filtern nach:`,clearAll:`Alle entfernen`,confirmDelete:`Tag "{{name}}" löschen?`,confirmDeleteMessage:`Entfernt den Tag aus dem Katalog. Dateien behalten ihre übrigen Tags.`,confirmDeleteInUseMessage:`Dieser Tag ist auf {{count}} Datei(en). Beim Löschen verschwindet er von allen; die Dateien selbst bleiben unverändert.`,editAria:`{{name}} bearbeiten`,deleteAria:`{{name}} löschen`},allTypes:`Alle Typen`,prints:`Drucke`,ascending:`Aufsteigend`,descending:`Absteigend`,showModified:`Änderungsdatum anzeigen`,hideModified:`Änderungsdatum ausblenden`,lastModified:`Zuletzt geändert`,lastActivity:`Letzte Aktivität`,resultsCount:`{{showing}} von {{total}} Dateien`,selectAll:`Alle auswählen`,deselectAll:`Auswahl aufheben`,selected:`{{count}} ausgewählt`,adding:`Hinzufügen...`,loadingFiles:`Dateien werden geladen...`,folderIsEmpty:`Ordner ist leer`,noFilesOutsideFolders:`Keine Dateien außerhalb von Ordnern`,noFilesYet:`Noch keine Dateien`,folderEmptyDescription:`Laden Sie Dateien hoch oder verschieben Sie Dateien in diesen Ordner.`,noFilesDescription:`Laden Sie Dateien hoch, um Ihre Druckdateien zu organisieren.`,noMatchingFiles:`Keine passenden Dateien`,noMatchingFilesDescription:`Keine Dateien entsprechen Ihren aktuellen Such- oder Filterkriterien.`,clearFilters:`Filter zurücksetzen`,printedCount:`{{count}}x gedruckt`,uploadedBy:`Hochgeladen von`,deleteFolder:`Ordner löschen`,deleteFile:`Datei löschen`,deleteFilesCount:`{{count}} Dateien löschen`,deleteFolderConfirm:`Möchten Sie diesen Ordner wirklich löschen? Alle Dateien darin werden ebenfalls gelöscht.`,deleteFileConfirm:`Möchten Sie diese Datei wirklich löschen?`,deleteFilesConfirm:`Möchten Sie {{count}} ausgewählte Dateien wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.`,deleting:`Wird gelöscht...`,noPermissionRenameFolder:`Sie haben keine Berechtigung, Ordner umzubenennen`,noPermissionLinkFolder:`Sie haben keine Berechtigung, Ordner zu verknüpfen`,noPermissionDeleteFolder:`Sie haben keine Berechtigung, Ordner zu löschen`,onlyOwnFoldersDeletable:`Du kannst nur eigene Ordner löschen, in denen alles dir gehört, oder leere Ordner ohne Besitzer`,shareFolder:`Mit allen teilen`,unshareFolder:`Nicht mehr teilen`,shareFolderHint:`Geteilte Ordner sind für alle Benutzer sichtbar, die darin Dateien und Unterordner anlegen können`,sharedFolder:`Mit allen geteilt`,folderNotWritable:`Du kannst nur in eigene Ordner und mit allen geteilte Ordner hinzufügen`,noPermissionPrint:`Sie haben keine Berechtigung zum Drucken`,noPermissionSlice:`Sie haben keine Berechtigung, Dateien zu slicen`,noPermissionAddToQueue:`Sie haben keine Berechtigung, zur Warteschlange hinzuzufügen`,noPermissionDownload:`Sie haben keine Berechtigung, Dateien herunterzuladen`,noPermissionPreview:`Sie haben keine Berechtigung, Dateien in der Vorschau anzuzeigen`,preview3d:`3D-Vorschau`,preview:{open:`Vorschau`,error:`Für diese Datei ist keine Vorschau möglich.`,tooLarge:`Die Datei ist zu groß für eine Vorschau ({{size}}).`,page:`Seite {{current}} von {{total}}`,prevPage:`Vorherige Seite`,nextPage:`Nächste Seite`,zoomIn:`Vergrößern`,zoomOut:`Verkleinern`,resetZoom:`Zoom zurücksetzen`,fullscreen:`Vollbild`,exitFullscreen:`Vollbild beenden`,emptySheet:`Dieses Tabellenblatt ist leer`,truncatedRows:`Die ersten {{shown}} von {{total}} Zeilen werden angezeigt`,truncatedCols:`Die ersten {{shown}} von {{total}} Spalten werden angezeigt`},details:{title:`Dateidetails`,size:`Größe`,type:`Typ`,printName:`Druckname`,printTime:`Druckzeit`,filament:`Filament`,slicedFor:`Gesliced für`,source:`Quelle`,created:`Erstellt`,modified:`Geändert`,notes:`Notizen`,notesPlaceholder:`Druckeinstellungen, Tipps, was funktioniert hat...`,externalLink:`Externer Link`,externalLinkPlaceholder:`https://printables.com/model/...`,openLink:`Link öffnen`,photos:`Fotos`,addPhoto:`Foto hinzufügen`,noPhotos:`Noch keine Fotos`,deletePhoto:`Foto löschen`,photoCount_one:`{{count}} Foto`,photoCount_other:`{{count}} Fotos`,hasNotes:`Hat Notizen`,save:`Speichern`,saved:`Dateidetails gespeichert`,saveFailed:`Dateidetails konnten nicht gespeichert werden`,uploadFailed:`Foto konnte nicht hochgeladen werden`,deleteFailed:`Foto konnte nicht gelöscht werden`},noPermissionRenameFile:`Sie haben keine Berechtigung, diese Datei umzubenennen`,noPermissionGenerateThumbnail:`Sie haben keine Berechtigung, Vorschaubilder zu generieren`,noPermissionDeleteFile:`Sie haben keine Berechtigung, diese Datei zu löschen`,noPermissionCreateFolder:`Sie haben keine Berechtigung, Ordner zu erstellen`,noPermissionUpload:`Sie haben keine Berechtigung, Dateien hochzuladen`,noPermissionMoveFiles:`Sie haben keine Berechtigung, Dateien zu verschieben`,noPermissionDeleteFiles:`Sie haben keine Berechtigung, Dateien zu löschen`,linkExternal:`Extern verknüpfen`,linkExternalFolder:`Externen Ordner verknüpfen`,linkExternalFolderDescription:`Ein Host-Verzeichnis (NAS, USB, Netzlaufwerk) in den Dateimanager einbinden. Dateien werden nicht kopiert — sie werden direkt vom Originalpfad gelesen.`,externalFolderNamePlaceholder:`z.B. NAS-Drucke`,externalPath:`Host-Pfad`,externalPathHelp:`Absoluter Pfad zum Verzeichnis auf dem Docker-Host. Muss als Bind-Mount in den Container eingebunden sein.`,readOnly:`Nur Lesen`,readOnlyHelp:`verhindert Uploads und Löschungen`,showHiddenFiles:`Versteckte Dateien anzeigen (Punkt-Dateien)`,externalFolder:`Externer Ordner`,scanFolder:`Scannen`,toast:{folderCreated:`Ordner erstellt`,openInSlicerFailed:`Konnte nicht im Slicer öffnen`,folderDeleted:`Ordner gelöscht`,fileDeleted:`Datei gelöscht`,filesDeleted:`{{count}} Dateien gelöscht`,filesMoved:`Dateien verschoben`,folderLinked:`Ordner verknüpft`,folderUnlinked:`Ordnerverknüpfung aufgehoben`,externalFolderLinked:`Externer Ordner verknüpft und gescannt`,folderScanned:`Scan abgeschlossen: {{added}} hinzugefügt, {{removed}} entfernt`,addedToQueue:`{{count}} Datei(en) zur Warteschlange hinzugefügt`,addedToQueuePartial:`{{added}} Datei(en) hinzugefügt, {{failed}} fehlgeschlagen`,failedToAddToQueue:`Fehler beim Hinzufügen: {{error}}`,fileRenamed:`Datei umbenannt`,folderRenamed:`Ordner umbenannt`,folderShared:`Ordner mit allen geteilt`,folderUnshared:`Ordner wird nicht mehr geteilt`,thumbnailsGenerated:`{{count}} Vorschaubild(er) generiert`,thumbnailsGeneratedPartial:`{{succeeded}} Vorschaubild(er) generiert, {{failed}} fehlgeschlagen`,noStlMissingThumbnails:`Keine STL- oder PDF-Dateien ohne Vorschaubild`,failedToGenerateThumbnails:`Fehler beim Generieren der Vorschaubilder: {{error}}`,thumbnailGenerated:`Vorschaubild generiert`,failedToGenerateThumbnail:`Fehler beim Generieren des Vorschaubildes: {{error}}`}},projects:{parentLabel:`Übergeordnetes Projekt`,parentNone:`Keines (Hauptprojekt)`,parentHint:`Dieses Projekt einem anderen unterordnen, damit seine Zahlen in ein Hauptprojekt einfließen`,partOf:`Teil von {{name}}`,subProjectCount:`{{count}} Unterprojekte`,subProjectsOf:`Unterprojekte von {{name}}`,collapseSubProjects:`Unterprojekte einklappen`,expandSubProjects:`Unterprojekte ausklappen`,title:`Projekte`,subtitle:`Organisieren und verfolgen Sie Ihre 3D-Druckprojekte`,newProject:`Neues Projekt`,editProject:`Projekt bearbeiten`,deleteProject:`Projekt löschen`,projectName:`Projektname`,description:`Beschreibung`,noProjects:`Noch keine Projekte`,noProjectsFiltered:`Keine {{status}} Projekte`,noProjectsFilteredHelp:`Sie haben keine {{status}} Projekte. Projekte werden hier angezeigt, wenn sich ihr Status ändert.`,createFirst:`Erstellen Sie Ihr erstes Projekt, um verwandte Drucke zu organisieren, den Fortschritt zu verfolgen und Ihre Builds zu verwalten.`,createFirstButton:`Erstes Projekt erstellen`,create:`Erstellen`,files:`Dateien`,prints:`Drucke`,plates:`Platten`,parts:`Teile`,lastModified:`Zuletzt geändert`,deleteConfirm:`Möchten Sie dieses Projekt wirklich löschen? Archive und Warteschlangenelemente werden getrennt, aber nicht gelöscht.`,addFiles:`Dateien hinzufügen`,removeFile:`Datei entfernen`,viewDetails:`Details anzeigen`,namePlaceholder:`z.B. Voron 2.4 Build`,descriptionPlaceholder:`Optionale Beschreibung...`,urlLabel:`URL`,urlPlaceholder:`https://makerworld.com/...`,urlInvalid:`URL muss mit http:// oder https:// beginnen`,openExternalUrl:`Projekt-URL öffnen`,coverImageLabel:`Titelbild`,coverImageAlt:`Projekt-Titelbild`,coverImageUpload:`Hochladen`,coverImageReplace:`Ersetzen`,coverImageRemove:`Entfernen`,color:`Farbe`,targetPlates:`Ziel-Platten`,targetPlatesPlaceholder:`z.B. 25`,targetPlatesHelp:`Anzahl der Druckaufträge`,targetParts:`Ziel-Teile`,targetPartsPlaceholder:`z.B. 150`,targetPartsHelp:`Benötigte Objekte insgesamt`,targetSets:`Kopien pro Datei`,targetSetsPlaceholder:`z. B. 10`,targetSetsHelp:`Wie oft jede druckbare Datei gedruckt werden soll`,tagsLabel:`Tags (kommagetrennt)`,tagsPlaceholder:`z.B. voron, funktional, geschenk`,dueDate:`Fälligkeitsdatum`,priority:`Priorität`,priorityLow:`Niedrig`,priorityNormal:`Normal`,priorityHigh:`Hoch`,priorityUrgent:`Dringend`,statusActive:`Aktiv`,statusCompleted:`Abgeschlossen`,statusArchived:`Archiviert`,done:`Fertig`,completed:`abgeschlossen`,failed:`fehlgeschlagen`,inQueue:`in Warteschlange`,noPrintsYet:`Noch keine Drucke`,printJobs:`Druckaufträge (Platten)`,partsPrinted:`Gedruckte Teile`,failedParts:`Fehlgeschlagene Teile`,import:`Importieren`,export:`Exportieren`,importProject:`Projekt importieren`,exportAll:`Alle Projekte exportieren`,loading:`Projekte werden geladen...`,noEditPermission:`Sie haben keine Berechtigung, Projekte zu bearbeiten`,noDeletePermission:`Sie haben keine Berechtigung, Projekte zu löschen`,noCreatePermission:`Sie haben keine Berechtigung, Projekte zu erstellen`,noImportPermission:`Sie haben keine Berechtigung, Projekte zu importieren`,noExportPermission:`Sie haben keine Berechtigung, Projekte zu exportieren`,toast:{created:`Projekt erstellt`,updated:`Projekt aktualisiert`,deleted:`Projekt gelöscht`,imported:`Projekt importiert`,multipleImported:`{{count}} Projekte importiert`,importFailed:`Import fehlgeschlagen`,exported:`Projekte exportiert (nur Metadaten)`}},projectDetail:{notFound:`Projekt nicht gefunden`,backToProjects:`Zurück zu Projekten`,export:`Exportieren`,exportProject:`Projekt exportieren`,noExportPermission:`Sie haben keine Berechtigung, Projekte zu exportieren`,noEditPermission:`Sie haben keine Berechtigung, Projekte zu bearbeiten`,partOf:`Teil von:`,priorityLabel:`Priorität:`,noPrints:`Noch keine Drucke in diesem Projekt`,status:{active:`Aktiv`,completed:`Abgeschlossen`,archived:`Archiviert`},priority:{low:`Niedrig`,normal:`Normal`,high:`Hoch`,urgent:`Dringend`},dueDate:{overdue:`Überfällig`,today:`Heute fällig`,daysLeft:`{{count}} Tage übrig`},progress:{platesProgress:`Platten-Fortschritt`,partsProgress:`Teile-Fortschritt`,setsProgress:`Vollständige Sätze`,sets:`Sätze`,setsHint:`Ein Satz ist vollständig, wenn jede druckbare Datei diese Anzahl erreicht hat`,printJobs:`Druckaufträge`,parts:`Teile`,percentComplete:`{{percent}}% abgeschlossen`,remaining:`{{count}} verbleibend`},stats:{printJobs:`Druckaufträge`,total:`gesamt`,failed:`{{count}} fehlgeschlagen`,partsPrinted:`{{count}} Teile gedruckt`,printTime:`Druckzeit`,filamentUsed:`Filament verbraucht`},cost:{title:`Kostenverfolgung`,filamentCost:`Filamentkosten`,energy:`Energie`,totalCost:`Erwartete Gesamtkosten`,total:`Gesamt`,includesBom:`inkl. Stückliste`,wear:`Druckerverschleiß`,budget:`Budget`,remaining:`Verbleibend`},subProjects:{title:`Unterprojekte ({{count}})`,jobs:`{{count}} Aufträge`},rollup:{title:`Inklusive {{count}} Unterprojekten`,progress:`Gesamtfortschritt`,percentComplete:`{{percent}}% abgeschlossen`},notes:{title:`Notizen`,noEditPermission:`Sie haben keine Berechtigung, Notizen zu bearbeiten`,placeholder:`Notizen zu diesem Projekt hinzufügen...`,empty:`Noch keine Notizen. Klicken Sie auf Bearbeiten, um Notizen hinzuzufügen.`},files:{title:`Dateien`,linkFolders:`Ordner aus dem Dateimanager verknüpfen`,forQuickAccess:`für schnellen Zugriff auf dieses Projekt.`,fileCount:`{{count}} Datei(en)`,empty:`Keine Ordner verknüpft. Gehen Sie zum Dateimanager und verknüpfen Sie einen Ordner mit diesem Projekt.`,printedCount:`{{count}}-mal gedruckt`,progressTooltip:`{{done}} von {{target}} abgeschlossenen Drucken`,noFiles:`Keine Dateien in diesem Ordner.`},bom:{title:`Stückliste`,acquired:`{{completed}}/{{total}} beschafft`,showAll:`Alle anzeigen`,hideDone:`Erledigte ausblenden`,addPart:`Teil hinzufügen`,noAddPermission:`Sie haben keine Berechtigung, Teile hinzuzufügen`,partNamePlaceholder:`Teilename (z.B. M3x8 Schrauben)`,partName:`Teilename`,qty:`Menge`,price:`Preis ({{currency}})`,sourcingUrlPlaceholder:`Bezugsquelle-URL (optional)`,remarksPlaceholder:`Bemerkungen (optional)`,deletePart:`Teil löschen`,deleteConfirm:`Möchten Sie "{{name}}" wirklich löschen?`,noUpdatePermission:`Sie haben keine Berechtigung, Teile zu aktualisieren`,noEditPermission:`Sie haben keine Berechtigung, Teile zu bearbeiten`,noDeletePermission:`Sie haben keine Berechtigung, Teile zu löschen`,totalCost:`Gesamtkosten:`,empty:`Keine Teile in der Stückliste. Fügen Sie Hardware, Elektronik oder andere Komponenten hinzu, um zu verfolgen, was beschafft werden muss.`},timeline:{title:`Aktivitätsverlauf`,empty:`Noch keine Aktivität.`},template:{saveAsTemplate:`Als Vorlage speichern`,noCreatePermission:`Sie haben keine Berechtigung, Vorlagen zu erstellen`},queue:{title:`Warteschlange`,viewAll:`Alle anzeigen`,printing:`{{count}} druckend`,queued:`{{count}} in Warteschlange`},prints:{title:`Drucke ({{count}})`},toast:{projectUpdated:`Projekt aktualisiert`,partAdded:`Teil hinzugefügt`,partRemoved:`Teil entfernt`,exportFailed:`Export fehlgeschlagen`,projectExported:`Projekt exportiert`,templateCreated:`Vorlage erstellt`}},system:{title:`Systeminformationen`,version:`Version`,uptime:`Laufzeit`,cpuUsage:`CPU-Auslastung`,memoryUsage:`Speicherauslastung`,diskUsage:`Festplattenauslastung`,networkInfo:`Netzwerkinformationen`,logs:`Protokolle`,debugMode:`Debug-Modus`,enableDebug:`Debug-Protokollierung aktivieren`,disableDebug:`Debug-Protokollierung deaktivieren`,downloadLogs:`Protokolle herunterladen`,clearLogs:`Protokolle löschen`,dockerInfo:`Docker-Info`,containerName:`Container-Name`,imageName:`Image-Name`,platform:`Plattform`,architecture:`Architektur`},sponsors:{sectionTitle:`Unabhängig & von der Community finanziert`,tagline:`Bambuddy ist kostenlos und bleibt es, weil Menschen es freiwillig unterstützen. Kein VC, kein Cloud-Zwang.`,viewSupporters:`Unterstützer ansehen`,toastPrints:`Du hast {{count}} Drucke mit Bambuddy abgeschlossen. Bambuddy bleibt kostenlos dank seiner Unterstützer.`,toastCost:`Du hast {{total}} an Filament mit Bambuddy verfolgt. Sieh dir an, wer das Projekt unabhängig hält.`,toastArchives:`{{count}} Drucke mit Bambuddy archiviert. Sieh dir an, wer es unabhängig hält.`,toastAnniversary:`Ein Jahr mit Bambuddy! Sieh dir an, wer das Projekt unabhängig hält.`,toastVersionUpdate:`Aktualisiert auf v{{version}}. Bambuddy bleibt kostenlos dank seiner Unterstützer.`,toastBusiness:`Sie betreiben Bambuddy auf {{count}} Druckern. Für Teams gibt es Support-Pakete – bevorzugte Fehlerbehebung, Rechnungsstellung und einen direkten Draht zum Maintainer.`,businessCta:`Bambuddy für Unternehmen`,businessTitle:`Bambuddy für Unternehmen`,businessTagline:`Sie betreiben {{count}} Drucker. Für Teams und Druckfarmen gibt es priorisierten Support, kommerzielle Lizenzen und Rechnungsstellung.`},library:{title:`Filament-Bibliothek`,addFilament:`Filament hinzufügen`,editFilament:`Filament bearbeiten`,deleteFilament:`Filament löschen`,vendor:`Hersteller`,material:`Material`,color:`Farbe`,kFactor:`K-Faktor`,temperature:`Temperatur`,noFilaments:`Keine Filamente in der Bibliothek`,deleteConfirm:`Möchten Sie dieses Filament wirklich löschen?`,importFromPrinter:`Vom Drucker importieren`,exportToFile:`In Datei exportieren`,runWithPipeline:{actionLabel:`Mit Pipeline ausführen`,noPermission:`Du hast keine Berechtigung, Pipelines auszuführen`,modalTitle:`Mit Pipeline ausführen`,confirmTitle:`Lauf bestätigen`,confirmIntro:`Pre-Flight hat Probleme mit diesem Lauf gefunden`,sourceHint:`Quelle`,pipelineHint:`Pipeline`,targetHint:`Ziel`,pipelineListAria:`Verfügbare Pipelines`,runAnyway:`Trotzdem ausführen`,loading:`Wird geladen…`,empty:`Noch keine Pipelines gespeichert. Öffne den Slice-Dialog und klicke „Als Pipeline speichern“, um eine zu erstellen.`,noTarget:`Kein Zieldrucker festgelegt`,noTargetMessage:`Diese Pipeline hat keinen Zieldrucker. Öffne sie in den Einstellungen, um einen festzulegen.`,copies:`Kopien`,copiesHint:`max. {{n}}`,classTarget:`Beliebiger {{model}}`,toast:{started:`Pipeline-Lauf gestartet`,failed:`Lauf konnte nicht gestartet werden`},issue:{printerNotSet:`Kein Zieldrucker für diese Pipeline festgelegt.`,printerNotFound:`Zieldrucker existiert nicht mehr.`,printerDisabled:`Zieldrucker ist deaktiviert.`,printerOffline:`Zieldrucker ist offline.`,filamentType:`Filament-Slot {{slot}}: erwartet {{expected}}, AMS hat {{actual}}`,filamentColor:`Filament-Slot {{slot}}: Farbe weicht ab (erwartet {{expected}}, AMS hat {{actual}})`,amsSlotMissing:`AMS-Slot {{slot}} ist auf diesem Drucker nicht verfügbar`,filamentUnverified:`Filament-Slot {{slot}} stammt aus einem Cloud-/Standard-Preset und konnte nicht statisch verifiziert werden.`,noClassMatches:`Keine Drucker in dieser Installation entsprechen der Zielmodellklasse der Pipeline ({{expected}}).`,classNotSet:`Pipeline-Ziel ist auf eine Druckerklasse gesetzt, aber kein Modell wurde gewählt.`}}},slicerSettings:{presetValuesOutdatedSidecar:`Es werden Slicer-Standardwerte angezeigt: Ihr Slicer-Sidecar ist älter als diese Funktion und kann die Werte eines Profils nicht liefern. Aktualisieren Sie das Sidecar-Image, um sie zu sehen. Alles, was Sie nicht ändern, verwendet weiterhin das Profil.`,presetValuesNotConfigured:`Es werden Slicer-Standardwerte angezeigt: Es ist kein Slicer-Sidecar konfiguriert, daher können die Werte eines Profils nicht gelesen werden. Alles, was Sie nicht ändern, verwendet weiterhin das Profil.`,presetValuesSidecarUnavailable:`Es werden Slicer-Standardwerte angezeigt: Das Slicer-Sidecar hat nicht geantwortet, daher können die Werte eines Profils nicht gelesen werden. Alles, was Sie nicht ändern, verwendet weiterhin das Profil.`,presetValuesUnavailable:`Es werden Slicer-Standardwerte angezeigt: Die Werte des gewählten Profils konnten nicht gelesen werden. Alles, was Sie nicht ändern, verwendet weiterhin das Profil.`,filamentDefault:`Standard`,fromFile:`aus Datei`,fromFileHint:`Der Designer hat dies in der Quelldatei geändert. Wert: {{value}}.`,fromFilePrinterCoupled:`Drucker des Designers`,fromFilePrinterCoupledHint:`Auf den Drucker abgestimmt, für den diese Datei erstellt wurde – auf Ihrem kann der Wert falsch oder außerhalb des Bereichs sein.`,fromFileOverridesPreset:`überschreibt Preset`,fromFileOverridesPresetHint:`Die Datei setzt hier {{value}}, das gewählte Preset verwendet {{preset}}. Nur aktivieren, wenn die Datei Vorrang haben soll.`,useFromFile:`Wert aus der Quelldatei für {{option}} verwenden`,otherFromFile:`Weitere Einstellungen aus dieser Datei`,fromFileSummary:`Der Designer hat in dieser Datei {{count}} Prozesseinstellungen geändert. Verwendet werden nur die, die du ankreuzt.`,fromFileUseAll:`Einstellungen des Designers übernehmen`,fromFileUseAllHint:`Kreuzt die Einstellungen an, die sich auf andere Drucker übertragen lassen. Die auf den Drucker des Designers abgestimmten und die, die dein gewähltes Preset ausmachen, bleiben aus.`,fromFileClear:`{{count}} zurücksetzen`,loading:`Slicer-Einstellungen werden geladen…`,mode:{simple:`Einfach`,advanced:`Erweitert`,expert:`Experte`},searchPlaceholder:`Einstellungen suchen`,resetAll:`{{count}} zurücksetzen`,resetOption:`Auf Standard zurücksetzen`,noMatches:`Keine Einstellungen passen zu dieser Suche.`},slice:{filamentSlotUnset:`nicht gewählt`,processSettingsEmbedded:`Wird nicht verwendet, solange „Integrierte Einstellungen der Datei verwenden“ aktiv ist – die Einstellungen der Datei bestimmen diesen Slice.`,processSettingsInactive:`Inaktiv`,presetsHidden:`{{count}} ausgeblendet`,showAllPresets:`Alle anzeigen`,showFewerPresets:`Weniger anzeigen`,processSettings:`Prozesseinstellungen`,processSettingsHint:`Passen Sie das gewählte Profil für diesen Slice an. Alles, was Sie nicht ändern, bleibt wie im Profil definiert.`,processSettingsChanged:`{{count}} geändert`,processSettingsUnchanged:`Profilstandard`,title:`Modell slicen`,action:`Slicen`,actionAll:`Alle {{count}} Plates slicen`,actionAllTitle:`Alle Plates in eine einzelne Multi-Plate-Ausgabe slicen (ein Archiv). Die Filamentauswahl gilt für jeden Slot des Projekts.`,allPlatesToggle:`Alle {{count}} Plates slicen`,slicing:`Slicen…`,printer:`Drucker-Profil`,process:`Prozess-Profil`,filament:`Filament-Profil`,filamentSlot:`Filament {{index}} – {{type}}`,filamentColour:`Filamentfarbe`,selectPreset:`— Profil auswählen —`,loadingPresets:`Profile werden geladen…`,analyzingPlateFilaments:`Plattenfilamente werden analysiert…`,analyzingPlateFilamentsHint:`Es wird ein Probeschnitt ausgeführt, um die belegten AMS-Slots dieser Platte zu ermitteln. Wird zwischengespeichert — erneutes Öffnen ist sofort.`,previewToast:`{{name}} wird analysiert — {{elapsed}}`,previewWithProgress:`{{name}} wird analysiert — {{stage}} ({{percent}}%) — {{elapsed}}`,notUsedByPlate:`— wird von dieser Platte nicht verwendet`,noPresetsForSlot:`Keine Profile verfügbar`,otherPrinters:`Andere Drucker`,presetsLoadFailed:`Profile konnten nicht geladen werden. Importiere sie zuerst unter Einstellungen → Profile.`,refreshPresets:`Aktualisieren`,refreshPresetsTitle:`Profile neu laden — die aktuellen Cloud- und Bundle-Listen abrufen (nach dem Löschen eines Profils in Bambu Studio oder Bambu Handy verwenden)`,allPresetsRequired:`Alle Profile müssen ausgewählt sein`,useEmbedded:`Eingebettete Einstellungen der Datei verwenden`,useEmbeddedHint:`So slicen, wie der Ersteller es angelegt hat (Wände, Füllung, Filament), statt mit den obigen Profilen. Verfügbar, weil dein Drucker zur Datei passt.`,autoOrient:`Objekte automatisch ausrichten`,autoOrientHint:`Der Slicer dreht jedes Objekt zuerst auf die am besten druckbare Seite. Überschreibt die Ausrichtung aus der Datei.`,autoArrange:`Automatisch auf dem Druckbett anordnen`,autoArrangeHint:`Der Slicer verteilt die Objekte so, dass sie sich nicht mehr überlappen. Ersetzt die Anordnung aus der Datei.`,enqueuing:`Slice-Auftrag wird übermittelt…`,queued:`In Warteschlange…`,failed:`Slicen fehlgeschlagen. Logs des Slicer-Sidecars prüfen.`,startedToast:`{{name}} wird im Hintergrund gesliced…`,queuedToast:`Warteschlange: {{name}} — {{elapsed}}`,runningToast:`{{name}} wird gesliced — {{elapsed}}`,runningWithProgress:`{{name}} – {{stage}} ({{percent}} %) – {{elapsed}}`,runningWithProgressMultiPlate:`Plate {{plateIndex}} von {{plateCount}} • {{name}} – {{stage}} ({{percent}} %) – {{elapsed}}`,completedToast:`{{name}} wurde gesliced`,externalWriteFallbackToast:`In der internen Bibliothek gespeichert: In den externen Ordner konnte nicht geschrieben werden`,failedTitle:`Slicen fehlgeschlagen`,failedToast:`Slicen von {{name}} fehlgeschlagen: {{detail}}`,tier:{local:`Importiert`,cloud:`Bambu Cloud`,orcaCloud:`Orca Cloud`,standard:`Standard`},cloud:{notAuthenticated:`In Bambu Cloud anmelden (Einstellungen → Profile → Bambu Cloud), um deine Cloud-Profile zu sehen.`,expired:`Bambu-Cloud-Sitzung abgelaufen — erneut anmelden, um die Cloud-Profile zu aktualisieren.`,unreachable:`Bambu Cloud ist gerade nicht erreichbar. Lokale und Standard-Profile funktionieren weiterhin.`},orcaCloud:{notAuthenticated:`Bei Orca Cloud anmelden (Profile → Orca Cloud), um Ihre Orca-Profile zu sehen.`,expired:`Orca Cloud-Sitzung abgelaufen — erneut anmelden, um die Orca-Profile zu aktualisieren.`,unreachable:`Orca Cloud ist derzeit nicht erreichbar. Andere Profile funktionieren weiterhin.`},bedType:{label:`Druckbett`,auto:`Auto (aus Prozess-Profil)`,coolPlate:`Cool Plate`,coolPlateSuperTack:`Cool Plate SuperTack`,engineering:`Engineering Plate`,highTemp:`High Temp Plate`,texturedPEI:`Textured PEI Plate`,smoothPEI:`Smooth PEI Plate`},filters:{onlyConnectedModels:`Nur Drucker, die online sind`,onlyConnectedModelsHint:`Druckerprofile für die gerade verbundenen Modelle, in jeder Düsengröße.`,onlyLoadedSpools:`Nur eingelegte Spulen`,onlyLoadedSpoolsHint:`Filamentprofile der Spulen in den verbundenen Druckern des gewählten Modells. Ein selbst gewähltes Profil bleibt erhalten.`,noneOnline:`Kein Drucker ist online, daher werden alle Profile angezeigt.`,noneLoaded:`Keine eingelegte Spule hat ein Profil für diesen Drucker, daher werden alle Filamentprofile angezeigt.`,notOnline:`Nicht online`,notLoaded:`Nicht eingelegt`},loadedSpools:{title:`Eingelegte Spulen`,pick:`Wählen`,pickTitle:`Eine Spule aus einem verbundenen Drucker wählen`,none:`Kein Drucker dieses Modells ist online.`,nothingLoaded:`Kein AMS und keine externe Spule.`,unknownSpool:`Unbekannte Spule`,empty:`Leer`,noProfile:`Kein Profil für den gewählten Drucker`,noProfileShort:`Kein Profil für diesen Drucker`},pipelines:{label:`Pipeline`,applyAria:`Pipeline anwenden`,applyPrompt:`Pipeline anwenden…`,empty:`Keine gespeicherten Pipelines`,saveButton:`Als Pipeline speichern`,saveTitle:`Aktuelle Auswahl aller vier Slots als wiederverwendbare Pipeline speichern`,namePlaceholder:`Pipeline-Name`,nameAria:`Neuer Pipeline-Name`,toast:{applied:`„{{name}}“ angewendet`,saved:`Pipeline gespeichert`,saveFailed:`Speichern fehlgeschlagen`}}},spoolman:{title:`Spoolman-Integration`,enabled:`Spoolman aktiviert`,url:`Spoolman URL`,connected:`Verbunden`,disconnected:`Nicht verbunden`,testConnection:`Verbindung testen`,sync:`Synchronisieren`,syncing:`Synchronisiert...`,lastSync:`Letzte Synchronisierung`,linkToSpoolman:`Mit Spoolman verknüpfen`,openInSpoolman:`In Spoolman öffnen`,unlinkSpool:`Spule trennen`,unlinkConfirmTitle:`Spule entfernen?`,unlinkConfirmMessage:`Die Spule wird vom Slot entfernt. Die Spulendaten selbst bleiben unverändert.`,selectSpool:`Spule auswählen`,noUnlinkedSpools:`Keine nicht zugewiesenen Spulen verfügbar`,linkSuccess:`Spule erfolgreich zugewiesen`,linkFailed:`Spule konnte nicht zugewiesen werden`,unlinkSuccess:`Spule erfolgreich entfernt`,unlinkFailed:`Spule konnte nicht entfernt werden`,linkedSpool:`Zugewiesene Spule`,spoolId:`Spulen-ID`,fillSourceLabel:`(Spoolman)`,weight:`Gewicht`,remaining:`Verbleibend`,disableWeightSync:`AMS-Gewichtsschätzung deaktivieren`,disableWeightSyncDesc:`Verbleibende Kapazität nicht aus AMS-Schätzungen aktualisieren. Verwenden Sie dies, wenn Sie die Verbrauchserfassung von Spoolman gegenüber den prozentualen AMS-Schätzungen bevorzugen. Neue Spulen verwenden weiterhin die AMS-Schätzung als Anfangsgewicht.`,reportPartialUsage:`Teilverbrauch bei fehlgeschlagenen Drucken melden`,reportPartialUsageDesc:`Wenn ein Druck fehlschlägt oder abgebrochen wird, den geschätzten Filamentverbrauch bis zu diesem Zeitpunkt basierend auf dem Schichtfortschritt melden.`},locations:{title:`Lagerorte`,subtitle:`Regale, Schubladen und andere physische Lagerplätze für Spulen verwalten`,add:`Lagerort hinzufügen`,addShort:`Hinzufügen`,edit:`Lagerort bearbeiten`,name:`Name`,spools:`Spulen`,sensors:`Sensoren`,empty:`Noch keine Lagerorte. Erstellen Sie Ihr erstes Regal oder Ihre erste Schublade.`,manage:`Lagerorte`,createPlaceholder:`z. B. Regal A, Schublade 1`,nameRequired:`Name des Lagerorts ist erforderlich`,created:`Lagerort erstellt`,updated:`Lagerort aktualisiert`,deleted:`Lagerort gelöscht`,saveFailed:`Lagerort konnte nicht gespeichert werden`,deleteFailed:`Lagerort konnte nicht gelöscht werden`,deleteBlocked:`Entfernen Sie zuerst alle Spulen von diesem Lagerort`,confirmDelete:`„{{name}}“ löschen?`,confirmDeleteMessage:`Dieser Lagerort wird aus dem Katalog entfernt. Spulen müssen zuerst verschoben werden.`,confirmDeleteMessageWithSensors:`Dieser Lagerort wird aus dem Katalog entfernt. Spulen müssen zuerst verschoben werden. Verbundene Sensoren werden ebenfalls gelöscht.`},inventory:{title:`Spulen-Inventar`,subtitle:`Verwalten Sie Ihre Spulen`,addToInventory:`Zum Inventar hinzufügen`,addToInventoryPending:`Wird hinzugefügt...`,addToInventorySuccess:`Spule zum Inventar hinzugefügt`,addToInventoryFailed:`Spule konnte nicht zum Inventar hinzugefügt werden`,unknownSpoolTitle:`Neues Filament erkannt`,unknownSpoolMessage:`An {{location}} wurde eine Spule mit unbekanntem RFID-Tag erkannt. Jetzt zum Inventar hinzufügen?`,unknownSpoolSlot:`Slot`,bulk:{selectAllVisible:`Alle sichtbaren auswählen`,selectRow:`Zeile auswählen`,selectGroup:`Gruppe auswählen`,selectionCount:`{{count}} ausgewählt`,edit:`Bearbeiten`,printLabels:`Etiketten drucken`,resetUsage:`Verbrauch zurücksetzen`,restore:`Wiederherstellen`,archive:`Archivieren`,delete:`Löschen`,clearSelection:`Auswahl aufheben`,editTitle:`Spulen sammelbearbeiten`,editSubtitle:`Wird auf {{count}} ausgewählte Spulen angewendet. Nur angekreuzte Felder werden aktualisiert.`,editHint:`In ein Feld tippen markiert es für die Aktualisierung — nur angekreuzte Zeilen werden gesendet. Leere Felder bleiben unverändert (Felder leeren geht nur pro Spule).`,useCustom:`„{{value}}" verwenden`,toggleField:`Aktualisierung für dieses Feld umschalten`,changeCount:`{{count}} Felder werden aktualisiert.`,applyPending:`Wird angewendet...`,applyButton:`Auf {{count}} Spulen anwenden`,deleteTitle:`Ausgewählte Spulen löschen`,archiveTitle:`Ausgewählte Spulen archivieren`,restoreTitle:`Ausgewählte Spulen wiederherstellen`,resetUsageTitle:`Verbrauch ausgewählter Spulen zurücksetzen`,deleteMessage:`{{count}} Spulen dauerhaft löschen? Dies kann nicht rückgängig gemacht werden.`,archiveMessage:`{{count}} Spulen archivieren? Sie können später wiederhergestellt werden.`,restoreMessage:`{{count}} archivierte Spulen wiederherstellen?`,resetUsageMessage:`Den "Gesamtverbrauch"-Zähler auf {{count}} Spulen zurücksetzen? Die verbleibende Menge bleibt erhalten.`,updateSuccess:`{{count}} Spulen aktualisiert`,updateFailed:`Sammelaktualisierung fehlgeschlagen`,updatePartial:`{{ok}} Spulen aktualisiert, {{failed}} fehlgeschlagen`,updateAllFailed:`Alle {{count}} Aktualisierungen fehlgeschlagen — Auswahl bleibt erhalten zum erneuten Versuch`,deleteSuccess:`{{count}} Spulen gelöscht`,deleteFailed:`Sammellöschung fehlgeschlagen`,deletePartial:`{{ok}} Spulen gelöscht, {{failed}} fehlgeschlagen`,deleteAllFailed:`Alle {{count}} Löschungen fehlgeschlagen — Auswahl bleibt erhalten zum erneuten Versuch`,archiveSuccess:`{{count}} Spulen archiviert`,archiveFailed:`Sammelarchivierung fehlgeschlagen`,archivePartial:`{{ok}} Spulen archiviert, {{failed}} fehlgeschlagen`,archiveAllFailed:`Alle {{count}} Archivierungen fehlgeschlagen — Auswahl bleibt erhalten zum erneuten Versuch`,restoreSuccess:`{{count}} Spulen wiederhergestellt`,restoreFailed:`Sammelwiederherstellung fehlgeschlagen`,restorePartial:`{{ok}} Spulen wiederhergestellt, {{failed}} fehlgeschlagen`,restoreAllFailed:`Alle {{count}} Wiederherstellungen fehlgeschlagen — Auswahl bleibt erhalten zum erneuten Versuch`,invalidHex:`6 Hex-Zeichen (RRGGBB) oder 8 (RRGGBBAA) eingeben. Anderenfalls wird das Feld nicht übernommen.`},spoolmanMixedContentTitle:`Spoolman lässt sich nicht über HTTPS laden — Browser blockiert gemischte Inhalte`,spoolmanMixedContentBody:`Bambuddy wird über HTTPS ausgeliefert (über deinen Reverse-Proxy), aber deine Spoolman-URL ist nach wie vor HTTP. Browser blockieren gemischte Inhalte aus Sicherheitsgründen, daher kann die eingebettete Spoolman-Oberfläche nicht geladen werden. Spoolman muss ebenfalls über HTTPS erreichbar sein.`,spoolmanMixedContentFixReverseProxy:`Stelle Spoolman hinter denselben Reverse-Proxy wie Bambuddy (Traefik / Nginx / Caddy) mit HTTPS und aktualisiere die Spoolman-URL in den Einstellungen auf die neue HTTPS-Adresse.`,spoolmanMixedContentFixOpenNewTab:`Als Workaround kannst du Spoolman in einem neuen Tab über HTTP öffnen — gemischte Inhalte werden nur innerhalb eingebetteter Frames blockiert, ein eigener Tab funktioniert weiterhin.`,spoolmanOpenInNewTab:`Spoolman in neuem Tab öffnen`,labels:{title:`Spulen-Etiketten drucken`,selectedCount:`{{count}} ausgewählt`,pickSpools:`Wählen Sie, für welche Spulen Etiketten gedruckt werden sollen:`,monochrome:`Monochrom (Schwarz-Weiß-Drucker)`,monochromeHint:`Entfernt das Farbfeld und verbreitert den Text`,startingPosition:`Startposition des Etiketts`,startingPositionInvalid:`Gib eine ganze Zahl zwischen 1 und {{capacity}} ein.`,startingPositionFirst:`Der Druck beginnt bei Position 1.`,startingPositionSkipped:`Die Positionen 1 bis {{lastPosition}} bleiben auf dem ersten Bogen leer.`,searchPlaceholder:`Name, Marke oder #ID suchen`,filterByMaterial:`Material:`,allMaterials:`Alle`,selectVisible:`Alle sichtbaren auswählen ({{count}})`,deselectVisible:`Sichtbare abwählen`,clearAll:`Alle entfernen`,noSpoolsToShow:`Keine Spulen anzuzeigen. Filter anpassen und erneut versuchen.`,noMatches:`Keine Spulen entsprechen der aktuellen Suche oder dem Filter.`,printOne:`Etikett für diese Spule drucken`,printLabels:`Etiketten drucken…`,bulkTitle:`Spulen aus den aktuell angezeigten {{count}} zum Etikettieren auswählen`,noSpoolsTitle:`Keine Spulen zum Etikettieren`,error:`Etiketten konnten nicht erstellt werden: {{msg}}`,template:`Etikettengröße`,preview:`Vorschau`,previewOf:`Vorschau von #{{id}}`,previewNoSelection:`Wähle eine Spule, um ihr Etikett zu sehen.`,previewError:`Vorschau konnte nicht erstellt werden: {{msg}}`,previewAlt:`Etikettenvorschau`,previewHint:`Zeilen, die auf diese Etikettengröße nicht passen, werden weggelassen.`,content:`Auf das Etikett drucken`,resetFields:`Auf Standard zurücksetzen`,format:`Ausgabe:`,dpi:`Auflösung`,pngHint:`Für Etikettendrucker-Software, die Bilder verarbeitet. Wähle die Auflösung deines Druckers; mehrere Etiketten kommen als ZIP.`,createPdf:`PDF erstellen`,downloadPng:`PNG herunterladen`,selectedTitle:`Etiketten für die {{count}} ausgewählten Spulen drucken`,fields:{brand:`Marke`,material:`Material und Untertyp`,hex:`Farbcode`,name:`Farb- oder Filamentname`,location:`Lagerort`,materialNumber:`Materialnummer`,temps:`Düsentemperatur`,weight:`Nettogewicht`,note:`Notiz`,added:`Hinzugefügt am`,qr:`QR-Code`,spoolId:`Spulen-ID`},sortBy:{label:`Sortieren:`,id:`Nach ID`,color:`Nach Farbe`},templates:{amsHolderSmall:{label:`AMS-Halter — klein (74 × 33 mm)`,hint:`Ein Etikett pro Seite; passt zum druckbaren Etikett aus dem MakerWorld-Modell 752566 (AMS-Filament-Etikettenhalter).`},amsHolderLarge:{label:`AMS-Halter — groß (75 × 55 mm)`,hint:`Ein Etikett pro Seite; passt zur Kartoneinleger-Variante des AMS-Filament-Etikettenhalters. Genug Platz für Farbprobe, Marke, Material, ID und QR-Code.`},box40x30:{label:`Boxetikett (40 × 30 mm)`,hint:`Ein Etikett pro Seite; gängige DK/Brother-Rollengröße, ideal für Filament-Beutel und Lager-Etiketten.`},box:{label:`Box label (62 × 29 mm)`,hint:`Ein Etikett pro Seite; für Brother PT/QL und Dymo-Kleinetiketten dimensioniert.`},averyL7160:{label:`Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)`,hint:`EU-Bogenformat; 21 Etiketten pro A4-Seite.`},avery5160:{label:`Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)`,hint:`US-Bogenformat; 30 Etiketten pro Letter-Seite.`}}},csv:{importButton:`CSV importieren`,exportButton:`CSV exportieren`,modalTitle:`Spulen aus CSV importieren`,selectFile:`CSV-Datei auswählen oder hierher ziehen`,dragHint:`Kopfzeile: material (erforderlich), brand, subtype, color_name, rgba, …`,parsing:`Datei wird gelesen…`,previewError:`CSV-Datei konnte nicht gelesen werden`,validCount:`{{count}} gültig`,errorCount:`{{count}} Fehler`,skippedCount:`{{count}} übersprungen`,colRow:`Zeile`,colStatus:`Status`,colColor:`Farbe`,colorResolved:`Farbe aus Katalog übernommen`,colorCrossMaterial:`Farbe von einem anderen Material übernommen — keine exakte Übereinstimmung im Katalog`,duplicateExisting:`Eine Spule mit diesem Material, dieser Marke und Farbe existiert bereits — sie wird trotzdem als neue Spule importiert`,spoolmanHint:`Im Spoolman-Modus den integrierten CSV-Import/-Export von Spoolman verwenden.`,importValidRows:`{{count}} gültige Zeilen importieren`,noValidRows:`Keine gültigen Zeilen`,importing:`Wird importiert…`,importSuccess:`{{count}} Spulen importiert`,importError:`Import fehlgeschlagen`,exportError:`Export fehlgeschlagen`},addSpool:`Spule hinzufügen`,copySpool:`Spule kopieren`,editSpool:`Spule bearbeiten`,material:`Material`,selectMaterial:`Material auswählen...`,subtype:`Untertyp`,brand:`Marke`,searchBrand:`Marke suchen...`,useCustomBrand:`"{{brand}}" verwenden`,useCustomMaterial:`Benutzerdefiniertes Material verwenden: {{material}}`,suggestedOptions:`Vorgeschlagen`,allOptions:`Alle`,colorName:`Farbname`,colorNamePlaceholder:`Jadeweiß, Feuerrot...`,color:`Farbe`,hexColor:`Hex-Farbe`,pickColor:`Benutzerdefinierte Farbe wählen`,labelWeight:`Nenngewicht`,coreWeight:`Leergewicht der Spule`,searchSpoolWeight:`Spulengewicht suchen...`,weightUsed:`Verbraucht`,currentWeight:`Restgewicht`,measuredWeight:`Gemessenes Gewicht`,spoolName:`Spule`,costPerKg:`Kosten pro kg`,storageLocation:`Lagerstandort`,temperature:`Temperatur`,humidity:`Luftfeuchtigkeit`,battery:`Batterie`,storageLocationPlaceholder:`z.B. Regal A, Schublade 1`,openInInventory:`Im Inventar öffnen`,measuredWeightError:`Das gemessene Gewicht muss zwischen {{min}}g und {{max}}g liegen.`,slicerFilament:`Slicer-Filament`,slicerFilamentName:`Slicer-Preset-Name`,slicerPreset:`Slicer-Preset`,searchPresets:`Filament-Presets suchen...`,selectedPreset:`Ausgewählt`,noPresetsFound:`Keine Presets gefunden`,tempOverrides:`Temperatur-Überschreibungen`,note:`Notiz`,notePlaceholder:`Zusätzliche Notizen zu dieser Spule...`,category:`Kategorie`,categoryPlaceholder:`z. B. Produktion, Prototyp, Kunde A`,categoryNone:`Ohne Kategorie`,storageLocationNone:`Kein Lagerort`,lowStockThresholdOverride:`Niedrigbestandsschwelle (diese Spule)`,lowStockThresholdOverrideHelp:`Leer lassen, um den globalen Schwellenwert ({{global}}%) zu verwenden.`,materialNumber:`Material-Nr.`,materialNumberPlaceholder:`z. B. 15`,materialNumberHelp:`Interne Einkaufsnummer - wird von allen Spulen dieses Produkts geteilt. Neue Spulen desselben Produkts übernehmen sie.`,lastDried:`Zuletzt getrocknet`,lastDriedNow:`Jetzt`,lastDriedHelp:`Wird eingetragen, wenn ein AMS-Trocknungslauf mindestens zur Hälfte gelaufen ist. Für eine anderswo getrocknete Spule hier setzen.`,materialNumberNone:`Keine Materialnummer`,suppliers:{label:`Lieferanten`,none:`Kein Lieferant`,addSupplier:`Lieferant hinzufügen…`,searchPlaceholder:`Lieferanten durchsuchen…`,noneLeft:`Alle Lieferanten sind bereits zugewiesen`,createNew:`"{{name}}" anlegen`,createFailed:`Lieferant konnte nicht angelegt werden`,purchaseSource:`Hier gekauft`,purchaseSourceHelp:`Markiert, wo diese Spule tatsächlich gekauft wurde; die übrigen Einträge sind alternative Bezugsquellen.`,articleNumberPlaceholder:`Artikelnr. des Lieferanten`,pricePlaceholder:`Angebotspreis/kg`,priceHelp:`Angebotspreis bei diesem Lieferanten, zum Vergleich der Bezugsquellen — der eigene Preis pro kg der Spule bleibt die Kostenbasis.`,help:`Wo dieses Produkt gekauft werden kann. Der hervorgehobene Eintrag ist die Bezugsquelle dieser Spule.`,saveFailed:`Lieferantenzuordnungen konnten nicht gespeichert werden`,title:`Lieferanten`,description:`Verwalten Sie, wo Sie Filament kaufen — nicht zu verwechseln mit der Marke, also dem Hersteller. Weisen Sie Spulen im Spulendialog Lieferanten zu; ein Lieferant, der noch Spulen zugewiesen ist, kann nicht gelöscht werden.`,search:`Lieferanten durchsuchen...`,addNew:`Neuen Lieferanten hinzufügen`,namePlaceholder:`Name (z. B. Filament24)`,websitePlaceholder:`Website / Shop-URL`,customerNumberPlaceholder:`Kundennr.`,notePlaceholder:`Notiz`,nameRequired:`Name ist erforderlich`,duplicateName:`Ein Lieferant mit diesem Namen existiert bereits`,customerNumber:`Kundennr.`,spools:`Spulen`,noMatch:`Keine Lieferanten entsprechen Ihrer Suche`,empty:`Noch keine Lieferanten`,added:`Lieferant hinzugefügt`,addFailed:`Lieferant konnte nicht hinzugefügt werden`,updated:`Lieferant aktualisiert`,updateFailed:`Lieferant konnte nicht aktualisiert werden`,deleted:`Lieferant gelöscht`,deleteFailed:`Lieferant konnte nicht gelöscht werden`,deleteBlocked:`Löschen nicht möglich: noch {{count}} Spule(n) zugewiesen`,loadFailed:`Lieferanten konnten nicht geladen werden`,deleteTitle:`Lieferant löschen`,deleteConfirm:`"{{name}}" löschen?`,deleteConfirmReferenced:`"{{name}}" ist {{count}} Spule(n) zugewiesen. Das Löschen ist blockiert, bis diese Zuordnungen entfernt wurden.`},clearRfid:`RFID-Tag löschen`,rfidCleared:`RFID-Tag gelöscht`,archive:`Archivieren`,restore:`Wiederherstellen`,noSpools:`Noch keine Spulen. Fügen Sie Ihre erste Spule hinzu.`,noAvailableSpools:`Keine Spulen verfügbar. Fügen Sie eine Spule zum Inventar hinzu oder lösen Sie eine aus einem anderen Slot.`,kProfiles:`K-Profile`,addKProfile:`K-Profil hinzufügen`,assignSpool:`Spule zuweisen`,unassignSpool:`Zuweisung aufheben`,assignSuccess:`Spule zugewiesen und AMS-Slot konfiguriert`,assignPendingInsert:`Zugewiesen. Slot wird beim Einsetzen der Spule konfiguriert.`,assignFailed:`Spulenzuweisung fehlgeschlagen`,selectSpool:`Wählen Sie eine Spule für diesen Slot`,assigned:`Zugewiesen`,assigning:`Wird zugewiesen...`,searchSpools:`Spulen suchen...`,showAllSpools:`Alle Spulen anzeigen`,spoolmanSpools:`Spoolman-Spulen`,allMaterials:`Alle Materialien`,filterByBrand:`Nach Marke filtern...`,showArchived:`Archivierte anzeigen`,quickAdd:`Schnellerfassung (Lager)`,quantity:`Menge`,stock:`Lager`,configured:`Konfiguriert`,spoolsCreated:`{{count}} Spulen erstellt`,spoolsPartiallyCreated:`{{created}} von {{total}} Spulen erstellt (einige fehlgeschlagen)`,spoolCreated:`Spule erstellt`,spoolUpdated:`Spule aktualisiert`,spoolDeleted:`Spule gelöscht`,deepLinkSpoolNotFound:`Spule nicht gefunden`,deepLinkFetchFailed:`Spule konnte nicht geladen werden — bitte erneut versuchen`,spoolArchived:`Spule archiviert`,spoolRestored:`Spule wiederhergestellt`,kProfileSaveFailed:`K-Profil-Einstellungen konnten nicht gespeichert werden`,syncWeightSpoolNotFound:`Spule nicht gefunden — sie wurde möglicherweise gelöscht`,syncWeightSpoolmanUnreachable:`Spoolman ist nicht erreichbar — bitte später erneut versuchen`,syncWeightFailed:`Gewicht konnte nicht synchronisiert werden`,spoolmanUnreachable:`Spoolman ist nicht erreichbar — bitte später erneut versuchen`,deleteSpoolNotFound:`Spule nicht gefunden — sie wurde möglicherweise bereits gelöscht`,deleteFailed:`Spule konnte nicht gelöscht werden`,archiveSpoolNotFound:`Spule nicht gefunden — sie wurde möglicherweise bereits gelöscht`,archiveFailed:`Spule konnte nicht archiviert werden`,restoreSpoolNotFound:`Spule nicht gefunden — sie wurde möglicherweise bereits gelöscht`,restoreFailed:`Spule konnte nicht wiederhergestellt werden`,saveFailed:`Änderungen konnten nicht gespeichert werden`,tagClearFailed:`Tag konnte nicht gelöscht werden`,deleteConfirm:`Möchten Sie diese Spule wirklich löschen? Dies kann nicht rückgängig gemacht werden.`,archiveConfirm:`Möchten Sie diese Spule wirklich archivieren?`,advancedSettings:`Erweiterte Einstellungen`,filamentInfoTab:`Filament-Info`,paProfileTab:`PA-Profil`,colorAndCostTab:`Farbe & Kosten`,printersTab:`Drucker`,filamentInfo:`Filament`,additional:`Zusätzlich`,loadingPresets:`Cloud-Presets werden geladen...`,cloudConnected:`Cloud verbunden`,cloudNotConnected:`Cloud nicht verbunden (Standardwerte)`,recentColors:`Zuletzt`,searchColors:`Farben suchen...`,searchResults:`Suchergebnisse`,allColors:`Alle Farben`,commonColors:`Häufige Farben`,showLess:`Weniger`,showAll:`Alle`,noColorsFound:`Keine Farben gefunden`,noResults:`Keine Ergebnisse`,extraColorsLabel:`Zusätzliche Farben`,extraColorsPlaceholder:`EC984C,#6CD4BC,A66EB9,D87694`,extraColorsHint:`2 bis 8 Hex-Stops, durch Kommas getrennt. Wird als Verlauf dargestellt.`,extraColorsInvalid:`Ungültige Hex-Werte ignoriert: {{tokens}}`,colorEffectLabel:`Effekt`,colorEffect:{none:`Keiner`,sparkle:`Glitzer`,wood:`Holz`,marble:`Marmor`,glow:`Leuchtend`,matte:`Matt`,silk:`Seide`,galaxy:`Galaxie`,rainbow:`Regenbogen`,metal:`Metallic`,translucent:`Lichtdurchlässig`,gradient:`Verlauf`,dualColor:`Zweifarbig`,triColor:`Dreifarbig`,multicolor:`Mehrfarbig`},selectMaterialFirst:`Bitte zuerst ein Material im Filament-Info Tab auswählen.`,noPrintersConfigured:`Keine Drucker konfiguriert. Fügen Sie Drucker hinzu.`,matchingFilter:`Filter`,anyBrand:`Jede Marke`,anyVariant:`Jede Variante`,autoSelect:`Auto-Auswahl`,matches:`Treffer`,match:`Treffer`,noMatches:`Keine Treffer`,connected:`Verbunden`,offline:`Offline`,printerOffline:`Drucker ist offline. Verbinden Sie ihn, um Kalibrierungsprofile anzuzeigen.`,noKProfilesMatch:`Keine K-Profile stimmen mit dem gewählten Filament überein.`,leftNozzle:`Linke Düse`,rightNozzle:`Rechte Düse`,profilesSelected:`Kalibrierungsprofil(e) ausgewählt`,filamentPreset:`Filament-Voreinstellung`,presetUseSpoolDefault:`Voreinstellung der Spule verwenden`,presetInherited:`geerbt`,presetOverride:`überschrieben`,presetNeedsModel:`Dieser Drucker hat sein Modell noch nicht gemeldet und kann daher keine eigene Voreinstellung haben.`,autoMatchPresets:`Automatisch zuordnen`,autoMatchPresetsHint:`Die Variante der Spulen-Voreinstellung suchen, die das jeweilige Modell nennt`,kProfilesPerPrinter:`K-Profile`,kProfileNotSet:`Nicht gesetzt`,kProfileFlowMismatch:`Dieses Profil wurde mit einer {{profile}}-Düse gemessen, eingebaut ist aber eine {{fitted}}-Düse — es wird daher nicht angewendet`,nozzle:`Düse`,unknownModel:`Unbekanntes Modell`,onePrinter:`1 Drucker`,nPrinters:`{{n}} Drucker`,filamentPresetsLoadFailed:`Die modellspezifischen Voreinstellungen dieser Spule konnten nicht geladen werden`,filamentPresetSaveFailed:`Die modellspezifischen Voreinstellungen konnten nicht gespeichert werden`,totalInventory:`Gesamtbestand`,totalConsumed:`Gesamtverbrauch`,byMaterial:`Nach Material`,inPrinter:`Im Drucker`,lowStock:`Niedriger Bestand`,sinceTracking:`Seit Beginn der Erfassung`,resetConsumedCounter:`Zähler zurücksetzen`,resetConsumedCounterTooltip:`Den verbrauchten Gramm-Zähler dieser Spule auf null setzen. Das Restgewicht bleibt unverändert.`,resetConsumedCounterConfirm:`Verbrauchten Gramm-Zähler dieser Spule auf 0 zurücksetzen? Künftige Drucke zählen wieder ab null. Die Spule selbst, ihre Restgewichtsberechnung und Ihre Einstellungen bleiben unverändert.`,resetAllConsumedCounters:`Alle Zähler zurücksetzen`,resetAllConsumedCountersTooltip:`Den verbrauchten Gramm-Zähler auf jeder Spule auf null setzen. Die Restgewichte bleiben unverändert.`,resetAllConsumedCountersConfirm:`Verbrauchten Gramm-Zähler auf allen {{count}} Spulen (archivierte eingeschlossen) auf 0 zurücksetzen? Das löscht den Wert „Insgesamt verbraucht“, sodass künftige Drucke wieder ab null gezählt werden. Spulen und Restgewichte bleiben unverändert.`,consumedCounterReset:`Zähler zurückgesetzt`,allConsumedCountersReset:`Zähler für {{count}} Spule(n) zurückgesetzt`,resetConsumedCounterFailed:`Zähler konnte nicht zurückgesetzt werden`,loadedInAms:`Im AMS/Ext geladen`,remaining:`Verbleibend`,weightCheck:`Gewichtskontrolle`,lastWeighed:`Zuletzt gewogen`,neverWeighed:`Nie gewogen`,search:`Spulen suchen...`,showing:`Zeige`,to:`bis`,of:`von`,show:`Zeige`,spools:`Spulen`,spool:`Spule`,page:`Seite`,noSpoolsMatch:`Keine Ergebnisse`,noSpoolsMatchDesc:`Versuchen Sie, Ihre Suche oder Filter anzupassen.`,active:`Aktiv`,archived:`Archiviert`,all:`Alle`,used:`Verwendet`,new:`Neu`,clearFilters:`Filter löschen`,table:`Tabelle`,cards:`Karten`,net:`Netto`,groupSimilar:`Gruppieren`,groupedSpools:`{{count}} identische Spulen`,groupedRows:`Zeilen`,columns:`Spalten`,configureColumns:`Spalten konfigurieren`,configureColumnsDesc:`Ziehen zum Neuordnen oder Pfeile verwenden. Sichtbarkeit mit dem Augensymbol umschalten.`,visible:`sichtbar`,reset:`Zurücksetzen`,cancel:`Abbrechen`,applyChanges:`Änderungen anwenden`,moveUp:`Nach oben`,moveDown:`Nach unten`,hideColumn:`Spalte ausblenden`,showColumn:`Spalte einblenden`,linkToSpool:`Mit Spule verknüpfen`,tagLinked:`Tag mit Spule verknüpft`,tagLinkFailed:`Tag-Verknüpfung fehlgeschlagen`,tagAlreadyLinked:`Tag bereits mit Spule #{{id}} verknüpft`,unknownTag:`Unbekannter RFID-Tag erkannt`,usageHistory:`Verbrauchshistorie`,noUsageHistory:`Noch kein Verbrauch erfasst`,printName:`Druckname`,weightConsumed:`Verbrauchtes Gewicht`,clearHistory:`Löschen`,historyCleared:`Verbrauchshistorie gelöscht`,fillSourceLabel:`(Inv)`,lowStockThresholdError:`Der Schwellenwert muss zwischen 0.1 und 99.9 liegen`,assignMismatchTitle:`Material stimmt nicht überein`,assignMismatchMessage:`Das ausgewählte Spulenmaterial "{{spoolMaterial}}" stimmt nicht mit dem Tray-Material "{{trayMaterial}}" für {{location}} überein. Trotzdem zuweisen?`,assignMismatchConfirm:`Trotzdem zuweisen`,assignPartialMismatchMessage:`Das Spulenmaterial "{{spoolMaterial}}" ist ähnlich, stimmt aber nicht genau mit "{{trayMaterial}}" in {{location}} überein. Möchten Sie fortfahren?`,assignProfileMismatchMessage:`Das Spulenprofil "{{spoolProfile}}" stimmt nicht mit dem Fachprofil "{{trayProfile}}" in {{location}} überein. Möchten Sie fortfahren?`,assignReconfigureNote:`Der AMS-Slot wird mit dem Profil der Spule neu konfiguriert.`,spoolmanFilamentCatalog:`Spoolman-Filamentkatalog`,pickFromSpoolmanCatalog:`Aus Spoolman-Katalog wählen…`,spoolmanFilamentSelected:`Filament aus Spoolman-Katalog ausgewählt`,spoolmanFilamentUnlinked:`Verknüpfung mit Filamentkatalog aufgehoben`,noSpoolmanFilaments:`Keine Filamente im Spoolman-Katalog gefunden`,spoolmanFilamentColorSwatch:`Filamentfarbe`,spoolmanCatalogLoadFailed:`Spoolman-Filamentkatalog konnte nicht geladen werden`},timelapse:{title:`Zeitraffer`,create:`Zeitraffer erstellen`,download:`Herunterladen`,delete:`Löschen`,preview:`Vorschau`,frameRate:`Bildrate`,quality:`Qualität`,processing:`Wird verarbeitet...`,noTimelapses:`Keine Zeitraffer verfügbar`},ams:{title:`AMS`,slot:`Slot`,empty:`Leer`,emptySlot:`Leerer Slot`,slotEmpty:`Leer`,slotUnconfigured:`?`,emptySlotReset:`Keine Spule zugewiesen`,unknown:`Unbekannt`,humidity:`Luftfeuchtigkeit`,temperature:`Temperatur`,filamentType:`Filamenttyp`,filamentColor:`Farbe`,remaining:`Verbleibend`,history:`AMS-Verlauf`,noHistory:`Kein Verlauf verfügbar`,configureSlot:`Slot konfigurieren`,externalSpool:`Externe Spule`,profile:`Profil`,kFactor:`K-Faktor`,kFactorShort:`K`,fill:`Füllstand`,configure:`Konfigurieren`,used:`verwendet`,remainingUnit:`verbleibend`},printModal:{variants:{editNote:`Diese Alternativen wurden beim Einreihen festgelegt. Zum Ändern abbrechen und neu einreihen.`,title:`Drucker-Alternativen`,help:`Ein Auftrag, ein Warteschlangenplatz. Der erste passende Drucker, der frei wird, druckt seine Datei.`,unknownModel:`Unbekanntes Modell`,plateFor:`Platte für {{filename}}`,moveUp:`Nach oben`,moveDown:`Nach unten`,queued:`Mit {{count}} Alternativen eingereiht`},selectPrinter:`Drucker auswählen`,selectPlate:`Platte auswählen`,filamentMapping:`Filamentzuordnung`,useArchiveMapping:`Zuordnung`,useArchiveMappingTooltip:`Jeden Steckplatz aus der mit diesem Archiv gespeicherten AMS-Zuordnung (vom Slicer) auswählen, anstatt nach Typ/Farbe abzugleichen.`,clickToChangeSlot:`Klicken, um die Steckplatzzuweisung zu ändern`,reRead:`Neu einlesen`,plateN:`Platte {{n}}`,plateFilamentsUnreadable:`Die Filamente einer ausgewählten Platte konnten nicht gelesen werden, sie lässt sich daher nicht zuordnen. Wähle sie ab, um die anderen einzureihen.`,totalCost:`Gesamtkosten:`,slotRemainingShort:` - {{grams}}g übrig`,printSettings:`Druckeinstellungen`,bedLeveling:`Bett-Nivellierung`,flowCalibration:`Fluss-Kalibrierung`,vibrationCalibration:`Vibrations-Kalibrierung`,layerInspection:`Erste-Schicht-Prüfung`,timelapse:`Zeitraffer`,cancel:`Abbrechen`,noPrintersAvailable:`Keine Drucker verfügbar`,printerBusy:`Drucker ist beschäftigt`,printerOffline:`Drucker ist offline`,sameTypeDifferentColor:`Gleicher Typ, andere Farbe`,filamentTypeNotLoaded:`Filamenttyp nicht geladen`,statusReady:`Bereit`,statusColorMismatch:`Farbe weicht ab`,statusTypeNotFound:`Typ nicht gefunden`,requiredTooltip:`Benötigt: {{name}} - {{color}}`,manuallySelected:`Manuell ausgewählt`,autoMatched:`Automatisch zugeordnet`,selectSlot:`Slot wählen`,exactColorMatch:`Exakte Farbübereinstimmung`,slotForFilament:`Drucker-Slot für {{name}}`,overrideForFilament:`Filament-Überschreibung für {{name}}`,sameTypeDifferentColorDetail:`Gleicher Typ, andere Farbe: benötigt {{required}}, im Slot ist {{loaded}}`,requiredTypeNotInPrinter:`Benötigter Filamenttyp im Drucker nicht gefunden.`,whenToPrint:`Wann drucken`,asap:`Sofort`,queue:`Warteschlange`,schedule:`Planen`,dateTime:`Datum & Uhrzeit`,invalidDateTime:`Bitte ein gültiges Datum und eine gültige Uhrzeit eingeben`,openCalendar:`Kalender öffnen`,requireManualStart:`Manuellen Start erfordern`,awaitingReviewNote:`Dein Druck wartet auf Freigabe: Er beginnt, sobald jemand, der die Warteschlange verwaltet, ihn startet.`,requirePreviousSuccess:`Nur starten, wenn der vorherige Druck erfolgreich war`,autoOffAfter:`Drucker nach Abschluss ausschalten`,helpAsap:`Der Druck wird oben in die Warteschlange eingefügt und startet, sobald ein geeigneter Drucker im Leerlauf ist.`,helpSchedule:`Der Druck startet zur geplanten Zeit, wenn der Drucker im Leerlauf ist. Wenn er belegt ist, wartet er, bis der Drucker verfügbar ist.`,helpQueue:`Der Druck wird hinten in die Warteschlange eingefügt.`,leftNozzle:`L`,rightNozzle:`R`,leftNozzleTooltip:`Linke Düse`,rightNozzleTooltip:`Rechte Düse`,ftsSameInletHint:`Alle Filamente für diesen Druck liegen an Filamentweiche IN-{{inlet}}. Wechsel zwischen Filamenten am selben Eingang dauern länger — verlege eines in ein AMS am anderen Eingang.`,rackPosition:`Wechslerposition`,rackPositionTooltip:`Welche Düse im Wechsler dieses Filament druckt. Die Positionen sind wie am Drucker nummeriert.`,rackEmptyPosition:`Diese Wechslerposition ist leer`,rackWrongNozzle:`Enthält eine {{has}}-Düse; dieses Filament benötigt {{needs}}`,filamentOverride:`Filament-Überschreibung`,filamentOverrideHint:`Filamente für modellbasierte Zuweisung optional überschreiben. Der Planer wird gegen die ausgewählten Filamente statt der ursprünglichen 3MF-Werte abgleichen.`,originalFilament:`Original`,overrideWith:`Ersetzen mit`,resetToOriginal:`Auf Original zurücksetzen`,insufficientFilamentTitle:`Nicht genug Filament`,waitingForAmsStatus:`Warte auf AMS-Status von {{printer}}…`,insufficientFilamentMessage:`Einige zugewiesene Spulen haben weniger Filament als dieser Druck benötigt:`,insufficientFilamentLine:`{{printer}} - {{slot}}: benötigt {{required}}g, verbleibend {{remaining}}g`,insufficientFilamentLinePooled:`{{printer}} - {{slot}}: benötigt {{required}}g, {{remaining}}g über passende Spulen verfügbar (AMS Filament Backup)`,printAnyway:`Trotzdem drucken`,forceColorMatch:`Farbe erzwingen`,staggerPrinterStarts:`Druckerstarts staffeln`,staggerGroupSize:`Gruppengröße`,staggerInterval:`Intervall (Min.)`,staggerPreview:`{{printers}} Drucker → {{groups}} Gruppen à {{size}}, Start alle {{interval}} Min.`,staggerLastGroup:`letzte Gruppe: {{count}}`,staggerTotal:`insgesamt: {{minutes}} Min.`,staggerToPrinters:`Gestaffelt an {{count}} Drucker senden`,gcodeInjection:`Auto-Print G-code einfügen`,insufficientBudget:`Budget nicht ausreichend`,unlimitedNoBudget:`Unbegrenzt – es ist kein Budgetlimit festgelegt.`,noPrintableCostCenters:`Es ist keine aktive Kostenstelle zum Drucken verfügbar. Bitte einen Administrator, dir Druckzugriff zu gewähren.`,askForOutcome:`Nach Ergebnis fragen`,askForOutcomeTitle:`Nach Abschluss fragen, wie der Druck geworden ist`},backup:{includesEncryptionKey:`Lokale Sicherungen enthalten die MFA-Schlüsseldatei (DATA_DIR/.mfa_encryption_key), damit ein Backup-ZIP selbstkonsistent ist. Behandle das ZIP als sensibel — wer Zugriff auf die Datei hat, kann die darin enthaltenen OIDC-Client-Secrets und TOTP-Geheimnisse entschlüsseln.`,title:`Sichern & Wiederherstellen`,createBackup:`Sicherung erstellen`,restoreBackup:`Sicherung wiederherstellen`,restoreDescription:`Alle Daten aus einer Sicherungsdatei ersetzen`,downloadBackup:`Sicherung herunterladen`,uploadBackup:`Sicherung hochladen`,lastBackup:`Letzte Sicherung`,autoBackup:`Automatische Sicherung`,backupNow:`Jetzt sichern`,restoreWarning:`Warnung: Das Wiederherstellen einer Sicherung überschreibt alle aktuellen Daten.`,includeArchives:`Archive einschließen`,includeSettings:`Einstellungen einschließen`,includeProfiles:`Profile einschließen`,backupSuccess:`Sicherung erfolgreich erstellt`,restoreSuccess:`Sicherung erfolgreich wiederhergestellt`,backupFailed:`Sicherung fehlgeschlagen`,restoreFailed:`Wiederherstellung fehlgeschlagen`,restoreNote:`Virtueller Drucker wird während der Wiederherstellung gestoppt`,githubBackup:`Git-Backup`,enabled:`Aktiviert`,cloudLoginRequired:`Bambu Cloud Login erforderlich. Melden Sie sich unter Profile → Cloud-Profile an, um GitHub-Backup zu aktivieren.`,cloudLoginRequiredShort:`Cloud-Login erforderlich`,githubDescription:`Synchronisieren Sie Ihre Profile automatisch mit einem privaten GitHub-Repository für Backup und Versionsverlauf.`,repoIsPrivate:`Repository ist privat — Sicherung möglich.`,repoIsPublicWarning:`Das Repository ist ÖFFENTLICH. Bambuddy-Backups enthalten MQTT-Zugangsdaten, Home-Assistant-Tokens, Prometheus-Tokens, Ihre Bambu-Cloud-E-Mail-Adresse und über K-Profile auch Drucker-Zugangscodes. Speichern ist blockiert, bis Sie das Repository in den Einstellungen Ihres Anbieters auf privat stellen.`,repoVisibilityUnknown:`Die Sichtbarkeit des Repositories konnte nicht bestimmt werden. Bambuddy sichert nur in Repositories, die nachweislich privat sind; Speichern wird blockiert.`,repositoryUrl:`Repository-URL`,repoUrlPlaceholderGitHub:`https://github.com/username/repo-name`,repoUrlPlaceholderGitea:`https://gitea.example.com/username/repo-name`,repoUrlPlaceholderForgejo:`https://forgejo.example.com/username/repo-name`,repoUrlPlaceholderGitLab:`https://gitlab.com/username/repo-name`,allowInsecureHttp:`Unsicheres HTTP erlauben`,allowInsecureHttpHint:`Für selbst gehostete Instanzen in privaten Netzwerken ohne TLS aktivieren`,personalAccessToken:`Persönlicher Zugriffstoken`,tokenSaved:`(gespeichert)`,enterNewToken:`Neuen Token eingeben zum Aktualisieren`,tokenHintGitHub:`Feingranularer Token mit Lese- und Schreibzugriff auf Contents oder klassischer Token mit dem Bereich repo.`,tokenHintGitLab:`Token mit dem Bereich api oder read_repository zusammen mit write_repository.`,tokenHintGitea:`Token mit dem Bereich write:repository.`,tokenHintForgejo:`Token mit dem Bereich write:repository. Ein Token, der nur für dieses eine Repository gilt, genügt.`,branch:`Branch`,provider:`Git-Anbieter`,providerGitHub:`GitHub`,providerGitLab:`GitLab`,providerGitea:`Gitea`,providerForgejo:`Forgejo`,manualOnly:`Nur manuell`,hourly:`Stündlich`,daily:`Täglich`,weekly:`Wöchentlich`,includeInBackup:`In Sicherung einschließen`,kProfiles:`K-Profile`,kProfilesDescription:`Druckvorschub-Kalibrierung von verbundenen Druckern`,noPrintersConnected:`Keine Drucker verbunden`,printersConnected:`{{connected}}/{{total}} verbunden`,cloudProfiles:`Cloud-Profile`,cloudProfilesDescription:`Filament-, Drucker- und Prozessprofile aus Bambu Cloud und Orca Cloud`,cloudProfilesAccounts:`Verbundene Konten — Bambu Cloud: {{bambu}}, Orca Cloud: {{orca}}`,appSettings:`App-Einstellungen`,appSettingsDescription:`Bambuddy-Konfiguration (komplette Datenbank)`,spoolInventory:`Spulenbestand`,spoolInventoryDescription:`Filamentspulen, Nutzungsverlauf und Kostenverfolgung`,printArchives:`Druckarchive`,printArchivesDescription:`Druckverlauf-Metadaten (keine GCode/3MF-Dateien)`,lastBackupAt:`Letzte Sicherung:`,noBackupsYet:`Noch keine Sicherungen`,next:`Nächste:`,startingBackup:`Sicherung wird gestartet...`,test:`Test`,enableBackup:`Sicherung aktivieren`,testConnection:`Verbindung testen`,enterRepoUrl:`Repository-URL eingeben`,enterRepoAndToken:`Repository-URL und Zugriffstoken eingeben`,repoRequired:`Repository-URL ist erforderlich`,tokenRequired:`Zugriffstoken ist erforderlich`,githubBackupEnabled:`GitHub-Backup aktiviert`,tokenUpdated:`Token aktualisiert`,settingsSaved:`Einstellungen gespeichert`,failedToSave:`Speichern fehlgeschlagen: {{message}}`,backupCompleteFiles:`Sicherung abgeschlossen - {{count}} Dateien aktualisiert`,backupSkippedNoChanges:`Sicherung übersprungen - keine Änderungen`,backupFailed2:`Sicherung fehlgeschlagen: {{message}}`,clearedLogs:`{{count}} Protokolle gelöscht`,failedToClearLogs:`Protokolle löschen fehlgeschlagen: {{message}}`,restoreFromGit:{button:`Aus Git wiederherstellen`,title:`Aus Git-Backup wiederherstellen`,subtitle:`Commit auswählen und festlegen, was wiederhergestellt wird`,commitLabel:`Backup-Commit`,latestCommit:`Neuestes Backup (Branch-Spitze)`,categoriesLabel:`Was wiederherstellen`,inspecting:`Backup-Inhalt wird gelesen...`,itemCount:`{{count}} im Backup`,overwriteLabel:`Vorhandene Einträge überschreiben`,overwriteOn:`Vorhandene Einträge werden aus dem Backup aktualisiert.`,overwriteOff:`Es werden nur fehlende Einträge ergänzt; vorhandene bleiben unverändert.`,selectedCount:`{{count}} ausgewählt`,restoring:`Wird wiederhergestellt...`,confirmTitle:`Aus Backup wiederherstellen?`,confirmMessage:`Die ausgewählten Kategorien werden aus diesem Commit wiederhergestellt. Fehlende Einträge werden ergänzt, vorhandene bleiben unverändert.`,confirmMessageOverwrite:`Die ausgewählten Kategorien werden aus diesem Commit wiederhergestellt und lokal vorhandene Einträge überschrieben. Dies kann nicht rückgängig gemacht werden.`,kprofilesOverwriteCaveat:`K-Profile sind die Ausnahme: Das Schreiben eines Slots ersetzt immer die Kalibrierung auf dem Drucker.`,tally:`{{restored}} wiederhergestellt, {{skipped}} übersprungen, {{failed}} fehlgeschlagen`,reloadHint:`Bambuddy neu laden, damit die wiederhergestellten Daten überall erscheinen.`,partialHint:`Die oben aufgeführten Kategorien wurden abgeschlossen und sind gespeichert. Fehlende Kategorien wurden nicht ausgeführt.`,failed:`Wiederherstellung fehlgeschlagen.`,loadFailed:`Das Backup-Repository konnte nicht gelesen werden.`,details:{notPresent:`In diesem Backup-Commit nicht vorhanden`,unreadableJson:`Unlesbares JSON: {{paths}}`,settingsNoPayload:`Keine Einstellungen in den Daten`,settingsCredentialsWillSkip:`{{count}} zugangsdatenähnliche Schlüssel werden übersprungen`,settingsCompanionWillSkip:`{{count}} zugangsdatenähnliche Schlüssel werden übersprungen und {{companion}} davon abhängige Schalter bleiben aus`,settingsCompanionOnlyWillSkip:`{{companion}} Schalter bleiben aus - die dafür nötigen Zugangsdaten können nicht aus einem Backup wiederhergestellt werden`,spoolsUsageCount:`davon {{count}} Verbrauchseinträge`,archivesMetadataOnly:`Nur Metadaten - 3MF-Dateien und Vorschaubilder sind nicht im Git-Backup enthalten`,kprofilesPrinterCount:`über {{count}} Drucker`},notes:{noData:`Keine Daten dieser Art in diesem Backup`,archivesPrinterMissing:`Einige Archive verwiesen auf nicht mehr vorhandene Drucker - Verknüpfung entfernt`,archivesProjectMissing:`Einige Archive verwiesen auf nicht mehr vorhandene Projekte - Verknüpfung entfernt`,archivesOwnerCleared:`Einige Archive verwiesen auf nicht mehr vorhandene Benutzer - Eigentümer entfernt. Sie sind daher nur für Benutzer mit der Berechtigung archives:read_all sichtbar, bis ein Administrator sie neu zuweist`,archivesOwnerUnmatched:`Einige Archive nennen einen Eigentümer, den es auf dieser Instanz nicht gibt - der Eigentümer wurde entfernt statt aus der Benutzer-ID der Sicherung geraten. Sie sind daher nur für Benutzer mit der Berechtigung archives:read_all sichtbar, bis ein Administrator sie neu zuweist`,archivesOwnerUnknown:`Einige Archive wurden ohne Eigentümer wiederhergestellt - diese Sicherung enthält keinen, daher sind sie nur für Benutzer mit der Berechtigung archives:read_all sichtbar, bis ein Administrator sie neu zuweist`,archivesUndeleted:`Seit dem Backup gelöschte Archive sind wieder sichtbar - Überschreiben war aktiv`,archivesMetadataOnly:`Wiederhergestellte Archive enthalten nur Metadaten - die 3MF- und Vorschaudateien sind nicht im Git-Backup enthalten`,spoolUsageUnresolved:`{{count}} Verbrauchseinträge übersprungen - ihre Spule ist nicht in der Spulenliste dieses Backups, es gibt also nichts, woran sie hängen könnten.`,spoolUsageUnlinked:`{{count}} Verbrauchseinträge ohne Verknüpfung zum Druckverlauf wiederhergestellt - wählen Sie Druckarchive zusammen mit dem Spulenbestand, um sie zu behalten.`,spoolTagKept:`{{count}} Spulen-Tags unverändert gelassen - das Backup hätte einen inzwischen gescannten Tag gelöscht oder ihn auf eine zweite Spule verschoben.`,settingsCredentialsSkipped:`{{count}} zugangsdatenähnliche Schlüssel übersprungen - Geheimnisse bitte manuell erneut eingeben`,settingsAuthSkipped:`{{count}} Authentifizierungseinstellungen übersprungen - ändern Sie diese unter Einstellungen > Authentifizierung, damit die Aussperrprüfungen greifen`,settingsCompanionSkipped:`{{keys}} bleiben ausgeschaltet - die jeweils benötigten Zugangsdaten lassen sich nicht aus einem Backup wiederherstellen und sind auf dieser Instanz nicht hinterlegt, ein Einschalten würde die Integration also ohne Authentifizierung lassen`,settingsMqttRelayFailed:`MQTT-Einstellungen wiederhergestellt, aber das Relay konnte nicht neu verbunden werden - Bambuddy neu starten`,kprofilesAlwaysOverwrite:`K-Profile überschreiben immer den passenden Slot auf dem Drucker`,kprofilesAckUnreliable:`Ein Drucker, der nicht antwortet, zählt weiterhin als wiederhergestellt - überprüfen Sie die Profile am Drucker`,kprofilesPrinterMissing:`Kein Drucker mit der Seriennummer {{serial}} - übersprungen`,kprofilesPrinterOffline:`{{printer}} ({{serial}}) ist nicht verbunden - übersprungen`,kprofilesUnknownNozzle:`Unerwarteter Düsendurchmesser {{nozzle}} für {{serial}} - unverändert gesendet`,kprofilesUnmatched:`{{count}} Profile für {{nozzle}} hatten kein Gegenstück auf {{printer}} - als neue Profile hinzugefügt`,kprofilesSendFailed:`{{nozzle}}-Profile konnten nicht an {{printer}} ({{serial}}) gesendet werden`,kprofilesRefused:`{{printer}} ({{serial}}) hat die {{nozzle}}-Profile abgelehnt: {{reason}}`,kprofilesStepFailed:`Der K-Profil-Schritt konnte nicht abgeschlossen werden - {{reason}}. Was zuvor wiederhergestellt wurde, ist trotzdem gespeichert.`}},history:`Verlauf`,clear:`Löschen`,date:`Datum`,status:`Status`,trigger:`Typ`,triggers:{manual:`Sicherung (manuell)`,scheduled:`Sicherung (geplant)`,restore:`Wiederherstellung`},commit:`Commit`,localBackup:`Lokale Sicherung`,localBackupDescription:`Erstellen Sie eine vollständige Sicherung Ihrer Bambuddy-Daten einschließlich Datenbank, Archive, Uploads und aller Dateien.`,downloadBackupLabel:`Sicherung herunterladen`,completeBackupZip:`Vollständige Sicherung: Datenbank + alle Dateien (ZIP)`,download:`Herunterladen`,preparingBackup:`Sicherung wird vorbereitet...`,creatingArchive:`Sicherungsarchiv wird erstellt... Dies kann bei großen Archiven eine Weile dauern.`,downloadingFile:`Sicherungsdatei wird heruntergeladen...`,backupDownloaded:`Sicherung erfolgreich heruntergeladen`,failedToCreateBackup:`Sicherung erstellen fehlgeschlagen: {{message}}`,restore:`Wiederherstellen`,restoreReplacesAll:`Wiederherstellung ersetzt alle Daten.`,restoreReplacesAllDetail:`Ihre aktuelle Datenbank und Dateien werden vollständig ersetzt. Nach der Wiederherstellung ist ein Neustart erforderlich.`,restoreConfirmTitle:`Sicherung wiederherstellen`,restoreConfirmMessage:`Sind Sie sicher, dass Sie von "{{filename}}" wiederherstellen möchten? Dies ersetzt Ihre aktuelle Datenbank und alle Dateien vollständig. Die Anwendung muss nach der Wiederherstellung neu gestartet werden.`,restoreConfirmButton:`Sicherung wiederherstellen`,uploadingFile:`Sicherungsdatei wird hochgeladen...`,backupRestoredRestart:`Sicherung wiederhergestellt. Bitte starten Sie Bambuddy neu.`,failedToRestore:`Sicherung wiederherstellen fehlgeschlagen. Bitte überprüfen Sie das Dateiformat.`,reloadNow:`Jetzt neu laden`,creatingBackup:`Sicherung erstellen`,restoringBackup:`Sicherung wiederherstellen`,preparing:`Vorbereiten...`,processing:`Verarbeiten...`,doNotClosePage:`Bitte schließen Sie diese Seite nicht und navigieren Sie nicht weg. Dieser Vorgang kann bei großen Sicherungen mehrere Minuten dauern.`,restoring:`Wiederherstellen...`,restoreComplete:`Wiederherstellung abgeschlossen`,restoreFailed2:`Wiederherstellung fehlgeschlagen`,importSettings:`Einstellungen aus einer Sicherungsdatei importieren`,pleaseWaitRestoring:`Bitte warten Sie, während Ihre Daten wiederhergestellt werden`,selectBackupFile:`Klicken Sie, um eine Sicherungsdatei auszuwählen (.json oder .zip)`,duplicateHandling:`So funktioniert die Duplikatbehandlung:`,matchPrinters:`Drucker`,matchPrintersBy:`abgeglichen nach Seriennummer`,matchSmartPlugs:`Smart Plugs`,matchSmartPlugsBy:`abgeglichen nach IP-Adresse`,matchNotificationProviders:`Benachrichtigungsanbieter`,matchNotificationProvidersBy:`abgeglichen nach Name`,matchFilaments:`Filamente`,matchFilamentsBy:`abgeglichen nach Name + Typ + Marke`,matchArchives:`Archive`,matchArchivesBy:`abgeglichen nach Inhaltshash (immer übersprungen)`,matchPendingUploads:`Ausstehende Uploads`,matchPendingUploadsBy:`abgeglichen nach Dateiname`,matchSettingsTemplates:`Einstellungen & Vorlagen`,matchSettingsTemplatesBy:`immer überschrieben`,replaceExisting:`Vorhandene Daten ersetzen`,keepExisting:`Vorhandene Daten behalten`,overwriteDescription:`Bereits vorhandene Elemente mit Sicherungsdaten überschreiben`,keepDescription:`Nur Elemente wiederherstellen, die noch nicht vorhanden sind`,overwriteCaution:`Achtung:`,overwriteWarning:`Das Überschreiben ersetzt Ihre aktuellen Konfigurationen durch Daten aus der Sicherung. Drucker-Zugangscodes werden aus Sicherheitsgründen nie überschrieben.`,cancel:`Abbrechen`,processingBackup:`Sicherungsdatei wird verarbeitet...`,itemsRestored:`Wiederhergestellt`,itemsSkipped:`Übersprungen`,restored:`Wiederhergestellt`,skippedAlreadyExist:`Übersprungen (bereits vorhanden)`,filesCategory:`Dateien (3MF, Thumbnails, etc.)`,andMore:`...und {{count}} weitere`,newApiKeysGenerated:`Neue API-Schlüssel generiert`,keysShownOnce:`Diese Schlüssel werden nur einmal angezeigt. Kopieren Sie sie jetzt!`,copy:`Kopieren`,noDataFound:`In der Sicherungsdatei wurden keine Daten zur Wiederherstellung gefunden.`,close:`Schließen`,scheduledBackup:`Geplante Backups`,scheduledBackupDescription:`Backup-Snapshots automatisch nach Zeitplan erstellen. Ausgabeverzeichnis kann auf einen NAS oder externen Speicher gemountet werden.`,frequency:`Frequenz`,backupTime:`Zeit`,retention:`Aufbewahrung`,retentionDescription:`Anzahl der zu behaltenden Backups`,outputPath:`Ausgabepfad`,outputPathPlaceholder:`Standard: {{path}}`,outputPathDescription:`Leer lassen für den Standardort`,runNow:`Jetzt ausführen`,backupFiles:`Backup-Dateien`,noScheduledBackups:`Noch keine Backups`,deleteBackup:`Löschen`,deleteBackupConfirm:`Diese Backup-Datei löschen?`,backupRunning:`Backup läuft...`,scheduledBackupComplete:`Backup erfolgreich abgeschlossen`,scheduledBackupFailed:`Backup fehlgeschlagen`,nextBackup:`Nächstes Backup`,backupSize:`Größe`,localTimeHint:`Ortszeit ({{tz}})`,defaultPathLabel:`Standard:`,pathCheck:{title:`Bambuddy kann nicht in dieses Verzeichnis schreiben`,howToFix:`So beheben Sie das:`,sandboxed:`Der Bambuddy-Dienst kann nicht nach {{path}} schreiben. Seine systemd-Unit läuft mit ProtectSystem=strict, wodurch jedes Verzeichnis außerhalb der Installations-, Daten- und Log-Verzeichnisse für den Dienst schreibgeschützt ist - auch eines, in das Sie aus Ihrer eigenen Shell schreiben können.`,read_only:`{{path}} liegt auf einem schreibgeschützten Dateisystem.`,permission_denied:`Bambuddy darf nicht nach {{path}} schreiben. Prüfen Sie Eigentümer und Rechte des Verzeichnisses.`,no_space:`Das Dateisystem, auf dem {{path}} liegt, ist voll.`,not_a_directory:`{{path}} existiert, ist aber kein Verzeichnis.`,missing:`{{path}} existiert nicht und konnte nicht angelegt werden.`,error:`Bambuddy kann nicht nach {{path}} schreiben.`,ephemeralTitle:`Diese Backups überleben einen Container-Neustart nicht`,container_ephemeral:`{{path}} liegt im Bambuddy-Container, nicht auf dem Host. Dort geschriebene Backups gehen verloren, sobald der Container neu erstellt wird. Binden Sie das Verzeichnis vom Host ein:`},categories:{settings:`Einstellungen`,notification_providers:`Benachrichtigungsanbieter`,notification_templates:`Benachrichtigungsvorlagen`,smart_plugs:`Smart Plugs`,printers:`Drucker`,filaments:`Filamente`,maintenance_types:`Wartungstypen`,archives:`Archive`,projects:`Projekte`,pending_uploads:`Ausstehende Uploads`,external_links:`Externe Links`,api_keys:`API-Schlüssel`}},tags:{title:`Tags`,addTag:`Tag hinzufügen`,editTag:`Tag bearbeiten`,deleteTag:`Tag löschen`,tagName:`Tag-Name`,tagColor:`Tag-Farbe`,noTags:`Keine Tags`,deleteConfirm:`Möchten Sie diesen Tag wirklich löschen?`,manageTags:`Tags verwalten`},uploadModal:{title:`3MF-Dateien hochladen`,dragDrop:`3MF-Dateien hierher ziehen`,or:`oder`,browseFiles:`Dateien durchsuchen`,extractionInfo:`Das Druckermodell wird automatisch aus den 3MF-Datei-Metadaten extrahiert.`,uploaded:`hochgeladen`,failed:`fehlgeschlagen`,uploading:`Wird hochgeladen...`,upload:`Hochladen`,uploadFailed:`Hochladen fehlgeschlagen`},confirmOutcome:{title:`Wie ist Ihr Druck geworden?`,good:`Gut`,reject:`Ausschuss`,later:`Später fragen`,noPhoto:`Kein Abschlussfoto verfügbar`,savedGood:`Als Gutteil markiert`,savedReject:`Als Ausschuss markiert`,saveFailed:`Bewertung konnte nicht gespeichert werden`,rejectReason:`Ausschussgrund (optional)`,noReason:`Kein Grund`,saveReject:`Speichern`,rejectAndReprint:`Erneut drucken`,alreadyGood:`Bereits als Gutteil bestätigt.`,alreadyRejected:`Bereits als Ausschuss markiert.`,cardPrompt:`Wie ist der Druck geworden?`,sources:{dialog:`In der App erfasst.`,link:`Über einen Ein-Tipp-Link erfasst.`,plateClear:`Bei der Freigabe der Druckplatte erfasst.`,printerCard:`Über die Druckerkarte erfasst.`,api:`Über die API erfasst.`,reaction:`Über eine Reaktion im Chat erfasst.`}},editArchive:{title:`Archiv bearbeiten`,name:`Name`,namePlaceholder:`Druckname`,printer:`Drucker`,noPrinter:`Kein Drucker`,project:`Projekt`,noProject:`Kein Projekt`,itemsPrinted:`Gedruckte Teile`,itemsPrintedHelp:`Anzahl der in diesem Druckauftrag produzierten Teile. 0, wenn die ganze Platte unbrauchbar war.`,filamentUsed:`Verbrauchtes Filament (g)`,filamentUsedPlaceholder:`z. B. 46.16`,filamentUsedHelp:`Von Hand eintragen, wenn ein Druck ohne 3MF archiviert wurde, damit er in die Filament-Summen eingeht. Beim erneuten Einlesen eines Archivs mit 3MF wird der Wert wieder aus der Datei übernommen.`,notes:`Notizen`,notesPlaceholder:`Notizen zu diesem Druck hinzufügen...`,externalLink:`Externer Link`,externalLinkPlaceholder:`https://printables.com/model/...`,externalLinkHelp:`Link zu Printables, Thingiverse oder anderer Quelle`,tags:`Tags`,tagsPlaceholder:`Tags hinzufügen...`,addMoreTags:`Weitere Tags hinzufügen...`,matchingTags:`Übereinstimmend mit "{{query}}"`,existingTags:`Vorhandene Tags`,clickToAdd:`(zum Hinzufügen klicken)`,status:`Status`,userVerdict:`Ergebnis-Bewertung`,verdicts:{none:`Nicht festgelegt`,good:`Gutteil`,reject:`Ausschuss`},failureReason:`Fehlergrund`,selectReason:`Grund auswählen...`,photos:`Fotos des Druckergebnisses`,photosHelp:`Klicken Sie auf + um Fotos Ihres Druckergebnisses hinzuzufügen`,printResult:`Druckergebnis`,saving:`Wird gespeichert...`,failureReasons:{adhesionFailure:`Haftungsfehler`,spaghettiDetached:`Spaghetti / Abgelöst`,layerShift:`Schichtversatz`,cloggedNozzle:`Verstopfte Düse`,filamentRunout:`Filament aufgebraucht`,warping:`Verformung`,stringing:`Fadenziehen`,underExtrusion:`Unterextrusion`,powerFailure:`Stromausfall`,userCancelled:`Vom Benutzer abgebrochen`,noStatusUpdate:`Kein Statusupdate empfangen`,other:`Sonstiges`},statuses:{completed:`Abgeschlossen`,failed:`Fehlgeschlagen`,aborted:`Abgebrochen`,printing:`Druckt`}},kProfiles:{title:`K-Profile`,noPrintersConfigured:`Keine Drucker konfiguriert`,addPrinterInSettings:`Fügen Sie einen Drucker in den Einstellungen hinzu, um K-Profile zu verwalten`,noActivePrinters:`Keine aktiven Drucker`,enablePrinterConnection:`Aktivieren Sie eine Druckerverbindung, um K-Profile anzuzeigen`,loadingProfiles:`Lade K-Profile...`,printerOffline:`Drucker offline`,printerOfflineDesc:`Der ausgewählte Drucker ist nicht verbunden. Schalten Sie ihn ein, um K-Profile anzuzeigen.`,noMatchingProfiles:`Keine passenden Profile`,noMatchingProfilesDesc:`Keine Profile entsprechen Ihren Suchkriterien`,noKProfiles:`Keine K-Profile`,noKProfilesDesc:`Keine Druckvorschub-Profile für {{diameter}}mm Düse gefunden`,createFirstProfile:`Erstes Profil erstellen`,printer:`Drucker`,nozzle:`Düse`,refresh:`Aktualisieren`,addProfile:`Profil hinzufügen`,export:`Exportieren`,import:`Importieren`,select:`Auswählen`,selectAll:`Alle auswählen`,delete:`Löschen`,searchPlaceholder:`Nach Name oder Filament suchen...`,allExtruders:`Alle Extruder`,leftOnly:`Nur links`,rightOnly:`Nur rechts`,allFlow:`Alle Flusstypen`,hfOnly:`Nur HF`,sOnly:`Nur S`,sortName:`Sortieren: Name`,sortKValue:`Sortieren: K-Wert`,sortFilament:`Sortieren: Filament`,leftExtruder:`Linker Extruder`,rightExtruder:`Rechter Extruder`,modal:{addTitle:`K-Profil hinzufügen`,editTitle:`K-Profil bearbeiten`,profileName:`Profilname`,profileNamePlaceholder:`Mein PLA-Profil`,kValue:`K-Wert`,kValuePlaceholder:`0,020`,kValueHelp:`Typischer Bereich: 0,01 - 0,06 für PLA, 0,02 - 0,10 für PETG`,filament:`Filament`,selectFilament:`Filament auswählen...`,source:{local:`Importiert`,orcaCloud:`Orca Cloud`,bambuCloud:`Bambu Cloud`,builtin:`Integriert`},noFilamentsHelp:`Keine Filamente verfügbar. Melde dich bei Bambu Cloud an oder importiere Presets unter Profile → Lokale Profile.`,searchFilaments:`Filamente durchsuchen...`,noFilamentMatches:`Kein Filament passt zu dieser Suche`,flowType:`Flusstyp`,highFlow:`Hoher Durchfluss`,standard:`Standard`,nozzleSize:`Düsengröße`,extruder:`Extruder`,extruders:`Extruder`,left:`Links`,right:`Rechts`,notes:`Notizen (lokal gespeichert)`,notesPlaceholder:`Notizen zu diesem Profil hinzufügen...`,notesHelp:`Notizen werden in Bambuddy gespeichert, nicht auf dem Drucker`,syncing:`Synchronisiert mit Drucker...`,savingExtruder:`Speichern auf Extruder {{current}}/{{total}}...`,pleaseWait:`Bitte warten`},deleteConfirm:{title:`Profil löschen`,cannotUndo:`Dies kann nicht rückgängig gemacht werden`,message:`Möchten Sie "{{name}}" wirklich vom Drucker löschen?`},bulkDelete:{title:`Profile löschen`,cannotUndo:`Dies kann nicht rückgängig gemacht werden`,message:`Möchten Sie wirklich {{count}} ausgewählte Profile vom Drucker löschen?`},toast:{profileSaved:`K-Profil gespeichert`,profilesSaved:`K-Profil auf {{count}} Extrudern gespeichert`,selectAtLeastOneExtruder:`Bitte wählen Sie mindestens einen Extruder aus`,selectFilament:`Bitte zuerst ein Filament auswählen`,filamentNotResolvable:`Keine Bambu-Filament-ID für {{name}} — der Drucker kann dafür kein Profil speichern`,profileDeleted:`K-Profil gelöscht`,profilesDeleted:`{{count}} Profile gelöscht`,exportedProfiles:`{{count}} Profile exportiert`,importedProfiles:`{{count}} von {{total}} Profilen importiert`,noProfilesToExport:`Keine Profile zum Exportieren`,invalidFileFormat:`Ungültiges Dateiformat`,failedToParseImport:`Import-Datei konnte nicht gelesen werden`,failedToSaveBatch:`K-Profile konnten nicht gespeichert werden`,noteSaved:`Notiz gespeichert`,failedToSaveNote:`Notiz konnte nicht gespeichert werden`},permission:{noRead:`Sie haben keine Berechtigung, Profile zu aktualisieren`,noCreate:`Sie haben keine Berechtigung, Profile hinzuzufügen`,noUpdate:`Sie haben keine Berechtigung, K-Profile zu aktualisieren`,noDelete:`Sie haben keine Berechtigung, K-Profile zu löschen`,noExport:`Sie haben keine Berechtigung, Profile zu exportieren`,noImport:`Sie haben keine Berechtigung, Profile zu importieren`}},virtualPrinter:{title:`Virtueller Drucker`,running:`Läuft`,stopped:`Gestoppt`,description:{default:`Aktiviere einen virtuellen Drucker, der in Bambu Studio und OrcaSlicer erscheint. Dateien, die an diesen Drucker gesendet werden, werden direkt archiviert ohne zu drucken.`,proxy:`Aktiviere einen Proxy, der Slicer-Datenverkehr an einen echten Drucker weiterleitet, um Ferndruck über jedes Netzwerk zu ermöglichen.`},enable:{title:`Virtuellen Drucker aktivieren`,visibleInSlicer:`Sichtbar als "Bambuddy" in der Slicer-Erkennung`,proxyingTo:`Proxy zu {{name}}`,notActive:`Nicht aktiv`},model:{title:`Druckermodell`,description:`Wähle welches Druckermodell emuliert werden soll.`,restartWarning:`Das Ändern des Modells startet den virtuellen Drucker neu`},accessCode:{title:`Zugangscode`,isSet:`Zugangscode ist gesetzt`,notSet:`Kein Zugangscode gesetzt - erforderlich zum Aktivieren`,placeholder:`8-Zeichen-Code eingeben`,placeholderChange:`Neuen Code eingeben zum Ändern`,hint:`Muss genau 8 Zeichen lang sein. Wird von Slicern zur Authentifizierung verwendet.`,charCount:`({{count}}/8)`,inheritedFromTarget:`Vom Zieldrucker übernommen`,derivedFromTargetHint:`Verwendet den Zugangscode des Zieldruckers. Die Brücke leitet die Slicer-Authentifizierung an den echten Drucker weiter, daher müssen die Codes übereinstimmen — den Druckercode in dessen Einstellungen ändern.`,reveal:`Zugangscode anzeigen`,hide:`Zugangscode verbergen`},targetPrinter:{title:`Zieldrucker`,configured:`Proxy-Ziel konfiguriert`,notConfigured:`Kein Zieldrucker ausgewählt - erforderlich für Proxy-Modus`,placeholder:`Drucker auswählen...`,hint:`Wähle den Drucker aus, an den der Slicer-Datenverkehr weitergeleitet werden soll. Der Drucker muss im LAN-Modus sein.`,noPrinters:`Keine Drucker konfiguriert. Füge zuerst einen Drucker hinzu, um den Proxy-Modus zu verwenden.`},remoteInterface:{title:`Netzwerkschnittstelle überschreiben`,configured:`Schnittstellenüberschreibung aktiv`,optional:`Optional - verwenden wenn die automatisch erkannte IP falsch ist (z.B. mehrere NICs, Docker, VPN)`,placeholder:`Automatisch erkennen (Standard)...`,hint:`Überschreibt die per SSDP beworbene und im TLS-Zertifikat verwendete IP-Adresse. Nützlich wenn Bambuddy mehrere Netzwerkschnittstellen hat.`},mode:{title:`Modus`,archive:`Archivieren`,archiveDesc:`Dateien sofort archivieren`,review:`Überprüfen`,reviewDesc:`Vor dem Archivieren überprüfen`,queue:`Warteschlange`,queueDesc:`Archivieren und zur Warteschlange hinzufügen`,proxy:`Proxy`,proxyDesc:`An echten Drucker weiterleiten`},autoDispatch:{title:`Automatisch starten`,description:`Drucke automatisch starten, wenn sie zur Warteschlange hinzugefügt werden. Wenn deaktiviert, warten Drucke auf manuellen Start.`},queueForceColorMatch:{title:`Farbabgleich erzwingen`,description:`Druckaufträge nur an Drucker senden, bei denen der genaue Filament-Typ und die genaue Farbe geladen sind. Standardmäßig deaktiviert — ohne diese Option verwendet die Warteschlange nur den Drucker-Modell-Abgleich und wählt möglicherweise einen Drucker mit der falschen Farbe.`},saveAmsMapping:{title:`AMS-Zuordnung speichern`,description:`Speichert die vom Slicer selbst gewählte AMS-Steckplatz-Zuordnung (aus dem MQTT-Befehl project_file) im Archiv, sodass ein späterer erneuter Druck dieselbe physische Spule verwendet, anstatt sie erneut aus Typ/Farbe der Datei abzuleiten. Standardmäßig deaktiviert.`},gcodeInjection:{title:`G-code-Injektion`,description:`Wendet die in den Einstellungen pro Modell konfigurierten G-code-Snippets auf Jobs dieses VP an. Standardmäßig aus.`},tailscaleDisabled:{title:`Tailscale-Integration`,description:`Aktivieren, um diesen VP als per Tailscale erreichbar zu markieren. Zeigt die Tailscale-Adresse des Hosts an, damit du weißt, welche IP du im Slicer eintragen musst. Der CA-Import bleibt unverändert — diese Option hat keinen Einfluss auf Zertifikate.`},setupRequired:{title:`Einrichtung erforderlich`,description:`Die virtuelle Druckerfunktion erfordert zusätzliche Systemkonfiguration, bevor sie funktioniert. Dies beinhaltet Portweiterleitung, Firewall-Regeln und plattformspezifische Einstellungen.`,readGuide:`Lese die Einrichtungsanleitung vor dem Aktivieren`},archiveNameSource:{title:`Quelle des Archivnamens`,description:`Lege fest, wie neue Archive benannt werden, wenn Dateien über den virtuellen Drucker eintreffen. "Metadaten" verwendet den im 3MF eingebetteten Titel des Slicers (Standard). "Dateiname" nutzt den Dateinamen, den Bambu Studio per FTP gesendet hat. Hinweis: Bambu Studio überschreibt den im Dialog "Zum Drucker senden" eingegebenen Namen mit dem Titelfeld der 3MF, sofern eines vorhanden ist — beide Modi liefern daher oft denselben Wert.`,metadata:`Metadaten`,filename:`Dateiname`},caCert:{title:`Slicer-Zertifikat`,description:`Virtuelle Drucker verwenden ein TLS-Zertifikat, das von der Bambuddy-CA signiert ist. Importieren Sie dieses CA-Zertifikat einmalig in den Vertrauensspeicher Ihres Slicers, damit er die Verbindung akzeptiert — kein Abrufen über die Kommandozeile mehr nötig.`,copy:`Kopieren`,copied:`Kopiert`,download:`Herunterladen`,fingerprint:`SHA-256`},howItWorks:{title:`So funktioniert es`,step1:`Im selben LAN erscheinen virtuelle Drucker automatisch in deinem Slicer (Bambu Studio / OrcaSlicer). Aus anderen Netzwerken füge sie manuell per IP-Adresse und Zugangscode hinzu.`,step2:`Im Archiv-, Überprüfungs- und Warteschlangen-Modus verwende die "Senden"-Funktion im Slicer, um 3MF-Dateien an Bambuddy zu senden. Der Slicer zeigt "Druck erfolgreich" — die Datei wird gespeichert, nicht gedruckt.`,step3:`Im Proxy-Modus leitet der virtuelle Drucker den gesamten Datenverkehr an einen echten Drucker weiter — Drucke starten sofort wie bei einer direkten Verbindung.`},status:{title:`Status-Details`,printerName:`Druckername`,model:`Modell`,serialNumber:`Seriennummer`,mode:`Modus`,pendingFiles:`Ausstehende Dateien`,targetPrinter:`Zieldrucker`,ftpPort:`FTP-Port`,mqttPort:`MQTT-Port`,ftpConnections:`FTP-Verbindungen`,mqttConnections:`MQTT-Verbindungen`},toast:{updated:`Virtuelle Druckereinstellungen aktualisiert`,failedToUpdate:`Einstellungen konnten nicht aktualisiert werden`,copyFailed:`Kopieren fehlgeschlagen — bitte Text manuell markieren`,accessCodeRequired:`Bitte zuerst einen Zugangscode setzen`,targetPrinterRequired:`Bitte zuerst einen Zieldrucker auswählen`,bindIpRequired:`Bitte zuerst eine Bind-IP setzen`,accessCodeEmpty:`Zugangscode darf nicht leer sein`,accessCodeLength:`Zugangscode muss genau 8 Zeichen lang sein`,targetCodeChangedRebind:`Zugangscode wurde an den neuen Zieldrucker angepasst. Bitte dieses Gerät im Slicer neu hinzufügen, damit der neue Code übernommen wird.`,created:`Virtueller Drucker erstellt`,failedToCreate:`Virtueller Drucker konnte nicht erstellt werden`,deleted:`Virtueller Drucker gelöscht`,failedToDelete:`Virtueller Drucker konnte nicht gelöscht werden`},list:{title:`Virtuelle Drucker`,add:`Hinzufügen`,addFirst:`Virtuellen Drucker hinzufügen`,empty:`Keine virtuellen Drucker konfiguriert. Fügen Sie einen hinzu, um zu beginnen.`},bindIp:{title:`Bind-Interface`,placeholder:`Interface auswählen...`,hint:`Netzwerkinterface, an das dieser virtuelle Drucker gebunden wird. Muss pro Drucker eindeutig sein.`},proxy:{accessCodeHint:`Im Proxy-Modus den Zugangscode des Zieldruckers im Slicer verwenden. Die Verbindung wird transparent zum echten Drucker weitergeleitet.`},addDialog:{title:`Virtuellen Drucker hinzufügen`,name:`Name`,hint:`Sie können Zugangscode, Zieldrucker und andere Einstellungen nach dem Erstellen konfigurieren.`,create:`Erstellen`},deleteConfirm:{title:`Virtuellen Drucker löschen`,message:`Möchten Sie "{{name}}" wirklich löschen? Dies stoppt alle Dienste für diesen Drucker.`}},modelViewer:{stepConverting:`STEP-Modell wird konvertiert … {{seconds}} s`,stepSlowHint:`Große STEP-Dateien können eine Minute oder länger dauern.`,openInSlicer:`Im Slicer öffnen`,openInSlicerWith:`In {{slicer}} öffnen`,moreSlicerOptions:`Weitere Slicer-Optionen`,openInSlicerFailed:`Konnte nicht im Slicer öffnen`,tabs:{model:`3D-Modell`},notAvailable:`nicht verfügbar`,plates:`Platten`,allPlates:`Alle Platten`,plateNumber:`Platte {{number}}`,plateCount:`{{count}} Platte`,plateCount_other:`{{count}} Platten`,objectCount:`{{count}} Objekt`,objectCount_other:`{{count}} Objekte`,filamentCount:`{{count}} Filament`,filamentCount_other:`{{count}} Filamente`,eta:`ETA {{minutes}} Min`,noPreview:`Keine Vorschau für diese Datei verfügbar`,pagination:{pageOf:`Seite {{current}} von {{total}}`,prev:`Zurück`,next:`Weiter`},errors:{failedToLoad:`Datei konnte nicht geladen werden`,noMeshes:`Keine Meshes in 3MF-Datei gefunden`,unsupportedFormat:`Nicht unterstütztes Dateiformat`}},maintenanceDescriptions:{lubricateCarbonRods:`Schmiermittel auf Karbonstäbe für sanfte Bewegung auftragen`,lubricateRails:`Schmiermittel auf Linearschienen für sanfte Bewegung auftragen`,cleanNozzle:`Hotend und Düse reinigen, um Verstopfungen zu verhindern`,checkBelts:`Riemenspannung für präzise Drucke überprüfen`,cleanBuildPlate:`Druckplatte für bessere Haftung reinigen`,checkExtruder:`Extruderzahnräder auf Verschleiß prüfen`,checkCooling:`Sicherstellen, dass Lüfter ordnungsgemäß funktionieren`,generalInspection:`Allgemeine Druckerinspektion`,cleanCarbonRods:`Karbonstäbe reinigen, um Reibung zu reduzieren`,lubricateSteelRods:`Schmiermittel auf Stahlstangen für sanfte Bewegung auftragen`,cleanSteelRods:`Stahlstangen reinigen, um Reibung zu reduzieren`,cleanLinearRails:`Linearschienen abwischen, um Staub und Schmutz zu entfernen`,checkPtfeTube:`PTFE-Schlauch auf Verschleiß oder Beschädigung prüfen`,replaceHepaFilter:`HEPA-Filter für Luftqualität ersetzen`,replaceCarbonFilter:`Aktivkohlefilter ersetzen`,lubricateLeftNozzleRail:`Linke Düsenschiene schmieren (H2-Serie)`},haSensors:{label:`Sensoren`,unavailable:`Nicht verfügbar`,blocksPrints:`{{entity}} — hält Drucke zurück, solange der Alarm aktiv ist`,states:{open:`Offen`,closed:`Geschlossen`,unlocked:`Entriegelt`,locked:`Verriegelt`,detected:`Erkannt`,clear:`Frei`,wet:`Nass`,dry:`Trocken`,problem:`Problem`,ok:`OK`,running:`Läuft`,stopped:`Gestoppt`,on:`An`,off:`Aus`},sectionTitle:`Home-Assistant-Sensoren (Drucker)`,add:`Sensor hinzufügen`,addTitle:`Home-Assistant-Sensor hinzufügen`,editTitle:`Home-Assistant-Sensor bearbeiten`,empty:`Noch keine Sensoren. Verknüpfe einen Türkontakt oder ein Thermometer aus Home Assistant, um es auf der Druckerkarte anzuzeigen.`,unknownPrinter:`Unbekannter Drucker`,badgeBlocks:`Hält Drucke zurück`,badgeNotifies:`Benachrichtigt`,badgeHidden:`Auf Karte ausgeblendet`,printer:`Drucker`,entity:`Entität`,searchPlaceholder:`Entitäten suchen ...`,noEntities:`Keine passenden Entitäten`,name:`Anzeigename`,alertWhen:`Alarm wenn`,alertNever:`Nie — nur anzeigen`,alertAbove:`Über`,alertBelow:`Unter`,alertHint:`Der Alarmzustand hebt den Sensor auf der Druckerkarte hervor und aktiviert die Optionen unten.`,showOnCard:`Auf Druckerkarte anzeigen`,notifyOnAlert:`Benachrichtigen, sobald der Alarm ausgelöst wird`,blockPrint:`Wartende Drucke zurückhalten, solange der Alarm aktiv ist`,blockPrintHint:`Aufträge bleiben in der Warteschlange und starten von selbst, sobald der Sensor wieder frei ist. Wird ignoriert, solange Home Assistant nicht erreichbar ist.`,toast:{created:`Sensor hinzugefügt`,updated:`Sensor gespeichert`,deleted:`Sensor entfernt`},error:{pickEntity:`Wähle eine Home-Assistant-Entität`,nameRequired:`Gib einen Anzeigenamen ein`,printerRequired:`Wähle einen Drucker`,alertRequired:`Lege zuerst eine Alarmbedingung fest`}},locationHaSensors:{sectionTitle:`Home-Assistant-Sensoren (Lagerorte)`,sectionDescription:`Binden Sie Home-Assistant-Temperatur-, Luftfeuchtigkeits- oder Batteriesensoren an Ihre Lagerorte, um Live-Werte auf der Filament-Karte und in der Tabelle anzuzeigen. Pro Lagerort ist nur ein Sensor je Kategorie möglich.`,add:`Sensor hinzufügen`,addTitle:`Home-Assistant-Sensor hinzufügen`,editTitle:`Home-Assistant-Sensor bearbeiten`,empty:`Noch keine Sensoren. Verknüpfen Sie einen Temperatur- oder Feuchtigkeitssensor aus Home Assistant, um ihn auf der Filament-Karte anzuzeigen.`,unknownLocation:`Unbekannter Lagerort`,location:`Lagerort`,showOnCard:`Auf Filament-Karte anzeigen`,overwriteConfirm:{title:`Vorhandenen Sensor ersetzen?`,messageTemperature:`„{{location}}“ hat bereits einen Temperatursensor gebunden: {{name}}. Beim Fortfahren wird dieser ersetzt.`,messageHumidity:`„{{location}}“ hat bereits einen Luftfeuchtigkeitssensor gebunden: {{name}}. Beim Fortfahren wird dieser ersetzt.`,messageBattery:`„{{location}}“ hat bereits einen Batteriesensor gebunden: {{name}}. Beim Fortfahren wird dieser ersetzt.`},autoAdd:{confirmTitle:`Auch die anderen Sensoren hinzufügen?`,confirmMessage:`Bambuddy hat für diesen Lagerort auch weitere Sensoren gefunden. Wählen Sie aus, welche zusätzlich hinzugefügt werden sollen.`,added:`Zusätzlich hinzugefügt: {{names}}`,noneFound:`Keine passenden Temperatur-, Luftfeuchtigkeits- oder Batteriesensoren für diesen Lagerort gefunden.`,onlyThisOne:`Nur dieser`},options:{buttonLabel:`Sensor-Optionen`,title:`Lagerort-Sensor-Optionen`,description:`Diese Werte werden verwendet, wenn ein Temperatur-, Luftfeuchtigkeits- oder Batteriesensor automatisch mit einem Lagerort gebunden wird.`,generalSettings:`Allgemeine Einstellungen`,pollInterval:`Aktualisierungsintervall (Sekunden)`,pollIntervalHint:`Wie oft Bambuddy Home Assistant abfragt und die Sensorwerte auf dem Bildschirm aktualisiert. Minimum 60 Sekunden.`,colorizeValues:`Sensorwerte anhand ihrer Alarmschwellen farbig darstellen`,aboveColor:`Farbe für Überschreitung`,belowColor:`Farbe für Unterschreitung`,optimalColor:`Farbe für Optimalwert`,colors:{red:`Rot`,orange:`Orange`,yellow:`Gelb`,green:`Grün`,blue:`Blau`,purple:`Lila`,pink:`Magenta`},saved:`Optionen gespeichert`,saveFailed:`Optionen konnten nicht gespeichert werden`,reset:`Zurücksetzen`,resetConfirm:{title:`Alle bestehenden Lagerort-Sensoren zurücksetzen?`,message:`Dies überschreibt die Alarmschwellen, Benachrichtigungen und Kartensichtbarkeit aller bestehenden Temperatur-, Luftfeuchtigkeits- und Batteriesensoren von Lagerorten mit den oben festgelegten Werten und setzt den Namen jedes Sensors auf seinen Home-Assistant-Anzeigenamen zurück – Drucker-Sensoren sind davon nicht betroffen. Dies kann nicht rückgängig gemacht werden. Je nach Anzahl der Sensoren kann dies einen Moment dauern.`},resetDone:`Auf {{count}} Lagerort-Sensoren angewendet`,resetFailed:`Zurücksetzen der Lagerort-Sensoren fehlgeschlagen`},deleteAllConfirm:{title:`Alle Sensoren löschen?`,message:`Dadurch werden alle {{count}} Sensoren entfernt, die an „{{location}}“ gebunden sind. Dies kann nicht rückgängig gemacht werden.`},currentlyBound:`Aktuell gebunden: {{entity}}`,error:{locationRequired:`Wählen Sie einen Lagerort`},toast:{created:`Sensor hinzugefügt`,updated:`Sensor gespeichert`,deleted:`Sensor entfernt`}},smartPlugs:{offline:`Offline`,admin:`Admin`,openPlugAdminPage:`Plug-Admin-Seite öffnen`,deleteSmartPlug:`Smart Plug löschen`,turnOnSmartPlug:`Smart Plug einschalten`,turnOffSmartPlug:`Smart Plug ausschalten`,turnOn:`Einschalten`,turnOff:`Ausschalten`,addSmartPlug:{scanningNetwork:`Netzwerk wird durchsucht...`,chooseEntity:`Entität auswählen...`,connectionFailed:`Verbindung fehlgeschlagen`,searchEntities:`Entitäten suchen...`,searchPowerSensors:`Leistungssensoren suchen...`,searchEnergySensors:`Energiesensoren suchen...`,placeholders:{plugName:`Wohnzimmer Steckdose`,mqttStateOnValue:`ON, true, 1`,mqttSameAsPower:`Gleich wie Leistungs-Topic oder anders`}},linkedTo:`Verbunden mit:`,monitorOnly:`Nur Überwachung`,alerts:`Alarme`,scheduleOn:`Ein {{time}}`,scheduleOff:`Aus {{time}}`,on:`Ein`,off:`Aus`,power:`Leistung`,kwhToday:`kWh Heute`,settings:`Einstellungen`,automationSettings:`Automatisierungseinstellungen`,showInSwitchbar:`In Schaltleiste anzeigen`,quickAccessSidebar:`Schnellzugriff über Seitenleiste`,enabled:`Aktiviert`,enableAutomation:`Automatisierung für diesen Stecker aktivieren`,autoOn:`Auto Ein`,autoOnDescription:`Einschalten wenn Druck startet`,autoOff:`Auto Aus`,autoOffDescription:`Ausschalten wenn Druck abgeschlossen (einmalig)`,autoOffPersistent:`Aktiviert lassen`,autoOffPersistentDescription:`Zwischen Drucken aktiviert bleiben statt einmalig`,controlsPrinterPower:`Versorgt den Drucker`,controlsPrinterPowerDescription:`Deaktivieren, wenn diese Steckdose nur Zubehör versorgt (Filterlüfter, Licht). Sonst wird der Drucker beim Ausschalten als offline markiert.`,autoOffAfterDrying:`Automatisch aus nach Trocknung`,autoOffAfterDryingDescription:`Ausschalten, wenn AMS-Trocknung abgeschlossen ist`,delayAfterDryingMinutes:`Verzögerung nach Trocknung (Minuten)`,turnOffDelayMode:`Ausschaltverzögerungsmodus`,time:`Zeit`,temp:`Temp.`,delayMinutes:`Verzögerung (Minuten)`,tempThreshold:`Temperaturschwelle (°C)`,tempThresholdDescription:`Schaltet aus wenn die Düse unter diese Temperatur abkühlt`,edit:`Bearbeiten`,deleteConfirm:`Möchten Sie "{{name}}" wirklich löschen? Dies kann nicht rückgängig gemacht werden.`,turnOnConfirm:`Möchten Sie "{{name}}" wirklich einschalten?`,turnOffConfirm:`Möchten Sie "{{name}}" wirklich ausschalten? Dies unterbricht die Stromversorgung des angeschlossenen Geräts.`,failedToTurn:`{{name}}" konnte nicht {{action}} werden`,unknown:`Unbekannt`,addTitle:`Smart Plug hinzufügen`,editTitle:`Smart Plug bearbeiten`,stopScanning:`Suche beenden`,discoverTasmota:`Tasmota Geräte suchen`,foundDevices:`{{count}} Gerät(e) gefunden - zum Auswählen klicken:`,noDevicesFound:`Keine Tasmota Geräte in Ihrem Netzwerk gefunden`,haNotConfigured:`Home Assistant ist nicht konfiguriert. Einrichtung unter`,haSettingsPath:`Einstellungen → Netzwerk → Home Assistant`,selectEntity:`Entität auswählen *`,ipAddress:`IP-Adresse *`,nameLabel:`Name *`,username:`Benutzername`,password:`Passwort`,authHint:`Leer lassen, wenn Ihr Tasmota-Gerät keine Authentifizierung benötigt`,linkToPrinter:`Mit Drucker verbinden`,noPrinter:`Kein Drucker (nur manuelle Steuerung)`,linkingDescription:`Verknüpfung ermöglicht automatisches Ein-/Ausschalten bei Druckstart/-ende`,powerAlerts:`Leistungsalarme`,alertAbove:`Alarm wenn über (W)`,alertBelow:`Alarm wenn unter (W)`,alertDescription:`Benachrichtigung wenn der Stromverbrauch diese Schwellenwerte überschreitet. Leer lassen um diese Richtung zu deaktivieren.`,dailySchedule:`Tagesplan`,turnOnAt:`Einschalten um`,turnOffAt:`Ausschalten um`,scheduleDescription:`Den Stecker automatisch täglich zu diesen Zeiten ein-/ausschalten. Leer lassen um diese Aktion zu überspringen.`,showOnPrinterCard:`Auf Druckerkarte anzeigen`,displayOnPrinterCard:`Schaltfläche auf Druckerkarte anzeigen`,connectedResult:`Verbunden!`,deviceLabel:`Gerät: {{name}} - `,stateLabel:`Status: {{state}}`,test:`Test`,delete:`Löschen`,save:`Speichern`,add:`Hinzufügen`,cancel:`Abbrechen`,failedToStartScan:`Suche konnte nicht gestartet werden`,nameRequired:`Name ist erforderlich`,entityRequired:`Entität ist für Home Assistant Stecker erforderlich`,mqttTopicRequired:`Mindestens ein MQTT-Topic muss für Leistung, Energie oder Statusüberwachung konfiguriert sein`,loadingEntities:`Entitäten werden geladen...`,loading:`Laden...`,failedToLoadEntities:`Entitäten konnten nicht geladen werden: {{error}}`,noEntitiesMatching:`Keine Entitäten gefunden die "{{search}}" entsprechen`,noEntitiesAvailable:`Keine Entitäten verfügbar`,searchingEntities:`Alle Entitäten durchsuchen ({{count}} gefunden)`,showingEntities:`Zeige switch, light, input_boolean ({{count}} verfügbar)`,energyMonitoringOptional:`Energieüberwachung (Optional)`,energyMonitoringHint:`Sensoren suchen und auswählen, die Leistungs-/Energiedaten liefern.`,powerSensorW:`Leistungssensor (W)`,energyTodayKwh:`Energie Heute (kWh)`,totalEnergyKwh:`Gesamtenergie (kWh)`,noMatchingSensors:`Keine passenden Sensoren`,none:`Keine`,mqttNotConfigured:`MQTT-Broker nicht konfiguriert. Broker-Adresse einstellen unter`,mqttSettingsPath:`Einstellungen → Netzwerk → MQTT-Veröffentlichung`,mqttNotConfiguredSuffix:`(Sie müssen die Veröffentlichung nicht aktivieren, nur die Broker-Details ausfüllen).`,mqttMonitorOnlyDescription:`MQTT-Stecker empfangen Leistungs-/Energiedaten über MQTT-Abonnement. Ein-/Ausschalten ist nicht verfügbar - verwenden Sie Ihren MQTT-Broker oder Ihr Home-Automation-System.`,powerMonitoring:`Leistungsüberwachung`,energyMonitoring:`Energieüberwachung`,stateMonitoring:`Statusüberwachung`,optional:`optional`,topic:`Thema`,jsonPath:`JSON-Pfad`,multiplier:`Multiplikator`,onValue:`EIN-Wert`,mqttPowerHint:`JSON-Pfad extrahiert Wert aus JSON-Payload (z.B. "power_l1"). Leer lassen wenn Topic rohe numerische Werte sendet. +Multiplikator 0.001 für mW→W, 1000 für kW→W verwenden.`,mqttEnergyHint:`JSON-Pfad extrahiert Wert aus JSON-Payload. Leer lassen für rohe Werte. +Multiplikator 0.001 für Wh→kWh, 1000 für MWh→kWh verwenden.`,mqttStateHint:`JSON-Pfad extrahiert Wert aus JSON-Payload. Leer lassen für rohe Werte. +EIN-Wert: der genaue String der "EIN" bedeutet. Leer lassen für Auto-Erkennung (ON, true, 1).`,restControl:`Steuerung`,restOnUrl:`Einschalt-URL`,restOffUrl:`Ausschalt-URL`,restOnBody:`EIN-Anforderungstext`,restOffBody:`AUS-Anforderungstext`,restMethod:`HTTP-Methode`,restHeaders:`Custom Headers (JSON)`,restStatusUrl:`Status-URL`,restStatusPath:`JSON-Pfad für Status`,restStatusOnValue:`EIN-Wert`,restPowerUrl:`Strom-URL`,restPowerPath:`JSON-Pfad für Leistung`,restPowerMultiplier:`Power Multiplikator`,restEnergyUrl:`Energie URL`,restEnergyPath:`JSON-Pfad für Energie (heute)`,restEnergyTotalPath:`JSON-Pfad für Energie (Gesamtzähler)`,restEnergyTotalMultiplier:`Multiplikator Gesamtzähler`,restEnergyTotalPathHint:`z.B. aenergy.total`,restEnergyTotalHint:`Viele Steckdosen — darunter alle Shellys — liefern nur einen Gesamtzähler, der nie zurückgesetzt wird. Er gehört hierher, nicht in das Feld darüber: als Tagesverbrauch gelesen würde er um Mitternacht nie zurückspringen, und Gestern und Gesamt blieben leer. Bambuddy errechnet Heute und Gestern daraus, wofür ein bis zwei Tage an Messwerten nötig sind. Ein Shelly liefert Wattstunden, also Multiplikator 0.001 verwenden.`,restEnergyMultiplier:`Energie Multiplikator`,restUrlRequired:`Mindestens eine URL (ON oder OFF) ist für REST-Steckdosen erforderlich`,restHeadersHint:`z. B. {"Authorization": "Bearer your-token"}`,restBodyHint:`z. B. ON, {"state": "on"}`,restStatusHint:`URL zum Abfragen des aktuellen Status`,restPathHint:`z. B. state oder data.power.status`,restPowerUrlHint:`Eigene URL für Leistungsdaten (nutzt Status URL wenn leer)`,restEnergyUrlHint:`Eigene URL für Energiedaten (nutzt Status URL wenn leer)`,restEnergyHint:`Jeder Wert kann eine eigene URL verwenden oder auf die Status URL zurückgreifen. Multiplikatoren für Einheitenumrechnung verwenden (z.B. 0.001 für Wh zu kWh).`,testConnection:`Verbindung testen`,connectionSuccess:`Verbindung erfolgreich`,noSwitchesInSwitchbar:`Keine Schalter in der Schaltleiste`,enableSwitchbarHint:`"In Schaltleiste anzeigen" unter Einstellungen > Smart Plugs aktivieren`},notifications:{notifyLockScreenWidgets:`Sperrbildschirm-Widgets (iOS)`,notifyLockScreenWidgetsHelp:`Nur aktive Drucker außerhalb des Wartungsmodus erhalten Widgets. Notify! erlaubt insgesamt 10 Widgets pro Gerät. Füge über die iOS-Sperrbildschirmanpassung ein Notify!-Widget hinzu und wähle einen Drucker. Es zeigt Status, Fortschritt und Probleme ohne laufenden Countdown. iOS aktualisiert etwa alle 15 Minuten oder seltener.`,notifyPhotoUnavailable:`Browser- und Gruppenempfänger unterstützen nur Textmitteilungen; Fotoanhänge sind nicht verfügbar.`,notifyShowStage:`Druckphase anzeigen`,notifyTimeSensitive:`Dringliche Problemmeldungen`,notifyTimeSensitiveHelp:`Markiert fehlgeschlagene oder gestoppte Drucke sowie Drucker- oder KI-Probleme als dringlich. Andere Push-Mitteilungen bleiben normal.`,notifyPrivacy:`Dateiname auf Kachel ausblenden`,notifyPrivacyHelp:`Blendet Dateinamen nur in der Live-Aktivität aus. Push-Texte verwenden weiterhin die Mitteilungsvorlagen.`,notifyStyle:`Fortschrittsdarstellung`,notifyStyleBar:`Fortschrittsbalken`,notifyStyleSegments:`Segmente`,notifyStyleNone:`Keine Fortschrittsanzeige`,notifyDashboardUrl:`Dashboard-URL (optional)`,notifySymbol:`Symbolname (optional)`,notifyTint:`Akzentfarbe (optional)`,notifyAppearance:`Darstellung der Live-Aktivität`,notifyMetrics:`Messwerte`,notifyMetricsHelp:`Der Timer wird standardmäßig angezeigt. Optionale Messwerte ersetzen die Dateinamenzeile.`,notifyDeviceId:`Geräte- oder Gruppen-ID`,notifyToken:`Notify!-Token`,notifyIconUrl:`Symbol-URL (optional)`,notifyGroupType:`Mitteilungsgruppe (optional)`,notifyGroupTypeHelp:`Leer lassen, um Push-Mitteilungen nach Drucker zu gruppieren. Ein eigener Wert fasst sie in derselben Gruppe zusammen.`,notifyLiveActivities:`Live-Aktivitäten (iOS)`,notifyLiveActivitiesHelp:`Verfolge Drucke auf dem iOS-Sperrbildschirm und in der Dynamic Island. Verwende eine iOS-Geräte-ID und einen separaten Anbieter für Gruppenmitteilungen.`,notifyLifecycleHelp:`Live-Aktivitäten begleiten jeden Druck automatisch. Die Ereignisschalter unten steuern nur Push-Mitteilungen. Ruhezeiten verhindern neue Aktivitäten; bestehende werden weiter aktualisiert und beendet. Tageszusammenfassungen verzögern keine Aktivitäten.`,notifyIosFeaturesUnavailable:`Live-Aktivitäten und Sperrbildschirm-Widgets benötigen eine iOS-Geräte-ID. Gruppen-, Browser- und macOS-IDs nutzen nur Push-Mitteilungen.`,notifyTestHelp:`Der Test sendet eine Push-Mitteilung. Eine Live-Aktivität beginnt beim Druckstart.`,providerTypes:{notify:`Notify!`,callmebot:`CallMeBot/WhatsApp`,ntfy:`ntfy`,pushover:`Pushover`,telegram:`Telegram`,email:`E-Mail`,discord:`Discord`,webhook:`Webhook`,homeassistant:`Home Assistant`,bark:`Bark`,gotify:`Gotify`},providerDescriptions:{notify:`Push-Mitteilungen und iOS-Live-Aktivitäten über Notify!`,email:`SMTP-E-Mail-Benachrichtigungen`,telegram:`Benachrichtigungen über Telegram-Bot`,discord:`An Discord-Kanal per Webhook senden`,ntfy:`Kostenlose, selbst-hostbare Push-Benachrichtigungen`,pushover:`Einfache, zuverlässige Push-Benachrichtigungen`,callmebot:`Kostenlose WhatsApp-Benachrichtigungen über CallMeBot`,webhook:`Generischer HTTP-POST an beliebige URL`,homeassistant:`Dauerhafte Benachrichtigungen im Home Assistant Dashboard`,bark:`iOS-Push-Benachrichtigungen über Bark (selbst hostbar)`,gotify:`Push-Benachrichtigungen über deinen eigenen Gotify-Server`},lastSuccess:`Zuletzt: {{date}}`,error:`Fehler`,printer:`Drucker:`,allPrinters:`Alle Drucker`,sendTestNotification:`Testbenachrichtigung senden`,eventSettings:`Ereigniseinstellungen`,enabled:`Aktiviert`,sendFromProvider:`Benachrichtigungen von diesem Anbieter senden`,printEvents:`Druckereignisse`,printerStatus:`Druckerstatus`,amsAlarms:`AMS-Alarme`,amsHtAlarms:`AMS-HT-Alarme`,printQueue:`Druckwarteschlange`,start:`Start`,plateCheck:`Plattenkontrolle`,complete:`Abgeschlossen`,failed:`Fehlgeschlagen`,stopped:`Gestoppt`,progress:`Fortschritt`,offline:`Offline`,lowFilament:`Filament niedrig`,maintenance:`Wartung`,amsHumidity:`AMS-Feuchtigkeit`,amsTemp:`AMS-Temperatur`,amsDryingSuspended:`Trocknung ausgesetzt`,amsHtHumidity:`AMS-HT-Feuchtigkeit`,amsHtTemp:`AMS-HT-Temperatur`,bedCooled:`Bett abgekühlt`,firstLayer:`Erste Schicht`,quiet:`Ruhe`,digest:`Zusammenfassung {{time}}`,noPhoto:`Kein Foto`,printStarted:`Druck gestartet`,plateNotEmpty:`Platte nicht leer`,plateNotEmptyDescription:`Objekte vor dem Druck erkannt`,plateClearRequired:`Platte freigeben`,plateClearRequiredDescription:`Druck beendet, Warteschlange wartet auf Bestätigung`,printConfirmRequest:`Ergebnis-Bestätigung`,printConfirmRequestDescription:`Gut/Ausschuss-Bewertung mit Ein-Klick-Links anfordern, wenn ein dafür aktivierter Druck abgeschlossen wird`,plateClear:`Platte freigeben`,printCompleted:`Druck abgeschlossen`,bedCooledLabel:`Bett abgekühlt`,bedCooledDescription:`Bett nach dem Druck unter Schwellenwert abgekühlt`,firstLayerCompleteLabel:`Erste Schicht fertig`,firstLayerCompleteDescription:`Benachrichtigung mit Foto nach erster Schicht`,connectedApps:`Verbundene Apps`,appMessages:`Nachrichten verbundener Apps`,appMessagesDescription:`Nachrichten zustellen, die andere Anwendungen über Bambuddy senden, z. B. Bambuddy Orders`,appMessagesBadge:`Apps`,missingSpoolAssignmentLabel:`Fehlende Spulenzuordnung`,billingChargeFailedLabel:`Abrechnungsfehler`,billingChargeFailedDescription:`Benachrichtigen, wenn Druckkosten nicht verbucht werden konnten`,missingSpoolAssignmentDescription:`Benachrichtigen, wenn ein Druck startet und benoetigte Schaechte keine zugeordnete Spule haben`,printFailed:`Druck fehlgeschlagen`,printStopped:`Druck gestoppt`,progressMilestones:`Fortschrittsmeilensteine`,progressMilestonesDescription:`Benachrichtigung bei 25%, 50%, 75%`,printerOffline:`Drucker offline`,printerError:`Druckerfehler`,aiFailureDetection:`KI-Fehlererkennung`,aiFailureDetectionDescription:`Benachrichtigen, wenn die Obico-KI einen möglichen Druckfehler erkennt`,lowFilamentLabel:`Filament niedrig`,maintenanceDue:`Wartung fällig`,maintenanceDueDescription:`Benachrichtigen, wenn Wartung erforderlich ist`,amsHumidityHigh:`AMS-Feuchtigkeit hoch`,amsHumidityHighDescription:`Normale AMS-Feuchtigkeit überschreitet Schwellenwert`,amsTemperatureHigh:`AMS-Temperatur hoch`,amsTemperatureHighDescription:`Normale AMS-Temperatur überschreitet Schwellenwert`,amsDryingSuspendedTitle:`Automatische Trocknung ausgesetzt`,amsDryingSuspendedDescription:`Automatische Trocknung wurde für eine AMS-Einheit aufgegeben, weil die Luftfeuchtigkeit nie unter den Schwellenwert fiel`,amsHtHumidityHigh:`AMS-HT-Feuchtigkeit hoch`,amsHtHumidityHighDescription:`AMS-HT-Feuchtigkeit überschreitet Schwellenwert`,amsHtTemperatureHigh:`AMS-HT-Temperatur hoch`,amsHtTemperatureHighDescription:`AMS-HT-Temperatur überschreitet Schwellenwert`,inventoryAlerts:`Bestandswarnungen`,stockReorderAlert:`Nachbestellungswarnung`,stockReorderAlertDescription:`SKU hat seinen Nachbestellungspunkt erreicht`,stockBreakAlert:`Bestandsunterbrechungswarnung`,stockBreakAlertDescription:`Der Bestand wird vor dem Eintreffen der Nachbestellung aufgebraucht sein`,jobAdded:`Auftrag hinzugefügt`,jobAddedDescription:`Auftrag zur Warteschlange hinzugefügt`,jobAssigned:`Auftrag zugewiesen`,jobAssignedDescription:`Modellbasierter Auftrag einem Drucker zugewiesen`,jobStarted:`Auftrag gestartet`,jobStartedDescription:`Warteschlangenauftrag hat Druck begonnen`,jobWaiting:`Auftrag wartet`,jobWaitingDescription:`Auftrag wartet auf Filament oder Drucker`,jobSkipped:`Auftrag übersprungen`,jobSkippedDescription:`Auftrag übersprungen (vorheriger fehlgeschlagen)`,jobFailed:`Auftrag fehlgeschlagen`,jobFailedDescription:`Auftrag konnte nicht gestartet werden`,queueComplete:`Warteschlange abgeschlossen`,queueCompleteDescription:`Alle Warteschlangenaufträge beendet`,quietHours:`Ruhezeiten`,noNotificationsDuring:`Keine Benachrichtigungen während dieser Zeiten`,editProviderToChangeQuietHours:`Anbieter bearbeiten, um Ruhezeiten zu ändern`,dailyDigest:`Tägliche Zusammenfassung`,batchNotifications:`Benachrichtigungen zu einer täglichen Zusammenfassung bündeln`,sendAt:`Senden um {{time}}`,editProviderToChangeDigestTime:`Anbieter bearbeiten, um Zusammenfassungszeit zu ändern`,edit:`Bearbeiten`,deleteProvider:`Benachrichtigungsanbieter löschen`,deleteConfirm:`Sind Sie sicher, dass Sie "{{name}}" löschen möchten? Dies kann nicht rückgängig gemacht werden.`,delete:`Löschen`,addTitle:`Benachrichtigungsanbieter hinzufügen`,editTitle:`Benachrichtigungsanbieter bearbeiten`,nameLabel:`Name *`,namePlaceholder:`Meine Benachrichtigungen`,providerTypeLabel:`Anbietertyp *`,configuration:`Konfiguration`,testConfiguration:`Konfiguration testen`,printerFilter:`Druckerfilter`,onlyFromPrinter:`Nur Benachrichtigungen für Ereignisse von diesem Drucker senden`,attachPhotoLabel:`Foto anhängen`,attachPhotoDescription:`Einen Kamera-Schnappschuss mitsenden, sofern für das Ereignis einer aufgenommen wurde`,quietHoursDnd:`Ruhezeiten (Nicht stören)`,quietStart:`Start`,quietEnd:`Ende`,dailyDigestLabel:`Tägliche Zusammenfassung`,sendDigestAt:`Zusammenfassung senden um`,digestCollected:`Ereignisse werden gesammelt und als einzelne Zusammenfassung zu dieser Zeit gesendet`,notificationEvents:`Benachrichtigungsereignisse`,progressPercent:`(25 %, 50 %, 75 %)`,bedCooledAfterPrint:`(nach Druckabschluss)`,haSensorAlert:`Drucker-Sensor-Alarm`,haSensorAlertDescription:`(ein verknüpfter Home-Assistant-Sensor braucht Aufmerksamkeit)`,locationHaSensorAlert:`Lagerort-Sensor-Alarm`,locationHaSensorAlertDescription:`(ein mit einem Lagerort verknüpfter Home-Assistant-Sensor braucht Aufmerksamkeit)`,eventPriority:{sectionTitle:`ntfy-Priorität`,helpNtfy:`Wähle eine Priorität pro aktiviertem Ereignis. ntfy nutzt diese, um Hinweise (Ton, Sichtbarkeit, Push-Verhalten) zu eskalieren. Hier nicht gesetzte Stufen verwenden den ntfy-Server-Standard.`,sectionTitleGotify:`Gotify-Priorität`,helpGotify:`Wähle eine Priorität pro aktiviertem Ereignis. Bambuddy sendet Min., Niedrig, Standard, Hoch und Dringend als 0, 2, 5, 8 und 10 an Gotify. In der Gotify-Android-App spielen Standard und höher einen Ton ab, Hoch und Dringend erscheinen zusätzlich als Pop-up.`,min:`Min.`,low:`Niedrig`,default:`Standard`,high:`Hoch`,urgent:`Dringend`},cancel:`Abbrechen`,save:`Speichern`,add:`Hinzufügen`,nameRequired:`Name ist erforderlich`,fieldRequired:`{{field}} ist erforderlich`,haDataInvalid:`Das Datenfeld muss ein gültiges JSON-Objekt sein, z. B. {"priority": "high", "ttl": 0}`,haServiceHelp:`Optional — standardmäßig eine dauerhafte Benachrichtigung in der Home-Assistant-Oberfläche. Lege einen Notify-Dienst fest (z. B. notify.mobile_app_myphone), um Push-Benachrichtigungen auf dem Handy zu erhalten; dann wird automatisch ein Kamera-Schnappschuss angehängt, sofern einer vorhanden ist und unter Einstellungen → Netzwerk eine Externe URL eingetragen ist.`,phoneNumber:`Telefonnummer`,apiKey:`API-Schlüssel`,serverUrl:`Server-URL`,topic:`Thema`,authToken:`Auth-Token`,userKey:`Benutzerschlüssel`,appToken:`App-Token`,priority:`Priorität`,pushoverRetry:`Notfall-Wiederholung (s)`,pushoverExpire:`Notfall-Ablauf (s)`,botToken:`Bot-Token`,chatId:`Chat-ID`,telegramThreadId:`Forum-Themen-ID`,telegramThreadIdHelp:`Optional. Sendet in ein einzelnes Thema einer Forum-Gruppe — die letzte Zahl im Themen-Link (t.me/c/.../25). Leer lassen für das allgemeine Thema.`,telegramThreadIdInvalid:`Die Forum-Themen-ID muss eine Zahl sein.`,telegramVerdictMode:`Ergebnis-Urteil per`,telegramVerdictModeButtons:`Inline-Buttons (Link)`,telegramVerdictModeReactions:`Reaktion (👍 / 👎)`,telegramVerdictModeBoth:`Buttons und Reaktion`,telegramVerdictModeHelp:`Wie die Ergebnis-Abfrage beantwortet wird. Reaktionen brauchen keine eingehende Verbindung und keine externe URL — Bambuddy fragt sie beim Bot ab. Für Reaktionen einen Bot verwenden, den nur Bambuddy nutzt: Eine andere App, die denselben Bot abfragt (z. B. Home Assistant), bekommt ihre Nachrichten sonst nicht mehr, auch nicht nach dem Zurückschalten auf Buttons. In einer Gruppe muss der Bot Admin sein, um Reaktionen zu sehen.`,telegramVerdictBadgeReactions:`Reaktionen`,telegramVerdictBadgeBoth:`Buttons + Reaktionen`,smtpServer:`SMTP-Server`,smtpPort:`SMTP-Port`,security:`Sicherheit`,authentication:`Authentifizierung`,username:`Benutzername`,password:`Passwort`,fromEmail:`Absender-E-Mail`,toEmail:`Empfänger-E-Mail`,webhookUrl:`Webhook-URL`,payloadFormat:`Payload-Format`,authorization:`Autorisierung`,titleFieldName:`Titel-Feldname`,messageFieldName:`Nachrichten-Feldname`,editTemplate:`Vorlage bearbeiten: {{name}}`,titleLabel:`Titel`,bodyLabel:`Inhalt`,titlePlaceholder:`Benachrichtigungstitel...`,bodyPlaceholder:`Benachrichtigungsinhalt...`,availableVariables:`Verfügbare Variablen`,clickToInsert:`Klicken, um an Cursorposition im Inhalt einzufügen`,livePreview:`Live-Vorschau`,hide:`Ausblenden`,show:`Anzeigen`,loadingPreview:`Vorschau wird geladen...`,enterTemplateContent:`Vorlageninhalt eingeben, um Vorschau zu sehen`,titlePreview:`Titel:`,bodyPreview:`Inhalt:`,photoPreview:`Foto:`,photoPreviewNote:`Nur ein Beispiel — Dienste, die Anhänge unterstützen (ntfy, Pushover, Telegram, Discord, Home Assistant, Bark, Slack webhook), fügen automatisch einen Kamera-Schnappschuss hinzu, wenn einer aufgenommen wurde, unabhängig vom Text oben.`,photoPreviewNoteWithEmail:`Nur ein Beispiel — wird bei unterstützten Diensten (ntfy, Pushover, Telegram, Discord, Home Assistant, Bark, Slack webhook) automatisch angehängt, wenn ein Schnappschuss aufgenommen wurde. Für E-Mail füge {finish_photo_url} in den Text oben ein, um das Foto eingebettet zu senden.`,photoPreviewNoteEmailOnly:`Nur ein Beispiel — dies ist immer eine E-Mail. Füge {finish_photo_url} in den Text oben ein, um das Foto eingebettet zu senden; ohne die Variable wird nur der Text verschickt.`,resetToDefault:`Auf Standard zurücksetzen`,titleRequired:`Titel ist erforderlich`,bodyRequired:`Inhalt ist erforderlich`,notificationLog:`Benachrichtigungsprotokoll`,showFailedOnly:`Nur fehlgeschlagene`,last24Hours:`Letzte 24 Stunden`,last7Days:`Letzte 7 Tage`,last30Days:`Letzte 30 Tage`,last90Days:`Letzte 90 Tage`,justNow:`Gerade eben`,noFailedNotifications:`Keine fehlgeschlagenen Benachrichtigungen`,noNotificationsLogged:`Keine Benachrichtigungen protokolliert`,unknownProvider:`Unbekannter Anbieter`,logTitle:`Titel`,logMessage:`Nachricht`,logError:`Fehler`,logProvider:`Anbieter: {{type}}`,logTime:`Zeit: {{time}}`,refresh:`Aktualisieren`,clearOld:`Alte löschen`,statsSummary:`Letzte {{days}} Tage:`,statsNotifications:`Benachrichtigungen`,statsSent:`{{count}} gesendet`,statsFailed:`{{count}} fehlgeschlagen`,eventTypes:{print_start:`Druck gestartet`,print_complete:`Druck abgeschlossen`,print_failed:`Druck fehlgeschlagen`,print_stopped:`Druck gestoppt`,print_progress:`Fortschritt`,printer_offline:`Drucker offline`,printer_error:`Druckerfehler`,filament_low:`Filament niedrig`,maintenance_due:`Wartung fällig`,test:`Test`},userEmail:{title:`Benachrichtigungen`,emailNotifications:`E-Mail-Benachrichtigungen`,emailNotificationsDesc:`Erhalten Sie E-Mail-Benachrichtigungen für Ihre eigenen Druckaufträge. E-Mails werden über die in der erweiterten Authentifizierung konfigurierten SMTP-Einstellungen gesendet.`,sendingTo:`Benachrichtigungen werden gesendet an`,noEmailWarning:`Ihr Konto hat keine E-Mail-Adresse. Wenden Sie sich an einen Administrator, um eine hinzuzufügen.`,printJobNotifications:`Druckauftrags-Benachrichtigungen`,printJobNotificationsDesc:`Wählen Sie aus, welche Ereignisse E-Mail-Benachrichtigungen für von Ihnen gesendete Druckaufträge auslösen.`,printJobStarts:`Druckauftrag startet`,printJobStartsDesc:`Benachrichtigt werden, wenn Ihr Druckauftrag beginnt.`,printJobFinishes:`Druckauftrag fertig`,printJobFinishesDesc:`Benachrichtigt werden, wenn Ihr Druckauftrag erfolgreich abgeschlossen wurde.`,printErrors:`Druckfehler`,printErrorsDesc:`Benachrichtigt werden, wenn Ihr Druckauftrag fehlschlägt oder auf einen Fehler stößt.`,printJobStops:`Druckauftrag gestoppt`,printJobStopsDesc:`Benachrichtigt werden, wenn Ihr Druckauftrag abgebrochen oder gestoppt wird.`,saveSuccess:`Benachrichtigungseinstellungen gespeichert.`,saveError:`Benachrichtigungseinstellungen konnten nicht gespeichert werden.`}},richTextEditor:{bold:`Fett`,italic:`Kursiv`,underline:`Unterstrichen`,bulletList:`Aufzählungsliste`,numberedList:`Nummerierte Liste`,alignLeft:`Linksbündig`,alignCenter:`Zentriert`,alignRight:`Rechtsbündig`,addLink:`Link hinzufügen`,removeLink:`Link entfernen`},externalLinks:{title:`Seitenleisten-Links`,sidebarLayout:`Seitenleiste`,sidebarLayoutDescription:`Integrierte Seiten ein- oder ausblenden, externe Links hinzufügen und Elemente ziehen, um die Seitenleisten-Navigation neu zu ordnen.`,systemPages:`Bambuddy-Seiten`,externalLinks:`Externe Links`,visibleInSidebar:`In Seitenleiste sichtbar`,hiddenFromSidebar:`In Seitenleiste ausgeblendet`,requiredInSidebar:`In Seitenleiste erforderlich`,hidePage:`Seite ausblenden`,showPage:`Seite anzeigen`,settingsCannotBeHidden:`Einstellungen können nicht ausgeblendet werden`,noLinksConfigured:`Keine externen Links konfiguriert`,deleteLink:`Link löschen`,removeCustomIcon:`Benutzerdefiniertes Symbol entfernen`,openInNewTab:`In neuem Tab öffnen`,placeholders:{linkName:`Mein Link`}},keyboardShortcuts:{title:`Tastaturkürzel`,navigation:`Navigation`,archivesSection:`Archive`,kProfilesSection:`K-Profile`,generalSection:`Allgemein`,shortcuts:{goToPrinters:`Zu Drucker gehen`,goToArchives:`Zu Archiv gehen`,goToQueue:`Zur Warteschlange gehen`,goToStats:`Zu Statistiken gehen`,goToProfiles:`Zu Cloud-Profilen gehen`,goToSettings:`Zu Einstellungen gehen`,focusSearch:`Suche fokussieren`,openUploadModal:`Upload-Modal öffnen`,clearSelection:`Auswahl löschen / Eingabe aufheben`,contextMenu:`Kontextmenü auf Karten`,refreshProfiles:`Profile aktualisieren`,newProfile:`Neues Profil`,exitSelectionMode:`Auswahlmodus beenden`,showHelp:`Diese Hilfe anzeigen`},footer:`Drücken Sie Esc oder klicken Sie außerhalb, um zu schließen`},notificationLog:{title:`Benachrichtigungsprotokoll`,events:{printStarted:`Druck gestartet`,printComplete:`Druck abgeschlossen`,printFailed:`Druck fehlgeschlagen`,printStopped:`Druck gestoppt`,progress:`Fortschritt`,printerOffline:`Drucker offline`,printerError:`Druckerfehler`,lowFilament:`Wenig Filament`,maintenanceDue:`Wartung fällig`,test:`Test`},timeAgo:{justNow:`Gerade eben`,minutesAgo:`vor {{minutes}}m`,hoursAgo:`vor {{hours}}h`}},restoreBackup:{title:`Backup wiederherstellen`,restoring:`Wird wiederhergestellt...`,restoreComplete:`Wiederherstellung abgeschlossen`,restoreFailed:`Wiederherstellung fehlgeschlagen`,importSettings:`Einstellungen aus Backup-Datei importieren`,pleaseWait:`Bitte warten Sie, während Ihre Daten wiederhergestellt werden`,clickToSelect:`Klicken Sie, um Backup-Datei auszuwählen (.json oder .zip)`,howDuplicateHandling:`So funktioniert die Duplikatbehandlung:`,categories:{printers:`Drucker`,smartPlugs:`Smart Plugs`,notificationProviders:`Benachrichtigungsanbieter`,filaments:`Filamente`,archives:`Archive`,pendingUploads:`Ausstehende Uploads`,settingsTemplates:`Einstellungen & Vorlagen`},matchingInfo:{printers:`abgeglichen nach Seriennummer`,smartPlugs:`abgeglichen nach IP-Adresse`,notificationProviders:`abgeglichen nach Name`,filaments:`abgeglichen nach Name + Typ + Marke`,archives:`abgeglichen nach Inhalts-Hash`,pendingUploads:`abgeglichen nach Dateiname`,settingsTemplates:`immer überschrieben`},replaceExisting:`Vorhandene Daten ersetzen`,keepExisting:`Vorhandene Daten behalten`,replaceDescription:`Bereits vorhandene Elemente mit Backup-Daten überschreiben`,keepDescription:`Nur Elemente wiederherstellen, die noch nicht existieren`,caution:`Vorsicht:`,cautionText:`Das Überschreiben ersetzt Ihre aktuellen Konfigurationen durch Backup-Daten. Drucker-Zugangscodes werden aus Sicherheitsgründen niemals überschrieben.`,itemsRestored:`Wiederhergestellte Elemente`,itemsSkipped:`Übersprungene Elemente`,restored:`Wiederhergestellt`,skipped:`Übersprungen (existieren bereits)`,filesLabel:`Dateien (3MF, Thumbnails, etc.)`,newApiKeysGenerated:`Neue API-Schlüssel generiert`,newApiKeysWarning:`Diese Schlüssel werden nur einmal angezeigt. Kopieren Sie sie jetzt!`,processingBackup:`Backup-Datei wird verarbeitet...`,noDataFound:`In der Backup-Datei wurden keine wiederherzustellenden Daten gefunden.`,failedToRestore:`Backup konnte nicht wiederhergestellt werden. Bitte überprüfen Sie das Dateiformat.`},backupExport:{title:`Backup exportieren`,selectData:`Zu exportierende Daten auswählen`,selectAll:`Alle auswählen`,selectNone:`Keine auswählen`,categoryDescriptions:{settings:`Sprache, Theme, Update-Einstellungen`,notifications:`ntfy, Pushover, Discord, usw.`,templates:`Benutzerdefinierte Nachrichtenvorlagen`,smartPlugs:`Tasmota-Plug-Konfigurationen`,externalLinks:`Seitenleiste Links zu externen Diensten`,printers:`Druckerinformationen (Zugangscodes ausgeschlossen)`,plateDetection:`Leere Platten-Referenzbilder`,filaments:`Filamenttypen und -kosten`,maintenance:`Benutzerdefinierte Wartungspläne`,archives:`Alle Druckdaten + Dateien (3MF, Thumbnails, Fotos)`,projects:`Projekte, BOM-Elemente und Anhänge`,pendingUploads:`Virtueller Drucker-Uploads zur Überprüfung`,apiKeys:`Webhook-API-Schlüssel (neue Schlüssel bei Import generiert)`},requiresPrinters:`Drucker müssen ausgewählt sein`,zipFileWarning:`ZIP-Datei wird erstellt.`,zipFileDescription:`Enthält alle 3MF-Dateien, Thumbnails, Zeitraffer und Fotos. Dies kann eine Weile dauern und zu einer großen Datei führen.`,includeAccessCodes:`Zugangscodes einschließen`,includeAccessCodesDescription:`Für die Übertragung auf eine andere Maschine`,includeAccessCodesWarning:`Zugangscodes werden im Klartext eingeschlossen. Bewahren Sie diese Backup-Datei sicher auf!`,categoriesSelected:`{{selectedCount}} Kategorien ausgewählt`},pendingUploads:{placeholders:{notes:`Notizen zu diesem Druck hinzufügen...`},discardUpload:`Upload verwerfen`,archiveAllUploads:`Alle Uploads archivieren`,discardAllUploads:`Alle Uploads verwerfen`,archive:`Archivieren`,timeAgo:{justNow:`Gerade eben`,minutesAgo:`vor {{minutes}}m`,hoursAgo:`vor {{hours}}h`,daysAgo:`vor {{days}}d`}},apiBrowser:{placeholders:{requestBody:`JSON-Anforderungstext...`,searchEndpoints:`Endpunkte suchen...`}},configureAmsSlot:{title:`AMS-Slot konfigurieren`,slotConfigured:`Slot konfiguriert!`,configuringSlot:`Slot wird konfiguriert:`,slotLabel:`{{ams}} – Slot {{slot}}`,searchPresets:`Voreinstellungen suchen...`,colorPlaceholder:`Farbname oder Hex (z.B. braun, FF8800)`,clearCustomColor:`Benutzerdefinierte Farbe löschen`,noCloudPresets:`Keine Cloud-Voreinstellungen. Melden Sie sich bei Bambu Cloud an, um zu synchronisieren.`,noPresetsAvailable:`Keine Voreinstellungen verfügbar. Melden Sie sich bei Bambu Cloud an oder importieren Sie lokale Profile.`,noMatchingPresets:`Keine passenden Voreinstellungen gefunden.`,custom:`Benutzerdefiniert`,builtin:`Integriert`,orcaCloud:`Orca Cloud`,bambuCloud:`Bambu Cloud`,settingsSentToPrinter:`Einstellungen an Drucker gesendet`,filamentProfile:`Filamentprofil`,kProfileLabel:`K-Profil (Pressure Advance)`,filteringFor:`Filtern nach: {{material}}`,noKProfile:`Kein K-Profil (Standard 0.020 verwenden)`,noMatchingKProfiles:`Keine passenden K-Profile gefunden. Standard K=0.020 wird verwendet.`,otherKProfiles:`Weitere K-Profile auf diesem Drucker`,selectFilamentFirst:`Zuerst ein Filamentprofil auswählen`,kFromCalibration:`K={{value}} aus Druckerkalibrierung`,customColorLabel:`Benutzerdefinierte Farbe (optional)`,presetColors:`{{name}} Farben:`,showLessColors:`Weniger Farben anzeigen`,showMoreColors:`Mehr Farben anzeigen`,clear:`Löschen`,hexLabel:`Hex – #{{hex}}`,resetting:`Wird zurückgesetzt...`,resetSlot:`Slot zurücksetzen`,cancel:`Abbrechen`,configuring:`Wird konfiguriert...`,configureSlot:`Slot konfigurieren`,orcaFallback:{no_filament_id:`Dieses Orca-Profil hat keine eigene Filament-ID, daher sieht OrcaSlicer diesen Slot als Generic {{material}}.`,lookup_failed:`Die Filament-ID dieses Profils konnte nicht aus der Orca Cloud gelesen werden, daher sieht OrcaSlicer diesen Slot als Generic {{material}}. Versuche es gleich noch einmal.`,no_permission:`Du hast keinen Zugriff auf die Orca Cloud, daher konnte die Filament-ID dieses Profils nicht gelesen werden. OrcaSlicer sieht diesen Slot als Generic {{material}}.`}},githubBackup:{title:`Git-Backup`,history:`Verlauf`,downloadBackup:`Backup herunterladen`,restoreBackup:`Backup wiederherstellen`,noBackupsYet:`Noch keine Backups`},emailSettings:{placeholders:{fromName:`Bambuddy`}},tagManagement:{searchTags:`Tags suchen...`,renameTag:`Tag umbenennen`,deleteTag:`Tag löschen`},notificationTemplates:{placeholders:{title:`Benachrichtigungstitel...`,body:`Benachrichtigungstext...`}},batchTag:{placeholders:{newTag:`Neuen Tag eingeben...`}},photoGallery:{deletePhoto:`Foto löschen`},filamentHoverCard:{copySpoolUuid:`Spulen-UUID kopieren`},kProfilesView:{hasNote:`Hat Notiz`,copyProfile:`Profil kopieren`},layout:{openMenu:`Menü öffnen`,noPermissionSystemInfo:`Sie haben keine Berechtigung zum Anzeigen von Systeminformationen`},dashboard:{dragToReorder:`Ziehen zum Neuordnen`,hideWidget:`Widget ausblenden`},notificationProviderCard:{deleteNotificationProvider:`Benachrichtigungsanbieter löschen`},fileManagerModal:{closeFileManager:`Dateimanager schließen`,sortFiles:`Dateien sortieren`,goToParentFolder:`Zum übergeordneten Ordner gehen`,threeView:`3D-Ansicht`},embeddedCameraViewer:{refreshStream:`Stream aktualisieren`,close:`Schließen`,zoomOut:`Verkleinern`,resetZoom:`Zoom zurücksetzen`,zoomIn:`Vergrößern`,dragToResize:`Ziehen zum Größe ändern`},timelapseViewer:{skipBack5s:`5s zurückspringen`,skipForward5s:`5s vorspringen`},notificationProviders:{descriptions:{email:`SMTP-E-Mail-Benachrichtigungen`,telegram:`Benachrichtigungen über Telegram-Bot`,discord:`An Discord-Kanal über Webhook senden`,ntfy:`Kostenlose, selbst hostbare Push-Benachrichtigungen`,pushover:`Einfache, zuverlässige Push-Benachrichtigungen`,callmebot:`Kostenlose WhatsApp-Benachrichtigungen über CallMeBot`,webhook:`Generischer HTTP POST zu beliebiger URL`}},logViewer:{searchPlaceholder:`Nachricht oder Logger-Name suchen...`,noLogEntries:`Keine Logeinträge gefunden`},switchbarPopover:{noSwitchesInSwitchbar:`Keine Schalter in Schalterleiste`},projectPageModal:{placeholders:{title:`Titel`,designer:`Designer`,license:`Lizenz`,description:`Beschreibung eingeben...`,profileTitle:`Profil-Titel`,profileDescription:`Profilbeschreibung...`}},spoolmanSettings:{},time:{unknown:`-`,waiting:`Wartend`,justNow:`Gerade eben`,now:`Jetzt`,minsAgo:`vor {{count}}m`,inMins:`in {{count}}min`,hoursAgo:`vor {{count}}h`,inHours:`in {{count}}Std`,daysAgo:`vor {{count}}d`,inDays:`in {{count}}T`},spoolbuddy:{nav:{dashboard:`Übersicht`,ams:`AMS`,inventory:`Inventar`,writeTag:`Schreiben`,settings:`Einstellungen`},status:{nfcReady:`NFC bereit`,nfcOff:`NFC aus`,offline:`Offline`,online:`Online`,noPrinters:`Keine Drucker`,deviceOffline:`Gerät offline`,waitingConnection:`Warte auf Geräteverbindung...`,systemReady:`System bereit`,status:`Status`},dashboard:{readyToScan:`Bereit zum Scannen`,idleMessage:`Spule auf die Waage legen zum Identifizieren`,nfcHint:`NFC-Tag wird automatisch gelesen`,device:`Gerät`,syncWeight:`Gewicht sync.`,weightSynced:`Synchronisiert!`,unknownTag:`Unbekannter Tag`,newTag:`Neuer Tag erkannt`,onScale:`auf der Waage`,linkSpool:`Mit Spule verknüpfen`,linkTagTitle:`Tag mit Spule verknüpfen`,linkTag:`Tag verknüpfen`,selectSpool:`Spule zum Verknüpfen auswählen:`,noUntagged:`Keine Spulen ohne Tags gefunden`,tagDetected:`Tag erkannt`,noTag:`Kein Tag`,tagId:`Tag`,grossWeight:`Bruttogewicht`,spoolSize:`Spulengröße`,close:`Schließen`,currentSpool:`Aktuelle Spule`,plateReady:`Druckplatte bereit: {{name}}`,plateReadyLabel:`Bereit-zum-Quittieren-Liste`,plateClearAction:`Frei`,plateClearedToast:`Druckplatte als geleert markiert`,plateClearFailed:`Druckplatte konnte nicht als geleert markiert werden`},modal:{spoolDetected:`Spule erkannt`,assignToAms:`AMS zuweisen`,syncWeight:`Gewicht sync.`,weightSynced:`Synchronisiert!`,syncing:`Synchronisiere...`,newTagDetected:`Neuer Tag erkannt`,addToInventory:`Zum Inventar hinzufügen`,assignToAmsTitle:`AMS zuweisen`,selectSlot:`Slot auswählen`,assign:`Zuweisen`,assigning:`Zuweisen...`,assignSuccess:`Zugewiesen!`,assignPendingInsert:`Zugewiesen. Slot wird beim Einsetzen der Spule konfiguriert.`,assignError:`Fehler beim Zuweisen. Bitte erneut versuchen.`,noPrinterSelected:`Drucker auswählen...`,noAmsDetected:`Kein AMS an diesem Drucker erkannt`,slot:`Slot`},weight:{noReading:`Kein Messwert`,stable:`Stabil`,measuring:`Messen...`,tare:`Tarieren`,calibrate:`Kalibrieren`},spool:{remaining:`Verbleibend`,material:`Material`,brand:`Marke`,color:`Farbe`,coreWeight:`Kern`,labelWeight:`Etikett`,scaleWeight:`Waage`,netWeight:`Netto`,lastUsed:`Zuletzt verwendet`,unknownColor:`Unbekannte Farbe`},ams:{noData:`Kein AMS erkannt`,connectAms:`AMS anschließen um Filament-Slots zu sehen`,noPrinter:`Kein Drucker ausgewählt`,selectPrinter:`Drucker in der oberen Leiste auswählen`,printerDisconnected:`Drucker getrennt`,humidity:`Feuchtigkeit`,level:`Stufe`,active:`Aktiv`,slot:`Slot`,empty:`Leer`},inventory:{search:`Spulen suchen...`,empty:`Keine Spulen im Inventar`,noResults:`Keine passenden Spulen`,spools:`Spulen`,addSpool:`Spule hinzufügen`},settings:{tabDevice:`Gerät`,tabDisplay:`Anzeige`,tabScale:`Waage`,tabUpdates:`Aktualisierungen`,nfcReader:`NFC-Leser`,type:`Typ`,connection:`Verbindung`,notConnected:`N/V`,deviceInfo:`Geräteinfo`,hostname:`Host`,uptime:`Betriebszeit`,systemConfig:`Backend & Auth`,backendUrl:`Bambuddy Backend URL`,apiToken:`API-Token`,apiTokenPlaceholder:`API-Token eingeben`,saveConfig:`Konfiguration speichern`,systemQueued:`Konfiguration in Warteschlange.`,nfcDiagnostic:`NFC-Diagnose`,scaleDiagnostic:`Waagen-Diagnose`,readTagDiagnostic:`Tag-Lese-Diagnose`,testNfc:`Leser testen`,testScale:`Genauigkeit testen`,testReadTag:`Tag lesen`,systemFieldsRequired:`Backend-URL ist erforderlich.`,brightness:`Helligkeit`,saved:`Gespeichert`,noBacklight:`Keine DSI-Hintergrundbeleuchtung erkannt. Helligkeitssteuerung erfordert ein DSI-Display.`,screenBlank:`Bildschirm-Abschaltzeit`,screenBlankDesc:`Bildschirm schaltet sich nach Inaktivität ab. Zum Aufwecken berühren.`,displayNote:`Helligkeit wird als Software-Filter angewendet.`,scaleCalibration:`Waagen-Kalibrierung`,currentWeight:`Aktuelles Gewicht`,tareOffset:`Tara`,calFactor:`Faktor`,knownWeight:`Bekanntes Gewicht`,calStep1:`Alle Gegenstände von der Waage entfernen und Nullpunkt setzen.`,calStep2:`Bekanntes Gewicht auf die Waage legen.`,setZero:`Nullpunkt setzen`,calibrateNow:`Kalibrieren`,calibrated:`Kalibriert`,tareSet:`Tara-Befehl gesendet. Warte auf Gerät...`,tareComplete:`Tara abgeschlossen!`,tareTimedOut:`Tara-Zeitüberschreitung — läuft der SpoolBuddy-Daemon?`,tareFailed:`Tara-Befehl fehlgeschlagen`,zeroSet:`Nullpunkt gesetzt. Bekanntes Gewicht auf die Waage legen.`,calibrationDone:`Kalibrierung abgeschlossen!`,calibrationFailed:`Kalibrierung fehlgeschlagen`,lastCalibrated:`Zuletzt kalibriert`,stable:`Stabil`,settling:`Stabilisierung...`,firmware:`Firmware`,scale:`Waage`,noDevice:`Kein SpoolBuddy-Gerät gefunden`,daemonVersion:`Daemon-Version`,currentVersion:`Aktuell`,versionPending:`Warte auf Daemon...`,checking:`Prüfe...`,checkUpdates:`Nach Updates suchen`,updateAvailable:`Update verfügbar`,updateInstructions:`Update per SSH: SpoolBuddy-Installationsskript ausführen.`,upToDate:`Aktuell`,includeBeta:`Beta-Versionen einschließen`},writeTag:{tabExisting:`Vorhandene Spule`,tabNew:`Neue Spule`,tabReplace:`Tag ersetzen`,searchPlaceholder:`Suche nach Material, Farbe, Marke...`,noUntaggedSpools:`Keine Spulen ohne Tags`,noTaggedSpools:`Keine Spulen mit Tags`,selectSpool:`Spule auswählen, dann einen NTAG auf den Leser legen`,placeTag:`NTAG auf den Leser legen`,tagReady:`Tag erkannt — bereit zum Schreiben`,writeTag:`Tag beschreiben`,replaceTag:`Tag ersetzen`,writing:`Tag wird beschrieben...`,waiting:`Warte auf SpoolBuddy...`,writeSuccess:`Tag erfolgreich beschrieben!`,writeFailed:`Schreiben fehlgeschlagen`,queueFailed:`Schreibbefehl konnte nicht eingereiht werden`,tryAgain:`Erneut versuchen`,cancel:`Abbrechen`,replaceWarning:`Alter Tag wird getrennt. Neuer Tag ersetzt ihn.`,deviceOffline:`SpoolBuddy ist offline`,material:`Material`,colorName:`Farbname`,color:`Farbe`,brand:`Marke`,weight:`Gewicht (g)`,createSpool:`Spule erstellen`,creating:`Wird erstellt...`,spoolCreated:`Spule erstellt! Bereit zum Schreiben.`,createFailed:`Spule konnte nicht erstellt werden`,incompleteDataWarning:`Tag mit unvollständigen Spoolman-Daten geschrieben`},quickMenu:{printerPower:`Drucker-Strom`,systemControls:`System`,restartDaemon:`Daemon neustarten`,restartBrowser:`Browser neustarten`,reboot:`Neustart`,shutdown:`Herunterfahren`,swipeToClose:`Nach unten wischen zum Schließen`,confirmTitle:`Bestätigen`,confirmShutdown:`Möchten Sie das SpoolBuddy wirklich herunterfahren? Sie benötigen physischen Zugang, um es wieder einzuschalten.`,confirmReboot:`Möchten Sie das SpoolBuddy wirklich neu starten?`,confirmRestartDaemon:`SpoolBuddy-Daemon neustarten? NFC und Waage sind vorübergehend nicht verfügbar.`,confirmRestartBrowser:`Kiosk-Browser neustarten? Das Display wird kurz schwarz.`,confirm:`Bestätigen`,confirmPlugOn:`{{name}} einschalten?`,confirmPlugOff:`{{name}} ausschalten?`,turnOn:`Einschalten`,turnOff:`Ausschalten`}},diagnostic:{modalTitle:`Verbindungsdiagnose — {{name}}`,running:`Diagnose läuft...`,runningElapsed:`Diagnose läuft... ({{elapsed}}s)`,waitingForReportHint:`Warten darauf, dass der Drucker einen Statusbericht sendet — kann bis zu {{max}} Sekunden dauern.`,runFailed:`Diagnose konnte nicht ausgeführt werden: {{error}}`,retry:`Erneut ausführen`,runButton:`Diagnose ausführen`,sectionTitle:`Verbindungsdiagnose`,sectionDescription:`Prüfen, warum ein Drucker keine Verbindung herstellt oder nicht druckt — Port-Erreichbarkeit, LAN-Entwicklermodus, Docker-Netzwerkmodus und Zugangsdaten.`,noPrinters:`Keine Drucker konfiguriert.`,overall:{ok:`Keine Probleme gefunden — die Druckerverbindung sieht gut aus.`,warnings:`Der Drucker sollte funktionieren, aber einige Punkte erfordern Aufmerksamkeit.`,problems:`Probleme gefunden, die erklären, warum der Drucker keine Verbindung herstellt oder nicht druckt.`},check:{port_mqtt:{title:`Steuerungsport (MQTT 8883)`,pass:`Erreichbar — der Drucker akzeptiert Steuerungsverbindungen.`,fail:`Port 8883 ist nicht erreichbar. Der Drucker ist ausgeschaltet, hat eine andere IP-Adresse oder eine Firewall blockiert ihn. Überprüfen Sie die Drucker-IP und dass nichts Port 8883 blockiert.`},port_ftps:{title:`Dateiübertragungsport (FTPS 990)`,pass:`Erreichbar — das Senden von Druckdateien funktioniert.`,warn:`Port 990 ist nicht erreichbar. Die Überwachung funktioniert möglicherweise weiterhin, aber das Senden von Drucken an den Drucker schlägt fehl. Stellen Sie sicher, dass Port 990 nicht blockiert ist.`,warn_no_tls:`Port 990 ist offen, aber der Dateidienst des Druckers schließt den TLS-Handshake nicht ab. Druckdateien, Vorschaubilder und Zeitraffer können nicht abgerufen werden, daher bleiben Archive leer. Starten Sie den Drucker neu — den Port freizugeben hilft hier nicht.`},external_storage:{title:`Gesendete Dateien auf externem Speicher speichern (Installationsschritt 4)`,pass:`Der Drucker meldet, dass diese Option aktiv ist — gesendete Dateien werden auf der SD-Karte gespeichert und Archive enthalten Vorschaubilder und Slicer-Metadaten.`,fail:`Der Drucker meldet, dass diese Option deaktiviert ist. Aktivieren Sie "Gesendete Dateien auf externem Speicher speichern" — bei neuer Firmware (P2S 01.02 / Bambu Studio 2.6+) liegt der Schalter in den Druckeinstellungen des Druckers, bei älteren Versionen im Geräte-Tab von Bambu Studio / OrcaSlicer. Ohne diese Option fehlen jedem archivierten Druck Vorschaubild und Slicer-Metadaten.`,skip:`Nicht geprüft — eine aktive MQTT-Verbindung ist erforderlich. Bei älteren Slicern, in denen diese Einstellung nur im Slicer existiert, meldet sie der Drucker nicht — diese Prüfung besteht auch dann, wenn die Option deaktiviert ist. Prüfen Sie Installationsschritt 4 in diesem Fall manuell.`,skip_unsupported_model:`Dieses Modell hat einen SD-Slot, aber keine Möglichkeit, die Option zu aktivieren — die aktuelle P1-Firmware zeigt den Schalter in Bambu Studio nicht an und der Drucker hat kein Display. Hier gibt es nichts zu beheben; archivierten Drucken fehlen möglicherweise Vorschaubilder und Slicer-Metadaten, bis Bambu Lab dies per Firmware unterstützt.`,fail_no_media:`Die Option ist aktiviert, aber der Drucker meldet weder Karte noch Stick im Steckplatz, daher können gesendete Dateien nirgends abgelegt werden. Legen Sie einen ein und drucken Sie erneut — bis dahin fehlen jedem archivierten Druck Vorschaubild und Slicer-Metadaten.`,warn_internal_storage:`Die Option ist aktiviert und ein Speicher ist vorhanden, aber der letzte Druck landete dennoch im internen Speicher des Druckers, den Bambuddy nicht lesen kann. Bei der H2-Serie, dem P2S und dem X2D sendet die Schaltfläche "Drucken" in Bambu Studio unabhängig von dieser Option immer dorthin. Drucke werden mit Namen und Zeiten archiviert, aber ohne Vorschaubild und Slicer-Metadaten. Für vollständige Archive den Druck aus Bambuddy starten oder in OrcaSlicer slicen — oder in Bambu Studio "Senden" mit "Extern" verwenden und den Druck danach starten.`,warn_internal_history:`Die Option ist aktiv und Speicher vorhanden, aber der letzte Druck lief aus einer Datei, die bereits auf dem Drucker lag — ein erneuter Druck über sein Display, ein Start aus Handy oder eine früher gesendete Datei. Diese Bibliothek liegt im internen Speicher, den Bambuddy nicht lesen kann, und keine Einstellung ändert das, denn für diesen Druck wurde nichts gesendet. Er wird weiterhin mit Namen und Zeiten archiviert, nur ohne Vorschaubild und Slicer-Metadaten. Für vollständige Archive Drucke aus Bambuddy starten oder aus dem Slicer senden.`},port_rtsps:{title:`Kameraport ({{protocol}} {{port}})`,pass:`Erreichbar — der Kamerastream funktioniert.`,warn:`Port {{port}} ist nicht erreichbar. Die Live-Kameraansicht funktioniert nicht. Dies betrifft das Drucken nicht.`},macos_local_network:{title:`macOS-Berechtigung „Lokales Netzwerk“`,pass:`macOS erlaubt Bambuddy den Zugriff auf das lokale Netzwerk.`,warn_unsigned:`Das Python, das Bambuddy ausführt, hat keine Code-Signatur. Damit hat macOS nichts, woran es die Berechtigung „Lokales Netzwerk“ binden könnte, und verwirft jede Verbindung zum Drucker stillschweigend — ohne Fehler und ohne Nachfrage. Führe das Bambuddy-Update-Skript (install/update_macos.sh) aus, das die Signatur setzt, und starte Bambuddy anschließend neu. Interpreter: {{executable}}`,warn_permission:`Wenn der Drucker eingeschaltet und unter dieser Adresse erreichbar ist, öffne Systemeinstellungen > Datenschutz & Sicherheit > Lokales Netzwerk und stelle sicher, dass das Python von Bambuddy aktiviert ist. macOS verwirft lokale Verbindungen sonst stillschweigend, und ein Python-Update kann die alte Berechtigung zurücklassen.`},network_mode:{title:`Container-Netzwerkmodus`,genericRuntime:`einem Container`,pass:`Läuft in {{runtime}} mit Host-Netzwerk.`,warn:`Bambuddy läuft in {{runtime}} mit Bridge-Netzwerk. Die Druckererkennung und der virtuelle Drucker benötigen den Host-Netzwerkmodus — erstellen Sie den Container mit Host-Netzwerk neu ("network_mode: host" in docker-compose, "--network=host" bei Podman).`,skip:`Läuft nicht in einem Container — nicht zutreffend.`,skip_unknown:`Bambuddy läuft in {{runtime}}, der Netzwerkmodus konnte jedoch nicht ermittelt werden. Falls die Druckererkennung oder der virtuelle Drucker nicht funktionieren, erstellen Sie den Container mit Host-Netzwerk neu.`,skip_system_container:`Bambuddy läuft in einem {{runtime}}-Systemcontainer, der wie eine virtuelle Maschine direkt im LAN liegt — nicht zutreffend.`},subnet:{title:`Netzwerk-Subnetz`,pass:`Drucker und Bambuddy befinden sich im selben Subnetz.`,warn:`Der Drucker ({{printer_ip}}) und Bambuddy ({{host_ip}}) befinden sich in unterschiedlichen Subnetzen. Sie können sich möglicherweise nicht erreichen, sofern kein Routing zwischen den Subnetzen konfiguriert ist.`,skip:`Subnetz konnte nicht ermittelt werden — übersprungen.`},mqtt_auth:{title:`Drucker-Zugangsdaten`,pass:`Der Drucker hat die Verbindung akzeptiert.`,fail:`Der Drucker ist erreichbar, aber Bambuddy ist nicht mit ihm verbunden. Höchstwahrscheinlich ist der Zugangscode oder die Seriennummer falsch — der Zugangscode ändert sich bei jedem Umschalten von „Nur LAN“ oder des Entwicklermodus, kopieren Sie ihn also erneut vom Druckerbildschirm. Ein Drucker, der gerade neu startet oder bereits die maximale Anzahl gleichzeitiger Verbindungen erreicht hat, sieht genauso aus.`,fail_auth_rejected:`Der Drucker hat die Zugangsdaten von Bambuddy abgelehnt. Der Zugangscode oder die Seriennummer ist falsch — der Zugangscode ändert sich bei jedem Umschalten von „Nur LAN“ oder des Entwicklermodus. Kopieren Sie ihn erneut vom Druckerbildschirm und speichern Sie ihn in den Druckereinstellungen.`,skip:`Nicht geprüft — der Drucker konnte nicht erreicht werden.`},developer_mode:{title:`LAN-Entwicklermodus`,pass:`Der Entwicklermodus ist aktiviert.`,fail:`Der Entwicklermodus ist am Drucker AUS. Aktivieren Sie ihn in den LAN-Einstellungen des Druckers — und bestätigen Sie mit OK. Ohne ihn starten Drucke nicht.`,skip:`Konnte nicht geprüft werden — erfordert eine aktive Verbindung zum Drucker.`},printer_publishing:{title:`Drucker sendet Statusmeldungen`,pass:`Der Drucker sendet Statusmeldungen — AMS, Filamente und K-Profile werden korrekt zum Slicer gespiegelt.`,fail:`Der MQTT-Broker hat die Verbindung akzeptiert, der Drucker sendet aber keine Statusmeldungen. Fast immer liegt eine falsche oder falsch geschriebene Seriennummer vor — das Topic device//report unterscheidet Groß- und Kleinschreibung. Prüfen Sie die Seriennummer in den Druckereinstellungen gegen die Anzeige am Drucker.`,skip:`Konnte nicht geprüft werden — erfordert eine aktive Verbindung zum Drucker.`}}},systemHealth:{sectionTitle:`Systemzustand`,sectionDescription:`Durchsucht aktuelle Logs nach bekannten Problemen, die du meist selbst beheben kannst, bevor daraus ein Support-Ticket wird.`,rescan:`Erneut prüfen`,clean:`Keine bekannten Probleme in den letzten {{times}} Log-Einträgen gefunden.`,logUnavailable:`Die Protokollierung in Dateien ist deaktiviert, daher können keine Logs durchsucht werden. Aktiviere die Datei-Protokollierung, um diese Prüfung zu nutzen.`,learnMore:`Lösung anzeigen`,fixLabel:`Lösung:`,occurrences:`{{times}}× aufgetreten — zuletzt um {{lastSeen}}`,category:{layer8:`Das kannst du beheben`,environment:`Umgebung`,bug:`Bitte melden`},signature:{"ftp-auth-rejected":{name:`Drucker hat den Zugriffscode abgelehnt`,cause:`Der Drucker hat die Anmeldung für die Dateiübertragung abgelehnt. Der Zugriffscode ist falsch oder hat sich nach dem Umschalten des Entwicklermodus geändert.`,fix:`Kopiere den Zugriffscode erneut vom Druckerbildschirm (LAN-Einstellungen) und aktualisiere ihn in den Druckereinstellungen in Bambuddy.`},"ftp-connection-timeout":{name:`Zeitüberschreitung bei der Dateiübertragung`,cause:`Bambuddy konnte den Dateiübertragungs-Port des Druckers (FTPS 990) nicht erreichen. Der Port ist blockiert, oder der Drucker ist aus oder in einem anderen Subnetz.`,fix:`Stelle sicher, dass Port 990 zwischen Bambuddy und dem Drucker nicht blockiert wird und beide im selben Netzwerk sind.`},"ftp-ssl-error":{name:`Sicherer Dateiübertragungs-Handshake fehlgeschlagen`,cause:`Der Dateidienst des Druckers antwortet auf Port 990 ohne TLS. Sein Dateiserver hat sich aufgehängt — ein Fehler im Drucker, kein Firewall- oder Firmware-Problem.`,fix:`Starte den Drucker neu. Bis dahin lassen sich Druckdateien, Vorschaubilder und Timelapses nicht abrufen; das Drucken selbst ist nicht betroffen.`},"bambu-cloud-captcha":{name:`Bambu Cloud verlangt ein CAPTCHA`,cause:`Der Missbrauchsschutz von Bambu prüft dieses Netzwerk, daher kann keine Bambu-Cloud-Anmeldung abgeschlossen werden. Das hängt an der öffentlichen IP-Adresse, nicht an deinem Konto oder dieser Installation.`,fix:`Warte ab — normalerweise löst es sich innerhalb weniger Stunden, wiederholte Anmeldeversuche verlängern es. Zwischenzeitlich kannst du dich mit einem Zugriffstoken aus einer Browser-Sitzung anmelden.`},"mqtt-connection-flapping":{name:`Druckerverbindung bricht ständig ab`,cause:`Die Steuerverbindung (MQTT 8883) trennt und verbindet sich wiederholt — meist wegen einer schwachen Netzwerkverbindung oder eines teilweise blockierten Ports.`,fix:`Prüfe das WLAN-Signal am Drucker, bevorzuge eine Kabelverbindung und stelle sicher, dass Port 8883 zuverlässig erreichbar ist.`},"camera-connection-refused":{name:`Kamera-Stream nicht erreichbar`,cause:`Die Live-Kamera war auf Port RTSPS 322 nicht erreichbar. Der Port ist blockiert, oder die Kamera bzw. die LAN-Liveansicht ist am Drucker deaktiviert.`,fix:`Aktiviere Kamera und LAN-Liveansicht am Drucker und stelle sicher, dass Port 322 nicht blockiert ist. Das Drucken ist davon nicht betroffen.`},"database-locked":{name:`Datenbank-Schreibkonflikte`,cause:`Die SQLite-Datenbank meldet unter Last "database is locked"-Fehler — häufig beim Betrieb mehrerer Drucker gleichzeitig.`,fix:`Stelle Bambuddy auf eine externe PostgreSQL-Datenbank um. Siehe die PostgreSQL-Anleitung in der Dokumentation.`}}},vpDiagnostic:{title:`Einrichtungsprüfung — {{name}}`,runButton:`Einrichtungsprüfung ausführen`,running:`Einrichtungsprüfung läuft...`,runFailed:`Einrichtungsprüfung konnte nicht ausgeführt werden: {{error}}`,retry:`Erneut prüfen`,overall:{ok:`Alle Prüfungen bestanden — dieser virtuelle Drucker ist korrekt eingerichtet.`,warnings:`Der virtuelle Drucker sollte funktionieren, aber einige Punkte brauchen Aufmerksamkeit.`,problems:`Es wurden Probleme gefunden, die erklären, warum der Slicer diesen virtuellen Drucker nicht sehen oder nutzen kann.`},check:{enabled:{title:`Virtueller Drucker aktiviert`,fail:`Dieser virtuelle Drucker ist ausgeschaltet. Schalten Sie ihn ein, damit er erkennbar wird.`},running:{title:`Dienste laufen`,fail:`Der virtuelle Drucker ist aktiviert, aber seine Dienste laufen nicht. Prüfen Sie das Bambuddy-Protokoll — meist stoppt sie ein Bind-IP-Konflikt oder ein Berechtigungsfehler.`},bind_interface:{title:`Bind-Netzwerkschnittstelle`,fail:`Die Bind-Schnittstelle ist nicht gesetzt oder existiert auf diesem Host nicht mehr. Wählen Sie im Dropdown "Bind-Schnittstelle" eine aktuelle Schnittstelle.`},access_code:{title:`Zugangscode gesetzt`,fail:`Es ist kein Zugangscode gesetzt. Dem Slicer muss derselbe 8-stellige Zugangscode angegeben werden, den Sie hier festlegen.`},target_printer:{title:`Zieldrucker`,fail:`Es ist kein Zieldrucker ausgewählt. Der Proxy-Modus benötigt einen echten Drucker zum Weiterleiten.`,warn:`Der Zieldrucker ist gerade offline — die Weiterleitung wird fortgesetzt, sobald er sich wieder verbindet.`},port_ftps:{title:`Datei-Upload-Dienst (Port {{port}})`,fail:`Auf Port {{port}} der Bind-IP lauscht nichts, daher kann der Slicer keine Dateien hochladen. Ursache ist meist ein Port-Konflikt auf dieser Schnittstelle.`},port_mqtt:{title:`Steuerungsdienst (Port {{port}})`,fail:`Auf Port {{port}} der Bind-IP lauscht nichts, daher kann der Slicer sich nicht verbinden oder den Status anzeigen.`},port_bind:{title:`Erkennungsdienst (Port {{port}})`,fail:`Auf Port {{port}} der Bind-IP lauscht nichts, daher schlägt der Erkennungs-Handshake des Slicers fehl.`},privileged_ports:{title:`Bindung an privilegierte Ports`,fail:`Port {{port}} liegt unter 1024 und dieser Dienst darf ihn nicht belegen — deshalb lauscht oben nichts. Fügen Sie AmbientCapabilities=CAP_NET_BIND_SERVICE in /etc/systemd/system/bambuddy.service ein und starten Sie neu, oder führen Sie "sudo setcap cap_net_bind_service=+ep $(readlink -f $(which python3))" aus. Unter Docker ergänzen Sie cap_add: [NET_BIND_SERVICE].`},certificate:{title:`TLS-Zertifikat`,pass:`Zertifikat bereit. Stellen Sie sicher, dass das Bambuddy-CA-Zertifikat (oben) in den Vertrauensspeicher Ihres Slicers importiert ist.`,fail:`Das TLS-Zertifikat für diesen virtuellen Drucker fehlt. Prüfen Sie, ob das Bambuddy-Datenverzeichnis beschreibbar ist.`}}},bugReport:{logHealthSummary:`Bekannte Probleme in deinen Logs gefunden`,logHealthIntro:`Aktuelle Logs entsprechen bekannten Problemen. Sieh dir die Lösungen unten an — sie zu beheben könnte dein Problem ohne Fehlerbericht lösen. Du kannst unten trotzdem einen Bericht senden.`,title:`Fehler melden`,description:`Beschreibung`,descriptionPlaceholder:`Was ist schiefgelaufen? Bitte beschreiben Sie das Problem...`,email:`E-Mail (optional)`,emailPlaceholder:`ihre@email.de`,emailPrivacy:`Falls angegeben, wird Ihre E-Mail in einem eingeklappten Abschnitt des GitHub-Issues aufgeführt, damit der Betreuer sich melden kann.`,screenshot:`Screenshot`,uploadOrPaste:`Bild hochladen, einfügen oder ziehen`,dataCollectedSummary:`Welche Daten werden im Bericht gesendet?`,dataIncluded:`Enthalten:`,dataIncludedList:`App-Version, Betriebssystem, Architektur, Python-Version, Datenbankstatistiken (nur Anzahl), Druckermodelle, Düsenanzahl, Firmware-Versionen, Verbindungsstatus, Integrationsstatus (Spoolman, MQTT, HA), nicht-sensible Einstellungen, Netzwerkschnittstellenanzahl, Docker-Details, Abhängigkeitsversionen.`,dataNeverIncluded:`Nie enthalten:`,dataNeverIncludedList:`Druckernamen, Seriennummern, Zugangscodes, Passwörter, IP-Adressen, E-Mail-Adressen, API-Schlüssel, Tokens, Webhook-URLs, Hostnamen oder Benutzernamen.`,submit:`Absenden`,startLogging:`Debug-Protokollierung starten`,stepEnableLogging:`Debug-Protokollierung aktiviert`,stepReproduce:`Problem jetzt reproduzieren`,stepStopLogging:`Stoppen & Bericht senden`,stopAndSubmit:`Stoppen & Senden`,maxDuration:`Stoppt automatisch nach {{minutes}} Min.`,stoppingLogs:`Protokolle sammeln & senden...`,submitting:`Fehlerbericht wird gesendet...`,submittingStepConnection:`Drucker-Verbindungsprüfungen werden ausgeführt`,submittingStepVirtualPrinters:`Setup-Prüfungen für virtuelle Drucker werden ausgeführt`,submittingStepLogScan:`Aktuelle Protokolle werden auf bekannte Probleme überprüft`,submittingStepSubmit:`Bericht wird an GitHub gesendet`,submitSuccess:`Fehlerbericht erfolgreich gesendet!`,submitFailed:`Fehlerbericht konnte nicht gesendet werden`,diagnosticChecking:`Druckerverbindungen werden geprüft...`,diagnosticHealthy:`Verbindungsprüfung bestanden — keine Probleme an Ihren Druckern gefunden.`,diagnosticSummary:`{{problems}} von {{total}} Druckern haben Verbindungsprobleme`,diagnosticIntro:`Einer oder mehrere Drucker haben ein Verbindungsproblem, das die Ursache Ihres Problems sein könnte. Klappen Sie einen Drucker unten auf, um die Lösung zu sehen — sie zu beheben könnte das Problem ohne Fehlerbericht lösen. Sie können unten dennoch einen Bericht senden.`,thankYou:`Vielen Dank!`,submitted:`Ihr Fehlerbericht wurde eingereicht.`,viewIssue:`Issue ansehen`,closeKeepsRecording:`Sie können dieses Fenster schließen, während Sie das Problem reproduzieren — die Aufzeichnung läuft weiter, und beim erneuten Öffnen sind Sie wieder hier.`,resumeRecording:`Fehlerbericht zeichnet auf — {{elapsed}}. Zum Abschließen klicken.`,resumeReport:`Bericht fortsetzen`,unexpectedError:`Ein unerwarteter Fehler ist aufgetreten`},failureDetection:{title:`KI-Fehlererkennung`,description:`Überwacht Drucke über eine selbst gehostete Obico-ML-API und reagiert automatisch auf erkannte Fehldrucke.`,mlUrl:`Obico-ML-API-URL`,mlUrlHint:`Basis-URL deines selbst gehosteten Obico-ml_api-Containers (z. B. http://192.168.1.10:3333).`,bambuddyInternalUrl:`Interne Bambuddy-URL (optional)`,bambuddyInternalUrlHint:`Bambuddy-Adresse, die die ML-API erreichen kann, etwa ein Docker-Dienstname oder eine LAN-IP. Leer lassen, um die externe URL zu verwenden. Andere Integrationen verwenden weiterhin die externe URL.`,bambuddyInternalUrlInvalid:`Muss mit http:// oder https:// beginnen (z. B. http://bambuddy:8000). Wird erst dann gespeichert.`,mlToken:`ML-API-Token (optional)`,mlTokenPlaceholder:`Leer lassen, wenn der Server ohne ML_API_TOKEN läuft`,mlTokenHint:`Muss mit der Umgebungsvariable ML_API_TOKEN deines Obico-ml_api-Containers übereinstimmen. Leer lassen, wenn der Container ohne Token läuft.`,test:`Testen`,testSuccess:`ML-API erreichbar und funktionsfähig.`,testSuccessTokenUnknown:`ML-API erreichbar und funktionsfähig. Das Token konnte nicht geprüft werden.`,testFailed:`ML-API konnte nicht erreicht werden.`,sensitivity:`Empfindlichkeit`,sensitivityLow:`Niedrig (weniger Fehlalarme)`,sensitivityMedium:`Mittel (ausgewogen)`,sensitivityHigh:`Hoch (frühe Erkennung, mehr Fehlalarme)`,sensitivityHint:`Passt die Konfidenz-Schwellwerte an, die Warnungen und Fehler auslösen.`,action:`Aktion bei erkanntem Fehler`,actionNotify:`Nur benachrichtigen`,actionPause:`Druck pausieren`,actionPauseOff:`Pausieren und Strom abschalten`,pollInterval:`Prüfintervall (Sekunden)`,pollIntervalHint:`Wie oft jeder Drucker während eines laufenden Drucks geprüft wird. Minimum 5 s, Maximum 120 s.`,externalUrlMissing:`Keine Adresse gesetzt, über die die ML-API Snapshots abrufen kann.`,externalUrlHint:`Setze hier die interne Bambuddy-URL oder die externe URL unter Einstellungen → Netzwerk, damit die ML-API Snapshots abrufen kann.`,perPrinterTitle:`Überwachte Drucker`,perPrinterHint:`Wähle, welche Drucker vom Erkennungsdienst überwacht werden.`,monitorAll:`Alle verbundenen Drucker überwachen`,statusTitle:`Status`,serviceRunning:`Dienst läuft`,thresholds:`Niedrig / Hoch-Schwellwerte`,activePrinters:`Aktive Drucke`,noActivePrints:`Derzeit laufen keine Drucke.`,historyTitle:`Letzte Erkennungen`,noHistory:`Noch keine Erkennungen.`},modelSources:{title:`Modellquellen`,tabMakerworld:`MakerWorld`,tabManyfold:`Manyfold`},manyfold:{description:`Durchsuche deine Manyfold-Bibliothek und importiere ihre Dateien, um sie zu slicen und zu drucken.`,notConnectedTitle:`Manyfold ist nicht verbunden`,notConnectedBody:`Bitte einen Administrator, deine Manyfold-Bibliothek zu verbinden.`,connectionTitle:`Manyfold-Verbindung`,connectionHelp:`Öffne in Manyfold Einstellungen → API und lege eine Anwendung mit den Berechtigungen "public" und "read" an. Trage hier ihre Client-ID und ihr Secret ein. Bambuddy sieht die Modelle, die der Besitzer der Anwendung sehen kann.`,url:`Manyfold-URL`,urlPlaceholder:`http://192.168.1.10:3214`,clientId:`Client-ID`,clientSecret:`Client-Secret`,clientSecretStored:`Gespeichert. Leer lassen, um es zu behalten.`,test:`Verbindung testen`,testOk:`Verbunden. Für Bambuddy sichtbare Modelle: {{count}}`,disconnect:`Trennen`,disconnectTitle:`Manyfold trennen?`,disconnectBody:`Bambuddy vergisst URL, Client-ID und Secret von Manyfold. Importierte Dateien bleiben in deiner Bibliothek.`,disconnected:`Manyfold getrennt`,editConnection:`Verbindung`,searchPlaceholder:`Modelle suchen`,modelCount:`Modelle: {{count}}`,noModels:`Keine Modelle gefunden.`,previous:`Zurück`,next:`Weiter`,page:`Seite {{page}}`,back:`Zurück zu den Modellen`,openInManyfold:`In Manyfold öffnen`,license:`Lizenz`,files:`Dateien`,noFiles:`Dieses Modell hat keine Dateien.`,importTo:`Importieren nach`,folderAuto:`Ordner "Manyfold"`,import:`Importieren`,importing:`Wird importiert…`,imported:`{{filename}} importiert`,alreadyInLibrary:`Bereits in deiner Bibliothek`,inLibrary:`In der Bibliothek`,showInLibrary:`In der Bibliothek zeigen`,notImportable:`Bambuddy kann diesen Dateityp weder slicen noch drucken`,selectAll:`Alle auswählen`,selectFile:`{{name}} auswählen`,importSelected:`Auswahl importieren ({{count}})`,importAll:`Alle importieren`,importProgress:`Importiere {{current}}/{{total}}`,bulkDone:`Importiert: {{imported}} · bereits in der Bibliothek: {{existing}} · fehlgeschlagen: {{failed}}`,bulkFailed:`Nicht importiert: {{names}}. {{reason}}`,bulkNothing:`Nichts zu importieren: Jede druckbare Datei ist bereits in deiner Bibliothek.`,selectModel:`{{name}} auswählen`,selectPage:`Seite auswählen`,modelsSelected:`Ausgewählte Modelle: {{count}}`,importModels:`Ihre Dateien importieren`,clearSelection:`Auswahl aufheben`,collectProgress:`Lese Modelle {{current}}/{{total}}`,modelsUnreadable:`Nicht lesbar: {{names}}`,errors:{manyfold_not_configured:`Manyfold ist nicht verbunden.`,manyfold_credentials:`Manyfold hat Client-ID oder Secret nicht akzeptiert.`,manyfold_scope:`Die Manyfold-Anwendung braucht die Berechtigung "read". Bearbeite sie in Manyfold unter Einstellungen → API.`,manyfold_rate_limited:`Manyfold begrenzt die Anmeldungen. Versuche es in ein paar Minuten erneut.`,manyfold_unreachable:`Bambuddy erreicht Manyfold nicht. Prüfe die URL und ob Manyfold läuft.`,manyfold_forbidden:`Manyfold hat den Zugriff verweigert. Prüfe, ob der Besitzer der Anwendung dieses Modell sehen kann.`,manyfold_not_found:`Manyfold findet dieses Modell oder diese Datei nicht.`,manyfold_too_large:`Die Datei ist größer als 200 MB.`,manyfold_not_importable:`Nur 3MF-, STL- und STEP-Dateien können importiert werden.`,manyfold_bad_url:`Gib die Manyfold-URL mit http:// oder https:// am Anfang ein.`,manyfold_secret_required:`Gib das Client-Secret ein.`,manyfold_failed:`Manyfold hat mit einem Fehler geantwortet.`}},makerworld:{title:`MakerWorld`,description:`Füge eine MakerWorld-Modell-URL ein, um es direkt aus Bambuddy zu importieren und zu drucken — ohne die Bambu Handy App zu öffnen.`,pasteUrlHeader:`Von MakerWorld importieren`,pasteUrlPlaceholder:`https://makerworld.com/de/models/… oder beliebigen MakerWorld-Link einfügen`,resolveButton:`Laden`,signInRequiredTitle:`Bambu-Cloud-Anmeldung für Download erforderlich`,signInRequiredBody:`Modell-Details können anonym angezeigt werden, aber MakerWorld verlangt eine Bambu-Cloud-Anmeldung zum Herunterladen der 3MF-Dateien.`,signInExpiredTitle:`Bambu-Cloud-Anmeldung abgelaufen`,signInExpiredBody:`Sie sind weiterhin bei Bambuddy angemeldet, aber Bambu Lab akzeptiert das gespeicherte Token nicht mehr, daher schlagen Downloads fehl. Melden Sie sich erneut bei Bambu Cloud an.`,openCloudSettings:`Cloud-Einstellungen öffnen`,untitledModel:`Unbenanntes Modell`,byCreator:`von {{name}}`,downloadsCount:`{{count}} Downloads`,licensePrefix:`Lizenz`,alreadyImported:`Bereits in Bibliothek`,openOnMakerworld:`Auf MakerWorld öffnen`,alreadyInLibrary:`Dieses Modell ist bereits in deiner Bibliothek — zu finden im Dateimanager → MakerWorld`,importSuccess:`{{filename}} importiert — gespeichert im Dateimanager → MakerWorld`,platesHeader:`Platten ({{count}})`,plateDefaultName:`Platte {{n}}`,materialCount:`{{count}} Filamente`,amsRequired:`AMS erforderlich`,slicedFor:`Gesliced für {{printer}}`,alsoCompatible:`Auch kompatibel: {{printers}}`,importToLibrary:`Speichern`,sliceIn:`Speichern & in {{slicer}} öffnen`,disclaimer:`Die MakerWorld-Integration verwendet von der Community dokumentierte API-Endpunkte. Bambuddy ist nicht mit MakerWorld oder Bambu Lab verbunden oder von diesen unterstützt.`,lastImportSuccess:`In deine Bibliothek importiert`,lastImportAlreadyInLibrary:`Bereits in deiner Bibliothek`,viewInLibrary:`Im Dateimanager anzeigen`,openInBambuStudio:`In Bambu Studio öffnen`,openInOrcaSlicer:`In OrcaSlicer öffnen`,importTo:`In Dateimanager importieren`,recentImportsHeader:`Zuletzt importiert`,phaseResolving:`Auflösen`,phaseDownloading:`Lade herunter`,folderAuto:`MakerWorld (Standard)`,importAll:`Alle importieren`,importAllProgress:`Importiere {{current}}/{{total}}`,openGallery:`Bildergalerie öffnen`,galleryPrev:`Vorheriges Bild`,galleryNext:`Nächstes Bild`,deleteImport:`Aus Bibliothek entfernen`,importDeleting:`Wird entfernt…`,importDeleted:`Aus Bibliothek entfernt`,confirmDelete:`{{filename}} aus der Bibliothek entfernen? Die lokale Datei wird gelöscht, die Platte kann aber erneut von MakerWorld importiert werden.`,errors:{resolveFailed:`Diese MakerWorld-URL konnte nicht aufgelöst werden.`,downloadFailed:`Download fehlgeschlagen. Bitte erneut versuchen.`,deleteFailed:`Datei konnte nicht aus der Bibliothek entfernt werden.`}},gcodeViewer:{filamentSlot:`Filament {{n}}`,loading:`Werkzeugweg wird gelesen…`,loadFailed:`Der G-Code für diese Datei konnte nicht geladen werden.`,showTravel:`Leerfahrten`,topLayer:`Oberste Schicht`,bottomLayer:`Unterste Schicht`,noSource:`Es wurde keine Datei zur Vorschau angegeben.`,view:{filament:`Filament`,feature:`Merkmal`,height:`Höhe`,width:`Breite`},feature:{wall:`Wände`,sparseInfill:`Spärliche Füllung`,solidInfill:`Massive Füllung`,bridge:`Brücke / Überhang`,support:`Stützen`,skirt:`Skirt / Brim`,gapFill:`Lückenfüllung`,ironing:`Bügeln`,primeTower:`Reinigungsturm`},back:`Zurück`,backToArchives:`Zurück zum Druckarchiv`,backToFiles:`Zurück zum Dateimanager`,plates:`Platten`,plateN:`Platte {{n}}`},libraryTrash:{title:`Papierkorb`,headerButton:`Papierkorb`,headerTooltip:`In den Papierkorb verschobene Dateien anzeigen`,backToFiles:`Zurück zum Dateimanager`,subtitleAdmin:`Gelöschte Dateien bleiben {{days}} Tage hier und werden dann automatisch entfernt. Diese Ansicht zeigt Papierkorb-Dateien aller Benutzer.`,subtitleUser:`Gelöschte Dateien bleiben {{days}} Tage hier und werden dann automatisch entfernt.`,loading:`Papierkorb wird geladen…`,loadError:`Papierkorb konnte nicht geladen werden.`,empty:`Der Papierkorb ist leer.`,summary:`{{count}} Dateien · {{size}}`,emptyTrash:`Papierkorb leeren`,restore:`Wiederherstellen`,purgeNow:`Jetzt löschen`,autoPurgeIn:`Wird in {{when}} gelöscht`,days:`Tage`,retentionLabel:`Automatisch löschen nach`,selectAll:`Alle auswählen`,selectOne:`{{filename}} auswählen`,selectionCount:`{{count}} ausgewählt`,bulkRestore:`Auswahl wiederherstellen`,bulkPurge:`Auswahl löschen`,col:{filename:`Datei`,folder:`Ordner`,size:`Größe`,deleted:`Verschoben`,autoPurge:`Löschung`,owner:`Besitzer`,actions:`Aktionen`},confirm:{purgeTitle:`Endgültig löschen?`,purgeBody:`{{filename}} wird von der Festplatte gelöscht und kann nicht wiederhergestellt werden.`,emptyTitle:`Papierkorb leeren?`,emptyBody:`Alle {{count}} Dateien werden endgültig von der Festplatte gelöscht.`,bulkPurgeTitle:`Ausgewählte Dateien endgültig löschen?`,bulkPurgeBody:`Die {{count}} ausgewählten Dateien werden von der Festplatte gelöscht und können nicht wiederhergestellt werden.`,cta:`Endgültig löschen`},toast:{restored:`Datei wiederhergestellt.`,restoreFailed:`Datei konnte nicht wiederhergestellt werden.`,purged:`Datei endgültig gelöscht.`,purgeFailed:`Datei konnte nicht gelöscht werden.`,emptied:`{{count}} Datei(en) aus dem Papierkorb gelöscht.`,emptyFailed:`Papierkorb konnte nicht geleert werden.`,retentionSaved:`Automatisches Löschen auf {{days}} Tage gesetzt.`,retentionFailed:`Einstellung konnte nicht gespeichert werden.`,bulkRestored:`{{count}} Datei(en) wiederhergestellt.`,bulkPurged:`{{count}} Datei(en) gelöscht.`}},libraryPurge:{title:`Alte Dateien entfernen`,headerButton:`Alte entfernen`,headerTooltip:`Alte Dateien im Block in den Papierkorb verschieben`,description:`Räume alte Dateien in einem Rutsch aus deiner Bibliothek. Dateien mit Druckverlauf werden nach dem letzten Druckdatum bewertet; nie gedruckte Dateien nach dem Upload-Datum.`,ageLabel:`Dateien älter als`,days:`Tage`,includeNeverPrinted:`Dateien einbeziehen, die nie gedruckt wurden`,effectsTitle:`Was passiert, wenn du auf „Entfernen" klickst`,effect1:`Passende Dateien werden in den Papierkorb verschoben — noch nicht von der Festplatte gelöscht.`,effect2:`Du kannst sie bis zum Ablauf der Aufbewahrungsfrist jederzeit wiederherstellen.`,effect3:`Nach Ablauf der Frist löscht der Papierkorb-Sweeper sie endgültig von der Festplatte.`,effect4:`Dateien in externen (verknüpften) Ordnern werden übersprungen — Bambuddy löscht keine Bytes, die ihm nicht gehören.`,previewLoading:`Prüfe, wie viele Dateien passen…`,previewFailed:`Vorschau konnte nicht geladen werden.`,previewSummary:`{{count}} Dateien · {{size}} würden in den Papierkorb verschoben`,andMore:`…und {{count}} weitere`,warning:`Dateien im Papierkorb zählen weiterhin zum Speicher, bis die Aufbewahrungsfrist abgelaufen ist. Leere den Papierkorb danach, um sofort Speicher freizugeben.`,confirmCta:`{{count}} in den Papierkorb verschieben`,purging:`Wird verschoben…`,toast:{success:`{{count}} Datei(en) in den Papierkorb verschoben.`,failed:`Dateien konnten nicht verschoben werden.`}},libraryAutoPurge:{enableLabel:`Alte Dateien automatisch entfernen`,enableDescription:`Führt die Admin-Bereinigung einmal pro Tag aus. Dateien landen zuerst im Papierkorb — sie werden nicht sofort gelöscht.`,ageLabel:`Dateien älter als`,ageDescription:`Minimum 7 Tage, Maximum 10 Jahre. Verwendet dieselbe Altersregel wie die manuelle „Alte entfernen“-Schaltfläche.`,days:`Tage`,includeNeverPrinted:`Dateien einbeziehen, die nie gedruckt wurden`,saveFailed:`Einstellungen konnten nicht gespeichert werden.`},archivePurge:{headerButton:`Alte löschen`,headerTooltip:`Alte Archive in einem Rutsch löschen`,title:`Alte Archive löschen`,description:`Räume alte Druckhistorie auf. Jedes Archiv wird nach seinem letzten abgeschlossenen Druck bewertet — ein erneuter Druck setzt die Frist zurück, aktive Arbeit bleibt sicher.`,ageLabel:`Archive löschen, die zuletzt gedruckt wurden vor`,days:`Tage`,effectsTitle:`Was passiert, wenn du auf „Löschen" klickst`,effect1:`Jedes passende Archiv wird aus der Listenansicht ausgeblendet und seine Dateien werden von der Festplatte entfernt (3MF, Vorschau, Timelapse, Quell-3MF, F3D, Fotos).`,effect2:`Die Archivzeile bleibt in der Datenbank, damit die Quick Stats den Filament-, Zeit-, Kosten- und Energiebeitrag behalten — wie der Standard beim Einzel-Löschen.`,effect3:`Aktiviere unten „Auch aus Statistiken entfernen", um zusätzlich den Quick-Stats-Beitrag zu verwerfen (entspricht dem Einzel-Löschen-Häkchen). Dieser Pfad ist unwiderruflich.`,effect4:`Ein erneuter Druck setzt die Frist zurück, Archive, die du weiterhin nutzt, bleiben sicher.`,purgeStatsLabel:`Auch aus Statistiken entfernen`,purgeStatsHint:`Verwirft die passenden Archive aus den Quick Stats (Filament, Zeit, Kosten, Energie). Ohne diese Option behalten die Quick Stats jeden Beitrag und nur die Dateien werden gelöscht.`,previewLoading:`Prüfe passende Archive…`,previewFailed:`Vorschau konnte nicht erstellt werden.`,previewSummary:`{{count}} Archive · {{size}} würden entfernt`,andMore:`…und {{count}} weitere`,warning:`Dateien werden von der Festplatte entfernt und können nicht wiederhergestellt werden. Lade wichtige Archive vorher herunter oder markiere sie als Favorit.`,confirmCta:`{{count}} Archiv(e) entfernen`,purging:`Entferne…`,toast:{success:`{{count}} Archiv(e) entfernt.`,failed:`Archive konnten nicht gelöscht werden.`}},archiveAutoPurge:{enableLabel:`Alte Archive automatisch löschen`,enableDescription:`Blendet einmal pro Tag Archive aus der Listenansicht aus und entfernt ihre Dateien von der Festplatte, wenn sie im angegebenen Zeitraum nicht gedruckt wurden. Ein erneuter Druck setzt die Frist zurück.`,ageLabel:`Archive automatisch löschen, die zuletzt gedruckt wurden vor`,ageDescription:`Minimum 7 Tage, Maximum 10 Jahre. Basiert auf dem letzten abgeschlossenen Druck — ein erneuter Druck setzt die Frist zurück. Entfernt 3MF, Vorschau, Timelapse, Quell-3MF, F3D und Fotos.`,days:`Tage`,purgeStatsLabel:`Auch aus Statistiken entfernen`,purgeStatsDescription:`Wenn aktiviert, verwirft der tägliche Sweeper auch den Quick-Stats-Beitrag (Filament, Zeit, Kosten, Energie) jedes gelöschten Archivs. Standard aus — Quick Stats behalten den Beitrag, nur die Dateien werden gelöscht.`,runNow:`Archive jetzt löschen`,saveFailed:`Einstellungen konnten nicht gespeichert werden.`},connectedApps:{title:`Verbundene Apps`,description:`Apps, bei denen man sich mit dem Bambuddy-Konto anmeldet. Jede App bekommt eine Client-ID und ein Geheimnis, und Bambuddy schickt eine Anmeldung nur an die hier eingetragene Callback-URL.`,requiresAuth:`Verbundene Apps brauchen die Bambuddy-Anmeldung. Aktiviere sie zuerst unter Benutzer.`,name:`App-Name`,namePlaceholder:`z. B. Auftragsverwaltung`,callbackUrl:`Callback-URL`,callbackHint:`Die Callback-URL steht in der Dokumentation der App. Sie muss exakt übereinstimmen.`,add:`App hinzufügen`,empty:`Noch keine verbundenen Apps.`,clientId:`Client-ID`,clientSecret:`Client-Geheimnis`,lastUsed:`Letzte Anmeldung`,disabledBadge:`Deaktiviert`,enable:`Aktivieren`,disable:`Deaktivieren`,rotate:`Neues Geheimnis`,delete:`Löschen`,cancel:`Abbrechen`,copy:`Kopieren`,secret:{title:`{{name}}: Geheimnis jetzt kopieren`,warning:`Trage Client-ID und Geheimnis in der App ein. Das Geheimnis wird nur dieses eine Mal angezeigt; geht es verloren, erzeuge ein neues.`,dismiss:`Gespeichert`},confirmRotate:{title:`Neues Geheimnis erzeugen?`,body:`"{{name}}" kann niemanden mehr anmelden, bis du das neue Geheimnis dort einträgst.`},confirmDelete:{title:`App löschen?`,body:`"{{name}}" kann niemanden mehr anmelden. Wird sie wieder hinzugefügt, werden alle erneut um Erlaubnis gefragt.`},toast:{created:`App hinzugefügt`,enabled:`App aktiviert`,disabled:`App deaktiviert`,rotated:`Neues Geheimnis erzeugt`,deleted:`App gelöscht`,copied:`In die Zwischenablage kopiert`,copyFailed:`Kopieren fehlgeschlagen. Markiere den Text und kopiere ihn von Hand.`,failed:`Etwas ist schiefgelaufen`},authorize:{checking:`Anmeldeanfrage wird geprüft…`,redirecting:`Du wirst angemeldet…`,errorTitle:`Anmeldung nicht möglich`,invalidRequest:`Diese Anmeldeanfrage ist ungültig: Die App ist nicht registriert, deaktiviert oder nutzt eine andere Callback-URL. Bitte deinen Bambuddy-Admin, Einstellungen > API-Schlüssel > Verbundene Apps zu prüfen.`,authDisabled:`Die Anmeldung mit Bambuddy ist nicht verfügbar, weil die Bambuddy-Anmeldung ausgeschaltet ist. Nutze stattdessen die Anmeldung der App.`,failed:`Anmeldung fehlgeschlagen. Geh zurück zur App und versuche es erneut.`,title:`{{app}} möchte dich anmelden`,signedInAs:`Bei Bambuddy angemeldet als {{username}}`,sharedData:`{{app}} sieht deinen Benutzernamen, deine E-Mail-Adresse, Gruppen und Berechtigungen. Dein Passwort und deine Bambuddy-Sitzung bekommt die App nicht.`,allow:`Erlauben`,deny:`Abbrechen`}},cameraTokens:{scope:{camera_stream:`Kamera-Stream`,camwall:`Kamera-Wand`,overlay:`Streaming-Overlay`},title:`Kamera-API-Tokens`,navTitle:`Kamera-API-Tokens`,description:`Langlebige Tokens, um den Kamera-Stream in Home Assistant, Frigate, Kiosk-Bildschirme oder jedes andere Werkzeug einzubinden, das eine stabile Adresse braucht. Der Geltungsbereich wird beim Erstellen gewählt; ein Token lässt sich jederzeit widerrufen.`,loading:`Laden…`,confirmRevoke:{title:`Dieses Token widerrufen?`,body:`Jedes Gerät, das "{{name}}" verwendet, verliert sofort den Zugriff. Dies kann nicht rückgängig gemacht werden.`,cancel:`Abbrechen`,confirm:`Widerrufen`},create:{scopeLabel:`Geltungsbereich`,hintCameraStream:`Ein Kamera-Stream-Token kann ausschließlich Kamera-Streams und Schnappschüsse abrufen. Geeignet für Home Assistant, Frigate oder alles, was eine einzelne Kamera einbettet.`,hintCamWall:`Ein Kamera-Wand-Token öffnet /camwall auf einem Bildschirm ohne Anmeldung. Es sieht Name und Status jedes Druckers sowie deren Kamera-Streams. Dateinamen, Adressen und Zugangscodes sieht es nicht.`,hintOverlay:`Ein Streaming-Overlay-Token öffnet /overlay/{printerId} auf einem Bildschirm ohne Anmeldung – für OBS oder jeden Livestream. Es sieht den Kamera-Stream eines Druckers sowie dessen Live-Druckstatus, einschließlich des auf dem Bildschirm angezeigten Dateinamens. Adressen und Zugangscodes sieht es nicht.`,title:`Neues Token erstellen`,nameLabel:`Token-Name`,namePlaceholder:`z. B. Home Assistant`,daysLabel:`Tage bis Ablauf`,submit:`Erstellen`,hint:`Maximale Lebensdauer 365 Tage. Der Token-Wert wird nur einmal bei der Erstellung angezeigt – jetzt kopieren.`},created:{camWallUrlTitle:`Kamera-Wand-Adresse für diesen Bildschirm`,camWallUrlHint:`Diese Adresse auf dem Bildschirm öffnen. Wer die Adresse lesen kann, kann die Kamera-Wand sehen — behandeln Sie sie wie einen Schlüssel. Widerrufen Sie das Token, um den Bildschirm abzuschalten.`,overlayUrlTitle:`Overlay-Adresse für OBS`,overlayUrlHint:`Fügen Sie dies in OBS als Browser-Quelle hinzu. Ändern Sie die Zahl in /overlay/1 auf die Nummer Ihres Druckers (aus dessen Adresse auf der Seite „Drucker“). Wer die Adresse lesen kann, kann den Stream sehen – behandeln Sie sie wie einen Schlüssel und widerrufen Sie das Token, um sie abzuschalten.`,title:`Token erstellt – jetzt kopieren`,warning:`Dies ist das einzige Mal, dass dieser Token sichtbar ist. Nach dem Schließen dieses Dialogs können Sie ihn nie wieder anzeigen.`,copy:`Kopieren`,dismiss:`Ich habe es gespeichert`},list:{scope:`Geltungsbereich`,myTitle:`Meine Tokens`,allTitle:`Alle Benutzer (Admin-Ansicht)`,empty:`Noch keine Tokens.`,name:`Name`,owner:`Eigentümer`,prefix:`Präfix`,created:`Erstellt`,expires:`Läuft ab`,lastUsed:`Zuletzt verwendet`,revoke:`Widerrufen`,expired:`Abgelaufen`},toast:{created:`Token erstellt`,createFailed:`Token konnte nicht erstellt werden`,revoked:`Token widerrufen`,revokeFailed:`Token konnte nicht widerrufen werden`,loadFailed:`Tokens konnten nicht geladen werden`,copied:`In Zwischenablage kopiert`,copyFailed:`Kopieren fehlgeschlagen – manuell auswählen und kopieren`}},forecast:{title:`Bestandsprognose`,noSpools:`Keine aktiven Spulen gefunden. Fügen Sie Spulen zu Ihrem Inventar hinzu, um Prognosedaten zu sehen.`,noUsageData:`Keine Verbrauchsdaten verfügbar — die Bestandszeitlinie kann nicht projiziert werden.`,sku:`SKU`,material:`Material`,stock:`Bestand`,dailyRate:`Rate`,daysLeft:`Verbleibende Tage`,emptyBy:`Aufgebraucht am`,reorderBy:`Nachbestellen bis`,actions:`Aktionen`,trend:`Trend`,estimated:`Gesch.`,noData:`Keine Daten`,timeframe:`Zeitraum`,chartTitle:`Bestandsprognose — Top 5 Materialien`,dashedLinesROP:`Gestrichelte Linien = Nachbestellpunkte`,stockLevel:`Bestandsniveau`,reorderPoint:`Nachbestellpunkt`,safetyMargin:`Sicherheitspuffer`,trendLegend:`Trend (verlaufsbasiert, 95 % Serviceniveau)`,estimatedLegend:`Geschätzt (Gewichtsdelta)`,noDataLegend:`Keine Daten`,ropLabel:`NBP`,ssLabel:`SB`,safetyStockLegend:`Sicherheitsbestand`,stockArrivalLegend:`Wareneingang`,stockoutLegend:`Fehlbestand`,alertCount_one:`{{count}} Warnung`,alertCount_other:`{{count}} Warnungen`,order:`Bestellen`,globalLeadTime:`Globale Lieferzeit`,globalLeadTimeHint:`Globale Lieferzeitvorgabe — wird in der Nachbestellpunktberechnung für alle SKUs verwendet`,save:`Speichern`,cancel:`Abbrechen`,settingsSaved:`Einstellungen gespeichert`,failedSaveSettings:`Einstellungen konnten nicht gespeichert werden`,globalLeadTimeSaved:`Globale Lieferzeit gespeichert`,skuLeadTimeOverride:`SKU-Lieferzeitüberschreibung`,skuLeadTimeHint:`0 = globale Lieferzeit verwenden. Größer 0 setzen, um für diesen SKU zu überschreiben.`,safetyMarginLabel:`Sicherheitspuffer`,effectiveLeadTime:`Effektive Lieferzeit`,effectiveLeadTimeHint:`max(global {{global}}T, SKU {{sku}}T)`,reorderPointHint:`d̄ × LT + safety margin — bei diesem Bestand bestellen`,safetyMarginHint:`Statistischer Sicherheitsbestand (z=1,65 × σ × √LT) + benutzerdefinierter Puffer`,safetyMarginHintDays:`Zusätzlicher Puffer auf den statistischen Sicherheitsbestand.{{approx}}`,safetyMarginHintDaysApprox:` ≈ {{g}}g beim aktuellen Verbrauch.`,safetyMarginHintG:`Fester Gewichtspuffer auf den statistischen Sicherheitsbestand.{{approx}}`,safetyMarginHintGApprox:` ≈ {{days}}d beim aktuellen Verbrauch.`,individualSpools:`Einzelne Spulen`,labelWeight:`Etikett`,spoolCount_one:`{{count}} Spule`,spoolCount_other:`{{count}} Spulen`,stockBreakRisk:`Bestandsunterbrechungsrisiko`,stockBreakBefore:`Bestandsunterbrechung vor Auffüllung`,stockBreakDetail:`{{days}}d verbleibend, Lieferzeit {{lt}}d.`,reorderNow:`Jetzt nachbestellen`,reorderTriggerPassed:`Auslösedatum {{date}} ist überschritten.`,shoppingList:`Einkaufsliste`,shoppingListItems_one:`({{count}} Artikel)`,shoppingListItems_other:`({{count}} Artikel)`,shoppingListEmpty:`Einkaufsliste ist leer. Klicken Sie auf das Warenkorbsymbol in einer Zeile, um Artikel hinzuzufügen.`,addToCart:`Zur Einkaufsliste hinzufügen`,alertsSnoozed:`Benachrichtigungen für diese SKU stummschalten`,alertsEnabled:`Benachrichtigungen für diese SKU aktivieren`,addedToCart:`Zur Einkaufsliste hinzugefügt`,failedAddItem:`Artikel konnte nicht hinzugefügt werden`,listView:`Liste`,logisticsView:`Logistik`,qty:`Menge`,weight:`Gewicht`,leadTime:`Lieferzeit`,expectedRestock:`Erwartete Auffüllung`,status:`Status`,note:`Notiz`,pending:`Ausstehend`,purchased:`Bestellt`,received:`Erhalten`,markPurchased:`Als bestellt markieren`,markReceived:`Als erhalten markieren — fügt Spulen dem Lagerbestand hinzu`,resetToPending:`Auf ausstehend zurücksetzen`,remove:`Entfernen`,clearAll:`Alle löschen`,downloadCsv:`CSV`,addToCartTitle:`Zur Einkaufsliste hinzufügen`,byQuantity:`Nach Menge`,byDuration:`Nach Dauer`,numberOfSpools:`Anzahl der Spulen`,lastHowManyDays:`Wie viele Tage soll es reichen?`,noUsageQty:`Keine Verbrauchsdaten — Menge auf 1 gesetzt.`,noteOptional:`Notiz (optional)`,notePlaceholder:`z. B. für Projekt X, dringend…`,addNSpools_one:`{{count}} Spule hinzufügen`,addNSpools_other:`{{count}} Spulen hinzufügen`,onArrival:`Bei Ankunft`,stockBreakIn:`Bestandsunterbrechung in {{days}}d.`,stockRunsOutBefore:`Bestand läuft vor Ablauf der {{lt}}d Lieferzeit aus.`,atRate:`Bei {{rate}}g/Tag benötigen Sie`,moreSpools_one:`{{count}} weitere Spule`,moreSpools_other:`{{count}} weitere Spulen`,bridgeGap:`um die Lücke zu überbrücken.`,noReadAccess:`Sie haben keine Berechtigung, Bestandsprognosen anzuzeigen.`,noWriteAccess:`Sie haben keine Berechtigung, Prognoseeinstellungen zu ändern.`}};export{e as default}; \ No newline at end of file diff --git a/static/assets/dollar-sign-Cj_Yhud4.js b/static/assets/dollar-sign-Cj_Yhud4.js new file mode 100644 index 000000000..ca9f1e792 --- /dev/null +++ b/static/assets/dollar-sign-Cj_Yhud4.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/droplet-CqYXMF2u.js b/static/assets/droplet-CqYXMF2u.js new file mode 100644 index 000000000..007d8ce4f --- /dev/null +++ b/static/assets/droplet-CqYXMF2u.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`droplet`,[[`path`,{d:`M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z`,key:`c7niix`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/ellipsis-vertical-t2D7cYyp.js b/static/assets/ellipsis-vertical-t2D7cYyp.js new file mode 100644 index 000000000..cbaba6bf7 --- /dev/null +++ b/static/assets/ellipsis-vertical-t2D7cYyp.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/es-CRlbEMPu.js b/static/assets/es-CRlbEMPu.js new file mode 100644 index 000000000..75f0f45f6 --- /dev/null +++ b/static/assets/es-CRlbEMPu.js @@ -0,0 +1,4 @@ +var e={nav:{printers:`Impresoras`,archives:`Archivos`,queue:`Cola de impresión`,stats:`Estadísticas`,profiles:`Perfiles`,maintenance:`Mantenimiento`,projects:`Proyectos`,inventory:`Filamento`,finance:`Finanzas`,files:`Gestor de archivos`,makerworld:`MakerWorld`,modelSources:`Fuentes de modelos`,notifications:`Notificaciones`,settings:`Ajustes`,system:`Sistema`,collapseSidebar:`Contraer barra lateral`,expandSidebar:`Expandir barra lateral`,update:`Actualizar`,updateAvailable:`Actualización disponible: v{{version}}`,updateAvailableBanner:`¡La versión {{version}} está disponible!`,viewUpdate:`Ver actualización`,viewOnGithub:`Ver en GitHub`,keyboardShortcuts:`Atajos de teclado (?)`,switchToLight:`Cambiar a modo claro`,switchToDark:`Cambiar a modo oscuro`,switchToSystem:`Cambiar a modo del sistema`,smartSwitches:`Interruptores inteligentes`,logout:`Cerrar sesión`,installApp:`Instalar app`,installAppSuccess:`Bambuddy se ha instalado`},announcements:{title:`Anuncios`,unread:`Anuncios sin leer: {{count}}`,empty:`No hay anuncios por ahora.`,earlier:`Anteriores ({{count}})`,new:`Nuevo`,readMore:`Leer más`,readMoreCount:`Leer más (+{{count}})`,gotIt:`Entendido`,source:`De los desarrolladores de Bambuddy, obtenidos de GitHub. Puedes desactivarlos en Ajustes.`,level:{info:`Aviso`,important:`Importante`,critical:`Crítico`}},common:{plusNMore:`+{{count}} más`,save:`Guardar`,saving:`Guardando...`,cancel:`Cancelar`,delete:`Eliminar`,edit:`Editar`,add:`Añadir`,close:`Cerrar`,confirm:`Confirmar`,loading:`Cargando...`,error:`Error`,errorLoading:`Error al cargar los datos`,retry:`Reintentar`,success:`Éxito`,warning:`Advertencia`,enabled:`Activado`,disabled:`Desactivado`,yes:`Sí`,no:`No`,on:`Encendido`,off:`Apagado`,all:`Todos`,none:`Ninguno`,search:`Buscar`,filter:`Filtrar`,sort:`Ordenar`,refresh:`Actualizar`,download:`Descargar`,upload:`Subir`,uploading:`Subiendo...`,uploadFailed:`Error al subir`,actions:`Acciones`,status:`Estado`,name:`Nombre`,description:`Descripción`,date:`Fecha`,time:`Hora`,hours:`horas`,minutes:`minutos`,seconds:`segundos`,days:`días`,enable:`Activar`,disable:`Desactivar`,permissions:`Permisos`,noPrinters:`No hay impresoras configuradas`,noData:`No hay datos disponibles`,linkNotFound:`Enlace no encontrado`,required:`Obligatorio`,optional:`Opcional`,dismiss:`Descartar`,apply:`Aplicar`,reset:`Restablecer`,export:`Exportar`,import:`Importar`,clear:`Borrar`,selectAll:`Seleccionar todo`,deselectAll:`Deseleccionar todo`,noChange:`— Sin cambios —`,unchanged:`Sin cambios`,unassigned:`Sin asignar`,unknown:`Desconocido`,unknownError:`Error desconocido`,today:`Hoy`,tomorrow:`Mañana`,asap:`Lo antes posible`,overdue:`Atrasado`,now:`Ahora`,collapse:`Contraer`,expand:`Expandir`,previous:`Anterior`,next:`Siguiente`,viewArchive:`Ver archivo`,viewInFileManager:`Ver en el gestor de archivos`,addedBy:`Añadido por {{username}}`,prints:`impresiones`,more:`+{{count}} más`,ascending:`Ascendente`,descending:`Descendente`,back:`Atrás`,copy:`Copiar`,copied:`¡Copiado!`,printer:`Impresora`,remove:`Quitar`,type:`Tipo`,print:`Imprimir`,rename:`Renombrar`,move:`Mover`,create:`Crear`,duplicate:`Duplicar`,left:`Izquierda`,right:`Derecha`,user:`Usuario`,run:`Ejecutar`,running:`Ejecutando...`},finance:{allTypes:`Todos los tipos`,allCostCenters:`Todos los centros de costes`,title:`Finanzas`,subtitle:`Monedero, transacciones personales y centros de costes`,noAccess:`No tienes permiso para ver los datos financieros.`,personalView:`Vista personal`,adminView:`Vista de administración`,createCostCenter:`Crear centro de costes`,adjustWallet:`Ajustar monedero`,addManualPrint:`Añadir impresión manual`,manageMembers:`Gestionar miembros del centro de costes`,currentBalance:`Saldo personal`,transactions:`Transacciones`,personalTransactions:`Transacciones personales`,costCenters:`Centros de costes`,availableForPrinting:`Disponible para asignar impresiones`,costCenterName:`Nombre`,budgetType:`Tipo de presupuesto`,monthlyBudget:`Presupuesto mensual`,totalBudget:`Presupuesto total`,noBudget:`Sin presupuesto`,create:`Crear`,selectUser:`Seleccionar usuario`,transactionType:`Tipo`,amount:`Importe`,noCostCenter:`Sin centro de costes`,descriptionOptional:`Descripción (opcional)`,applyAdjustment:`Aplicar ajuste`,memberCanPrint:`El miembro puede imprimir`,addMember:`Añadir miembro`,canPrint:`Puede imprimir`,noMembers:`No hay miembros asignados.`,editCostCenter:`Editar centro de costes`,myCostCenters:`Mis centros de costes`,costCentersHint:`Revisa los límites presupuestarios y mantén los costes bajo control`,noCostCenters:`No se encontraron centros de costes.`,owner:`Propietario`,balance:`Saldo de cuenta`,unlimited:`Ilimitado`,budgetPolicyHint:`Los saldos de cuenta registran los costes. La impresión solo está limitada por el presupuesto del centro de costes seleccionado; sin presupuesto, es ilimitada.`,budget:`Presupuesto`,shared:`Compartido`,cannotEditPrivateCostCenter:`Los centros de costes privados no se pueden editar aquí`,recentTransactions:`Transacciones recientes`,transactionsHint:`Filtrar por tipo y centro de costes`,first:`Primera`,prev:`Anterior`,next:`Siguiente`,last:`Última`,pageNumberOf:`Página {{page}} de {{total}}`,noTransactions:`No hay transacciones disponibles.`,noTransactionsForFilter:`Ninguna transacción coincide con los filtros seleccionados.`,costCenter:`Centro de costes`,balanceAfter:`Saldo posterior`,userWithId:`Usuario n.º {{id}}`,partial:`Parcial`,editTransaction:`Editar transacción`,selectCostCenter:`Seleccionar centro de costes...`,costCenterRequired:`Selecciona un centro de costes`,amountExample:`p. ej., 4,00`,manualAdjustmentExample:`p. ej., Ajuste manual`,userRequired:`Selecciona un usuario`,amountInvalid:`El importe debe ser un número válido`,createdCostCenter:`Centro de costes creado`,createCostCenterFailed:`No se pudo crear el centro de costes`,transactionDeleted:`Transacción eliminada`,deleteTransactionFailed:`No se pudo eliminar la transacción`,transactionEdited:`Transacción actualizada y libro mayor recalculado`,editTransactionFailed:`No se pudo editar la transacción`,manualPrintCreated:`Cargo de impresión manual añadido y libro mayor recalculado`,manualPrintFailed:`No se pudo crear la impresión manual`,memberSaved:`Miembro guardado`,memberSaveFailed:`No se pudo guardar el miembro`,memberRemoved:`Miembro eliminado`,memberRemoveFailed:`No se pudo eliminar el miembro`,costCenterNameRequired:`El nombre del centro de costes es obligatorio`,costCenterUpdated:`Centro de costes actualizado`,costCenterUpdateFailed:`No se pudo actualizar el centro de costes`,confirmDeleteCostCenter:`¿Eliminar el centro de costes «{{name}}»?`,costCenterDeleted:`Centro de costes eliminado`,costCenterDeleteFailed:`No se pudo eliminar el centro de costes`,deleteTransactionConfirm:`¿Eliminar esta transacción? Los saldos se recalcularán automáticamente.`,deposit:`Ingreso`,withdraw:`Retirada`,printCharge:`Cargo de impresión`,deleteTransaction:`Eliminar transacción`},printers:{locations:{title:`Ubicaciones de impresoras`,backToPrinters:`Volver a las impresoras`,subtitle:`{{grouped}} con ubicación, {{ungrouped}} sin ubicación`,search:`Buscar ubicaciones...`,showEmpty:`Mostrar vacías`,hideEmpty:`Ocultar vacías`,select:`Seleccionar`,done:`Listo`,sortNameAsc:`Nombre A→Z`,sortNameDesc:`Nombre Z→A`,sortCountAsc:`Menos impresoras`,sortCountDesc:`Más impresoras`,create:`Nueva ubicación`,createTitle:`Crear ubicación`,editTitle:`Editar ubicación`,namePlaceholder:`Nombre de la ubicación`,icon:`Icono`,color:`Color de la ubicación`,noColor:`Sin color`,none:`Aún no hay ubicaciones de impresoras`,noResults:`Ninguna ubicación coincide con la búsqueda`,printerCount:`Impresoras: {{count}}`,noPrinters:`No hay impresoras en esta ubicación`,selectPrinter:`Seleccionar impresora`,move:`Mover a otra ubicación`,moveButton:`Mover`,removeFromLocation:`Quitar de la ubicación`,ungroupedPrinters:`Impresoras sin ubicación: {{count}}`,selected:`Seleccionadas: {{count}}`,deleteSelected:`Eliminar selección`,moveTitle:`Mover impresora`,moveTitleMany:`Mover impresoras ({{count}})`,targetPlaceholder:`Selecciona una ubicación...`,noLocation:`Sin ubicación`,deleteTitle:`Eliminar ubicación`,deleteTitleMany:`Eliminar ubicaciones ({{count}})`,deleteMessage:`¿Eliminar {{names}}? Impresoras que quedarán sin ubicación: {{count}}.`,created:`Ubicación creada`,saved:`Ubicación actualizada`,deleted:`Ubicaciones eliminadas: {{count}}`,moved:`Impresoras movidas: {{count}}`,failed:`No se pudo guardar el cambio: {{error}}`},addPreflight:{checking:`Comprobando la conexión...`,warning:`Algunas comprobaciones de conexión fallaron. Esta impresora podría aparecer como desconectada. Revisa las comprobaciones de abajo, soluciona lo que puedas o guárdala de todos modos.`,back:`Atrás`,saveAnyway:`Guardar de todos modos`},title:`Impresoras`,addPrinter:`Añadir impresora`,editPrinter:`Editar impresora`,deletePrinter:`Eliminar impresora`,printerName:`Nombre de la impresora`,serialNumber:`Número de serie`,ipAddress:`Dirección IP / Nombre de host`,accessCode:`Código de acceso`,model:`Modelo`,nozzleCount:`Número de boquillas`,autoArchive:`Archivado automático`,status:{available:`Disponible`,idle:`Inactiva`,printing:`Imprimiendo`,paused:`En pausa`,offline:`Desconectada`,problem:`Problema`,error:`Error`,finished:`Finalizada`,unknown:`Desconocido`},temperatures:{nozzle:`Boquilla`,bed:`Cama`,chamber:`Cámara`},heaterHistory:{title:`Historial de calentadores`,openLabel:`Ver historial de calentadores`,nozzle:`Boquilla`,nozzle2:`Boquilla 2`,bed:`Cama`,chamber:`Cámara`,error:`No se pudo cargar el historial`,empty:`Aún no hay datos registrados`},progress:`{{percent}}% completado`,timeRemaining:`{{time}} restante`,deleteConfirm:`¿Está seguro de que desea eliminar "{{name}}"?`,maintenanceOk:`Mantenimiento correcto`,maintenanceWarning:`{{count}} advertencia`,maintenanceWarning_plural:`{{count}} advertencias`,maintenanceDue:`{{count}} pendiente`,maintenanceDue_plural:`{{count}} pendientes`,sort:{name:`Nombre`,status:`Estado`,model:`Modelo`,location:`Ubicación`,eta:`Tiempo restante`,ascending:`Orden ascendente`,descending:`Orden descendente`},cardSize:{small:`Tarjetas pequeñas`,medium:`Tarjetas medianas`,large:`Tarjetas grandes`,extraLarge:`Tarjetas extragrandes`},pageView:{openCamWallPage:`Abrir el muro de cámaras como página`,cards:`Tarjetas`,camWall:`Muro de cámaras`},camWall:{page:{tokenRejected:`Este enlace del muro de cámaras ya no es válido. Es posible que el token haya caducado o se haya revocado.`,loadFailed:`No se han podido cargar las impresoras.`},tileSize:{small:`Mosaicos pequeños`,medium:`Mosaicos medianos`,large:`Mosaicos grandes`,extraLarge:`Mosaicos extragrandes`},noPrinters:`No hay impresoras que mostrar`,noSignal:`Sin señal`,live:`En vivo`,snap:`Foto`,off:`Inactivo`,summary:`{{live}} en vivo, {{snap}} fotos, {{total}} en total`,layer:`Capa {{cur}}/{{total}}`,timeLeft:`quedan {{time}}`,statusMode:{off:`Apagado`,compact:`Compacto`,full:`Completo`},settings:{title:`Ajustes del muro de cámaras`,maxLive:`Máx. transmisiones en vivo`,maxLiveHint:`Cuántos mosaicos transmiten en vivo a la vez. Los demás se actualizan como fotos.`,snapshotInterval:`Intervalo de fotos (segundos)`,snapshotIntervalHint:`Con qué frecuencia los mosaicos no en vivo obtienen una nueva foto.`,statusOverlay:`Superposición de estado`,statusOverlayHint:`Compacto: solo insignia de estado. Completo: + progreso, capa, tiempo restante.`}},hideOffline:`Ocultar desconectadas`,nextAvailable:`Próxima disponible`,powerOn:`Encender`,offlinePrintersWithPlugs:`Impresoras desconectadas con enchufes inteligentes`,noPrintersConfigured:`Aún no hay impresoras configuradas`,search:`Buscar impresoras...`,noSearchResults:`Ninguna impresora coincide con su búsqueda o filtros`,filter:{allStatuses:`Todos los estados`,allLocations:`Todas las ubicaciones`},toolbar:{filters:`Filtros`,view:`Vista`,actions:`Acciones`},readyToPrint:`Lista para imprimir`,external:`Externo`,ext:`Externo`,extL:`Ext-L`,extR:`Ext-R`,deleteArchives:`Eliminar archivos de impresión`,noLabel:`Sin etiqueta`,printPreview:`Vista previa de impresión`,width:`Anchura`,height:`Altura`,noObjectsFound:`No se encontraron objetos`,objectsLoadedOnPrintStart:`Los objetos se cargan al iniciar una impresión`,willBeSkipped:`Se omitirá`,name:`Nombre`,serialCannotBeChanged:`El número de serie no se puede cambiar`,locationHelp:`Se usa para agrupar impresoras y filtrar trabajos en cola`,wifiSignal:{veryWeak:`Muy débil`,weak:`Débil`,fair:`Aceptable`,good:`Buena`,excellent:`Excelente`},maintenanceUpToDate:`Todo el mantenimiento al día - Haga clic para ver`,maintenance:{title:`En mantenimiento`,subtitle:`Esta impresora está en pausa — sin conexión, no elegible para la cola y sin enviar notificaciones.`,pillLabel:`Mantenimiento`,exitButton:`Salir de mantenimiento`,menuEnter:`Entrar en modo mantenimiento`,menuExit:`Salir del modo mantenimiento`,toastEntered:`{{name}} ahora está en modo mantenimiento`,toastExited:`{{name}} vuelve a estar en línea`,confirmMidPrintTitle:`¿Entrar en modo mantenimiento durante una impresión?`,confirmMidPrintMessage:`{{name}} está imprimiendo actualmente. Entrar en modo mantenimiento desconectará MQTT y detendrá el seguimiento del progreso y las notificaciones de finalización para este trabajo. ¿Continuar?`,editFieldLabel:`Modo mantenimiento`,editFieldHelp:`Cuando está activado, esta impresora se pausa de MQTT, despacho de cola y notificaciones — útil para reparaciones, instalaciones paralelas de Bambuddy o suspensión temporal.`},chamberLightOn:`Encender luz de la cámara`,chamberLightOff:`Apagar luz de la cámara`,files:`Archivos`,browseFiles:`Explorar archivos de la impresora`,autoOffAfterPrint:`Apagado automático tras la impresión`,autoOffExecuted:`Se ejecutó el apagado automático - encienda la impresora para restablecer`,hmsErrors:`Errores HMS`,viewHmsErrors:`Ver {{count}} error(es) HMS`,resume:`Reanudar`,pause:`Pausar`,stop:`Detener`,camera:`Cámara`,skipObject:`Omitir objeto`,reconnect:`Reconectar`,forceRefresh:`Forzar actualización`,forceRefreshSuccess:`Actualización solicitada`,mqttDebug:`Depuración MQTT`,printerInformation:`Información de la impresora`,copyToClipboard:`Copiar`,copied:`¡Copiado!`,state:`Estado`,wifiSignalLabel:`Señal Wi-Fi`,developerMode:`Modo desarrollador`,enabled:`Activado`,disabled:`Desactivado`,addedOn:`Añadida`,sdCard:`Tarjeta SD`,inserted:`Insertada`,notInserted:`No insertada`,totalPrintHours:`Horas de impresión`,activeNozzle:`Activa: boquilla {{nozzle}}`,amsSwitchInletTooltip:`Conmutador de ruta de filamento IN-{{inlet}} ({{side}}): alimenta ambas boquillas`,nozzleRack:`Soporte de boquillas`,nozzleDocked:`Acoplada`,nozzleMounted:`Montada`,nozzleActive:`Activa`,nozzleIdle:`Inactiva`,nozzleDiameter:`Diámetro`,nozzleType:`Tipo`,nozzleStatus:`Estado`,nozzleFilament:`Filamento`,nozzleWear:`Desgaste`,nozzleMaxTemp:`Temp. máx.`,nozzleSerial:`Serie`,nozzleHardenedSteel:`Acero endurecido`,nozzleStainlessSteel:`Acero inoxidable`,nozzleTungstenCarbide:`Carburo de tungsteno`,nozzleFlow:`Flujo`,nozzleHighFlow:`Flujo alto`,nozzleStandardFlow:`Estándar`,firmwareUpdate:`Actualización de firmware`,firmwareInstructions:`En la pantalla táctil de la impresora, vaya a`,firmwareNav:`Navegue hasta`,settings:`Ajustes`,firmware:`Firmware`,discoverPrinters:`Detectar impresoras`,searching:`Buscando...`,manualEntry:`Entrada manual`,addFromCloud:`Añadir desde la nube`,toast:{printerDeleted:`Impresora eliminada`,missingSpoolAssignment:`Impresión iniciada en {{printer}}. Falta la asignación de bobina para: {{slots}}`,killSwitchTriggered:`El interruptor de seguridad de facturación detuvo una impresión no autorizada en {{printer}}: {{filename}}`,billingChargeFailed:`La facturación de {{filename}} en {{printer}} ha fallado. Se conservó la reserva de presupuesto; revisa los registros del servidor.`,assignmentVerified:`Filamento cargado en la ranura {{slot}} ({{printer}})`,assignmentVerifiedNoKprofile:`Ranura {{slot}} en {{printer}} cargada, pero no se aplicó el perfil de calibración de flujo (perfil K)`,assignmentNotConfirmed:`No se pudo confirmar la asignación de la ranura {{slot}} en {{printer}}: revisa la ranura AMS`,printerAdded:`Impresora añadida`,printerUpdated:`Impresora actualizada`,failedToDelete:`Error al eliminar la impresora`,failedToAdd:`Error al añadir la impresora`,connectionFailedNotAdded:`No se pudo conectar con la impresora. Verifique la IP, el número de serie y el código de acceso, y confirme que el modo solo LAN está activado. La impresora no se añadió.`,failedToUpdate:`Error al actualizar la impresora`,commandSent:`Comando enviado`,failedToSendCommand:`Error al enviar el comando`,turnedOn:`{{name}} encendida`,failedToPowerOn:`Error al encender {{name}}`,scriptTriggered:`Script ejecutado`,printStopped:`Impresión detenida`,printPaused:`Impresión en pausa`,printResumed:`Impresión reanudada`,referenceDeleted:`Referencia eliminada`,detectionAreaSaved:`Área de detección guardada`,failedToRunScript:`Error al ejecutar el script`,failedToStopPrint:`Error al detener la impresión`,failedToPausePrint:`Error al pausar la impresión`,failedToResumePrint:`Error al reanudar la impresión`,failedToControlChamberLight:`Error al controlar la luz de la cámara`,failedToSetSpeed:`Error al establecer la velocidad de impresión`,failedToUpdateSetting:`Error al actualizar el ajuste`,failedToSkipObjects:`Error al omitir objetos`,failedToRereadRfid:`Error al releer el RFID`,failedToCheckPlate:`Error al comprobar la cama`,failedToUpdateLabel:`Error al actualizar la etiqueta`,failedToDeleteReference:`Error al eliminar la referencia`,failedToSaveDetectionArea:`Error al guardar el área de detección`,plateCheckEnabled:`Comprobación de cama activada`,plateCheckDisabled:`Comprobación de cama desactivada`,calibrationSaved:`¡Calibración guardada!`,calibrationFailed:`Error en la calibración`,rfidRereadInitiated:`Relectura de RFID iniciada`,loadInitiated:`Cargando filamento…`,unloadInitiated:`Descargando filamento…`,failedToLoad:`Error al cargar el filamento`,failedToUnload:`Error al descargar el filamento`},connection:{connected:`Conectada`,offline:`Desconectada`},plateStatus:{markCleared:`Marcar cama como despejada`,cleared:`Cama despejada`,notCleared:`Cama no despejada`,inUse:`Cama en uso`},queue:{inQueue:`{{count}} impresión en cola`,inQueue_plural:`{{count}} impresiones en cola`},controls:`Controles`,rfid:{reread:`Releer RFID`},ams:{load:`Cargar`,unload:`Descargar`,feedTitle:`¿En qué boquilla cargar {{slot}}?`,feedPrompt:`El Filament Track Switch puede dirigir esta ranura a cualquiera de los dos hotends. Elige cuál alimentar.`,feedLeft:`Boquilla izquierda`,feedRight:`Boquilla derecha`,feedAlreadyLoaded:`Ya cargado`,switchNotReady:`El Filament Track Switch aún no está configurado. Asigna cada AMS a una entrada en la impresora e inténtalo de nuevo.`},bedJog:{limitWarning:`Los límites de recorrido no se aplican en los movimientos manuales: un error del firmware de Bambu ignora los finales de carrera por software en los comandos remotos. Muévelo con cuidado para evitar colisiones.`,title:`Controles de movimiento`,bed:`Cama`,step:`Paso (mm)`,up:`Subir la cama`,down:`Bajar la cama`,toolheadUp:`Subir el cabezal`,toolheadDown:`Bajar el cabezal`,disabledWhilePrinting:`Desactivado durante la impresión`,notHomedTitle:`La impresora no está en posición de origen`,notHomedMessage:`La impresora no se ha llevado a su posición de origen desde la última impresión. Ejecute el autoorigen primero para un posicionamiento seguro (estaciona el cabezal y luego lleva X, Y y Z al origen), o mueva de todos modos — los finales de carrera por software se omitirán.`,homeZ:`Autoorigen`,moveAnyway:`Mover de todos modos`,homingStarted:`Llevando la impresora al origen…`},permission:{noAdd:`No tiene permiso para añadir impresoras`,noEdit:`No tiene permiso para editar impresoras`,noDelete:`No tiene permiso para eliminar impresoras`,noControl:`No tiene permiso para controlar impresoras`,noFiles:`No tiene permiso para acceder a los archivos de la impresora`,noAmsRfid:`No tiene permiso para releer el RFID del AMS`,noSmartPlugControl:`No tiene permiso para controlar enchufes inteligentes`,noCamera:`No tiene permiso para ver las cámaras`},modal:{addTitle:`Añadir impresora`,editTitle:`Editar impresora`,myPrinter:`Mi impresora`,selectModel:`Seleccionar modelo...`,locationGroup:`Ubicación / Grupo (opcional)`,locationPlaceholder:`p. ej., Taller, Oficina, Sótano`,autoArchiveLabel:`Archivar automáticamente las impresiones completadas`,wearCostLabel:`Coste de desgaste por hora de impresión ({{currency}})`,wearCostHelp:`Lo que una hora de impresión le cuesta a esta impresora en desgaste y piezas. Se suma al coste de cada impresión a partir de ahora; las impresiones anteriores no cambian. Déjalo vacío para desactivarlo.`,fromPrinterSettings:`Desde los ajustes de la impresora`,modelOptional:`Modelo (opcional)`,saveChanges:`Guardar cambios`},skipObjects:{tooltip:`Omitir objetos`,onlyWhilePrinting:`Omitir objetos (solo durante la impresión)`,requiresMultiple:`Omitir objetos (requiere 2 o más objetos)`,title:`Omitir objetos`,matchIdsInfo:`Haga coincidir los ID con la pantalla de su impresora`,printerShowsIds:`La pantalla de la impresora muestra los ID de los objetos en la cama de impresión`,skipSelected:`Omitir seleccionados`,skipping:`Omitiendo...`,noObjectsSelected:`No hay objetos seleccionados`,selectObjectsToSkip:`Seleccione los objetos que desea omitir de la impresión actual`,skipped:`omitidos`,objectsSkipped:`Objetos omitidos`,activeCount:`{{count}} activos`,waitForLayer:`Espere a la capa 2 o superior para omitir objetos (capa actual {{layer}})`,skip:`Omitir`,confirmTitle:`¿Omitir objeto?`,confirmMessage:`¿Está seguro de que desea omitir "{{name}}"? Esto no se puede deshacer.`,confirmAllMessage:`Se han seleccionado todos los objetos restantes. Esto detendrá el trabajo de impresión. ¿Continuar?`,confirmMultipleMessage:`¿Omitir {{count}} objetos seleccionados? Esto no se puede deshacer.`},confirm:{deleteTitle:`Eliminar impresora`,deleteMessage:`¿Está seguro de que desea eliminar "{{name}}"? Esto eliminará todos los ajustes de conexión.`,deleteArchivesNote:`Todo el historial de impresión de esta impresora se eliminará permanentemente.`,keepArchivesNote:`El historial de impresión se conservará pero ya no estará asociado a esta impresora.`,stopTitle:`Detener impresión`,stopMessage:`¿Está seguro de que desea detener la impresión actual en "{{name}}"? Esto cancelará el trabajo de impresión.`,stopButton:`Detener impresión`,pauseTitle:`Pausar impresión`,pauseMessage:`¿Está seguro de que desea pausar la impresión actual en "{{name}}"?`,pauseButton:`Pausar impresión`,resumeTitle:`Reanudar impresión`,resumeMessage:`¿Está seguro de que desea reanudar la impresión en "{{name}}"?`,resumeButton:`Reanudar impresión`,powerOnTitle:`Encender impresora`,powerOnMessage:`¿Está seguro de que desea ENCENDER "{{name}}"?`,powerOnButton:`Encender`,powerOffTitle:`Apagar impresora`,powerOffMessage:`¿Está seguro de que desea APAGAR "{{name}}"?`,powerOffWarning:`ADVERTENCIA: ¡"{{name}}" está imprimiendo actualmente! ¿Está seguro de que desea APAGARLA? Esto interrumpirá la impresión y podría dañar la impresora.`,powerOffButton:`Apagar`,haToggleTitle:`Conmutar "{{name}}"`,haToggleMessage:`¿Conmutar la entidad de Home Assistant {{entity}}? Esto puede apagarla si está encendida actualmente.`,haToggleWarning:`ADVERTENCIA: ¡"{{name}}" está imprimiendo actualmente! Conmutar {{entity}} puede cortar la corriente e interrumpir la impresión. ¿Continuar?`,haToggleButton:`Conmutar`},bulk:{select:`Seleccionar`,selectAll:`Seleccionar todo`,selectByLocation:`Seleccionar por ubicación`,selected:`{{count}} seleccionadas`,actions:{stop:`Detener`,pause:`Pausar`,resume:`Reanudar`,clearPlate:`Despejar cama`,clearHMS:`Borrar notificaciones`},confirm:{stopTitle:`Detener {{count}} impresiones`,stopMessage:`Esto cancelará las impresiones activas en {{count}} impresora(s). Esta acción no se puede deshacer.`,stopButton:`Detener todo`,pauseTitle:`Pausar {{count}} impresiones`,pauseMessage:`Esto pausará las impresiones activas en {{count}} impresora(s).`,pauseButton:`Pausar todo`,clearPlateTitle:`Despejar {{count}} camas de impresión`,clearPlateMessage:`Esto despejará la cama de impresión en {{count}} impresora(s) y puede activar trabajos en cola.`,clearPlateButton:`Despejar todo`},success:`{{action}} completado en {{count}} impresora(s)`,partial:`{{succeeded}} con éxito, {{failed}} con error`,noneApplicable:`Ninguna de las impresoras seleccionadas está en el estado adecuado para esta acción`,selectByState:`Seleccionar por estado`},discovery:{title:`Detectar impresoras`,searching:`Buscando...`,scanning:`Escaneando...`,scanProgress:`Escaneando... {{scanned}}/{{total}}`,foundPrinters:`Se encontraron {{count}} impresora(s)`,noPrintersFound:`No se encontraron impresoras`,noPrintersFoundSubnet:`No se encontraron impresoras en la subred especificada.`,noPrintersFoundNetwork:`No se encontraron impresoras en la red.`,allConfigured:`Todas las impresoras detectadas ya están configuradas.`,alreadyAdded:`Ya añadida`,select:`Seleccionar`,manualEntry:`Entrada manual`,addFromCloud:`Añadir desde la nube`,subnetToScan:`Subred a escanear`,dockerNote:`Docker detectado. Introduzca la subred de su impresora en notación CIDR. Requiere network_mode: host en docker-compose.yml.`,scanSubnet:`Escanear subred en busca de impresoras`,discoverNetwork:`Detectar impresoras en la red`,scanningSubnet:`Escaneando la subred en busca de impresoras Bambu...`,scanningNetwork:`Escaneando la red...`,serialRequired:`Número de serie obligatorio`,unknown:`Desconocido`,failedToStart:`Error al iniciar la detección`,customSubnetOption:`Subred personalizada...`,customSubnetLabel:`Subred personalizada (CIDR)`,customSubnetNote:`Usa una subred personalizada si tu impresora está en una red distinta a la de este servidor. Los puertos FTP (990) y MQTT (8883) deben ser accesibles a través del límite de enrutamiento.`},drying:{start:`Iniciar secado`,stop:`Detener secado`,temperature:`Temperatura`,duration:`Duración`,hours:`horas`,timeRemaining:`{{time}} restante`,active:`Secando`,notRunning:`El secado no está en curso`,notRunningHint:`La impresora tiene un temporizador de secado, pero la cuenta atrás se ha detenido y el AMS no informa de ninguna fase de secado. El ciclo nunca empezó o se pausó, por ejemplo por el límite de potencia o por la impresión en curso.`,targetSummary:`{{filament}} @ {{temp}}°C`,notSupported:`Secado no compatible`,powerRequired:`Conecte el adaptador de corriente del AMS para activar el secado`,cannotDryNow:`El AMS no puede iniciar el secado en este momento`,startingDrying:`Iniciando el secado...`,toastCommandSent:`Comando de secado enviado`,toastStopped:`Secado detenido`,toastNotStarted:`La impresora aceptó el comando, pero el AMS no inició el secado. Comprueba que el adaptador de corriente del AMS esté conectado y que la impresora esté inactiva.`,screenOnly:`En esta impresora, el secado del AMS solo se puede controlar desde la pantalla de la propia impresora (limitación de Bambu)`,stoppingDrying:`Deteniendo el secado...`,rotateTray:`Girar la bobina durante el secado`,rotateUnavailableReason:`No disponible — un slot de este AMS está cargado hacia el cabezal. La bobina está bloqueada por el tubo de alimentación y no puede girar. Retira el filamento primero.`,startMode:`Hora de inicio`,modeNow:`Ahora`,modeDelay:`Tras un retraso`,modeAtTime:`A una hora`,schedule:`Programar`,scheduledFor:`Secado programado para {{time}}`,scheduledAsap:`Secado programado (esperando la impresora)`,cancelScheduled:`Cancelar secado programado`,scheduleFailed:`No se pudo programar el secado`,retractFilament:`Retire el filamento de la salida del AMS para iniciar el secado`,waitingAmsNotFound:`Esperando a que se detecte el AMS`,waitingOffline:`Esperando a que la impresora se conecte`,waitingPrinterBusy:`Esperando a que la impresora esté libre`,waitingAlreadyDrying:`Esperando a que termine el ciclo de secado actual`,waitingInterrupted:`Interrumpido, se reanudará cuando la impresora esté libre`,scheduleFailedReason:`El secado programado falló: {{reason}}`,scheduleFailedUnknown:`Error desconocido`,scheduleFailedDidNotStart:`La impresora aceptó el comando, pero el AMS no empezó a secar`,dismissFailed:`Descartar`},amsBackup:{titleOn:`AMS Filament Backup está ACTIVADO. Haz clic para desactivar.`,titleOff:`AMS Filament Backup está DESACTIVADO. Haz clic para activar.`,titleUnknown:`Estado de AMS Filament Backup no disponible en esta impresora.`,toastEnabled:`AMS Filament Backup activado`,toastDisabled:`AMS Filament Backup desactivado`,modalTitle:`AMS Filament Backup`,modalHelp:`Cuando el slot activo se agota, la impresora rota a slots con el mismo preset y color en este orden.`,modalNoSlots:`Sin filamento cargado.`,modalNoPairs:`No hay pares de respaldo — no hay dos slots que compartan preset y color.`,extruderRightShort:`D`,extruderLeftShort:`I`,stateOn:`Activado`,stateOff:`Desactivado`,stateUnknown:`No compatible con esta impresora`},activeJobSlot:{title:`Este slot es el filamento {{n}} en la impresión activa`,ariaLabel:`Slot de impresión activa {{n}}`},expectedSlot:{title:`La impresora está esperando filamento en este slot`,ariaLabel:`Slot de filamento esperado {{n}}`,label:`{{ams}} · Slot {{slot}}`,external:`Bobina externa`},filaments:`Filamentos`,externalSpool:{hide:`Ocultar bobina externa`,show:`Mostrar bobina externa`},openCameraOverlay:`Abrir la cámara superpuesta`,openCameraWindow:`Abrir la cámara en una ventana nueva`,firmwareUpdateAvailable:`Actualización de firmware disponible: {{current}} → {{latest}}`,firmwareUpToDate:`Firmware {{version}} — Actualizado`,firmwareUpdateButton:`Actualizar`,plateDetection:{noPermission:`No tiene permiso para actualizar impresoras`,enabledClick:`Comprobación de cama activada - Haga clic para desactivar`,disabledClick:`Comprobación de cama desactivada - Haga clic para activar`,manageCalibration:`Gestionar la calibración de detección de cama`,calibrationRequired:`Calibración necesaria`,calibrationInstructions:`Asegúrese de que la cama de impresión esté completamente vacía y luego haga clic en Calibrar.`,calibrationDescription:`La calibración captura una imagen de referencia de la cama vacía. Las comprobaciones futuras se compararán con esta referencia para detectar objetos.`,calibrationTip:`Consejo: puede almacenar hasta 5 calibraciones para distintas camas. El sistema usa automáticamente la mejor coincidencia al comprobar.`,plateEmpty:`La cama parece estar vacía`,objectsDetected:`Objetos detectados en la cama`,confidence:`Confianza`,difference:`Diferencia`,analysisPreview:`Vista previa del análisis:`,analysisLegend:`Recuadro verde = área de detección, Superposición roja = diferencias respecto a la calibración`,savedReferences:`Referencias guardadas ({{count}}/{{max}})`,deleteReference:`Eliminar referencia`,labelPlaceholder:`Etiqueta...`,clickToEdit:`{{label}} - Haga clic para editar`,clickToAddLabel:`Haga clic para añadir una etiqueta`},speed:{title:`Velocidad de impresión`,silent:`Silencioso (50%)`,standard:`Estándar (100%)`,sport:`Sport (124%)`,ludicrous:`Ludicrous (166%)`},airduct:{title:`Modo de conducto de aire`,cooling:`Refrigeración`,heating:`Calentamiento`},noSdCard:`Sin SD`,door:{open:`Abierta`,closed:`Cerrada`},fans:{partCooling:`Ventilador de refrigeración de piezas`,auxiliary:`Ventilador auxiliar`,leftAuxiliary:`Ventilador auxiliar izquierdo`,exhaust:`Extracción`,chamber:`Ventilador de la cámara`},clickToViewHmsErrors:`Haga clic para ver los errores HMS`,aiDetection:{safe:`Seguro`,warning:`Advertencia`,failure:`Fallo`,idle:`Inactiva`,error:`Sin comprobar`,unknown:`Iniciando`,tooltipError:`La detección de fallos por IA no está comprobando esta impresión: {{reason}} - haga clic para más detalles`,tooltipUnknown:`Detección de fallos por IA: esperando el primer resultado - haga clic para más detalles`,errorHint:`Esta impresión no se está comprobando. La detección se reanudará automáticamente cuando se solucione el problema indicado abajo.`,tooltip:`Detección de fallos por IA: {{status}} (puntuación {{score}}) - haga clic para más detalles`,tooltipIdle:`Detección de fallos por IA activada - la supervisión comienza con la próxima impresión - haga clic para más detalles`,modalTitle:`Detección de fallos por IA - {{name}}`,currentStatus:`Estado`,score:`Puntuación`,framesAnalyzed:`Fotogramas analizados`,idleHint:`Ahora mismo no se supervisa ninguna impresión. La supervisión comienza automáticamente con la próxima impresión.`,lastError:`Último error`,openSettings:`Abrir ajustes`},estimatedCompletion:`Hora estimada de finalización`,plateNumber:`Cama {{number}}`,slotOptions:`Opciones de la ranura`,amsPopup:{friendlyName:`Nombre del AMS`,friendlyNamePlaceholder:`p. ej. Nombre descriptivo del AMS`,serialNumber:`Número de serie`,firmwareVersion:`Firmware`,save:`Guardar`,clear:`Borrar`,noEditPermission:`No tiene permiso para renombrar unidades AMS`},firmwareModal:{title:`Actualización de firmware`,titleUpToDate:`Información del firmware`,currentVersion:`Actual:`,latestVersion:`Más reciente:`,releaseNotes:`Notas de la versión`,checkingPrereqs:`Comprobando los requisitos previos...`,sdCardReady:`Tarjeta SD lista. Haga clic abajo para subir el firmware.`,uploadedSuccess:`¡Firmware subido a la tarjeta SD!`,applyInstructions:`Para aplicar la actualización en su impresora:`,step1:`En la pantalla táctil de la impresora, vaya a Ajustes`,step2:`Navegue hasta Firmware`,step3:`Seleccione Actualizar desde tarjeta SD`,step4:`La actualización tardará entre 10 y 20 minutos`,done:`Hecho`,starting:`Iniciando...`,uploadFirmware:`Subir firmware`,uploadFailed:`Error al iniciar la subida: {{error}}`,uploadedToast:`¡Firmware subido! Inicie la actualización desde la pantalla de la impresora.`,availableVersions:`Versiones disponibles`,usable:`Utilizable`,unavailable:`No disponible`,installed:`Instalada`,newerBadge:`más reciente`,olderBadge:`más antigua`,currentBadge:`actual`},accessCodePlaceholder:`Dejar vacío para conservar el actual`,roi:{title:`Área de detección (ROI)`,xStart:`Inicio X`,yStart:`Inicio Y`,width:`Anchura`,height:`Altura`,instruction:`Ajuste el área de detección para centrarse en la cama de impresión. El recuadro verde de la vista previa muestra el área actual.`},developerModeWarning:`El modo desarrollador LAN no está activado en: {{names}}. Es posible que algunas funciones no funcionen.`,howToEnable:`Cómo activarlo`,incompatibleFile:`Este archivo se laminó para {{slicedFor}}, pero esta impresora es una {{printerModel}}`,dropNotPrintable:`Solo se pueden imprimir archivos .gcode y .gcode.3mf`,dropToPrint:`Suelte para imprimir`,dropToQueue:`Suelte para poner en cola`},archives:{media:{title:`Vídeos de la impresión`,download:`Descargar vídeos de la impresión`,searching:`Buscando vídeos en la impresora…`,searchFailed:`No se pudieron buscar vídeos en la impresora.`,none:`No se encontraron vídeos timelapse ni fragmentos de cámara IP para esta impresión.`,attachedTimelapse:`Timelapse adjunto`,printerFiles:`Archivos que aún están en la impresora`,downloadSelected:`Descargar seleccionados`,printerMissing:`La impresora ya no está configurada`,timelapseUnavailable:`No se pudo leer el directorio de timelapses`,ipcamUnavailable:`No se pudo leer el directorio de la cámara IP`},title:`Archivos de impresión`,no3mfBanner:{title:`Algunas impresiones recientes no se pudieron archivar con miniaturas`,body:`El slicer no dejó el archivo .gcode.3mf en la tarjeta SD de la impresora, así que Bambuddy no pudo recuperar ni la miniatura ni los metadatos del slicer. Esto suele deberse a que "Almacenar archivos enviados en almacenamiento externo" está desactivado en el slicer (pestaña Dispositivo de Bambu Studio / OrcaSlicer).`,docsLink:`Ver paso 4 de instalación`,docsLinkInternalStorage:`Por qué ocurre`,titleInternalStorage:`Algunas impresiones recientes se quedaron en el almacenamiento interno de la impresora`,bodyInternalStorage:`Bambu Studio guardó el archivo laminado en el almacenamiento interno de la impresora en lugar de la tarjeta, así que Bambuddy no tenía nada que leer por FTP. En la serie H2, la P2S y la X2D su botón «Imprimir» siempre lo hace: solo «Enviar» ofrece elección, y también viene con «Caché» por defecto. Esas impresiones se siguen archivando con su nombre y sus tiempos, solo que sin miniatura ni metadatos del laminador. Para archivos completos, inicia la impresión desde Bambuddy o lamina en OrcaSlicer, o bien en Bambu Studio usa «Enviar» con «Externo» y luego inicia la impresión. Todas requieren una tarjeta o memoria en la impresora.`,titleNoExternalStorage:`Algunas impresiones recientes no se pudieron archivar — no hay almacenamiento en la impresora`,bodyNoExternalStorage:`La impresora no detecta ninguna tarjeta ni memoria en su ranura, así que el archivo laminado no tenía dónde aterrizar y Bambuddy nada que leer. Inserte una y la próxima impresión se archivará por completo.`,titleInternalHistory:`Algunas impresiones recientes se iniciaron desde un archivo que ya estaba en la impresora`,bodyInternalHistory:`Esas impresiones salieron de la propia biblioteca de la impresora: una reimpresión desde su pantalla, un inicio desde Handy o un archivo enviado antes e impreso después. Bambuddy lee los archivos de impresión por FTP, que solo sirve la tarjeta o la memoria, mientras que la impresora guarda esa biblioteca en una zona que FTP no alcanza, así que no había ningún 3MF que leer. Ninguna opción del laminador cambia esto, porque para estas impresiones no se envió nada. Se siguen archivando con su nombre y sus tiempos, y «Editar archivo» permite anotar a mano el filamento usado. Para un archivo completo, inicia la impresión desde Bambuddy o desde tu laminador.`,titleFtpsCooloff:`Algunas impresiones recientes no se pudieron archivar — la impresora rechazó la conexión de archivos`,bodyFtpsCooloff:`Bambuddy abrió el puerto de transferencia de archivos de la impresora (FTPS 990) y la impresora respondió con algo que no es TLS, así que no se pudo leer nada de ella. Esas impresiones siguen archivadas con su nombre y sus tiempos, solo que sin miniatura ni metadatos del laminador. No es un ajuste del laminador ni algo que usted haya cambiado — los mismos modelos y firmware funcionan con normalidad en otras instalaciones, y una impresora afectada suele volver a funcionar sola más tarde. Tras un fallo así, Bambuddy pausa las transferencias a esa impresora durante cinco minutos y vuelve a por el archivo cuando termina la pausa, de modo que un episodio breve se resuelve por sí solo; una ficha que sigue vacía significa que el rechazo duró más que el reintento. Todavía no se sabe qué lo provoca. Si se repite, active el registro de depuración en la página Sistema y adjunte un paquete de soporte a su informe.`,titleFtpTransferFailed:`Algunas impresiones recientes no se pudieron archivar: la transferencia del archivo agotó su tiempo`,bodyFtpTransferFailed:`El archivo laminado estaba en la tarjeta de la impresora y la impresora lo sirvió, pero la transferencia no terminó en el tiempo permitido. Al iniciar la impresión la impresora también atiende su cámara, sus mensajes de estado y la subida del trabajo, y un 3MF grande no siempre consigue pasar con todo eso. Esas impresiones siguen archivadas con su nombre y sus tiempos, solo que sin miniatura ni metadatos del laminador. No es un ajuste del laminador ni algo que usted haya cambiado. Bambuddy vuelve a por el archivo tres veces durante los diez minutos siguientes, así que la mayoría se completan solas; una tarjeta que sigue vacía significa que todos esos intentos también agotaron su tiempo. Si se repite, aumente Tiempo de espera de conexión en Ajustes > Red > Reintento FTP.`,dismissLabel:`Descartar este aviso`},searchPlaceholder:`Buscar archivos...`,filterByPrinter:`Filtrar por impresora`,filterByStatus:`Filtrar por estado`,sortBy:`Ordenar por`,sortNewest:`Más recientes primero`,sortOldest:`Más antiguos primero`,sortName:`Nombre`,sortDuration:`Duración`,sortLargest:`Mayores primero`,sortSmallest:`Menores primero`,sortSize:`Tamaño`,noArchives:`No se encontraron archivos`,noArchivesSearch:`Ningún archivo coincide con su búsqueda`,originalPrintNotVisible:`La impresión original no está visible - pruebe a borrar los filtros`,noArchivesYet:`Aún no hay archivos`,prints:`impresiones`,pagination:{showing:`Mostrando`,to:`a`,of:`de`,show:`Mostrar`,page:`Página`,all:`Todos`},loadingArchives:`Cargando archivos...`,releaseToUpload:`Suelte para subir`,showAll:`Mostrar todos`,showFavoritesOnly:`Mostrar solo favoritos`,gridView:`Vista de cuadrícula`,listView:`Vista de lista`,calendarView:`Vista de calendario`,logView:`Registro de impresión`,manageTags:`Gestionar etiquetas`,showFailedPrints:`Mostrar impresiones fallidas`,hideFailedPrints:`Ocultar impresiones fallidas`,hideDuplicates:`Ocultar duplicados`,filterUnconfirmed:`Sin confirmar`,filterUnconfirmedTitle:`Mostrar solo las impresiones que aún esperan su veredicto de resultado`,viewOriginalPrint:`Haga clic para ver la impresión original (n.º {{id}})`,printTime:`Tiempo de impresión`,filamentUsed:`Filamento usado`,cost:`Coste`,preview:`Vista previa`,deleteArchive:`Eliminar archivo`,deleteConfirm:`¿Está seguro de que desea eliminar este archivo?`,favorite:`Favorito`,unfavorite:`Quitar de favoritos`,viewDetails:`Ver detalles`,status:{completed:`Completada`,failed:`Fallida`,stopped:`Detenida`},toast:{source3mfAttached:`3MF de origen adjuntado: {{filename}}`,failedUploadSource3mf:`Error al subir el 3MF de origen`,source3mfRemoved:`3MF de origen eliminado`,failedRemoveSource3mf:`Error al eliminar el 3MF de origen`,f3dAttached:`F3D adjuntado: {{filename}}`,failedUploadF3d:`Error al subir el F3D`,f3dRemoved:`F3D eliminado`,failedRemoveF3d:`Error al eliminar el F3D`,timelapseAttached:`Time-lapse adjuntado: {{filename}}`,timelapseAlreadyAttached:`El time-lapse ya está adjuntado`,noMatchingTimelapse:`No se encontró ningún time-lapse coincidente`,failedScanTimelapse:`Error al buscar el time-lapse`,failedAttachTimelapse:`Error al adjuntar el time-lapse`,timelapseRemoved:`Time-lapse eliminado`,failedRemoveTimelapse:`Error al eliminar el time-lapse`,timelapseUploaded:`Time-lapse subido: {{filename}}`,failedUploadTimelapse:`Error al subir el time-lapse`,archiveDeleted:`Archivo eliminado`,failedDeleteArchive:`Error al eliminar el archivo`,addedToFavorites:`Añadido a favoritos`,removedFromFavorites:`Quitado de favoritos`,projectUpdated:`Proyecto actualizado`,failedUpdateProject:`Error al actualizar el proyecto`,linkCopied:`Enlace copiado al portapapeles`,failedCopyLink:`Error al copiar el enlace`,photoDeleted:`Foto eliminada`,failedDeletePhoto:`Error al eliminar la foto`,failedDeleteArchives:`Error al eliminar los archivos`,failedUpdateFavorites:`Error al actualizar los favoritos`,exportDownloaded:`Exportación descargada`,exportFailed:`Error en la exportación`},menu:{print:`Imprimir`,openInBambuStudio:`Abrir en el laminador`,slice:`Laminar`,externalLink:`Enlace externo`,viewOnMakerWorld:`Ver en MakerWorld`,confirmOutcome:`Confirmar resultado`,preview3d:`Vista previa 3D`,viewTimelapse:`Ver time-lapse`,scanForTimelapse:`Buscar time-lapse`,uploadTimelapse:`Subir time-lapse`,removeTimelapse:`Eliminar time-lapse`,downloadSource3mf:`Descargar 3MF de origen`,uploadSource3mf:`Subir 3MF de origen`,replaceSource3mf:`Reemplazar 3MF de origen`,removeSource3mf:`Eliminar 3MF de origen`,uploadF3d:`Subir F3D`,replaceF3d:`Reemplazar F3D`,downloadF3d:`Descargar F3D`,removeF3d:`Eliminar F3D`,download:`Descargar`,copyDownloadLink:`Copiar enlace de descarga`,qrCode:`Código QR`,viewPhotos:`Ver fotos`,viewPhotosCount:`Ver fotos ({{count}})`,projectPage:`Página del proyecto`,addToFavorites:`Añadir a favoritos`,removeFromFavorites:`Quitar de favoritos`,edit:`Editar`,printLog:`Registro de impresión`,goToProject:`Ir al proyecto: {{name}}`,addToProject:`Añadir al proyecto`,removeFromProject:`Quitar del proyecto`,loading:`Cargando...`,noProjectsAvailable:`No hay proyectos disponibles`,searchProjects:`Buscar proyectos…`,select:`Seleccionar`,deselect:`Deseleccionar`,delete:`Eliminar`},permission:{noReprint:`No tiene permiso para reimprimir este archivo`,noAddToQueue:`No tiene permiso para añadir a la cola`,noUpdateArchives:`No tiene permiso para actualizar archivos`,noUploadFiles:`No tiene permiso para subir archivos`,noDownload:`No tiene permiso para descargar archivos`,noCopyLink:`No tiene permiso para copiar enlaces de descarga`,noDelete:`No tiene permiso para eliminar este archivo`,noEdit:`No tiene permiso para editar esta entrada`,noCreate:`No tiene permiso para crear archivos`},platePicker:{title:`Seleccione la cama para la vista previa`,hint:`Este archivo tiene varias camas. Elija una para abrirla en el visor de G-code.`,plateLabel:`Cama {{index}}`,objectCount:`{{count}} objeto`,objectCount_plural:`{{count}} objetos`,noGcode:`Este archivo no tiene G-code laminado para previsualizar. Ábralo en Bambu Studio para laminarlo primero.`},card:{previousPlate:`Cama anterior`,nextPlate:`Cama siguiente`,plateNumber:`Cama {{index}}`,moreOptions:`Haga clic con el botón derecho para más opciones`,addToFavorites:`Añadir a favoritos`,removeFromFavorites:`Quitar de favoritos`,cancelled:`cancelada`,failed:`fallida`,confirmPending:`¿resultado?`,confirmPendingTitle:`Esta impresión solicitó un veredicto de resultado — haga clic para responder`,rejected:`rechazada`,rejectedTitle:`Completada en la impresora, marcada como rechazo por el usuario`,confirmedGood:`buena`,confirmedGoodTitle:`Confirmada como pieza buena por el usuario`,duplicate:`duplicado`,duplicateTitle:`Este modelo ya se ha impreso anteriormente`,openSource3mf:`Abrir el 3MF de origen en Bambu Studio (clic derecho para más opciones)`,downloadF3d:`Descargar el archivo de diseño de Fusion 360`,viewTimelapse:`Ver time-lapse`,viewPhoto:`Ver 1 foto`,viewPhotos:`Ver {{count}} fotos`,openFolder:`Abrir carpeta: {{name}}`,slicedFile:`Archivo laminado - listo para imprimir`,sourceFile:`Solo archivo de origen - no hay mapeo de AMS disponible`,gcode:`GCODE`,source:`ORIGEN`,project:`Proyecto: {{name}}`,runsBadge:`{{count}} impresiones`,runsBadgeTitle:`{{count}} impresiones en total — {{successful}} con éxito, {{failed}} fallidas. Haga clic para ver el registro completo de impresión.`,estimated:`Estimado: {{time}}`,actual:`Real: {{time}}`,accuracy:`Precisión: {{percent}}%`,filament:`{{weight}} g`,layer:`{{count}} capa`,layers:`{{count}} capas`,wearCost:`Desgaste de la impresora`,costEstimate:`Estimación: el coste final se fija cuando termina la impresión`,object:`{{count}} objeto`,objects:`{{count}} objetos`,slicedFor:`Laminado para {{model}}`,uploadedBy:`Subido por`,noPermissionReprint:`No tiene permiso para reimprimir`,noFileForReprint:`No hay archivo 3MF disponible — no se pudo descargar el archivo de la impresora cuando se registró la impresión`,slicerAmsMapping:`Mapeo de AMS guardado ({{printer}})`,slicerAmsMappingTooltip:`La elección de ranura AMS del slicer se guardó para {{printer}}. Los números de ranura solo significan algo en esa impresora, así que una reimpresión los reutiliza únicamente si vuelve a dirigirse a {{printer}}.`,noPermissionEdit:`No tiene permiso para editar archivos`,noPermissionDelete:`No tiene permiso para eliminar archivos`,openInBambuStudio:`Abrir en el laminador`,openInBambuStudioToSlice:`Abrir en el laminador para laminar`,slice:`Laminar`,externalLink:`Enlace externo`,makerWorld:`MakerWorld: {{designer}}`,viewProject:`Ver proyecto`,noExternalLink:`Sin enlace externo`,preview3d:`Vista previa 3D`,download:`Descargar`,edit:`Editar`,delete:`Eliminar`},runLog:{title:`Registro de impresión`,modalTitle:`Registro de impresión — {{name}}`,modalTitleFallback:`este archivo`,empty:`Aún no se han registrado eventos de impresión para este archivo.`,col:{date:`Fecha`,status:`Estado`,duration:`Duración`,filament:`Filamento`,cost:`Coste`},status:{completed:`Completada`,failed:`Fallida`,cancelled:`Cancelada`,stopped:`Detenida`,skipped:`Omitida`,printing:`Imprimiendo`}},modal:{deleteArchive:`Eliminar archivo`,deleteConfirm:`¿Está seguro de que desea eliminar "{{name}}"? Esta acción no se puede deshacer.`,deleteButton:`Eliminar`,deletePurgeStats:`Eliminar también esta impresión de las estadísticas rápidas (filamento, tiempo, coste, energía)`,deleteQueueItemsWarning:`También se eliminarán {{count}} elemento(s) de la cola vinculado(s) a este archivo.`,deleteBlockedByPrinting:`No se puede eliminar — {{count}} elemento(s) de la cola se están imprimiendo. Detén la impresión primero y vuelve a intentarlo.`,removeSource3mf:`Eliminar 3MF de origen`,removeSource3mfConfirm:`¿Está seguro de que desea eliminar el archivo 3MF de origen de "{{name}}"? Esto eliminará el archivo de proyecto original del laminador.`,removeButton:`Eliminar`,removeF3d:`Eliminar F3D`,removeF3dConfirm:`¿Está seguro de que desea eliminar el archivo de diseño de Fusion 360 de "{{name}}"?`,removeTimelapse:`Eliminar time-lapse`,removeTimelapseConfirm:`¿Está seguro de que desea eliminar el vídeo time-lapse de "{{name}}"?`,timelapse:`{{name}} - Time-lapse`,selectTimelapse:`Seleccionar time-lapse`,selectTimelapseDesc:`No se encontró ninguna coincidencia automática. Seleccione el time-lapse para esta impresión:`,deleteArchives:`Eliminar archivos`,deleteArchivesConfirm:`¿Está seguro de que desea eliminar {{count}} archivo(s)? Esta acción no se puede deshacer.`,deleteCount:`Eliminar {{count}}`},page:{title:`Archivos`,printsCount:`{{filtered}} de {{total}} impresiones`,dropFilesHere:`Suelte aquí los archivos .3mf`,releaseToUpload:`Suelte para subir`,only3mfSupported:`Solo se admiten archivos .3mf`,close:`Cerrar`,selected:`{{count}} seleccionados`,selectAll:`Seleccionar todo`,tags:`Etiquetas`,project:`Proyecto`,favorite:`Favorito`,delete:`Eliminar`,toggledFavorites:`Se cambió el estado de favorito de {{count}} archivo(s)`,failedUpdateFavorites:`Error al actualizar los favoritos`,archivesDeleted:`{{count}} archivo(s) eliminado(s)`,failedDeleteArchives:`Error al eliminar los archivos`,photoDeleted:`Foto eliminada`,failedDeletePhoto:`Error al eliminar la foto`},list:{name:`Nombre`,printer:`Impresora`,date:`Fecha`,size:`Tamaño`,actions:`Acciones`,hasTimelapse:`Tiene time-lapse`},log:{date:`Fecha`,printName:`Nombre de la impresión`,printer:`Impresora`,user:`Usuario`,status:`Estado`,duration:`Duración`,filament:`Filamento`,filamentUsed:`Filamento usado`,cost:`Coste`,energy:`Energía`,energyCost:`Coste de energía`,wearCost:`Coste de desgaste`,completedAt:`Finalizado`,columns:`Columnas`,sortBy:`Ordenar por {{column}}`,allPrinters:`Todas las impresoras`,allUsers:`Todos los usuarios`,allStatuses:`Todos los estados`,cancelled:`Cancelada`,skipped:`Omitida`,dateFrom:`Desde`,dateTo:`Hasta`,noEntries:`No se encontraron entradas en el registro de impresión`,showing:`Mostrando {{count}} de {{total}} entradas`,rowsPerPage:`Filas`,page:`Página`,prev:`Anterior`,next:`Siguiente`,clearLog:`Borrar registro`,clearLogTitle:`Borrar el registro de impresión`,clearLogConfirm:`Todas las entradas del registro de impresión se eliminarán permanentemente. Los archivos y los elementos de la cola no se ven afectados. Esta acción no se puede deshacer. ¿Está seguro?`,clearLogButton:`Borrar todo`,cleared:`{{count}} entradas del registro borradas`,clearFailed:`Error al borrar el registro de impresión`,deleteEntryTitle:`Eliminar entrada del registro de impresión`,deleteEntryConfirm:`Esta entrada se eliminará del registro y sus contribuciones de filamento, tiempo y costo desaparecerán de las estadísticas rápidas. El archivo correspondiente (si lo hay) no se ve afectado. Esta acción no se puede deshacer.`,entryDeleted:`Entrada del registro de impresión eliminada`,entryDeleteFailed:`Error al eliminar la entrada del registro de impresión`,editEntryTitle:`Editar entrada del registro de impresión`,editEntryDescription:`Clasifica esta impresión. El widget de Análisis de fallos agrupa por estos valores, por lo que las actualizaciones se reflejan en las estadísticas de inmediato.`,entryUpdated:`Entrada del registro actualizada`,entryUpdateFailed:`No se pudo actualizar la entrada del registro`,statuses:{completed:`Completada`,failed:`Fallida`,stopped:`Detenida`,cancelled:`Cancelada`,skipped:`Omitida`}}},dispatchToast:{untitled:`Trabajo de impresión`,startingPrints:`Iniciando impresiones`,progressSummary:`{{complete}}/{{total}} listas • Procesando: {{processing}}`,expandDetails:`Expandir detalles del despacho`,collapseDetails:`Contraer detalles del despacho`,awaitingPrinter:`Esperando a la impresora…`,status:{processing:`Procesando`,completed:`Completada`,failed:`Fallida`},failed:{generic:`Despacho fallido`,upload_failed:`Fallo al subir a la impresora`,start_command_failed:`La impresora rechazó el comando de inicio`},dismiss:`Cerrar`},pipelineRuns:{title:`Ejecuciones de pipeline`,loading:`Cargando…`,empty:`Aún no hay ejecuciones de pipeline.`,filter:{pipeline:`Pipeline`,status:`Estado`,target:`Destino`,all:`Todas`,allPipelines:`Todas las pipelines`,allStatus:`Todos los estados`,allTargets:`Todos los destinos`,clear:`Limpiar filtros`,noMatches:`Ninguna ejecución coincide con los filtros actuales.`},totalCount_one:`{{n}} ejecución`,totalCount_other:`{{n}} ejecuciones`,copies:`{{n}} copias`,failedCount:`{{n}} fallidas`,copyN:`Copia {{n}}`,retryFailed:`Reintentar fallidas`,retryOf:`reintento de #{{n}}`,pagination:`{{start}}–{{end}} de {{total}}`,toast:{cancelled:`Ejecución cancelada`,cancelFailed:`Cancelación fallida`,retryStarted:`Reintento iniciado`,retryFailed:`Reintento fallido`,cleared:`{{n}} ejecuciones eliminadas`,clearFailed:`Error al borrar`},clearLog:`Borrar historial`,clearConfirmTitle:`¿Borrar historial?`,clearConfirmBody:`¿Eliminar todas las ejecuciones de pipeline completadas, fallidas, canceladas y con fallos parciales? Las ejecuciones en curso se conservan. Esto no se puede deshacer.`,clearConfirmAction:`Borrar`,jobStatus:{pending:`pendiente`,awaiting_printer:`esperando impresora`,queued:`en cola`,printing:`imprimiendo`,completed:`completada`,failed:`fallida`,cancelled:`cancelada`},cancelledByUser:`Cancelado por el usuario`},queue:{filamentShort:{rowBadge:`Filamento insuficiente para la bobina asignada`,rowTooltip:`El planificador marco este elemento. Pulsa Reproducir para ver el deficit por slot y decidir si imprimir de todos modos.`,confirmTitle:`Filamento insuficiente`,confirmIntro:`La bobina asignada no puede cubrir al menos un slot. Imprimir de todos modos?`,lineItem:`Slot {{slot}}: necesita {{required}} g, quedan {{remaining}} g`,unknown:`desconocido`,printAnyway:`Imprimir de todos modos`},filamentMissing:{confirmTitle:`Filamento no cargado`,confirmIntro:`La impresora no tiene ninguna bandeja con este filamento. Carguelo y pulse Iniciar de nuevo, o imprima de todos modos:`},slicerAmsMapping:{rowBadge:`Ranuras AMS guardadas para esta impresora`,rowTooltip:`Este archivo conserva las ranuras AMS exactas que eligió el slicer, guardadas para la impresora de este elemento. Una reimpresión en ella puede reutilizar esas bobinas en lugar de volver a emparejar por tipo y color.`},title:`Cola de impresión`,subtitle:`Programe y gestione sus trabajos de impresión`,editQueueItem:`Editar elemento de la cola`,selectAllPlates:`Seleccionar las {{count}} camas`,deselectAll:`Deseleccionar todo`,printQueued:`Impresión encolada`,printQueuedWillStartWhenIdle:`Comenzará cuando la impresora esté inactiva`,itemsQueued:`{{count}} elementos encolados`,sending:`Enviando...`,sendingProgress:`Enviando {{current}}/{{total}}...`,adding:`Añadiendo...`,addingProgress:`Añadiendo {{current}}/{{total}}...`,savingProgress:`Guardando {{current}}/{{total}}...`,clearQueue:`Vaciar la cola`,clearHistory:`Borrar el historial`,emptyQueue:`La cola está vacía`,position:`Posición`,scheduledTime:`Hora programada`,moveUp:`Subir`,moveDown:`Bajar`,startNow:`Iniciar ahora`,printingInProgress:`Impresión en curso...`,viewArchive:`Ver archivo`,viewInFileManager:`Ver en el gestor de archivos`,itemCount:`{{count}} elemento`,itemCount_plural:`{{count}} elementos`,dragToReorder:`Arrastre para reordenar (solo elementos «lo antes posible»)`,reorderHint:`La posición solo afecta a los elementos «lo antes posible». Los elementos programados se ejecutan a su hora establecida.`,sjf:{label:`SJF`,tooltip:`Trabajo más corto primero — el planificador prioriza las impresiones más cortas`},addedBy:`Añadido por {{name}}`,nextInQueue:`Siguiente en la cola`,clearPlateSuccess:`Cama despejada — lista para la próxima impresión`,plateNumber:`Cama {{index}}`,quantity:`Cantidad`,quantityHint:`Crea {{count}} elementos en la cola`,plateQuantityLabel:`Impresiones de {{plate}}`,plateQuantityTotal_one:`{{count}} impresión en total`,plateQuantityTotal_other:`{{count}} impresiones en total`,batchOrders:{title:`Pedidos por lotes`,emptyTitle:`Sin pedidos por lotes`,emptyDescription:`Pon en cola un archivo de varias bandejas, o más de una copia de una bandeja, y el pedido aparecerá aquí con su progreso.`,filter:{active:`Activos`,completed:`Completados`,cancelled:`Cancelados`,all:`Todos`},status:{active:`Activo`,completed:`Completado`,cancelled:`Cancelado`},noTargets:`Solo agrupación`,noTargetsHint:`Creado antes de que existieran las cantidades por bandeja, así que sigue las impresiones en cola en lugar de un objetivo.`,dispatchRemaining:`Encolar {{count}} restantes`,dispatchPlate:`Encolar restantes`,strandedPlate:`No queda de dónde copiar los ajustes`,strandedNotice:`No se pueden encolar {{runs}} de las {{owed}} impresiones aún pendientes: esa cama ya no tiene ninguna impresión encolada o terminada de la que copiar los ajustes. Encola la cama una vez desde el archivo o cancela el pedido.`,dispatched:`Impresiones restantes encoladas para {{name}}`,plateProgress:`{{completed}} de {{target}} hechas`,remaining:`{{count}} pendientes`,failed:`{{count}} fallidas`,printing:`{{count}} imprimiendo`,wholeFile:`Archivo completo`,due:`Vence {{date}}`,costSoFar:`{{amount}} hasta ahora`,costRemaining:`({{amount}} por gastar)`},activeBatches:`Lotes activos`,batchProgress:`{{completed}} de {{total}} completados`,cancelBatch:`Cancelar los restantes`,batchCancelled:`Elementos restantes del lote cancelados`,cancelBatchConfirmTitle:`Cancelar lote`,cancelBatchConfirmMessage:`¿Cerrar este pedido? Las impresiones que sigan en la cola se cancelan y deja de reclamar lo que no ha producido.`,batch:{defaultName:`Lote`,label:`{{count}} elemento`,label_plural:`{{count}} elementos`,pendingCount:`{{count}} pendiente`,pendingCount_plural:`{{count}} pendientes`,expand:`Expandir lote`,collapse:`Contraer lote`,groupAsBatch:`Agrupar como lote…`,groupAsBatchDescription:`Combinar los {{count}} elementos seleccionados en un único lote contraíble.`,nameLabel:`Nombre del lote`,namePlaceholder:`p. ej., Regalos del viernes`,create:`Crear lote`,ungroup:`Desagrupar`,ungroupConfirmTitle:`¿Desagrupar lote?`,ungroupConfirmMessage:`Los elementos permanecerán en la cola pero ya no estarán agrupados.`,dragGroup:`Arrastrar grupo`},tabs:{batches:`Lotes`,queue:`Cola`,history:`Historial`,timeline:`Cronología`,pipelines:`Procesos`},layout:{flatList:`Lista`,byPrinter:`Por impresora`,groupByPrinter:`Agrupar por impresora`},history:{emptyTitle:`Sin historial todavía`,emptyDescription:`Las impresiones completadas, canceladas y fallidas aparecerán aquí.`,showMore:`Mostrar más`,showingCount:`Mostrando {{shown}} de {{total}}`},dragGhost:{multiCount:`{{count}} elementos`,batch:`{{name}} ({{count}} copia)`,batch_plural:`{{name}} ({{count}} copias)`},sections:{currentlyPrinting:`Imprimiendo actualmente`,queued:`En cola`,history:`Historial`},status:{pending:`Pendiente`,waiting:`En espera`,printing:`Imprimiendo`,paused:`En pausa`,completed:`Completada`,failed:`Fallida`,skipped:`Omitida`,cancelled:`Cancelada`},summary:{printing:`Imprimiendo`,queued:`En cola`,totalTime:`Tiempo total de la cola`,totalWeight:`Peso total de la cola`,history:`Historial`},filter:{allPrinters:`Todas las impresoras`,unassigned:`Sin asignar`,allStatus:`Todos los estados`,allLocations:`Todas las ubicaciones`,any:`Cualquiera`},sort:{byPosition:`Ordenar por posición`,byName:`Ordenar por nombre`,byPrinter:`Ordenar por impresora`,bySchedule:`Ordenar por programación`,byDate:`Ordenar por fecha`,ascendingOldest:`Ascendente (más antiguos primero)`,descendingNewest:`Descendente (más recientes primero)`},badges:{awaitingReview:`Esperando revisión`,staged:`Preparado`,requiresPrevious:`Requiere éxito previo`,autoPowerOff:`Apagado automático`,gcodeInjection:`G-code`,confirmOutcome:`Consulta de resultado`,confirmOutcomeTitle:`Pregunta cómo salió la impresión al terminar`},empty:{title:`No hay impresiones programadas`,description:`Programe una impresión desde la página de Archivos con la opción «Programar» del menú contextual, o arrastre y suelte archivos para empezar.`},time:{etaIfStartedNow:`Hora de finalización si este trabajo comenzara ahora`,whenFree:`Cuando haya una impresora libre`,overdue:`Atrasada`,now:`Ahora`,lessThanMinute:`En menos de un minuto`,inMinutes:`En {{count}} min`,inHours:`En {{count}} horas`},actions:{startPrint:`Iniciar impresión`,stopPrint:`Detener impresión`,requeue:`Volver a encolar`},bulkEdit:{title:`Editar {{count}} elemento`,title_plural:`Editar {{count}} elementos`,description:`Solo se aplicarán los ajustes modificados a los elementos seleccionados.`,printer:`Impresora`,noChange:`— Sin cambios —`,queueOptions:`Opciones de la cola`,staged:`Preparado (inicio manual)`,autoPowerOff:`Apagado automático tras la impresión`,requirePrevious:`Requerir éxito previo`,gcodeInjection:`Inyectar G-code`,printOptions:`Opciones de impresión`,bedLevelling:`Nivelación de la cama`,flowCalibration:`Calibración del flujo`,vibrationCalibration:`Calibración de vibración`,layerInspection:`Inspección de la primera capa`,timelapse:`Time-lapse`,useAms:`Usar AMS`,confirmOutcome:`Preguntar el resultado`,nozzleOffsetCali:`Calibración del offset de boquillas`,applyChanges:`Aplicar cambios`,selectAll:`Seleccionar todo`,deselectAll:`Deseleccionar todo`,selected:`{{count}} seleccionados`,editSelected:`Editar seleccionados`,cancelSelected:`Cancelar seleccionados`},confirm:{cancelTitle:`Cancelar impresión programada`,cancelMessage:`¿Está seguro de que desea cancelar "{{name}}"?`,stopTitle:`Detener impresión`,stopMessage:`¿Está seguro de que desea detener la impresión actual "{{name}}"? Esto cancelará el trabajo de impresión en la impresora.`,removeTitle:`Quitar del historial`,removeMessage:`¿Está seguro de que desea quitar "{{name}}" del historial de la cola?`,clearHistoryTitle:`Borrar el historial`,clearHistoryMessage:`¿Está seguro de que desea quitar los {{count}} elemento(s) del historial?`,cancelButton:`Cancelar impresión`,stopButton:`Detener impresión`,thisPrint:`esta impresión`,thisItem:`este elemento`},toast:{cancelled:`Elemento de la cola cancelado`,cancelFailed:`Error al cancelar el elemento`,removed:`Elemento de la cola eliminado`,keptForOrder:`Cancelado en lugar de eliminado: es la única impresión desde la que el pedido puede volver a encolar esta cama`,historyKeptForOrders:`Se conservan {{kept}} que los pedidos todavía necesitan.`,removeFailed:`Error al eliminar el elemento`,stopped:`Impresión detenida`,stopFailed:`Error al detener la impresión`,released:`Impresión liberada a la cola`,startFailed:`Error al iniciar la impresión`,reorderFailed:`Error al reordenar la cola`,historyCleared:`Se borraron {{count}} elemento(s) del historial`,clearHistoryFailed:`Error al borrar el historial`,updateFailed:`Error al actualizar los elementos`,bulkCancelled:`Se cancelaron {{count}} elemento(s)`,bulkCancelFailed:`Error al cancelar los elementos`,batchCreated:`Lote "{{name}}" creado`,batchCreateFailed:`Error al crear el lote`,batchUngrouped:`{{count}} elemento(s) desagrupado(s)`,batchUngroupFailed:`Error al desagrupar el lote`,resumedAfterFailure:`Cola reanudada — {{restored}} trabajo(s) restaurado(s) a pendientes`,resumeAfterFailureFailed:`Error al reanudar la cola`},resumeAfterFailure:{banner:`{{printer}} está bloqueado por un fallo de impresión previo — {{count}} trabajo(s) omitido(s)`,bannerHint:`Soluciona el problema de la impresora y reanuda para restaurar los trabajos omitidos y limpiar el bloqueo.`,button:`Reanudar tras fallo`,confirmTitle:`¿Reanudar la cola tras el fallo?`,confirmMessage:`Restaurar {{count}} trabajo(s) omitido(s) en {{printer}} a pendientes y limpiar el bloqueo del trabajo anterior. Asegúrate de que la impresora esté lista antes de continuar.`},timeline:{listView:`Lista`,timelineView:`Cronología`,unassigned:`Sin asignar`,noData:`No hay impresiones programadas para este día`,nothingCommitted:`No hay programaciones comprometidas en esta ventana. Los elementos preparados, los elementos en espera y los trabajos ASAP en impresoras inactivas no se muestran — establece una hora programada o libera un elemento preparado para verlo aquí.`,allDoneBy:`Todas las impresiones estimadas para las {{time}}`,staged:`Preparado`,filterAll:`Mostrar todo`,filterPrinting:`Imprimiendo`,filterQueued:`En cola`,time:{anyMoment:`en cualquier momento`,minutesLeft:`{{minutes}} min restantes`,hoursLeft:`{{hours}} h restantes`,hoursMinutesLeft:`{{hours}} h {{minutes}} min restantes`},day:{previous:`Día anterior`,next:`Día siguiente`,today:`Hoy`},window:{back12h:`12 horas atrás`,forward12h:`12 horas adelante`,now:`Ahora`},printerColumnHeader:`Impresora`},permissions:{noStopPrint:`No tiene permiso para detener impresiones`,noStartPrint:`No tiene permiso para iniciar impresiones`,awaitingReview:`Esperando revisión: alguien que gestiona la cola inicia este trabajo`,noEdit:`No tiene permiso para editar este elemento de la cola`,noCancel:`No tiene permiso para cancelar este elemento de la cola`,noRequeue:`No tiene permiso para volver a encolar elementos`,noRemove:`No tiene permiso para eliminar este elemento de la cola`,noClearHistory:`No tiene permiso para borrar todo el historial`,noEditItems:`No tiene permiso para editar elementos de la cola`,noCancelItems:`No tiene permiso para cancelar elementos de la cola`}},stats:{title:`Estadísticas`,subtitle:`Arrastre los widgets para reorganizarlos. Haga clic en el icono del ojo para ocultarlos.`,overview:`Resumen`,totalPrints:`Impresiones totales`,successRate:`Tasa de éxito`,totalPrintTime:`Tiempo total de impresión`,printTime:`Tiempo de impresión`,totalFilament:`Filamento total usado`,filamentUsed:`Filamento usado`,filamentCost:`Coste del filamento`,totalCost:`Coste total`,energyUsed:`Energía usada`,energyCost:`Coste de la energía`,wearCost:`Coste de desgaste`,energyWarmingUpTooltip:`El seguimiento de energía aún está recopilando instantáneas horarias. Los totales por rango de fechas serán precisos una vez que exista al menos una instantánea antes del rango seleccionado. Los valores iniciales pueden quedarse cortos.`,averagePrintTime:`Tiempo medio de impresión`,printsPerDay:`Impresiones por día`,byPrinter:`Por impresora`,printsByPrinter:`Impresiones por impresora`,byMaterial:`Por material`,byMonth:`Por mes`,last7Days:`Últimos 7 días`,last30Days:`Últimos 30 días`,last90Days:`Últimos 90 días`,allTime:`Todo el tiempo`,quickStats:`Estadísticas rápidas`,printActivity:`Actividad de impresión`,filamentTypes:`Tipos de filamento`,filamentTrends:`Tendencias del filamento`,materialNumbers:{title:`Por número de material`,empty:`Aún no hay números de material asignados. Añádelos a las bobinas en el inventario para agrupar aquí el consumo y los costes.`,loadFailed:`No se han podido cargar las estadísticas por número de material.`,spools:`Bobinas`,remaining:`Restante`,consumed:`Consumido`,cost:`Coste`},suppliers:{title:`Por proveedor`,empty:`Aún no hay compras registradas. Marque en una bobina a qué proveedor se compró para agrupar aquí el consumo y los costes.`,error:`No se pudieron cargar las estadísticas de proveedores`,supplier:`Proveedor`,spools:`Bobinas`,remaining:`Restante`,consumed:`Consumido`,cost:`Coste`},failureAnalysis:`Análisis de fallos`,timeAccuracy:`Precisión temporal`,successful:`Con éxito:`,failed:`Fallidas:`,cancelled:`Canceladas:`,perfectEstimate:`100% = estimación perfecta`,noTimeAccuracyData:`Aún no hay datos de precisión temporal`,noFilamentData:`No hay datos de filamento disponibles`,noPrinterData:`No hay datos de impresora disponibles`,noPrintData:`No hay datos de impresión disponibles`,noPrintDataLast30Days:`No hay datos de impresión en los últimos 30 días`,failureReasons:`Motivos de fallo`,topFailureReasons:`Principales motivos de fallo`,failedPrintsCount:`{{failed}} / {{total}} impresiones fallidas`,rejectedPrintsCount:`{{rejected}} rechazadas tras completarse`,yieldRate:`Rendimiento: {{rate}}%`,lastWeekRate:`Semana pasada: {{rate}}%`,resetLayout:`Restablecer disposición`,recalculateCosts:`Recalcular costes`,recalculateCostsHint:`Recalcular todos los costes de archivo usando los precios actuales del filamento`,exportStats:`Exportar estadísticas`,exportAsCsv:`Exportar como CSV`,exportAsExcel:`Exportar como Excel`,hiddenCount:`{{count}} ocultos`,exportDownloaded:`Exportación descargada`,exportFailed:`Error en la exportación`,layoutReset:`Disposición restablecida`,recalculatedCosts:`Costes recalculados para {{count}} archivos`,recalculateFailed:`Error al recalcular los costes`,loadingStats:`Cargando estadísticas...`,noPermissionResetLayout:`No tiene permiso para restablecer la disposición`,noPermissionRecalculate:`No tiene permiso para recalcular los costes`,noPrintDataInRange:`No hay datos de impresión en el rango seleccionado`,periodFilament:`Filamento del periodo`,periodCost:`Coste del periodo`,avgPerPrint:`Promedio por impresión`,usageOverTime:`Uso a lo largo del tiempo`,energyOverTime:`Energía a lo largo del tiempo`,filamentByWeight:`Peso`,printDuration:`Duración de la impresión`,printerUtilization:`Uso de la impresora`,filamentSuccess:`Éxito por material`,printHabits:`Hábitos de impresión`,printTimeOfDay:`Hora del día de impresión`,colorDistribution:`Distribución de colores`,noColorData:`No hay datos de color disponibles`,records:`Récords`,longestPrint:`Impresión más larga`,heaviestPrint:`Impresión más pesada`,mostExpensivePrint:`Más cara`,busiestDay:`Día más activo`,successStreak:`Racha de éxitos`,streakPrint:`impresión consecutiva`,streakPrints:`{{count}} impresiones consecutivas`,printerStats:`Estadísticas de la impresora`,hours:`horas`,avgPrints:`Impresiones medias`,noArchiveData:`No hay datos de impresión disponibles`,filamentByTime:`Tiempo`,avgWeight:`Peso medio`,avgTime:`Tiempo medio`,filamentByPrints:`Impresiones`,timeframe:{today:`Hoy`,"this-week":`Esta semana`,"this-month":`Este mes`,"last-7":`Últimos 7 días`,"last-30":`Últimos 30 días`,"last-90":`Últimos 90 días`,"this-year":`Este año`,"all-time":`Todo el tiempo`,custom:`Rango personalizado`,from:`Desde`,to:`Hasta`},allUsers:`Todos los usuarios`,noUser:`Sin usuario (sistema)`,filterByUser:`Filtrar por usuario`},maintenance:{title:`Mantenimiento`,overview:`Resumen`,allOk:`Todo el mantenimiento al día`,dueCount:`{{count}} tarea pendiente`,dueCount_plural:`{{count}} tareas pendientes`,warningCount:`{{count}} advertencia`,warningCount_plural:`{{count}} advertencias`,totalPrintTime:`Tiempo total de impresión`,nextMaintenance:`Próximo mantenimiento`,nothingDue:`Nada pendiente`,tasks:`Tareas`,lastPerformed:`Realizado por última vez`,interval:`Intervalo`,hoursRemaining:`{{hours}} h restantes`,hoursOverdue:`{{hours}} h de retraso`,markDone:`Marcar como hecho`,performMaintenance:`Realizar mantenimiento`,history:`Historial`,noHistory:`No hay historial de mantenimiento`,editPrintHours:`Editar horas de impresión`,currentHours:`Horas actuales`,statusTab:`Estado`,settingsTab:`Ajustes`,overdueCount:`{{count}} atrasadas`,dueSoonCount:`{{count}} pronto pendientes`,dueSoon:`Pronto pendiente`,allGood:`Todo correcto`,overdueBy:`Atrasado {{duration}}`,dueIn:`Pendiente en {{duration}}`,timeLeft:`{{duration}} restante`,day:`1 día`,days:`{{count}} días`,week:`1 semana`,weeks:`{{count}} semanas`,month:`1 mes`,months:`{{count}} meses`,year:`1 año`,maintenanceTypes:`Tipos de mantenimiento`,maintenanceTypesDescription:`Tipos del sistema y sus tareas de mantenimiento personalizadas`,addCustomType:`Añadir tipo personalizado`,restoreDefaults:`Restaurar tareas predeterminadas`,intervalType:`Tipo de intervalo`,intervalValue:`Intervalo ({{type}})`,icon:`Icono`,documentationLink:`Enlace de documentación (opcional)`,assignToPrinters:`Asignar a impresoras`,selectAtLeastOnePrinter:`Seleccione al menos una impresora`,addType:`Añadir tipo`,custom:`Personalizado`,printHours:`Horas de impresión`,calendarDays:`Días naturales`,exampleName:`p. ej., Reemplazar filtro HEPA`,viewDocumentation:`Ver documentación`,timeBasedInterval:`Intervalo basado en el tiempo`,intervalOverrides:`Anulaciones de intervalo`,intervalOverridesDescription:`Personalizar intervalos para impresoras concretas`,assignedToPrinters:`Asignado a las impresoras:`,noPrintersAssigned:`No hay impresoras asignadas`,addPrinterShort:`Añadir:`,printersAssignedClick:`{{count}} impresora(s) asignada(s) - haga clic para gestionar`,removeFromPrinter:`Quitar de esta impresora`,types:{lubricateCarbonRods:`Lubricar varillas de carbono`,lubricateRails:`Lubricar guías lineales`,cleanNozzle:`Limpiar boquilla/fusor`,checkBelts:`Comprobar la tensión de las correas`,cleanBuildPlate:`Limpiar la cama de impresión`,checkExtruder:`Comprobar los engranajes del extrusor`,checkCooling:`Comprobar los ventiladores de refrigeración`,generalInspection:`Inspección general`,cleanCarbonRods:`Limpiar varillas de carbono`,lubricateSteelRods:`Lubricar varillas de acero`,cleanSteelRods:`Limpiar varillas de acero`,cleanLinearRails:`Limpiar guías lineales`,checkPtfeTube:`Comprobar el tubo de PTFE`,replaceHepaFilter:`Reemplazar filtro HEPA`,replaceCarbonFilter:`Reemplazar filtro de carbono`,lubricateLeftNozzleRail:`Lubricar la guía de la boquilla izquierda`},maintenanceComplete:`Mantenimiento marcado como completado`,typeUpdated:`Tipo de mantenimiento actualizado`,typeDeleted:`Tipo de mantenimiento eliminado`,defaultsRestored:`Se restauraron {{count}} tarea(s) predeterminada(s)`,printHoursUpdated:`Horas de impresión actualizadas`,printerAssigned:`Impresora asignada`,printerRemoved:`Impresora eliminada`,deleteTypeConfirm:`¿Eliminar "{{name}}"?`,deleteSystemTypeTitle:`¿Eliminar la tarea de mantenimiento predeterminada?`,deleteSystemTypeMessage:`¿Está seguro de que desea eliminar la tarea de mantenimiento predeterminada "{{name}}"?`,noPermissionUpdate:`No tiene permiso para actualizar elementos de mantenimiento`,noPermissionPerform:`No tiene permiso para realizar mantenimiento`,noPermissionEditTypes:`No tiene permiso para editar tipos de mantenimiento`,noPermissionDeleteTypes:`No tiene permiso para eliminar tipos de mantenimiento`,noPermissionEditHours:`No tiene permiso para editar las horas de impresión`,noPermissionRemovePrinter:`No tiene permiso para quitar asignaciones de impresoras`,noPermissionAssignPrinter:`No tiene permiso para asignar impresoras`,noPermissionEditIntervals:`No tiene permiso para editar intervalos`,configureSettings:`Configurar tipos e intervalos de mantenimiento`},settings:{sliceEngine:`Motor de laminado`,sliceEngineSidecar:`Sidecar del servidor`,sliceEngineSidecarHint:`El laminado se ejecuta en el servidor, en el contenedor sidecar del laminador.`,sliceEngineBrowser:`En el navegador`,sliceEngineBrowserHint:`El laminado se ejecuta en este dispositivo, sin servidor.`,title:`Ajustes`,general:`General`,tabs:{general:`General`,smartPlugs:`Enchufes inteligentes`,sensors:`Sensores`,notifications:`Notificaciones`,queue:`Flujo de trabajo`,queueDispatch:`Cola y Despacho`,queuePipelines:`Pipelines`,filament:`Filamento`,camera:`Cámara`,network:`Red`,apiKeys:`Claves API`,virtualPrinter:`Impresora virtual`,spoolbuddy:`SpoolBuddy`,failureDetection:`Detección de fallos`,users:`Autenticación`,backup:`Copia de seguridad`,emailAuth:`Autenticación por correo`,ldap:`LDAP`,twoFa:`Autenticación de dos factores`,oidc:`SSO / OIDC`,security:`Seguridad`},spoolbuddy:{infoTitle:`Dispositivos SpoolBuddy`,infoBody:`Los quioscos SpoolBuddy se registran automáticamente mediante una señal de latido. Anule el registro de un dispositivo aquí si ya no está en uso o si quedó un duplicado obsoleto tras el fallo de un demonio.`,duplicatesTitle:`{{count}} dispositivos registrados`,duplicatesBody:`La interfaz del quiosco solo usa el primer dispositivo registrado. Si uno de estos es un duplicado obsoleto de un fallo, anule su registro — un dispositivo en línea se volverá a registrar en su próxima señal de latido.`,empty:`Aún no hay dispositivos SpoolBuddy registrados.`,online:`En línea`,offline:`Desconectado`,unregister:`Anular registro`,unregisterSuccess:`Registro del dispositivo anulado`,unregisterError:`Error al anular el registro del dispositivo`,confirmTitle:`¿Anular el registro del dispositivo SpoolBuddy?`,confirmBody:`Esto eliminará "{{hostname}}" ({{deviceId}}) de la base de datos. Si el dispositivo está en línea, se volverá a registrar en su próxima señal de latido.`,ipAddress:`Dirección IP`,firmware:`Firmware`,lastSeen:`Visto por última vez`,daemonUptime:`Tiempo de actividad del demonio`,systemUptime:`Tiempo de actividad del sistema`,never:`nunca`,nfc:`NFC`,scale:`Báscula`,cpuTemp:`Temp. de CPU`,cpuLoad:`Carga de CPU`,memory:`Memoria`,disk:`Disco`,update:`Actualizar`,updateConfirmTitle:`¿Actualizar el demonio de Spoolbuddy?`,updateConfirmBody:`¿Iniciar una actualización de software en "{{hostname}}"? El demonio se reiniciará una vez aplicada la actualización.`,restartBrowser:`Reiniciar navegador`,restartBrowserConfirmTitle:`¿Reiniciar el navegador del quiosco?`,restartBrowserConfirmBody:`¿Reiniciar el navegador del quiosco en "{{hostname}}"? La pantalla se quedará en negro brevemente.`,restartDaemon:`Reiniciar demonio`,restartDaemonConfirmTitle:`¿Reiniciar el demonio de Spoolbuddy?`,restartDaemonConfirmBody:`¿Reiniciar el demonio de Spoolbuddy en "{{hostname}}"? El dispositivo se desconectará durante unos segundos.`,reboot:`Reiniciar`,rebootConfirmTitle:`¿Reiniciar el dispositivo?`,rebootConfirmBody:`¿Reiniciar "{{hostname}}"? El dispositivo estará desconectado durante alrededor de un minuto.`,shutdown:`Apagar`,shutdownConfirmTitle:`¿Apagar el dispositivo?`,shutdownConfirmBody:`¿Apagar "{{hostname}}"? Necesitará acceso físico para volver a encenderlo.`,commandConfirm:`Confirmar`,commandQueued:`Comando encolado`,commandError:`Error al enviar el comando`},ldap:{title:`Autenticación LDAP`,enabledDesc:`La autenticación LDAP está activada`,disabledDesc:`La autenticación LDAP está desactivada`,disabledHint:`Configure y guarde los ajustes de LDAP a continuación y luego actívela.`,enabled:`Autenticación LDAP activada`,disabled:`Autenticación LDAP desactivada`,feature1:`Los usuarios pueden iniciar sesión con credenciales LDAP`,feature2:`La cuenta de administrador local permanece como alternativa`,feature3:`Los grupos LDAP se asignan a los grupos de Bambuddy al iniciar sesión`,serverConfig:`Configuración del servidor LDAP`,serverUrl:`URL del servidor`,serverUrlHint:`Use ldaps:// para SSL o ldap:// con StartTLS`,security:`Seguridad`,securityHint:`StartTLS actualiza una conexión sin cifrar a TLS. LDAPS usa TLS desde el principio.`,bindDn:`Bind DN (cuenta de servicio)`,bindPassword:`Contraseña de Bind`,searchBase:`DN base de búsqueda`,userFilter:`Filtro de búsqueda de usuarios`,userFilterHint:`{username} se sustituye por el nombre de usuario de inicio de sesión. Use (uid={username}) para OpenLDAP.`,advanced:`Avanzado`,autoProvision:`Aprovisionar usuarios automáticamente`,autoProvisionHint:`Crear automáticamente una cuenta de Bambuddy en el primer inicio de sesión LDAP`,defaultGroup:`Grupo predeterminado`,defaultGroupNone:`— Ninguno (sin alternativa) —`,defaultGroupHint:`Grupo alternativo asignado cuando un usuario LDAP se autentica pero no figura en ningún grupo LDAP asignado. Déjelo vacío para dejar a los usuarios sin asignar sin permisos.`,groupMapping:`Asignación de grupos (JSON)`,groupMappingHint:`Asignar los DN de grupos LDAP a los grupos de Bambuddy. Grupos disponibles: `,testConnection:`Probar conexión`,settingsSaved:`Ajustes de LDAP guardados`,errors:{serverRequired:`La URL del servidor LDAP es obligatoria`,searchBaseRequired:`El DN base de búsqueda es obligatorio`,enableAuthFirst:`Active primero la autenticación`,configureLdapFirst:`Guarde primero los ajustes de LDAP`}},email:{smtpSettings:`Configuración SMTP`,smtpHost:`Servidor SMTP`,smtpPort:`Puerto SMTP`,security:`Seguridad`,authentication:`Autenticación`,username:`Nombre de usuario`,password:`Contraseña`,fromEmail:`Correo del remitente`,fromName:`Nombre del remitente`,testConnection:`Probar conexión SMTP`,testRecipient:`Correo del destinatario de prueba`,sendTest:`Enviar correo de prueba`,sending:`Enviando...`,save:`Guardar ajustes`,saving:`Guardando...`,advancedAuth:`Autenticación avanzada`,advancedAuthEnabled:`La autenticación avanzada está activada`,advancedAuthEnabledDesc:`Las funciones de gestión de usuarios basadas en correo están activas. Los nuevos usuarios recibirán contraseñas autogeneradas por correo, y los usuarios podrán restablecer sus contraseñas mediante la función de contraseña olvidada.`,advancedAuthDisabled:`La autenticación avanzada está desactivada`,advancedAuthDisabledDesc:`Active la autenticación avanzada para habilitar las funciones basadas en correo para la gestión de usuarios.`,enable:`Activar`,disable:`Desactivar`,feature1:`Las contraseñas se autogeneran y se envían por correo a los nuevos usuarios`,feature2:`Los usuarios pueden iniciar sesión con el nombre de usuario o el correo`,feature3:`La función de contraseña olvidada está disponible`,feature4:`Los administradores pueden restablecer las contraseñas de los usuarios por correo`,errors:{requiredFields:`Rellene todos los campos obligatorios`,usernameRequired:`El nombre de usuario es obligatorio cuando la autenticación está activada`,enterTestEmail:`Introduzca una dirección de correo de prueba`,smtpServerAndEmail:`Rellene el servidor SMTP y el correo del remitente antes de probar`,usernamePasswordRequired:`El nombre de usuario y la contraseña son obligatorios cuando la autenticación está activada`,configureSmtpFirst:`Configure y pruebe primero los ajustes de SMTP`,enableAuthFirst:`Active primero la autenticación para usar las funciones basadas en correo.`},success:{settingsSaved:`Ajustes de SMTP guardados correctamente`},securityOptions:{starttls:`STARTTLS (puerto 587)`,ssl:`SSL/TLS (puerto 465)`,none:`Ninguna (puerto 25)`},authOptions:{enabled:`Activada`,disabled:`Desactivada`}},appearance:`Apariencia`,notifications:`Notificaciones`,smartPlugs:`Enchufes inteligentes`,spoolman:`Spoolman`,updates:`Actualizaciones`,language:`Idioma`,languageDescription:`Seleccione su idioma preferido`,theme:`Tema`,themeLight:`Claro`,themeDark:`Oscuro`,themeSystem:`Sistema`,defaultView:`Vista predeterminada`,defaultViewDescription:`Página que se muestra al abrir la aplicación`,checkForUpdates:`Buscar actualizaciones`,autoUpdate:`Actualización automática`,currentVersion:`Versión actual`,latestVersion:`Versión más reciente`,upToDate:`Está actualizado`,updateAvailable:`Actualización disponible`,notificationLanguage:`Idioma de las notificaciones`,notificationLanguageDescription:`Idioma de las notificaciones push`,bedCooledThreshold:`Umbral de cama enfriada`,bedCooledThresholdDescription:`Temperatura por debajo de la cual se considera que la cama se ha enfriado tras una impresión`,userNotificationsEnabled:`Notificaciones de usuario`,userNotificationsEnabledDescription:`Activa el menú de notificaciones de usuario y las notificaciones por correo de los eventos de los trabajos de impresión. Requiere autenticación avanzada.`,userNotificationsDisabledHint:`Active la autenticación avanzada para usar las notificaciones de usuario.`,notificationProviders:`Proveedores de notificaciones`,addProvider:`Añadir proveedor`,editProvider:`Editar proveedor`,providerType:`Tipo de proveedor`,testNotification:`Notificación de prueba`,testSuccess:`Notificación de prueba enviada correctamente`,testFailed:`Error al enviar la notificación de prueba`,quietHours:`Horas de silencio`,quietHoursDescription:`No molestar durante estas horas`,quietHoursStart:`Inicio`,quietHoursEnd:`Fin`,events:{title:`Eventos de notificación`,printStart:`Impresión iniciada`,printComplete:`Impresión completada`,printFailed:`Impresión fallida`,printStopped:`Impresión detenida`,printProgress:`Hitos de progreso`,printProgressDescription:`Notificar al 25%, 50% y 75%`,printerOffline:`Impresora desconectada`,printerError:`Error de la impresora`,filamentLow:`Filamento bajo`,maintenanceDue:`Mantenimiento pendiente`,maintenanceDueDescription:`Notificar cuando se necesite mantenimiento`},smartPlug:{title:`Enchufes inteligentes`,add:`Añadir enchufe inteligente`,edit:`Editar enchufe inteligente`,name:`Nombre`,ipAddress:`Dirección IP`,linkedPrinter:`Impresora vinculada`,autoOn:`Encendido automático`,autoOnDescription:`Encender cuando comienza la impresión`,autoOff:`Apagado automático`,autoOffDescription:`Apagar tras completar la impresión`,offDelay:`Retardo de apagado`,offDelayMinutes:`Minutos tras la impresión`,offDelayTemp:`Cuando la boquilla está por debajo de la temperatura`,currentState:`Estado actual`,turnOn:`Encender`,turnOff:`Apagar`},filamentTracking:`Seguimiento del filamento`,filamentTrackingDesc:`Elija cómo realizar el seguimiento de sus bobinas de filamento. Puede usar el inventario integrado o conectar un servidor Spoolman externo.`,autoAddUnknownRfid:`Añadir automáticamente bobinas RFID desconocidas`,autoAddUnknownRfidDesc:`Crea automáticamente una entrada de inventario cuando se detecta una bobina con una etiqueta RFID desconocida. Desactive si registra manualmente las nuevas bobinas con antelación para evitar duplicados.`,filamentChecks:`Comprobaciones de filamento`,disableFilamentWarnings:`Desactivar las advertencias de filamento`,disableFilamentWarningsDesc:`No mostrar advertencias sobre filamento insuficiente al imprimir o encolar`,preferLowestFilament:`Preferir el filamento con menos restante`,preferLowestFilamentDesc:`Cuando varias bobinas coincidan, usar la que tenga menos filamento restante`,preferLowestFilamentBackupNote:`Solo surte efecto cuando AMS Filament Backup está activado en la impresora — de lo contrario, la impresora no puede cambiar a una segunda bobina cuando la elegida se acabe.`,trackingModeBuiltIn:`Inventario integrado`,trackingModeBuiltInDesc:`Incluye coincidencia automática por RFID y seguimiento del uso`,trackingModeSpoolmanDesc:`Servidor externo de gestión de filamento`,builtInFeatureRfid:`Detecta automáticamente las bobinas RFID de Bambu Lab en el AMS`,builtInFeatureUsage:`Realiza el seguimiento del consumo de filamento por impresión`,builtInFeatureCatalog:`Gestione bobinas, colores y perfiles de factor K`,builtInFeatureThirdParty:`Las bobinas de terceros se pueden asignar a bobinas del inventario`,amsSyncButton:`Sincronizar pesos desde el AMS`,amsSyncTitle:`Sincronizar los pesos de las bobinas desde el AMS`,amsSyncMessage:`Esto sobrescribirá todos los pesos de las bobinas del inventario con los valores actuales de % restante del AMS de las impresoras conectadas. Use esto para recuperarse de datos de peso dañados. Las impresoras deben estar en línea.`,amsSyncing:`Sincronizando...`,amsSyncSuccess:`{{synced}} bobina(s) sincronizada(s), {{skipped}} omitida(s)`,amsSyncError:`Error al sincronizar los pesos desde el AMS`,spoolmanAmsSyncButton:`Sincronizar pesos de Spoolman desde el AMS`,spoolmanAmsSyncTitle:`Sincronizar los pesos de las bobinas de Spoolman desde el AMS`,spoolmanAmsSyncMessage:`Esto actualizará todos los pesos de las bobinas de Spoolman según los valores actuales de % restante del AMS de las impresoras conectadas. Las impresoras deben estar en línea.`,spoolmanAmsSyncing:`Sincronizando...`,spoolmanAmsSyncSuccess:`{{synced}} bobina(s) sincronizada(s), {{skipped}} omitida(s)`,spoolmanAmsSyncError:`Error al sincronizar los pesos de Spoolman desde el AMS`,spoolmanAmsSyncErrorUnreachable:`Error al sincronizar los pesos de Spoolman (Spoolman inaccesible)`,spoolmanAmsSyncErrorNotConfigured:`Error al sincronizar los pesos de Spoolman (Spoolman no configurado)`,nativeTagsTitle:`Etiquetas nativas de Spoolman`,nativeTagsDesc:`Spoolman 0.27 vincula las etiquetas NFC por sí mismo. Copia allí las etiquetas que Bambuddy guarda en extra.tag para que Spoolman y otros lectores también encuentren las bobinas. extra.tag no se modifica.`,nativeTagsCheck:`Comprobar etiquetas`,nativeTagsToMove:`Por copiar`,nativeTagsAlready:`Ya en Spoolman`,nativeTagsSlotIds:`ID de ranura AMS (se quedan en extra.tag)`,nativeTagsConflicts:`Conflictos`,nativeTagsConflictSpool:`Bobina #{{spool}}: la etiqueta {{tag}} ya pertenece a la bobina #{{holder}}`,nativeTagsConflictElsewhere:`Bobina #{{spool}}: la etiqueta {{tag}} ya pertenece a un filamento o una ubicación`,nativeTagsMove:`Copiar etiquetas`,nativeTagsMoved:`Etiquetas copiadas a Spoolman: {{count}}`,nativeTagsNothing:`Todas las etiquetas están en Spoolman.`,nativeTagsError:`No se pudieron copiar las etiquetas a Spoolman`,spoolmanNotConfigured:`Spoolman no configurado`,spoolmanFilamentCatalogTitle:`Catálogo de filamentos de Spoolman`,spoolmanFilamentCatalogDesc:`Nombres de filamentos y pesos de tara de su instancia de Spoolman. El nombre y el peso de la bobina se pueden editar aquí; el resto de las propiedades se gestionan directamente en Spoolman.`,spoolmanUrl:`URL de Spoolman`,spoolmanUrlHint:`URL de su servidor Spoolman (p. ej., http://localhost:7912)`,spoolmanConnected:`Conectado`,spoolmanDisconnected:`Desconectado`,status:`Estado`,connect:`Conectar`,disconnect:`Desconectar`,howSyncWorks:`Cómo funciona la sincronización`,syncInfoRfidOnly:`Solo se sincronizan las bobinas oficiales de Bambu Lab con RFID`,syncInfoAutoCreate:`Las bobinas nuevas se crean automáticamente en Spoolman en la primera sincronización`,syncInfoThirdPartySkipped:`Las bobinas que no son de Bambu Lab (de terceros, rellenadas) se omiten`,linkingExistingSpools:`Vincular bobinas existentes`,linkingExistingSpoolsDesc:`Para vincular bobinas existentes de Spoolman a su AMS, pase el cursor sobre una ranura del AMS y haga clic en "Vincular a Spoolman".`,syncMode:`Modo de sincronización`,syncModeAuto:`Automática`,syncModeManual:`Solo manual`,syncModeAutoDesc:`Los datos del AMS se sincronizan automáticamente cuando se detectan cambios`,syncModeManualDesc:`Sincronizar solo cuando se active manualmente`,syncAmsData:`Sincronizar datos del AMS`,syncAmsDataDesc:`Sincronizar manualmente los datos del AMS de la impresora con Spoolman`,allPrinters:`Todas las impresoras`,noDefaultPrinter:`Sin predeterminada (preguntar cada vez)`,sidebarOrder:`Orden de la barra lateral`,saveThumbnails:`Guardar miniaturas`,captureFinishPhoto:`Capturar foto de finalización`,noPrintersConfigured:`No hay impresoras configuradas`,archiveMode:{always:`Crear siempre una entrada de archivo`,never:`No crear nunca una entrada de archivo`,ask:`Preguntar cada vez`},checkForUpdatesLabel:`Buscar actualizaciones`,checkPrinterFirmware:`Comprobar el firmware de la impresora`,includeBetaUpdates:`Incluir versiones beta`,includeBetaUpdatesDesc:`Notificar sobre versiones beta y preliminares al buscar actualizaciones`,announcementsEnabled:`Recibir anuncios`,announcementsEnabledDesc:`Mensajes de los desarrolladores de Bambuddy, como correcciones de seguridad y cambios incompatibles. Bambuddy descarga un archivo firmado de GitHub cada pocas horas; no se envía nada sobre esta instalación.`,announcementsLearnMore:`Más información`,announcementsAllUsers:`Mostrar a todos los usuarios`,announcementsAllUsersDesc:`Desactivado: solo los administradores los ven. No tiene efecto mientras la autenticación esté desactivada.`,localLogin:{disable:`Deshabilitar el inicio de sesión local con usuario/contraseña`,disableHint:`Cuando se habilita, solo los proveedores SSO pueden iniciar sesión. LDAP no se ve afectado. Defina BAMBUDDY_LOCAL_LOGIN=true en el servidor para mantener una vía de recuperación.`},enableRetry:`Activar reintentos`,homeAssistantDescription:`Controlar enchufes inteligentes mediante Home Assistant`,environmentManagedLabel:`(Gestionado por el entorno)`,autoEnabledViaEnv:`Activado automáticamente mediante variables de entorno`,urlFromEnvReadOnly:`Valor establecido por la variable de entorno HA_URL (solo lectura)`,tokenFromEnvReadOnly:`Valor establecido por la variable de entorno HA_TOKEN (solo lectura)`,mqttConnectedTo:`Conectado a`,prometheusDescription:`Exponer los datos de la impresora en formato Prometheus`,noSmartPlugsTitle:`No hay enchufes inteligentes configurados`,noSmartPlugsDescription:`Añada un enchufe inteligente basado en Tasmota para realizar el seguimiento del consumo de energía y automatizar el control de la alimentación.`,noProvidersTitle:`No hay proveedores configurados`,noProvidersDescription:`Añada un proveedor para recibir alertas.`,noTemplatesAvailable:`No hay plantillas disponibles. Reinicie el backend para cargar las plantillas predeterminadas.`,apiPermissionView:`Ver el estado de la impresora y la cola`,apiPermissionEdit:`Añadir y quitar elementos de la cola de impresión`,apiKeysEmptyTitle:`No hay claves API`,apiKeysEmptyDescription:`Cree una clave API para integrarse con servicios externos.`,noUsersFound:`No se encontraron usuarios`,noGroupsFound:`No se encontraron grupos`,noGroupsAvailable:`No hay grupos disponibles`,passwordsDoNotMatch:`Las contraseñas no coinciden`,systemGroupWarning:`Los nombres de los grupos del sistema no se pueden cambiar`,authDisabledTitle:`La autenticación está desactivada`,authDisabledFeature1:`Exigir inicio de sesión para acceder al sistema`,authDisabledFeature2:`Crear varios usuarios con permisos basados en grupos`,authDisabledFeature3:`Controlar el acceso con más de 50 permisos granulares`,userHasCreated:`Este usuario ha creado:`,userItemsQuestion:`¿Qué desea hacer con estos elementos?`,deleteUserConfirm:`¿Está seguro de que desea eliminar este usuario?`,actionCannotBeUndone:`Esta acción no se puede deshacer.`,addFirstSmartPlug:`Añada su primer enchufe inteligente`,providers:`Proveedores`,log:`Registro`,testAll:`Probar todo`,testResults:`Resultados de la prueba`,testPassedCount:`{{count}} superadas`,testFailedCount:`{{count}} fallidas`,messageTemplates:`Plantillas de mensajes`,messageTemplatesDescription:`Personalice los mensajes de notificación para cada evento.`,apiKeys:`Claves API`,apiKeysDescription:`Cree claves API para integraciones externas y webhooks.`,createKey:`Crear clave`,apiKeyCreated:`Clave API creada correctamente`,apiKeyCopyWarning:`¡Copie esta clave ahora; no se volverá a mostrar!`,useInApiBrowser:`Usar en el explorador de API`,apiKeyQrButton:`Código QR`,apiKeyQrTitle:`Escanea para configurar`,apiKeyQrCaption:`Escanea con tu app móvil para añadir este servidor y la clave API.`,apiKeyQrWarning:`Contiene tu clave API secreta: no la compartas ni hagas capturas donde otros puedan verla.`,createNewApiKey:`Crear nueva clave API`,keyName:`Nombre de la clave`,keyNamePlaceholder:`p. ej., Home Assistant, OctoPrint`,readStatus:`Leer estado`,readStatusDescription:`Ver el estado de la impresora, la cola, la biblioteca, los archivos de impresión y las pipelines del cortador`,manageQueue:`Gestionar la cola`,manageQueueDescription:`Añadir y quitar elementos de la cola de impresión. Junto con "Gestionar biblioteca", ejecutar pipelines del cortador`,controlPrinter:`Controlar la impresora`,controlPrinterDescription:`Pausar, reanudar y detener impresiones`,manageLibrary:`Gestionar biblioteca`,manageLibraryDescription:`Subir, renombrar, eliminar y cortar archivos de la biblioteca; importar modelos desde MakerWorld. Junto con "Gestionar la cola", ejecutar pipelines del cortador`,manageInventory:`Gestionar inventario`,manageInventoryDescription:`Crear, actualizar y eliminar bobinas y registros de inventario. Necesario para los quioscos SpoolBuddy (escaneo NFC, lecturas de balanza, comandos del sistema del quiosco).`,manageMaintenance:`Gestionar mantenimiento`,manageMaintenanceDescription:`Registrar mantenimientos completados, restablecer contadores, editar intervalos y gestionar el catálogo de tipos de mantenimiento. Ideal para automatizaciones de Home Assistant que registran "limpié la boquilla" sin conceder un control más amplio de la impresora.`,manageArchives:`Gestionar archivos de impresión`,manageArchivesDescription:`Editar y eliminar archivos de impresión, incluida la eliminación de impresiones antiguas y de su contribución a las estadísticas. Ideal para automatizaciones que depuran el historial de impresión.`,manageProjects:`Gestionar proyectos`,manageProjectsDescription:`Crear, actualizar y eliminar proyectos, y añadirles archivos de impresión. Ideal para automatizaciones que organizan las impresiones en proyectos.`,maintenanceBadge:`Mantenimiento`,archivesBadge:`Archivos`,projectsBadge:`Proyectos`,libraryBadge:`Biblioteca`,inventoryBadge:`Inventario`,cloudAccess:`Permitir el acceso a la nube`,cloudAccessDescription:`Leer los preajustes y filamentos de Bambu Cloud en su nombre. Requiere que haya iniciado sesión en Bambu Cloud.`,cloudBadge:`Nube`,updateEnergyCost:`Actualizar el precio de la electricidad`,updateEnergyCostDescription:`Permite que esta clave envíe por POST un nuevo precio de electricidad por kWh a /settings/electricity-price. Útil para las automatizaciones de tarifa dinámica de Home Assistant (Tibber, Octopus, etc.). Este es el único campo de ajustes que se puede escribir mediante una clave API.`,energyCostBadge:`Energía`,sendNotifications:`Enviar notificaciones`,sendNotificationsDescription:`Permite a esta clave enviar mensajes a través de los canales de notificación que aceptan mensajes de aplicaciones conectadas (POST /notifications/app-message). Para aplicaciones como Bambuddy Orders. Nada más: la clave no puede leer ni cambiar los canales.`,sendNotificationsBadge:`Notif.`,legacyKey:`Heredada`,legacyKeyTooltip:`Creada antes de la propiedad por usuario; vuelva a crearla para usar el acceso a la nube`,unnamedKey:`Clave sin nombre`,lastUsed:`Usada por última vez`,read:`Lectura`,control:`Control`,createFirstKey:`Cree su primera clave`,webhookEndpoints:`Puntos de conexión de webhook`,webhookApiKeyHint:`Use su clave API en la cabecera X-API-Key.`,webhook:{getAllStatus:`Obtener el estado de todas las impresoras`,getSpecificStatus:`Obtener el estado de una impresora concreta`,addToQueue:`Añadir a la cola de impresión`,pausePrint:`Pausar impresión`,resumePrint:`Reanudar impresión`,stopPrint:`Detener impresión`},apiBrowser:`Explorador de API`,apiBrowserDescription:`Explore y pruebe todos los puntos de conexión de API disponibles.`,apiKeyForTesting:`Clave API para pruebas`,apiKeyPlaceholder:`Pegue aquí su clave API para probar los puntos de conexión autenticados...`,apiKeyHint:`Esta clave se enviará como cabecera X-API-Key en las solicitudes.`,deleteApiKeyTitle:`Eliminar clave API`,deleteApiKeyMessage:`¿Está seguro de que desea eliminar esta clave API? Cualquier integración que use esta clave dejará de funcionar.`,deleteKey:`Eliminar clave`,amsDisplayThresholds:`Umbrales de visualización del AMS`,amsThresholdsDescription:`Configure los umbrales de color para los indicadores de humedad y temperatura del AMS.`,humidity:`Humedad`,goodGreen:`Buena (verde)`,fairOrange:`Aceptable (naranja)`,aboveFairBad:`Por encima del umbral aceptable se muestra en rojo (mala)`,fairAlsoDryingThreshold:`Este umbral también se usa para activar el secado automático cuando está habilitado`,fairBelowDryingFloor:`El secado automático no puede alcanzar este valor: un AMS indica {{floor}} % o más mientras calienta, por lo que cada ciclo terminaría y se reiniciaría al instante. Súbelo por encima del {{floor}} % si usas el secado automático.`,temperature:`Temperatura`,goodBlue:`Buena (azul)`,aboveFairHot:`Por encima del umbral aceptable se muestra en rojo (caliente)`,tempAlarmThreshold:`Alarma por encima de`,tempAlarmSeparateFromBand:`Solo el umbral de alarma envía notificaciones: Bueno y Aceptable únicamente colorean la pantalla. Déjalo vacío para alarmar en el umbral aceptable, como antes.`,tempAlarmMustBePositive:`Un umbral de 0 o inferior se ignora: la alarma usa el umbral aceptable.`,historyRetention:`Retención del historial`,keepSensorHistory:`Conservar el historial del sensor durante`,historyRetentionDescription:`Los datos de humedad y temperatura más antiguos se eliminarán automáticamente`,defaultPrintOptions:`Opciones de impresión predeterminadas`,defaultPrintOptionsDescription:`Establezca valores predeterminados para las opciones de impresión al iniciar nuevas impresiones. Se pueden anular por impresión en el diálogo de impresión.`,defaultBedLevelling:`Nivelación de la cama`,defaultBedLevellingDesc:`Nivelar automáticamente la cama antes de imprimir`,defaultFlowCali:`Calibración del flujo`,defaultFlowCaliDesc:`Calibrar el flujo de extrusión`,defaultVibrationCali:`Calibración de vibración`,defaultVibrationCaliDesc:`Reducir los artefactos de resonancia`,defaultLayerInspect:`Inspección de la primera capa`,defaultLayerInspectDesc:`Inspección de la primera capa por IA`,defaultTimelapse:`Time-lapse`,defaultTimelapseDesc:`Grabar vídeo time-lapse`,defaultConfirmOutcome:`Preguntar el resultado`,defaultConfirmOutcomeDesc:`Preguntar si la impresión ha salido bien después de completarse`,confirmOutcomeExternalPrints:`Preguntar también por impresiones iniciadas fuera de Bambuddy`,confirmOutcomeExternalPrintsDesc:`Las impresiones iniciadas en la impresora, en Bambu Studio o en la app Handy también se archivan en Bambuddy. Con esta opción reciben la misma pregunta de resultado que los trabajos de la cola.`,confirmDefaultGoodOnPlateClear:`Contar resultados sin responder como buenos al despejar la cama`,confirmDefaultGoodOnPlateClearDescription:`Cuando se despeja la cama (manualmente o por la siguiente impresión en cola) y la pregunta sobre el resultado de la impresión sigue sin responder, registrarla automáticamente como pieza buena. La impresión cuenta entonces como buena en cuanto se despeja la cama; una respuesta posterior por Telegram o por enlace solo muestra el resultado ya registrado.`,defaultNozzleOffsetCali:`Calibración del offset de boquillas`,defaultNozzleOffsetCaliDesc:`Calibrar los desplazamientos entre boquillas`,tempFanPresetsTitle:`Predefinidos de temperatura y ventilador`,tempFanPresetsDescription:`Personalice los valores de selección rápida en las ventanas emergentes de temperatura y velocidad del ventilador de la tarjeta de impresora. El botón Apagar siempre se muestra.`,tempFanPresetsNozzle:`Temperatura de la boquilla`,tempFanPresetsBed:`Temperatura de la cama`,tempFanPresetsChamber:`Temperatura de la cámara`,tempFanPresetsFan:`Velocidad del ventilador`,tempFanPresetsReset:`Restablecer valores predeterminados`,concurrentUploadsTitle:`Subidas simultáneas`,concurrentUploadsDescription:`Cuántas impresoras pueden recibir archivos de la cola al mismo tiempo. Las impresoras reciben los archivos lentamente (una impresión grande puede tardar varios minutos) y cada una espera su turno, así que en una granja grande subir este valor evita que la última impresora de un lote tenga que esperar a que terminen todas las transferencias anteriores. Bájalo si tu red o el host de Bambuddy tienen problemas con transferencias en paralelo.`,concurrentUploadsLabel:`Impresoras atendidas a la vez`,concurrentUploadsHelp:`1 envía a una impresora cada vez (el comportamiento anterior). El valor predeterminado es 4.`,staggeredStart:`Inicio escalonado`,staggeredStartDescription:`Tamaño de grupo e intervalo predeterminados al escalonar los inicios de lotes en varias impresoras. Se pueden anular por lote en la ventana de impresión.`,preheatTitle:`Precalentamiento y Heat Soak`,preheatDescription:`Calienta la cama (y la cámara, si es compatible) y mantiene la temperatura antes de iniciar cada impresión en cola. Útil para filamentos técnicos (PA, ABS) en impresoras sin calentador activo de cámara — la cama calienta la cámara por radiación mientras corre el temporizador de soak. La temperatura objetivo de la cama se lee del archivo de impresión; el comportamiento de la cámara depende del modelo de impresora.`,preheatEnabled:`Activar precalentamiento y soak`,preheatEnabledDesc:`Si está desactivado, las impresiones en cola se inician de inmediato. Cada elemento puede anular por impresión.`,preheatFilamentTargetsLabel:`Objetivo de cámara por filamento (°C)`,preheatFilamentTargetsHint:`Bambuddy elige el objetivo más alto entre los slots AMS cargados. Una impresión cuyos slots derivan todos 0 (PLA, PETG, TPU, PVA) omite el precalentamiento por completo y empieza de inmediato.`,preheatFilamentTargetsReset:`Restablecer valores predeterminados`,preheatFilamentTargetsDefaultRow:`Otros / sin asignar`,preheatMaxWait:`Espera máx. (segundos)`,preheatMaxWaitHelp:`Tope de la fase de calentamiento de cámara antes de pasar al soak.`,preheatSoak:`Soak (segundos)`,preheatSoakHelp:`Tiempo de retención tras alcanzar el objetivo o caducar la espera máx.`,preheatHardwareTitle:`Comportamiento por impresora:`,preheatHardwareDetail:`H2C/H2D/H2D Pro/H2S/X2D/X1E calientan activamente la cámara vía M141. X1C/P2S leen la temperatura pero solo calientan la cámara por radiación de la cama. P1S/P1P/A1/A1 Mini no tienen sensor de cámara — solo aplica el temporizador de soak.`,preheatPerItemDesc:`Calienta la cama y la cámara antes de iniciar esta impresión. Por defecto usa el interruptor global de Ajustes → Workflow.`,preheatOverride_inherit:`Heredar`,preheatOverride_on:`Activado`,preheatOverride_off:`Desactivado`,calibrationMode_off:`Desactivado`,calibrationMode_on:`Activado`,calibrationMode_auto:`Automático`,preheatTargetOverride:`Sobrescribir objetivo de cámara (°C, vacío = por filamento)`,preheatTargetOverrideHelp:`0 calienta la cama y ejecuta el reposo sin cámara. Si se deja en blanco, una impresión sin necesidad de cámara omite el precalentamiento por completo.`,plateClear:`Confirmación de cama despejada`,requirePlateClear:`Requerir confirmación de cama despejada`,requirePlateClearDescription:`Cuando está activado, el planificador espera la confirmación de cama despejada por impresora antes de iniciar impresiones en cola en impresoras con trabajos finalizados. Desactivar esto también oculta la insignia de estado de la cama y el botón "Marcar cama como despejada" en las tarjetas de impresora.`,keepBedWarm:`Mantener la cama caliente entre impresiones`,keepBedWarmDesc:`Mientras se espera la confirmación de limpieza de placa, mantiene la cama a la temperatura de mantenimiento indicada abajo para que la cámara siga caliente — o a la temperatura de cama de la siguiente impresión si es mayor. Solo aplica cuando la siguiente impresión requiere calefacción de cámara (ASA, ABS, PA, PC, etc.). Requiere la confirmación de limpieza de placa activada.`,keepWarmBedTemp:`Temperatura de la cama en mantenimiento (°C)`,keepWarmBedTempHelp:`Se usa siempre que la cama sirve para calentar la cámara: durante el mantenimiento en caliente y en el precalentado cuando el archivo no incluye temperatura de cama. Una temperatura mayor del archivo siempre tiene prioridad.`,keepWarmMaxMinutes:`Dejar de mantener caliente tras (minutos)`,keepWarmMaxMinutesHelp:`Si la placa no se limpia dentro de este tiempo, los calentadores se apagan en lugar de mantenerse encendidos indefinidamente.`,gcodeInjection:`Inyección de G-code`,gcodeInjectionDescription:`Configure G-code personalizado para inyectar al inicio o al final de las impresiones para sistemas de impresión automática como Farmloop, SwapMod, AutoClear y Printflow 3D. Los fragmentos se configuran por modelo de impresora y se aplican cuando se activa "Inyectar G-code" en un elemento de la cola.`,gcodeInjectionNoPrinters:`No se encontraron impresoras. Añada impresoras para configurar fragmentos de G-code.`,gcodeStartLabel:`G-code de inicio`,gcodeEndLabel:`G-code de fin`,gcodeStartPlaceholder:`G-code añadido antes de que comience la impresión...`,gcodeEndPlaceholder:`G-code añadido después de que termine la impresión...`,staggerGroupSize:`Tamaño de grupo`,staggerGroupSizeHelp:`Impresoras que se inician simultáneamente por grupo`,staggerInterval:`Intervalo (minutos)`,staggerIntervalHelp:`Retardo entre el inicio de cada grupo`,queueDrying:`Secado automático de la cola`,queueDryingDescription:`Secar automáticamente el filamento del AMS cuando la impresora está inactiva entre impresiones en cola. Usa el umbral de humedad de arriba para activar el secado.`,queueDryingEnabled:`Activar el secado automático`,queueDryingEnabledDescription:`Iniciar el secado del AMS automáticamente cuando la impresora está inactiva y la humedad supera el umbral`,queueDryingBlock:`Esperar a que termine el secado`,queueDryingBlockDescription:`Bloquear la cola de impresión hasta que termine el secado. Cuando está desactivado, las impresiones tienen prioridad sobre el secado.`,ambientDryingEnabled:`Secado ambiental`,ambientDryingEnabledDescription:`Secar automáticamente el filamento en impresoras inactivas cuando la humedad supera el umbral, incluso sin impresiones en cola.`,ambientDryingSustainedEnabled:`Requerir humedad sostenida`,ambientDryingSustainedDescription:`Esperar hasta que la humedad se haya mantenido por encima del umbral durante un tiempo definido antes de iniciar un secado ambiental — absorbe el pico al abrir la tapa del AMS.`,ambientDryingSustainedMinutes:`Tiempo sostenido (minutos)`,printDryingEnabled:`Continuar secado durante la impresión`,printDryingEnabledDescription:`Permite que el secado automático siga funcionando durante una impresión en hardware compatible (H2D, H2C, H2S, P2S, H2D Pro, X2D, X1C, A2L con firmware reciente). La temperatura de secado se limita automáticamente 5°C por debajo del preajuste en reposo para proteger las bobinas.`,dryingPresets:`Preajustes de secado`,dryingPresetsDescription:`Temperatura y duración por tipo de filamento. El AMS 2 Pro usa temperaturas más bajas; el AMS-HT admite temperaturas más altas.`,dryingFilament:`Filamento`,humidityThresholds:`Umbrales de humedad`,humidityThresholdsDescription:`Disparador de humedad por tipo de filamento para autosecado y alarmas. Cargas mixtas en un AMS usan el umbral más bajo.`,humidityThresholdCol:`Umbral`,humidityThresholdDefault:`Predeterminado (tipos desconocidos)`,printModal:`Ventana de impresión`,expandCustomMapping:`Expandir el mapeo personalizado de forma predeterminada`,expandCustomMappingDescription:`Al imprimir en varias impresoras, mostrar el mapeo de AMS por impresora expandido`,authentication:`Autenticación`,authEnabledDescription:`Su instancia está protegida con autenticación de usuario`,authDisabledDescription:`Active para exigir el inicio de sesión y gestionar el acceso de los usuarios`,authDisabledMessage:`Active la autenticación para crear cuentas de usuario, gestionar permisos y proteger su instancia de Bambuddy.`,enableAuthentication:`Activar la autenticación`,currentUser:`Usuario actual`,changePassword:`Cambiar contraseña`,admin:`Administrador`,users:`Usuarios`,addUser:`Añadir usuario`,groups:`Grupos`,addGroup:`Añadir grupo`,system:`Sistema`,noDescription:`Sin descripción`,userCount:`{{count}} usuarios`,permissionCount:`{{count}} permisos`,createUser:`Crear usuario`,username:`Nombre de usuario`,enterUsername:`Introduzca el nombre de usuario`,password:`Contraseña`,enterPassword:`Introduzca la contraseña`,passwordRequirements:`Al menos 8 caracteres, con una mayúscula, una minúscula, un dígito y un carácter especial.`,confirmPassword:`Confirmar contraseña`,confirmPasswordPlaceholder:`Confirme la contraseña`,viewReleaseOnGitHub:`Ver la versión en GitHub`,turnAllPlugsOn:`Encender todos los enchufes`,turnAllPlugsOff:`Apagar todos los enchufes`,clearNotificationLogs:`Borrar los registros de notificaciones`,clearLogsMessage:`Esto eliminará permanentemente todos los registros de notificaciones de más de 30 días. Esta acción no se puede deshacer.`,clearLogs:`Borrar registros`,resetUiPreferences:`Restablecer las preferencias de la interfaz`,resetUiPreferencesMessage:`Esto restablecerá todas las preferencias de la interfaz a sus valores predeterminados: orden de la barra lateral, tema, disposición del panel, modos de vista y preferencias de ordenación. Sus impresoras, archivos y ajustes del servidor NO se verán afectados. La página se recargará tras el restablecimiento.`,resetPreferences:`Restablecer preferencias`,deleteGroupTitle:`Eliminar grupo`,deleteGroupMessage:`¿Está seguro de que desea eliminar este grupo? Los usuarios de este grupo perderán estos permisos.`,deleteGroup:`Eliminar grupo`,disableAuthenticationTitle:`Desactivar la autenticación`,disableAuthenticationMessage:`¿Está seguro de que desea desactivar la autenticación? Esto hará que su instancia de Bambuddy sea accesible sin iniciar sesión. Todos los usuarios permanecerán en la base de datos, pero la autenticación se desactivará.`,disableAuthentication:`Desactivar la autenticación`,configureBambuddy:`Configurar Bambuddy`,systemDefault:`Predeterminado del sistema`,archiveSettings:`Ajustes de archivado`,newWindow:`Ventana nueva`,embeddedOverlay:`Superposición integrada`,preferredSlicer:`Laminador preferido`,preferredSlicerDescription:`Laminador usado para el corte en la aplicación a través del sidecar de la API`,openInSlicerLabel:`Abrir en el laminador`,openInSlicerInherit:`Igual que el laminador de la API`,openInSlicerDescription:`Laminador de escritorio que usa el botón «Abrir en el laminador». Déjelo en «Igual que el laminador de la API» para heredar, o elija un laminador distinto para uso local.`,orcaslicerKnownIssuesWarning:`OrcaSlicer 2.3.2 / 2.4.0-dev tienen errores conocidos de la CLI que impiden laminar muchos 3MF creados con Bambu — consulte las incidencias del proyecto original #12426 (cierre inesperado en archivos multiextrusor pintados) y #13386 (rechazo por validación estricta del rango de parámetros). Se recomienda Bambu Studio hasta que lleguen las correcciones.`,useSlicerApi:`Usar la API del laminador`,useSlicerApiDescription:`Cuando está activado, las acciones de «Laminar» abren la ventana del laminador integrada en la aplicación y llaman al contenedor auxiliar de la API del laminador. Cuando está desactivado (predeterminado), delegan en el laminador de escritorio mediante un esquema de URI.`,slicerCard:`Laminador`,orcaslicerApiUrl:`OrcaSlicer sidecar URL`,bambuStudioApiUrl:`Bambu Studio sidecar URL`,slicerStallTimeout:`Tiempo de espera por inactividad del laminador (minutos)`,slicerStallTimeoutDescription:`Abandona un laminado tras este tiempo sin progreso del sidecar. Los modelos pesados que siguen informando progreso nunca se interrumpen, por mucho que tarden. Los sidecars que no informan progreso usan este valor como limite de tiempo total.`,slicerApiUrlDescription:`URL del contenedor auxiliar de la API del laminador. Déjelo en blanco para usar los valores predeterminados de las variables de entorno SLICER_API_URL / BAMBU_STUDIO_API_URL.`,externalCameras:`Cámaras externas`,costTracking:`Seguimiento de costes`,billingEnabled:`Activar facturación`,billingEnabledDescription:`Cobrar las impresiones a los usuarios y activar las funciones financieras`,printerKillSwitch:`Parada de impresiones no autorizadas`,printerKillSwitchDescription:`Detiene inmediatamente las impresiones que comiencen sin autorización.`,financeBudgetReset:`Reinicio mensual del presupuesto financiero`,financeBudgetResetDay:`Día de reinicio`,financeBudgetResetDayHelp:`En los meses cortos, se usa el último día del mes.`,financeBudgetResetTimezone:`Zona horaria del reinicio`,financeBudgetResetTimezoneHelp:`El inicio del período presupuestario se calcula en esta zona horaria.`,rebuildLedger:`Reconstruir libro mayor del monedero`,rebuildLedgerStarted:`Se inició la reconstrucción del libro mayor`,rebuildLedgerConfirmTitle:`¿Reconstruir el libro mayor del monedero?`,rebuildLedgerConfirmMessage:`Esto reconstruirá el libro mayor para reparar saldos históricos. Ejecútalo solo si sabes lo que estás haciendo.`,rebuildLedgerInProgress:`Iniciando reconstrucción...`,printsOnly:`Solo impresiones`,totalConsumption:`Consumo total`,dataManagement:`Gestión de datos`,storageUsage:`Uso del almacenamiento`,storageUsageDescription:`Desglose del uso de datos por categoría`,storageUsageTotal:`Total`,storageUsageErrors:`Errores`,storageUsageOtherBreakdown:`Otros (incluye recursos estáticos, scripts y archivos de configuración)`,storageUsageSystem:`Sistema`,storageUsageData:`Datos`,storageUsageUnavailable:`Información de uso del almacenamiento no disponible`,clearNotificationLogsDescription:`Eliminar los registros de notificaciones de más de 30 días`,resetUiPreferencesDescription:`Restablecer el orden de la barra lateral, el tema, los modos de vista y las preferencias de disposición. Las impresoras, los archivos y los ajustes no se ven afectados.`,enableHomeAssistant:`Activar Home Assistant`,enableMqtt:`Activar MQTT`,useTls:`Usar TLS`,enableMetricsEndpoint:`Activar el punto de conexión de métricas`,availableMetrics:`Métricas disponibles`,editUser:`Editar usuario`,deleteUserTitle:`Eliminar usuario`,groupName:`Nombre del grupo`,leaveEmptyForAnonymous:`Dejar vacío para anónimo`,leaveEmptyForNoAuth:`Dejar vacío para sin autenticación`,enterNewPassword:`Introduzca la nueva contraseña`,confirmNewPassword:`Confirme la nueva contraseña`,enterGroupName:`Introduzca el nombre del grupo`,enterDescriptionOptional:`Introduzca una descripción (opcional)`,enterCurrentPassword:`Introduzca la contraseña actual`,enterNewPasswordMin6:`Introduzca la nueva contraseña (mín. 6 caracteres)`,toast:{keyCopied:`Clave copiada al portapapeles`,copyFailed:`Error al copiar la clave`,keyAddedToBrowser:`Clave añadida al explorador de API`,clearLogsFailed:`Error al borrar los registros`,uiPreferencesReset:`Preferencias de la interfaz restablecidas. Actualizando...`,authDisabled:`Autenticación desactivada correctamente`,authDisableFailed:`Error al desactivar la autenticación`,apiKeyCreated:`Clave API creada`,apiKeyDeleted:`Clave API eliminada`,userCreated:`Usuario creado correctamente`,userUpdated:`Usuario actualizado correctamente`,userDeleted:`Usuario eliminado correctamente`,groupCreated:`Grupo creado correctamente`,groupUpdated:`Grupo actualizado correctamente`,groupDeleted:`Grupo eliminado correctamente`,fillRequiredFields:`Rellene todos los campos obligatorios`,passwordsDoNotMatch:`Las contraseñas no coinciden`,passwordTooShort:`La contraseña debe tener al menos 8 caracteres`,passwordNeedsUppercase:`La contraseña debe contener al menos una letra mayúscula`,passwordNeedsLowercase:`La contraseña debe contener al menos una letra minúscula`,passwordNeedsDigit:`La contraseña debe contener al menos un dígito`,passwordNeedsSpecial:`La contraseña debe contener al menos un carácter especial`,enterGroupName:`Introduzca un nombre de grupo`,settingsSaved:`Ajustes guardados`,noPermissionUpdate:`No tiene permiso para cambiar los ajustes`,cameraSettingsSaved:`Ajustes de la cámara guardados`,enterCameraUrl:`Introduzca una URL de cámara`,passwordChanged:`Contraseña cambiada correctamente`,connectionFailed:`Error de conexión`,testFailed:`La prueba falló`,cameraConnected:`Cámara conectada{{resolution}}`,cameraConnectedCoalesced:`Cámara conectada{{resolution}} (compartida con una captura ya en curso)`},testConnection:`Probar conexión`,catalog:{spoolCatalog:`Catálogo de bobinas`,spoolCatalogDescription:`Pesos de bobinas vacías por marca/tipo. Se usa para la búsqueda automática de peso al añadir bobinas.`,searchCatalog:`Buscar en el catálogo...`,addNewEntry:`Añadir nueva entrada`,namePlaceholder:`Nombre (p. ej., Bambu Lab - Plástico)`,weight:`Peso`,type:`Tipo`,default:`Predeterminado`,custom:`Personalizado`,noMatch:`Ninguna entrada coincide con su búsqueda`,empty:`No hay entradas en el catálogo`,deleteEntry:`Eliminar entrada`,deleteConfirm:`¿Está seguro de que desea eliminar "{{name}}"?`,resetCatalog:`Restablecer catálogo`,resetConfirm:`¿Restablecer el catálogo a los valores predeterminados? Esto eliminará todas las entradas personalizadas.`,loadFailed:`Error al cargar el catálogo de bobinas`,nameWeightRequired:`El nombre y el peso son obligatorios`,entryAdded:`Entrada añadida`,addFailed:`Error al añadir la entrada`,entryUpdated:`Entrada actualizada`,updateFailed:`Error al actualizar la entrada`,entryDeleted:`Entrada eliminada`,deleteFailed:`Error al eliminar la entrada`,resetSuccess:`Catálogo restablecido a los valores predeterminados`,resetFailed:`Error al restablecer el catálogo`,exported:`Se exportaron {{count}} entradas`,imported:`Se importaron {{added}} entradas ({{skipped}} omitidas)`,importFailed:`Error al importar: formato JSON no válido`,exportTooltip:`Exportar el catálogo a JSON`,importTooltip:`Importar el catálogo desde JSON`,resetTooltip:`Restablecer a los valores predeterminados`,selectedCount:`{{count}} seleccionadas`,deleteSelected:`Eliminar seleccionadas`,bulkDeleteConfirm:`¿Está seguro de que desea eliminar {{count}} entradas?`,bulkDeleted:`Se eliminaron {{count}} entradas`,bulkDeleteFailed:`Error al eliminar las entradas`,material:`Material`,spoolWeight:`Peso de la bobina`,color:`Color`,updateSpoolWeight:`Actualizar el peso de la bobina`,filamentUpdated:`Filamento actualizado`,filamentUpdateFailed:`Error al actualizar el filamento`,filamentUpdateInvalid:`Datos de filamento no válidos`,keepExistingSpoolWeight:`Conservar el peso anterior para las bobinas existentes`,keepExistingSpoolWeightDesc:`Las bobinas ya creadas con este tipo de filamento conservan el peso de tara anterior. Las bobinas nuevas usan el valor actualizado.`,applyToAllSpools:`Aplicar a todas las bobinas`,applyToAllSpoolsDesc:`Todos los cálculos de peso para este tipo de filamento usan inmediatamente el nuevo peso de tara.`},colorCatalog:{title:`Catálogo de colores`,description:`Colores de filamento por fabricante/material. Se usa para la búsqueda automática de color al añadir bobinas.`,searchColors:`Buscar colores...`,allManufacturers:`Todos los fabricantes`,addNewColor:`Añadir nuevo color`,manufacturer:`Fabricante`,colorName:`Nombre del color`,hex:`Hex`,materialOptional:`Material (opcional)`,showing:`Mostrando {{filtered}} de {{total}} colores`,noMatch:`Ningún color coincide con su búsqueda`,empty:`No hay colores en el catálogo`,deleteColor:`Eliminar color`,deleteConfirm:`¿Está seguro de que desea eliminar "{{name}}"?`,resetCatalog:`Restablecer el catálogo de colores`,resetConfirm:`¿Restablecer el catálogo a los valores predeterminados? Esto eliminará todos los colores personalizados.`,sync:`Sincronizar`,starting:`Iniciando...`,syncTooltip:`Sincronizar desde FilamentColors.xyz (más de 2000 colores, puede tardar un minuto)`,loadFailed:`Error al cargar el catálogo de colores`,fieldsRequired:`El fabricante, el nombre del color y el color hexadecimal son obligatorios`,colorAdded:`Color añadido`,addFailed:`Error al añadir el color`,colorUpdated:`Color actualizado`,updateFailed:`Error al actualizar el color`,colorDeleted:`Color eliminado`,deleteFailed:`Error al eliminar el color`,resetSuccess:`Catálogo de colores restablecido a los valores predeterminados`,resetFailed:`Error al restablecer el catálogo`,syncUpToDate:`Ya está actualizado ({{count}} colores comprobados)`,syncComplete:`Se añadieron {{added}} colores nuevos ({{skipped}} ya existían)`,syncError:`Error de sincronización`,syncFailed:`Error al sincronizar desde FilamentColors.xyz`,exported:`Se exportaron {{count}} colores`,imported:`Se importaron {{added}} colores ({{skipped}} omitidos)`,importFailed:`Error al importar: formato JSON no válido`,selectedCount:`{{count}} seleccionados`,deleteSelected:`Eliminar seleccionados`,bulkDeleteConfirm:`¿Está seguro de que desea eliminar {{count}} colores?`,bulkDeleted:`Se eliminaron {{count}} colores`,bulkDeleteFailed:`Error al eliminar los colores`},dateFormat:`Formato de fecha`,dateFormatUs:`EE. UU. (MM/DD/AAAA)`,dateFormatEu:`UE (DD/MM/AAAA)`,dateFormatIso:`ISO (AAAA-MM-DD)`,timeFormat:`Formato de hora`,timeFormat12:`12 horas (3:30 PM)`,timeFormat24:`24 horas (15:30)`,defaultPrinter:`Impresora predeterminada`,defaultPrinterDescription:`Preseleccione esta impresora para subidas, reimpresiones y otras operaciones.`,slicerBambuStudio:`Bambu Studio`,slicerOrcaSlicer:`OrcaSlicer`,sidebarOrderDescription:`Use Diseño de la barra lateral para reordenar elementos, restablecer la visibilidad y gestionar enlaces personalizados.`,setDefault:`Establecer como predeterminado`,sidebarOrderSetDefaultHint:`Establecer como predeterminado aplica el orden de menú actual a los usuarios que no han personalizado el suyo.`,sidebarDefaultSet:`Se ha establecido el orden de menú predeterminado.`,sidebarDefaultCleared:`Orden de menú predeterminado borrado.`,sidebarDefaultFailed:`Error al establecer el orden de menú predeterminado.`,reset:`Restablecer`,darkMode:`Modo oscuro`,lightMode:`Modo claro`,active:`(activo)`,background:`Fondo`,accent:`Acento`,style:`Estilo`,bgNeutral:`Neutro`,bgWarm:`Cálido`,bgCool:`Frío`,bgOled:`Negro OLED`,bgSlate:`Azul pizarra`,bgForest:`Verde bosque`,accentGreen:`Verde`,accentTeal:`Verde azulado`,accentBlue:`Azul`,accentOrange:`Naranja`,accentPurple:`Morado`,accentRed:`Rojo`,styleClassic:`Clásico`,styleGlow:`Resplandor`,styleVibrant:`Vibrante`,themeToggleHint:`Alterne entre modo oscuro, claro y sistema con el icono en la barra lateral.`,progressInTitle:`Progreso en la pestaña`,progressInTitleDescription:`Muestra el porcentaje de la impresión activa y un anillo de progreso en la pestaña del navegador.`,autoArchivePrints:`Archivar impresiones automáticamente`,autoArchiveDescription:`Guardar automáticamente los archivos 3MF cuando se completan las impresiones`,saveThumbnailsDescription:`Extraer y guardar imágenes de vista previa de los archivos 3MF`,captureFinishPhotoDescription:`Tomar una foto desde la cámara de la impresora cuando se completa la impresión. Bambuddy graba un breve timelapse durante la impresión para que la foto pueda obtenerse del momento previo al descenso de la cama; el archivo del timelapse se conserva si activaste el timelapse para esta impresión, de lo contrario se elimina automáticamente tras capturar la foto.`,finishPhotoRestorePlate:`Elevar la cama para la foto final`,finishPhotoRestorePlateDescription:`La impresora baja la cama unos 100 mm al terminar una impresión, dejando la pieza terminada por debajo del encuadre de la cámara. Bambuddy la vuelve a subir hasta justo encima de la última capa impresa, toma la foto y luego la baja de nuevo. Se omite si se desconoce la altura de la impresión o si hay otro trabajo en cola.`,ffmpegNotInstalled:`ffmpeg no instalado`,ffmpegRequired:`La captura de cámara requiere ffmpeg. Instálelo mediante brew install ffmpeg (macOS) o apt install ffmpeg (Linux).`,camera:`Cámara`,cameraViewMode:`Modo de vista de la cámara`,cameraOverlayDescription:`La cámara se abre en una superposición redimensionable en la pantalla principal`,cameraWindowDescription:`La cámara se abre en una ventana de navegador independiente`,externalCamerasDescription:`Configure cámaras externas para sustituir la cámara integrada de la impresora. Admite transmisiones MJPEG, RTSP, capturas HTTP y cámaras USB (V4L2). Cuando está activada, la cámara externa se usa para la vista en directo y las fotos de finalización.`,cameraPlaceholderUsb:`Ruta del dispositivo (/dev/video0)`,cameraPlaceholderUrl:`URL de la cámara (rtsp://... o http://...)`,cameraTypeMjpeg:`Transmisión MJPEG`,cameraTypeRtsp:`Transmisión RTSP`,cameraTypeSnapshot:`Captura HTTP`,cameraTypeUsb:`Cámara USB (V4L2)`,cameraSnapshotUrl:`URL de captura (opcional)`,cameraSnapshotUrlPlaceholder:`http://192.168.1.61:1984/api/frame.jpeg?src=printer`,cameraSnapshotUrlHelp:`URL de fotograma único usada para las miniaturas de notificaciones, las fotos de finalización, los fotogramas de time-lapse por capa y la detección de cama. El time-lapse y la detección de cama requieren cada uno su propio interruptor por impresora; esta URL es solo la fuente de imagen de la que se nutren cuando están activos. Déjelo en blanco para capturar desde la transmisión en directo de arriba. Útil para go2rtc (/api/frame.jpeg) y cámaras IP con un punto de conexión de captura dedicado.`,cameraRotation:`Rotación`,cameraLight:`Encender la luz de la cámara de impresión para la cámara`,cameraLightHint:`Enciende la luz mientras alguien mira la cámara y para las capturas automáticas, como las fotos de las notificaciones, las fotos finales y las imágenes para Home Assistant. Después la vuelve a apagar, pero solo si la encendió Bambuddy.`,cameraLightDelay:`Espera antes de la captura`,cameraLightDelayHint:`Solo si la luz estaba apagada. Da tiempo a que se encienda la luz y cualquier luz sincronizada con ella.`,cameraLightMode_off:`Desactivado`,cameraLightMode_all:`Todas las impresoras`,cameraLightMode_selected:`Impresoras seleccionadas`,cameraLightDelayUnit:`segundos`,cameraLightNoneSelected:`Aún no hay ninguna impresora elegida.`,cameraLightAddPrinter:`Añadir impresora`,cameraLightRemovePrinter:`Quitar {{name}}`,externalCameraAdd:`Añadir cámara externa`,externalCameraRemove:`Quitar la cámara externa de {{name}}`,printerPickerSearch:`Buscar impresoras`,printerPickerNoMatch:`Ninguna impresora coincide.`,cameraShowSettings:`Ajustes de cámara`,test:`Probar`,connected:`Conectada`,disconnected:`Desconectada`,currency:`Moneda`,defaultFilamentCost:`Coste predeterminado del filamento (por kg)`,electricityCost:`Coste de la electricidad por kWh`,energyPriceSource:`Origen del precio de la electricidad`,energyPriceSourceFixed:`Precio fijo`,energyPriceSourceHomeAssistant:`Sensor de Home Assistant`,energyPriceHaEntity:`Sensor de precio`,energyPriceLastRead:`Último precio leído por kWh`,energyPriceFixedHint:`Un precio nuevo se aplica a la energía consumida a partir de entonces; la energía ya consumida conserva el precio al que se consumió.`,energyPriceHaHint:`Se lee cada hora y al inicio y al final de cada impresión, y cada hora de energía se calcula a su propio precio. El sensor debe dar el precio por kWh (por MWh y por Wh se convierten).`,energyPriceHaNotConfigured:`Home Assistant no está configurado. Conéctalo en Ajustes → Red → Home Assistant.`,energyDisplayMode:`Modo de visualización de la energía`,energyModePrintDescription:`El panel muestra la suma de la energía usada durante las impresiones`,energyModeTotalDescription:`El panel muestra la energía total de los enchufes inteligentes`,fileManager:`Gestor de archivos`,createArchiveEntry:`Crear una entrada de archivo al imprimir`,createArchiveEntryDescription:`Al imprimir desde el gestor de archivos, crear opcionalmente una entrada de archivo`,lowDiskSpaceWarning:`Advertencia de poco espacio en disco`,lowDiskSpaceDescription:`Mostrar una advertencia cuando el espacio libre en disco caiga por debajo de este umbral`,printerFirmware:`Firmware de la impresora`,checkFirmwareDescription:`Buscar actualizaciones de firmware de la impresora de Bambu Lab`,bambuddySoftware:`Software de Bambuddy`,autoCheckDescription:`Buscar automáticamente nuevas versiones al iniciar`,checkNow:`Buscar ahora`,updateAvailableVersion:`Actualización disponible: v{{version}}`,releaseNotes:`Notas de la versión`,updateViaDocker:`Actualizar mediante Docker Compose:`,composeDirectory:`Directorio de Compose`,composeDirectoryHint:`Directorio que contiene tu docker-compose.yml. Déjalo vacío para omitir el cd.`,copyUpdateCommand:`Copiar comando de actualización`,updateViaHomeAssistant:`Las actualizaciones las gestiona el Supervisor de Home Assistant. Abra Ajustes → Complementos → Bambuddy en Home Assistant para instalar la nueva versión.`,updateViaWindowsInstaller:`Las instalaciones en Windows se actualizan volviendo a ejecutar el instalador. Descarga la nueva versión abajo — tus datos, ajustes e impresoras se conservan.`,downloadWindowsInstaller:`Descargar instalador para v{{version}}`,installUpdate:`Instalar actualización`,latestVersionRunning:`Está ejecutando la versión más reciente`,failedToCheckUpdates:`Error al buscar actualizaciones: {{error}}`,backupRestore:`Copia de seguridad y restauración`,backupRestoreDescription:`Exportar/importar ajustes y configurar la copia de seguridad en GitHub`,goToBackup:`Ir a la copia de seguridad`,externalUrl:`URL externa`,externalUrlDescription:`La URL externa donde Bambuddy es accesible. Se usa para las imágenes de notificación y las integraciones externas.`,bambuddyUrl:`URL de Bambuddy`,externalUrlHint:`Incluya el protocolo y el puerto (p. ej., http://192.168.1.100:8000)`,ftpRetry:`Reintento de FTP`,ftpRetryDescription:`Reintentar las operaciones FTP cuando el Wi-Fi de la impresora no es fiable. Se aplica a las descargas de 3MF, las subidas de impresión, las descargas de time-lapse y las actualizaciones de firmware.`,autoRetryDescription:`Reintentar automáticamente las operaciones FTP fallidas`,retryAttempts:`Intentos de reintento`,retryDelay:`Retardo de reintento`,connectionTimeout:`Tiempo de espera de la conexión`,time_one:`{{count}} vez`,time_other:`{{count}} veces`,second_one:`{{count}} segundo`,second_other:`{{count}} segundos`,nSeconds:`{{count}} segundos`,increaseForWeakWifi:`Aumente para impresoras con Wi-Fi débil`,homeAssistant:`Home Assistant`,homeAssistantFullDescription:`Conéctese a Home Assistant para controlar enchufes inteligentes mediante la API REST de HA. Admite las entidades switch, light, input_boolean y script.`,homeAssistantUrl:`URL de Home Assistant`,longLivedAccessToken:`Token de acceso de larga duración`,haTokenHint:`Cree un token en HA: Perfil → Tokens de acceso de larga duración → Crear token`,connectionSuccessful:`Conexión correcta`,connectionFailed:`Error de conexión`,haConnectionSuccess:`Conexión con Home Assistant realizada correctamente.`,haConnectionFailed:`Error al conectar con Home Assistant.`,mqttPublishing:`Publicación MQTT`,mqttDescription:`Publique los eventos de Bambuddy en un broker MQTT externo para la integración con Node-RED, Home Assistant y otros sistemas de automatización.`,mqttEnableDescription:`Publicar eventos en un broker MQTT externo`,brokerHostname:`Nombre de host del broker`,port:`Puerto`,usernameOptional:`Nombre de usuario (opcional)`,passwordOptional:`Contraseña (opcional)`,topicPrefix:`Prefijo del tema`,topicPrefixHint:`Los temas serán: {{prefix}}/printers//status, etc.`,prometheusMetrics:`Métricas de Prometheus`,prometheusEndpointDescription:`Exponer las métricas de la impresora en /api/v1/metrics para la supervisión con Prometheus/Grafana.`,bearerTokenOptional:`Bearer Token (opcional)`,bearerTokenHint:`Si se establece, las solicitudes deben incluir Authorization: Bearer `,metricsConnectionStatus:`Estado de la conexión`,metricsPrinterState:`Estado de la impresora (inactiva/imprimiendo/etc.)`,metricsPrintProgress:`Progreso de la impresión 0-100%`,metricsBedTemp:`Temperatura de la cama`,metricsNozzleTemp:`Temperatura de la boquilla`,metricsPrintsTotal:`Total de impresiones por resultado`,metricsMore:`...y más (capas, ventiladores, cola, uso de filamento)`,smartPlugsDescription:`Conecte enchufes inteligentes (Tasmota o Home Assistant) para automatizar el control de la alimentación y realizar el seguimiento del consumo de energía de sus impresoras.`,allOn:`Encender todo`,allOff:`Apagar todo`,addSmartPlug:`Añadir enchufe inteligente`,energySummary:`Resumen de energía`,currentPower:`Potencia actual`,plugsOnline:`{{reachable}}/{{total}} enchufes en línea`,today:`Hoy`,yesterday:`Ayer`,total:`Total`,enablePlugsForSummary:`Active enchufes para ver el resumen de energía`,addNotificationProvider:`Añadir`,systemBadge:`(Sistema)`,creating:`Creando...`,changing:`Cambiando...`,deleteUserAndItems:`Eliminar el usuario Y sus elementos`,deleteUserKeepItems:`Eliminar el usuario, conservar los elementos (quedan sin propietario)`,ok:`Aceptar`,twoFa:{totpTitle:`Aplicación de autenticación (TOTP)`,totpDesc:`Use una aplicación de autenticación como Google Authenticator, Aegis o Authy.`,emailOtpTitle:`OTP por correo`,emailOtpDesc:`Enviar un código de un solo uso a {{email}} cuando inicie sesión.`,emailOtpNoEmail:`Añada una dirección de correo a su cuenta para habilitar este método.`,addEmailFirst:`Su cuenta no tiene dirección de correo. Pida a un administrador que añada una antes de activar el OTP por correo.`,setupTotp:`Configurar la aplicación de autenticación`,setupAuthApp:`Configurar la aplicación de autenticación`,setupInstructions:`Escanee el código QR de abajo con su aplicación de autenticación y luego confirme con un código.`,manualEntry:`¿No puede escanear? Introduzca este secreto manualmente:`,scannedContinue:`He escaneado el código — continuar`,enterCodeToConfirm:`Introduzca el código de 6 dígitos de su aplicación de autenticación para confirmar la configuración.`,activate:`Activar`,disableTotp:`Desactivar el autenticador`,disableConfirmHint:`Introduzca un código TOTP válido o un código de respaldo para desactivar el autenticador.`,totpDisabled:`Aplicación de autenticación desactivada.`,emailOtpEnabled:`OTP por correo activado.`,emailOtpDisabled:`OTP por correo desactivado.`,smtpRequired:`Configure y pruebe primero los ajustes de SMTP.`,invalidCode:`Código no válido. Inténtelo de nuevo.`,enableEmailOtp:`Activar el OTP por correo`,disableEmailOtp:`Desactivar el OTP por correo`,emailSetupEnterCode:`Se ha enviado un código de verificación a su dirección de correo. Introdúzcalo a continuación para confirmar que es el propietario de este buzón.`,verifyAndEnable:`Verificar y activar`,emailDisablePasswordHint:`Introduzca la contraseña de su cuenta para confirmar la desactivación del OTP por correo.`,passwordPlaceholder:`Introduzca su contraseña`,backupCodesTitle:`Guarde sus códigos de respaldo`,backupCodesWarning:`Guarde estos códigos en un lugar seguro. Cada código solo se puede usar una vez y no se volverán a mostrar.`,backupCodesRemaining:`Quedan {{count}} códigos de respaldo`,savedCodes:`He guardado mis códigos`,regenBackup:`Regenerar los códigos de respaldo`,regenBackupHint:`Introduzca su código TOTP actual para generar 10 códigos de respaldo nuevos. Todos los códigos de respaldo existentes quedarán invalidados.`,newBackupCodes:`Nuevos códigos de respaldo`,linkedAccounts:`Cuentas de SSO vinculadas`,linkedAccountsDesc:`Estos proveedores de identidad externos están vinculados a su cuenta.`,oidcUnlinked:`Cuenta desvinculada.`},sessionPolicy:{title:`Política de sesión`,description:`Duración máxima de sesión para nuevos inicios de sesión. Los tokens ya emitidos conservan su caducidad original.`,preset24h:`24 horas`,preset7d:`7 días`,preset30d:`30 días`,customHoursLabel:`Duración de sesión personalizada en horas`,hoursSuffix:`horas`,warning:`Las sesiones más largas reducen la protección de cierre automático. Recomendado solo para implementaciones de usuario único en entornos de confianza.`},oidc:{title:`Proveedores SSO / OIDC`,desc:`Configure proveedores de OpenID Connect para permitir el inicio de sesión único mediante proveedores de identidad externos.`,addProvider:`Añadir proveedor`,newProvider:`Nuevo proveedor`,empty:`Aún no hay proveedores OIDC configurados.`,created:`Proveedor creado.`,updated:`Proveedor actualizado.`,deleted:`Proveedor eliminado.`,refreshIcon:`Actualizar icono`,removeIcon:`Quitar icono`,iconRefreshed:`Icono actualizado.`,iconRemoved:`Icono eliminado.`,iconFetchFailed:`No se pudo obtener el icono de la URL del proveedor.`,deleteTitle:`Eliminar proveedor`,deleteMessage:`¿Eliminar "{{name}}"? Todas las cuentas de usuario vinculadas se desconectarán.`,form:{name:`Nombre visible`,issuerUrl:`URL del emisor`,clientId:`ID de cliente`,clientSecret:`Secreto de cliente`,scopes:`Ámbitos`,iconUrl:`URL del icono (opcional)`,enabled:`Activado`,autoCreate:`Crear usuarios automáticamente`,autoCreateDesc:`Crear automáticamente una cuenta local en el primer inicio de sesión.`,autoLink:`Vincular cuentas existentes automáticamente`,autoLinkDesc:`Vincular cuentas locales existentes haciendo coincidir el correo en el primer inicio de sesión.`,secretHint:`dejar en blanco para conservar el actual`,secretPlaceholder:`nuevo secreto`,emailClaim:`Claim de correo`,emailClaimDesc:`Claim de JWT usado como identidad de correo. Use «preferred_username» o «upn» para Azure Entra ID (que no envía email_verified). Use solo nombres de claim de confianza.`,emailClaimPlaceholder:`correo`,emailClaimCustomClaimAutoLinkWarning:`Los claims personalizados solo son seguros para la vinculación automática cuando el valor lo administra el inquilino (p. ej. upn / preferred_username de Azure Entra ID). No active la vinculación automática si su IdP permite a los usuarios autoasignarse este claim.`,requireEmailVerified:`Requerir correo verificado`,requireEmailVerifiedDesc:`Aceptar el claim de correo solo cuando el proveedor lo marca como verificado.`,requireEmailVerifiedWarning:`Advertencia: el correo se aceptará incluso sin verificación. Úselo solo con proveedores de confianza.`,requireEmailVerifiedAutoLink:`Desactive primero la vinculación automática para cambiar este ajuste.`,defaultGroup:`Grupo predeterminado`,defaultGroupDesc:`Grupo asignado a los usuarios creados automáticamente. Si no se establece, se usa Visores como alternativa.`,defaultGroupViewersFallback:`Visores (predeterminado)`,autologin:`Inicio automático`,autologinDesc:`Redirigir a los visitantes no autenticados directamente a este proveedor. Solo un proveedor puede llevar esta marca.`,groupClaim:`Claim de grupos`,groupClaimDesc:`Claim JWT que contiene los grupos del usuario en el proveedor de identidad. La mayoría usa 'groups'; el valor puede ser un array JSON o una cadena.`,groupMapping:`Mapeo de grupos`,groupMappingDesc:`Los grupos mapeados se sincronizan en cada inicio de sesión. Los grupos que no aparezcan aquí no se tocan, de modo que las asignaciones manuales se conservan. Déjalo vacío para desactivar la sincronización de grupos.`,groupSync:`Sincronización de grupos`,groupSyncOn:`Activa`,groupMappingIdpGroupPlaceholder:`Nombre del grupo en el proveedor de identidad`,groupMappingSelectGroup:`Seleccionar grupo de Bambuddy…`,groupMappingAddRow:`Añadir mapeo`,groupMappingDeletedGroupOption:`{{group}} (eliminado)`,groupMappingDeletedGroupWarning:`Este grupo de Bambuddy ha sido eliminado. Elige un reemplazo o quita este mapeo.`,groupMappingIncompleteRow:`Escribe el grupo del proveedor de identidad y elige un grupo de Bambuddy, o quita este mapeo.`,groupMappingDuplicateRow:`Este grupo del proveedor de identidad ya está mapeado más arriba. Los nombres de grupo se comparan sin distinguir mayúsculas y minúsculas.`}},encryption:{title:`Estado del cifrado de MFA`,enabledFromEnv:`Cifrado en reposo activado (clave de la variable de entorno MFA_ENCRYPTION_KEY)`,enabledFromFile:`Cifrado en reposo activado (clave cargada del directorio de datos)`,enabledGenerated:`Cifrado en reposo activado con una clave autogenerada`,notConfigured:`Cifrado en reposo no configurado`,notConfiguredDesc:`Los secretos TOTP y los client_secrets de OIDC se almacenan en texto plano. Establezca MFA_ENCRYPTION_KEY o reinicie Bambuddy con un directorio de datos con permisos de escritura para generar una automáticamente.`,allEncrypted:`Todos los secretos de MFA están cifrados en reposo.`,legacyRowsLabel:`Filas heredadas en texto plano`,encryptedRowsLabel:`Filas cifradas`,legacyRowsWarning:`Se detectaron {{count}} fila(s) heredada(s) en texto plano. Vuelva a guardar el proveedor OIDC o vuelva a registrar la aplicación de autenticación del usuario para migrar al almacenamiento cifrado.`,backupHint:`La clave autogenerada se almacena en DATA_DIR/.mfa_encryption_key y se incluye en los ZIP de copia de seguridad local. Mantenga sus copias de seguridad seguras o establezca MFA_ENCRYPTION_KEY de forma explícita.`,decryptionBrokenTitle:`Falta la clave de cifrado`,decryptionBrokenError:`{{count}} registro(s) cifrado(s) no se pueden descifrar porque la clave de cifrado ya no está disponible. Restaure la MFA_ENCRYPTION_KEY anterior o DATA_DIR/.mfa_encryption_key para recuperarlos.`,migrationErrorWarning:`{{count}} fila(s) heredada(s) no se pudieron volver a cifrar al iniciar. Revise los registros del servidor y reinicie Bambuddy para reintentarlo.`},pipelineLimits:{title:`Límites de pipelines del cortador`,maxCopiesLabel:`Copias máximas por ejecución`,maxCopiesDesc:`Límite superior de copias que los operadores pueden solicitar al ejecutar una pipeline. El límite máximo del servidor es 1000.`},pipelines:{title:`Pipelines del Cortador`,subtitle:`Paquetes reutilizables de preajustes (impresora + proceso + filamentos + tipo de placa). Guarda uno desde el diálogo Cortar y aplícalo con un clic al siguiente archivo.`,loading:`Cargando pipelines…`,loadError:`No se pudieron cargar las pipelines.`,confirmDelete:`¿Eliminar esta pipeline? Esto no se puede deshacer.`,staleWarning:`Uno o más preajustes referenciados ya no existen. Vuelve a guardar esta pipeline desde el diálogo Cortar para corregirla.`,empty:{title:`Aún no hay pipelines.`,howto:`Abre el diálogo Cortar para cualquier archivo, elige impresora / proceso / filamentos / placa, y haz clic en "Guardar como pipeline". Tus pipelines guardadas aparecerán aquí.`},field:{name:`Nombre de la pipeline`,description:`Descripción`,targetPrinter:`Impresora de destino`,noTarget:`— Sin destino —`,targetKind:`Tipo de destino`,targetKindSpecific:`Impresora específica`,targetKindClass:`Clase de impresora`,targetModelClass:`Modelo de impresora`,fanoutStrategy:`Estrategia de distribución`,fanout:{max_parallel:`Máximo paralelo — distribuir entre cualquier impresora libre coincidente`,round_robin:`Round robin — alternar entre impresoras elegibles`,fill_one_first:`Llenar una primero — fijar todas las copias a una impresora`},fanoutShort:{max_parallel:`paralelo`,round_robin:`round robin`,fill_one_first:`primero uno`}},action:{save:`Guardar`,cancel:`Cancelar`,rename:`Renombrar`,delete:`Eliminar`},slot:{printer:`Impresora`,process:`Proceso`,filament:`Filamento`,filamentN:`Filamento {{n}}`,filamentAll:`Todos los {{n}} slots`,bed:`Placa`},group:{profiles:`Perfiles`,filaments:`Filamentos`},searchPlaceholder:`Buscar pipelines…`,filterTargetType:`Filtrar por tipo de destino`,filterTarget:`Filtrar por destino`,filter:{all:`Todos los destinos`,noTarget:`Sin destino`,count:`{{shown}} / {{total}}`,noMatches:`Ninguna pipeline coincide con los filtros actuales.`},toast:{saved:`Pipeline guardada`,saveFailed:`Error al guardar`,deleted:`Pipeline eliminada`,deleteFailed:`Error al eliminar`},noTargetHint:`Establece una impresora de destino para ejecutar`,noTargetWarning:`Establece una impresora de destino antes de ejecutar esta pipeline.`,runs:{lastRun:`Última ejecución`,status:{queued:`en cola`,slicing:`cortando`,dispatching:`enviando`,in_progress:`imprimiendo`,completed:`completada`,failed:`fallida`,partial_failure:`fallo parcial`,cancelled:`cancelada`}}}},notification:{printStarted:{title:`Impresión iniciada`,body:`{{printer}}: {{filename}} ha empezado a imprimirse`},printCompleted:{title:`Impresión completada`,body:`{{printer}}: {{filename}} se completó correctamente`},printFailed:{title:`Impresión fallida`,body:`{{printer}}: {{filename}} ha fallado`},printStopped:{title:`Impresión detenida`,body:`{{printer}}: {{filename}} se detuvo`},printProgress:{title:`Progreso de la impresión`,body:`{{printer}}: {{filename}} está al {{percent}}%`},printerOffline:{title:`Impresora desconectada`,body:`{{printer}} está desconectada`},printerError:{title:`Error de la impresora`,body:`{{printer}}: {{error}}`},filamentLow:{title:`Filamento bajo`,body:`{{printer}}: el filamento se está agotando`},maintenanceDue:{title:`Mantenimiento pendiente`,body:`{{printer}}: {{items}} necesitan atención`}},errors:{generic:`Algo salió mal`,networkError:`Error de red. Compruebe su conexión.`,notFound:`No encontrado`,unauthorized:`No autorizado`,serverError:`Error del servidor`,validationError:`Compruebe los datos introducidos`,printerConnectionFailed:`Error al conectar con la impresora`,saveFailed:`Error al guardar los cambios`,deleteFailed:`Error al eliminar`,loadFailed:`Error al cargar los datos`},hmsErrors:{title:`Errores - {{name}}`,noErrors:`No hay errores`,viewOnWiki:`Ver en la wiki de Bambu Lab`,mqttVerifyFailedRemedy:`Activa el modo desarrollador en la impresora, reinicia la impresora y vuelve a iniciar el trabajo.`,mqttVerifyFailedDescription:`La impresora rechazó un comando porque no pudo verificarlo. Las impresiones, los cambios de temperatura y las cargas de filamento enviados desde Bambuddy se ignorarán hasta que se solucione.`,severityError:`Fallo`,severityWarning:`Advertencia`,severityNotice:`Aviso`,severityUnknown:`Nivel desconocido`,uncountedSummary:`También notificados, sin contar ({{n}})`,uncountedHint:`Avisos que no requieren tu intervención y códigos para los que Bambu no publica texto. No cuentan como problemas en la tarjeta de la impresora ni envían notificaciones.`,unknownCode:`Código HMS desconocido — consulta la wiki de Bambu Lab para más detalles.`,clearInstructions:`Borre los errores en la impresora para descartarlos aquí.`,clearErrors:`Borrar errores`,clearSuccess:`Errores HMS borrados`,clearFailed:`Error al borrar los errores HMS`,actionSuccess:`Acción enviada a la impresora`,actionFailed:`No se pudo enviar la acción`,runoutExpectedSlot:`El filamento se agotó en {{ranOut}}. La impresora ahora espera filamento compatible en {{expected}}. Inserta una bobina en {{expected}} y luego selecciona Reintentar.`,runoutExpectedSlotOnly:`La impresora está esperando filamento compatible en {{expected}}. Inserta una bobina ahí y luego selecciona Reintentar.`,runoutSlotUnknown:`El filamento se agotó y la impresión está en pausa. Bambuddy no pudo determinar qué slot espera ahora la impresora — revisa la pantalla de la impresora para ver el slot solicitado.`,actions:{RESUME_PRINTING:`Reanudar impresión`,RESUME_PRINTING_DEFECTS:`Reanudar (defectos aceptables)`,RESUME_PRINTING_PROBELM_SOLVED:`Reanudar (problema resuelto)`,STOP_PRINTING:`Detener impresión`,CHECK_ASSISTANT:`Ver asistente`,FILAMENT_EXTRUDED:`Filamento extruido, continuar`,RETRY_FILAMENT_EXTRUDED:`Aún no extruido, reintentar`,CONTINUE:`Finalizado, continuar`,LOAD_VIRTUAL_TRAY:`Cargar filamento`,OK_BUTTON:`OK`,FILAMENT_LOAD_RESUME:`Filamento cargado, reanudar`,JUMP_TO_LIVEVIEW:`Ver en vivo`,NO_REMINDER_NEXT_TIME:`No recordar la próxima vez`,REFRESH_NOZZLE:`Volver a comprobar`,IGNORE_NO_REMINDER_NEXT_TIME:`Ignorar y no recordar`,IGNORE_RESUME:`Ignorar y reanudar`,PROBLEM_SOLVED_RESUME:`Problema resuelto, reanudar`,TURN_OFF_FIRE_ALARM:`Entendido, apagar alarma de incendio`,RETRY_PROBLEM_SOLVED:`Reintentar (problema resuelto)`,CANCLE:`Cancelar`,STOP_DRYING:`Detener secado`,PROCEED:`Continuar`,OK_JUMP_RACK:`OK`,ABORT:`Cancelar`,DISABLE_PURIFICATION:`Desactivar purificación para esta impresión`,DONT_REMIND_NEXT_TIME:`No recordarme`,DBL_CHECK_CANCEL:`Cancelar`,DBL_CHECK_DONE:`Hecho`,DBL_CHECK_RETRY:`Reintentar`,DBL_CHECK_RESUME:`Reanudar`,DBL_CHECK_OK:`Confirmar`,REMOVE_CLOSE_BTN:`Cerrar`}},mqttDebug:{title:`Registro de depuración MQTT`,searchPlaceholder:`Buscar tema o carga útil...`,noMessages:`Aún no se han registrado mensajes`,startLoggingHint:`Haga clic en «Iniciar registro» para empezar a capturar mensajes MQTT`,noMessagesMatch:`Ningún mensaje coincide con su filtro`,adjustFilterHint:`Pruebe a ajustar su búsqueda o los criterios del filtro`,incoming:`Entrante`,outgoing:`Saliente`,loggingStopped:`Registro detenido`,loggingActive:`Registro activo - los mensajes se actualizarán automáticamente`,startLogging:`Iniciar registro`,stopLogging:`Detener registro`,clearLog:`Borrar registro`,topic:`Tema`,timestamp:`Marca de tiempo`,direction:`Dirección`,all:`Todos`},printerFiles:{zipStarted_one:`Se inició la descarga ZIP de {{count}} archivo`,zipStarted_other:`Se inició la descarga ZIP de {{count}} archivos`,zipPartial:`La descarga ZIP comenzó con {{successful}} de {{total}} archivos; no se pudieron recuperar los demás`,downloadFailed:`Error de descarga: {{error}}`,unknownError:`Error desconocido`,shiftSelectHint:`Mayús-clic para seleccionar un intervalo`,selectFile:`Seleccionar {{name}}`,deselectFile:`Deseleccionar {{name}}`,title:`Gestor de archivos`,storageUsed:`Usado:`,storageFree:`Libre:`,filterPlaceholder:`Filtrar archivos...`,deleteButton:`Eliminar`,deleteFiles:`Eliminar {{count}} archivos`,deleteFileConfirm:`¿Eliminar "{{name}}"? Esto no se puede deshacer.`,deleteFilesConfirm:`¿Eliminar {{count}} archivos seleccionados? Esto no se puede deshacer.`,noFiles:`No hay archivos en la impresora`,printerUnavailable:`El servicio de archivos de la impresora no está disponible. Inténtelo de nuevo cuando la impresora esté accesible.`,loadingFiles:`Cargando archivos...`,failedToLoad:`Error al cargar los archivos`,toast:{filesDeleted:`Se eliminaron {{count}} archivo(s)`,deleteFailed:`Error al eliminar: {{error}}`}},confirm:{delete:`¿Está seguro de que desea eliminar esto?`,unsavedChanges:`Tiene cambios sin guardar. ¿Está seguro de que desea salir?`,clearQueue:`¿Está seguro de que desea vaciar la cola?`},login:{title:`Inicio de sesión en Bambuddy`,subtitle:`Inicie sesión en su cuenta`,username:`Nombre de usuario`,usernamePlaceholder:`Introduzca su nombre de usuario`,usernameOrEmail:`Nombre de usuario o correo`,usernameOrEmailPlaceholder:`Nombre de usuario o @ correo`,password:`Contraseña`,passwordPlaceholder:`Introduzca su contraseña`,signIn:`Iniciar sesión`,signingIn:`Iniciando sesión...`,rememberMe:`Recordarme`,forgotPassword:`¿Olvidó su contraseña?`,autologinFailed:`El inicio de sesión SSO automático falló. Elija un proveedor abajo para continuar.`,localDisabledNotice:`El inicio de sesión local está deshabilitado. Use uno de los proveedores SSO de abajo.`,loginSuccess:`Sesión iniciada correctamente`,loginFailed:`Error al iniciar sesión`,enterCredentials:`Introduzca el nombre de usuario y la contraseña`,enterEmail:`Introduzca su dirección de correo`,oidcLoginFailed:`Error en el inicio de sesión con OIDC`,oidcErrors:{providerError:`El proveedor de identidad devolvió un error`,missingParameters:`A la respuesta de OIDC le faltan parámetros obligatorios`,invalidState:`El estado de OIDC no es válido o ya se ha usado`,stateExpired:`La sesión de inicio de sesión con OIDC ha caducado — inténtelo de nuevo`,providerNotFound:`Proveedor OIDC no encontrado`,discoveryFailed:`Error al obtener el documento de descubrimiento de OIDC`,invalidDiscovery:`El documento de descubrimiento de OIDC no es válido`,networkError:`Error de red durante el intercambio de tokens de OIDC`,badResponse:`Respuesta inesperada durante el intercambio de tokens de OIDC`,noIdToken:`El proveedor OIDC no devolvió un token de ID`,validationFailed:`Error en la validación del token de OIDC`,nonceMismatch:`Discrepancia de nonce de OIDC — posible ataque de repetición`,missingSubClaim:`Al token de OIDC le falta el claim sub`,noLinkedAccount:`Ninguna cuenta local está vinculada a esta identidad de OIDC`,accountInactive:`Su cuenta está inactiva`,userResolutionFailed:`Error al resolver su cuenta`,internalError:`Se produjo un error interno durante el inicio de sesión con OIDC`,tokenExchangeFailed:`Error en el intercambio de tokens de OIDC`},forgotPasswordTitle:`Contraseña olvidada`,forgotPasswordMessage:`Si ha olvidado su contraseña, póngase en contacto con el administrador de su sistema para restablecerla.`,forgotPasswordEmailMessage:`Introduzca su dirección de correo y le enviaremos una contraseña nueva.`,emailAddress:`Dirección de correo`,emailPlaceholder:`su.correo@ejemplo.com`,cancel:`Cancelar`,sending:`Enviando...`,sendResetEmail:`Enviar correo de restablecimiento`,howToReset:`Cómo restablecer su contraseña:`,resetStep1:`Póngase en contacto con su administrador de Bambuddy`,resetStep2:`Pídale que restablezca su contraseña en la gestión de usuarios`,resetStep3:`Puede establecerle una nueva contraseña temporal`,resetStep4:`Inicie sesión con la nueva contraseña y cámbiela en Ajustes`,gotIt:`Entendido`,resetPassword:{title:`Establecer nueva contraseña`,subtitle:`Introduzca y confirme su nueva contraseña a continuación.`,newPassword:`Nueva contraseña`,newPasswordPlaceholder:`Al menos 8 caracteres`,confirmPassword:`Confirmar contraseña`,confirmPasswordPlaceholder:`Repita la nueva contraseña`,saving:`Guardando…`,submit:`Establecer nueva contraseña`,backToLogin:`Volver al inicio de sesión`,passwordsDoNotMatch:`Las contraseñas no coinciden`,passwordTooShort:`La contraseña debe tener al menos 8 caracteres`,resetFailed:`Error al restablecer la contraseña. Es posible que el enlace haya caducado.`},twoFA:{title:`Autenticación de dos factores`,subtitle:`Su cuenta está protegida con 2FA. Introduzca el código de verificación a continuación.`,methodAuthenticator:`Aplicación de autenticación`,methodEmail:`Código por correo`,methodBackup:`Código de respaldo`,instructionsTotp:`Abra su aplicación de autenticación e introduzca el código de 6 dígitos para Bambuddy.`,instructionsEmail:`Se ha enviado un código de 6 dígitos a su dirección de correo. Caduca en 10 minutos.`,instructionsEmailNotSent:`Haga clic en el botón de abajo para recibir un código de verificación por correo.`,instructionsBackup:`Introduzca uno de sus códigos de recuperación de respaldo de 8 caracteres. Cada código solo se puede usar una vez.`,sendCodeButton:`Enviar código por correo`,sendingCode:`Enviando...`,resendCode:`Reenviar código`,codeLabel:`Código de verificación`,backupCodeLabel:`Código de respaldo`,codePlaceholder:`000000`,backupCodePlaceholder:`XXXXXXXX`,verifyButton:`Verificar`,verifyingButton:`Verificando...`,backToLogin:`← Volver al inicio de sesión`,orContinueWith:`o continuar con`,signInWith:`Iniciar sesión con {{provider}}`,enterCode:`Introduzca el código de verificación`,sendCodeFailed:`Error al enviar el código de verificación`,invalidCode:`Código no válido. Inténtelo de nuevo.`}},setup:{title:`Configuración de Bambuddy`,subtitle:`Configure la autenticación para su instancia de Bambuddy`,enableAuth:`Activar la autenticación`,adminAccount:`Cuenta de administrador`,adminAccountDesc:`Si ya existen usuarios administradores, la autenticación se activará usando las cuentas de administrador existentes. Deje los campos de abajo vacíos para usar los administradores existentes, o introduzca nuevas credenciales para crear un nuevo usuario administrador.`,adminUsername:`Nombre de usuario del administrador`,adminPassword:`Contraseña del administrador`,optionalIfAdminExists:`(opcional si existen usuarios administradores)`,adminUsernamePlaceholder:`Introduzca el nombre de usuario del administrador (opcional)`,adminPasswordPlaceholder:`Introduzca la contraseña del administrador (opcional)`,confirmPassword:`Confirmar contraseña`,confirmPasswordPlaceholder:`Confirme la contraseña del administrador`,settingUp:`Configurando...`,completeSetup:`Completar la configuración`,toast:{authEnabledAdminCreated:`Autenticación activada y usuario administrador creado`,authEnabledExistingAdmins:`Autenticación activada usando los usuarios administradores existentes`,setupCompleted:`Configuración completada`,enterBothCredentials:`Introduzca el nombre de usuario y la contraseña del administrador, o deje ambos vacíos para usar los usuarios administradores existentes`,passwordsDoNotMatch:`Las contraseñas no coinciden`,passwordTooShort:`La contraseña debe tener al menos 6 caracteres`}},changePassword:{title:`Cambiar contraseña`,currentPassword:`Contraseña actual`,currentPasswordPlaceholder:`Introduzca la contraseña actual`,newPassword:`Nueva contraseña`,newPasswordPlaceholder:`Introduzca la nueva contraseña (mín. 6 caracteres)`,confirmPassword:`Confirmar nueva contraseña`,confirmPasswordPlaceholder:`Confirme la nueva contraseña`,passwordsDoNotMatch:`Las contraseñas no coinciden`,passwordTooShort:`La contraseña debe tener al menos 6 caracteres`,changing:`Cambiando...`,success:`Contraseña cambiada correctamente`,failed:`Error al cambiar la contraseña`},plateAlert:{title:`¡Impresión en pausa!`,message:`Se han detectado objetos en la cama de impresión. La impresión se ha pausado automáticamente. Despeje la cama y reanude la impresión.`,understand:`Entendido`},camera:{title:`Vista de la cámara`,invalidPrinterId:`ID de impresora no válido`,live:`En directo`,snapshot:`Captura`,restartStream:`Reiniciar la transmisión`,refreshSnapshot:`Actualizar la captura`,fullscreen:`Pantalla completa`,exitFullscreen:`Salir de la pantalla completa`,connectingToCamera:`Conectando con la cámara...`,capturingSnapshot:`Capturando imagen...`,connectionLost:`Conexión perdida`,connectionFailed:`Error de conexión con la cámara`,reconnecting:`Reconectando en {{countdown}} s... (intento {{attempt}}/{{max}})`,reconnectNow:`Reconectar ahora`,cameraUnavailable:`Cámara no disponible`,cameraUnavailableDesc:`Asegúrese de que la impresora está encendida y conectada.`,noCamera:`No hay cámara disponible`,retry:`Reintentar`,cameraStream:`Transmisión de la cámara`,zoomOut:`Alejar`,zoomIn:`Acercar`,resetZoom:`Restablecer el zoom`,recording:`Grabando`,startRecording:`Iniciar grabación`,stopRecording:`Detener grabación`,chamberLight:`Conmutar la luz de la cámara`,unavailable:`Cámara no disponible`,diagnose:{button:`Diagnosticar`,modalTitle:`Diagnóstico de la cámara`,running:`Ejecutando el diagnóstico...`,runFailed:`No se pudo ejecutar el diagnóstico: {{error}}`,retry:`Ejecutar de nuevo`,stage:{tcp_reachable:`Accesibilidad de la red`,first_frame:`Captura de fotogramas`,live_stream_active:`Transmisión en directo activa`},summary:{all_ok:`La cámara funciona. El diagnóstico completó todas las etapas correctamente.`,live_stream_active_healthy:`La cámara está transmitiendo actualmente con fotogramas recientes — no se necesita ninguna prueba.`,printer_unreachable:`La impresora no es accesible. Compruebe la dirección IP, la conexión de red y que la impresora está encendida.`,camera_port_closed:`La impresora es accesible pero el puerto de la cámara está cerrado. Asegúrese de que el modo solo LAN y el modo desarrollador están activados en los ajustes de la impresora.`,no_frame:`Se conectó a la cámara pero no se recibieron fotogramas. Inténtelo de nuevo o compruebe que la cámara está activada en los ajustes de la impresora.`,unknown_failure:`El diagnóstico de la cámara falló por un motivo desconocido. Consulte el registro de soporte para más detalles.`},meta:{protocol:`Protocolo`,port:`Puerto`,profile:`Perfil`}}},groups:{title:`Gestión de grupos`,subtitle:`Gestione los grupos de permisos para el control de acceso`,backToSettings:`Volver a Ajustes`,createGroup:`Crear grupo`,noPermission:`No tiene permiso para acceder a esta página.`,system:`Sistema`,noDescription:`Sin descripción`,usersCount:`{{count}} usuarios`,permissionsCount:`{{count}} permisos`,edit:`Editar`,delete:`Eliminar`,toast:{created:`Grupo creado correctamente`,updated:`Grupo actualizado correctamente`,deleted:`Grupo eliminado correctamente`,enterGroupName:`Introduzca un nombre de grupo`},modal:{editGroup:`Editar grupo`,createGroup:`Crear grupo`,cancel:`Cancelar`,saving:`Guardando...`,creating:`Creando...`,saveChanges:`Guardar cambios`},form:{groupName:`Nombre del grupo`,groupNamePlaceholder:`Introduzca el nombre del grupo`,systemGroupWarning:`Los nombres de los grupos del sistema no se pueden cambiar`,description:`Descripción`,descriptionPlaceholder:`Introduzca una descripción (opcional)`,permissions:`Permisos ({{count}} seleccionados)`},deleteModal:{title:`Eliminar grupo`,message:`¿Está seguro de que desea eliminar este grupo? Los usuarios de este grupo perderán estos permisos.`,confirm:`Eliminar grupo`},editor:{title:`Editar grupo`,createTitle:`Crear grupo`,search:`Buscar permisos...`,selectAll:`Seleccionar todo`,clearAll:`Borrar todo`,permissionsSelected:`{{count}} seleccionados`,noResults:`Ningún permiso coincide con su búsqueda`,websocketHint:`Necesario para las actualizaciones en vivo. Sin este permiso, la interfaz recurre al sondeo periódico.`,printerAccess:`Acceso a impresoras`,adminsSeeAllPrinters:`Los administradores siempre ven todas las impresoras.`,printerAccessAfterCreate:`Una vez creado el grupo, elija sus impresoras en Ajustes → Autenticación → Acceso a impresoras.`,printerAccessLimited:`Limitado: {{printers}} impresoras elegidas, {{locations}} ubicaciones`,printerAccessOpen:`Sin límite: los miembros ven todas las impresoras.`,managePrinterAccess:`Gestionar acceso a impresoras`}},printerAccess:{tab:`Acceso a impresoras`,intro:`Elija qué impresoras pueden ver y controlar los miembros de cada grupo. Un grupo sin límite no restringe nada: un usuario que no está en ningún grupo limitado ve todas las impresoras, y los administradores siempre.`,byGroup:`Por grupo`,byPrinter:`Por impresora`,searchGroups:`Buscar grupos`,groupFilter:{all:`Todos`,limited:`Limitados`,open:`Sin límite`},noGroupsMatch:`Ningún grupo coincide.`,alwaysAll:`Siempre todas las impresoras`,notLimited:`Todas las impresoras`,reachShort:`{{count}} de {{total}} impresoras`,unsaved:`Cambios sin guardar`,pickGroup:`Elija un grupo para seleccionar sus impresoras.`,memberCount:`Miembros: {{count}}`,editGroup:`Editar grupo`,adminsSeeAll:`Los administradores siempre ven todas las impresoras.`,limit:`Limitar a los miembros a las impresoras y ubicaciones elegidas aquí`,limitHint:`Desactivado: este grupo no restringe qué impresoras ven sus miembros.`,reach:`Los miembros pueden usar {{count}} de {{total}} impresoras.`,noneGranted:`Nada seleccionado: los miembros de este grupo no verán ninguna impresora.`,noPrinters:`Aún no se ha añadido ninguna impresora.`,searchPrinters:`Buscar por nombre, modelo, número de serie o ubicación`,allLocations:`Todas las ubicaciones`,noLocation:`Sin ubicación`,allModels:`Todos los modelos`,accessFilter:`Acceso`,accessAll:`Con y sin acceso`,accessWith:`Con acceso`,accessWithout:`Sin acceso`,tickShown:`Marcar todas las mostradas`,untickShown:`Desmarcar todas las mostradas`,emptyLocation:`ahora mismo no hay ninguna impresora aquí`,wholeLocation:`Ubicación completa`,wholeLocationHint:`Todas las impresoras de {{location}}, incluidas las que se añadan después`,noPrintersMatch:`Ninguna impresora coincide.`,viaLocation:`por ubicación`,alsoVisible:`Además de los grupos aquí listados, todas las impresoras son visibles para los administradores y para los usuarios que no están en ningún grupo limitado.`,openUsers:`Usuarios sin grupo limitado: {{names}}`,noOpenUsers:`Todos los usuarios, salvo los administradores, están en un grupo limitado.`,noLimitedGroups:`Todavía no hay ningún grupo limitado, así que todos los usuarios ven todas las impresoras. Limite un grupo en "Por grupo".`,noLimitedGroupReaches:`Ningún grupo limitado`,showingOne:`Mostrando una impresora.`,showAll:`Mostrar todas las impresoras`,viaLocationTitle:`A través de la ubicación {{location}}. Cámbielo en "Por grupo".`,removeGroup:`Quitar acceso a {{group}}`,addGroup:`Dar acceso a…`,changedGroups:`Cambios sin guardar: {{names}}`,discard:`Descartar`,saved:`Acceso a impresoras guardado`,whoHasAccess:`Quién tiene acceso`,moveWarning:`Mover esta impresora a otra ubicación cambia quién puede usarla: {{groups}}.`},users:{title:`Gestión de usuarios`,subtitle:`Gestione los usuarios y su acceso a su instancia de Bambuddy`,backToSettings:`Volver a Ajustes`,createUser:`Crear usuario`,noPermission:`No tiene permiso para acceder a esta página.`,admin:`Administrador`,noGroups:`Sin grupos`,active:`Activo`,inactive:`Inactivo`,edit:`Editar`,delete:`Eliminar`,system:`Sistema`,noGroupsAvailable:`No hay grupos disponibles`,table:{username:`Nombre de usuario`,groups:`Grupos`,status:`Estado`,actions:`Acciones`},toast:{created:`Usuario creado correctamente`,updated:`Usuario actualizado correctamente`,deleted:`Usuario eliminado correctamente`,fillRequired:`Rellene todos los campos obligatorios`,passwordsDoNotMatch:`Las contraseñas no coinciden`,passwordTooShort:`La contraseña debe tener al menos 6 caracteres`,ldapProvisioned:`Usuario LDAP "{{username}}" aprovisionado`},modal:{createUser:`Crear usuario`,editUser:`Editar usuario`,cancel:`Cancelar`,creating:`Creando...`,saving:`Guardando...`,saveChanges:`Guardar cambios`,advancedAuthSubtitle:`con autenticación avanzada`,tabsAriaLabel:`Origen del usuario`,localTab:`Local`,ldapTab:`LDAP`,ldapSearchLabel:`Buscar en el directorio`,ldapSearchPlaceholder:`Escriba un nombre de usuario, nombre o correo...`,ldapMinChars:`Escriba al menos 2 caracteres para buscar`,ldapTypeToSearch:`Empiece a escribir para buscar en el directorio LDAP`,ldapSearching:`Buscando en el directorio...`,ldapNoResults:`No hay usuarios coincidentes en el directorio`,ldapSearchError:`Error en la búsqueda en el directorio. Compruebe el estado del servidor LDAP.`,ldapAlreadyProvisioned:`Ya aprovisionado`,ldapSelectedLabel:`Seleccionado`,ldapProvision:`Aprovisionar usuario`,ldapProvisioning:`Aprovisionando...`,ldapErrorProvision:`Error en el aprovisionamiento. Compruebe el estado del servidor LDAP e inténtelo de nuevo.`},form:{username:`Nombre de usuario`,usernamePlaceholder:`Introduzca el nombre de usuario`,email:`Correo`,emailPlaceholder:`usuario@ejemplo.com`,password:`Contraseña`,passwordPlaceholder:`Introduzca la contraseña`,confirmPassword:`Confirmar contraseña`,confirmPasswordPlaceholder:`Confirme la contraseña`,newPasswordPlaceholder:`Introduzca la nueva contraseña`,confirmNewPasswordPlaceholder:`Confirme la nueva contraseña`,leaveBlankToKeep:`dejar en blanco para conservar la actual`,groups:`Grupos`,optional:`opcional`,autoGeneratedPassword:`Se generará automáticamente una contraseña segura y se enviará al usuario por correo.`,passwordManagedByAdvancedAuth:`La contraseña la gestiona la autenticación avanzada. Use «Restablecer contraseña» para enviar una nueva contraseña al usuario por correo.`,resetPassword:`Restablecer contraseña`,resettingPassword:`Restableciendo la contraseña...`},deleteModal:{title:`Eliminar usuario`,message:`¿Está seguro de que desea eliminar este usuario? Esta acción no se puede deshacer.`,confirm:`Eliminar usuario`}},streamOverlay:{branding:{title:`Identidad visual`,hint:`Un logotipo compartido para esta instalación. PNG o WebP, hasta 2 MiB y 4 millones de píxeles. Reemplazarlo o eliminarlo afecta a las superposiciones que lo utilizan.`,upload:`Subir logotipo`,logo:`Logotipo personalizado`,from:`Color inicial`,to:`Color final`,reset:`Restablecer colores`,failed:`No se pudo guardar el logotipo. Comprueba el formato y el tamaño.`},title:`Superposición de transmisión`,invalidPrinterId:`ID de impresora no válido`,cameraStream:`Transmisión de la cámara`,progress:`Progreso`,eta:`Tiempo estimado`,printerIdle:`La impresora está inactiva`,printerOffline:`Impresora desconectada`,layer:`Capa`,remaining:`Restante`,builder:{backgroundTransparency:`Transparencia del fondo`,backgroundTransparencyHint:`Atenúa solo los fondos oscuros. El texto, los logotipos y la cámara siguen visibles.`,layout:`Diseño`,landscape:`Horizontal`,portrait:`Vertical`,both:`Ambos`,orientationUrl:`URL {{orientation}}`,orientationPreview:`Vista previa {{orientation}}`,sourceDimensions:`Fuente de navegador: {{width}} × {{height}} px`,artwork:`Diseño`,artworkClassic:`Clásico`,artworkV2:`Versión 2`,createToken:`Crear token de superposición`,showToken:`Mostrar token`,hideToken:`Ocultar token`,credentialHint:`Crea un token arriba, introduce uno existente o importa una URL de superposición. Copia la URL antes de salir: los tokens solo se mantienen en memoria y no se pueden recuperar de su hash almacenado.`,importUrl:`URL de superposición existente`,importAction:`Importar URL`,importHint:`Importa una URL localmente para reutilizar su token y ajustes en este servidor. Los ajustes que Bambuddy no reconoce se ignoran.`,rememberedHint:`Tus opciones se guardan en este navegador. El token no.`,resetChoices:`Restablecer opciones`,importError:`Introduce una URL de superposición HTTP(S) válida con un número de impresora positivo, como máximo un token y sin usuario ni contraseña.`,manualToken:`Token manual`,title:`Superposición de emisión`,description:`Crea la URL de una superposición de emisión: una vista de cámara a pantalla completa con los datos de impresión en directo encima, para OBS, una pantalla de pared o cualquier fuente de navegador. Elige los campos y copia la URL.`,printer:`Impresora`,size:`Tamaño del texto`,sizeSmall:`Pequeño`,sizeMedium:`Mediano`,sizeLarge:`Grande`,fps:`Fotogramas por segundo`,fpsHint:`Las cámaras A1 y P1 no pasan de unos 5 fps, sea cual sea el valor solicitado.`,tokenWarning:`Esta URL contiene un token: cualquiera que pueda leerla verá la emisión y el nombre del archivo. Revoca el token para cortar el acceso.`,fields:`Campos que mostrar`,fieldPrinter:`Nombre de la impresora`,fieldModel:`Modelo de impresora`,fieldFilename:`Nombre del archivo`,fieldStatus:`Estado`,fieldProgress:`Barra de progreso`,fieldLayers:`Número de capas`,fieldEta:`Tiempo restante y hora de fin`,fieldCamera:`Imagen de la cámara`,chamberHint:`La temperatura de la cámara de impresión solo aparece en modelos con sensor real: las P1 y A1 informan un valor sin sentido, así que se omite.`,urlTitle:`URL de la superposición`,open:`Abrir`,showPreview:`Mostrar vista previa`,hidePreview:`Ocultar vista previa`,previewTitle:`Vista previa de la superposición`},status:{printing:`Imprimiendo`,paused:`En pausa`,finished:`Finalizada`,failed:`Fallida`,idle:`Inactiva`,unknown:`Desconocido`}},profiles:{title:`Perfiles`,subtitle:`Gestione sus preajustes del laminador y las calibraciones de avance de presión`,tabs:{bambuCloud:`Bambu Cloud`,orcaCloud:`Orca Cloud`,local:`Perfiles locales`,kprofiles:`Perfiles K`},orcaCloud:{connectedAs:`Conectado como`,connectedShort:`Conectado a Orca Cloud`,logout:`Desconectar`,noLogoutPermission:`No tienes permiso para desconectar`,noConnectPermission:`No tienes permiso para conectar a Orca Cloud`,retry:`Reintentar`,connectButton:`Conectar Orca Cloud`,connect:{title:`Conectar a Orca Cloud`,description:`Inicia sesión en tu cuenta Orca Cloud para sincronizar tus perfiles de slicer en Bambuddy.`},device:{title:`Aprueba Bambuddy en Orca Cloud`,instruction:`Abre Orca Cloud y aprueba este código. Bambuddy se conecta automáticamente en cuanto lo apruebes.`,codeLabel:`Tu código de emparejamiento`,openButton:`Abrir la página de aprobación de Orca Cloud`,manualHint:`O ve a {{url}} e introduce el código de arriba.`,waiting:`Esperando a que apruebes…`,cancel:`Cancelar`},profiles:{title:`Tus perfiles de Orca Cloud ({{count}})`,refresh:`Actualizar`,empty:`Aún no hay perfiles en tu cuenta de Orca Cloud.`},toast:{disconnected:`Desconectado de Orca Cloud`},errors:{startFailed:`No se pudo iniciar el inicio de sesión de Orca Cloud.`,denied:`El emparejamiento fue rechazado en Orca Cloud.`,expired:`El código de emparejamiento caducó. Haz clic en Conectar para intentarlo de nuevo.`,pollFailed:`Se perdió la conexión mientras se esperaba la aprobación. Inténtalo de nuevo.`}},localProfiles:{title:`Perfiles locales`,subtitle:`Importe y gestione preajustes del laminador desde OrcaSlicer`,import:`Importar perfiles`,importDesc:`Suelte aquí archivos .bbscfg, .bbsflmt, .orca_filament, .zip o .json`,importing:`Importando...`,search:`Buscar preajustes locales...`,noPresets:`Aún no hay preajustes locales`,noSearchResults:`Ningún preajuste coincide con su búsqueda`,badge:`Local`,edit:`Editar`,delete:`Eliminar`,cancel:`Cancelar`,deleteConfirmTitle:`Eliminar preajuste`,deleteConfirm:`¿Está seguro de que desea eliminar este preajuste? Esto no se puede deshacer.`,source:`Origen`,inheritsFrom:`Hereda de`,filamentType:`Tipo`,vendor:`Proveedor`,compatiblePrinters:`Impresoras`,nozzleTemp:`Temp. de la boquilla`,cost:`Coste`,density:`Densidad`,pressureAdvance:`Avance de presión`,filament:`Filamento`,process:`Proceso`,printer:`Impresora`,toast:{importSuccess:`{{count}} preajuste(s) importado(s)`,importSkipped:`{{count}} preajuste(s) omitido(s) (duplicados)`,importError:`{{count}} error(es) durante la importación`,deleted:`Preajuste eliminado`,updated:`Preajuste actualizado`}},connectedAs:`Conectado como`,signInExpiredTitle:`La sesión de Bambu Cloud ha caducado`,signInExpiredBody:`Bambu Lab ya no acepta el token almacenado. Inicie sesión de nuevo para restaurar los perfiles en la nube, las importaciones de MakerWorld y las comprobaciones de firmware.`,logout:`Cerrar sesión`,noLogoutPermission:`No tiene permiso para cerrar sesión`,failedToLoad:`Error al cargar los perfiles`,retry:`Reintentar`,time:{justNow:`Ahora mismo`,minsAgo:`hace {{count}} min`,hoursAgo:`hace {{count}} h`,daysAgo:`hace {{count}} d`},toast:{loggedOut:`Sesión cerrada`},login:{title:`Conectarse a Bambu Cloud`,subtitle:`Sincronice sus preajustes del laminador entre dispositivos`,email:`Correo`,password:`Contraseña`,region:`Región`,regionGlobal:`Global`,regionChina:`China`,verificationCode:`Código de verificación`,totpCode:`Código del autenticador`,checkEmail:`Compruebe su correo ({{email}}) en busca de un código de 6 dígitos`,enterTotpHint:`Introduzca el código de 6 dígitos de su aplicación de autenticación`,accessToken:`Token de acceso`,accessTokenHint:`Pegue su token de acceso de Bambu Cloud. Las cuentas de la región de China deben usar esta vía (vinculada al teléfono — inicio de sesión por correo no disponible). Consulte la wiki para saber cómo obtener el token de las cookies de MakerWorld.`,back:`Atrás`,loginButton:`Iniciar sesión`,verifyButton:`Verificar`,setTokenButton:`Establecer token`,useToken:`Usar token de acceso en su lugar`,captchaTitle:`Bambu Cloud solicita un CAPTCHA`,captchaBody:`Bambu está exigiendo un CAPTCHA a tu red antes de aceptar un inicio de sesión, y ese desafío no se puede responder desde Bambuddy. Tu correo y tu contraseña no son el problema. El bloqueo está ligado a tu dirección IP pública y suele desaparecer solo en unas horas; reintentar repetidamente lo prolonga. Para entrar ahora, usa un token de acceso obtenido en una sesión del navegador.`,useEmail:`Iniciar sesión con correo en su lugar`,toast:{loggedIn:`Sesión iniciada correctamente`,codeSent:`Código de verificación enviado a su correo`,enterTotp:`Introduzca el código de su aplicación de autenticación`,tokenSet:`Token establecido correctamente`}},presets:{myPreset:`Mi preajuste (editable)`,duplicate:`Duplicar`,editable:`Editable`,failedToLoadDetails:`Error al cargar los detalles del preajuste`,deleteConfirm:`¿Eliminar este preajuste?`,deleteWarning:`Esto eliminará permanentemente "{{name}}" de Bambu Cloud. Esto no se puede deshacer.`,noDuplicatePermission:`No tiene permiso para duplicar preajustes`,noEditPermission:`No tiene permiso para editar preajustes`,noDeletePermission:`No tiene permiso para eliminar preajustes`,types:{filament:`Preajuste de filamento`,printer:`Preajuste de impresora`,process:`Preajuste de proceso`},toast:{deleted:`Preajuste eliminado`,created:`Preajuste creado`,updated:`Preajuste actualizado`,duplicated:`Preajuste duplicado`,fieldAdded:`Campo "{{key}}" añadido`,exported:`Preajuste exportado`},baseLabel:`Base: {{name}}`,currentLabel:`Actual: {{name}}`,newPreset:`Nuevo preajuste`,editPreset:`Editar preajuste`,duplicatePreset:`Duplicar preajuste`,createNewPreset:`Crear nuevo preajuste`,customizeSettings:`Personalice los ajustes de su nuevo preajuste`,compareWithBase:`Comparar con el preajuste base`,compare:`Comparar`,basePreset:`Preajuste base`,selectBasePreset:`Seleccionar preajuste base...`,presetName:`Nombre del preajuste`,myCustomPreset:`Mi preajuste personalizado`,inheritsFrom:`Hereda de`,dropJsonToImport:`Suelte un JSON para importar`,tabs:{common:`Común`,allFields:`Todos los campos`},availableFields:`Campos disponibles`,searchFieldsPlaceholder:`Buscar campos...`,noMatchingFields:`No hay campos coincidentes`,allFieldsAdded:`Todos los campos añadidos`,addCustomField:`Añadir campo personalizado`,yourOverrides:`Sus anulaciones`,noOverridesYet:`Aún no hay anulaciones`,clickFieldsToAdd:`Haga clic en los campos de la izquierda para añadirlos`,saveAsTemplate:`Guardar como plantilla`,jsonTip:`Consejo: arrastre y suelte un archivo .json en cualquier parte de esta ventana para importar ajustes`},cloudView:{searchPlaceholder:`Buscar preajustes...`,templates:`Plantillas`,refresh:`Actualizar`,newPreset:`Nuevo preajuste`,clearFilters:`Borrar filtros`,compareMode:`Modo de comparación`,selectAnotherPreset:`Seleccione otro preajuste de {{type}}`,clickTwoPresets:`Haga clic en dos preajustes del mismo tipo para compararlos`,selectFirst:`1. Seleccione el primero`,selectSecond:`2. Seleccione el segundo`,compareNow:`Comparar ahora`,lastSynced:`Última sincronización:`,showingCount:`Mostrando {{showing}} de {{total}} preajustes`,noPresetsFound:`No se encontraron preajustes`,columns:{filament:`Filamento`,process:`Proceso`,printer:`Impresora`},noFilamentPresets:`No hay preajustes de filamento`,noProcessPresets:`No hay preajustes de proceso`,noPrinterPresets:`No hay preajustes de impresora`,filters:{type:`Tipo`,owner:`Propietario`,printer:`Impresora`,nozzle:`Boquilla`,filament:`Filamento`,layer:`Capa`,all:`Todos`,myPresets:`Mis preajustes`,builtIn:`Integrados`,process:`Proceso`},noTemplatesPermission:`No tiene permiso para gestionar plantillas`,noRefreshPermission:`No tiene permiso para actualizar perfiles`,noCreatePermission:`No tiene permiso para crear preajustes`},templates:{title:`Plantillas rápidas`,noTemplates:`Aún no hay plantillas`,createFirst:`Cree plantillas desde el editor de preajustes`,typeFilter:`Tipo:`,deleteTitle:`Eliminar plantilla`,deleteWarning:`Esta acción no se puede deshacer`,deleteConfirm:`¿Está seguro de que desea eliminar "{{name}}"?`,namePlaceholder:`Nombre de la plantilla`,descriptionPlaceholder:`Descripción`,settingsJson:`Ajustes (JSON)`,fieldsCount:`{{count}} campos`,shownInModals:`Mostrada en las ventanas`,hiddenInModals:`Oculta en las ventanas`,apply:`Aplicar`,toast:{deleted:`Plantilla eliminada`,updated:`Plantilla actualizada`,created:`Plantilla creada`,applied:`Plantilla aplicada`}}},support:{debugLoggingActive:`El registro de depuración está activo`,manageLogs:`Gestionar`,collectItem7:`Conectividad de la impresora y versiones de firmware`,collectItem8:`Estado de las integraciones (Spoolman, MQTT, HA)`,collectItem9:`Interfaces de red (solo subredes)`,collectItem10:`Versiones de los paquetes de Python`,collectItem11:`Comprobaciones de estado de la base de datos`,collectItem12:`Detalles del entorno de Docker`,bundleGenerating:`Generando paquete...`,bundleStepConnection:`Ejecutando comprobaciones de conectividad de impresoras`,bundleStepVirtualPrinters:`Ejecutando comprobaciones de configuración de impresoras virtuales`,bundleStepLogScan:`Analizando los registros recientes en busca de problemas conocidos`,bundleStepBuild:`Creando el archivo ZIP del paquete de soporte`},fileManager:{combine:{action:`Combinar en 3MF`,tooltip:`Combina los STL seleccionados en un 3MF para laminarlos en una sola placa`,title:`Combinar en 3MF`,description:`Crea un 3MF con todos los modelos de abajo, listo para laminar en una sola placa. Activa la organización automática al laminar para distribuirlos en la cama.`,nameLabel:`Nombre del archivo`,defaultName:`{{name}} + {{count}} más`,model:`Modelo`,copies:`Copias`,copiesFor:`Copias de {{filename}}`,total:`Objetos en la placa: {{count}}`,tooMany:`Como máximo {{max}} objetos por placa`,sliceNext:`Abrir el laminador al terminar`,submit:`Combinar`,done:`Se creó {{filename}} con {{count}} objetos`},variants:{badge:`{{count}} versiones`,groupAction:`Agrupar como versiones`,groupTooltip:`Marcar estos archivos como el mismo trabajo laminado para distintas impresoras`,grouped:`{{count}} archivos agrupados como versiones`,printAlternatives:`Imprimir ({{count}} alternativas)`},title:`Gestor de archivos`,subtitle:`Organice y gestione sus archivos de impresión`,uploadFiles:`Subir archivos`,newFolder:`Nueva carpeta`,folderName:`Nombre de la carpeta`,folderNamePlaceholder:`p. ej., Piezas funcionales`,renameFile:`Renombrar archivo`,renameFolder:`Renombrar carpeta`,invalidFilenameChar:`El carácter "{{char}}" no está permitido en nombres de archivos de impresión. La tarjeta SD de la impresora rechaza: < > : " / \\ | ? *`,moveFiles:`Mover {{count}} archivo(s)`,rootNoFolder:`Raíz (sin carpeta)`,current:`actual`,linkFolder:`Vincular carpeta`,linkFolderDescription:`Vincule "{{name}}" a un proyecto o archivo para un acceso rápido.`,project:`Proyecto`,archive:`Archivo`,noProjectsFound:`No se encontraron proyectos`,noArchivesFound:`No se encontraron archivos`,unlink:`Desvincular`,link:`Vincular`,dragDropFiles:`Arrastre y suelte archivos aquí`,dropFilesHere:`Suelte archivos aquí`,releaseToUpload:`Suelte para subir`,orClickToBrowse:`o haga clic para examinar`,allFileTypesSupported:`Se admiten todos los tipos de archivo. Los archivos ZIP se extraerán.`,zipFilesDetected:`Archivos ZIP detectados`,zipExtractOptions:`Los archivos ZIP se extraerán. Elija cómo gestionar la estructura de carpetas:`,preserveZipStructure:`Conservar la estructura de carpetas del ZIP`,createFolderFromZip:`Crear una carpeta a partir del nombre del archivo ZIP`,stlThumbnailGeneration:`Generación de miniaturas STL`,zipMayContainStl:`Los archivos ZIP pueden contener archivos STL. Se pueden generar miniaturas durante la extracción.`,thumbnailsCanBeGenerated:`Se pueden generar miniaturas para los archivos STL. Los modelos grandes pueden tardar más en procesarse.`,generateThumbnailsForStl:`Generar miniaturas para los archivos STL`,threemfDetected:`Archivos 3MF detectados`,threemfExtractionInfo:`El modelo de impresora, el material, el color y los ajustes de impresión se extraerán automáticamente de los archivos 3MF.`,willBeExtracted:`Se extraerá`,filesExtracted:`{{count}} archivos extraídos`,uploadComplete:`Subida completada: {{succeeded}} con éxito`,uploadFailed:`Error al subir`,zipFilesFailed:`{{count}} archivos fallidos`,uploading:`Subiendo...`,changeLink:`Cambiar enlace...`,linkTo:`Vincular a...`,linkToProjectOrArchive:`Vincular a un proyecto o archivo`,generateThumbnail:`Generar miniatura`,generateThumbnails:`Generar miniaturas`,generateThumbnailsForMissing:`Generar miniaturas para los archivos STL y PDF que no las tienen`,gridView:`Vista de cuadrícula`,listView:`Vista de lista`,columnsView:`Vista de columnas`,lowDiskSpaceWarning:`Advertencia de poco espacio en disco`,lowDiskSpaceDetails:`Solo {{free}} libres de {{total}} en total. El umbral está establecido en {{threshold}} GB en los ajustes.`,files:`Archivos`,folders:`Carpetas`,size:`Tamaño`,free:`Libre`,allFiles:`Todos los archivos`,allExternal:`Externos`,externalIsEmpty:`Sin archivos externos`,externalEmptyDescription:`Los archivos de tus carpetas externas vinculadas aparecerán aquí.`,wrap:`Ajustar`,enableTextWrapping:`Activar el ajuste de texto`,disableTextWrapping:`Desactivar el ajuste de texto`,collapse:`Contraer`,collapseFoldersByDefault:`Contraer las carpetas de forma predeterminada`,expandFoldersByDefault:`Expandir las carpetas de forma predeterminada`,folderSort:`Ordenar carpetas`,folderSortByName:`Por nombre`,folderSortByActivity:`Por actividad reciente`,dragToResizeTooltip:`Arrastre para redimensionar, doble clic para restablecer`,searchFiles:`Buscar archivos...`,searchSubfoldersHint:`Incluyendo subcarpetas`,readme:{truncated:`Truncado`,show:`Mostrar README`,hide:`Ocultar README`,label:`README`},tags:{title:`Etiquetas`,subtitle:`Etiqueta archivos para filtros transversales — juguetes, apto para niños, solo PETG, lo que necesites.`,manage:`Etiquetas`,manageTitle:`Gestionar el catálogo de etiquetas`,add:`Nueva etiqueta`,edit:`Renombrar etiqueta`,name:`Nombre`,fileCount:`Archivos`,empty:`Aún no hay etiquetas. Crea una para empezar a etiquetar archivos.`,noMatches:`No hay etiquetas que coincidan.`,createPlaceholder:`p. ej. juguetes, apto-niños, petg`,createButton:`Crear`,nameRequired:`El nombre es obligatorio.`,searchPlaceholder:`Filtrar etiquetas...`,created:`Etiqueta creada.`,updated:`Etiqueta renombrada.`,deleted:`Etiqueta eliminada.`,saveFailed:`No se pudo guardar la etiqueta.`,deleteFailed:`No se pudo eliminar la etiqueta.`,applyFailed:`No se pudieron aplicar las etiquetas.`,applyAdd:`Añadir etiquetas`,applyRemove:`Quitar etiquetas`,applyAddSuccess:`Se añadieron {{count}} etiqueta(s) en {{files}} archivo(s).`,applyRemoveSuccess:`Se quitaron {{count}} etiqueta(s) en {{files}} archivo(s).`,actionAdd:`Añadir a los archivos seleccionados`,actionRemove:`Quitar de los archivos seleccionados`,tagAction:`Etiquetar`,bulkTitle:`Etiquetar {{count}} archivo(s) seleccionado(s)`,bulkTooltip:`Añadir o quitar etiquetas en cada archivo seleccionado.`,noPermission:`No tienes permiso para etiquetar archivos.`,filterLabel:`Filtrando por:`,clearAll:`Limpiar todo`,confirmDelete:`¿Eliminar la etiqueta "{{name}}"?`,confirmDeleteMessage:`Esto elimina la etiqueta del catálogo. Los archivos conservan sus otras etiquetas.`,confirmDeleteInUseMessage:`Esta etiqueta está en {{count}} archivo(s). Al eliminarla desaparece de todos; los archivos en sí no se tocan.`,editAria:`Editar {{name}}`,deleteAria:`Eliminar {{name}}`},allTypes:`Todos los tipos`,prints:`Impresiones`,ascending:`Ascendente`,descending:`Descendente`,showModified:`Mostrar fechas de modificación`,hideModified:`Ocultar fechas de modificación`,lastModified:`Última modificación`,lastActivity:`Última actividad`,resultsCount:`{{showing}} de {{total}} archivos`,selectAll:`Seleccionar todo`,deselectAll:`Deseleccionar todo`,selected:`{{count}} seleccionados`,adding:`Añadiendo...`,loadingFiles:`Cargando archivos...`,folderIsEmpty:`La carpeta está vacía`,noFilesOutsideFolders:`No hay archivos fuera de las carpetas`,noFilesYet:`Aún no hay archivos`,folderEmptyDescription:`Suba archivos o mueva archivos a esta carpeta para empezar.`,noFilesDescription:`Suba archivos para empezar a organizar sus archivos relacionados con la impresión.`,noMatchingFiles:`No hay archivos coincidentes`,noMatchingFilesDescription:`Ningún archivo coincide con su búsqueda o los criterios de filtro actuales.`,clearFilters:`Borrar filtros`,printedCount:`Impreso {{count}} veces`,uploadedBy:`Subido por`,deleteFolder:`Eliminar carpeta`,deleteFile:`Eliminar archivo`,deleteFilesCount:`Eliminar {{count}} archivos`,deleteFolderConfirm:`¿Está seguro de que desea eliminar esta carpeta? Todos los archivos que contiene también se eliminarán.`,deleteFileConfirm:`¿Está seguro de que desea eliminar este archivo?`,deleteFilesConfirm:`¿Está seguro de que desea eliminar {{count}} archivos seleccionados? Esta acción no se puede deshacer.`,deleting:`Eliminando...`,noPermissionRenameFolder:`No tiene permiso para renombrar carpetas`,noPermissionLinkFolder:`No tiene permiso para vincular carpetas`,noPermissionDeleteFolder:`No tiene permiso para eliminar carpetas`,onlyOwnFoldersDeletable:`Solo puedes eliminar tus propias carpetas cuando todo su contenido es tuyo, o carpetas vacías sin propietario`,shareFolder:`Compartir con todos`,unshareFolder:`Dejar de compartir`,shareFolderHint:`Las carpetas compartidas son visibles para todos los usuarios, que pueden añadir archivos y subcarpetas`,sharedFolder:`Compartida con todos`,folderNotWritable:`Solo puedes añadir a tus propias carpetas y a las carpetas compartidas con todos`,noPermissionPrint:`No tiene permiso para imprimir`,noPermissionAddToQueue:`No tiene permiso para añadir a la cola`,noPermissionSlice:`No tiene permiso para laminar archivos`,noPermissionDownload:`No tiene permiso para descargar archivos`,noPermissionPreview:`No tienes permiso para previsualizar archivos`,preview3d:`Vista previa 3D`,preview:{open:`Vista previa`,error:`Este archivo no se puede previsualizar.`,tooLarge:`El archivo es demasiado grande para previsualizarlo ({{size}}).`,page:`Página {{current}} de {{total}}`,prevPage:`Página anterior`,nextPage:`Página siguiente`,zoomIn:`Acercar`,zoomOut:`Alejar`,resetZoom:`Restablecer zoom`,fullscreen:`Pantalla completa`,exitFullscreen:`Salir de la pantalla completa`,emptySheet:`Esta hoja está vacía`,truncatedRows:`Mostrando las primeras {{shown}} de {{total}} filas`,truncatedCols:`Mostrando las primeras {{shown}} de {{total}} columnas`},details:{title:`Detalles del archivo`,size:`Tamaño`,type:`Tipo`,printName:`Nombre de impresión`,printTime:`Tiempo de impresión`,filament:`Filamento`,slicedFor:`Laminado para`,source:`Origen`,created:`Creado`,modified:`Modificado`,notes:`Notas`,notesPlaceholder:`Ajustes de impresión, consejos, qué funcionó...`,externalLink:`Enlace externo`,externalLinkPlaceholder:`https://printables.com/model/...`,openLink:`Abrir enlace`,photos:`Fotos`,addPhoto:`Añadir foto`,noPhotos:`Aún no hay fotos`,deletePhoto:`Eliminar foto`,photoCount_one:`{{count}} foto`,photoCount_other:`{{count}} fotos`,hasNotes:`Tiene notas`,save:`Guardar`,saved:`Detalles del archivo guardados`,saveFailed:`No se pudieron guardar los detalles del archivo`,uploadFailed:`No se pudo subir la foto`,deleteFailed:`No se pudo eliminar la foto`},noPermissionRenameFile:`No tiene permiso para renombrar este archivo`,noPermissionGenerateThumbnail:`No tiene permiso para generar miniaturas`,noPermissionDeleteFile:`No tiene permiso para eliminar este archivo`,noPermissionCreateFolder:`No tiene permiso para crear carpetas`,noPermissionUpload:`No tiene permiso para subir archivos`,noPermissionMoveFiles:`No tiene permiso para mover archivos`,noPermissionDeleteFiles:`No tiene permiso para eliminar archivos`,linkExternal:`Vincular externa`,linkExternalFolder:`Vincular carpeta externa`,linkExternalFolderDescription:`Monte un directorio del host (NAS, USB, recurso compartido de red) en el gestor de archivos. Los archivos no se copian — se accede a ellos directamente desde la ruta original.`,externalFolderNamePlaceholder:`p. ej., Impresiones del NAS`,externalPath:`Ruta del host`,externalPathHelp:`Ruta absoluta al directorio en el host de Docker. Debe estar montado por enlace en el contenedor.`,readOnly:`Solo lectura`,readOnlyHelp:`impide las subidas y eliminaciones`,showHiddenFiles:`Mostrar archivos ocultos (con punto)`,externalFolder:`Carpeta externa`,scanFolder:`Escanear`,toast:{folderCreated:`Carpeta creada`,openInSlicerFailed:`No se pudo abrir en el laminador`,folderDeleted:`Carpeta eliminada`,fileDeleted:`Archivo eliminado`,filesDeleted:`Se eliminaron {{count}} archivos`,filesMoved:`Archivos movidos`,folderLinked:`Carpeta vinculada`,folderUnlinked:`Carpeta desvinculada`,externalFolderLinked:`Carpeta externa vinculada y escaneada`,folderScanned:`Escaneo completado: {{added}} añadidos, {{removed}} eliminados`,addedToQueue:`Se añadieron {{count}} archivo(s) a la cola`,addedToQueuePartial:`Se añadieron {{added}} archivo(s), {{failed}} fallidos`,failedToAddToQueue:`Error al añadir los archivos: {{error}}`,fileRenamed:`Archivo renombrado`,folderRenamed:`Carpeta renombrada`,folderShared:`Carpeta compartida con todos`,folderUnshared:`La carpeta ya no está compartida`,thumbnailsGenerated:`Se generaron {{count}} miniatura(s)`,thumbnailsGeneratedPartial:`Se generaron {{succeeded}} miniatura(s), {{failed}} fallidas`,noStlMissingThumbnails:`No hay archivos STL ni PDF sin miniaturas`,failedToGenerateThumbnails:`Error al generar las miniaturas: {{error}}`,thumbnailGenerated:`Miniatura generada`,failedToGenerateThumbnail:`Error al generar la miniatura: {{error}}`}},projects:{parentLabel:`Proyecto principal`,parentNone:`Ninguno (proyecto de nivel superior)`,parentHint:`Anida este proyecto en otro para que sus cifras se sumen en un proyecto maestro`,partOf:`Parte de {{name}}`,subProjectCount:`{{count}} subproyectos`,subProjectsOf:`Subproyectos de {{name}}`,collapseSubProjects:`Contraer subproyectos`,expandSubProjects:`Expandir subproyectos`,title:`Proyectos`,subtitle:`Organice y haga el seguimiento de sus proyectos de impresión 3D`,newProject:`Nuevo proyecto`,editProject:`Editar proyecto`,deleteProject:`Eliminar proyecto`,projectName:`Nombre del proyecto`,description:`Descripción`,noProjects:`Aún no hay proyectos`,noProjectsFiltered:`No hay proyectos {{status}}`,noProjectsFilteredHelp:`No tiene ningún proyecto {{status}}. Los proyectos aparecerán aquí cuando cambie su estado.`,createFirst:`Cree su primer proyecto para empezar a organizar impresiones relacionadas, hacer el seguimiento del progreso y gestionar sus construcciones.`,createFirstButton:`Cree su primer proyecto`,create:`Crear`,files:`Archivos`,prints:`Impresiones`,plates:`camas`,parts:`piezas`,lastModified:`Última modificación`,deleteConfirm:`¿Está seguro de que desea eliminar este proyecto? Los archivos y los elementos de la cola se desvincularán pero no se eliminarán.`,addFiles:`Añadir archivos`,removeFile:`Quitar archivo`,viewDetails:`Ver detalles`,namePlaceholder:`p. ej., Construcción de Voron 2.4`,descriptionPlaceholder:`Descripción opcional...`,urlLabel:`URL`,urlPlaceholder:`https://makerworld.com/...`,urlInvalid:`La URL debe empezar por http:// o https://`,openExternalUrl:`Abrir la URL del proyecto`,coverImageLabel:`Foto de portada`,coverImageAlt:`Foto de portada del proyecto`,coverImageUpload:`Subir`,coverImageReplace:`Reemplazar`,coverImageRemove:`Quitar`,color:`Color`,targetPlates:`Camas objetivo`,targetPlatesPlaceholder:`p. ej., 25`,targetPlatesHelp:`Número de trabajos de impresión`,targetParts:`Piezas objetivo`,targetPartsPlaceholder:`p. ej., 150`,targetPartsHelp:`Total de objetos necesarios`,targetSets:`Copias por archivo`,targetSetsPlaceholder:`p. ej., 10`,targetSetsHelp:`Veces que debe imprimirse cada archivo imprimible`,tagsLabel:`Etiquetas (separadas por comas)`,tagsPlaceholder:`p. ej., voron, funcional, regalo`,dueDate:`Fecha límite`,priority:`Prioridad`,priorityLow:`Baja`,priorityNormal:`Normal`,priorityHigh:`Alta`,priorityUrgent:`Urgente`,statusActive:`Activo`,statusCompleted:`Completado`,statusArchived:`Archivado`,done:`Hecho`,completed:`completadas`,failed:`fallidas`,inQueue:`en cola`,noPrintsYet:`Aún no hay impresiones`,printJobs:`Trabajos de impresión (camas)`,partsPrinted:`Piezas impresas`,failedParts:`Piezas fallidas`,import:`Importar`,export:`Exportar`,importProject:`Importar proyecto`,exportAll:`Exportar todos los proyectos`,loading:`Cargando proyectos...`,noEditPermission:`No tiene permiso para editar proyectos`,noDeletePermission:`No tiene permiso para eliminar proyectos`,noCreatePermission:`No tiene permiso para crear proyectos`,noImportPermission:`No tiene permiso para importar proyectos`,noExportPermission:`No tiene permiso para exportar proyectos`,toast:{created:`Proyecto creado`,updated:`Proyecto actualizado`,deleted:`Proyecto eliminado`,imported:`Proyecto importado`,multipleImported:`{{count}} proyectos importados`,importFailed:`Error en la importación`,exported:`Proyectos exportados (solo metadatos)`}},projectDetail:{notFound:`Proyecto no encontrado`,backToProjects:`Volver a Proyectos`,export:`Exportar`,exportProject:`Exportar proyecto`,noExportPermission:`No tiene permiso para exportar proyectos`,noEditPermission:`No tiene permiso para editar proyectos`,partOf:`Parte de:`,priorityLabel:`Prioridad:`,noPrints:`Aún no hay impresiones en este proyecto`,status:{active:`Activo`,completed:`Completado`,archived:`Archivado`},priority:{low:`Baja`,normal:`Normal`,high:`Alta`,urgent:`Urgente`},dueDate:{overdue:`Atrasado`,today:`Vence hoy`,daysLeft:`Quedan {{count}} días`},progress:{platesProgress:`Progreso de camas`,partsProgress:`Progreso de piezas`,setsProgress:`Juegos completos`,sets:`juegos`,setsHint:`Un juego está completo cuando cada archivo imprimible alcanza este número`,printJobs:`trabajos de impresión`,parts:`piezas`,percentComplete:`{{percent}}% completado`,remaining:`{{count}} restantes`},stats:{printJobs:`Trabajos de impresión`,total:`total`,failed:`{{count}} fallidos`,partsPrinted:`{{count}} piezas impresas`,printTime:`Tiempo de impresión`,filamentUsed:`Filamento usado`},cost:{title:`Seguimiento de costes`,filamentCost:`Coste del filamento`,energy:`Energía`,totalCost:`Coste total`,total:`Total`,includesBom:`incl. lista de materiales`,wear:`Desgaste de la impresora`,budget:`Presupuesto`,remaining:`Restante`},subProjects:{title:`Subproyectos ({{count}})`,jobs:`{{count}} trabajos`},rollup:{title:`Incluyendo {{count}} subproyectos`,progress:`Progreso general`,percentComplete:`{{percent}}% completado`},notes:{title:`Notas`,noEditPermission:`No tiene permiso para editar notas`,placeholder:`Añada notas sobre este proyecto...`,empty:`Aún no hay notas. Haga clic en Editar para añadir notas.`},files:{title:`Archivos`,linkFolders:`Vincule carpetas del gestor de archivos`,forQuickAccess:`a este proyecto para un acceso rápido.`,fileCount:`{{count}} archivo(s)`,empty:`No hay carpetas vinculadas. Vaya al gestor de archivos y vincule una carpeta a este proyecto.`,printedCount:`Impreso {{count}} veces`,progressTooltip:`{{done}} de {{target}} impresiones completadas`,noFiles:`No hay archivos en esta carpeta.`},bom:{title:`Lista de materiales`,acquired:`{{completed}}/{{total}} adquiridos`,showAll:`Mostrar todo`,hideDone:`Ocultar los hechos`,addPart:`Añadir pieza`,noAddPermission:`No tiene permiso para añadir piezas`,partNamePlaceholder:`Nombre de la pieza (p. ej., tornillos M3x8)`,partName:`Nombre de la pieza`,qty:`Cant.`,price:`Precio ({{currency}})`,sourcingUrlPlaceholder:`URL de aprovisionamiento (opcional)`,remarksPlaceholder:`Observaciones (opcional)`,deletePart:`Eliminar pieza`,deleteConfirm:`¿Está seguro de que desea eliminar "{{name}}"?`,noUpdatePermission:`No tiene permiso para actualizar piezas`,noEditPermission:`No tiene permiso para editar piezas`,noDeletePermission:`No tiene permiso para eliminar piezas`,totalCost:`Coste total:`,empty:`No hay piezas en la lista de materiales. Añada hardware, componentes electrónicos u otros componentes para hacer el seguimiento de lo que hay que aprovisionar.`},timeline:{title:`Cronología de actividad`,empty:`Aún no hay actividad.`},template:{saveAsTemplate:`Guardar como plantilla`,noCreatePermission:`No tiene permiso para crear plantillas`},queue:{title:`Cola`,viewAll:`Ver todo`,printing:`{{count}} imprimiendo`,queued:`{{count}} en cola`},prints:{title:`Impresiones ({{count}})`},toast:{projectUpdated:`Proyecto actualizado`,partAdded:`Pieza añadida`,partRemoved:`Pieza eliminada`,exportFailed:`Error en la exportación`,projectExported:`Proyecto exportado`,templateCreated:`Plantilla creada`}},system:{title:`Información del sistema`,version:`Versión`,uptime:`Tiempo de actividad`,cpuUsage:`Uso de la CPU`,memoryUsage:`Uso de la memoria`,diskUsage:`Uso del disco`,networkInfo:`Información de la red`,logs:`Registros`,debugMode:`Modo de depuración`,enableDebug:`Activar el registro de depuración`,disableDebug:`Desactivar el registro de depuración`,downloadLogs:`Descargar registros`,clearLogs:`Borrar registros`,dockerInfo:`Información de Docker`,containerName:`Nombre del contenedor`,imageName:`Nombre de la imagen`,platform:`Plataforma`,architecture:`Arquitectura`},sponsors:{sectionTitle:`Independiente y financiado por la comunidad`,tagline:`Bambuddy es gratuito y seguirá siéndolo porque hay quien decide apoyarlo. Sin VC, sin dependencia de la nube.`,viewSupporters:`Ver patrocinadores`,toastPrints:`Has completado {{count}} impresiones con Bambuddy. Bambuddy sigue siendo gratuito gracias a quienes lo apoyan.`,toastCost:`Has rastreado {{total}} de filamento con Bambuddy. Mira quién mantiene el proyecto independiente.`,toastArchives:`{{count}} impresiones archivadas con Bambuddy. Mira quién lo mantiene independiente.`,toastAnniversary:`¡Un año con Bambuddy! Mira quién mantiene el proyecto independiente.`,toastVersionUpdate:`Actualizado a v{{version}}. Bambuddy sigue siendo gratuito gracias a quienes lo apoyan.`,toastBusiness:`¿Usas Bambuddy en {{count}} impresoras? Existe un plan de soporte para equipos: correcciones prioritarias, facturación y contacto directo con el responsable del proyecto.`,businessCta:`Bambuddy para empresas`,businessTitle:`Bambuddy para empresas`,businessTagline:`Estás gestionando {{count}} impresoras. Hay soporte prioritario, licencias comerciales y facturación disponibles para equipos y granjas de impresión.`},library:{title:`Biblioteca de filamentos`,addFilament:`Añadir filamento`,editFilament:`Editar filamento`,deleteFilament:`Eliminar filamento`,vendor:`Proveedor`,material:`Material`,color:`Color`,kFactor:`Factor K`,temperature:`Temperatura`,noFilaments:`No hay filamentos en la biblioteca`,deleteConfirm:`¿Está seguro de que desea eliminar este filamento?`,importFromPrinter:`Importar desde la impresora`,exportToFile:`Exportar a un archivo`,runWithPipeline:{actionLabel:`Ejecutar con pipeline`,noPermission:`No tienes permiso para ejecutar pipelines`,modalTitle:`Ejecutar con pipeline`,confirmTitle:`Confirmar ejecución`,confirmIntro:`El pre-vuelo encontró problemas con esta ejecución`,sourceHint:`Origen`,pipelineHint:`Pipeline`,targetHint:`Destino`,pipelineListAria:`Pipelines disponibles`,runAnyway:`Ejecutar de todos modos`,loading:`Cargando…`,empty:`Aún no hay pipelines guardadas. Abre el diálogo Cortar y haz clic en "Guardar como pipeline" para crear una.`,noTarget:`Sin impresora de destino`,noTargetMessage:`Esta pipeline no tiene impresora de destino. Ábrela en Ajustes para elegir una.`,copies:`Copias`,copiesHint:`máx {{n}}`,classTarget:`Cualquier {{model}}`,toast:{started:`Ejecución de pipeline iniciada`,failed:`No se pudo iniciar la ejecución`},issue:{printerNotSet:`Sin impresora de destino en esta pipeline.`,printerNotFound:`La impresora de destino ya no existe.`,printerDisabled:`La impresora de destino está deshabilitada.`,printerOffline:`La impresora de destino está desconectada.`,filamentType:`Slot de filamento {{slot}}: esperado {{expected}}, AMS tiene {{actual}}`,filamentColor:`Slot de filamento {{slot}}: color distinto (esperado {{expected}}, AMS tiene {{actual}})`,amsSlotMissing:`Slot AMS {{slot}} no disponible en esta impresora`,filamentUnverified:`Slot de filamento {{slot}} proviene de un preset de nube / estándar y no se pudo verificar estáticamente.`,noClassMatches:`Ninguna impresora en esta instalación coincide con la clase de modelo objetivo de la pipeline ({{expected}}).`,classNotSet:`El destino de la pipeline es una clase de impresora pero no se eligió ningún modelo.`}}},slicerSettings:{presetValuesOutdatedSidecar:`Se muestran los valores predeterminados del laminador: tu sidecar es más antiguo que esta función y no puede informar los valores de un perfil. Actualiza la imagen del sidecar para verlos. Todo lo que no cambies seguirá usando el perfil.`,presetValuesNotConfigured:`Se muestran los valores predeterminados del laminador: no hay ningún sidecar configurado, así que no se pueden leer los valores de un perfil. Todo lo que no cambies seguirá usando el perfil.`,presetValuesSidecarUnavailable:`Se muestran los valores predeterminados del laminador: el sidecar no respondió, así que no se pueden leer los valores de un perfil. Todo lo que no cambies seguirá usando el perfil.`,presetValuesUnavailable:`Se muestran los valores predeterminados del laminador: no se pudieron leer los del perfil seleccionado. Todo lo que no cambies seguirá usando el perfil.`,filamentDefault:`Predeterminado`,fromFile:`del archivo`,fromFileHint:`El diseñador cambió esto en el archivo de origen. Su valor es {{value}}.`,fromFilePrinterCoupled:`impresora del diseñador`,fromFilePrinterCoupledHint:`Ajustado para la impresora para la que se diseñó este archivo: en la tuya puede ser incorrecto o estar fuera de rango.`,fromFileOverridesPreset:`anula el perfil`,fromFileOverridesPresetHint:`El archivo lo fija en {{value}} mientras que el perfil elegido usa {{preset}}. Actívalo solo si debe mandar el archivo.`,useFromFile:`Usar el valor del archivo de origen para {{option}}`,otherFromFile:`Otros ajustes de este archivo`,fromFileSummary:`El diseñador cambió {{count}} ajustes de proceso en este archivo. Solo se usan los que marques.`,fromFileUseAll:`Usar los ajustes del diseñador`,fromFileUseAllHint:`Marca los ajustes que se trasladan a otras impresoras. Los ajustados a la impresora del diseñador, y los que definen el perfil que elegiste, quedan sin marcar.`,fromFileClear:`Borrar {{count}}`,loading:`Cargando ajustes del laminador…`,mode:{simple:`Simple`,advanced:`Avanzado`,expert:`Experto`},searchPlaceholder:`Buscar ajustes`,resetAll:`Restablecer {{count}}`,resetOption:`Restablecer al valor predeterminado`,noMatches:`Ningún ajuste coincide con esta búsqueda.`},slice:{filamentSlotUnset:`sin definir`,processSettingsEmbedded:`No se usa mientras «Usar los ajustes integrados del archivo» está activo: los ajustes del propio archivo rigen este corte.`,processSettingsInactive:`Inactivo`,presetsHidden:`{{count}} ocultos`,showAllPresets:`Mostrar todos`,showFewerPresets:`Mostrar menos`,processSettings:`Ajustes de proceso`,processSettingsHint:`Ajusta el perfil seleccionado para este corte. Todo lo que no toques se mantiene como lo define el perfil.`,processSettingsChanged:`{{count}} cambiados`,processSettingsUnchanged:`Valores del perfil`,title:`Laminar modelo`,action:`Laminar`,actionAll:`Laminar las {{count}} bandejas`,actionAllTitle:`Laminar todas las bandejas en una salida única de varias bandejas (un solo archivo). La selección de filamento cubre cada hueco que defina el proyecto.`,allPlatesToggle:`Laminar las {{count}} bandejas`,slicing:`Laminando…`,printer:`Perfil de impresora`,process:`Perfil de proceso`,filament:`Perfil de filamento`,filamentSlot:`Filamento {{index}} ({{type}})`,filamentColour:`Color del filamento`,selectPreset:`— Seleccione un preajuste —`,loadingPresets:`Cargando preajustes…`,analyzingPlateFilaments:`Analizando los filamentos de la cama…`,analyzingPlateFilamentsHint:`Ejecutando un laminado de vista previa para descubrir qué ranuras del AMS usa esta cama. Después se almacena en caché — volver a abrir es instantáneo.`,previewToast:`Analizando {{name}} — {{elapsed}}`,previewWithProgress:`Analizando {{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,notUsedByPlate:`— no usado por esta cama`,noPresetsForSlot:`No hay preajustes disponibles`,otherPrinters:`Otras impresoras`,presetsLoadFailed:`Error al cargar los preajustes. Abra Ajustes → Perfiles para importarlos primero.`,refreshPresets:`Actualizar`,refreshPresetsTitle:`Actualizar preajustes — recuperar los listados más recientes de la nube y los paquetes (úselo tras eliminar un preajuste en Bambu Studio o Bambu Handy)`,allPresetsRequired:`Deben seleccionarse todos los preajustes`,useEmbedded:`Usar la configuración incorporada del archivo`,useEmbeddedHint:`Laminar tal como lo configuró el diseñador (perímetros, relleno, filamento) en lugar de los perfiles de arriba. Disponible porque tu impresora coincide con la del archivo.`,autoOrient:`Orientar los objetos automáticamente`,autoOrientHint:`El laminador gira cada objeto hacia su mejor cara de impresión antes de laminar. Sustituye la orientación del archivo.`,autoArrange:`Organizar automáticamente en la base`,autoArrangeHint:`El laminador coloca los objetos para que dejen de solaparse. Sustituye la disposición del archivo.`,enqueuing:`Enviando el trabajo de laminado…`,queued:`En cola…`,failed:`Error al laminar. Consulte los registros del contenedor auxiliar del laminador.`,startedToast:`Laminando {{name}} en segundo plano…`,queuedToast:`En cola: {{name}} — {{elapsed}}`,runningToast:`Laminando {{name}} — {{elapsed}}`,runningWithProgress:`{{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,runningWithProgressMultiPlate:`Bandeja {{plateIndex}} de {{plateCount}} • {{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,completedToast:`{{name}} laminado`,externalWriteFallbackToast:`Guardado en la biblioteca interna: no se pudo escribir en la carpeta externa`,failedTitle:`Error al laminar`,failedToast:`Error al laminar {{name}}: {{detail}}`,tier:{local:`Importado`,cloud:`Bambu Cloud`,orcaCloud:`Orca Cloud`,standard:`Estándar`},cloud:{notAuthenticated:`Inicie sesión en Bambu Cloud (Ajustes → Perfiles → Bambu Cloud) para ver sus preajustes de la nube.`,expired:`La sesión de Bambu Cloud ha caducado — inicie sesión de nuevo para actualizar sus preajustes de la nube.`,unreachable:`Bambu Cloud no es accesible en este momento. Los preajustes locales y estándar siguen funcionando.`},orcaCloud:{notAuthenticated:`Inicia sesión en Orca Cloud (Perfiles → Orca Cloud) para ver tus preajustes Orca.`,expired:`Sesión de Orca Cloud caducada — inicia sesión de nuevo para actualizar tus preajustes Orca.`,unreachable:`Orca Cloud no está disponible ahora. Otros preajustes siguen funcionando.`},bedType:{label:`Cama de impresión`,auto:`Automático (usar el preajuste de proceso)`,coolPlate:`Cool Plate`,coolPlateSuperTack:`Cool Plate SuperTack`,engineering:`Engineering Plate`,highTemp:`High Temp Plate`,texturedPEI:`Textured PEI Plate`,smoothPEI:`Smooth PEI Plate`},filters:{onlyConnectedModels:`Solo impresoras en línea`,onlyConnectedModelsHint:`Perfiles de impresora de los modelos conectados ahora, en todos los tamaños de boquilla.`,onlyLoadedSpools:`Solo bobinas cargadas`,onlyLoadedSpoolsHint:`Perfiles de filamento de las bobinas en las impresoras conectadas del modelo seleccionado. Un perfil que elijas tú se mantiene.`,noneOnline:`Ninguna impresora está en línea, así que se muestran todos los perfiles.`,noneLoaded:`Ninguna bobina cargada tiene un perfil para esta impresora, así que se muestran todos los perfiles de filamento.`,notOnline:`Sin conexión`,notLoaded:`No cargado`},loadedSpools:{title:`Bobinas cargadas`,pick:`Elegir`,pickTitle:`Elegir una bobina cargada en una impresora conectada`,none:`Ninguna impresora de este modelo está en línea.`,nothingLoaded:`Sin AMS ni bobina externa.`,unknownSpool:`Bobina no identificada`,empty:`Vacío`,noProfile:`Sin perfil para la impresora seleccionada`,noProfileShort:`Sin perfil para esta impresora`},pipelines:{label:`Pipeline`,applyAria:`Aplicar pipeline`,applyPrompt:`Aplicar pipeline…`,empty:`Sin pipelines guardadas`,saveButton:`Guardar como pipeline`,saveTitle:`Guardar la selección actual de los cuatro ajustes como pipeline reutilizable`,namePlaceholder:`Nombre de la pipeline`,nameAria:`Nuevo nombre de pipeline`,toast:{applied:`"{{name}}" aplicada`,saved:`Pipeline guardada`,saveFailed:`Error al guardar`}}},spoolman:{title:`Integración con Spoolman`,enabled:`Spoolman activado`,url:`URL de Spoolman`,connected:`Conectado`,disconnected:`No conectado`,testConnection:`Probar conexión`,sync:`Sincronizar`,syncing:`Sincronizando...`,lastSync:`Última sincronización`,linkToSpoolman:`Vincular a Spoolman`,openInSpoolman:`Abrir en Spoolman`,unlinkSpool:`Desvincular bobina`,unlinkConfirmTitle:`¿Desasignar la bobina?`,unlinkConfirmMessage:`Esto quitará la bobina de esta ranura. Los datos de la bobina en sí permanecerán sin cambios.`,selectSpool:`Seleccionar bobina`,noUnlinkedSpools:`No hay bobinas sin asignar disponibles`,linkSuccess:`Bobina asignada correctamente`,linkFailed:`Error al asignar la bobina`,unlinkSuccess:`Bobina desasignada correctamente`,unlinkFailed:`Error al desasignar la bobina`,linkedSpool:`Bobina asignada`,spoolId:`ID de la bobina`,fillSourceLabel:`(Spoolman)`,weight:`Peso`,remaining:`Restante`,disableWeightSync:`Desactivar la sincronización del peso estimado del AMS`,disableWeightSyncDesc:`No actualizar la capacidad restante a partir de las estimaciones del AMS. Use esto si prefiere el seguimiento del uso de Spoolman a las estimaciones del AMS basadas en porcentajes. Las bobinas nuevas seguirán usando la estimación del AMS como su peso inicial.`,reportPartialUsage:`Informar del uso parcial en las impresiones fallidas`,reportPartialUsageDesc:`Cuando una impresión falla o se cancela, informar del filamento estimado usado hasta ese punto según el progreso de las capas.`},locations:{title:`Ubicaciones de almacenamiento`,subtitle:`Gestione estantes, cajones y otros lugares físicos para sus bobinas`,add:`Añadir ubicación`,addShort:`Añadir`,edit:`Editar ubicación`,name:`Nombre`,spools:`Bobinas`,sensors:`Sensores`,empty:`Aún no hay ubicaciones de almacenamiento. Cree su primer estante o cajón.`,manage:`Ubicaciones`,createPlaceholder:`p. ej. Estante A, Cajón 1`,nameRequired:`El nombre de la ubicación es obligatorio`,created:`Ubicación creada`,updated:`Ubicación actualizada`,deleted:`Ubicación eliminada`,saveFailed:`No se pudo guardar la ubicación`,deleteFailed:`No se pudo eliminar la ubicación`,deleteBlocked:`Retire todas las bobinas de esta ubicación antes de eliminarla`,confirmDelete:`¿Eliminar «{{name}}»?`,confirmDeleteMessage:`Esta ubicación se eliminará del catálogo. Mueva las bobinas primero.`,confirmDeleteMessageWithSensors:`Esta ubicación se eliminará del catálogo. Mueva las bobinas primero. Los sensores conectados también se eliminarán.`},inventory:{title:`Inventario de bobinas`,subtitle:`Gestione sus bobinas`,addToInventory:`Añadir al inventario`,addToInventoryPending:`Añadiendo...`,addToInventorySuccess:`Bobina añadida al inventario`,addToInventoryFailed:`No se pudo añadir la bobina al inventario`,unknownSpoolTitle:`Nuevo filamento detectado`,unknownSpoolMessage:`Se ha detectado una bobina con una etiqueta RFID desconocida en {{location}}. ¿Añadirla a su inventario ahora?`,unknownSpoolSlot:`Ranura`,bulk:{selectAllVisible:`Seleccionar todo lo visible`,selectRow:`Seleccionar fila`,selectGroup:`Seleccionar grupo`,selectionCount:`{{count}} seleccionadas`,edit:`Editar`,printLabels:`Imprimir etiquetas`,resetUsage:`Restablecer uso`,restore:`Restaurar`,archive:`Archivar`,delete:`Eliminar`,clearSelection:`Limpiar selección`,editTitle:`Edición masiva de bobinas`,editSubtitle:`Se aplica a {{count}} bobinas seleccionadas. Solo se actualizan los campos marcados.`,editHint:`Escriba en un campo para marcarlo para actualización — solo se envían las filas marcadas. Los campos vacíos no cambian las bobinas (vaciar campos solo se hace por bobina).`,useCustom:`Usar "{{value}}"`,toggleField:`Activar la actualización de este campo`,changeCount:`Se actualizarán {{count}} campos.`,applyPending:`Aplicando...`,applyButton:`Aplicar a {{count}} bobinas`,deleteTitle:`Eliminar bobinas seleccionadas`,archiveTitle:`Archivar bobinas seleccionadas`,restoreTitle:`Restaurar bobinas seleccionadas`,resetUsageTitle:`Restablecer uso de bobinas seleccionadas`,deleteMessage:`¿Eliminar permanentemente {{count}} bobinas? Esto no se puede deshacer.`,archiveMessage:`¿Archivar {{count}} bobinas? Se pueden restaurar más tarde.`,restoreMessage:`¿Restaurar {{count}} bobinas archivadas?`,resetUsageMessage:`¿Restablecer el contador "Total consumido" en {{count}} bobinas? El peso restante se conserva.`,updateSuccess:`{{count}} bobinas actualizadas`,updateFailed:`Actualización masiva fallida`,updatePartial:`{{ok}} bobinas actualizadas, {{failed}} fallidas`,updateAllFailed:`Las {{count}} actualizaciones fallaron — la selección se mantiene para reintentar`,deleteSuccess:`{{count}} bobinas eliminadas`,deleteFailed:`Eliminación masiva fallida`,deletePartial:`{{ok}} bobinas eliminadas, {{failed}} fallidas`,deleteAllFailed:`Las {{count}} eliminaciones fallaron — la selección se mantiene para reintentar`,archiveSuccess:`{{count}} bobinas archivadas`,archiveFailed:`Archivado masivo fallido`,archivePartial:`{{ok}} bobinas archivadas, {{failed}} fallidas`,archiveAllFailed:`Los {{count}} archivados fallaron — la selección se mantiene para reintentar`,restoreSuccess:`{{count}} bobinas restauradas`,restoreFailed:`Restauración masiva fallida`,restorePartial:`{{ok}} bobinas restauradas, {{failed}} fallidas`,restoreAllFailed:`Las {{count}} restauraciones fallaron — la selección se mantiene para reintentar`,invalidHex:`Introduzca 6 caracteres hex (RRGGBB) u 8 (RRGGBBAA). De lo contrario el campo no se aplicará.`},spoolmanMixedContentTitle:`Spoolman no se puede cargar por HTTPS — contenido mixto bloqueado por su navegador`,spoolmanMixedContentBody:`Bambuddy se sirve por HTTPS (mediante su proxy inverso), pero su URL de Spoolman sigue siendo HTTP sin cifrar. Los navegadores bloquean el contenido mixto por seguridad, por lo que la interfaz integrada de Spoolman no se puede mostrar. Spoolman debe ser accesible por HTTPS para que esto funcione.`,spoolmanMixedContentFixReverseProxy:`Ponga Spoolman tras el mismo proxy inverso que Bambuddy (Traefik / Nginx / Caddy) con HTTPS y luego actualice la URL de Spoolman en Ajustes a la nueva dirección HTTPS.`,spoolmanMixedContentFixOpenNewTab:`Como solución alternativa, abra Spoolman en una pestaña nueva del navegador por HTTP — las reglas de contenido mixto solo se aplican a los marcos integrados, por lo que una pestaña independiente sí funciona.`,spoolmanOpenInNewTab:`Abrir Spoolman en una pestaña nueva`,labels:{title:`Imprimir etiquetas de bobinas`,selectedCount:`{{count}} seleccionadas`,pickSpools:`Elija para qué bobinas imprimir etiquetas:`,monochrome:`Monocromo (impresora en blanco y negro)`,monochromeHint:`Elimina la muestra de color y amplía el texto`,startingPosition:`Posición inicial de la etiqueta`,startingPositionInvalid:`Introduce un número entero del 1 al {{capacity}}.`,startingPositionFirst:`La impresión comienza en la posición 1.`,startingPositionSkipped:`Las posiciones 1 a {{lastPosition}} quedarán vacías en la primera hoja.`,searchPlaceholder:`Buscar nombre, marca o n.º de ID`,filterByMaterial:`Material:`,allMaterials:`Todos`,selectVisible:`Seleccionar todas las visibles ({{count}})`,deselectVisible:`Deseleccionar las visibles`,clearAll:`Borrar todo`,noSpoolsToShow:`No hay bobinas que mostrar. Ajuste su filtro e inténtelo de nuevo.`,noMatches:`Ninguna bobina coincide con la búsqueda o el filtro actuales.`,printOne:`Imprimir etiqueta para esta bobina`,printLabels:`Imprimir etiquetas…`,bulkTitle:`Elija las bobinas para las que imprimir etiquetas de las {{count}} mostradas actualmente`,noSpoolsTitle:`No hay bobinas que etiquetar`,error:`No se pudieron generar las etiquetas: {{msg}}`,template:`Tamaño de etiqueta`,preview:`Vista previa`,previewOf:`Vista previa de #{{id}}`,previewNoSelection:`Selecciona una bobina para ver su etiqueta.`,previewError:`No se pudo generar la vista previa: {{msg}}`,previewAlt:`Vista previa de la etiqueta`,previewHint:`Las líneas que no caben en este tamaño de etiqueta se omiten.`,content:`Imprimir en la etiqueta`,resetFields:`Restablecer valores predeterminados`,format:`Salida:`,dpi:`Resolución`,pngHint:`Para software de impresoras de etiquetas que usa imágenes. Elige la resolución de tu impresora; varias etiquetas se descargan como ZIP.`,createPdf:`Crear PDF`,downloadPng:`Descargar PNG`,selectedTitle:`Imprimir etiquetas para las {{count}} bobinas seleccionadas`,fields:{brand:`Marca`,material:`Material y subtipo`,hex:`Código de color`,name:`Nombre del color o filamento`,location:`Ubicación de almacenamiento`,materialNumber:`Número de material`,temps:`Temperatura de la boquilla`,weight:`Peso neto`,note:`Nota`,added:`Fecha de alta`,qr:`Código QR`,spoolId:`ID de bobina`},sortBy:{label:`Ordenar:`,id:`Por ID`,color:`Por color`},templates:{amsHolderSmall:{label:`Soporte de AMS — pequeño (74 × 33 mm)`,hint:`Una etiqueta por página; coincide con la etiqueta imprimible del modelo 752566 de MakerWorld (AMS Filament Label Holder).`},amsHolderLarge:{label:`Soporte de AMS — grande (75 × 55 mm)`,hint:`Una etiqueta por página; encaja en la variante con inserto de cartulina del AMS Filament Label Holder. Lo bastante amplia para muestra de color, marca, material, ID y código QR.`},box40x30:{label:`Etiqueta de caja (40 × 30 mm)`,hint:`Una etiqueta por página; tamaño de rollo DK/Brother habitual, adecuado para etiquetas de bolsas de filamento y cajas de almacenamiento.`},box:{label:`Box label (62 × 29 mm)`,hint:`Una etiqueta por página; dimensionada para las etiquetas pequeñas de Brother PT/QL y Dymo.`},averyL7160:{label:`Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)`,hint:`Hojas de tamaño UE; 21 etiquetas por página A4.`},avery5160:{label:`Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)`,hint:`Hojas de tamaño EE. UU.; 30 etiquetas por página Letter.`}}},csv:{importButton:`Importar CSV`,exportButton:`Exportar CSV`,modalTitle:`Importar bobinas desde CSV`,selectFile:`Elige un archivo CSV o arrástralo aquí`,dragHint:`Encabezado: material (obligatorio), brand, subtype, color_name, rgba, …`,parsing:`Leyendo archivo…`,previewError:`No se pudo leer el archivo CSV`,validCount:`{{count}} válidas`,errorCount:`{{count}} con error`,skippedCount:`{{count}} omitidas`,colRow:`Fila`,colStatus:`Estado`,colColor:`Color`,colorResolved:`Color rellenado desde el catálogo`,colorCrossMaterial:`Color tomado de un material diferente — sin coincidencia exacta en el catálogo`,duplicateExisting:`Ya existe una bobina con este material, marca y color — se importará igualmente como una bobina nueva`,spoolmanHint:`En modo Spoolman, usa la importación/exportación CSV integrada de Spoolman.`,importValidRows:`Importar {{count}} filas válidas`,noValidRows:`Sin filas válidas`,importing:`Importando…`,importSuccess:`{{count}} bobinas importadas`,importError:`Error al importar`,exportError:`Error al exportar`},addSpool:`Añadir bobina`,editSpool:`Editar bobina`,copySpool:`Copiar bobina`,material:`Material`,selectMaterial:`Seleccionar material...`,subtype:`Subtipo`,brand:`Marca`,searchBrand:`Buscar marca...`,useCustomBrand:`Usar "{{brand}}"`,useCustomMaterial:`Usar material personalizado: {{material}}`,suggestedOptions:`Sugeridos`,allOptions:`Todos`,colorName:`Nombre del color`,colorNamePlaceholder:`Blanco jade, Rojo fuego...`,color:`Color`,hexColor:`Color hexadecimal`,pickColor:`Elegir color personalizado`,labelWeight:`Peso de la etiqueta`,coreWeight:`Peso de la bobina vacía`,searchSpoolWeight:`Buscar peso de la bobina...`,weightUsed:`Usado`,currentWeight:`Peso restante`,measuredWeight:`Peso medido`,spoolName:`Bobina`,costPerKg:`Coste por kg`,storageLocation:`Ubicación de almacenamiento`,temperature:`Temperatura`,humidity:`Humedad`,battery:`Batería`,storageLocationPlaceholder:`p. ej. Estante A, Cajón 1`,openInInventory:`Abrir en el inventario`,measuredWeightError:`El peso medido debe estar entre {{min}} g y {{max}} g.`,slicerFilament:`Filamento del laminador`,slicerFilamentName:`Nombre del preajuste del laminador`,slicerPreset:`Preajuste del laminador`,searchPresets:`Buscar preajustes de filamento...`,selectedPreset:`Seleccionado`,noPresetsFound:`No se encontraron preajustes`,tempOverrides:`Anulaciones de temperatura`,note:`Nota`,notePlaceholder:`Cualquier nota adicional sobre esta bobina...`,category:`Categoría`,categoryPlaceholder:`p. ej. Producción, Prototipo, Cliente A`,categoryNone:`Sin categoría`,storageLocationNone:`Sin ubicación establecida`,lowStockThresholdOverride:`Umbral de existencias bajas (esta bobina)`,lowStockThresholdOverrideHelp:`Déjelo en blanco para usar el umbral global ({{global}}%).`,materialNumber:`N.º de material`,materialNumberPlaceholder:`p. ej. 15`,materialNumberHelp:`Número interno de compras: compartido por todas las bobinas de este producto. Las bobinas nuevas del mismo producto lo heredan.`,lastDried:`Último secado`,lastDriedNow:`Ahora`,lastDriedHelp:`Se rellena cuando termina un secado en el AMS que ha durado al menos la mitad de su duración. Indícalo aquí para una bobina secada en otro sitio.`,materialNumberNone:`Sin número de material`,suppliers:{label:`Proveedores`,none:`Sin proveedor`,addSupplier:`Añadir proveedor…`,searchPlaceholder:`Buscar proveedores…`,noneLeft:`Todos los proveedores ya están asignados`,createNew:`Crear "{{name}}"`,createFailed:`Error al crear el proveedor`,purchaseSource:`Comprado aquí`,purchaseSourceHelp:`Indica dónde se compró realmente esta bobina; las demás entradas son fuentes alternativas.`,articleNumberPlaceholder:`N.º de artículo del proveedor`,pricePlaceholder:`Precio ofertado/kg`,priceHelp:`Precio ofertado por este proveedor, para comparar fuentes; el coste por kg de la propia bobina sigue siendo la base de coste.`,help:`Dónde se puede comprar este producto. La entrada resaltada es donde se compró esta bobina.`,saveFailed:`Error al guardar las asignaciones de proveedores`,title:`Proveedores`,description:`Gestione dónde compra el filamento, algo distinto de la marca, que indica quién lo fabricó. Asigne proveedores a las bobinas en el diálogo de bobina; un proveedor que siga asignado a bobinas no se puede eliminar.`,search:`Buscar proveedores...`,addNew:`Añadir nuevo proveedor`,namePlaceholder:`Nombre (p. ej. Filament24)`,websitePlaceholder:`Sitio web / URL de la tienda`,customerNumberPlaceholder:`N.º de cliente`,notePlaceholder:`Nota`,nameRequired:`El nombre es obligatorio`,duplicateName:`Ya existe un proveedor con este nombre`,customerNumber:`N.º de cliente`,spools:`Bobinas`,noMatch:`Ningún proveedor coincide con su búsqueda`,empty:`Aún no hay proveedores`,added:`Proveedor añadido`,addFailed:`Error al añadir el proveedor`,updated:`Proveedor actualizado`,updateFailed:`Error al actualizar el proveedor`,deleted:`Proveedor eliminado`,deleteFailed:`Error al eliminar el proveedor`,deleteBlocked:`No se puede eliminar: sigue asignado a {{count}} bobina(s)`,loadFailed:`Error al cargar los proveedores`,deleteTitle:`Eliminar proveedor`,deleteConfirm:`¿Eliminar "{{name}}"?`,deleteConfirmReferenced:`"{{name}}" está asignado a {{count}} bobina(s). La eliminación está bloqueada hasta que se quiten esas asignaciones.`},clearRfid:`Borrar etiqueta RFID`,rfidCleared:`Etiqueta RFID borrada`,archive:`Archivar`,restore:`Restaurar`,noSpools:`Aún no hay bobinas. Añada su primera bobina para empezar.`,noAvailableSpools:`No hay bobinas disponibles. Añada una bobina a su inventario o desasigne una de otra ranura primero.`,kProfiles:`Perfiles K`,addKProfile:`Añadir perfil K`,assignSpool:`Asignar bobina`,unassignSpool:`Desasignar`,assignSuccess:`Bobina asignada y ranura del AMS configurada`,assignPendingInsert:`Asignada. La ranura se configurará cuando inserte la bobina.`,assignFailed:`Error al asignar la bobina`,selectSpool:`Seleccione una bobina para asignar a esta ranura`,assigned:`Asignada`,assigning:`Asignando...`,searchSpools:`Buscar bobinas...`,showAllSpools:`Mostrar todas las bobinas`,spoolmanSpools:`Bobinas de Spoolman`,allMaterials:`Todos los materiales`,filterByBrand:`Filtrar por marca...`,showArchived:`Mostrar archivadas`,quickAdd:`Añadir rápido (existencias)`,quantity:`Cantidad`,stock:`Existencias`,configured:`Configurada`,spoolsCreated:`{{count}} bobinas creadas`,spoolsPartiallyCreated:`{{created}} de {{total}} bobinas creadas (algunas fallaron)`,spoolCreated:`Bobina creada`,spoolUpdated:`Bobina actualizada`,spoolDeleted:`Bobina eliminada`,deepLinkSpoolNotFound:`Bobina no encontrada`,deepLinkFetchFailed:`No se pudo cargar la bobina — inténtelo de nuevo`,spoolArchived:`Bobina archivada`,spoolRestored:`Bobina restaurada`,kProfileSaveFailed:`No se pudieron guardar los ajustes del perfil K`,syncWeightSpoolNotFound:`Bobina no encontrada — es posible que se haya eliminado`,syncWeightSpoolmanUnreachable:`Spoolman no es accesible — inténtelo más tarde`,syncWeightFailed:`Error al sincronizar el peso`,spoolmanUnreachable:`Spoolman no es accesible — inténtelo de nuevo más tarde`,deleteSpoolNotFound:`Bobina no encontrada — es posible que ya se haya eliminado`,deleteFailed:`Error al eliminar la bobina`,archiveSpoolNotFound:`Bobina no encontrada — es posible que ya se haya eliminado`,archiveFailed:`Error al archivar la bobina`,restoreSpoolNotFound:`Bobina no encontrada — es posible que ya se haya eliminado`,restoreFailed:`Error al restaurar la bobina`,saveFailed:`Error al guardar los cambios`,tagClearFailed:`Error al borrar la etiqueta`,deleteConfirm:`¿Está seguro de que desea eliminar esta bobina? Esto no se puede deshacer.`,archiveConfirm:`¿Está seguro de que desea archivar esta bobina?`,advancedSettings:`Ajustes avanzados`,filamentInfoTab:`Información del filamento`,paProfileTab:`Perfil PA`,colorAndCostTab:`Color y coste`,printersTab:`Impresoras`,filamentInfo:`Filamento`,additional:`Adicional`,loadingPresets:`Cargando preajustes de la nube...`,cloudConnected:`Nube conectada`,cloudNotConnected:`Nube no conectada (usando los valores predeterminados)`,recentColors:`Recientes`,searchColors:`Buscar colores...`,searchResults:`Resultados de búsqueda`,allColors:`Todos los colores`,commonColors:`Colores comunes`,showLess:`Mostrar menos`,showAll:`Mostrar todos`,noColorsFound:`Ningún color coincide con su búsqueda`,noResults:`No se encontraron coincidencias`,extraColorsLabel:`Colores adicionales`,extraColorsPlaceholder:`EC984C,#6CD4BC,A66EB9,D87694`,extraColorsHint:`Pegue de 2 a 8 paradas hexadecimales, separadas por comas. Se muestra como un degradado.`,extraColorsInvalid:`Se ignoró el hexadecimal no válido: {{tokens}}`,colorEffectLabel:`Efecto`,colorEffect:{none:`Ninguno`,sparkle:`Destellos`,wood:`Madera`,marble:`Mármol`,glow:`Brillante en la oscuridad`,matte:`Mate`,silk:`Seda`,galaxy:`Galaxia`,rainbow:`Arcoíris`,metal:`Metal`,translucent:`Translúcido`,gradient:`Degradado`,dualColor:`Bicolor`,triColor:`Tricolor`,multicolor:`Multicolor`},selectMaterialFirst:`Seleccione primero un material en la pestaña de información del filamento.`,noPrintersConfigured:`No hay impresoras configuradas. Añada impresoras para usar perfiles PA.`,matchingFilter:`Coincidentes`,anyBrand:`Cualquier marca`,anyVariant:`Cualquier variante`,autoSelect:`Selección automática`,matches:`coincidencias`,match:`coincidencia`,noMatches:`Sin coincidencias`,connected:`Conectada`,offline:`Desconectada`,printerOffline:`La impresora está desconectada. Conéctela para ver los perfiles de calibración.`,noKProfilesMatch:`Ningún perfil K coincide con el filamento seleccionado.`,leftNozzle:`Boquilla izquierda`,rightNozzle:`Boquilla derecha`,profilesSelected:`perfil(es) de calibración seleccionado(s)`,filamentPreset:`Perfil de filamento`,presetUseSpoolDefault:`Usar el perfil de la bobina`,presetInherited:`heredado`,presetOverride:`personalizado`,presetNeedsModel:`Esta impresora aún no ha indicado su modelo, así que no puede tener su propio perfil.`,autoMatchPresets:`Asignar automáticamente`,autoMatchPresetsHint:`Buscar la variante del perfil de la bobina que nombra cada modelo`,kProfilesPerPrinter:`Perfiles K`,kProfileNotSet:`Sin definir`,kProfileFlowMismatch:`Este perfil se midió con una boquilla {{profile}} pero hay montada una {{fitted}}, así que no se aplicará`,nozzle:`Boquilla`,unknownModel:`Modelo desconocido`,onePrinter:`1 impresora`,nPrinters:`{{n}} impresoras`,filamentPresetsLoadFailed:`No se pudieron cargar los perfiles por modelo de esta bobina`,filamentPresetSaveFailed:`No se pudieron guardar los perfiles por modelo`,totalInventory:`Inventario total`,totalConsumed:`Total consumido`,byMaterial:`Por material`,inPrinter:`En la impresora`,lowStock:`Existencias bajas`,sinceTracking:`Desde que comenzó el seguimiento`,resetConsumedCounter:`Restablecer contador`,resetConsumedCounterTooltip:`Poner a cero el contador de gramos consumidos de esta bobina. El peso restante no cambia.`,resetConsumedCounterConfirm:`¿Restablecer a 0 el contador de gramos consumidos de esta bobina? Las impresiones futuras volverán a contar desde cero. La bobina en sí, su cálculo de peso restante y sus ajustes no cambian.`,resetAllConsumedCounters:`Restablecer todos los contadores`,resetAllConsumedCountersTooltip:`Poner a cero el contador de gramos consumidos de todas las bobinas. Los pesos restantes no cambian.`,resetAllConsumedCountersConfirm:`¿Restablecer a 0 el contador de gramos consumidos de las {{count}} bobinas (incluidas las archivadas)? Esto borra la estadística «Total consumido» para que las impresiones futuras cuenten desde cero. Las bobinas y los pesos restantes no cambian.`,consumedCounterReset:`Contador restablecido`,allConsumedCountersReset:`Contador restablecido para {{count}} bobina(s)`,resetConsumedCounterFailed:`Error al restablecer el contador`,loadedInAms:`Cargada en AMS/ext.`,remaining:`Restante`,weightCheck:`Comprobación de peso`,lastWeighed:`Pesada por última vez`,neverWeighed:`Nunca pesada`,search:`Buscar bobinas...`,showing:`Mostrando`,to:`a`,of:`de`,show:`Mostrar`,spools:`bobinas`,spool:`bobina`,page:`Página`,noSpoolsMatch:`No se encontraron resultados`,noSpoolsMatchDesc:`Pruebe a ajustar su búsqueda o sus filtros para encontrar lo que busca.`,active:`Activas`,archived:`Archivadas`,all:`Todas`,used:`Usada`,new:`Nueva`,clearFilters:`Borrar filtros`,table:`Tabla`,cards:`Tarjetas`,net:`Neto`,groupSimilar:`Agrupar`,groupedSpools:`{{count}} bobinas idénticas`,groupedRows:`filas`,columns:`Columnas`,configureColumns:`Configurar columnas`,configureColumnsDesc:`Arrastre para reordenar las columnas o use las flechas. Conmute la visibilidad con el icono del ojo.`,visible:`visibles`,reset:`Restablecer`,cancel:`Cancelar`,applyChanges:`Aplicar cambios`,moveUp:`Subir`,moveDown:`Bajar`,hideColumn:`Ocultar columna`,showColumn:`Mostrar columna`,linkToSpool:`Vincular a bobina`,tagLinked:`Etiqueta vinculada a la bobina`,tagLinkFailed:`Error al vincular la etiqueta`,tagAlreadyLinked:`La etiqueta ya está vinculada a la bobina #{{id}}`,unknownTag:`Se detectó una etiqueta RFID desconocida`,usageHistory:`Historial de uso`,noUsageHistory:`Aún no se ha registrado ningún uso`,printName:`Nombre de la impresión`,weightConsumed:`Peso consumido`,clearHistory:`Borrar`,historyCleared:`Historial de uso borrado`,fillSourceLabel:`(Inv.)`,lowStockThresholdError:`El umbral debe estar entre 0,1 y 99,9`,assignMismatchTitle:`Discrepancia de material`,assignMismatchMessage:`El material de la bobina seleccionada "{{spoolMaterial}}" no coincide con el material de la bandeja "{{trayMaterial}}" de {{location}}. ¿Asignar de todos modos?`,assignMismatchConfirm:`Asignar de todos modos`,assignPartialMismatchMessage:`El material de la bobina "{{spoolMaterial}}" es similar pero no coincide exactamente con "{{trayMaterial}}" en {{location}}. ¿Desea continuar?`,assignProfileMismatchMessage:`El perfil de la bobina "{{spoolProfile}}" no coincide con el perfil de la bandeja "{{trayProfile}}" en {{location}}. ¿Desea continuar?`,assignReconfigureNote:`La ranura del AMS se reconfigurará para usar el perfil de la bobina.`,spoolmanFilamentCatalog:`Catálogo de filamentos de Spoolman`,pickFromSpoolmanCatalog:`Elegir del catálogo de Spoolman…`,spoolmanFilamentSelected:`Filamento seleccionado del catálogo de Spoolman`,spoolmanFilamentUnlinked:`Vínculo del catálogo de filamentos borrado`,noSpoolmanFilaments:`No se encontraron filamentos en el catálogo de Spoolman`,spoolmanFilamentColorSwatch:`Color del filamento`,spoolmanCatalogLoadFailed:`Error al cargar el catálogo de filamentos de Spoolman`},timelapse:{title:`Time-lapse`,create:`Crear time-lapse`,download:`Descargar`,delete:`Eliminar`,preview:`Vista previa`,frameRate:`Velocidad de fotogramas`,quality:`Calidad`,processing:`Procesando...`,noTimelapses:`No hay time-lapses disponibles`},ams:{title:`AMS`,slot:`Ranura`,empty:`Vacía`,emptySlot:`Ranura vacía`,slotEmpty:`Vacía`,slotUnconfigured:`?`,emptySlotReset:`No hay filamento asignado`,unknown:`Desconocido`,humidity:`Humedad`,temperature:`Temperatura`,filamentType:`Tipo de filamento`,filamentColor:`Color`,remaining:`Restante`,history:`Historial del AMS`,noHistory:`No hay historial disponible`,configureSlot:`Configurar ranura`,externalSpool:`Bobina externa`,profile:`Perfil`,kFactor:`Factor K`,kFactorShort:`K`,fill:`Rellenar`,configure:`Configurar`,used:`usado`,remainingUnit:`restante`},printModal:{variants:{editNote:`Estas alternativas se fijaron al poner el trabajo en cola. Cancela y vuelve a encolar para cambiarlas.`,title:`Alternativas de impresora`,help:`Un trabajo, un puesto en la cola. La primera impresora compatible que quede libre imprime su archivo.`,unknownModel:`Modelo desconocido`,plateFor:`Placa para {{filename}}`,moveUp:`Subir`,moveDown:`Bajar`,queued:`En cola con {{count}} alternativas`},selectPrinter:`Seleccionar impresora`,selectPlate:`Seleccionar cama`,filamentMapping:`Mapeo de filamentos`,useArchiveMapping:`Mapeo`,useArchiveMappingTooltip:`Selecciona todas las ranuras a partir del mapeo de AMS guardado con este archivo (del slicer), en lugar de emparejar por tipo/color.`,clickToChangeSlot:`Haga clic para cambiar la asignación de ranura`,reRead:`Releer`,plateN:`Cama {{n}}`,plateFilamentsUnreadable:`No se han podido leer los filamentos de una cama seleccionada, por lo que no se puede asignar. Deselecciónala para encolar las demás.`,totalCost:`Coste total:`,slotRemainingShort:` - quedan {{grams}} g`,printSettings:`Ajustes de impresión`,bedLeveling:`Nivelación de la cama`,flowCalibration:`Calibración del flujo`,vibrationCalibration:`Calibración de vibración`,layerInspection:`Inspección de la primera capa`,timelapse:`Time-lapse`,cancel:`Cancelar`,noPrintersAvailable:`No hay impresoras disponibles`,printerBusy:`La impresora está ocupada`,printerOffline:`La impresora está desconectada`,sameTypeDifferentColor:`Mismo tipo, color distinto`,filamentTypeNotLoaded:`Tipo de filamento no cargado`,statusReady:`Listo`,statusColorMismatch:`Color distinto`,statusTypeNotFound:`Tipo no encontrado`,requiredTooltip:`Requerido: {{name}} - {{color}}`,manuallySelected:`Seleccionado manualmente`,autoMatched:`Emparejado automáticamente`,selectSlot:`Elegir ranura`,exactColorMatch:`Coincidencia exacta de color`,slotForFilament:`Ranura de impresora para {{name}}`,overrideForFilament:`Anulación de filamento para {{name}}`,sameTypeDifferentColorDetail:`Mismo tipo, color distinto: necesita {{required}}, la ranura tiene {{loaded}}`,requiredTypeNotInPrinter:`El tipo de filamento requerido no se encuentra en la impresora.`,whenToPrint:`Cuándo imprimir`,asap:`Lo antes posible`,queue:`Cola`,schedule:`Programar`,dateTime:`Fecha y hora`,invalidDateTime:`Introduzca una fecha y hora válidas`,openCalendar:`Abrir calendario`,requireManualStart:`Requerir inicio manual`,awaitingReviewNote:`Tu impresión espera revisión: empieza cuando alguien que gestiona la cola la inicie.`,requirePreviousSuccess:`Iniciar solo si la impresión anterior se completó correctamente`,autoOffAfter:`Apagar la impresora al terminar`,helpAsap:`La impresión se añadirá al principio de la cola y comenzará en cuanto haya una impresora elegible inactiva.`,helpSchedule:`La impresión comenzará a la hora programada si la impresora está inactiva. Si está ocupada, esperará hasta que esté disponible.`,helpQueue:`La impresión se añadirá al final de la cola.`,leftNozzle:`I`,rightNozzle:`D`,leftNozzleTooltip:`Boquilla izquierda`,rightNozzleTooltip:`Boquilla derecha`,ftsSameInletHint:`Todos los filamentos de esta impresión están en el conmutador de ruta de filamento IN-{{inlet}}. Cambiar entre filamentos de la misma entrada es más lento: mueve uno a un AMS de la otra entrada.`,rackPosition:`Posición del carro`,rackPositionTooltip:`Qué boquilla del carro imprime este filamento. Las posiciones se numeran como en la impresora.`,rackEmptyPosition:`Esta posición del carro está vacía`,rackWrongNozzle:`Tiene una boquilla {{has}}; este filamento necesita {{needs}}`,filamentOverride:`Anulación de filamento`,filamentOverrideHint:`Anule opcionalmente los filamentos para la asignación basada en el modelo. El planificador comparará con los filamentos que ha seleccionado en lugar de los valores originales del 3MF.`,originalFilament:`Original`,overrideWith:`Anular con`,resetToOriginal:`Restablecer al original`,insufficientFilamentTitle:`No hay suficiente filamento`,waitingForAmsStatus:`Esperando el estado del AMS de {{printer}}…`,insufficientFilamentMessage:`Algunas bobinas asignadas tienen menos filamento restante del que necesita esta impresión:`,insufficientFilamentLine:`{{printer}} - {{slot}}: necesita {{required}} g, restante {{remaining}} g`,insufficientFilamentLinePooled:`{{printer}} - {{slot}}: necesita {{required}} g, {{remaining}} g disponibles entre bobinas equivalentes (AMS Filament Backup)`,printAnyway:`Imprimir de todos modos`,forceColorMatch:`Forzar la coincidencia de color`,staggerPrinterStarts:`Escalonar los inicios de las impresoras`,staggerGroupSize:`Tamaño de grupo`,staggerInterval:`Intervalo (min)`,staggerPreview:`{{printers}} impresoras → {{groups}} grupos de {{size}}, iniciando cada {{interval}} min`,staggerLastGroup:`último grupo: {{count}}`,staggerTotal:`total: {{minutes}} min`,staggerToPrinters:`Escalonar en {{count}} impresoras`,gcodeInjection:`Inyectar G-code de impresión automática`,insufficientBudget:`Presupuesto insuficiente`,unlimitedNoBudget:`Ilimitado: no se ha establecido ningún límite de presupuesto.`,noPrintableCostCenters:`No hay ningún centro de costes activo disponible para imprimir. Pide a un administrador que te conceda acceso de impresión.`,askForOutcome:`Preguntar el resultado`,askForOutcomeTitle:`Preguntar cómo salió la impresión al terminar`},backup:{includesEncryptionKey:`Las copias de seguridad locales incluyen el archivo de clave de cifrado de MFA (DATA_DIR/.mfa_encryption_key) para que un ZIP de copia de seguridad sea autónomo. Trate el ZIP como información sensible — cualquiera que tenga el archivo puede descifrar los secretos de cliente de OIDC y los secretos TOTP que contiene.`,title:`Copia de seguridad y restauración`,createBackup:`Crear copia de seguridad`,restoreBackup:`Restaurar copia de seguridad`,restoreDescription:`Reemplazar todos los datos desde un archivo de copia de seguridad`,downloadBackup:`Descargar copia de seguridad`,uploadBackup:`Subir copia de seguridad`,lastBackup:`Última copia de seguridad`,autoBackup:`Copia de seguridad automática`,backupNow:`Hacer copia de seguridad ahora`,restoreWarning:`Advertencia: restaurar una copia de seguridad sobrescribirá todos los datos actuales.`,includeArchives:`Incluir archivos`,includeSettings:`Incluir ajustes`,includeProfiles:`Incluir perfiles`,backupSuccess:`Copia de seguridad creada correctamente`,restoreSuccess:`Copia de seguridad restaurada correctamente`,backupFailed:`Error en la copia de seguridad`,restoreFailed:`Error en la restauración`,restoreNote:`La impresora virtual se detendrá durante la restauración`,githubBackup:`Copia de seguridad en Git`,enabled:`Activada`,cloudLoginRequired:`Se requiere iniciar sesión en Bambu Cloud. Inicie sesión en Perfiles → Perfiles en la nube para activar la copia de seguridad en GitHub.`,cloudLoginRequiredShort:`Se requiere iniciar sesión en la nube`,githubDescription:`Sincronice automáticamente sus perfiles con un repositorio privado de GitHub para la copia de seguridad y el historial de versiones.`,repoIsPrivate:`El repositorio es privado — es seguro hacer copias de seguridad en él.`,repoIsPublicWarning:`El repositorio es PÚBLICO. Las copias de seguridad de Bambuddy incluyen credenciales de MQTT, tokens de Home Assistant, tokens de Prometheus, su correo de Bambu Cloud y los códigos de acceso de las impresoras mediante los perfiles K. El guardado está bloqueado hasta que haga el repositorio privado en los ajustes de su proveedor.`,repoVisibilityUnknown:`No se pudo determinar la visibilidad del repositorio. Bambuddy se niega a hacer copias de seguridad en cualquier cosa que no se confirme como privada; el guardado se bloqueará.`,repositoryUrl:`URL del repositorio`,repoUrlPlaceholderGitHub:`https://github.com/username/repo-name`,repoUrlPlaceholderGitea:`https://gitea.example.com/username/repo-name`,repoUrlPlaceholderForgejo:`https://forgejo.example.com/username/repo-name`,repoUrlPlaceholderGitLab:`https://gitlab.com/username/repo-name`,allowInsecureHttp:`Permitir HTTP no seguro`,allowInsecureHttpHint:`Actívelo para instancias autoalojadas en redes privadas sin TLS`,personalAccessToken:`Token de acceso personal`,tokenSaved:`(guardado)`,enterNewToken:`Introduzca un nuevo token para actualizar`,tokenHintGitHub:`Token de granularidad fina con acceso de lectura y escritura a Contents, o token clásico con el ámbito repo.`,tokenHintGitLab:`Token con el ámbito api, o read_repository junto con write_repository.`,tokenHintGitea:`Token con el ámbito write:repository.`,tokenHintForgejo:`Token con el ámbito write:repository. Basta con un token limitado a este único repositorio.`,branch:`Rama`,provider:`Proveedor de Git`,providerGitHub:`GitHub`,providerGitLab:`GitLab`,providerGitea:`Gitea`,providerForgejo:`Forgejo`,manualOnly:`Solo manual`,hourly:`Cada hora`,daily:`Diaria`,weekly:`Semanal`,includeInBackup:`Incluir en la copia de seguridad`,kProfiles:`Perfiles K`,kProfilesDescription:`Calibración de avance de presión de las impresoras conectadas`,noPrintersConnected:`No hay impresoras conectadas`,printersConnected:`{{connected}}/{{total}} conectadas`,cloudProfiles:`Perfiles en la nube`,cloudProfilesDescription:`Preajustes de filamento, impresora y proceso de Bambu Cloud y Orca Cloud`,cloudProfilesAccounts:`Cuentas conectadas — Bambu Cloud: {{bambu}}, Orca Cloud: {{orca}}`,appSettings:`Ajustes de la aplicación`,appSettingsDescription:`Configuración de Bambuddy (base de datos completa)`,spoolInventory:`Inventario de bobinas`,spoolInventoryDescription:`Bobinas de filamento, historial de uso y seguimiento de costes`,printArchives:`Archivos de impresión`,printArchivesDescription:`Metadatos del historial de impresión (sin archivos gcode/3MF)`,lastBackupAt:`Última copia de seguridad:`,noBackupsYet:`Aún no hay copias de seguridad`,next:`Siguiente:`,startingBackup:`Iniciando la copia de seguridad...`,test:`Probar`,enableBackup:`Activar la copia de seguridad`,testConnection:`Probar conexión`,enterRepoUrl:`Introduzca la URL del repositorio`,enterRepoAndToken:`Introduzca la URL del repositorio y el token de acceso`,repoRequired:`La URL del repositorio es obligatoria`,tokenRequired:`El token de acceso es obligatorio`,githubBackupEnabled:`Copia de seguridad en GitHub activada`,tokenUpdated:`Token actualizado`,settingsSaved:`Ajustes guardados`,failedToSave:`Error al guardar: {{message}}`,backupCompleteFiles:`Copia de seguridad completada - {{count}} archivos actualizados`,backupSkippedNoChanges:`Copia de seguridad omitida - sin cambios`,backupFailed2:`Error en la copia de seguridad: {{message}}`,clearedLogs:`Se borraron {{count}} registros`,failedToClearLogs:`Error al borrar los registros: {{message}}`,restoreFromGit:{button:`Restaurar desde Git`,title:`Restaurar desde copia de Git`,subtitle:`Elige un commit y qué se debe restaurar`,commitLabel:`Commit de la copia`,latestCommit:`Última copia (punta de la rama)`,categoriesLabel:`Qué restaurar`,inspecting:`Leyendo el contenido de la copia...`,itemCount:`{{count}} en la copia`,overwriteLabel:`Sobrescribir entradas existentes`,overwriteOn:`Las entradas existentes se actualizarán desde la copia.`,overwriteOff:`Solo se añaden las entradas que falten; las existentes no se modifican.`,selectedCount:`{{count}} seleccionados`,restoring:`Restaurando...`,confirmTitle:`¿Restaurar desde la copia?`,confirmMessage:`Las categorías seleccionadas se restaurarán desde este commit. Se añaden las entradas que falten y las existentes se mantienen igual.`,confirmMessageOverwrite:`Las categorías seleccionadas se restaurarán desde este commit y se sobrescribirán las entradas que ya existan localmente. Esto no se puede deshacer.`,kprofilesOverwriteCaveat:`Los perfiles K son la excepción: escribir una ranura siempre reemplaza la calibración en la impresora.`,tally:`{{restored}} restaurados, {{skipped}} omitidos, {{failed}} fallidos`,reloadHint:`Recarga Bambuddy para que los datos restaurados aparezcan en todas partes.`,partialHint:`Las categorías indicadas arriba se completaron y están guardadas. Las que faltan no llegaron a ejecutarse.`,failed:`La restauración ha fallado.`,loadFailed:`No se pudo leer el repositorio de copias de seguridad.`,details:{notPresent:`No está presente en este commit de la copia`,unreadableJson:`JSON ilegible: {{paths}}`,settingsNoPayload:`No hay ajustes en los datos`,settingsCredentialsWillSkip:`Se omitirán {{count}} claves con aspecto de credencial`,settingsCompanionWillSkip:`Se omitirán {{count}} claves con aspecto de credencial y {{companion}} interruptores que dependen de ellas quedarán desactivados`,settingsCompanionOnlyWillSkip:`{{companion}} interruptores quedarán desactivados - la credencial que necesita cada uno no se puede restaurar desde una copia de seguridad`,spoolsUsageCount:`incluidos {{count}} registros de consumo`,archivesMetadataOnly:`Solo metadatos - los archivos 3MF y las miniaturas no están en una copia de Git`,kprofilesPrinterCount:`en {{count}} impresoras`},notes:{noData:`No hay datos de este tipo en esta copia de seguridad`,archivesPrinterMissing:`Algunos archivos hacían referencia a impresoras que ya no existen - enlace eliminado`,archivesProjectMissing:`Algunos archivos hacían referencia a proyectos que ya no existen - enlace eliminado`,archivesOwnerCleared:`Algunos archivos hacían referencia a usuarios que ya no existen - se ha borrado el propietario, por lo que solo son visibles para usuarios con el permiso archives:read_all hasta que un administrador los reasigne`,archivesOwnerUnmatched:`Algunos archivos indican un propietario que no existe en esta instancia - se ha borrado el propietario en lugar de deducirlo del id de usuario de la copia de seguridad, por lo que solo son visibles para usuarios con el permiso archives:read_all hasta que un administrador los reasigne`,archivesOwnerUnknown:`Algunos archivos se restauraron sin propietario - esta copia de seguridad no registra ninguno, por lo que solo son visibles para usuarios con el permiso archives:read_all hasta que un administrador los reasigne`,archivesUndeleted:`Los archivos eliminados desde la copia vuelven a estar visibles - la sobrescritura estaba activada`,archivesMetadataOnly:`Los archivos restaurados solo contienen metadatos - los ficheros 3MF y las miniaturas no están en una copia de Git`,spoolUsageUnresolved:`{{count}} registros de consumo omitidos - su bobina no está en la lista de bobinas de esta copia, así que no hay nada a lo que asociarlos.`,spoolUsageUnlinked:`{{count}} registros de consumo restaurados sin su enlace al historial de impresión - selecciona Archivos de impresión junto con Inventario de bobinas para conservarlo.`,spoolTagKept:`{{count}} etiquetas de bobina se han dejado como estaban - la copia habría borrado una etiqueta escaneada desde entonces, o la habría movido a una segunda bobina.`,settingsCredentialsSkipped:`{{count}} claves con aspecto de credencial omitidas - vuelve a introducir los secretos manualmente`,settingsAuthSkipped:`{{count}} ajustes de autenticación omitidos - cámbialos en Ajustes > Autenticación para que sigan aplicándose las comprobaciones de bloqueo`,settingsCompanionSkipped:`{{keys}} se han dejado desactivados - la credencial que cada uno necesita no puede restaurarse desde una copia y esta instancia no tiene ninguna guardada, así que activarlos dejaría la integración sin autenticación`,settingsMqttRelayFailed:`Ajustes MQTT restaurados, pero no se pudo reconectar el relé - reinicia Bambuddy`,kprofilesAlwaysOverwrite:`Los perfiles K siempre sobrescriben la ranura correspondiente en la impresora`,kprofilesAckUnreliable:`Una impresora que no responde sigue contando como restaurada - verifica los perfiles en la impresora`,kprofilesPrinterMissing:`No hay ninguna impresora con el número de serie {{serial}} - omitido`,kprofilesPrinterOffline:`{{printer}} ({{serial}}) no está conectada - omitido`,kprofilesUnknownNozzle:`Diámetro de boquilla inesperado {{nozzle}} para {{serial}} - enviado tal cual`,kprofilesUnmatched:`{{count}} perfiles para {{nozzle}} no tenían equivalente en {{printer}} - añadidos como perfiles nuevos`,kprofilesSendFailed:`No se pudieron enviar los perfiles de {{nozzle}} a {{printer}} ({{serial}})`,kprofilesRefused:`{{printer}} ({{serial}}) rechazó los perfiles de {{nozzle}}: {{reason}}`,kprofilesStepFailed:`No se pudo completar el paso de los perfiles K - {{reason}}. Lo que se restauró antes sigue guardado.`}},history:`Historial`,clear:`Borrar`,date:`Fecha`,status:`Estado`,trigger:`Tipo`,triggers:{manual:`Copia (manual)`,scheduled:`Copia (programada)`,restore:`Restauración`},commit:`Confirmación`,localBackup:`Copia de seguridad local`,localBackupDescription:`Cree una copia de seguridad completa de sus datos de Bambuddy, incluida la base de datos, los archivos, las subidas y todos los archivos.`,downloadBackupLabel:`Descargar copia de seguridad`,completeBackupZip:`Copia de seguridad completa: base de datos + todos los archivos (ZIP)`,download:`Descargar`,preparingBackup:`Preparando la copia de seguridad...`,creatingArchive:`Creando el archivo de copia de seguridad... Esto puede tardar un rato para archivos grandes.`,downloadingFile:`Descargando el archivo de copia de seguridad...`,backupDownloaded:`Copia de seguridad descargada correctamente`,failedToCreateBackup:`Error al crear la copia de seguridad: {{message}}`,restore:`Restaurar`,restoreReplacesAll:`La restauración reemplaza todos los datos.`,restoreReplacesAllDetail:`Su base de datos y archivos actuales se reemplazarán por completo. Se requiere un reinicio tras la restauración.`,restoreConfirmTitle:`Restaurar copia de seguridad`,restoreConfirmMessage:`¿Está seguro de que desea restaurar desde "{{filename}}"? Esto reemplazará por completo su base de datos actual y todos los archivos. La aplicación deberá reiniciarse tras la restauración.`,restoreConfirmButton:`Restaurar copia de seguridad`,uploadingFile:`Subiendo el archivo de copia de seguridad...`,backupRestoredRestart:`Copia de seguridad restaurada. Reinicie Bambuddy.`,failedToRestore:`Error al restaurar la copia de seguridad. Compruebe el formato del archivo.`,reloadNow:`Recargar ahora`,creatingBackup:`Creando copia de seguridad`,restoringBackup:`Restaurando copia de seguridad`,preparing:`Preparando...`,processing:`Procesando...`,doNotClosePage:`No cierre esta página ni navegue a otra. Esta operación puede tardar varios minutos para copias de seguridad grandes.`,restoring:`Restaurando...`,restoreComplete:`Restauración completada`,restoreFailed2:`Error en la restauración`,importSettings:`Importar ajustes desde un archivo de copia de seguridad`,pleaseWaitRestoring:`Espere mientras se restauran sus datos`,selectBackupFile:`Haga clic para seleccionar el archivo de copia de seguridad (.json o .zip)`,duplicateHandling:`Cómo funciona la gestión de duplicados:`,matchPrinters:`Impresoras`,matchPrintersBy:`coincidencia por número de serie`,matchSmartPlugs:`Enchufes inteligentes`,matchSmartPlugsBy:`coincidencia por dirección IP`,matchNotificationProviders:`Proveedores de notificaciones`,matchNotificationProvidersBy:`coincidencia por nombre`,matchFilaments:`Filamentos`,matchFilamentsBy:`coincidencia por nombre + tipo + marca`,matchArchives:`Archivos`,matchArchivesBy:`coincidencia por hash del contenido (siempre se omiten)`,matchPendingUploads:`Subidas pendientes`,matchPendingUploadsBy:`coincidencia por nombre de archivo`,matchSettingsTemplates:`Ajustes y plantillas`,matchSettingsTemplatesBy:`siempre se sobrescriben`,replaceExisting:`Reemplazar los datos existentes`,keepExisting:`Conservar los datos existentes`,overwriteDescription:`Sobrescribir los elementos que ya existen con los datos de la copia de seguridad`,keepDescription:`Restaurar solo los elementos que aún no existen`,overwriteCaution:`Precaución:`,overwriteWarning:`Sobrescribir reemplazará sus configuraciones actuales con los datos de la copia de seguridad. Los códigos de acceso de las impresoras nunca se sobrescriben por seguridad.`,cancel:`Cancelar`,processingBackup:`Procesando el archivo de copia de seguridad...`,itemsRestored:`Elementos restaurados`,itemsSkipped:`Elementos omitidos`,restored:`Restaurados`,skippedAlreadyExist:`Omitidos (ya existen)`,filesCategory:`Archivos (3MF, miniaturas, etc.)`,andMore:`...y {{count}} más`,newApiKeysGenerated:`Nuevas claves API generadas`,keysShownOnce:`Estas claves solo se muestran una vez. ¡Cópielas ahora!`,copy:`Copiar`,noDataFound:`No se encontraron datos para restaurar en el archivo de copia de seguridad.`,close:`Cerrar`,scheduledBackup:`Copias de seguridad programadas`,scheduledBackupDescription:`Cree automáticamente instantáneas de copia de seguridad según una programación. El directorio de salida se puede montar en un NAS o en almacenamiento externo.`,frequency:`Frecuencia`,backupTime:`Hora`,retention:`Retención`,retentionDescription:`Número de copias de seguridad que conservar`,outputPath:`Ruta de salida`,outputPathPlaceholder:`Predeterminada: {{path}}`,outputPathDescription:`Déjelo vacío para la ubicación predeterminada`,runNow:`Ejecutar ahora`,backupFiles:`Archivos de copia de seguridad`,noScheduledBackups:`Aún no hay copias de seguridad`,deleteBackup:`Eliminar`,deleteBackupConfirm:`¿Eliminar este archivo de copia de seguridad?`,backupRunning:`Copia de seguridad en curso...`,scheduledBackupComplete:`Copia de seguridad completada correctamente`,scheduledBackupFailed:`Error en la copia de seguridad`,nextBackup:`Próxima copia de seguridad`,backupSize:`Tamaño`,localTimeHint:`Hora local ({{tz}})`,defaultPathLabel:`Predeterminada:`,pathCheck:{title:`Bambuddy no puede escribir en este directorio`,howToFix:`Cómo solucionarlo:`,sandboxed:`El servicio de Bambuddy no puede escribir en {{path}}. Su unidad de systemd se ejecuta con ProtectSystem=strict, lo que hace que todo directorio fuera de los de instalación, datos y registros sea de solo lectura para el servicio, incluso uno en el que usted sí puede escribir desde su propia shell.`,read_only:`{{path}} está en un sistema de archivos de solo lectura.`,permission_denied:`Bambuddy no tiene permiso para escribir en {{path}}. Compruebe el propietario y los permisos del directorio.`,no_space:`El sistema de archivos que contiene {{path}} está lleno.`,not_a_directory:`{{path}} existe pero no es un directorio.`,missing:`{{path}} no existe y no se pudo crear.`,error:`Bambuddy no puede escribir en {{path}}.`,ephemeralTitle:`Estas copias de seguridad no sobrevivirán a la recreación del contenedor`,container_ephemeral:`{{path}} está dentro del contenedor de Bambuddy, no en el host. Las copias escritas ahí se pierden cuando se recrea el contenedor. Monte el directorio desde el host:`},categories:{settings:`Ajustes`,notification_providers:`Proveedores de notificaciones`,notification_templates:`Plantillas de notificaciones`,smart_plugs:`Enchufes inteligentes`,printers:`Impresoras`,filaments:`Filamentos`,maintenance_types:`Tipos de mantenimiento`,archives:`Archivos`,projects:`Proyectos`,pending_uploads:`Subidas pendientes`,external_links:`Enlaces externos`,api_keys:`Claves API`}},tags:{title:`Etiquetas`,addTag:`Añadir etiqueta`,editTag:`Editar etiqueta`,deleteTag:`Eliminar etiqueta`,tagName:`Nombre de la etiqueta`,tagColor:`Color de la etiqueta`,noTags:`No hay etiquetas`,deleteConfirm:`¿Está seguro de que desea eliminar esta etiqueta?`,manageTags:`Gestionar etiquetas`},uploadModal:{title:`Subir archivos 3MF`,dragDrop:`Arrastre y suelte archivos .3mf aquí`,or:`o`,browseFiles:`Examinar archivos`,extractionInfo:`El modelo de impresora se extraerá automáticamente de los metadatos del archivo 3MF.`,uploaded:`subidos`,failed:`fallidos`,uploading:`Subiendo...`,upload:`Subir`,uploadFailed:`Error al subir`},confirmOutcome:{title:`¿Cómo ha salido su impresión?`,good:`Buena`,reject:`Rechazar`,later:`Preguntar más tarde`,noPhoto:`No hay foto del acabado disponible`,savedGood:`Marcada como pieza buena`,savedReject:`Marcada como rechazada`,saveFailed:`No se pudo guardar el veredicto`,rejectReason:`Motivo del rechazo (opcional)`,noReason:`Sin motivo`,saveReject:`Guardar`,rejectAndReprint:`Imprimir de nuevo`,alreadyGood:`Ya está confirmada como pieza buena.`,alreadyRejected:`Ya está marcada como rechazada.`,cardPrompt:`¿Cómo ha salido?`,sources:{dialog:`Registrado en la aplicación.`,link:`Registrado con un enlace de un toque.`,plateClear:`Registrado al despejar la cama.`,printerCard:`Registrado desde la tarjeta de la impresora.`,api:`Registrado a través de la API.`,reaction:`Registrado con una reacción en el chat.`}},editArchive:{title:`Editar archivo`,name:`Nombre`,namePlaceholder:`Nombre de la impresión`,printer:`Impresora`,noPrinter:`Sin impresora`,project:`Proyecto`,noProject:`Sin proyecto`,itemsPrinted:`Elementos impresos`,itemsPrintedHelp:`Número de elementos producidos en este trabajo de impresión. Use 0 si toda la placa se estropeó.`,filamentUsed:`Filamento usado (g)`,filamentUsedPlaceholder:`p. ej. 46.16`,filamentUsedHelp:`Introdúcelo a mano cuando una impresión se haya archivado sin su 3MF, para que siga contando en los totales de filamento. Al volver a escanear un archivo que sí tiene su 3MF, el valor se lee de nuevo del fichero.`,notes:`Notas`,notesPlaceholder:`Añada notas sobre esta impresión...`,externalLink:`Enlace externo`,externalLinkPlaceholder:`https://printables.com/model/...`,externalLinkHelp:`Enlace a Printables, Thingiverse u otra fuente`,tags:`Etiquetas`,tagsPlaceholder:`Añada etiquetas...`,addMoreTags:`Añada más etiquetas...`,matchingTags:`Coincidentes con "{{query}}"`,existingTags:`Etiquetas existentes`,clickToAdd:`(haga clic para añadir)`,status:`Estado`,userVerdict:`Veredicto del resultado`,verdicts:{none:`Sin establecer`,good:`Pieza buena`,reject:`Rechazada`},failureReason:`Motivo del fallo`,selectReason:`Seleccionar motivo...`,photos:`Fotos del resultado impreso`,photosHelp:`Haga clic en + para añadir fotos de su resultado impreso`,printResult:`Resultado de la impresión`,saving:`Guardando...`,failureReasons:{adhesionFailure:`Fallo de adhesión`,spaghettiDetached:`Espagueti / Desprendido`,layerShift:`Desplazamiento de capa`,cloggedNozzle:`Boquilla obstruida`,filamentRunout:`Agotamiento del filamento`,warping:`Alabeo`,stringing:`Hilos`,underExtrusion:`Subextrusión`,powerFailure:`Corte de corriente`,userCancelled:`Cancelada por el usuario`,noStatusUpdate:`No se recibió actualización de estado`,other:`Otro`},statuses:{completed:`Completada`,failed:`Fallida`,aborted:`Cancelada`,printing:`Imprimiendo`}},kProfiles:{title:`Perfiles K`,noPrintersConfigured:`No hay impresoras configuradas`,addPrinterInSettings:`Añada una impresora en Ajustes para gestionar perfiles K`,noActivePrinters:`No hay impresoras activas`,enablePrinterConnection:`Active la conexión de una impresora para ver sus perfiles K`,loadingProfiles:`Cargando perfiles K...`,printerOffline:`Impresora desconectada`,printerOfflineDesc:`La impresora seleccionada no está conectada. Enciéndala para ver los perfiles K.`,noMatchingProfiles:`No hay perfiles coincidentes`,noMatchingProfilesDesc:`Ningún perfil coincide con sus criterios de búsqueda`,noKProfiles:`No hay perfiles K`,noKProfilesDesc:`No se encontraron perfiles de avance de presión para la boquilla de {{diameter}} mm`,createFirstProfile:`Crear el primer perfil`,printer:`Impresora`,nozzle:`Boquilla`,refresh:`Actualizar`,addProfile:`Añadir perfil`,export:`Exportar`,import:`Importar`,select:`Seleccionar`,selectAll:`Seleccionar todo`,delete:`Eliminar`,searchPlaceholder:`Buscar por nombre o filamento...`,allExtruders:`Todos los extrusores`,leftOnly:`Solo izquierdo`,rightOnly:`Solo derecho`,allFlow:`Todos los flujos`,hfOnly:`Solo flujo alto`,sOnly:`Solo estándar`,sortName:`Ordenar: nombre`,sortKValue:`Ordenar: valor K`,sortFilament:`Ordenar: filamento`,leftExtruder:`Extrusor izquierdo`,rightExtruder:`Extrusor derecho`,modal:{addTitle:`Añadir perfil K`,editTitle:`Editar perfil K`,profileName:`Nombre del perfil`,profileNamePlaceholder:`Mi perfil de PLA`,kValue:`Valor K`,kValuePlaceholder:`0,020`,kValueHelp:`Rango típico: 0,01 - 0,06 para PLA, 0,02 - 0,10 para PETG`,filament:`Filamento`,selectFilament:`Seleccionar filamento...`,source:{local:`Importado`,orcaCloud:`Orca Cloud`,bambuCloud:`Bambu Cloud`,builtin:`Integrado`},noFilamentsHelp:`No hay filamentos disponibles. Inicia sesión en Bambu Cloud o importa ajustes en Perfiles → Perfiles locales.`,searchFilaments:`Buscar filamentos...`,noFilamentMatches:`Ningún filamento coincide con esa búsqueda`,flowType:`Tipo de flujo`,highFlow:`Flujo alto`,standard:`Estándar`,nozzleSize:`Tamaño de la boquilla`,extruder:`Extrusor`,extruders:`Extrusores`,left:`Izquierdo`,right:`Derecho`,notes:`Notas (almacenadas localmente)`,notesPlaceholder:`Añada notas sobre este perfil...`,notesHelp:`Las notas se guardan en Bambuddy, no en la impresora`,syncing:`Sincronizando con la impresora...`,savingExtruder:`Guardando en el extrusor {{current}}/{{total}}...`,pleaseWait:`Espere`},deleteConfirm:{title:`Eliminar perfil`,cannotUndo:`Esto no se puede deshacer`,message:`¿Está seguro de que desea eliminar "{{name}}" de la impresora?`},bulkDelete:{title:`Eliminar perfiles`,cannotUndo:`Esto no se puede deshacer`,message:`¿Está seguro de que desea eliminar {{count}} perfiles seleccionados de la impresora?`},toast:{profileSaved:`Perfil K guardado`,profilesSaved:`Perfil K guardado en {{count}} extrusores`,selectAtLeastOneExtruder:`Seleccione al menos un extrusor`,selectFilament:`Selecciona primero un filamento`,filamentNotResolvable:`No hay ID de filamento Bambu para {{name}}: la impresora no puede guardar un perfil`,profileDeleted:`Perfil K eliminado`,profilesDeleted:`Se eliminaron {{count}} perfiles`,exportedProfiles:`Se exportaron {{count}} perfiles`,importedProfiles:`Se importaron {{count}} de {{total}} perfiles`,noProfilesToExport:`No hay perfiles que exportar`,invalidFileFormat:`Formato de archivo no válido`,failedToParseImport:`Error al analizar el archivo de importación`,failedToSaveBatch:`Error al guardar los perfiles K`,noteSaved:`Nota guardada`,failedToSaveNote:`Error al guardar la nota`},permission:{noRead:`No tiene permiso para actualizar perfiles`,noCreate:`No tiene permiso para añadir perfiles`,noUpdate:`No tiene permiso para actualizar perfiles K`,noDelete:`No tiene permiso para eliminar perfiles K`,noExport:`No tiene permiso para exportar perfiles`,noImport:`No tiene permiso para importar perfiles`}},virtualPrinter:{title:`Impresora virtual`,running:`En ejecución`,stopped:`Detenida`,description:{default:`Active una impresora virtual que aparece en Bambu Studio y OrcaSlicer. Los archivos enviados a esta impresora se archivarán directamente sin imprimir.`,proxy:`Active un proxy que retransmite el tráfico del laminador a una impresora real, permitiendo la impresión remota a través de cualquier red.`},enable:{title:`Activar la impresora virtual`,visibleInSlicer:`Visible como "Bambuddy" en la detección del laminador`,proxyingTo:`Haciendo de proxy hacia {{name}}`,notActive:`No activa`},model:{title:`Modelo de impresora`,description:`Seleccione qué modelo de impresora emular.`,restartWarning:`Cambiar el modelo reiniciará la impresora virtual`},accessCode:{title:`Código de acceso`,isSet:`El código de acceso está establecido`,notSet:`No hay código de acceso establecido - necesario para activarla`,placeholder:`Introduzca un código de 8 caracteres`,placeholderChange:`Introduzca un nuevo código para cambiarlo`,hint:`Debe tener exactamente 8 caracteres. Los laminadores lo usan para autenticarse.`,charCount:`({{count}}/8)`,inheritedFromTarget:`Heredado de la impresora de destino`,derivedFromTargetHint:`Usa el código de acceso de la impresora de destino. El puente reenvía la autenticación del laminador a la impresora real, por lo que los códigos deben coincidir — edita el código en los ajustes de la impresora para cambiarlo.`,reveal:`Mostrar código de acceso`,hide:`Ocultar código de acceso`},targetPrinter:{title:`Impresora de destino`,configured:`Destino del proxy configurado`,notConfigured:`No hay impresora de destino seleccionada - necesaria para el modo proxy`,placeholder:`Seleccionar una impresora...`,hint:`Seleccione la impresora a la que retransmitir el tráfico del laminador. La impresora debe estar en modo LAN.`,noPrinters:`No hay impresoras configuradas. Añada primero una impresora para usar el modo proxy.`},remoteInterface:{title:`Anulación de la interfaz de red`,configured:`Anulación de la interfaz activa`,optional:`Opcional - úsela si la IP detectada automáticamente es incorrecta (p. ej. varias tarjetas de red, Docker, VPN)`,placeholder:`Detección automática (predeterminada)...`,hint:`Anula la dirección IP anunciada mediante SSDP y usada en el certificado TLS. Útil cuando Bambuddy tiene varias interfaces de red.`},mode:{title:`Modo`,archive:`Archivar`,archiveDesc:`Archivar los archivos inmediatamente`,review:`Revisar`,reviewDesc:`Revisar antes de archivar`,queue:`Encolar`,queueDesc:`Archivar y añadir a la cola`,proxy:`Proxy`,proxyDesc:`Retransmitir a una impresora real`},autoDispatch:{title:`Envío automático`,description:`Iniciar automáticamente las impresiones al añadirlas a la cola. Cuando está desactivado, las impresiones esperan al envío manual.`},queueForceColorMatch:{title:`Forzar la coincidencia de color`,description:`Negarse a enviar a una impresora que no tiene cargados el tipo y el color exactos de filamento. Desactivado de forma predeterminada — sin esto, la cola usa la coincidencia solo por modelo y puede elegir una impresora con el color equivocado cargado.`},saveAmsMapping:{title:`Guardar mapeo de AMS`,description:`Guarda en el archivo la selección de ranura AMS propia del slicer (del comando MQTT project_file), de modo que una reimpresión posterior reutilice el mismo carrete físico en lugar de volver a derivarlo del tipo/color del archivo. Desactivado de forma predeterminada.`},gcodeInjection:{title:`Inyección de G-code`,description:`Aplica los fragmentos de G-code configurados por modelo en Ajustes a los trabajos de esta IV. Desactivado de forma predeterminada.`},tailscaleDisabled:{title:`Integración con Tailscale`,description:`Actívelo para marcar esta IV como expuesta a través de Tailscale. Muestra la dirección de Tailscale del host para que sepa qué IP pegar en el laminador. El paso de importación de la CA no cambia — este interruptor no tiene ningún efecto sobre los certificados.`},setupRequired:{title:`Configuración necesaria`,description:`La función de impresora virtual requiere configuración adicional del sistema antes de funcionar. Esto incluye el reenvío de puertos, las reglas del cortafuegos y los ajustes específicos de la plataforma.`,readGuide:`Lea la guía de configuración antes de activarla`},archiveNameSource:{title:`Origen del nombre del archivo`,description:`Elija cómo se nombran los archivos nuevos cuando llegan a través de la impresora virtual. «Metadatos» usa el título incrustado por el laminador del 3MF (predeterminado). «Nombre de archivo» usa el nombre de archivo que Bambu Studio envió por FTP. Nota: Bambu Studio sobrescribe el nombre que escribe en el diálogo «enviar a la impresora» con el campo Título del 3MF cuando existe, por lo que ambos modos suelen producir la misma cadena.`,metadata:`Metadatos`,filename:`Nombre de archivo`},caCert:{title:`Certificado del laminador`,description:`Las impresoras virtuales usan un certificado TLS firmado por la CA de Bambuddy. Importe este certificado de CA en el almacén de confianza de su laminador una sola vez para que acepte la conexión — sin necesidad de copiarlo desde la línea de comandos.`,copy:`Copiar`,copied:`Copiado`,download:`Descargar`,fingerprint:`SHA-256`},howItWorks:{title:`Cómo funciona`,step1:`En la misma LAN, las impresoras virtuales aparecen automáticamente en su laminador (Bambu Studio / OrcaSlicer) mediante detección. Desde otras redes, añádalas manualmente por dirección IP y código de acceso.`,step2:`En los modos Archivar, Revisar y Encolar, use el botón «Enviar» de su laminador para subir archivos 3MF a Bambuddy. El laminador mostrará «Impresión correcta» — el archivo se almacena, no se imprime.`,step3:`En el modo Proxy, la impresora virtual retransmite todo el tráfico a una impresora real — las impresiones comienzan inmediatamente como si estuviera conectada directamente.`},status:{title:`Detalles del estado`,printerName:`Nombre de la impresora`,model:`Modelo`,serialNumber:`Número de serie`,mode:`Modo`,pendingFiles:`Archivos pendientes`,targetPrinter:`Impresora de destino`,ftpPort:`Puerto FTP`,mqttPort:`Puerto MQTT`,ftpConnections:`Conexiones FTP`,mqttConnections:`Conexiones MQTT`},toast:{updated:`Ajustes de la impresora virtual actualizados`,failedToUpdate:`Error al actualizar los ajustes`,copyFailed:`Error al copiar — pruebe a seleccionar el texto manualmente`,accessCodeRequired:`Establezca primero un código de acceso`,targetPrinterRequired:`Seleccione primero una impresora de destino`,bindIpRequired:`Establezca primero una IP de enlace`,accessCodeEmpty:`El código de acceso no puede estar vacío`,accessCodeLength:`El código de acceso debe tener exactamente 8 caracteres`,targetCodeChangedRebind:`El código de acceso ahora coincide con la nueva impresora de destino. Vuelve a añadir este dispositivo en tu laminador para usar el nuevo código.`,created:`Impresora virtual creada`,failedToCreate:`Error al crear la impresora virtual`,deleted:`Impresora virtual eliminada`,failedToDelete:`Error al eliminar la impresora virtual`},list:{title:`Impresoras virtuales`,add:`Añadir`,addFirst:`Añadir impresora virtual`,empty:`No hay impresoras virtuales configuradas. Añada una para empezar.`},bindIp:{title:`Interfaz de enlace`,placeholder:`Seleccionar interfaz...`,hint:`Interfaz de red a la que se enlaza esta impresora virtual. Debe ser única por impresora.`},proxy:{accessCodeHint:`En el modo proxy, use el código de acceso de su impresora de destino en el laminador. La conexión se reenvía de forma transparente a la impresora real.`},addDialog:{title:`Añadir impresora virtual`,name:`Nombre`,hint:`Puede configurar el código de acceso, la impresora de destino y otros ajustes después de crearla.`,create:`Crear`},deleteConfirm:{title:`Eliminar impresora virtual`,message:`¿Está seguro de que desea eliminar "{{name}}"? Esto detendrá todos los servicios de esta impresora.`}},modelViewer:{stepConverting:`Convirtiendo el modelo STEP… {{seconds}} s`,stepSlowHint:`Los archivos STEP grandes pueden tardar un minuto o más.`,openInSlicer:`Abrir en el laminador`,openInSlicerWith:`Abrir en {{slicer}}`,moreSlicerOptions:`Más opciones de laminador`,openInSlicerFailed:`No se pudo abrir en el laminador`,tabs:{model:`Modelo 3D`},notAvailable:`no disponible`,plates:`Camas`,allPlates:`Todas las camas`,plateNumber:`Cama {{number}}`,plateCount:`{{count}} cama`,plateCount_other:`{{count}} camas`,objectCount:`{{count}} objeto`,objectCount_other:`{{count}} objetos`,filamentCount:`{{count}} filamento`,filamentCount_other:`{{count}} filamentos`,eta:`Tiempo estimado {{minutes}} min`,noPreview:`No hay vista previa disponible para este archivo`,pagination:{pageOf:`Página {{current}} de {{total}}`,prev:`Anterior`,next:`Siguiente`},errors:{failedToLoad:`Error al cargar el archivo`,noMeshes:`No se encontraron mallas en el archivo 3MF`,unsupportedFormat:`Formato de archivo no compatible`}},maintenanceDescriptions:{lubricateCarbonRods:`Aplique lubricante a las varillas de carbono para un movimiento suave`,lubricateRails:`Aplique lubricante a las guías lineales para un movimiento suave`,cleanNozzle:`Limpie el fusor y la boquilla para evitar obstrucciones`,checkBelts:`Verifique la tensión de las correas para impresiones precisas`,cleanBuildPlate:`Limpie la cama de impresión para una mejor adhesión`,checkExtruder:`Inspeccione los engranajes del extrusor en busca de desgaste`,checkCooling:`Asegúrese de que los ventiladores de refrigeración funcionan correctamente`,generalInspection:`Inspección general de la impresora`,cleanCarbonRods:`Limpie las varillas de carbono para reducir la fricción`,lubricateSteelRods:`Aplique lubricante a las varillas de acero para un movimiento suave`,cleanSteelRods:`Limpie las varillas de acero para reducir la fricción`,cleanLinearRails:`Limpie las guías lineales para eliminar el polvo y los residuos`,checkPtfeTube:`Inspeccione el tubo de PTFE en busca de desgaste o daños`,replaceHepaFilter:`Reemplace el filtro HEPA para la calidad del aire`,replaceCarbonFilter:`Reemplace el filtro de carbón activado`,lubricateLeftNozzleRail:`Lubrique la guía de la boquilla izquierda (serie H2)`},haSensors:{label:`Sensores`,unavailable:`No disponible`,blocksPrints:`{{entity}} — retiene las impresiones mientras haya alerta`,states:{open:`Abierto`,closed:`Cerrado`,unlocked:`Desbloqueado`,locked:`Bloqueado`,detected:`Detectado`,clear:`Despejado`,wet:`Húmedo`,dry:`Seco`,problem:`Problema`,ok:`OK`,running:`En marcha`,stopped:`Detenido`,on:`Encendido`,off:`Apagado`},sectionTitle:`Sensores de Home Assistant (impresoras)`,add:`Añadir sensor`,addTitle:`Añadir sensor de Home Assistant`,editTitle:`Editar sensor de Home Assistant`,empty:`Aún no hay sensores. Vincula un contacto de puerta o un termómetro de Home Assistant para mostrarlo en la tarjeta de la impresora.`,unknownPrinter:`Impresora desconocida`,badgeBlocks:`Retiene impresiones`,badgeNotifies:`Notifica`,badgeHidden:`Oculto en la tarjeta`,printer:`Impresora`,entity:`Entidad`,searchPlaceholder:`Buscar entidades...`,noEntities:`No hay entidades coincidentes`,name:`Nombre visible`,alertWhen:`Alertar cuando`,alertNever:`Nunca — solo mostrar`,alertAbove:`Por encima de`,alertBelow:`Por debajo de`,alertHint:`El estado de alerta resalta el sensor en la tarjeta de la impresora y habilita las opciones de abajo.`,showOnCard:`Mostrar en la tarjeta de la impresora`,notifyOnAlert:`Enviar una notificación cuando empiece la alerta`,blockPrint:`Retener las impresiones en cola mientras haya alerta`,blockPrintHint:`Los trabajos siguen en cola y arrancan solos cuando el sensor se despeja. Se ignora mientras Home Assistant no esté accesible.`,toast:{created:`Sensor añadido`,updated:`Sensor guardado`,deleted:`Sensor eliminado`},error:{pickEntity:`Elige una entidad de Home Assistant`,nameRequired:`Introduce un nombre visible`,printerRequired:`Elige una impresora`,alertRequired:`Define primero una condición de alerta`}},locationHaSensors:{sectionTitle:`Sensores de Home Assistant (ubicaciones de almacenamiento)`,sectionDescription:`Vincule sensores de temperatura, humedad o batería de Home Assistant a sus ubicaciones de almacenamiento para mostrar lecturas en vivo en la tarjeta de filamento y en la tabla. Solo se permite un sensor por categoría y ubicación.`,add:`Añadir sensor`,addTitle:`Añadir sensor de Home Assistant`,editTitle:`Editar sensor de Home Assistant`,empty:`Aún no hay sensores. Vincula un sensor de temperatura o humedad de Home Assistant para mostrarlo en la tarjeta del filamento.`,unknownLocation:`Ubicación desconocida`,location:`Ubicación de almacenamiento`,showOnCard:`Mostrar en la tarjeta del filamento`,overwriteConfirm:{title:`¿Reemplazar el sensor existente?`,messageTemperature:`"{{location}}" ya tiene un sensor de temperatura vinculado: {{name}}. Si continúas, se reemplazará.`,messageHumidity:`"{{location}}" ya tiene un sensor de humedad vinculado: {{name}}. Si continúas, se reemplazará.`,messageBattery:`"{{location}}" ya tiene un sensor de batería vinculado: {{name}}. Si continúas, se reemplazará.`},autoAdd:{confirmTitle:`¿Añadir también los otros sensores?`,confirmMessage:`Bambuddy también encontró otros sensores para esta ubicación. Elige cuáles añadir también.`,added:`También añadido: {{names}}`,noneFound:`No se encontraron sensores de temperatura, humedad o batería coincidentes para esta ubicación.`,onlyThisOne:`Solo este`},options:{buttonLabel:`Opciones de sensores`,title:`Opciones de sensores de ubicación`,description:`Estos valores se usan cuando un sensor de temperatura, humedad o batería se vincula automáticamente junto con el primer sensor de una ubicación.`,generalSettings:`Ajustes generales`,pollInterval:`Intervalo de actualización (segundos)`,pollIntervalHint:`Con qué frecuencia Bambuddy consulta Home Assistant y actualiza los valores de los sensores en pantalla. Mínimo 60 segundos.`,colorizeValues:`Colorear los valores de los sensores según sus umbrales de alerta`,aboveColor:`Color al superar el umbral`,belowColor:`Color al estar por debajo del umbral`,optimalColor:`Color para el valor óptimo`,colors:{red:`Rojo`,orange:`Naranja`,yellow:`Amarillo`,green:`Verde`,blue:`Azul`,purple:`Morado`,pink:`Rosa`},saved:`Opciones guardadas`,saveFailed:`No se pudieron guardar las opciones`,reset:`Restablecer`,resetConfirm:{title:`¿Restablecer todos los sensores de ubicación existentes?`,message:`Esto sobrescribe los umbrales de alerta, las notificaciones y la visibilidad en la tarjeta de todos los sensores de temperatura, humedad y batería de ubicaciones existentes con los valores configurados arriba, y restaura el nombre de cada sensor a su nombre descriptivo de Home Assistant; los sensores de impresora no se ven afectados. Esto no se puede deshacer. Dependiendo de cuántos sensores tenga, esto puede tardar un momento.`},resetDone:`Aplicado a {{count}} sensores de ubicación`,resetFailed:`No se pudieron restablecer los sensores de ubicación`},deleteAllConfirm:{title:`¿Eliminar todos los sensores?`,message:`Esto elimina los {{count}} sensores vinculados a "{{location}}". Esta acción no se puede deshacer.`},currentlyBound:`Actualmente vinculado: {{entity}}`,error:{locationRequired:`Elige una ubicación de almacenamiento`},toast:{created:`Sensor añadido`,updated:`Sensor guardado`,deleted:`Sensor eliminado`}},smartPlugs:{offline:`Desconectado`,admin:`Administración`,openPlugAdminPage:`Abrir la página de administración del enchufe`,deleteSmartPlug:`Eliminar enchufe inteligente`,turnOnSmartPlug:`Encender el enchufe inteligente`,turnOffSmartPlug:`Apagar el enchufe inteligente`,turnOn:`Encender`,turnOff:`Apagar`,addSmartPlug:{scanningNetwork:`Escaneando la red...`,chooseEntity:`Elija una entidad...`,connectionFailed:`Error de conexión`,searchEntities:`Buscar entidades...`,searchPowerSensors:`Buscar sensores de potencia...`,searchEnergySensors:`Buscar sensores de energía...`,placeholders:{plugName:`Enchufe del salón`,mqttStateOnValue:`ON, true, 1`,mqttSameAsPower:`Igual que el tema de potencia, o distinto`}},linkedTo:`Vinculado a:`,monitorOnly:`Solo supervisión`,alerts:`Alertas`,scheduleOn:`Encendido a las {{time}}`,scheduleOff:`Apagado a las {{time}}`,on:`Encendido`,off:`Apagado`,power:`Potencia`,kwhToday:`kWh hoy`,settings:`Ajustes`,automationSettings:`Ajustes de automatización`,showInSwitchbar:`Mostrar en la barra de interruptores`,quickAccessSidebar:`Acceso rápido desde la barra lateral`,enabled:`Activada`,enableAutomation:`Activar la automatización para este enchufe`,autoOn:`Encendido automático`,autoOnDescription:`Encender cuando comienza la impresión`,autoOff:`Apagado automático`,autoOffDescription:`Apagar cuando se completa la impresión (una sola vez)`,autoOffPersistent:`Mantener activado`,autoOffPersistentDescription:`Permanecer activado entre impresiones en lugar de una sola vez`,controlsPrinterPower:`Alimenta la impresora`,controlsPrinterPowerDescription:`Desactívalo si este enchufe solo alimenta un accesorio (ventilador de filtro, luces). De lo contrario, apagarlo marca la impresora como desconectada.`,autoOffAfterDrying:`Apagado automático tras el secado`,autoOffAfterDryingDescription:`Apagar cuando se completa el secado del AMS`,delayAfterDryingMinutes:`Retardo de secado (minutos)`,turnOffDelayMode:`Modo de retardo de apagado`,time:`Tiempo`,temp:`Temp.`,delayMinutes:`Retardo (minutos)`,tempThreshold:`Umbral de temperatura (°C)`,tempThresholdDescription:`Se apaga cuando la boquilla se enfría por debajo de esta temperatura`,edit:`Editar`,deleteConfirm:`¿Está seguro de que desea eliminar "{{name}}"? Esto no se puede deshacer.`,turnOnConfirm:`¿Está seguro de que desea encender "{{name}}"?`,turnOffConfirm:`¿Está seguro de que desea apagar "{{name}}"? Esto cortará la corriente al dispositivo conectado.`,failedToTurn:`Error al {{action}} "{{name}}"`,unknown:`Desconocido`,addTitle:`Añadir enchufe inteligente`,editTitle:`Editar enchufe inteligente`,stopScanning:`Detener escaneo`,discoverTasmota:`Detectar dispositivos Tasmota`,foundDevices:`Se encontraron {{count}} dispositivo(s) - haga clic para seleccionar:`,noDevicesFound:`No se encontraron dispositivos Tasmota en su red`,haNotConfigured:`Home Assistant no está configurado. Configúrelo en`,haSettingsPath:`Ajustes → Red → Home Assistant`,selectEntity:`Seleccionar entidad *`,ipAddress:`Dirección IP *`,nameLabel:`Nombre *`,username:`Nombre de usuario`,password:`Contraseña`,authHint:`Déjelo vacío si su dispositivo Tasmota no requiere autenticación`,linkToPrinter:`Vincular a una impresora`,noPrinter:`Sin impresora (solo control manual)`,linkingDescription:`La vinculación activa el encendido/apagado automático cuando las impresiones comienzan/terminan`,powerAlerts:`Alertas de potencia`,alertAbove:`Alertar si supera (W)`,alertBelow:`Alertar si está por debajo (W)`,alertDescription:`Reciba una notificación cuando el consumo de energía cruce estos umbrales. Déjelo vacío para desactivar esa dirección.`,dailySchedule:`Programación diaria`,turnOnAt:`Encender a las`,turnOffAt:`Apagar a las`,scheduleDescription:`Encender/apagar automáticamente el enchufe a estas horas cada día. Déjelo vacío para omitir esa acción.`,showOnPrinterCard:`Mostrar en la tarjeta de la impresora`,displayOnPrinterCard:`Mostrar el botón en la tarjeta de la impresora`,connectedResult:`¡Conectado!`,deviceLabel:`Dispositivo: {{name}} - `,stateLabel:`Estado: {{state}}`,test:`Probar`,delete:`Eliminar`,save:`Guardar`,add:`Añadir`,cancel:`Cancelar`,failedToStartScan:`Error al iniciar el escaneo`,nameRequired:`El nombre es obligatorio`,entityRequired:`La entidad es obligatoria para los enchufes de Home Assistant`,mqttTopicRequired:`Debe configurarse al menos un tema MQTT para la supervisión de potencia, energía o estado`,loadingEntities:`Cargando entidades...`,loading:`Cargando...`,failedToLoadEntities:`Error al cargar las entidades: {{error}}`,noEntitiesMatching:`No se encontraron entidades que coincidan con "{{search}}"`,noEntitiesAvailable:`No hay entidades disponibles`,searchingEntities:`Buscando en todas las entidades ({{count}} encontradas)`,showingEntities:`Mostrando switch, light, input_boolean ({{count}} disponibles)`,energyMonitoringOptional:`Supervisión de energía (opcional)`,energyMonitoringHint:`Busque y seleccione sensores que proporcionen datos de potencia/energía.`,powerSensorW:`Sensor de potencia (W)`,energyTodayKwh:`Energía de hoy (kWh)`,totalEnergyKwh:`Energía total (kWh)`,noMatchingSensors:`No hay sensores coincidentes`,none:`Ninguno`,mqttNotConfigured:`El broker MQTT no está configurado. Establezca la dirección del broker en`,mqttSettingsPath:`Ajustes → Red → Publicación MQTT`,mqttNotConfiguredSuffix:`(no necesita activar la publicación, solo rellenar los datos del broker).`,mqttMonitorOnlyDescription:`Los enchufes MQTT reciben los datos de potencia/energía mediante una suscripción MQTT. El control de encendido/apagado no está disponible - use su broker MQTT o sistema de domótica.`,powerMonitoring:`Supervisión de potencia`,energyMonitoring:`Supervisión de energía`,stateMonitoring:`Supervisión de estado`,optional:`opcional`,topic:`Tema`,jsonPath:`Ruta JSON`,multiplier:`Multiplicador`,onValue:`Valor de ON`,mqttPowerHint:`La ruta JSON extrae el valor de la carga útil JSON (p. ej., "power_l1"). Déjelo vacío si el tema publica valores numéricos sin procesar. +Use el multiplicador 0,001 para mW→W, 1000 para kW→W.`,mqttEnergyHint:`La ruta JSON extrae el valor de la carga útil JSON. Déjelo vacío para valores sin procesar. +Use el multiplicador 0,001 para Wh→kWh, 1000 para MWh→kWh.`,mqttStateHint:`La ruta JSON extrae el valor de la carga útil JSON. Déjelo vacío para valores sin procesar. +Valor de ON: la cadena exacta que significa «ON». Déjelo vacío para la detección automática (ON, true, 1).`,restControl:`Control`,restOnUrl:`URL de encendido`,restOffUrl:`URL de apagado`,restOnBody:`Cuerpo de la solicitud de encendido`,restOffBody:`Cuerpo de la solicitud de apagado`,restMethod:`Método HTTP`,restHeaders:`Cabeceras personalizadas (JSON)`,restStatusUrl:`URL de estado`,restStatusPath:`Ruta JSON del estado`,restStatusOnValue:`Valor de ON`,restPowerUrl:`URL de potencia`,restPowerPath:`Ruta JSON de la potencia`,restPowerMultiplier:`Multiplicador de potencia`,restEnergyUrl:`URL de energía`,restEnergyPath:`Ruta JSON de energía (hoy)`,restEnergyTotalPath:`Ruta JSON de energía (contador total)`,restEnergyTotalMultiplier:`Multiplicador del contador total`,restEnergyTotalPathHint:`p. ej. aenergy.total`,restEnergyTotalHint:`Muchos enchufes — todos los Shelly entre ellos — solo informan de un contador acumulado que nunca se reinicia. Va aquí, no en el campo de arriba: leído como el consumo de hoy nunca se pondría a cero a medianoche, y Ayer y Total seguirían vacíos. Bambuddy deduce Hoy y Ayer a partir de él, lo que requiere uno o dos días de lecturas. Un Shelly informa en vatios-hora, así que usa un multiplicador de 0.001.`,restEnergyMultiplier:`Multiplicador de energía`,restUrlRequired:`Se requiere al menos una URL (de encendido o apagado) para los enchufes REST`,restHeadersHint:`p. ej. {"Authorization": "Bearer your-token"}`,restBodyHint:`p. ej. ON, {"state": "on"}`,restStatusHint:`URL para sondear el estado actual`,restPathHint:`p. ej. state o data.power.status`,restPowerUrlHint:`URL independiente para los datos de potencia (usa la URL de estado si está vacía)`,restEnergyUrlHint:`URL independiente para los datos de energía (usa la URL de estado si está vacía)`,restEnergyHint:`Cada valor puede usar su propia URL o recurrir a la URL de estado. Use multiplicadores para la conversión de unidades (p. ej. 0,001 para convertir Wh en kWh).`,testConnection:`Probar conexión`,connectionSuccess:`Conexión correcta`,noSwitchesInSwitchbar:`No hay interruptores en la barra de interruptores`,enableSwitchbarHint:`Active «Mostrar en la barra de interruptores» en Ajustes > Enchufes inteligentes`},notifications:{notifyLockScreenWidgets:`Widgets de la pantalla de bloqueo (iOS)`,notifyLockScreenWidgetsHelp:`Solo las impresoras activas fuera del modo de mantenimiento reciben widgets. Notify! permite un total de 10 widgets por dispositivo. Añade un widget de Notify! desde la personalización de la pantalla de bloqueo de iOS y selecciona una impresora. Muestra el estado, el progreso y los problemas sin cuenta atrás en directo. iOS actualiza aproximadamente cada 15 minutos o más.`,notifyPhotoUnavailable:`Los destinatarios de navegador y grupo solo admiten notificaciones de texto; no se pueden adjuntar fotos.`,notifyShowStage:`Mostrar fase de impresión`,notifyTimeSensitive:`Alertas urgentes de problemas`,notifyTimeSensitiveHelp:`Marca como urgentes las impresiones fallidas o detenidas y los problemas de la impresora o detectados por IA. Las demás notificaciones siguen siendo normales.`,notifyPrivacy:`Ocultar nombre del archivo en la tarjeta`,notifyPrivacyHelp:`Solo oculta los nombres de archivo en la actividad en directo. El texto de las notificaciones sigue usando las plantillas de notificación.`,notifyStyle:`Estilo de progreso`,notifyStyleBar:`Barra de progreso`,notifyStyleSegments:`Segmentos`,notifyStyleNone:`Sin indicador de progreso`,notifyDashboardUrl:`URL del panel (opcional)`,notifySymbol:`Símbolo (opcional)`,notifyTint:`Color (opcional)`,notifyAppearance:`Aspecto de la actividad en directo`,notifyMetrics:`Métricas`,notifyMetricsHelp:`El temporizador se muestra de forma predeterminada. Las métricas opcionales sustituyen la línea del nombre de archivo.`,notifyDeviceId:`ID del dispositivo o grupo`,notifyToken:`Token de Notify!`,notifyIconUrl:`URL del icono (opcional)`,notifyGroupType:`Hilo de notificaciones (opcional)`,notifyGroupTypeHelp:`Déjalo vacío para agrupar las notificaciones por impresora. Un valor personalizado las agrupa en el mismo hilo.`,notifyLiveActivities:`Actividades en directo (iOS)`,notifyLiveActivitiesHelp:`Sigue las impresiones en la pantalla de bloqueo de iOS y en la Dynamic Island. Usa un ID de dispositivo iOS y añade otro proveedor para las notificaciones de grupo.`,notifyLifecycleHelp:`Las actividades en directo siguen cada impresión automáticamente. Los interruptores de abajo solo controlan las notificaciones push. Las horas de silencio bloquean nuevas actividades; las existentes se siguen actualizando y finalizando. Los resúmenes diarios no retrasan las actividades.`,notifyIosFeaturesUnavailable:`Las actividades en directo y los widgets de la pantalla de bloqueo requieren un ID de dispositivo iOS. Los ID de grupos, navegadores y macOS solo usan notificaciones push.`,notifyTestHelp:`La prueba envía una notificación push. Una actividad en directo comienza al iniciar una impresión.`,providerTypes:{notify:`Notify!`,callmebot:`CallMeBot/WhatsApp`,ntfy:`ntfy`,pushover:`Pushover`,telegram:`Telegram`,email:`Correo`,discord:`Discord`,webhook:`Webhook`,homeassistant:`Home Assistant`,bark:`Bark`,gotify:`Gotify`},providerDescriptions:{notify:`Notificaciones push y actividades en directo de iOS mediante Notify!`,email:`Notificaciones por correo SMTP`,telegram:`Notificaciones mediante un bot de Telegram`,discord:`Enviar a un canal de Discord mediante un webhook`,ntfy:`Notificaciones push gratuitas y autoalojables`,pushover:`Notificaciones push sencillas y fiables`,callmebot:`Notificaciones de WhatsApp gratuitas mediante CallMeBot`,webhook:`POST HTTP genérico a cualquier URL`,homeassistant:`Notificaciones persistentes en el panel de Home Assistant`,bark:`Notificaciones push de iOS mediante Bark (autoalojable)`,gotify:`Notificaciones push a través de tu propio servidor Gotify`},lastSuccess:`Última: {{date}}`,error:`Error`,printer:`Impresora:`,allPrinters:`Todas las impresoras`,sendTestNotification:`Enviar notificación de prueba`,eventSettings:`Ajustes de eventos`,enabled:`Activado`,sendFromProvider:`Enviar notificaciones desde este proveedor`,printEvents:`Eventos de impresión`,printerStatus:`Estado de la impresora`,amsAlarms:`Alarmas del AMS`,amsHtAlarms:`Alarmas del AMS-HT`,printQueue:`Cola de impresión`,start:`Inicio`,plateCheck:`Comprobación de cama`,complete:`Completada`,failed:`Fallida`,stopped:`Detenida`,progress:`Progreso`,offline:`Desconectada`,lowFilament:`Filamento bajo`,maintenance:`Mantenimiento`,amsHumidity:`Humedad del AMS`,amsTemp:`Temp. del AMS`,amsDryingSuspended:`Secado suspendido`,amsHtHumidity:`Humedad del AMS-HT`,amsHtTemp:`Temp. del AMS-HT`,bedCooled:`Cama enfriada`,firstLayer:`Primera capa`,quiet:`Silencio`,digest:`Resumen {{time}}`,noPhoto:`Sin foto`,printStarted:`Impresión iniciada`,plateNotEmpty:`Cama no vacía`,plateNotEmptyDescription:`Objetos detectados antes de la impresión`,plateClearRequired:`Confirmar cama libre`,plateClearRequiredDescription:`Impresión terminada, la cola espera confirmación`,printConfirmRequest:`Confirmación de resultado`,printConfirmRequestDescription:`Solicitar un veredicto de buena/rechazo con enlaces de un solo toque cuando se complete una impresión que lo tenga activado`,plateClear:`Cama libre`,printCompleted:`Impresión completada`,bedCooledLabel:`Cama enfriada`,bedCooledDescription:`La cama se enfrió por debajo del umbral tras la impresión`,firstLayerCompleteLabel:`Primera capa completada`,firstLayerCompleteDescription:`Notificar con una captura cuando termina la primera capa`,connectedApps:`Aplicaciones conectadas`,appMessages:`Mensajes de aplicaciones conectadas`,appMessagesDescription:`Entregar los mensajes que otras aplicaciones envían a través de Bambuddy, p. ej. Bambuddy Orders`,appMessagesBadge:`Apps`,missingSpoolAssignmentLabel:`Falta la asignación de bobina`,billingChargeFailedLabel:`Error de facturación`,billingChargeFailedDescription:`Notificar cuando no se puedan registrar los costes de impresión`,missingSpoolAssignmentDescription:`Notificar cuando la impresión comienza y las bandejas necesarias no tienen ninguna bobina asignada`,printFailed:`Impresión fallida`,printStopped:`Impresión detenida`,progressMilestones:`Hitos de progreso`,progressMilestonesDescription:`Notificar al 25%, 50% y 75%`,printerOffline:`Impresora desconectada`,printerError:`Error de la impresora`,aiFailureDetection:`Detección de fallos por IA`,aiFailureDetectionDescription:`Notificar cuando la IA de Obico detecte un posible fallo de impresión`,lowFilamentLabel:`Filamento bajo`,maintenanceDue:`Mantenimiento pendiente`,maintenanceDueDescription:`Notificar cuando se necesite mantenimiento`,amsHumidityHigh:`Humedad alta del AMS`,amsHumidityHighDescription:`La humedad del AMS normal supera el umbral`,amsTemperatureHigh:`Temperatura alta del AMS`,amsTemperatureHighDescription:`La temperatura del AMS normal supera el umbral`,amsDryingSuspendedTitle:`Secado automático suspendido`,amsDryingSuspendedDescription:`El secado automático se rindió con una unidad AMS porque la humedad nunca bajó del umbral`,amsHtHumidityHigh:`Humedad alta del AMS-HT`,amsHtHumidityHighDescription:`La humedad del AMS-HT supera el umbral`,amsHtTemperatureHigh:`Temperatura alta del AMS-HT`,amsHtTemperatureHighDescription:`La temperatura del AMS-HT supera el umbral`,inventoryAlerts:`Alertas de inventario`,stockReorderAlert:`Alerta de reabastecimiento`,stockReorderAlertDescription:`El SKU ha alcanzado su punto de reabastecimiento`,stockBreakAlert:`Alerta de rotura de existencias`,stockBreakAlertDescription:`Las existencias se agotarán antes de que llegue el reabastecimiento`,jobAdded:`Trabajo añadido`,jobAddedDescription:`Trabajo añadido a la cola`,jobAssigned:`Trabajo asignado`,jobAssignedDescription:`Trabajo basado en el modelo asignado a una impresora`,jobStarted:`Trabajo iniciado`,jobStartedDescription:`El trabajo de la cola empezó a imprimirse`,jobWaiting:`Trabajo en espera`,jobWaitingDescription:`Trabajo a la espera de filamento o impresora`,jobSkipped:`Trabajo omitido`,jobSkippedDescription:`Trabajo omitido (el anterior falló)`,jobFailed:`Trabajo fallido`,jobFailedDescription:`El trabajo no pudo iniciarse`,queueComplete:`Cola completada`,queueCompleteDescription:`Todos los trabajos de la cola han terminado`,quietHours:`Horas de silencio`,noNotificationsDuring:`No hay notificaciones durante estas horas`,editProviderToChangeQuietHours:`Edite el proveedor para cambiar las horas de silencio`,dailyDigest:`Resumen diario`,batchNotifications:`Agrupar las notificaciones en un único resumen diario`,sendAt:`Enviar a las {{time}}`,editProviderToChangeDigestTime:`Edite el proveedor para cambiar la hora del resumen`,edit:`Editar`,deleteProvider:`Eliminar proveedor de notificaciones`,deleteConfirm:`¿Está seguro de que desea eliminar "{{name}}"? Esto no se puede deshacer.`,delete:`Eliminar`,addTitle:`Añadir proveedor de notificaciones`,editTitle:`Editar proveedor de notificaciones`,nameLabel:`Nombre *`,namePlaceholder:`Mis notificaciones`,providerTypeLabel:`Tipo de proveedor *`,configuration:`Configuración`,testConfiguration:`Probar configuración`,printerFilter:`Filtro de impresora`,onlyFromPrinter:`Enviar notificaciones solo para los eventos de esta impresora`,attachPhotoLabel:`Adjuntar foto`,attachPhotoDescription:`Incluir una captura de la cámara en las notificaciones, cuando se haya tomado una para el evento`,quietHoursDnd:`Horas de silencio (no molestar)`,quietStart:`Inicio`,quietEnd:`Fin`,dailyDigestLabel:`Resumen diario`,sendDigestAt:`Enviar el resumen a las`,digestCollected:`Los eventos se recopilarán y se enviarán como un único resumen a esta hora`,notificationEvents:`Eventos de notificación`,progressPercent:`(25%, 50%, 75%)`,bedCooledAfterPrint:`(después de completar la impresión)`,haSensorAlert:`Alerta de sensor de impresora`,haSensorAlertDescription:`(un sensor de Home Assistant vinculado requiere atención)`,locationHaSensorAlert:`Alerta de sensor de ubicación`,locationHaSensorAlertDescription:`(un sensor de Home Assistant vinculado a una ubicación de almacenamiento requiere atención)`,eventPriority:{sectionTitle:`Prioridad de ntfy`,helpNtfy:`Elija una prioridad para cada evento activado. ntfy las usa para escalar las alertas (sonido, visibilidad, comportamiento de las notificaciones push). Los niveles no establecidos aquí usan el valor predeterminado del servidor ntfy.`,sectionTitleGotify:`Prioridad de Gotify`,helpGotify:`Elija una prioridad para cada evento activado. Bambuddy envía Mínima, Baja, Predeterminada, Alta y Urgente a Gotify como 0, 2, 5, 8 y 10. En la app de Gotify para Android, Predeterminada y superiores emiten un sonido, y Alta y Urgente aparecen como ventana emergente.`,min:`Mínima`,low:`Baja`,default:`Predeterminada`,high:`Alta`,urgent:`Urgente`},cancel:`Cancelar`,save:`Guardar`,add:`Añadir`,nameRequired:`El nombre es obligatorio`,fieldRequired:`{{field}} es obligatorio`,haDataInvalid:`El campo Data debe ser un objeto JSON válido, p. ej. {"priority": "high", "ttl": 0}`,haServiceHelp:`Opcional: por defecto, una notificación persistente en la interfaz de Home Assistant. Indica un servicio notify (p. ej. notify.mobile_app_myphone) para recibir notificaciones push en el móvil, que además adjuntan automáticamente una captura de la cámara cuando la hay y se ha configurado la URL externa en Ajustes → Red.`,phoneNumber:`Número de teléfono`,apiKey:`Clave API`,serverUrl:`URL del servidor`,topic:`Tema`,authToken:`Token de autenticación`,userKey:`Clave de usuario`,appToken:`Token de la aplicación`,priority:`Prioridad`,pushoverRetry:`Reintento de emergencia (s)`,pushoverExpire:`Expiración de emergencia (s)`,botToken:`Token del bot`,chatId:`ID del chat`,telegramThreadId:`ID del tema del foro`,telegramThreadIdHelp:`Opcional. Envía a un único tema de un grupo de foro: el último número del enlace del tema (t.me/c/.../25). Déjalo vacío para el tema General.`,telegramThreadIdInvalid:`El ID del tema del foro debe ser un número.`,telegramVerdictMode:`Veredicto del resultado mediante`,telegramVerdictModeButtons:`Botones inline (enlace)`,telegramVerdictModeReactions:`Reacción (👍 / 👎)`,telegramVerdictModeBoth:`Botones y reacción`,telegramVerdictModeHelp:`Cómo se responde a la consulta del resultado. Las reacciones no necesitan conectividad entrante ni URL externa: Bambuddy las consulta al bot. Para las reacciones, usa un bot que solo use Bambuddy: otra aplicación que consulte el mismo bot (por ejemplo, Home Assistant) deja de recibir sus mensajes, incluso después de volver a los botones. En un grupo, el bot debe ser administrador para ver las reacciones.`,telegramVerdictBadgeReactions:`Reacciones`,telegramVerdictBadgeBoth:`Botones + reacciones`,smtpServer:`Servidor SMTP`,smtpPort:`Puerto SMTP`,security:`Seguridad`,authentication:`Autenticación`,username:`Nombre de usuario`,password:`Contraseña`,fromEmail:`Correo del remitente`,toEmail:`Correo del destinatario`,webhookUrl:`URL del webhook`,payloadFormat:`Formato de la carga útil`,authorization:`Autorización`,titleFieldName:`Nombre del campo del título`,messageFieldName:`Nombre del campo del mensaje`,editTemplate:`Editar plantilla: {{name}}`,titleLabel:`Título`,bodyLabel:`Cuerpo`,titlePlaceholder:`Título de la notificación...`,bodyPlaceholder:`Cuerpo de la notificación...`,availableVariables:`Variables disponibles`,clickToInsert:`Haga clic para insertar en la posición del cursor en el cuerpo`,livePreview:`Vista previa en directo`,hide:`Ocultar`,show:`Mostrar`,loadingPreview:`Cargando la vista previa...`,enterTemplateContent:`Introduzca el contenido de la plantilla para ver la vista previa`,titlePreview:`Título:`,bodyPreview:`Cuerpo:`,photoPreview:`Foto:`,photoPreviewNote:`Solo es un ejemplo: los proveedores que admiten adjuntos (ntfy, Pushover, Telegram, Discord, Home Assistant, Bark, Slack webhook) incluyen automáticamente una captura de la cámara cuando se ha tomado una, diga lo que diga el cuerpo de arriba.`,photoPreviewNoteWithEmail:`Solo es un ejemplo: se adjunta automáticamente en los proveedores compatibles (ntfy, Pushover, Telegram, Discord, Home Assistant, Bark, Slack webhook) cuando se ha tomado una captura. Para el correo electrónico, añade {finish_photo_url} al cuerpo de arriba para incluirla en línea.`,photoPreviewNoteEmailOnly:`Solo es un ejemplo: esto siempre es un correo electrónico. Añade {finish_photo_url} al cuerpo de arriba para incluir la foto en línea; sin ella solo se envía el texto.`,resetToDefault:`Restablecer al valor predeterminado`,titleRequired:`El título es obligatorio`,bodyRequired:`El cuerpo es obligatorio`,notificationLog:`Registro de notificaciones`,showFailedOnly:`Solo fallidas`,last24Hours:`Últimas 24 horas`,last7Days:`Últimos 7 días`,last30Days:`Últimos 30 días`,last90Days:`Últimos 90 días`,justNow:`Ahora mismo`,noFailedNotifications:`No hay notificaciones fallidas`,noNotificationsLogged:`No hay notificaciones registradas`,unknownProvider:`Proveedor desconocido`,logTitle:`Título`,logMessage:`Mensaje`,logError:`Error`,logProvider:`Proveedor: {{type}}`,logTime:`Hora: {{time}}`,refresh:`Actualizar`,clearOld:`Borrar antiguas`,statsSummary:`Últimos {{days}} días:`,statsNotifications:`notificaciones`,statsSent:`{{count}} enviadas`,statsFailed:`{{count}} fallidas`,eventTypes:{print_start:`Impresión iniciada`,print_complete:`Impresión completada`,print_failed:`Impresión fallida`,print_stopped:`Impresión detenida`,print_progress:`Progreso`,printer_offline:`Impresora desconectada`,printer_error:`Error de la impresora`,filament_low:`Filamento bajo`,maintenance_due:`Mantenimiento pendiente`,test:`Prueba`},userEmail:{title:`Notificaciones`,emailNotifications:`Notificaciones por correo`,emailNotificationsDesc:`Reciba notificaciones por correo de sus propios trabajos de impresión. Los correos se envían usando los ajustes de SMTP del sistema configurados en la autenticación avanzada.`,sendingTo:`Las notificaciones se enviarán a`,noEmailWarning:`Su cuenta no tiene una dirección de correo. Póngase en contacto con un administrador para añadir una.`,printJobNotifications:`Notificaciones de trabajos de impresión`,printJobNotificationsDesc:`Elija qué eventos activan las notificaciones por correo para los trabajos de impresión que envíe.`,printJobStarts:`El trabajo de impresión comienza`,printJobStartsDesc:`Reciba una notificación cuando su trabajo de impresión comience.`,printJobFinishes:`El trabajo de impresión termina`,printJobFinishesDesc:`Reciba una notificación cuando su trabajo de impresión se complete correctamente.`,printErrors:`Errores de impresión`,printErrorsDesc:`Reciba una notificación cuando su trabajo de impresión falle o encuentre un error.`,printJobStops:`El trabajo de impresión se detiene`,printJobStopsDesc:`Reciba una notificación cuando su trabajo de impresión se cancele o se detenga.`,saveSuccess:`Preferencias de notificación guardadas.`,saveError:`Error al guardar las preferencias de notificación.`}},richTextEditor:{bold:`Negrita`,italic:`Cursiva`,underline:`Subrayado`,bulletList:`Lista con viñetas`,numberedList:`Lista numerada`,alignLeft:`Alinear a la izquierda`,alignCenter:`Centrar`,alignRight:`Alinear a la derecha`,addLink:`Añadir enlace`,removeLink:`Quitar enlace`},externalLinks:{title:`Enlaces de la barra lateral`,sidebarLayout:`Barra lateral`,sidebarLayoutDescription:`Muestra u oculta páginas integradas, añade enlaces externos y arrastra elementos para reordenar la navegación lateral.`,systemPages:`Páginas de Bambuddy`,externalLinks:`Enlaces externos`,visibleInSidebar:`Visible en la barra lateral`,hiddenFromSidebar:`Oculto en la barra lateral`,requiredInSidebar:`Obligatorio en la barra lateral`,hidePage:`Ocultar página`,showPage:`Mostrar página`,settingsCannotBeHidden:`Ajustes no se puede ocultar`,noLinksConfigured:`No hay enlaces externos configurados`,deleteLink:`Eliminar enlace`,removeCustomIcon:`Quitar el icono personalizado`,openInNewTab:`Abrir en una pestaña nueva`,placeholders:{linkName:`Mi enlace`}},keyboardShortcuts:{title:`Atajos de teclado`,navigation:`Navegación`,archivesSection:`Archivos`,kProfilesSection:`Perfiles K`,generalSection:`General`,shortcuts:{goToPrinters:`Ir a Impresoras`,goToArchives:`Ir a Archivos`,goToQueue:`Ir a la cola`,goToStats:`Ir a Estadísticas`,goToProfiles:`Ir a Perfiles en la nube`,goToSettings:`Ir a Ajustes`,focusSearch:`Enfocar la búsqueda`,openUploadModal:`Abrir la ventana de subida`,clearSelection:`Borrar la selección / quitar el foco del campo`,contextMenu:`Menú contextual en las tarjetas`,refreshProfiles:`Actualizar perfiles`,newProfile:`Nuevo perfil`,exitSelectionMode:`Salir del modo de selección`,showHelp:`Mostrar esta ayuda`},footer:`Pulse Esc o haga clic fuera para cerrar`},notificationLog:{title:`Registro de notificaciones`,events:{printStarted:`Impresión iniciada`,printComplete:`Impresión completada`,printFailed:`Impresión fallida`,printStopped:`Impresión detenida`,progress:`Progreso`,printerOffline:`Impresora desconectada`,printerError:`Error de la impresora`,lowFilament:`Filamento bajo`,maintenanceDue:`Mantenimiento pendiente`,test:`Prueba`},timeAgo:{justNow:`Ahora mismo`,minutesAgo:`hace {{minutes}} min`,hoursAgo:`hace {{hours}} h`}},restoreBackup:{title:`Restaurar copia de seguridad`,restoring:`Restaurando...`,restoreComplete:`Restauración completada`,restoreFailed:`Error en la restauración`,importSettings:`Importar ajustes desde un archivo de copia de seguridad`,pleaseWait:`Espere mientras se restauran sus datos`,clickToSelect:`Haga clic para seleccionar el archivo de copia de seguridad (.json o .zip)`,howDuplicateHandling:`Cómo funciona la gestión de duplicados:`,categories:{printers:`Impresoras`,smartPlugs:`Enchufes inteligentes`,notificationProviders:`Proveedores de notificaciones`,filaments:`Filamentos`,archives:`Archivos`,pendingUploads:`Subidas pendientes`,settingsTemplates:`Ajustes y plantillas`},matchingInfo:{printers:`coincidencia por número de serie`,smartPlugs:`coincidencia por dirección IP`,notificationProviders:`coincidencia por nombre`,filaments:`coincidencia por nombre + tipo + marca`,archives:`coincidencia por hash del contenido`,pendingUploads:`coincidencia por nombre de archivo`,settingsTemplates:`siempre se sobrescriben`},replaceExisting:`Reemplazar los datos existentes`,keepExisting:`Conservar los datos existentes`,replaceDescription:`Sobrescribir los elementos que ya existen con los datos de la copia de seguridad`,keepDescription:`Restaurar solo los elementos que aún no existen`,caution:`Precaución:`,cautionText:`Sobrescribir reemplazará sus configuraciones actuales con los datos de la copia de seguridad. Los códigos de acceso de las impresoras nunca se sobrescriben por seguridad.`,itemsRestored:`Elementos restaurados`,itemsSkipped:`Elementos omitidos`,restored:`Restaurados`,skipped:`Omitidos (ya existen)`,filesLabel:`Archivos (3MF, miniaturas, etc.)`,newApiKeysGenerated:`Nuevas claves API generadas`,newApiKeysWarning:`Estas claves solo se muestran una vez. ¡Cópielas ahora!`,processingBackup:`Procesando el archivo de copia de seguridad...`,noDataFound:`No se encontraron datos para restaurar en el archivo de copia de seguridad.`,failedToRestore:`Error al restaurar la copia de seguridad. Compruebe el formato del archivo.`},backupExport:{title:`Exportar copia de seguridad`,selectData:`Seleccione los datos que incluir`,selectAll:`Seleccionar todo`,selectNone:`No seleccionar nada`,categoryDescriptions:{settings:`Idioma, tema, preferencias de actualización`,notifications:`ntfy, Pushover, Discord, etc.`,templates:`Plantillas de mensajes personalizadas`,smartPlugs:`Configuraciones de enchufes Tasmota`,externalLinks:`Enlaces de la barra lateral a servicios externos`,printers:`Información de las impresoras (códigos de acceso excluidos)`,plateDetection:`Imágenes de referencia de la cama vacía`,filaments:`Tipos y costes de filamento`,maintenance:`Programaciones de mantenimiento personalizadas`,archives:`Todos los datos de impresión + archivos (3MF, miniaturas, fotos)`,projects:`Proyectos, elementos de la lista de materiales y adjuntos`,pendingUploads:`Subidas de la impresora virtual pendientes de revisión`,apiKeys:`Claves API de webhook (se generan claves nuevas al importar)`},requiresPrinters:`Requiere que se seleccionen las impresoras`,zipFileWarning:`Se creará un archivo ZIP.`,zipFileDescription:`Incluye todos los archivos 3MF, las miniaturas, los time-lapses y las fotos. Esto puede tardar un rato y dar como resultado un archivo grande.`,includeAccessCodes:`Incluir los códigos de acceso`,includeAccessCodesDescription:`Para transferir a otra máquina`,includeAccessCodesWarning:`Los códigos de acceso se incluirán en texto plano. ¡Mantenga este archivo de copia de seguridad seguro!`,categoriesSelected:`{{selectedCount}} categorías seleccionadas`},pendingUploads:{placeholders:{notes:`Añada notas sobre esta impresión...`},discardUpload:`Descartar subida`,archiveAllUploads:`Archivar todas las subidas`,discardAllUploads:`Descartar todas las subidas`,archive:`Archivar`,timeAgo:{justNow:`Ahora mismo`,minutesAgo:`hace {{minutes}} min`,hoursAgo:`hace {{hours}} h`,daysAgo:`hace {{days}} d`}},apiBrowser:{placeholders:{requestBody:`Cuerpo de la solicitud JSON...`,searchEndpoints:`Buscar puntos de conexión...`}},configureAmsSlot:{title:`Configurar la ranura del AMS`,slotConfigured:`¡Ranura configurada!`,configuringSlot:`Configurando la ranura:`,slotLabel:`{{ams}} Ranura {{slot}}`,searchPresets:`Buscar preajustes...`,colorPlaceholder:`Nombre del color o hexadecimal (p. ej., marrón, FF8800)`,clearCustomColor:`Borrar el color personalizado`,noCloudPresets:`No hay preajustes de la nube. Inicie sesión en Bambu Cloud para sincronizar.`,noPresetsAvailable:`No hay preajustes disponibles. Inicie sesión en Bambu Cloud o importe perfiles locales.`,noMatchingPresets:`No se encontraron preajustes coincidentes.`,custom:`Personalizado`,builtin:`Integrado`,orcaCloud:`Orca Cloud`,bambuCloud:`Bambu Cloud`,settingsSentToPrinter:`Ajustes enviados a la impresora`,filamentProfile:`Perfil de filamento`,kProfileLabel:`Perfil K (avance de presión)`,filteringFor:`Filtrando por: {{material}}`,noKProfile:`Sin perfil K (usar el predeterminado 0,020)`,noMatchingKProfiles:`No se encontraron perfiles K coincidentes. Se usará el K=0,020 predeterminado.`,otherKProfiles:`Otros perfiles K en esta impresora`,selectFilamentFirst:`Seleccione primero un perfil de filamento`,kFromCalibration:`K={{value}} de la calibración de la impresora`,customColorLabel:`Color personalizado (opcional)`,presetColors:`Colores de {{name}}:`,showLessColors:`Mostrar menos colores`,showMoreColors:`Mostrar más colores`,clear:`Borrar`,hexLabel:`Hex: #{{hex}}`,resetting:`Restableciendo...`,resetSlot:`Restablecer ranura`,cancel:`Cancelar`,configuring:`Configurando...`,configureSlot:`Configurar ranura`,orcaFallback:{no_filament_id:`Este perfil de Orca no tiene un ID de filamento propio, así que OrcaSlicer verá esta ranura como Generic {{material}}.`,lookup_failed:`No se pudo leer el ID de filamento de este perfil desde Orca Cloud, así que OrcaSlicer verá esta ranura como Generic {{material}}. Inténtalo de nuevo en un momento.`,no_permission:`No tienes acceso a Orca Cloud, así que no se pudo leer el ID de filamento de este perfil. OrcaSlicer verá esta ranura como Generic {{material}}.`}},githubBackup:{title:`Copia de seguridad en Git`,history:`Historial`,downloadBackup:`Descargar copia de seguridad`,restoreBackup:`Restaurar copia de seguridad`,noBackupsYet:`Aún no hay copias de seguridad`},emailSettings:{placeholders:{fromName:`BamBuddy`}},tagManagement:{searchTags:`Buscar etiquetas...`,renameTag:`Renombrar etiqueta`,deleteTag:`Eliminar etiqueta`},notificationTemplates:{placeholders:{title:`Título de la notificación...`,body:`Cuerpo de la notificación...`}},batchTag:{placeholders:{newTag:`Introduzca una nueva etiqueta...`}},photoGallery:{deletePhoto:`Eliminar foto`},filamentHoverCard:{copySpoolUuid:`Copiar el UUID de la bobina`},kProfilesView:{hasNote:`Tiene nota`,copyProfile:`Copiar perfil`},layout:{openMenu:`Abrir menú`,noPermissionSystemInfo:`No tiene permiso para ver la información del sistema`},dashboard:{dragToReorder:`Arrastre para reordenar`,hideWidget:`Ocultar widget`},notificationProviderCard:{deleteNotificationProvider:`Eliminar proveedor de notificaciones`},fileManagerModal:{closeFileManager:`Cerrar el gestor de archivos`,sortFiles:`Ordenar archivos`,goToParentFolder:`Ir a la carpeta superior`,threeView:`Vista 3D`},embeddedCameraViewer:{refreshStream:`Actualizar la transmisión`,close:`Cerrar`,zoomOut:`Alejar`,resetZoom:`Restablecer el zoom`,zoomIn:`Acercar`,dragToResize:`Arrastre para redimensionar`},timelapseViewer:{skipBack5s:`Retroceder 5 s`,skipForward5s:`Avanzar 5 s`},notificationProviders:{descriptions:{email:`Notificaciones por correo SMTP`,telegram:`Notificaciones mediante un bot de Telegram`,discord:`Enviar a un canal de Discord mediante un webhook`,ntfy:`Notificaciones push gratuitas y autoalojables`,pushover:`Notificaciones push sencillas y fiables`,callmebot:`Notificaciones de WhatsApp gratuitas mediante CallMeBot`,webhook:`POST HTTP genérico a cualquier URL`}},logViewer:{searchPlaceholder:`Buscar mensaje o nombre del registrador...`,noLogEntries:`No se encontraron entradas de registro`},switchbarPopover:{noSwitchesInSwitchbar:`No hay interruptores en la barra de interruptores`},projectPageModal:{placeholders:{title:`Título`,designer:`Diseñador`,license:`Licencia`,description:`Introduzca una descripción...`,profileTitle:`Título del perfil`,profileDescription:`Descripción del perfil...`}},spoolmanSettings:{},time:{unknown:`-`,waiting:`En espera`,justNow:`Ahora mismo`,now:`Ahora`,minsAgo:`hace {{count}} min`,inMins:`en {{count}} min`,hoursAgo:`hace {{count}} h`,inHours:`en {{count}} h`,daysAgo:`hace {{count}} d`,inDays:`en {{count}} d`},spoolbuddy:{nav:{dashboard:`Panel`,ams:`AMS`,inventory:`Inventario`,writeTag:`Escribir`,settings:`Ajustes`},status:{nfcReady:`NFC listo`,nfcOff:`NFC apagado`,offline:`Desconectado`,online:`En línea`,noPrinters:`No hay impresoras`,deviceOffline:`Dispositivo desconectado`,waitingConnection:`Esperando la conexión del dispositivo...`,systemReady:`Sistema listo`,status:`Estado`},dashboard:{readyToScan:`Listo para escanear`,idleMessage:`Coloque una bobina en la báscula para identificarla`,nfcHint:`La etiqueta NFC se leerá automáticamente`,device:`Dispositivo`,syncWeight:`Sincronizar peso`,weightSynced:`¡Sincronizado!`,unknownTag:`Etiqueta desconocida`,newTag:`Nueva etiqueta detectada`,onScale:`en la báscula`,linkSpool:`Vincular a bobina`,linkTagTitle:`Vincular la etiqueta a una bobina`,linkTag:`Vincular etiqueta`,selectSpool:`Seleccione una bobina a la que vincular esta etiqueta:`,noUntagged:`No se encontraron bobinas sin etiquetas`,tagDetected:`Etiqueta detectada`,noTag:`Sin etiqueta`,tagId:`Etiqueta`,grossWeight:`Peso bruto`,spoolSize:`Tamaño de la bobina`,close:`Cerrar`,currentSpool:`Bobina actual`,plateReady:`Cama lista: {{name}}`,plateReadyLabel:`Camas listas para despejar`,plateClearAction:`Despejar`,plateClearedToast:`Cama marcada como despejada`,plateClearFailed:`No se pudo marcar la cama como despejada`},modal:{spoolDetected:`Bobina detectada`,assignToAms:`Asignar al AMS`,syncWeight:`Sincronizar peso`,weightSynced:`¡Sincronizado!`,syncing:`Sincronizando...`,newTagDetected:`Nueva etiqueta detectada`,addToInventory:`Añadir al inventario`,assignToAmsTitle:`Asignar al AMS`,selectSlot:`Seleccione una ranura`,assign:`Asignar`,assigning:`Asignando...`,assignSuccess:`¡Asignada!`,assignPendingInsert:`Asignada. La ranura se configurará cuando inserte la bobina.`,assignError:`Error al asignar la bobina. Inténtelo de nuevo.`,noPrinterSelected:`Seleccionar una impresora...`,noAmsDetected:`No se detectó ningún AMS en esta impresora`,slot:`Ranura`},weight:{noReading:`Sin lectura`,stable:`Estable`,measuring:`Midiendo...`,tare:`Tara`,calibrate:`Calibrar`},spool:{remaining:`Restante`,material:`Material`,brand:`Marca`,color:`Color`,coreWeight:`Núcleo`,labelWeight:`Etiqueta`,scaleWeight:`Báscula`,netWeight:`Neto`,lastUsed:`Usada por última vez`,unknownColor:`Color desconocido`},ams:{noData:`No se detectó ningún AMS`,connectAms:`Conecte un AMS para ver las ranuras de filamento`,noPrinter:`No hay impresora seleccionada`,selectPrinter:`Seleccione una impresora en la barra superior`,printerDisconnected:`Impresora desconectada`,humidity:`Humedad`,level:`Nivel`,active:`Activa`,slot:`Ranura`,empty:`Vacía`},inventory:{search:`Buscar bobinas...`,empty:`No hay bobinas en el inventario`,noResults:`No hay bobinas coincidentes`,spools:`bobinas`,addSpool:`Añadir bobina`},settings:{tabDevice:`Dispositivo`,tabDisplay:`Pantalla`,tabScale:`Báscula`,tabUpdates:`Actualizaciones`,nfcReader:`Lector NFC`,type:`Tipo`,connection:`Conexión`,notConnected:`N/D`,deviceInfo:`Información del dispositivo`,hostname:`Host`,uptime:`Tiempo de actividad`,systemConfig:`Backend y autenticación`,backendUrl:`URL del backend de Bambuddy`,apiToken:`Token de API`,apiTokenPlaceholder:`Introduzca el token de API`,saveConfig:`Guardar configuración`,systemQueued:`Configuración encolada.`,nfcDiagnostic:`Diagnóstico de NFC`,scaleDiagnostic:`Diagnóstico de la báscula`,readTagDiagnostic:`Diagnóstico de lectura de etiqueta`,testNfc:`Probar el lector`,testScale:`Probar la precisión`,testReadTag:`Leer etiqueta`,systemFieldsRequired:`La URL del backend es obligatoria.`,brightness:`Brillo`,saved:`Guardado`,noBacklight:`No se detectó retroiluminación DSI. El control del brillo requiere una pantalla DSI.`,screenBlank:`Tiempo de espera para apagar la pantalla`,screenBlankDesc:`La pantalla se apaga tras la inactividad. Toque para activarla.`,displayNote:`El brillo se aplica como un filtro de software.`,scaleCalibration:`Calibración de la báscula`,currentWeight:`Peso actual`,tareOffset:`Tara`,calFactor:`Factor`,knownWeight:`Peso conocido`,calStep1:`Retire todos los elementos de la báscula y pulse Poner a cero.`,calStep2:`Coloque el peso conocido en la báscula.`,setZero:`Poner a cero`,calibrateNow:`Calibrar`,calibrated:`Calibrada`,tareSet:`Comando de tara enviado. Esperando al dispositivo...`,tareComplete:`¡Tara completada!`,tareTimedOut:`Tara agotó el tiempo de espera — ¿está activo el daemon de SpoolBuddy?`,tareFailed:`Error al enviar el comando de tara`,zeroSet:`Punto cero establecido. Coloque el peso conocido en la báscula.`,calibrationDone:`¡Calibración completada!`,calibrationFailed:`Error en la calibración`,lastCalibrated:`Calibrada por última vez`,stable:`Estable`,settling:`Estabilizando...`,firmware:`Firmware`,scale:`Báscula`,noDevice:`No se encontró ningún dispositivo SpoolBuddy`,daemonVersion:`Versión del demonio`,currentVersion:`Actual`,versionPending:`Esperando al demonio...`,checking:`Comprobando...`,checkUpdates:`Buscar actualizaciones`,updateAvailable:`Actualización disponible`,updateInstructions:`Actualice mediante SSH: ejecute el script de instalación de SpoolBuddy para actualizar.`,upToDate:`Actualizado`,includeBeta:`Incluir versiones beta`},writeTag:{tabExisting:`Bobina existente`,tabNew:`Bobina nueva`,tabReplace:`Reemplazar etiqueta`,searchPlaceholder:`Buscar por material, color, marca...`,noUntaggedSpools:`No hay bobinas sin etiquetas`,noTaggedSpools:`No hay bobinas con etiquetas`,selectSpool:`Seleccione una bobina y luego coloque una etiqueta NTAG en blanco en el lector`,placeTag:`Coloque una etiqueta NTAG en el lector`,tagReady:`Etiqueta detectada — lista para escribir`,writeTag:`Escribir etiqueta`,replaceTag:`Reemplazar etiqueta`,writing:`Escribiendo la etiqueta...`,waiting:`Esperando a SpoolBuddy...`,writeSuccess:`¡Etiqueta escrita correctamente!`,writeFailed:`Error al escribir`,queueFailed:`Error al encolar el comando de escritura`,tryAgain:`Inténtelo de nuevo`,cancel:`Cancelar`,replaceWarning:`La etiqueta antigua se desvinculará. La nueva etiqueta la reemplazará.`,deviceOffline:`SpoolBuddy está desconectado`,material:`Material`,colorName:`Nombre del color`,color:`Color`,brand:`Marca`,weight:`Peso (g)`,createSpool:`Crear bobina`,creating:`Creando...`,spoolCreated:`¡Bobina creada! Lista para escribir.`,createFailed:`Error al crear la bobina`,incompleteDataWarning:`Etiqueta escrita con datos de Spoolman incompletos`},quickMenu:{printerPower:`Alimentación de la impresora`,systemControls:`Sistema`,restartDaemon:`Reiniciar demonio`,restartBrowser:`Reiniciar navegador`,reboot:`Reiniciar`,shutdown:`Apagar`,swipeToClose:`Deslice hacia abajo para cerrar`,confirmTitle:`Confirmar`,confirmShutdown:`¿Está seguro de que desea apagar el SpoolBuddy? Necesitará acceso físico para volver a encenderlo.`,confirmReboot:`¿Está seguro de que desea reiniciar el SpoolBuddy?`,confirmRestartDaemon:`¿Reiniciar el demonio de SpoolBuddy? El NFC y la báscula no estarán disponibles temporalmente.`,confirmRestartBrowser:`¿Reiniciar el navegador del quiosco? La pantalla se quedará en negro brevemente.`,confirm:`Confirmar`,confirmPlugOn:`¿Encender {{name}}?`,confirmPlugOff:`¿Apagar {{name}}?`,turnOn:`Encender`,turnOff:`Apagar`}},diagnostic:{modalTitle:`Diagnóstico de conexión — {{name}}`,running:`Ejecutando el diagnóstico...`,runningElapsed:`Ejecutando el diagnóstico... ({{elapsed}}s)`,waitingForReportHint:`Esperando a que la impresora publique un informe de estado — puede tardar hasta {{max}} segundos.`,runFailed:`No se pudo ejecutar el diagnóstico: {{error}}`,retry:`Ejecutar de nuevo`,runButton:`Ejecutar diagnóstico`,sectionTitle:`Diagnóstico de conexión`,sectionDescription:`Compruebe por qué una impresora no se conecta o no imprime — accesibilidad de los puertos, modo desarrollador LAN, modo de red de Docker y credenciales.`,noPrinters:`No hay impresoras configuradas.`,overall:{ok:`No se encontraron problemas — la conexión de la impresora parece correcta.`,warnings:`La impresora debería funcionar, pero algunas cosas necesitan atención.`,problems:`Se encontraron problemas que explican por qué la impresora no se conecta o no imprime.`},check:{port_mqtt:{title:`Puerto de control (MQTT 8883)`,pass:`Accesible — la impresora acepta conexiones de control.`,fail:`El puerto 8883 no es accesible. La impresora está apagada, en una dirección IP distinta, o un cortafuegos lo está bloqueando. Verifique la IP de la impresora y que nada bloquee el puerto 8883.`},port_ftps:{title:`Puerto de transferencia de archivos (FTPS 990)`,pass:`Accesible — el envío de archivos de impresión funcionará.`,warn:`El puerto 990 no es accesible. La supervisión puede seguir funcionando, pero el envío de impresiones a la impresora fallará. Asegúrese de que el puerto 990 no esté bloqueado.`,warn_no_tls:`El puerto 990 está abierto, pero el servicio de archivos de la impresora no completa el protocolo de enlace TLS. No se pueden obtener los archivos de impresión, las portadas ni los timelapses, por lo que los archivos quedan vacíos. Reinicie la impresora — desbloquear el puerto no servirá.`},external_storage:{title:`Almacenar archivos enviados en almacenamiento externo (paso 4 de instalación)`,pass:`La impresora informa que esta opción está activada — los archivos enviados se guardarán en la tarjeta SD y los archivos tendrán miniaturas y metadatos del slicer.`,fail:`La impresora informa que esta opción está desactivada. Active "Almacenar archivos enviados en almacenamiento externo" — en firmware reciente (P2S 01.02 / Bambu Studio 2.6+) el conmutador está en los Ajustes de Impresión de la impresora; en versiones anteriores está en la pestaña Dispositivo de Bambu Studio / OrcaSlicer. Sin esta opción, cada impresión archivada queda sin miniatura ni metadatos del slicer.`,skip:`No comprobado — se necesita una conexión MQTT activa. En slicers más antiguos donde este ajuste solo existe en el slicer, la impresora no lo reporta, así que esta comprobación pasa aunque la opción esté desactivada — verifique el paso 4 de la instalación manualmente.`,skip_unsupported_model:`Este modelo tiene ranura SD pero no hay forma de activar la opción — el firmware actual de la serie P1 no muestra el interruptor en Bambu Studio y la impresora no tiene pantalla. Aquí no hay nada que arreglar; a las impresiones archivadas pueden faltarles miniaturas y metadatos del slicer hasta que Bambu Lab lo admita por firmware.`,fail_no_media:`La opción está activada, pero la impresora no detecta ninguna tarjeta ni memoria en su ranura, así que los archivos enviados no tienen dónde ir. Inserte una e imprima de nuevo — hasta entonces, cada impresión archivada carecerá de miniatura y de metadatos del laminador.`,warn_internal_storage:`La opción está activada y hay almacenamiento presente, pero la última impresión aun así fue al almacenamiento interno de la impresora, que Bambuddy no puede leer. En la serie H2, la P2S y la X2D, el botón «Imprimir» de Bambu Studio siempre envía ahí, sea cual sea este ajuste. Las impresiones se archivan con su nombre y sus tiempos, pero sin miniatura ni metadatos del laminador. Para archivos completos, inicia las impresiones desde Bambuddy o lamina en OrcaSlicer, o bien en Bambu Studio usa «Enviar» con «Externo» y luego inicia la impresión.`,warn_internal_history:`La opción está activada y hay almacenamiento, pero la última impresión salió de un archivo que ya estaba en la impresora: una reimpresión desde su pantalla, un inicio desde Handy o un archivo enviado antes. Esa biblioteca reside en el almacenamiento interno, que Bambuddy no puede leer, y ninguna opción lo cambia, porque para esa impresión no se envió nada. Se sigue archivando con su nombre y sus tiempos, pero sin miniatura ni metadatos del laminador. Para archivos completos, inicia las impresiones desde Bambuddy o envíalas desde el laminador.`},port_rtsps:{title:`Puerto de la cámara ({{protocol}} {{port}})`,pass:`Accesible — la transmisión de la cámara funcionará.`,warn:`El puerto {{port}} no es accesible. La vista de la cámara en directo no funcionará. Esto no afecta a la impresión.`},macos_local_network:{title:`Permiso de red local de macOS`,pass:`macOS permite que Bambuddy acceda a la red local.`,warn_unsigned:`El Python que ejecuta Bambuddy no tiene firma de código, así que macOS no tiene a qué asociar el permiso de red local y descarta en silencio todas las conexiones con la impresora: sin error y sin solicitud. Ejecuta el actualizador de Bambuddy (install/update_macos.sh), que lo firma, y reinicia Bambuddy. Intérprete: {{executable}}`,warn_permission:`Si la impresora está encendida y en esta dirección, abre Ajustes del Sistema > Privacidad y seguridad > Red local y comprueba que el Python de Bambuddy esté activado. Si no lo está, macOS descarta las conexiones locales en silencio, y actualizar Python puede dejar atrás el permiso anterior.`},network_mode:{title:`Modo de red del contenedor`,genericRuntime:`un contenedor`,pass:`Ejecutándose en {{runtime}} con red de host.`,warn:`Bambuddy se está ejecutando en {{runtime}} con red de tipo bridge. La detección de impresoras y la impresora virtual necesitan el modo de red de host — vuelva a crear el contenedor con red de host ("network_mode: host" en docker-compose, "--network=host" en Podman).`,skip:`No se está ejecutando en un contenedor — no aplicable.`,skip_unknown:`Bambuddy se está ejecutando en {{runtime}}, pero no se pudo determinar su modo de red. Si la detección de impresoras o la impresora virtual no funcionan, vuelva a crear el contenedor con red de host.`,skip_system_container:`Bambuddy se está ejecutando en un contenedor de sistema {{runtime}}, que está en la LAN como una máquina virtual — no aplicable.`},subnet:{title:`Subred de la red`,pass:`La impresora y Bambuddy están en la misma subred.`,warn:`La impresora ({{printer_ip}}) y Bambuddy ({{host_ip}}) están en subredes distintas. Es posible que no se alcancen entre sí a menos que se configure el enrutamiento entre las subredes.`,skip:`No se pudo determinar la subred — omitido.`},mqtt_auth:{title:`Credenciales de la impresora`,pass:`La impresora aceptó la conexión.`,fail:`La impresora es accesible pero Bambuddy no está conectado a ella. Lo más probable es que el código de acceso o el número de serie sean incorrectos — el código de acceso cambia cada vez que se conmuta el modo Solo LAN o el modo desarrollador, así que vuelva a copiarlo de la pantalla de la impresora. Una impresora que se está reiniciando, o que ya alcanzó su límite de conexiones simultáneas, se ve igual.`,fail_auth_rejected:`La impresora rechazó las credenciales de Bambuddy. El código de acceso o el número de serie son incorrectos — el código de acceso cambia cada vez que se conmuta el modo Solo LAN o el modo desarrollador, así que vuelva a copiarlo de la pantalla de la impresora y guárdelo en la configuración de la impresora.`,skip:`No comprobado — no se pudo alcanzar la impresora.`},developer_mode:{title:`Modo desarrollador LAN`,pass:`El modo desarrollador está activado.`,fail:`El modo desarrollador está DESACTIVADO en la impresora. Actívelo en los ajustes de LAN de la impresora — y confirme con Aceptar. Sin él, las impresiones no comenzarán.`,skip:`No se pudo comprobar — requiere una conexión activa con la impresora.`},printer_publishing:{title:`La impresora publica estado`,pass:`La impresora está publicando actualizaciones de estado — AMS, filamentos y perfiles K se reflejarán correctamente en el slicer.`,fail:`El broker MQTT aceptó la conexión, pero la impresora no ha publicado ningún informe de estado. Casi siempre se trata de un número de serie incorrecto o con mayúsculas/minúsculas mal escritas — el topic device//report distingue entre mayúsculas y minúsculas. Revise el número de serie en los ajustes de la impresora comparándolo con la pantalla del aparato.`,skip:`No se pudo comprobar — requiere una conexión activa con la impresora.`}}},systemHealth:{sectionTitle:`Estado del sistema`,sectionDescription:`Analiza los registros recientes en busca de problemas conocidos que normalmente puedes resolver tú mismo, antes de que se conviertan en un ticket de soporte.`,rescan:`Volver a analizar`,clean:`No se encontraron problemas conocidos en las últimas {{times}} entradas de registro.`,logUnavailable:`El registro en archivo está desactivado, por lo que no se pueden analizar los registros. Activa el registro en archivo para usar esta comprobación.`,learnMore:`Cómo solucionarlo`,fixLabel:`Solución:`,occurrences:`Visto {{times}}× — última vez a las {{lastSeen}}`,category:{layer8:`Puedes solucionarlo`,environment:`Entorno`,bug:`Por favor, repórtalo`},signature:{"ftp-auth-rejected":{name:`La impresora rechazó el código de acceso`,cause:`La impresora rechazó el inicio de sesión de transferencia de archivos. El código de acceso es incorrecto o cambió tras activar el Modo Desarrollador.`,fix:`Vuelve a copiar el código de acceso desde la pantalla de la impresora (ajustes de LAN) y actualízalo en los ajustes de la impresora en Bambuddy.`},"ftp-connection-timeout":{name:`Se agotó el tiempo de la conexión de transferencia de archivos`,cause:`Bambuddy no pudo alcanzar el puerto de transferencia de archivos de la impresora (FTPS 990). El puerto está bloqueado, o la impresora está apagada o en otra subred.`,fix:`Asegúrate de que nada bloquee el puerto 990 entre Bambuddy y la impresora, y de que ambos estén en la misma red.`},"ftp-ssl-error":{name:`Falló el protocolo de enlace seguro de transferencia de archivos`,cause:`El servicio de archivos de la impresora respondió en el puerto 990 sin TLS. Su servidor de archivos se ha bloqueado: es un fallo de la impresora, no del cortafuegos ni del firmware.`,fix:`Reinicia la impresora. Hasta entonces no se pueden descargar archivos de impresión, portadas ni timelapses; la impresión en sí no se ve afectada.`},"bambu-cloud-captcha":{name:`Bambu Cloud solicita un CAPTCHA`,cause:`La protección antiabuso de Bambu está verificando esta red, por lo que ningún inicio de sesión en Bambu Cloud puede completarse. Depende de la dirección IP pública, no de tu cuenta ni de esta instalación.`,fix:`Espera: suele resolverse en unas horas y los intentos repetidos lo prolongan. Mientras tanto, conéctate con un token de acceso obtenido en una sesión del navegador.`},"mqtt-connection-flapping":{name:`La conexión con la impresora se cae continuamente`,cause:`La conexión de control (MQTT 8883) se desconecta y reconecta repetidamente, normalmente por una red débil o un puerto parcialmente bloqueado.`,fix:`Comprueba la señal Wi-Fi en la impresora, usa preferentemente una conexión por cable y asegúrate de que el puerto 8883 sea accesible de forma fiable.`},"camera-connection-refused":{name:`Transmisión de cámara inaccesible`,cause:`No se pudo acceder a la cámara en vivo en el puerto RTSPS 322. El puerto está bloqueado, o la cámara o la vista en vivo por LAN están desactivadas en la impresora.`,fix:`Activa la cámara y la vista en vivo por LAN en la impresora y asegúrate de que el puerto 322 no esté bloqueado. Esto no afecta a la impresión.`},"database-locked":{name:`Conflictos de escritura en la base de datos`,cause:`La base de datos SQLite presenta errores "database is locked" bajo carga, algo habitual al usar varias impresoras a la vez.`,fix:`Cambia Bambuddy a una base de datos PostgreSQL externa. Consulta la guía de PostgreSQL en la documentación.`}}},vpDiagnostic:{title:`Comprobación de configuración — {{name}}`,runButton:`Ejecutar comprobación de configuración`,running:`Ejecutando comprobación de configuración...`,runFailed:`No se pudo ejecutar la comprobación de configuración: {{error}}`,retry:`Volver a comprobar`,overall:{ok:`Todas las comprobaciones se superaron — esta impresora virtual está configurada correctamente.`,warnings:`La impresora virtual debería funcionar, pero algunas cosas requieren atención.`,problems:`Se encontraron problemas que explican por qué el laminador no puede ver ni usar esta impresora virtual.`},check:{enabled:{title:`Impresora virtual habilitada`,fail:`Esta impresora virtual está apagada. Actívela para que sea detectable.`},running:{title:`Servicios en ejecución`,fail:`La impresora virtual está habilitada pero sus servicios no se están ejecutando. Revise el registro de Bambuddy — normalmente los detiene un conflicto de IP de enlace o un error de permisos.`},bind_interface:{title:`Interfaz de red de enlace`,fail:`La interfaz de enlace no está configurada o ya no existe en este host. Elija una interfaz actual en el menú "Interfaz de enlace".`},access_code:{title:`Código de acceso configurado`,fail:`No hay ningún código de acceso configurado. Al laminador se le debe dar el mismo código de acceso de 8 caracteres que configura aquí.`},target_printer:{title:`Impresora de destino`,fail:`No hay ninguna impresora de destino seleccionada. El modo proxy necesita una impresora real a la que reenviar.`,warn:`La impresora de destino está desconectada ahora mismo — el reenvío se reanudará cuando vuelva a conectarse.`},port_ftps:{title:`Servicio de subida de archivos (puerto {{port}})`,fail:`No hay nada escuchando en el puerto {{port}} de la IP de enlace, por lo que el laminador no puede subir archivos. La causa habitual es un conflicto de puerto en esta interfaz.`},port_mqtt:{title:`Servicio de control (puerto {{port}})`,fail:`No hay nada escuchando en el puerto {{port}} de la IP de enlace, por lo que el laminador no puede conectarse ni mostrar el estado.`},port_bind:{title:`Servicio de detección (puerto {{port}})`,fail:`No hay nada escuchando en el puerto {{port}} de la IP de enlace, por lo que falla el protocolo de detección del laminador.`},privileged_ports:{title:`Vinculación a puertos privilegiados`,fail:`El puerto {{port}} está por debajo de 1024 y este servicio no tiene permiso para vincularlo, por eso no hay nada escuchando arriba. Añade AmbientCapabilities=CAP_NET_BIND_SERVICE a /etc/systemd/system/bambuddy.service y reinicia, o ejecuta "sudo setcap cap_net_bind_service=+ep $(readlink -f $(which python3))". En Docker, añade cap_add: [NET_BIND_SERVICE].`},certificate:{title:`Certificado TLS`,pass:`Certificado listo. Asegúrese de que el certificado de CA de Bambuddy (arriba) esté importado en el almacén de confianza de su laminador.`,fail:`Falta el certificado TLS de esta impresora virtual. Compruebe que el directorio de datos de Bambuddy tenga permisos de escritura.`}}},bugReport:{logHealthSummary:`Se encontraron problemas conocidos en tus registros`,logHealthIntro:`Los registros recientes coinciden con problemas conocidos. Revisa las soluciones de abajo: resolverlas podría arreglar tu problema sin un informe de error. Aun así, puedes enviar un informe abajo.`,title:`Informar de un error`,description:`Descripción`,descriptionPlaceholder:`¿Qué salió mal? Describa el problema...`,email:`Correo (opcional)`,emailPlaceholder:`su@correo.com`,emailPrivacy:`Si lo proporciona, su correo se incluirá en una sección plegada de la incidencia de GitHub para que el mantenedor pueda hacer un seguimiento.`,screenshot:`Captura de pantalla`,uploadOrPaste:`Suba, pegue o arrastre una imagen`,dataCollectedSummary:`¿Qué datos se incluyen en el informe?`,dataIncluded:`Incluidos:`,dataIncludedList:`Versión de la aplicación, sistema operativo, arquitectura, versión de Python, estadísticas de la base de datos (solo recuentos), modelos de impresora, número de boquillas, versiones de firmware, estado de la conectividad, estado de las integraciones (Spoolman, MQTT, HA), ajustes no sensibles, número de interfaces de red, detalles de Docker, versiones de las dependencias.`,dataNeverIncluded:`Nunca incluidos:`,dataNeverIncludedList:`Nombres de impresora, números de serie, códigos de acceso, contraseñas, direcciones IP, direcciones de correo, claves API, tokens, URL de webhook, nombres de host o nombres de usuario.`,submit:`Enviar`,startLogging:`Iniciar el registro de depuración`,stepEnableLogging:`Registro de depuración activado`,stepReproduce:`Reproduzca el problema ahora`,stepStopLogging:`Detener y enviar el informe`,stopAndSubmit:`Detener y enviar`,maxDuration:`Se detiene automáticamente tras {{minutes}} min`,stoppingLogs:`Recopilando registros y enviando...`,submitting:`Enviando el informe de error...`,submittingStepConnection:`Ejecutando comprobaciones de conectividad de impresoras`,submittingStepVirtualPrinters:`Ejecutando comprobaciones de configuración de impresoras virtuales`,submittingStepLogScan:`Analizando los registros recientes en busca de problemas conocidos`,submittingStepSubmit:`Enviando el informe a GitHub`,submitSuccess:`¡Informe de error enviado correctamente!`,submitFailed:`Error al enviar el informe de error`,diagnosticChecking:`Comprobando las conexiones de las impresoras...`,diagnosticHealthy:`La comprobación de conexión se superó — no se encontraron problemas en sus impresoras.`,diagnosticSummary:`{{problems}} de {{total}} impresoras tienen problemas de conexión`,diagnosticIntro:`Una o más impresoras tienen un problema de conexión que puede estar causando su problema. Despliegue una impresora a continuación para ver la solución — resolverla podría solucionar el problema sin un informe de error. Aún puede enviar un informe a continuación.`,thankYou:`¡Gracias!`,submitted:`Su informe de error se ha enviado.`,viewIssue:`Ver incidencia`,closeKeepsRecording:`Puedes cerrar este panel mientras reproduces el problema: la grabación sigue en marcha y al volver a abrirlo regresarás aquí.`,resumeRecording:`Informe de error grabando — {{elapsed}}. Haz clic para finalizar.`,resumeReport:`Reanudar informe`,unexpectedError:`Se produjo un error inesperado`},failureDetection:{title:`Detección de fallos por IA`,description:`Supervise las impresiones con una API de ML de Obico autoalojada y actúe automáticamente ante los fallos detectados.`,mlUrl:`URL de la API de ML de Obico`,mlUrlHint:`URL base de su contenedor ml_api de Obico autoalojado (p. ej. http://192.168.1.10:3333).`,bambuddyInternalUrl:`URL interna de Bambuddy (opcional)`,bambuddyInternalUrlHint:`Dirección de Bambuddy accesible desde la API de ML, como un nombre de servicio de Docker o una IP de la red local. Déjela vacía para usar la URL externa. Las demás integraciones seguirán usando la URL externa.`,bambuddyInternalUrlInvalid:`Debe empezar por http:// o https:// (por ejemplo, http://bambuddy:8000). No se guarda hasta entonces.`,mlToken:`Token de la API de ML (opcional)`,mlTokenPlaceholder:`Déjelo vacío si el servidor funciona sin ML_API_TOKEN`,mlTokenHint:`Debe coincidir con la variable de entorno ML_API_TOKEN de su contenedor ml_api de Obico. Déjelo vacío si el contenedor funciona sin token.`,test:`Probar`,testSuccess:`API de ML accesible y correcta.`,testSuccessTokenUnknown:`API de ML accesible y correcta. No se pudo comprobar el token.`,testFailed:`No se pudo alcanzar la API de ML.`,sensitivity:`Sensibilidad`,sensitivityLow:`Baja (menos falsos positivos)`,sensitivityMedium:`Media (equilibrada)`,sensitivityHigh:`Alta (detección temprana, más falsos positivos)`,sensitivityHint:`Ajusta los umbrales de confianza que activan las advertencias y los fallos.`,action:`Acción ante un fallo detectado`,actionNotify:`Solo notificar`,actionPause:`Pausar la impresión`,actionPauseOff:`Pausar y cortar la corriente`,pollInterval:`Intervalo de sondeo (segundos)`,pollIntervalHint:`Con qué frecuencia comprobar cada impresora mientras imprime. Mínimo 5 s, máximo 120 s.`,externalUrlMissing:`No hay ninguna dirección desde la que la API de ML pueda obtener las capturas.`,externalUrlHint:`Establezca aquí la URL interna de Bambuddy o la URL externa en Ajustes → Red para que la API de ML pueda obtener las capturas.`,perPrinterTitle:`Impresoras supervisadas`,perPrinterHint:`Elija qué impresoras vigila el servicio de detección.`,monitorAll:`Supervisar todas las impresoras conectadas`,statusTitle:`Estado`,serviceRunning:`Servicio en ejecución`,thresholds:`Umbrales bajo / alto`,activePrinters:`Impresiones activas`,noActivePrints:`No hay impresiones en curso actualmente.`,historyTitle:`Detecciones recientes`,noHistory:`Aún no hay detecciones.`},modelSources:{title:`Fuentes de modelos`,tabMakerworld:`MakerWorld`,tabManyfold:`Manyfold`},manyfold:{description:`Explora y busca en tu biblioteca de Manyfold e importa sus archivos para laminarlos e imprimirlos.`,notConnectedTitle:`Manyfold no está conectado`,notConnectedBody:`Pide a un administrador que conecte tu biblioteca de Manyfold.`,connectionTitle:`Conexión con Manyfold`,connectionHelp:`En Manyfold, abre Ajustes → API y crea una aplicación con los permisos "public" y "read". Introduce aquí su ID de cliente y su secreto. Bambuddy ve los modelos que puede ver el propietario de la aplicación.`,url:`URL de Manyfold`,urlPlaceholder:`http://192.168.1.10:3214`,clientId:`ID de cliente`,clientSecret:`Secreto de cliente`,clientSecretStored:`Guardado. Déjalo vacío para conservarlo.`,test:`Probar conexión`,testOk:`Conectado. Modelos que Bambuddy puede ver: {{count}}`,disconnect:`Desconectar`,disconnectTitle:`¿Desconectar Manyfold?`,disconnectBody:`Bambuddy olvida la URL, el ID de cliente y el secreto de Manyfold. Los archivos importados se quedan en tu biblioteca.`,disconnected:`Manyfold desconectado`,editConnection:`Conexión`,searchPlaceholder:`Buscar modelos`,modelCount:`Modelos: {{count}}`,noModels:`No se encontraron modelos.`,previous:`Anterior`,next:`Siguiente`,page:`Página {{page}}`,back:`Volver a los modelos`,openInManyfold:`Abrir en Manyfold`,license:`Licencia`,files:`Archivos`,noFiles:`Este modelo no tiene archivos.`,importTo:`Importar a`,folderAuto:`Carpeta "Manyfold"`,import:`Importar`,importing:`Importando…`,imported:`{{filename}} importado`,alreadyInLibrary:`Ya está en tu biblioteca`,inLibrary:`En la biblioteca`,showInLibrary:`Mostrar en la biblioteca`,notImportable:`Bambuddy no puede laminar ni imprimir este tipo de archivo`,selectAll:`Seleccionar todo`,selectFile:`Seleccionar {{name}}`,importSelected:`Importar selección ({{count}})`,importAll:`Importar todo`,importProgress:`Importando {{current}}/{{total}}`,bulkDone:`Importados: {{imported}} · ya en la biblioteca: {{existing}} · fallidos: {{failed}}`,bulkFailed:`Sin importar: {{names}}. {{reason}}`,bulkNothing:`Nada que importar: todos los archivos imprimibles ya están en tu biblioteca.`,selectModel:`Seleccionar {{name}}`,selectPage:`Seleccionar página`,modelsSelected:`Modelos seleccionados: {{count}}`,importModels:`Importar sus archivos`,clearSelection:`Quitar selección`,collectProgress:`Leyendo modelos {{current}}/{{total}}`,modelsUnreadable:`No se pudieron leer: {{names}}`,errors:{manyfold_not_configured:`Manyfold no está conectado.`,manyfold_credentials:`Manyfold no aceptó el ID de cliente o el secreto.`,manyfold_scope:`La aplicación de Manyfold necesita el permiso "read". Edítala en Manyfold en Ajustes → API.`,manyfold_rate_limited:`Manyfold está limitando los inicios de sesión. Inténtalo de nuevo en unos minutos.`,manyfold_unreachable:`Bambuddy no puede conectar con Manyfold. Comprueba la URL y que Manyfold esté en marcha.`,manyfold_forbidden:`Manyfold denegó el acceso. Comprueba que el propietario de la aplicación pueda ver este modelo.`,manyfold_not_found:`Manyfold no encuentra este modelo o archivo.`,manyfold_too_large:`El archivo ocupa más de 200 MB.`,manyfold_not_importable:`Solo se pueden importar archivos 3MF, STL y STEP.`,manyfold_bad_url:`Introduce la URL de Manyfold empezando por http:// o https://.`,manyfold_secret_required:`Introduce el secreto de cliente.`,manyfold_failed:`Manyfold respondió con un error.`}},makerworld:{title:`MakerWorld`,description:`Pegue la URL de un modelo de MakerWorld para importarlo e imprimirlo directamente desde Bambuddy — sin tener que salir a la aplicación Bambu Handy.`,pasteUrlHeader:`Importar desde MakerWorld`,pasteUrlPlaceholder:`https://makerworld.com/en/models/… o pegue cualquier enlace de MakerWorld`,resolveButton:`Resolver`,signInRequiredTitle:`Se requiere iniciar sesión en Bambu Cloud para descargar`,signInRequiredBody:`Puede explorar los detalles del modelo de forma anónima, pero MakerWorld requiere una cuenta de Bambu Cloud para descargar archivos 3MF.`,signInExpiredTitle:`La sesión de Bambu Cloud ha caducado`,signInExpiredBody:`Sigue conectado a Bambuddy, pero Bambu Lab ha dejado de aceptar el token almacenado, por lo que las descargas fallarán. Inicie sesión de nuevo en Bambu Cloud.`,openCloudSettings:`Abrir los ajustes de la nube`,untitledModel:`Modelo sin título`,byCreator:`de {{name}}`,downloadsCount:`{{count}} descargas`,licensePrefix:`Licencia`,alreadyImported:`Ya está en la biblioteca`,openOnMakerworld:`Abrir en MakerWorld`,alreadyInLibrary:`Este modelo ya está en su biblioteca — encuéntrelo en Gestor de archivos → MakerWorld`,importSuccess:`{{filename}} importado — guardado en Gestor de archivos → MakerWorld`,platesHeader:`Camas ({{count}})`,plateDefaultName:`Cama {{n}}`,materialCount:`{{count}} filamentos`,amsRequired:`AMS necesario`,slicedFor:`Laminado para {{printer}}`,alsoCompatible:`También marcado como compatible: {{printers}}`,importToLibrary:`Guardar`,sliceIn:`Guardar y laminar en {{slicer}}`,disclaimer:`La integración con MakerWorld usa puntos de conexión de API documentados por la comunidad. Bambuddy no está afiliado a MakerWorld ni a Bambu Lab ni cuenta con su respaldo.`,lastImportSuccess:`Importado a su biblioteca`,lastImportAlreadyInLibrary:`Ya está en su biblioteca`,viewInLibrary:`Ver en el gestor de archivos`,openInBambuStudio:`Abrir en Bambu Studio`,openInOrcaSlicer:`Abrir en OrcaSlicer`,importTo:`Importar al gestor de archivos`,recentImportsHeader:`Importaciones recientes`,phaseResolving:`Resolviendo`,phaseDownloading:`Descargando`,folderAuto:`MakerWorld (predeterminada)`,importAll:`Importar todo`,importAllProgress:`Importando {{current}}/{{total}}`,openGallery:`Abrir la galería de imágenes`,galleryPrev:`Imagen anterior`,galleryNext:`Imagen siguiente`,deleteImport:`Quitar de la biblioteca`,importDeleting:`Quitando…`,importDeleted:`Quitado de la biblioteca`,confirmDelete:`¿Quitar {{filename}} de la biblioteca? Esto elimina el archivo local, pero la cama se puede volver a importar desde MakerWorld.`,errors:{resolveFailed:`No se pudo resolver esa URL de MakerWorld.`,downloadFailed:`Error en la descarga. Inténtelo de nuevo.`,deleteFailed:`No se pudo quitar el archivo de la biblioteca.`}},gcodeViewer:{filamentSlot:`Filamento {{n}}`,loading:`Leyendo la trayectoria…`,loadFailed:`No se pudo cargar el G-code de este archivo.`,showTravel:`Movimientos en vacío`,topLayer:`Capa superior`,bottomLayer:`Capa inferior`,noSource:`No se indicó ningún archivo para previsualizar.`,view:{filament:`Filamento`,feature:`Elemento`,height:`Altura`,width:`Ancho`},feature:{wall:`Paredes`,sparseInfill:`Relleno disperso`,solidInfill:`Relleno sólido`,bridge:`Puente / voladizo`,support:`Soporte`,skirt:`Falda / borde`,gapFill:`Relleno de huecos`,ironing:`Alisado`,primeTower:`Torre de purga`},back:`Atrás`,backToArchives:`Volver a los archivos de impresión`,backToFiles:`Volver al gestor de archivos`,plates:`Camas`,plateN:`Cama {{n}}`},libraryTrash:{title:`Papelera`,headerButton:`Papelera`,headerTooltip:`Ver los archivos movidos a la papelera`,backToFiles:`Volver al gestor de archivos`,subtitleAdmin:`Los archivos eliminados permanecen aquí durante {{days}} días y luego se eliminan automáticamente. Esta vista muestra los archivos en la papelera de todos los usuarios.`,subtitleUser:`Los archivos eliminados permanecen aquí durante {{days}} días y luego se eliminan automáticamente.`,loading:`Cargando la papelera…`,loadError:`No se pudo cargar la papelera.`,empty:`La papelera está vacía.`,summary:`{{count}} archivos · {{size}}`,emptyTrash:`Vaciar la papelera`,restore:`Restaurar`,purgeNow:`Eliminar ahora`,autoPurgeIn:`Se elimina automáticamente en {{when}}`,days:`días`,retentionLabel:`Eliminar automáticamente tras`,selectAll:`Seleccionar todo`,selectOne:`Seleccionar {{filename}}`,selectionCount:`{{count}} seleccionados`,bulkRestore:`Restaurar los seleccionados`,bulkPurge:`Eliminar los seleccionados`,col:{filename:`Archivo`,folder:`Carpeta`,size:`Tamaño`,deleted:`Movido a la papelera`,autoPurge:`Se elimina automáticamente`,owner:`Propietario`,actions:`Acciones`},confirm:{purgeTitle:`¿Eliminar permanentemente?`,purgeBody:`{{filename}} se eliminará del disco y no se podrá restaurar.`,emptyTitle:`¿Vaciar la papelera?`,emptyBody:`Los {{count}} archivos se eliminarán del disco. Esto no se puede deshacer.`,bulkPurgeTitle:`¿Eliminar permanentemente los archivos seleccionados?`,bulkPurgeBody:`Los {{count}} archivos seleccionados se eliminarán del disco y no se podrán restaurar.`,cta:`Eliminar permanentemente`},toast:{restored:`Archivo restaurado.`,restoreFailed:`No se pudo restaurar el archivo.`,purged:`Archivo eliminado permanentemente.`,purgeFailed:`No se pudo eliminar el archivo.`,emptied:`Se eliminaron {{count}} archivo(s) de la papelera.`,emptyFailed:`No se pudo vaciar la papelera.`,retentionSaved:`Eliminación automática establecida en {{days}} días.`,retentionFailed:`No se pudo guardar el ajuste de retención.`,bulkRestored:`Se restauraron {{count}} archivo(s).`,bulkPurged:`Se eliminaron {{count}} archivo(s).`}},libraryPurge:{title:`Purgar archivos antiguos`,headerButton:`Purgar antiguos`,headerTooltip:`Mover en bloque los archivos antiguos a la papelera`,description:`Limpie de un solo paso los archivos antiguos de su biblioteca. Los archivos con un historial de impresión envejecen según su fecha de última impresión; los archivos que nunca se imprimieron envejecen según su fecha de subida.`,ageLabel:`Mover los archivos de más de`,days:`días`,includeNeverPrinted:`Incluir los archivos que nunca se han impreso`,effectsTitle:`Qué ocurre cuando hace clic en Purgar`,effect1:`Los archivos coincidentes se mueven a la papelera — aún no se eliminan del disco.`,effect2:`Puede restaurarlos de la papelera en cualquier momento hasta que expire el periodo de retención.`,effect3:`Tras la retención, el barrido de la papelera los elimina permanentemente del disco.`,effect4:`Los archivos de carpetas externas (vinculadas) se omiten — Bambuddy nunca elimina bytes que no le pertenecen.`,previewLoading:`Comprobando cuántos archivos coinciden…`,previewFailed:`No se pudo previsualizar la purga.`,previewSummary:`{{count}} archivos · {{size}} se moverían a la papelera`,andMore:`…y {{count}} más`,warning:`Los archivos en la papelera siguen contando para el almacenamiento hasta que expire el periodo de retención. Vacíe la papelera después para liberar el disco de inmediato.`,confirmCta:`Mover {{count}} a la papelera`,purging:`Moviendo a la papelera…`,toast:{success:`Se movieron {{count}} archivo(s) a la papelera.`,failed:`No se pudieron purgar los archivos.`}},libraryAutoPurge:{enableLabel:`Purgar automáticamente los archivos antiguos`,enableDescription:`Ejecuta la purga de administración una vez al día. Los archivos van primero a la papelera — no se eliminan de inmediato.`,ageLabel:`Purgar automáticamente los archivos de más de`,ageDescription:`Mínimo 7 días, máximo 10 años. Usa la misma regla de antigüedad que el botón de purga manual.`,days:`días`,includeNeverPrinted:`Incluir los archivos que nunca se han impreso`,saveFailed:`No se pudieron guardar los ajustes de purga automática.`},archivePurge:{headerButton:`Purgar antiguos`,headerTooltip:`Eliminar en bloque los archivos antiguos`,title:`Purgar archivos antiguos`,description:`Limpie el historial de impresión antiguo. Cada archivo envejece según la finalización de su impresión más reciente — reimprimir un archivo actualiza su antigüedad, por lo que el trabajo activo nunca se purga.`,ageLabel:`Eliminar los archivos no impresos en los últimos`,days:`días`,effectsTitle:`Qué ocurre cuando hace clic en Purgar`,effect1:`Cada archivo coincidente se oculta de los listados y sus archivos se eliminan del disco (3MF, miniatura, time-lapse, 3MF de origen, archivo de diseño F3D, fotos).`,effect2:`La fila del archivo permanece en la base de datos para que las estadísticas rápidas conserven la contribución de filamento, tiempo, coste y energía — igual que el comportamiento predeterminado de la eliminación de un solo archivo.`,effect3:`Marque «Eliminar también de las estadísticas» abajo para descartar también la contribución a las estadísticas rápidas (coincide con la opción de eliminación de un solo archivo). Esa vía es irreversible.`,effect4:`Reimprimir un archivo actualiza su reloj de antigüedad, por lo que los archivos que aún usa están a salvo.`,purgeStatsLabel:`Eliminar también de las estadísticas`,purgeStatsHint:`Descarta los archivos coincidentes de las estadísticas rápidas (filamento, tiempo, coste, energía). Sin esto, las estadísticas rápidas conservan todas las contribuciones y solo los archivos abandonan el disco.`,previewLoading:`Comprobando cuántos archivos coinciden…`,previewFailed:`No se pudo previsualizar la purga.`,previewSummary:`{{count}} archivos · {{size}} se eliminarían`,andMore:`…y {{count}} más`,warning:`Los archivos se eliminan del disco y no se pueden restaurar. Descargue o marque como favorito todo lo que desee conservar antes de continuar.`,confirmCta:`Eliminar {{count}} archivo(s)`,purging:`Eliminando…`,toast:{success:`Se eliminaron {{count}} archivo(s).`,failed:`No se pudieron purgar los archivos.`}},archiveAutoPurge:{enableLabel:`Purgar automáticamente los archivos antiguos`,enableDescription:`Una vez al día, oculta los archivos de los listados y elimina sus archivos del disco cuando no se han impreso dentro del umbral. Reimprimir un archivo reinicia el reloj.`,ageLabel:`Eliminar automáticamente los archivos no impresos en los últimos`,ageDescription:`Mínimo 7 días, máximo 10 años. Se basa en la finalización de la impresión más reciente — reimprimir un archivo actualiza su antigüedad. Elimina el 3MF, la miniatura, el time-lapse, el 3MF de origen, el F3D y las fotos.`,days:`días`,purgeStatsLabel:`Eliminar también de las estadísticas`,purgeStatsDescription:`Cuando está activado, el barrido diario también descarta cada archivo purgado de las estadísticas rápidas (filamento, tiempo, coste, energía). Desactivado de forma predeterminada — las estadísticas rápidas conservan la contribución, solo los archivos abandonan el disco.`,runNow:`Purgar los archivos ahora`,saveFailed:`No se pudieron guardar los ajustes de purga automática.`},connectedApps:{title:`Aplicaciones conectadas`,description:`Aplicaciones en las que se inicia sesión con la cuenta de Bambuddy. Cada aplicación recibe un ID de cliente y un secreto, y Bambuddy solo envía el inicio de sesión a la URL de retorno registrada aquí.`,requiresAuth:`Las aplicaciones conectadas necesitan la autenticación de Bambuddy. Actívala primero en Usuarios.`,name:`Nombre de la aplicación`,namePlaceholder:`p. ej. Gestor de pedidos`,callbackUrl:`URL de retorno`,callbackHint:`La documentación de la aplicación indica su URL de retorno. Debe coincidir exactamente.`,add:`Añadir aplicación`,empty:`Todavía no hay aplicaciones conectadas.`,clientId:`ID de cliente`,clientSecret:`Secreto de cliente`,lastUsed:`Último inicio de sesión`,disabledBadge:`Desactivada`,enable:`Activar`,disable:`Desactivar`,rotate:`Nuevo secreto`,delete:`Eliminar`,cancel:`Cancelar`,copy:`Copiar`,secret:{title:`{{name}}: copia el secreto ahora`,warning:`Pega el ID de cliente y el secreto en la aplicación. El secreto solo se muestra esta vez; si se pierde, crea uno nuevo.`,dismiss:`Lo he guardado`},confirmRotate:{title:`¿Crear un secreto nuevo?`,body:`"{{name}}" dejará de iniciar sesiones hasta que pegues en ella el secreto nuevo.`},confirmDelete:{title:`¿Eliminar esta aplicación?`,body:`"{{name}}" ya no podrá iniciar sesión de nadie. Si se vuelve a añadir, se pedirá permiso de nuevo a todos.`},toast:{created:`Aplicación añadida`,enabled:`Aplicación activada`,disabled:`Aplicación desactivada`,rotated:`Secreto nuevo creado`,deleted:`Aplicación eliminada`,copied:`Copiado al portapapeles`,copyFailed:`No se pudo copiar. Selecciona el texto y cópialo a mano.`,failed:`Algo salió mal`},authorize:{checking:`Comprobando la solicitud de inicio de sesión…`,redirecting:`Iniciando sesión…`,errorTitle:`No se puede iniciar sesión`,invalidRequest:`Esta solicitud de inicio de sesión no es válida: la aplicación no está registrada, está desactivada o usa otra URL de retorno. Pide a tu administrador de Bambuddy que revise Ajustes > Claves API > Aplicaciones conectadas.`,authDisabled:`El inicio de sesión con Bambuddy no está disponible porque la autenticación de Bambuddy está desactivada. Usa el inicio de sesión propio de la aplicación.`,failed:`Error al iniciar sesión. Vuelve a la aplicación e inténtalo de nuevo.`,title:`{{app}} quiere iniciar tu sesión`,signedInAs:`Sesión iniciada en Bambuddy como {{username}}`,sharedData:`{{app}} verá tu nombre de usuario, tu correo electrónico, tus grupos y tus permisos. No obtiene tu contraseña ni tu sesión de Bambuddy.`,allow:`Permitir`,deny:`Cancelar`}},cameraTokens:{scope:{camera_stream:`Transmisión de cámara`,camwall:`Muro de cámaras`,overlay:`Superposición de streaming`},title:`Tokens de API de la cámara`,navTitle:`Tokens de API de la cámara`,description:`Tokens de larga duración para incrustar la transmisión de la cámara en Home Assistant, Frigate, pantallas en modo quiosco o cualquier otra herramienta que necesite una dirección estable. El alcance se elige al crearlos; un token se puede revocar en cualquier momento.`,loading:`Cargando…`,confirmRevoke:{title:`¿Revocar este token?`,body:`Cualquier dispositivo que use "{{name}}" perderá el acceso de inmediato. Esto no se puede deshacer.`,cancel:`Cancelar`,confirm:`Revocar`},create:{scopeLabel:`Alcance`,hintCameraStream:`Un token de transmisión de cámara solo puede obtener transmisiones e instantáneas. Úsalo para Home Assistant, Frigate o cualquier cosa que incruste una sola cámara.`,hintCamWall:`Un token de muro de cámaras abre /camwall en una pantalla sin iniciar sesión. Puede ver el nombre y el estado de cada impresora, y sus transmisiones de cámara. No puede ver nombres de archivo, direcciones ni códigos de acceso.`,hintOverlay:`Un token de superposición de streaming abre /overlay/{printerId} en una pantalla sin iniciar sesión, para OBS o cualquier transmisión en vivo. Puede ver la transmisión de la cámara de una impresora y su estado de impresión en vivo, incluido el nombre de archivo que aparece en pantalla. No puede ver direcciones ni códigos de acceso.`,title:`Crear nuevo token`,nameLabel:`Nombre del token`,namePlaceholder:`p. ej. Home Assistant`,daysLabel:`Días hasta la caducidad`,submit:`Crear`,hint:`La vida útil máxima es de 365 días. El valor del token se muestra solo una vez al crearlo — cópielo ahora.`},created:{camWallUrlTitle:`Dirección del muro de cámaras para esta pantalla`,camWallUrlHint:`Abre esta dirección en la pantalla. Cualquiera que pueda leerla puede ver el muro, así que trátala como una llave: revoca el token para dejar la pantalla sin acceso.`,overlayUrlTitle:`Dirección de superposición para OBS`,overlayUrlHint:`Agrega esto como Fuente de navegador en OBS. Cambia el número de /overlay/1 por el número de tu impresora (de su dirección en la página Impresoras). Cualquiera que pueda leer la dirección puede ver la transmisión, así que trátala como una llave: revoca el token para cortar el acceso.`,title:`Token creado — cópielo ahora`,warning:`Esta es la única vez que este token estará visible. Después de cerrar este diálogo no podrá volver a verlo nunca.`,copy:`Copiar`,dismiss:`Lo he guardado`},list:{scope:`Alcance`,myTitle:`Mis tokens`,allTitle:`Todos los usuarios (vista de administración)`,empty:`Aún no hay tokens.`,name:`Nombre`,owner:`Propietario`,prefix:`Prefijo`,created:`Creado`,expires:`Caduca`,lastUsed:`Usado por última vez`,revoke:`Revocar`,expired:`Caducado`},toast:{created:`Token creado`,createFailed:`Error al crear el token`,revoked:`Token revocado`,revokeFailed:`Error al revocar el token`,loadFailed:`Error al cargar los tokens`,copied:`Copiado al portapapeles`,copyFailed:`Error al copiar — selecciónelo y cópielo manualmente`}},forecast:{title:`Previsión`,noSpools:`No se encontraron bobinas activas. Añada bobinas a su inventario para ver los datos de previsión.`,noUsageData:`No hay datos de uso disponibles — no se puede proyectar la cronología de existencias.`,sku:`SKU`,material:`Material`,stock:`Existencias`,dailyRate:`Tasa`,daysLeft:`Días restantes`,emptyBy:`Se agota el`,reorderBy:`Reabastecer antes del`,actions:`Acciones`,trend:`Tendencia`,estimated:`Est.`,noData:`Sin datos`,timeframe:`Periodo`,chartTitle:`Existencias previstas — Los 5 materiales principales`,dashedLinesROP:`Líneas discontinuas = puntos de reabastecimiento`,stockLevel:`Nivel de existencias`,reorderPoint:`Punto de reabastecimiento`,safetyMargin:`Margen de seguridad`,trendLegend:`Tendencia (basada en el historial, nivel de servicio del 95%)`,estimatedLegend:`Estimada (diferencia de peso)`,noDataLegend:`Sin datos`,ropLabel:`PR`,ssLabel:`ES`,safetyStockLegend:`Existencias de seguridad`,stockArrivalLegend:`Llegada de existencias`,stockoutLegend:`Rotura de existencias`,alertCount_one:`{{count}} alerta`,alertCount_other:`{{count}} alertas`,order:`Pedir`,save:`Guardar`,cancel:`Cancelar`,settingsSaved:`Ajustes guardados`,failedSaveSettings:`Error al guardar los ajustes`,globalLeadTimeSaved:`Plazo de entrega global guardado`,globalLeadTime:`Plazo de entrega global`,globalLeadTimeHint:`Mínimo del plazo de entrega global — se usa en el cálculo del punto de reabastecimiento para todos los SKU`,skuLeadTimeOverride:`Anulación del plazo de entrega del SKU`,skuLeadTimeHint:`0 = usar el plazo de entrega global. Establezca >0 para anularlo para este SKU.`,safetyMarginLabel:`Margen de seguridad`,effectiveLeadTime:`Plazo de entrega efectivo`,effectiveLeadTimeHint:`máx(global {{global}} d, SKU {{sku}} d)`,reorderPointHint:`d̄ × PE + margen de seguridad — pida cuando las existencias alcancen este nivel`,safetyMarginHint:`Existencias de seguridad estadísticas (z=1,65 × σ × √PE) + margen definido por el usuario`,safetyMarginHintDays:`Margen añadido sobre las existencias de seguridad estadísticas.{{approx}}`,safetyMarginHintDaysApprox:` ≈ {{g}} g a la tasa actual.`,safetyMarginHintG:`Margen de peso fijo añadido sobre las existencias de seguridad estadísticas.{{approx}}`,safetyMarginHintGApprox:` ≈ {{days}} d a la tasa actual.`,individualSpools:`Bobinas individuales`,labelWeight:`Etiqueta`,spoolCount_one:`{{count}} bobina`,spoolCount_other:`{{count}} bobinas`,stockBreakRisk:`Riesgo de rotura de existencias`,stockBreakDetail:`Quedan {{days}} d, plazo de entrega {{lt}} d.`,stockBreakBefore:`Rotura de existencias antes del reabastecimiento`,reorderNow:`Reabastecer ahora`,reorderTriggerPassed:`La fecha de activación {{date}} ha pasado.`,shoppingList:`Lista de la compra`,shoppingListItems_one:`({{count}} artículo)`,shoppingListItems_other:`({{count}} artículos)`,shoppingListEmpty:`La lista de la compra está vacía. Haga clic en el icono del carrito de cualquier fila para añadir artículos.`,addToCart:`Añadir a la lista de la compra`,alertsSnoozed:`Silenciar las alertas de este SKU`,alertsEnabled:`Reactivar las alertas de este SKU`,addedToCart:`Añadido a la lista de la compra`,failedAddItem:`Error al añadir el artículo`,listView:`Lista`,logisticsView:`Logística`,qty:`Cant.`,weight:`Peso`,leadTime:`Plazo de entrega`,expectedRestock:`Reabastecimiento previsto`,status:`Estado`,note:`Nota`,pending:`Pendiente`,purchased:`Comprado`,received:`Recibido`,markPurchased:`Marcar como comprado`,markReceived:`Marcar como recibido — añade bobinas al inventario de existencias`,resetToPending:`Restablecer a pendiente`,remove:`Quitar`,clearAll:`Borrar todo`,downloadCsv:`CSV`,addToCartTitle:`Añadir a la lista de la compra`,byQuantity:`Por cantidad`,byDuration:`Por duración`,numberOfSpools:`Número de bobinas`,lastHowManyDays:`¿Cuántos días debería durar?`,noUsageQty:`No hay datos de uso — cantidad establecida en 1.`,noteOptional:`Nota (opcional)`,notePlaceholder:`p. ej. para el proyecto X, urgente…`,addNSpools_one:`Añadir {{count}} bobina`,addNSpools_other:`Añadir {{count}} bobinas`,onArrival:`A la llegada`,stockBreakIn:`Rotura de existencias en {{days}} d.`,stockRunsOutBefore:`Las existencias se agotan antes de que transcurra el plazo de entrega de {{lt}} d.`,atRate:`A {{rate}} g/día necesita`,moreSpools_one:`{{count}} bobina más`,moreSpools_other:`{{count}} bobinas más`,bridgeGap:`para cubrir el déficit.`,noReadAccess:`No tiene permiso para ver las previsiones de inventario.`,noWriteAccess:`No tiene permiso para modificar los ajustes de previsión.`}};export{e as default}; \ No newline at end of file diff --git a/static/assets/eye-off-6CkaxYwP.js b/static/assets/eye-off-6CkaxYwP.js new file mode 100644 index 000000000..824fe5829 --- /dev/null +++ b/static/assets/eye-off-6CkaxYwP.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/fan-D6AmXZMv.js b/static/assets/fan-D6AmXZMv.js new file mode 100644 index 000000000..45c7aa414 --- /dev/null +++ b/static/assets/fan-D6AmXZMv.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),n=e(`fan`,[[`path`,{d:`M10.827 16.379a6.082 6.082 0 0 1-8.618-7.002l5.412 1.45a6.082 6.082 0 0 1 7.002-8.618l-1.45 5.412a6.082 6.082 0 0 1 8.618 7.002l-5.412-1.45a6.082 6.082 0 0 1-7.002 8.618l1.45-5.412Z`,key:`484a7f`}],[`path`,{d:`M12 12v.01`,key:`u5ubse`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/static/assets/filamentSwatchHelpers-D3oXQSGk.js b/static/assets/filamentSwatchHelpers-D3oXQSGk.js new file mode 100644 index 000000000..0c470fdb0 --- /dev/null +++ b/static/assets/filamentSwatchHelpers-D3oXQSGk.js @@ -0,0 +1 @@ +var e=2166136261,t=16777619;function n(...t){let n=e,i=new TextEncoder,a=i.encode(`__|`);for(let e of t)typeof e==`string`?n=r(n,i.encode(e+`|`)):e??(n=r(n,a));return n>>>0}function r(e,n){for(let r of n)e^=r,e=Math.imul(e,t)>>>0;return e}function i(e){let t=()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,(t^t>>>14)>>>0},n=(e,n)=>{if(!Number.isFinite(e)||!Number.isFinite(n))throw RangeError(`from and to must be finite numbers`);if(e>n)throw RangeError(`from must be less than or equal to to`);return e===n?e:e+t()/4294967295*(n-e)};return{next:()=>t()/4294967295,floatBetween:(e,t)=>n(e,t),intBetween:(e,t)=>{if(!Number.isInteger(e)||!Number.isInteger(t))throw RangeError(`from and to must be integers`);return Math.round(n(e,t))}}}var a={table:{dotCount:5,dotScale:1},preview:{dotCount:8,dotScale:1.5},card:{dotCount:40,dotScale:2},bar:{dotCount:20,dotScale:2},groupheader:{dotCount:80,dotScale:2}},o=[{value:``,labelKey:`inventory.colorEffect.none`},{value:`sparkle`,labelKey:`inventory.colorEffect.sparkle`},{value:`wood`,labelKey:`inventory.colorEffect.wood`},{value:`marble`,labelKey:`inventory.colorEffect.marble`},{value:`glow`,labelKey:`inventory.colorEffect.glow`},{value:`matte`,labelKey:`inventory.colorEffect.matte`},{value:`silk`,labelKey:`inventory.colorEffect.silk`},{value:`galaxy`,labelKey:`inventory.colorEffect.galaxy`},{value:`rainbow`,labelKey:`inventory.colorEffect.rainbow`},{value:`metal`,labelKey:`inventory.colorEffect.metal`},{value:`translucent`,labelKey:`inventory.colorEffect.translucent`},{value:`gradient`,labelKey:`inventory.colorEffect.gradient`},{value:`dual-color`,labelKey:`inventory.colorEffect.dualColor`},{value:`tri-color`,labelKey:`inventory.colorEffect.triColor`},{value:`multicolor`,labelKey:`inventory.colorEffect.multicolor`}],s=`repeating-conic-gradient(#979797 0% 25%, #f5f5f5 0% 50%)`,c=`12px 12px`,l={sparkle:(e=0,t=`table`)=>{let n=i(e),r=a[t]??a.table,o=[];for(let e=0;e`repeating-linear-gradient(90deg, rgba(0,0,0,0.18) 0 1px, transparent 1px 6px, rgba(0,0,0,0.08) 6px 7px, transparent 7px 12px)`,marble:()=>`repeating-linear-gradient(135deg, rgba(255,255,255,0.18) 0 2px, transparent 2px 8px), repeating-linear-gradient(45deg, rgba(0,0,0,0.10) 0 1px, transparent 1px 7px)`,glow:()=>`radial-gradient(circle at 50% 50%, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 70%)`,matte:()=>`linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.10) 100%)`,silk:()=>`linear-gradient(110deg, rgba(255,255,255,0) 30%, rgba(255,255,255,0.30) 50%, rgba(255,255,255,0) 70%)`,galaxy:()=>`linear-gradient(110deg, rgba(255,255,255,0) 25%, rgba(255,255,255,0.40) 50%, rgba(255,255,255,0) 75%)`,metal:()=>`repeating-linear-gradient(90deg, rgba(255,255,255,0.10) 0 1px, transparent 1px 3px), linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(0,0,0,0.18) 100%)`};function u(e){let t=e.trim().replace(/^#/,``);return t.length!==6&&t.length!==8||!/^[0-9a-fA-F]+$/.test(t)?null:`#${t}`}function d(e){return e?e.split(`,`).map(e=>u(e)).filter(e=>!!e):[]}function f(e,t,n,r){let i=e?u(e):null;if(t.length===0)return`linear-gradient(${i??`#808080`}, ${i??`#808080`})`;let a=t.length===1?[t[0],t[0]]:t,o=(n??``).toLowerCase(),s=(r??``).toLowerCase();if(o===`multicolor`||s===`multicolor`){let e=a.length;return`conic-gradient(from 0deg, ${a.map((t,n)=>`${t} ${(n/e*360).toFixed(3)}deg ${((n+1)/e*360).toFixed(3)}deg`).join(`, `)})`}if(s===`dual-color`||s===`tri-color`){let e=a.length;return`linear-gradient(to right, ${a.map((t,n)=>`${t} ${(n/e*100).toFixed(3)}% ${((n+1)/e*100).toFixed(3)}%`).join(`, `)})`}return`linear-gradient(135deg, ${a.join(`, `)})`}function p(e,t,n){let r=l[e];return r?r(n,t):null}function m(e){let t=d(e.extraColors),r=f(e.rgba,t,e.subtype,e.effectType),i=n(e.rgba,e.extraColors,e.subtype,e.effectType),a=typeof e.effectType==`string`?p(e.effectType,e.effectSize,i):null,o=[];return a&&(Array.isArray(a)?a:[a]).forEach(e=>{o.push({image:e,size:`cover`})}),o.push({image:r,size:`cover`}),o.push({image:s,size:c}),{backgroundImage:o.map(e=>e.image).join(`, `),backgroundSize:o.map(e=>e.size).join(`, `)}}export{m as n,d as r,o as t}; \ No newline at end of file diff --git a/static/assets/filamentTypes-Dysa4k6j.js b/static/assets/filamentTypes-Dysa4k6j.js new file mode 100644 index 000000000..b2b36795f --- /dev/null +++ b/static/assets/filamentTypes-Dysa4k6j.js @@ -0,0 +1 @@ +function e(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim();e&&!t.includes(e)&&t.push(e)}return t}export{e as t}; \ No newline at end of file diff --git a/static/assets/file-DDkFXH-b.js b/static/assets/file-DDkFXH-b.js new file mode 100644 index 000000000..40ea5ff72 --- /dev/null +++ b/static/assets/file-DDkFXH-b.js @@ -0,0 +1 @@ +function e(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=1024,r=Math.floor(Math.log(e)/Math.log(n)),i=e/n**r;return r===0?`${i} ${t[r]}`:`${i.toFixed(1)} ${t[r]}`}export{e as t}; \ No newline at end of file diff --git a/static/assets/file-box-04V4jZ9_.js b/static/assets/file-box-04V4jZ9_.js new file mode 100644 index 000000000..e0f36a2cb --- /dev/null +++ b/static/assets/file-box-04V4jZ9_.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`file-box`,[[`path`,{d:`M14.5 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.8`,key:`1kchwa`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11.7 14.2 7 17l-4.7-2.8`,key:`1yk8tc`}],[`path`,{d:`M3 13.1a2 2 0 0 0-.999 1.76v3.24a2 2 0 0 0 .969 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01z`,key:`19flxy`}],[`path`,{d:`M7 17v5`,key:`1yj1jh`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/file-spreadsheet-WxOA9vYy.js b/static/assets/file-spreadsheet-WxOA9vYy.js new file mode 100644 index 000000000..55170be11 --- /dev/null +++ b/static/assets/file-spreadsheet-WxOA9vYy.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/fr-CvEzyKAc.js b/static/assets/fr-CvEzyKAc.js new file mode 100644 index 000000000..e3b450ef9 --- /dev/null +++ b/static/assets/fr-CvEzyKAc.js @@ -0,0 +1,4 @@ +var e={nav:{printers:`Imprimantes`,archives:`Archives`,queue:`File d'attente d'impression`,stats:`Statistiques`,profiles:`Profils`,maintenance:`Maintenance`,projects:`Projets`,inventory:`Filament`,finance:`Finances`,files:`Gestionnaire de fichiers`,makerworld:`MakerWorld`,modelSources:`Sources de modèles`,notifications:`Notifications`,settings:`Paramètres`,system:`Système`,collapseSidebar:`Réduire la barre latérale`,expandSidebar:`Développer la barre latérale`,update:`Mise à jour`,updateAvailable:`Mise à jour disponible : v{{version}}`,updateAvailableBanner:`La version {{version}} est disponible !`,viewUpdate:`Voir la mise à jour`,viewOnGithub:`Voir sur GitHub`,keyboardShortcuts:`Raccourcis clavier (?)`,switchToLight:`Passer au mode clair`,switchToDark:`Passer au mode sombre`,switchToSystem:`Passer au mode système`,smartSwitches:`Interrupteurs intelligents`,logout:`Déconnexion`,installApp:`Installer l'application`,installAppSuccess:`Bambuddy a été installé`},announcements:{title:`Annonces`,unread:`Annonces non lues : {{count}}`,empty:`Aucune annonce pour le moment.`,earlier:`Précédentes ({{count}})`,new:`Nouveau`,readMore:`En savoir plus`,readMoreCount:`En savoir plus (+{{count}})`,gotIt:`Compris`,source:`Des développeurs de Bambuddy, récupérées depuis GitHub. Vous pouvez les désactiver dans les paramètres.`,level:{info:`Information`,important:`Importante`,critical:`Critique`}},common:{plusNMore:`+{{count}} autres`,save:`Enregistrer`,saving:`Enregistrement...`,cancel:`Annuler`,delete:`Supprimer`,edit:`Modifier`,add:`Ajouter`,close:`Fermer`,confirm:`Confirmer`,loading:`Chargement...`,error:`Erreur`,errorLoading:`Erreur de chargement`,retry:`Réessayer`,success:`Succès`,warning:`Avertissement`,enabled:`Activé`,disabled:`Désactivé`,yes:`Oui`,no:`Non`,on:`On`,off:`Désactivé`,all:`Tous`,none:`Aucun`,search:`Rechercher`,filter:`Filtrer`,sort:`Trier`,refresh:`Actualiser`,download:`Télécharger`,upload:`Téléverser`,uploading:`Téléversement...`,uploadFailed:`Échec du téléversement`,actions:`Actions`,status:`Statut`,name:`Nom`,description:`Description`,date:`Date`,time:`Heure`,hours:`heures`,minutes:`minutes`,seconds:`secondes`,days:`jours`,enable:`Activer`,disable:`Désactiver`,permissions:`Autorisations`,noPrinters:`Aucune imprimante configurée`,noData:`Aucune donnée disponible`,linkNotFound:`Lien non trouvé`,required:`Requis`,optional:`Optionnel`,dismiss:`Ignorer`,apply:`Appliquer`,reset:`Réinitialiser`,export:`Exporter`,import:`Importer`,clear:`Effacer`,selectAll:`Tout sélectionner`,deselectAll:`Tout désélectionner`,noChange:`— Aucun changement —`,unchanged:`Inchangé`,unassigned:`Non assigné`,unknown:`Inconnu`,unknownError:`Erreur inconnue`,today:`Aujourd'hui`,tomorrow:`Demain`,asap:`Dès que possible`,overdue:`En retard`,now:`Maintenant`,collapse:`Réduire`,expand:`Développer`,previous:`Précédent`,next:`Suivant`,viewArchive:`Voir l'archive`,viewInFileManager:`Voir dans le gestionnaire de fichiers`,addedBy:`Ajouté par {{username}}`,prints:`impressions`,more:`+{{count}} de plus`,ascending:`Croissant`,descending:`Décroissant`,back:`Retour`,copy:`Copier`,copied:`Copié\xA0!`,printer:`Imprimante`,remove:`Retirer`,type:`Type`,print:`Imprimer`,rename:`Renommer`,move:`Déplacer`,create:`Créer`,duplicate:`Dupliquer`,left:`Gauche`,right:`Droite`,user:`Utilisateur`,run:`Exécuter`,running:`En cours d'exécution...`},finance:{allTypes:`Tous les types`,allCostCenters:`Tous les centres de coûts`,title:`Finances`,subtitle:`Portefeuille, transactions personnelles et centres de coûts`,noAccess:`Vous n'avez pas la permission d'accéder aux données financières.`,personalView:`Vue personnelle`,adminView:`Vue administrateur`,createCostCenter:`Créer un centre de coûts`,adjustWallet:`Ajuster le portefeuille`,addManualPrint:`Ajouter un tirage manuel`,manageMembers:`Gérer les membres du centre de coûts`,currentBalance:`Solde personnel`,transactions:`Opérations`,personalTransactions:`Transactions personnelles`,costCenters:`Centres de coûts`,availableForPrinting:`Disponible pour l'attribution d'impression`,costCenterName:`Nom`,budgetType:`Type de budget`,monthlyBudget:`Budget mensuel`,totalBudget:`Budget total`,noBudget:`Aucun budget`,create:`Créer`,selectUser:`Sélectionner un utilisateur`,transactionType:`Type`,amount:`Montant`,noCostCenter:`Aucun centre de coûts`,descriptionOptional:`Description (facultative)`,applyAdjustment:`Appliquer l'ajustement`,memberCanPrint:`Le membre peut imprimer`,addMember:`Ajouter un membre`,canPrint:`Peut imprimer`,noMembers:`Aucun membre assigné.`,editCostCenter:`Modifier le centre de coûts`,myCostCenters:`Mes centres de coûts`,costCentersHint:`Vérifier les limites budgétaires et garder les coûts sous contrôle`,noCostCenters:`Aucun centre de coûts trouvé.`,owner:`Propriétaire`,balance:`Solde du compte`,unlimited:`Illimité`,budgetPolicyHint:`Les soldes de compte servent au suivi des coûts. L’impression est limitée uniquement par le budget du centre de coûts sélectionné ; sans budget, elle est illimitée.`,budget:`Budget`,shared:`Partagé`,cannotEditPrivateCostCenter:`Les centres de coûts privés ne peuvent pas être modifiés ici`,recentTransactions:`Transactions récentes`,transactionsHint:`Filtrer par type et centre de coûts`,first:`Première`,prev:`Précédente`,next:`Suivante`,last:`Dernière`,pageNumberOf:`Page {{page}} sur {{total}}`,noTransactions:`Aucune transaction disponible.`,noTransactionsForFilter:`Aucune transaction ne correspond aux filtres sélectionnés.`,costCenter:`Centre de coûts`,balanceAfter:`Solde après`,userWithId:`Utilisateur #{{id}}`,partial:`Partiel`,editTransaction:`Modifier la transaction`,selectCostCenter:`Sélectionner un centre de coûts...`,costCenterRequired:`Veuillez sélectionner un centre de coûts`,amountExample:`p. ex. 4,00`,manualAdjustmentExample:`p. ex. Ajustement manuel`,userRequired:`Veuillez sélectionner un utilisateur`,amountInvalid:`Le montant doit être un nombre valide`,createdCostCenter:`Centre de coûts créé`,createCostCenterFailed:`Impossible de créer le centre de coûts`,transactionDeleted:`Transaction supprimée`,deleteTransactionFailed:`Impossible de supprimer la transaction`,transactionEdited:`Transaction mise à jour et ledger recalculé`,editTransactionFailed:`Impossible de modifier la transaction`,manualPrintCreated:`Frais de tirage manuel ajoutés et ledger recalculé`,manualPrintFailed:`Impossible de créer le tirage manuel`,memberSaved:`Membre enregistré`,memberSaveFailed:`Impossible d'enregistrer le membre`,memberRemoved:`Membre supprimé`,memberRemoveFailed:`Impossible de supprimer le membre`,costCenterNameRequired:`Le nom du centre de coûts est requis`,costCenterUpdated:`Centre de coûts mis à jour`,costCenterUpdateFailed:`Impossible de mettre à jour le centre de coûts`,confirmDeleteCostCenter:`Supprimer le centre de coûts « {{name}} » ?`,costCenterDeleted:`Centre de coûts supprimé`,costCenterDeleteFailed:`Impossible de supprimer le centre de coûts`,deleteTransactionConfirm:`Supprimer cette transaction ? Les soldes seront recalculés automatiquement.`,deposit:`Dépôt`,withdraw:`Retrait`,printCharge:`Frais d'impression`,deleteTransaction:`Supprimer la transaction`},printers:{locations:{title:`Emplacements des imprimantes`,backToPrinters:`Retour aux imprimantes`,subtitle:`{{grouped}} avec emplacement, {{ungrouped}} sans`,search:`Rechercher des emplacements...`,showEmpty:`Afficher les vides`,hideEmpty:`Masquer les vides`,select:`Sélectionner`,done:`Terminé`,sortNameAsc:`Nom A→Z`,sortNameDesc:`Nom Z→A`,sortCountAsc:`Moins d'imprimantes`,sortCountDesc:`Plus d'imprimantes`,create:`Nouvel emplacement`,createTitle:`Créer un emplacement`,editTitle:`Modifier l'emplacement`,namePlaceholder:`Nom de l'emplacement`,icon:`Icône`,color:`Couleur`,noColor:`Aucune couleur`,none:`Aucun emplacement d'imprimante pour l'instant`,noResults:`Aucun emplacement ne correspond à la recherche`,printerCount:`Imprimantes : {{count}}`,noPrinters:`Aucune imprimante à cet emplacement`,selectPrinter:`Sélectionner l'imprimante`,move:`Déplacer vers un autre emplacement`,moveButton:`Déplacer`,removeFromLocation:`Retirer de l'emplacement`,ungroupedPrinters:`Imprimantes sans emplacement : {{count}}`,selected:`Sélection : {{count}}`,deleteSelected:`Supprimer la sélection`,moveTitle:`Déplacer l'imprimante`,moveTitleMany:`Déplacer les imprimantes ({{count}})`,targetPlaceholder:`Choisir un emplacement...`,noLocation:`Aucun emplacement`,deleteTitle:`Supprimer l'emplacement`,deleteTitleMany:`Supprimer les emplacements ({{count}})`,deleteMessage:`Supprimer {{names}} ? Imprimantes qui resteront sans emplacement : {{count}}.`,created:`Emplacement créé`,saved:`Emplacement mis à jour`,deleted:`Emplacements supprimés : {{count}}`,moved:`Imprimantes déplacées : {{count}}`,failed:`Impossible d'enregistrer la modification : {{error}}`},addPreflight:{checking:`Vérification de la connexion...`,warning:`Certaines vérifications de connexion ont échoué. Cette imprimante pourrait apparaître hors ligne. Examinez les vérifications ci-dessous, corrigez ce que vous pouvez, ou enregistrez quand même.`,back:`Retour`,saveAnyway:`Enregistrer quand même`},title:`Imprimantes`,addPrinter:`Ajouter une imprimante`,editPrinter:`Modifier l'imprimante`,deletePrinter:`Supprimer l'imprimante`,printerName:`Nom de l'imprimante`,serialNumber:`Numéro de série`,ipAddress:`Adresse IP / Nom d'hôte`,accessCode:`Code d'accès`,model:`Modèle`,nozzleCount:`Nombre de buses`,autoArchive:`Auto-archivage`,status:{available:`Disponible`,idle:`Inactif`,printing:`Impression en cours`,paused:`En pause`,offline:`Hors ligne`,problem:`Problème`,error:`Erreur`,finished:`Terminé`,unknown:`Inconnu`},temperatures:{nozzle:`Buse`,bed:`Plateau`,chamber:`Chambre`},heaterHistory:{title:`Historique des chauffages`,openLabel:`Voir l'historique des chauffages`,nozzle:`Buse`,nozzle2:`Buse 2`,bed:`Plateau`,chamber:`Chambre`,error:`Échec du chargement de l'historique`,empty:`Aucune donnée enregistrée`},progress:`{{percent}}% terminé`,timeRemaining:`{{time}} restant`,deleteConfirm:`Êtes-vous sûr de vouloir supprimer "{{name}}" ?`,maintenanceOk:`Maintenance OK`,maintenanceWarning:`{{count}} avertissement`,maintenanceWarning_plural:`{{count}} avertissements`,maintenanceDue:`{{count}} échéance`,maintenanceDue_plural:`{{count}} échéances`,sort:{name:`Nom`,status:`Statut`,model:`Modèle`,location:`Emplacement`,eta:`Temps restant`,ascending:`Tri croissant`,descending:`Tri décroissant`},cardSize:{small:`Petites cartes`,medium:`Cartes moyennes`,large:`Grandes cartes`,extraLarge:`Très grandes cartes`},pageView:{openCamWallPage:`Ouvrir le mur de caméras en pleine page`,cards:`Cartes`,camWall:`Mur de caméras`},camWall:{page:{tokenRejected:`Ce lien du mur de caméras n'est plus valide. Le jeton a peut-être expiré ou été révoqué.`,loadFailed:`Impossible de charger les imprimantes.`},tileSize:{small:`Petites vignettes`,medium:`Vignettes moyennes`,large:`Grandes vignettes`,extraLarge:`Très grandes vignettes`},noPrinters:`Aucune imprimante à afficher`,noSignal:`Aucun signal`,live:`En direct`,snap:`Photo`,off:`Arrêt`,summary:`{{live}} en direct, {{snap}} captures, {{total}} au total`,layer:`Couche {{cur}}/{{total}}`,timeLeft:`{{time}} restantes`,statusMode:{off:`Arrêt`,compact:`Compact`,full:`Complet`},settings:{title:`Paramètres du mur de caméras`,maxLive:`Flux en direct max.`,maxLiveHint:`Combien de vignettes diffusent en direct à la fois. Les autres se rafraîchissent en captures.`,snapshotInterval:`Intervalle de capture (secondes)`,snapshotIntervalHint:`À quelle fréquence les vignettes hors direct récupèrent une nouvelle capture.`,statusOverlay:`Overlay de statut`,statusOverlayHint:`Compact : badge de statut seul. Complet : + progression, couche, temps restant.`}},hideOffline:`Masquer hors ligne`,nextAvailable:`Prochaine disponible`,powerOn:`Allumer`,offlinePrintersWithPlugs:`Imprimantes hors ligne avec prises connectées`,noPrintersConfigured:`Aucune imprimante configurée pour le moment`,search:`Rechercher des imprimantes...`,noSearchResults:`Aucune imprimante ne correspond à votre recherche ou à vos filtres`,filter:{allStatuses:`Tous les statuts`,allLocations:`Tous les emplacements`},toolbar:{filters:`Filtres`,view:`Vue`,actions:`Actions`},readyToPrint:`Prête à imprimer`,external:`Externe`,ext:`Externe`,extL:`Ext-L`,extR:`Ext-R`,deleteArchives:`Supprimer les archives d'impression`,noLabel:`Pas d'étiquette`,printPreview:`Aperçu avant impression`,width:`Largeur`,height:`Hauteur`,noObjectsFound:`Aucun objet trouvé`,objectsLoadedOnPrintStart:`Les objets sont chargés au début de l'impression`,willBeSkipped:`Sera sauté`,name:`Nom`,serialCannotBeChanged:`Le numéro de série ne peut pas être modifié`,locationHelp:`Utilisé pour grouper les imprimantes et filtrer la file d'attente`,wifiSignal:{veryWeak:`Très faible`,weak:`Faible`,fair:`Moyen`,good:`Bon`,excellent:`Excellent`},maintenanceUpToDate:`Maintenance à jour - Cliquez pour voir`,maintenance:{title:`En maintenance`,subtitle:`Cette imprimante est en pause — non connectée, non éligible à la file d'attente, sans notifications.`,pillLabel:`Maintenance`,exitButton:`Quitter la maintenance`,menuEnter:`Activer le mode maintenance`,menuExit:`Quitter le mode maintenance`,toastEntered:`{{name}} est maintenant en mode maintenance`,toastExited:`{{name}} est de nouveau en ligne`,confirmMidPrintTitle:`Passer en mode maintenance pendant une impression ?`,confirmMidPrintMessage:`{{name}} est en cours d'impression. Le mode maintenance déconnectera MQTT et arrêtera le suivi de progression ainsi que les notifications de fin pour ce travail. Continuer ?`,editFieldLabel:`Mode maintenance`,editFieldHelp:`Quand activé, cette imprimante est mise en pause de MQTT, de la file d'attente et des notifications — utile pour les réparations, les installations Bambuddy parallèles ou une suspension temporaire.`},chamberLightOn:`Allumer la lumière de la chambre`,chamberLightOff:`Éteindre la lumière de la chambre`,files:`Fichiers`,browseFiles:`Parcourir les fichiers de l'imprimante`,autoOffAfterPrint:`Extinction auto après impression`,autoOffExecuted:`Extinction auto exécutée - rallumez pour réinitialiser`,hmsErrors:`Erreurs HMS`,viewHmsErrors:`Voir {{count}} erreur(s) HMS`,resume:`Reprendre`,pause:`Pause`,stop:`Arrêter`,camera:`Caméra`,skipObject:`Sauter l'objet`,reconnect:`Reconnecter`,forceRefresh:`Forcer l'actualisation`,forceRefreshSuccess:`Actualisation demandée`,mqttDebug:`Débogage MQTT`,printerInformation:`Informations imprimante`,copyToClipboard:`Copier`,copied:`Copié !`,state:`État`,wifiSignalLabel:`Signal WiFi`,developerMode:`Mode développeur`,enabled:`Activé`,disabled:`Désactivé`,addedOn:`Ajoutée le`,sdCard:`Carte SD`,inserted:`Insérée`,notInserted:`Non insérée`,totalPrintHours:`Heures d'impression`,activeNozzle:`Active : buse {{nozzle}}`,amsSwitchInletTooltip:`Sélecteur de chemin de filament IN-{{inlet}} ({{side}}) — alimente les deux buses`,nozzleRack:`Rack à buses`,nozzleDocked:`Rangée`,nozzleMounted:`Montée`,nozzleActive:`Actif`,nozzleIdle:`Inactive`,nozzleDiameter:`Diamètre`,nozzleType:`Type`,nozzleStatus:`Statut`,nozzleFilament:`Filament`,nozzleWear:`Usure`,nozzleMaxTemp:`Temp Max`,nozzleSerial:`Série`,nozzleHardenedSteel:`Acier Trempé`,nozzleStainlessSteel:`Acier Inoxydable`,nozzleTungstenCarbide:`Carbure de Tungstène`,nozzleFlow:`Débit`,nozzleHighFlow:`Haut débit`,nozzleStandardFlow:`Standard`,firmwareUpdate:`Mise à jour Firmware`,firmwareInstructions:`Sur l'écran de l'imprimante, allez dans`,firmwareNav:`Naviguez vers`,settings:`Paramètres`,firmware:`Micrologiciel`,discoverPrinters:`Découvrir les imprimantes`,searching:`Recherche...`,manualEntry:`Saisie manuelle`,addFromCloud:`Ajouter depuis le Cloud`,toast:{printerDeleted:`Imprimante supprimée`,missingSpoolAssignment:`Impression démarrée sur {{printer}}. Attribution de bobine manquante pour : {{slots}}`,killSwitchTriggered:`Le coupe-circuit de facturation a arrêté une impression non autorisée sur {{printer}} : {{filename}}`,billingChargeFailed:`La facturation de {{filename}} sur {{printer}} a échoué. La réservation budgétaire a été conservée ; consultez les journaux du serveur.`,assignmentVerified:`Filament chargé dans l'emplacement {{slot}} ({{printer}})`,assignmentVerifiedNoKprofile:`Emplacement {{slot}} sur {{printer}} chargé, mais le profil de calibration de débit (profil K) n'a pas été appliqué`,assignmentNotConfirmed:`Impossible de confirmer l'attribution de l'emplacement {{slot}} sur {{printer}} — vérifiez l'emplacement AMS`,printerAdded:`Imprimante ajoutée`,printerUpdated:`Imprimante mise à jour`,failedToDelete:`Échec de la suppression`,failedToAdd:`Échec de l'ajout`,connectionFailedNotAdded:`Connexion à l'imprimante impossible. Vérifiez l'IP, le numéro de série et le code d'accès, et confirmez que le mode LAN-only est activé. L'imprimante n'a pas été ajoutée.`,failedToUpdate:`Échec de la mise à jour`,commandSent:`Commande envoyée`,failedToSendCommand:`Échec de l'envoi de la commande`,turnedOn:`{{name}} allumée`,failedToPowerOn:`Échec de l'allumage de {{name}}`,scriptTriggered:`Script déclenché`,printStopped:`Impression arrêtée`,printPaused:`Impression en pause`,printResumed:`Impression reprise`,referenceDeleted:`Référence supprimée`,detectionAreaSaved:`Zone de détection enregistrée`,failedToRunScript:`Échec du script`,failedToStopPrint:`Échec de l'arrêt`,failedToPausePrint:`Échec de la mise en pause`,failedToResumePrint:`Échec de la reprise`,failedToControlChamberLight:`Échec du contrôle de la lumière`,failedToSetSpeed:`Échec du réglage de la vitesse`,failedToUpdateSetting:`Échec de mise à jour du paramètre`,failedToSkipObjects:`Échec du saut d'objets`,failedToRereadRfid:`Échec lecture RFID`,failedToCheckPlate:`Échec vérification plateau`,failedToUpdateLabel:`Échec mise à jour étiquette`,failedToDeleteReference:`Échec suppression référence`,failedToSaveDetectionArea:`Échec enregistrement zone`,plateCheckEnabled:`Vérification plateau activée`,plateCheckDisabled:`Vérification plateau désactivée`,calibrationSaved:`Calibration enregistrée !`,calibrationFailed:`Échec de la calibration`,rfidRereadInitiated:`Lecture RFID initiée`,loadInitiated:`Chargement du filament…`,unloadInitiated:`Déchargement du filament…`,failedToLoad:`Échec du chargement du filament`,failedToUnload:`Échec du déchargement du filament`},connection:{connected:`Connecté`,offline:`Hors ligne`},plateStatus:{markCleared:`Marquer le plateau comme dégagé`,cleared:`Plateau dégagé`,notCleared:`Plateau non dégagé`,inUse:`Plateau en cours d'utilisation`},queue:{inQueue:`{{count}} impression en file`,inQueue_plural:`{{count}} impressions en file`},controls:`Contrôles`,rfid:{reread:`Relire RFID`},ams:{load:`Charger`,unload:`Décharger`,feedTitle:`Charger {{slot}} vers quelle buse ?`,feedPrompt:`Le Filament Track Switch peut diriger cet emplacement vers les deux buses. Choisissez celle à alimenter.`,feedLeft:`Buse gauche`,feedRight:`Buse droite`,feedAlreadyLoaded:`Déjà chargé`,switchNotReady:`Le Filament Track Switch n'est pas encore configuré. Affectez chaque AMS à une entrée sur l'imprimante, puis réessayez.`},bedJog:{limitWarning:`Les limites de déplacement ne sont pas appliquées lors des mouvements manuels : un bug du firmware Bambu ignore les butées logicielles pour les commandes à distance. Déplacez avec précaution pour éviter une collision.`,title:`Commandes de déplacement`,bed:`Plateau`,step:`Pas (mm)`,up:`Monter le plateau`,down:`Descendre le plateau`,toolheadUp:`Monter la tête`,toolheadDown:`Descendre la tête`,disabledWhilePrinting:`Désactivé pendant l'impression`,notHomedTitle:`Imprimante non référencée`,notHomedMessage:`L'imprimante n'a pas été référencée depuis la dernière impression. Lancez la référence automatique d'abord pour un positionnement sûr (parque la tête d'outil, puis référence X, Y et Z), ou déplacez quand même — les butées logicielles seront ignorées.`,homeZ:`Référence automatique`,moveAnyway:`Déplacer quand même`,homingStarted:`Référencement automatique en cours…`},permission:{noAdd:`Pas d'autorisation pour ajouter`,noEdit:`Pas d'autorisation pour modifier`,noDelete:`Pas d'autorisation pour supprimer`,noControl:`Pas d'autorisation pour contrôler`,noFiles:`Pas d'autorisation pour les fichiers`,noAmsRfid:`Pas d'autorisation pour le RFID`,noSmartPlugControl:`Pas d'autorisation pour les prises`,noCamera:`Pas d'autorisation pour les caméras`},modal:{addTitle:`Ajouter une imprimante`,editTitle:`Modifier l'imprimante`,myPrinter:`Mon imprimante`,selectModel:`Choisir un modèle...`,locationGroup:`Emplacement / Groupe (optionnel)`,locationPlaceholder:`ex: Atelier, Bureau`,autoArchiveLabel:`Auto-archiver les impressions terminées`,wearCostLabel:`Coût d'usure par heure d'impression ({{currency}})`,wearCostHelp:`Ce qu'une heure d'impression coûte à cette imprimante en usure et en pièces. Il s'ajoute au coût de chaque impression à partir de maintenant ; les impressions précédentes ne changent pas. Laissez vide pour le désactiver.`,fromPrinterSettings:`Depuis les paramètres imprimante`,modelOptional:`Modèle (optionnel)`,saveChanges:`Enregistrer les modifications`},skipObjects:{tooltip:`Sauter des objets`,onlyWhilePrinting:`Sauter (uniquement pendant l'impression)`,requiresMultiple:`Sauter (nécessite 2+ objets)`,title:`Sauter des objets`,matchIdsInfo:`Faites correspondre les IDs avec l'écran de l'imprimante`,printerShowsIds:`L'écran affiche les IDs des objets sur le plateau`,skipSelected:`Sauter la sélection`,skipping:`Saut en cours...`,noObjectsSelected:`Aucun objet sélectionné`,selectObjectsToSkip:`Sélectionnez les objets à ignorer`,skipped:`sauté`,objectsSkipped:`Objets sautés`,activeCount:`{{count}} actifs`,waitForLayer:`Attendez la couche 2 pour sauter des objets (actuelle : {{layer}})`,skip:`Sauter`,confirmTitle:`Sauter l'objet ?`,confirmMessage:`Voulez-vous vraiment sauter "{{name}}" ? Cette action est irréversible.`,confirmAllMessage:`Tous les objets restants sont sélectionnés. Cela arrêtera la tâche d’impression. Continuer ?`,confirmMultipleMessage:`Sauter {{count}} objets sélectionnés ? Cette action est irréversible.`},confirm:{deleteTitle:`Supprimer l'imprimante`,deleteMessage:`Supprimer "{{name}}" ? Cela retirera tous les paramètres de connexion.`,deleteArchivesNote:`Tout l'historique sera définitivement supprimé.`,keepArchivesNote:`L'historique sera conservé mais plus associé à cette imprimante.`,stopTitle:`Arrêter l'impression`,stopMessage:`Arrêter l'impression sur "{{name}}" ?`,stopButton:`Arrêter`,pauseTitle:`Mettre en pause`,pauseMessage:`Mettre en pause l'impression sur "{{name}}" ?`,pauseButton:`Pause`,resumeTitle:`Reprendre l'impression`,resumeMessage:`Reprendre l'impression sur "{{name}}" ?`,resumeButton:`Reprendre`,powerOnTitle:`Allumer l'imprimante`,powerOnMessage:`Allumer "{{name}}" ?`,powerOnButton:`Allumer`,powerOffTitle:`Éteindre l'imprimante`,powerOffMessage:`Éteindre "{{name}}" ?`,powerOffWarning:`ATTENTION : "{{name}}" imprime ! L'éteindre maintenant peut endommager l'imprimante.`,powerOffButton:`Éteindre`,haToggleTitle:`Basculer "{{name}}"`,haToggleMessage:`Basculer l'entité Home Assistant {{entity}} ? Cela peut couper l'alimentation si elle est actuellement activée.`,haToggleWarning:`ATTENTION : "{{name}}" imprime ! Basculer {{entity}} peut couper l'alimentation et interrompre l'impression. Continuer ?`,haToggleButton:`Basculer`},bulk:{select:`Sélectionner`,selectAll:`Tout sélectionner`,selectByLocation:`Sélectionner par emplacement`,selected:`{{count}} sélectionné(s)`,actions:{stop:`Arrêter`,pause:`Pause`,resume:`Reprendre`,clearPlate:`Vider le plateau`,clearHMS:`Effacer les notifications`},confirm:{stopTitle:`Arrêter {{count}} impressions`,stopMessage:`Cela annulera les impressions actives sur {{count}} imprimante(s). Cette action est irréversible.`,stopButton:`Tout arrêter`,pauseTitle:`Mettre en pause {{count}} impressions`,pauseMessage:`Cela mettra en pause les impressions actives sur {{count}} imprimante(s).`,pauseButton:`Tout mettre en pause`,clearPlateTitle:`Vider {{count}} plateaux`,clearPlateMessage:`Cela videra le plateau sur {{count}} imprimante(s) et pourrait lancer les travaux en file d'attente.`,clearPlateButton:`Tout vider`},success:`{{action}} terminé sur {{count}} imprimante(s)`,partial:`{{succeeded}} réussi(s), {{failed}} échoué(s)`,noneApplicable:`Aucune imprimante sélectionnée n'est dans le bon état pour cette action`,selectByState:`Sélectionner par état`},discovery:{title:`Découvrir les imprimantes`,searching:`Recherche...`,scanning:`Scan en cours...`,scanProgress:`Scan... {{scanned}}/{{total}}`,foundPrinters:`{{count}} imprimante(s) trouvée(s)`,noPrintersFound:`Aucune imprimante trouvée`,noPrintersFoundSubnet:`Aucune imprimante dans ce sous-réseau.`,noPrintersFoundNetwork:`Aucune imprimante sur le réseau.`,allConfigured:`Toutes les imprimantes trouvées sont déjà configurées.`,alreadyAdded:`Déjà ajoutée`,select:`Sélectionner`,manualEntry:`Saisie manuelle`,addFromCloud:`Ajouter depuis le Cloud`,subnetToScan:`Sous-réseau à scanner`,dockerNote:`Docker détecté. Entrez le sous-réseau en notation CIDR. Nécessite network_mode: host.`,scanSubnet:`Scanner le sous-réseau`,discoverNetwork:`Découvrir sur le réseau`,scanningSubnet:`Scan du sous-réseau pour imprimantes Bambu...`,scanningNetwork:`Scan du réseau...`,serialRequired:`Série requis`,unknown:`Inconnu`,failedToStart:`Échec du démarrage de la découverte`,customSubnetOption:`Sous-réseau personnalisé...`,customSubnetLabel:`Sous-réseau personnalisé (CIDR)`,customSubnetNote:`Utilisez un sous-réseau personnalisé si votre imprimante se trouve sur un réseau différent de celui de ce serveur. Les ports FTP (990) et MQTT (8883) doivent être accessibles à travers la limite de routage.`},drying:{start:`Démarrer le séchage`,stop:`Arrêter le séchage`,temperature:`Température`,duration:`Durée`,hours:`heures`,timeRemaining:`{{time}} restant`,active:`Séchage`,notRunning:`Séchage à l'arrêt`,notRunningHint:`L'imprimante a un minuteur de séchage, mais le compte à rebours est arrêté et l'AMS ne signale aucune phase de séchage. Le cycle n'a jamais démarré ou a été mis en pause, par exemple par la limite d'alimentation ou l'impression en cours.`,targetSummary:`{{filament}} @ {{temp}}°C`,notSupported:`Séchage non pris en charge`,powerRequired:`Brancher l'adaptateur secteur AMS pour activer le séchage`,cannotDryNow:`L'AMS ne peut pas démarrer le séchage pour le moment`,startingDrying:`Démarrage du séchage...`,toastCommandSent:`Commande de séchage envoyée`,toastStopped:`Séchage arrêté`,toastNotStarted:`L'imprimante a accepté la commande, mais l'AMS n'a pas démarré le séchage. Vérifiez que l'adaptateur secteur de l'AMS est branché et que l'imprimante est inactive.`,screenOnly:`Sur cette imprimante, le séchage de l'AMS ne peut être commandé que depuis l'écran de l'imprimante (limitation de Bambu)`,stoppingDrying:`Arrêt du séchage...`,rotateTray:`Tourner la bobine pendant le séchage`,rotateUnavailableReason:`Indisponible — un emplacement de cet AMS est chargé vers la tête d'impression. La bobine est bloquée par le tube d'alimentation et ne peut pas tourner. Rétractez d'abord le filament.`,startMode:`Heure de démarrage`,modeNow:`Maintenant`,modeDelay:`Après un délai`,modeAtTime:`À une heure`,schedule:`Planifier`,scheduledFor:`Séchage planifié pour {{time}}`,scheduledAsap:`Séchage planifié (en attente de l'imprimante)`,cancelScheduled:`Annuler le séchage planifié`,scheduleFailed:`Échec de la planification du séchage`,retractFilament:`Rétractez le filament à la sortie de l'AMS pour démarrer le séchage`,waitingAmsNotFound:`En attente de la détection de l'AMS`,waitingOffline:`En attente de la connexion de l'imprimante`,waitingPrinterBusy:`En attente de la disponibilité de l'imprimante`,waitingAlreadyDrying:`En attente de la fin du cycle de séchage en cours`,waitingInterrupted:`Interrompu, reprendra lorsque l'imprimante sera libre`,scheduleFailedReason:`Échec du séchage planifié : {{reason}}`,scheduleFailedUnknown:`Erreur inconnue`,scheduleFailedDidNotStart:`L'imprimante a accepté la commande, mais l'AMS n'a pas commencé le séchage`,dismissFailed:`Masquer`},amsBackup:{titleOn:`AMS Filament Backup est ACTIVÉ. Cliquez pour désactiver.`,titleOff:`AMS Filament Backup est DÉSACTIVÉ. Cliquez pour activer.`,titleUnknown:`État de l'AMS Filament Backup indisponible sur cette imprimante.`,toastEnabled:`AMS Filament Backup activé`,toastDisabled:`AMS Filament Backup désactivé`,modalTitle:`AMS Filament Backup`,modalHelp:`Lorsque l'emplacement actif s'épuise, l'imprimante passe aux emplacements ayant le même preset et la même couleur dans cet ordre.`,modalNoSlots:`Aucun filament chargé.`,modalNoPairs:`Aucune paire de secours — aucun emplacement ne partage à la fois preset et couleur.`,extruderRightShort:`D`,extruderLeftShort:`G`,stateOn:`Activé`,stateOff:`Désactivé`,stateUnknown:`Non pris en charge par cette imprimante`},activeJobSlot:{title:`Cet emplacement est le filament {{n}} dans l'impression active`,ariaLabel:`Emplacement d'impression active {{n}}`},expectedSlot:{title:`L'imprimante attend du filament dans cet emplacement`,ariaLabel:`Emplacement de filament attendu {{n}}`,label:`{{ams}} · Emplacement {{slot}}`,external:`Bobine externe`},filaments:`Filaments`,externalSpool:{hide:`Masquer la bobine externe`,show:`Afficher la bobine externe`},openCameraOverlay:`Ouvrir la caméra en superposition`,openCameraWindow:`Ouvrir la caméra dans une fenêtre`,firmwareUpdateAvailable:`Mise à jour firmware : {{current}} → {{latest}}`,firmwareUpToDate:`Firmware {{version}} — À jour`,firmwareUpdateButton:`Mettre à jour`,plateDetection:{noPermission:`Pas d'autorisation de modification`,enabledClick:`Vérification activée - Cliquez pour désactiver`,disabledClick:`Vérification désactivée - Cliquez pour activer`,manageCalibration:`Gérer la calibration de détection`,calibrationRequired:`Calibration requise`,calibrationInstructions:`Videz le plateau, puis cliquez sur Calibrer.`,calibrationDescription:`Capture une image de référence du plateau vide.`,calibrationTip:`Conseil : Stockez jusqu'à 5 références. Le système utilise la meilleure correspondance.`,plateEmpty:`Le plateau semble vide`,objectsDetected:`Objets détectés sur le plateau`,confidence:`Confiance`,difference:`Différence`,analysisPreview:`Aperçu de l'analyse :`,analysisLegend:`Cadre vert = zone, Rouge = différences`,savedReferences:`Références ({{count}}/{{max}})`,deleteReference:`Supprimer la référence`,labelPlaceholder:`Étiquette...`,clickToEdit:`{{label}} - Modifier`,clickToAddLabel:`Ajouter une étiquette`},speed:{title:`Vitesse d'impression`,silent:`Silencieux (50%)`,standard:`Standard (100%)`,sport:`Sport (124%)`,ludicrous:`Ludicrous (166%)`},airduct:{title:`Mode conduit d'air`,cooling:`Refroidissement`,heating:`Chauffage`},noSdCard:`Pas de SD`,door:{open:`Ouverte`,closed:`Fermée`},fans:{partCooling:`Ventilateur pièce`,auxiliary:`Ventilateur auxiliaire`,leftAuxiliary:`Ventilateur auxiliaire gauche`,exhaust:`Extraction`,chamber:`Ventilateur chambre`},clickToViewHmsErrors:`Cliquez pour voir les erreurs HMS`,aiDetection:{safe:`Sûr`,warning:`Avertissement`,failure:`Échec`,idle:`Inactif`,error:`Ne vérifie pas`,unknown:`Démarrage`,tooltipError:`La détection d'échec par IA ne vérifie pas cette impression : {{reason}} - cliquez pour les détails`,tooltipUnknown:`Détection d'échec par IA : en attente du premier résultat - cliquez pour les détails`,errorHint:`Cette impression n'est pas vérifiée. La détection reprendra automatiquement une fois le problème ci-dessous résolu.`,tooltip:`Détection d'échec par IA : {{status}} (score {{score}}) - cliquez pour les détails`,tooltipIdle:`Détection d'échec par IA activée - la surveillance démarre à la prochaine impression - cliquez pour les détails`,modalTitle:`Détection d'échec par IA - {{name}}`,currentStatus:`Statut`,score:`Score`,framesAnalyzed:`Images analysées`,idleHint:`Aucune impression n'est surveillée actuellement. La surveillance démarre automatiquement à la prochaine impression.`,lastError:`Dernière erreur`,openSettings:`Ouvrir les paramètres`},estimatedCompletion:`Fin estimée`,plateNumber:`Plaque {{number}}`,slotOptions:`Options du slot`,amsPopup:{friendlyName:`Nom AMS`,friendlyNamePlaceholder:`ex. Nom convivial AMS`,serialNumber:`Numéro de série`,firmwareVersion:`Micrologiciel`,save:`Enregistrer`,clear:`Effacer`,noEditPermission:`Vous n'avez pas la permission de renommer les unités AMS`},firmwareModal:{title:`Mise à jour Firmware`,titleUpToDate:`Infos Firmware`,currentVersion:`Actuelle :`,latestVersion:`Dernière :`,releaseNotes:`Notes de version`,checkingPrereqs:`Vérification des prérequis...`,sdCardReady:`Carte SD prête. Cliquez pour téléverser.`,uploadedSuccess:`Firmware téléversé !`,applyInstructions:`Pour appliquer sur l'imprimante :`,step1:`Sur l'écran, allez dans Paramètres`,step2:`Allez dans Firmware`,step3:`Sélectionnez "Mettre à jour depuis carte SD"`,step4:`Prévoyez 10-20 minutes`,done:`Terminé`,starting:`Démarrage...`,uploadFirmware:`Téléverser le Firmware`,uploadFailed:`Échec du téléversement : {{error}}`,uploadedToast:`Firmware téléversé ! Lancez la mise à jour sur l'écran.`,availableVersions:`Versions disponibles`,usable:`Utilisable`,unavailable:`Indisponible`,installed:`Installé`,newerBadge:`plus récent`,olderBadge:`plus ancien`,currentBadge:`actuel`},accessCodePlaceholder:`Laissez vide pour garder l'actuel`,roi:{title:`Zone de détection (ROI)`,xStart:`Début X`,yStart:`Début Y`,width:`Largeur`,height:`Hauteur`,instruction:`Ajustez le cadre vert pour cibler le plateau.`},developerModeWarning:`Le mode développeur LAN n'est pas activé sur : {{names}}. Certaines fonctionnalités peuvent ne pas fonctionner.`,howToEnable:`Comment activer`,incompatibleFile:`Ce fichier a été tranché pour {{slicedFor}}, mais cette imprimante est une {{printerModel}}`,dropNotPrintable:`Seuls les fichiers .gcode et .gcode.3mf peuvent être imprimés`,dropToPrint:`Déposer pour imprimer`,dropToQueue:`Déposer pour mettre en file`},archives:{media:{title:`Vidéos d’impression`,download:`Télécharger les vidéos d’impression`,searching:`Recherche de vidéos sur l’imprimante…`,searchFailed:`Impossible de rechercher les vidéos sur l’imprimante.`,none:`Aucun timelapse ni segment de caméra IP n’a été trouvé pour cette impression.`,attachedTimelapse:`Timelapse joint`,printerFiles:`Fichiers encore présents sur l’imprimante`,downloadSelected:`Télécharger la sélection`,printerMissing:`L’imprimante n’est plus configurée`,timelapseUnavailable:`Impossible de lire le dossier des timelapses`,ipcamUnavailable:`Impossible de lire le dossier de la caméra IP`},title:`Archives d'impression`,no3mfBanner:{title:`Certaines impressions récentes n'ont pas pu être archivées avec leur miniature`,body:`Le slicer n'a pas laissé le fichier .gcode.3mf sur la carte SD de l'imprimante, donc Bambuddy n'a pas pu récupérer la miniature ni les métadonnées slicer. C'est généralement parce que « Stocker les fichiers envoyés sur stockage externe » est désactivé dans le slicer (onglet Périphérique de Bambu Studio / OrcaSlicer).`,docsLink:`Voir l'étape 4 de l'installation`,docsLinkInternalStorage:`Pourquoi cela arrive`,titleInternalStorage:`Certaines impressions récentes sont restées dans le stockage interne de l'imprimante`,bodyInternalStorage:`Bambu Studio a placé le fichier tranché dans le stockage interne de l'imprimante au lieu de la carte, Bambuddy n'avait donc rien à lire en FTP. Sur les séries H2, P2S et X2D, son bouton « Imprimer » le fait toujours : seul « Envoyer » propose un choix, et il est lui aussi réglé sur « Cache » par défaut. Ces impressions restent archivées avec leur nom et leurs durées, simplement sans miniature ni métadonnées slicer. Pour des archives complètes, lancez l'impression depuis Bambuddy ou tranchez dans OrcaSlicer, ou bien dans Bambu Studio utilisez « Envoyer » avec « Externe » puis lancez l'impression. Toutes nécessitent une carte ou une clé dans l'imprimante.`,titleNoExternalStorage:`Certaines impressions récentes n'ont pas pu être archivées — aucun stockage dans l'imprimante`,bodyNoExternalStorage:`L'imprimante ne signale ni carte ni clé dans son emplacement, le fichier tranché n'avait donc nulle part où atterrir et Bambuddy rien à lire. Insérez-en une et la prochaine impression sera archivée complètement.`,titleInternalHistory:`Certaines impressions récentes ont été lancées depuis un fichier déjà présent sur l'imprimante`,bodyInternalHistory:`Ces impressions sont parties de la bibliothèque de l'imprimante elle-même : une réimpression depuis son écran, un lancement depuis Handy, ou un fichier envoyé plus tôt et imprimé ensuite. Bambuddy lit les fichiers d'impression en FTP, qui ne dessert que la carte ou la clé, tandis que l'imprimante conserve cette bibliothèque dans une zone que le FTP n'atteint pas : il n'y avait donc aucun 3MF à lire. Aucun réglage du trancheur n'y change quoi que ce soit, puisque rien n'a été envoyé pour ces impressions. Elles restent archivées avec leur nom et leurs durées, et « Modifier l'archive » permet de saisir à la main le filament utilisé. Pour une archive complète, lancez plutôt l'impression depuis Bambuddy ou depuis votre trancheur.`,titleFtpsCooloff:`Certaines impressions récentes n'ont pas pu être archivées — l'imprimante a refusé la connexion de fichiers`,bodyFtpsCooloff:`Bambuddy a ouvert le port de transfert de fichiers de l'imprimante (FTPS 990) et celle-ci a répondu par autre chose que du TLS, si bien que rien n'a pu en être lu. Ces impressions restent archivées avec leur nom et leurs durées, simplement sans vignette ni métadonnées du trancheur. Ce n'est pas un réglage du trancheur ni quelque chose que vous avez modifié — les mêmes modèles et les mêmes firmwares fonctionnent normalement sur d'autres installations, et une imprimante touchée refonctionne généralement d'elle-même plus tard. Après un tel échec, Bambuddy suspend les transferts vers cette imprimante pendant cinq minutes puis revient chercher le fichier une fois la pause terminée : un épisode bref se répare donc tout seul, tandis qu'une fiche encore vide signifie que le refus a duré plus longtemps que la nouvelle tentative. On ignore encore ce qui le déclenche. Si cela se reproduit, activez la journalisation de débogage sur la page Système et joignez un paquet de support à votre signalement.`,titleFtpTransferFailed:`Certaines impressions récentes n'ont pas pu être archivées : le transfert du fichier a dépassé le temps imparti`,bodyFtpTransferFailed:`Le fichier tranché se trouvait sur la carte de l'imprimante et l'imprimante l'a bien servi, mais le transfert ne s'est pas terminé dans le temps imparti. Au démarrage d'une impression, l'imprimante gère aussi sa caméra, ses messages d'état et l'envoi du travail, et un gros 3MF ne passe pas toujours face à tout cela. Ces impressions restent archivées avec leur nom et leurs durées, simplement sans miniature ni métadonnées du trancheur. Ce n'est pas un réglage du trancheur ni quelque chose que vous avez modifié. Bambuddy revient chercher le fichier trois fois au cours des dix minutes suivantes, la plupart de ces cas se règlent donc d'eux-mêmes ; une carte toujours vide signifie que chacune de ces tentatives a également dépassé le temps imparti. Si cela se reproduit, augmentez Délai de connexion dans Paramètres > Réseau > Nouvelle tentative FTP.`,dismissLabel:`Ignorer ce message`},searchPlaceholder:`Chercher dans les archives...`,filterByPrinter:`Par imprimante`,filterByStatus:`Par statut`,sortBy:`Trier par`,sortNewest:`Plus récent`,sortOldest:`Plus ancien`,sortName:`Nom`,sortDuration:`Durée`,sortLargest:`Plus volumineux`,sortSmallest:`Plus léger`,sortSize:`Taille`,noArchives:`Aucune archive trouvée`,noArchivesSearch:`Aucune archive ne correspond`,originalPrintNotVisible:`Impression d'origine non visible - essayez d'effacer les filtres`,noArchivesYet:`Pas encore d'archive`,prints:`impressions`,pagination:{showing:`Affichage`,to:`à`,of:`sur`,show:`Afficher`,page:`Page`,all:`Tout`},loadingArchives:`Chargement...`,releaseToUpload:`Relâcher pour téléverser`,showAll:`Tout afficher`,showFavoritesOnly:`Favoris uniquement`,gridView:`Grille`,listView:`Liste`,calendarView:`Calendrier`,logView:`Journal d'impression`,manageTags:`Gérer les tags`,showFailedPrints:`Afficher les échecs`,hideFailedPrints:`Masquer les échecs`,hideDuplicates:`Masquer les doublons`,filterUnconfirmed:`Non confirmées`,filterUnconfirmedTitle:`Afficher uniquement les impressions en attente de leur verdict de résultat`,viewOriginalPrint:`Cliquez pour afficher l'impression originale (#{{id}})`,printTime:`Temps d'impression`,filamentUsed:`Filament utilisé`,cost:`Coût`,preview:`Aperçu`,deleteArchive:`Supprimer l'archive`,deleteConfirm:`Supprimer cette archive ?`,favorite:`Favori`,unfavorite:`Retirer des favoris`,viewDetails:`Détails`,status:{completed:`Réussi`,failed:`Échoué`,stopped:`Arrêté`},toast:{source3mfAttached:`Source 3MF attachée : {{filename}}`,failedUploadSource3mf:`Échec téléversement 3MF`,source3mfRemoved:`Source 3MF retirée`,failedRemoveSource3mf:`Échec retrait 3MF`,f3dAttached:`F3D attaché : {{filename}}`,failedUploadF3d:`Échec téléversement F3D`,f3dRemoved:`F3D retiré`,failedRemoveF3d:`Échec retrait F3D`,timelapseAttached:`Timelapse attaché : {{filename}}`,timelapseAlreadyAttached:`Timelapse déjà présent`,noMatchingTimelapse:`Pas de timelapse correspondant`,failedScanTimelapse:`Échec scan timelapse`,failedAttachTimelapse:`Échec attache timelapse`,timelapseRemoved:`Timelapse supprimé`,failedRemoveTimelapse:`Échec de la suppression du timelapse`,timelapseUploaded:`Timelapse importé : {{filename}}`,failedUploadTimelapse:`Échec de l'importation du timelapse`,archiveDeleted:`Archive supprimée`,failedDeleteArchive:`Échec suppression`,addedToFavorites:`Ajouté aux favoris`,removedFromFavorites:`Retiré des favoris`,projectUpdated:`Projet mis à jour`,failedUpdateProject:`Échec mise à jour projet`,linkCopied:`Lien copié`,failedCopyLink:`Échec copie lien`,photoDeleted:`Photo supprimée`,failedDeletePhoto:`Échec suppression photo`,failedDeleteArchives:`Échec suppression archives`,failedUpdateFavorites:`Échec mise à jour favoris`,exportDownloaded:`Export téléchargé`,exportFailed:`Échec export`},menu:{print:`Imprimer`,openInBambuStudio:`Ouvrir dans le Slicer`,slice:`Découper`,externalLink:`Lien externe`,viewOnMakerWorld:`Voir sur MakerWorld`,confirmOutcome:`Confirmer le résultat`,preview3d:`Aperçu 3D`,viewTimelapse:`Voir le Timelapse`,scanForTimelapse:`Scanner pour Timelapse`,uploadTimelapse:`Importer un timelapse`,removeTimelapse:`Supprimer le timelapse`,downloadSource3mf:`Télécharger Source 3MF`,uploadSource3mf:`Téléverser Source 3MF`,replaceSource3mf:`Remplacer Source 3MF`,removeSource3mf:`Retirer Source 3MF`,uploadF3d:`Téléverser F3D`,replaceF3d:`Remplacer F3D`,downloadF3d:`Télécharger F3D`,removeF3d:`Retirer F3D`,download:`Télécharger`,copyDownloadLink:`Copier lien de téléchargement`,qrCode:`Code QR`,viewPhotos:`Voir les photos`,viewPhotosCount:`Voir les photos ({{count}})`,projectPage:`Page du Projet`,addToFavorites:`Ajouter aux favoris`,removeFromFavorites:`Retirer des favoris`,edit:`Modifier`,printLog:`Journal d'impression`,goToProject:`Aller au Projet : {{name}}`,addToProject:`Ajouter au Projet`,removeFromProject:`Retirer du Projet`,loading:`Chargement...`,noProjectsAvailable:`Aucun projet disponible`,searchProjects:`Rechercher des projets…`,select:`Sélectionner`,deselect:`Désélectionner`,delete:`Supprimer`},permission:{noReprint:`Pas d'autorisation de réimpression`,noAddToQueue:`Pas d'autorisation pour la file`,noUpdateArchives:`Pas d'autorisation de mise à jour`,noUploadFiles:`Pas d'autorisation de téléversement`,noDownload:`Pas d'autorisation de téléchargement`,noCopyLink:`Pas d'autorisation de copie lien`,noDelete:`Pas d'autorisation de suppression`,noEdit:`Pas d'autorisation de modification`,noCreate:`Pas d'autorisation de création`},platePicker:{title:`Choisir une plaque à prévisualiser`,hint:`Cette archive contient plusieurs plaques. Sélectionnez-en une pour l'ouvrir dans la visionneuse GCode.`,plateLabel:`Plaque {{index}}`,objectCount:`{{count}} objet`,objectCount_plural:`{{count}} objets`,noGcode:`Cette archive ne contient pas de G-code généré à prévisualiser. Ouvrez-la d'abord dans Bambu Studio pour la trancher.`},card:{previousPlate:`Plateau précédent`,nextPlate:`Plateau suivant`,plateNumber:`Plateau {{index}}`,moreOptions:`Clic droit pour plus d'options`,addToFavorites:`Ajouter aux favoris`,removeFromFavorites:`Retirer des favoris`,cancelled:`annulé`,failed:`échoué`,confirmPending:`résultat ?`,confirmPendingTitle:`Cette impression attend un verdict de résultat — cliquez pour répondre`,rejected:`rebuté`,rejectedTitle:`Terminée sur l'imprimante, marquée comme rebut par l'utilisateur`,confirmedGood:`réussi`,confirmedGoodTitle:`Confirmée comme pièce réussie par l'utilisateur`,duplicate:`doublon`,duplicateTitle:`Ce modèle a déjà été imprimé`,openSource3mf:`Ouvrir 3MF dans Bambu Studio (clic droit pour plus)`,downloadF3d:`Télécharger fichier Fusion 360`,viewTimelapse:`Voir timelapse`,viewPhoto:`Voir 1 photo`,viewPhotos:`Voir {{count}} photos`,openFolder:`Ouvrir le dossier : {{name}}`,slicedFile:`Fichier découpé - prêt`,sourceFile:`Fichier source uniquement - pas de mapping AMS`,gcode:`GCODE`,source:`SOURCE`,project:`Projet : {{name}}`,runsBadge:`{{count}} impressions`,runsBadgeTitle:`{{count}} impressions au total — {{successful}} réussies, {{failed}} échouées. Cliquez pour voir le journal complet.`,estimated:`Estimé : {{time}}`,actual:`Réel : {{time}}`,accuracy:`Précision : {{percent}}%`,filament:`{{weight}} g`,layer:`{{count}} couche`,layers:`{{count}} couches`,wearCost:`Usure de l'imprimante`,costEstimate:`Estimation : le coût final est fixé à la fin de l'impression`,object:`{{count}} objet`,objects:`{{count}} objets`,slicedFor:`Découpé pour {{model}}`,uploadedBy:`Téléversé par`,noPermissionReprint:`Pas d'autorisation de réimpression`,noFileForReprint:`Aucun fichier 3MF disponible — le fichier n'a pas pu être téléchargé depuis l'imprimante lors de l'enregistrement`,slicerAmsMapping:`Mappage AMS enregistré ({{printer}})`,slicerAmsMappingTooltip:`Le choix d'emplacement AMS du slicer a été enregistré pour {{printer}}. Les numéros d'emplacement n'ont de sens que sur cette imprimante : une réimpression ne les réutilise donc que si elle vise à nouveau {{printer}}.`,noPermissionEdit:`Pas d'autorisation de modification`,noPermissionDelete:`Pas d'autorisation de suppression`,openInBambuStudio:`Ouvrir dans le Slicer`,openInBambuStudioToSlice:`Ouvrir dans le Slicer pour découper`,slice:`Découper`,externalLink:`Lien externe`,makerWorld:`MakerWorld : {{designer}}`,viewProject:`Voir projet`,noExternalLink:`Aucun lien externe`,preview3d:`Aperçu 3D`,download:`Télécharger`,edit:`Modifier`,delete:`Supprimer`},runLog:{title:`Journal d'impression`,modalTitle:`Journal d'impression — {{name}}`,modalTitleFallback:`cette archive`,empty:`Aucun événement d'impression enregistré pour cette archive.`,col:{date:`Date`,status:`Statut`,duration:`Durée`,filament:`Filament`,cost:`Coût`},status:{completed:`Terminé`,failed:`Échoué`,cancelled:`Annulé`,stopped:`Arrêté`,skipped:`Ignoré`,printing:`Impression en cours`}},modal:{deleteArchive:`Supprimer l'archive`,deleteConfirm:`Supprimer "{{name}}" ? Cette action est irréversible.`,deleteButton:`Supprimer`,deletePurgeStats:`Retirer également cette impression des Quick Stats (filament, temps, coût, énergie)`,deleteQueueItemsWarning:`{{count}} élément(s) de file d'attente lié(s) à cette archive seront également supprimé(s).`,deleteBlockedByPrinting:`Suppression impossible — {{count}} élément(s) de file d'attente en cours d'impression. Arrêtez l'impression d'abord, puis réessayez.`,removeSource3mf:`Retirer Source 3MF`,removeSource3mfConfirm:`Retirer le fichier 3MF de "{{name}}" ?`,removeButton:`Retirer`,removeF3d:`Retirer F3D`,removeF3dConfirm:`Retirer le fichier Fusion 360 de "{{name}}" ?`,removeTimelapse:`Supprimer le timelapse`,removeTimelapseConfirm:`Êtes-vous sûr de vouloir supprimer la vidéo timelapse de "{{name}}" ?`,timelapse:`{{name}} – Timelapse`,selectTimelapse:`Choisir un Timelapse`,selectTimelapseDesc:`Sélectionnez manuellement le timelapse :`,deleteArchives:`Supprimer les archives`,deleteArchivesConfirm:`Supprimer {{count}} archive(s) ?`,deleteCount:`Supprimer {{count}}`},page:{title:`Archives`,printsCount:`{{filtered}} sur {{total}} impressions`,dropFilesHere:`Déposez les fichiers .3mf ici`,releaseToUpload:`Relâcher pour téléverser`,only3mfSupported:`Seuls les fichiers .3mf sont supportés`,close:`Fermer`,selected:`{{count}} sélectionnés`,selectAll:`Tout sélectionner`,tags:`Étiquettes`,project:`Projet`,favorite:`Favori`,delete:`Supprimer`,toggledFavorites:`Favoris mis à jour pour {{count}} archive(s)`,failedUpdateFavorites:`Échec mise à jour favoris`,archivesDeleted:`{{count}} archive(s) supprimée(s)`,failedDeleteArchives:`Échec suppression`,photoDeleted:`Photo supprimée`,failedDeletePhoto:`Échec suppression photo`},list:{name:`Nom`,printer:`Imprimante`,date:`Date`,size:`Taille`,actions:`Actions`,hasTimelapse:`A un timelapse`},log:{date:`Date`,printName:`Nom de l'impression`,printer:`Imprimante`,user:`Utilisateur`,status:`Statut`,duration:`Durée`,filament:`Filament`,filamentUsed:`Filament utilisé`,cost:`Coût`,energy:`Énergie`,energyCost:`Coût énergétique`,wearCost:`Coût d'usure`,completedAt:`Terminé`,columns:`Colonnes`,sortBy:`Trier par {{column}}`,allPrinters:`Toutes les imprimantes`,allUsers:`Tous les utilisateurs`,allStatuses:`Tous les statuts`,cancelled:`Annulé`,skipped:`Ignoré`,dateFrom:`Du`,dateTo:`Au`,noEntries:`Aucune entrée de journal trouvée`,showing:`{{count}} sur {{total}} entrées`,rowsPerPage:`Lignes`,page:`Page`,prev:`Préc.`,next:`Suiv.`,clearLog:`Effacer le journal`,clearLogTitle:`Effacer le journal d'impression`,clearLogConfirm:`Toutes les entrées du journal d'impression seront supprimées définitivement. Les archives et les éléments de file d'attente ne sont pas affectés. Cette action est irréversible. Êtes-vous sûr ?`,clearLogButton:`Tout effacer`,cleared:`{{count}} entrées de journal effacées`,clearFailed:`Échec de l'effacement du journal d'impression`,deleteEntryTitle:`Supprimer l'entrée du journal d'impression`,deleteEntryConfirm:`Cette entrée sera retirée du journal et ses contributions en filament, temps et coût disparaîtront des statistiques rapides. L'archive correspondante (le cas échéant) n'est pas affectée. Cette action est irréversible.`,entryDeleted:`Entrée du journal d'impression supprimée`,entryDeleteFailed:`Échec de la suppression de l'entrée du journal d'impression`,editEntryTitle:`Modifier l'entrée du journal d'impression`,editEntryDescription:`Classez cette impression. Le widget Analyse des échecs regroupe par ces valeurs, ce qui répercute immédiatement la mise à jour dans les statistiques.`,entryUpdated:`Entrée du journal mise à jour`,entryUpdateFailed:`Échec de la mise à jour de l'entrée du journal`,statuses:{completed:`Terminée`,failed:`Échouée`,stopped:`Arrêtée`,cancelled:`Annulée`,skipped:`Ignorée`}}},dispatchToast:{untitled:`Tâche d'impression`,startingPrints:`Démarrage des impressions`,progressSummary:`{{complete}}/{{total}} terminées • En cours : {{processing}}`,expandDetails:`Afficher les détails de l'envoi`,collapseDetails:`Masquer les détails de l'envoi`,awaitingPrinter:`En attente de l'imprimante…`,status:{processing:`En cours`,completed:`Terminée`,failed:`Échouée`},failed:{generic:`Échec de l'envoi`,upload_failed:`Échec du téléversement vers l'imprimante`,start_command_failed:`L'imprimante a rejeté la commande de démarrage`},dismiss:`Fermer`},pipelineRuns:{title:`Exécutions de pipeline`,loading:`Chargement…`,empty:`Aucune exécution de pipeline pour le moment.`,filter:{pipeline:`Pipeline`,status:`Statut`,target:`Cible`,all:`Toutes`,allPipelines:`Tous les pipelines`,allStatus:`Tous les statuts`,allTargets:`Toutes les cibles`,clear:`Effacer les filtres`,noMatches:`Aucune exécution ne correspond aux filtres actuels.`},totalCount_one:`{{n}} exécution`,totalCount_other:`{{n}} exécutions`,copies:`{{n}} copies`,failedCount:`{{n}} échouées`,copyN:`Copie {{n}}`,retryFailed:`Réessayer les échouées`,retryOf:`réessai de #{{n}}`,pagination:`{{start}}–{{end}} sur {{total}}`,toast:{cancelled:`Exécution annulée`,cancelFailed:`Annulation échouée`,retryStarted:`Réessai démarré`,retryFailed:`Réessai échoué`,cleared:`{{n}} exécutions effacées`,clearFailed:`Échec de l'effacement`},clearLog:`Effacer le journal`,clearConfirmTitle:`Effacer le journal ?`,clearConfirmBody:`Supprimer toutes les exécutions de pipeline terminées, échouées, annulées et en échec partiel ? Les exécutions en cours sont conservées. Ceci ne peut pas être annulé.`,clearConfirmAction:`Effacer`,jobStatus:{pending:`en attente`,awaiting_printer:`attente imprimante`,queued:`en file`,printing:`impression`,completed:`terminée`,failed:`échouée`,cancelled:`annulée`},cancelledByUser:`Annulé par l'utilisateur`},queue:{filamentShort:{rowBadge:`Filament insuffisant pour la bobine assignee`,rowTooltip:`Le planificateur a signale cet element. Cliquez sur Lecture pour voir le deficit par emplacement et decider de lancer quand meme l'impression.`,confirmTitle:`Filament insuffisant`,confirmIntro:`La bobine assignee ne peut pas couvrir au moins un emplacement. Imprimer quand meme ?`,lineItem:`Emplacement {{slot}} : besoin de {{required}} g, {{remaining}} g restants`,unknown:`inconnu`,printAnyway:`Imprimer quand meme`},filamentMissing:{confirmTitle:`Filament non charge`,confirmIntro:`L'imprimante n'a aucun emplacement avec ce filament. Chargez-le et appuyez de nouveau sur Demarrer, ou imprimez quand meme :`},slicerAmsMapping:{rowBadge:`Emplacements AMS enregistrés pour cette imprimante`,rowTooltip:`Cette archive conserve les emplacements AMS exacts choisis par le slicer, enregistrés pour l'imprimante de cet élément. Une réimpression dessus peut réutiliser ces bobines au lieu de refaire la correspondance par type et couleur.`},title:`File d'attente`,subtitle:`Gérez vos travaux d'impression`,editQueueItem:`Modifier l'élément`,selectAllPlates:`Sélectionner les {{count}} plaques`,deselectAll:`Tout désélectionner`,printQueued:`Impression ajoutée à la file`,printQueuedWillStartWhenIdle:`Démarrera lorsque l'imprimante sera inactive`,itemsQueued:`{{count}} éléments ajoutés à la file`,sending:`Envoi...`,sendingProgress:`Envoi {{current}}/{{total}}...`,adding:`Ajout...`,addingProgress:`Ajout {{current}}/{{total}}...`,savingProgress:`Enregistrement {{current}}/{{total}}...`,clearQueue:`Vider la file`,clearHistory:`Effacer l'historique`,emptyQueue:`La file est vide`,position:`Position`,scheduledTime:`Heure prévue`,moveUp:`Monter`,moveDown:`Descendre`,startNow:`Démarrer maintenant`,printingInProgress:`Impression en cours...`,viewArchive:`Voir l'archive`,viewInFileManager:`Voir dans le gestionnaire`,itemCount:`{{count}} élément`,itemCount_plural:`{{count}} éléments`,dragToReorder:`Glisser pour réordonner (ASAP uniquement)`,reorderHint:`La position n'affecte que les éléments ASAP.`,sjf:{label:`SJF`,tooltip:`Travail le plus court en premier — le planificateur priorise les impressions plus courtes`},addedBy:`Ajouté par {{name}}`,nextInQueue:`Prochain en file`,clearPlateSuccess:`Plateau vidé — prêt pour l'impression suivante`,plateNumber:`Plateau {{index}}`,quantity:`Quantité`,quantityHint:`Crée {{count}} éléments de file d'attente`,plateQuantityLabel:`Impressions de {{plate}}`,plateQuantityTotal_one:`{{count}} impression au total`,plateQuantityTotal_other:`{{count}} impressions au total`,batchOrders:{title:`Commandes par lot`,emptyTitle:`Aucune commande par lot`,emptyDescription:`Mettez en file un fichier multi-plateaux, ou plusieurs copies d'un plateau, et la commande apparaît ici avec son avancement.`,filter:{active:`Actives`,completed:`Terminées`,cancelled:`Annulées`,all:`Toutes`},status:{active:`Active`,completed:`Terminée`,cancelled:`Annulée`},noTargets:`Regroupement seul`,noTargetsHint:`Créée avant les quantités par plateau : elle suit les impressions mises en file plutôt qu'un objectif.`,dispatchRemaining:`Mettre en file les {{count}} restantes`,dispatchPlate:`Mettre le reste en file`,strandedPlate:`Aucun réglage à copier`,strandedNotice:`Impossible de mettre en file {{runs}} des {{owed}} impressions encore dues : aucune impression en file ou terminée ne subsiste pour cette plaque, donc plus aucun réglage à copier. Mettez la plaque en file une fois depuis le fichier, ou annulez la commande.`,dispatched:`Impressions restantes mises en file pour {{name}}`,plateProgress:`{{completed}} sur {{target}} faites`,remaining:`{{count}} encore dues`,failed:`{{count}} échouées`,printing:`{{count}} en cours`,wholeFile:`Fichier entier`,due:`Échéance {{date}}`,costSoFar:`{{amount}} à ce jour`,costRemaining:`({{amount}} à venir)`},activeBatches:`Lots actifs`,batchProgress:`{{completed}} sur {{total}} terminés`,cancelBatch:`Annuler les restants`,batchCancelled:`Éléments restants du lot annulés`,cancelBatchConfirmTitle:`Annuler le lot`,cancelBatchConfirmMessage:`Clôturer cette commande ? Les impressions encore en file sont annulées, et elle cesse de réclamer ce qui n'a pas été produit.`,batch:{defaultName:`Lot`,label:`{{count}} élément`,label_plural:`{{count}} éléments`,pendingCount:`{{count}} en attente`,pendingCount_plural:`{{count}} en attente`,expand:`Développer le lot`,collapse:`Réduire le lot`,groupAsBatch:`Grouper en lot…`,groupAsBatchDescription:`Combiner les {{count}} éléments sélectionnés en un seul lot repliable.`,nameLabel:`Nom du lot`,namePlaceholder:`p. ex. Cadeaux du vendredi`,create:`Créer le lot`,ungroup:`Dégrouper`,ungroupConfirmTitle:`Dégrouper le lot ?`,ungroupConfirmMessage:`Les éléments resteront dans la file mais ne seront plus groupés.`,dragGroup:`Faire glisser le groupe`},tabs:{batches:`Lots`,queue:`File`,history:`Historique`,timeline:`Chronologie`,pipelines:`Exécutions`},layout:{flatList:`Liste`,byPrinter:`Par imprimante`,groupByPrinter:`Grouper par imprimante`},history:{emptyTitle:`Aucun historique`,emptyDescription:`Les impressions terminées, annulées et échouées apparaîtront ici.`,showMore:`Afficher plus`,showingCount:`Affichage de {{shown}} sur {{total}}`},dragGhost:{multiCount:`{{count}} éléments`,batch:`{{name}} ({{count}} copie)`,batch_plural:`{{name}} ({{count}} copies)`},sections:{currentlyPrinting:`En cours`,queued:`En attente`,history:`Historique`},status:{pending:`En attente`,waiting:`En attente`,printing:`Impression`,paused:`En pause`,completed:`Terminé`,failed:`Échoué`,skipped:`Sauté`,cancelled:`Annulé`},summary:{printing:`Impressions`,queued:`En attente`,totalTime:`Temps total estimé`,totalWeight:`Poids total estimé`,history:`Historique`},filter:{allPrinters:`Toutes les imprimantes`,unassigned:`Non assigné`,allStatus:`Tous les statuts`,allLocations:`Tous les emplacements`,any:`Tout`},sort:{byPosition:`Par position`,byName:`Par nom`,byPrinter:`Par imprimante`,bySchedule:`Par planification`,byDate:`Par date`,ascendingOldest:`Croissant (plus vieux)`,descendingNewest:`Décroissant (plus récent)`},badges:{awaitingReview:`En attente de validation`,staged:`Préparé`,requiresPrevious:`Nécessite succès précédent`,autoPowerOff:`Extinction auto`,gcodeInjection:`G-code`,confirmOutcome:`Demande de résultat`,confirmOutcomeTitle:`Demande comment l’impression s’est déroulée une fois terminée`},empty:{title:`Aucune impression prévue`,description:`Planifiez depuis les Archives ou glissez des fichiers ici.`},time:{etaIfStartedNow:`Heure de fin si cette tâche démarrait maintenant`,whenFree:`Dès qu'une imprimante est libre`,overdue:`En retard`,now:`Maintenant`,lessThanMinute:`Dans moins d'une minute`,inMinutes:`Dans {{count}} min`,inHours:`Dans {{count}} heures`},actions:{startPrint:`Démarrer`,stopPrint:`Arrêter`,requeue:`Remettre en file`},bulkEdit:{title:`Modifier {{count}} élément`,title_plural:`Modifier {{count}} éléments`,description:`Seuls les changements seront appliqués.`,printer:`Imprimante`,noChange:`— Aucun changement —`,queueOptions:`Options de file`,staged:`Préparé (manuel)`,autoPowerOff:`Extinction auto après`,requirePrevious:`Requiert succès précédent`,gcodeInjection:`Injecter le G-code`,printOptions:`Options d'impression`,bedLevelling:`Nivellement plateau`,flowCalibration:`Calibration débit`,vibrationCalibration:`Vibration (Input Shaper)`,layerInspection:`Inspection 1ère couche`,timelapse:`Time-lapse`,useAms:`Utiliser AMS`,confirmOutcome:`Demander le résultat`,nozzleOffsetCali:`Calibration du décalage des buses`,applyChanges:`Appliquer`,selectAll:`Tout sélectionner`,deselectAll:`Tout désélectionner`,selected:`{{count}} sélectionnés`,editSelected:`Modifier la sélection`,cancelSelected:`Annuler la sélection`},confirm:{cancelTitle:`Annuler l'impression prévue`,cancelMessage:`Annuler "{{name}}" ?`,stopTitle:`Arrêter l'impression`,stopMessage:`Arrêter "{{name}}" sur l'imprimante ?`,removeTitle:`Retirer de l'historique`,removeMessage:`Retirer "{{name}}" de l'historique ?`,clearHistoryTitle:`Effacer l'historique`,clearHistoryMessage:`Retirer les {{count}} éléments ?`,cancelButton:`Annuler l'impression`,stopButton:`Arrêter l'impression`,thisPrint:`cette impression`,thisItem:`cet élément`},toast:{cancelled:`Élément annulé`,cancelFailed:`Échec annulation`,removed:`Élément retiré`,keptForOrder:`Annulé au lieu d'être retiré : cette impression est la seule dont la commande peut remettre cette plaque en file`,historyKeptForOrders:`{{kept}} conservées car des commandes en ont encore besoin.`,removeFailed:`Échec retrait`,stopped:`Impression arrêtée`,stopFailed:`Échec arrêt`,released:`Libéré dans la file`,startFailed:`Échec démarrage`,reorderFailed:`Échec réorganisation`,historyCleared:`{{count}} éléments effacés`,clearHistoryFailed:`Échec effacement`,updateFailed:`Échec mise à jour`,bulkCancelled:`{{count}} éléments annulés`,bulkCancelFailed:`Échec annulation`,batchCreated:`Lot « {{name}} » créé`,batchCreateFailed:`Échec de la création du lot`,batchUngrouped:`{{count}} élément(s) dégroupé(s)`,batchUngroupFailed:`Échec du dégroupement du lot`,resumedAfterFailure:`File reprise — {{restored}} tâche(s) restaurée(s) en attente`,resumeAfterFailureFailed:`Échec de la reprise de la file`},resumeAfterFailure:{banner:`{{printer}} est bloquée par un échec d'impression précédent — {{count}} tâche(s) ignorée(s)`,bannerHint:`Résolvez le problème de l'imprimante, puis reprenez la file pour restaurer les tâches ignorées et lever le blocage.`,button:`Reprendre après échec`,confirmTitle:`Reprendre la file après l'échec ?`,confirmMessage:`Restaurer {{count}} tâche(s) ignorée(s) sur {{printer}} en attente et lever le blocage de l'impression précédente. Assurez-vous que l'imprimante est prête avant de continuer.`},timeline:{listView:`Liste`,timelineView:`Chronologie`,unassigned:`Non attribué`,noData:`Aucune impression planifiée pour ce jour`,nothingCommitted:`Aucun horaire confirmé dans cette fenêtre. Les éléments en attente d’action, les éléments bloqués et les jobs ASAP sur des imprimantes inactives ne sont pas affichés — définissez une heure planifiée ou libérez un élément en attente pour qu’il apparaisse ici.`,allDoneBy:`Toutes les impressions terminées vers {{time}}`,staged:`En attente`,filterAll:`Tout afficher`,filterPrinting:`En cours`,filterQueued:`En file`,time:{anyMoment:`imminent`,minutesLeft:`{{minutes}}m restantes`,hoursLeft:`{{hours}}h restantes`,hoursMinutesLeft:`{{hours}}h {{minutes}}m restantes`},day:{previous:`Jour précédent`,next:`Jour suivant`,today:`Aujourd'hui`},window:{back12h:`Reculer de 12 heures`,forward12h:`Avancer de 12 heures`,now:`Maintenant`},printerColumnHeader:`Imprimante`},permissions:{noStopPrint:`Pas d'autorisation d'arrêt`,noStartPrint:`Pas d'autorisation de démarrage`,awaitingReview:`En attente de validation : une personne qui gère la file lance ce travail`,noEdit:`Pas d'autorisation de modification`,noCancel:`Pas d'autorisation d'annulation`,noRequeue:`Pas d'autorisation de remise en file`,noRemove:`Pas d'autorisation de retrait`,noClearHistory:`Pas d'autorisation historique`,noEditItems:`Pas d'autorisation modification groupée`,noCancelItems:`Pas d'autorisation annulation groupée`}},stats:{title:`Statistiques`,subtitle:`Glissez les widgets pour réorganiser. Cliquez sur l'œil pour masquer.`,overview:`Vue d'ensemble`,totalPrints:`Total impressions`,successRate:`Taux de succès`,totalPrintTime:`Temps total d'impression`,printTime:`Temps d'impression`,totalFilament:`Total filament utilisé`,filamentUsed:`Filament utilisé`,filamentCost:`Coût filament`,totalCost:`Coût total`,energyUsed:`Énergie consommée`,energyCost:`Coût énergie`,wearCost:`Coût d'usure`,energyWarmingUpTooltip:`Le suivi énergétique collecte encore des instantanés horaires. Les totaux par période deviendront précis dès qu’un instantané existera avant la plage sélectionnée. Les premières valeurs peuvent être sous-estimées.`,averagePrintTime:`Temps moyen par impression`,printsPerDay:`Impressions par jour`,byPrinter:`Par imprimante`,printsByPrinter:`Impressions par imprimante`,byMaterial:`Par matériau`,byMonth:`Par mois`,last7Days:`7 derniers jours`,last30Days:`30 derniers jours`,last90Days:`90 derniers jours`,allTime:`Tout le temps`,quickStats:`Stats rapides`,printActivity:`Activité d'impression`,filamentTypes:`Types de filament`,filamentTrends:`Tendances filament`,materialNumbers:{title:`Par numéro de matière`,empty:`Aucun numéro de matière attribué pour l'instant. Ajoutez-en aux bobines dans l'inventaire pour regrouper ici la consommation et les coûts.`,loadFailed:`Impossible de charger les statistiques par numéro de matière.`,spools:`Bobines`,remaining:`Restant`,consumed:`Consommé`,cost:`Coût`},suppliers:{title:`Par fournisseur`,empty:`Aucun achat enregistré pour le moment. Indiquez sur une bobine auprès de quel fournisseur elle a été achetée pour regrouper ici la consommation et les coûts.`,error:`Impossible de charger les statistiques des fournisseurs`,supplier:`Fournisseur`,spools:`Bobines`,remaining:`Restant`,consumed:`Consommé`,cost:`Coût`},failureAnalysis:`Analyse des échecs`,timeAccuracy:`Précision du temps`,successful:`Succès :`,failed:`Échecs :`,cancelled:`Annulés :`,perfectEstimate:`100% = estimation parfaite`,noTimeAccuracyData:`Pas encore de données de précision`,noFilamentData:`Aucune donnée de filament`,noPrinterData:`Aucune donnée d'imprimante`,noPrintData:`Aucune donnée d'impression`,noPrintDataLast30Days:`Aucune impression ces 30 derniers jours`,failureReasons:`Raisons des échecs`,topFailureReasons:`Top raisons d'échec`,failedPrintsCount:`{{failed}} / {{total}} impressions ont échoué`,rejectedPrintsCount:`{{rejected}} rebutées après achèvement`,yieldRate:`Rendement : {{rate}}%`,lastWeekRate:`Semaine dernière : {{rate}}%`,resetLayout:`Réinitialiser la mise en page`,recalculateCosts:`Recalculer les coûts`,recalculateCostsHint:`Recalcule les coûts avec les prix actuels des filaments`,exportStats:`Exporter les stats`,exportAsCsv:`Exporter en CSV`,exportAsExcel:`Exporter en Excel`,hiddenCount:`{{count}} Masqués`,exportDownloaded:`Export téléchargé`,exportFailed:`Échec export`,layoutReset:`Mise en page réinitialisée`,recalculatedCosts:`Coûts recalculés pour {{count}} archives`,recalculateFailed:`Échec du calcul`,loadingStats:`Chargement des statistiques...`,noPermissionResetLayout:`Pas d'autorisation de réinitialisation`,noPermissionRecalculate:`Pas d'autorisation de recalcul`,noPrintDataInRange:`Aucune donnée dans la période sélectionnée`,periodFilament:`Filament utilisé`,periodCost:`Coût`,avgPerPrint:`Moy. par impression`,usageOverTime:`Utilisation dans le temps`,energyOverTime:`Énergie dans le temps`,filamentByWeight:`Poids`,printDuration:`Durée d'impression`,printerUtilization:`Utilisation imprimante`,filamentSuccess:`Succès par matériau`,printHabits:`Habitudes d'impression`,printTimeOfDay:`Heure d'impression`,colorDistribution:`Distribution des couleurs`,noColorData:`Aucune donnée de couleur disponible`,records:`Enregistrements`,longestPrint:`Plus longue impression`,heaviestPrint:`Plus lourde impression`,mostExpensivePrint:`Plus chère`,busiestDay:`Jour le plus actif`,successStreak:`Série de succès`,streakPrint:`impression consécutive`,streakPrints:`{{count}} impressions consécutives`,printerStats:`Stats imprimante`,hours:`heures`,avgPrints:`Moy. impressions`,noArchiveData:`Aucune donnée d'impression disponible`,filamentByTime:`Temps`,avgWeight:`Moy. poids`,avgTime:`Moy. temps`,filamentByPrints:`Impressions`,timeframe:{today:`Aujourd'hui`,"this-week":`Cette semaine`,"this-month":`Ce mois`,"last-7":`7 derniers jours`,"last-30":`30 derniers jours`,"last-90":`90 derniers jours`,"this-year":`Cette année`,"all-time":`Tout`,custom:`Personnalisé`,from:`Du`,to:`Au`},allUsers:`Tous les utilisateurs`,noUser:`Aucun utilisateur (Système)`,filterByUser:`Filtrer par utilisateur`},maintenance:{title:`Maintenance`,overview:`Vue d'ensemble`,allOk:`Toute la maintenance est à jour`,dueCount:`{{count}} tâche à faire`,dueCount_plural:`{{count}} tâches à faire`,warningCount:`{{count}} avertissement`,warningCount_plural:`{{count}} avertissements`,totalPrintTime:`Temps d'impression total`,nextMaintenance:`Prochaine maintenance`,nothingDue:`Rien de prévu`,tasks:`Tâches`,lastPerformed:`Dernière réalisation`,interval:`Intervalle`,hoursRemaining:`{{hours}}h restantes`,hoursOverdue:`{{hours}}h de retard`,markDone:`Marquer comme fait`,performMaintenance:`Effectuer la maintenance`,history:`Historique`,noHistory:`Aucun historique`,editPrintHours:`Modifier les heures d'impression`,currentHours:`Heures actuelles`,statusTab:`Statut`,settingsTab:`Paramètres`,overdueCount:`{{count}} en retard`,dueSoonCount:`{{count}} bientôt`,dueSoon:`Bientôt`,allGood:`Tout va bien`,overdueBy:`Retard de {{duration}}`,dueIn:`Dans {{duration}}`,timeLeft:`{{duration}} restant`,day:`1 jour`,days:`{{count}} jours`,week:`1 semaine`,weeks:`{{count}} semaines`,month:`1 mois`,months:`{{count}} mois`,year:`1 an`,maintenanceTypes:`Types de maintenance`,maintenanceTypesDescription:`Types système et tâches personnalisées`,addCustomType:`Ajouter un type`,restoreDefaults:`Restaurer les tâches par défaut`,intervalType:`Type d'intervalle`,intervalValue:`Intervalle ({{type}})`,icon:`Icône`,documentationLink:`Lien documentation (optionnel)`,assignToPrinters:`Assigner aux imprimantes`,selectAtLeastOnePrinter:`Sélectionnez au moins une imprimante`,addType:`Ajouter le type`,custom:`Personnalisé`,printHours:`Heures d'impression`,calendarDays:`Jours calendaires`,exampleName:`ex: Remplacement filtre HEPA`,viewDocumentation:`Voir documentation`,timeBasedInterval:`Intervalle temporel`,intervalOverrides:`Exceptions d'intervalle`,intervalOverridesDescription:`Intervalles spécifiques par imprimante`,assignedToPrinters:`Assigné aux imprimantes :`,noPrintersAssigned:`Aucune imprimante assignée`,addPrinterShort:`Ajouter :`,printersAssignedClick:`{{count}} imprimante(s) assignée(s) - gérer`,removeFromPrinter:`Retirer de cette imprimante`,types:{lubricateCarbonRods:`Lubrifier les tiges carbone`,lubricateRails:`Lubrifier les rails linéaires`,cleanNozzle:`Nettoyer la buse / hotend`,checkBelts:`Vérifier la tension des courroies`,cleanBuildPlate:`Nettoyer le plateau`,checkExtruder:`Vérifier les engrenages de l'extrudeur`,checkCooling:`Vérifier les ventilateurs`,generalInspection:`Inspection générale`,cleanCarbonRods:`Nettoyer les tiges carbone`,lubricateSteelRods:`Lubrifier les tiges en acier`,cleanSteelRods:`Nettoyer les tiges en acier`,cleanLinearRails:`Nettoyer les rails linéaires`,checkPtfeTube:`Vérifier le tube PTFE`,replaceHepaFilter:`Remplacer le filtre HEPA`,replaceCarbonFilter:`Remplacer le filtre charbon`,lubricateLeftNozzleRail:`Lubrifier le rail de buse gauche`},maintenanceComplete:`Maintenance marquée comme faite`,typeUpdated:`Type mis à jour`,typeDeleted:`Type supprimé`,defaultsRestored:`{{count}} tâche(s) par défaut restaurée(s)`,printHoursUpdated:`Heures mises à jour`,printerAssigned:`Imprimante assignée`,printerRemoved:`Imprimante retirée`,deleteTypeConfirm:`Supprimer "{{name}}" ?`,deleteSystemTypeTitle:`Supprimer la tâche de maintenance par défaut ?`,deleteSystemTypeMessage:`Êtes-vous sûr de vouloir supprimer la tâche de maintenance par défaut "{{name}}" ?`,noPermissionUpdate:`Pas d'autorisation de mise à jour`,noPermissionPerform:`Pas d'autorisation d'action`,noPermissionEditTypes:`Pas d'autorisation de modification types`,noPermissionDeleteTypes:`Pas d'autorisation de suppression types`,noPermissionEditHours:`Pas d'autorisation de modification heures`,noPermissionRemovePrinter:`Pas d'autorisation retrait imprimante`,noPermissionAssignPrinter:`Pas d'autorisation assignation`,noPermissionEditIntervals:`Pas d'autorisation modification intervalles`,configureSettings:`Configurer types et intervalles`},settings:{sliceEngine:`Moteur de découpage`,sliceEngineSidecar:`Sidecar serveur`,sliceEngineSidecarHint:`Le découpage s'exécute sur le serveur, dans le conteneur sidecar du trancheur.`,sliceEngineBrowser:`Dans le navigateur`,sliceEngineBrowserHint:`Le découpage s'exécute sur cet appareil, sans serveur.`,title:`Paramètres`,general:`Général`,tabs:{general:`Général`,smartPlugs:`Prises connectées`,sensors:`Capteurs`,notifications:`Notifications`,queue:`Flux de travail`,queueDispatch:`File & Distribution`,queuePipelines:`Pipelines`,filament:`Filament`,camera:`Caméra`,network:`Réseau`,apiKeys:`Clés API`,virtualPrinter:`Imprimante virtuelle`,failureDetection:`Détection d'échec`,users:`Authentification`,backup:`Sauvegarde`,emailAuth:`Authentification Email`,ldap:`LDAP`,twoFa:`Authentification 2FA`,oidc:`SSO / OIDC`,security:`Sécurité`,spoolbuddy:`SpoolBuddy`},ldap:{title:`Authentification LDAP`,enabledDesc:`L'authentification LDAP est activée`,disabledDesc:`L'authentification LDAP est désactivée`,disabledHint:`Configurez et enregistrez les paramètres LDAP ci-dessous, puis activez.`,enabled:`Authentification LDAP activée`,disabled:`Authentification LDAP désactivée`,feature1:`Les utilisateurs peuvent se connecter avec leurs identifiants LDAP`,feature2:`Le compte administrateur local reste disponible en secours`,feature3:`Les groupes LDAP sont associés aux groupes BamBuddy à la connexion`,serverConfig:`Configuration du serveur LDAP`,serverUrl:`URL du serveur`,serverUrlHint:`Utilisez ldap:// pour standard ou ldaps:// pour les connexions SSL`,security:`Sécurité`,securityHint:`StartTLS met à niveau une connexion simple vers TLS. LDAPS utilise TLS dès le début.`,bindDn:`DN de liaison (compte de service)`,bindPassword:`Mot de passe de liaison`,searchBase:`DN de base de recherche`,userFilter:`Filtre de recherche utilisateur`,userFilterHint:`{username} est remplacé par le nom d'utilisateur. Utilisez (uid={username}) pour OpenLDAP.`,advanced:`Avancé`,autoProvision:`Provisionnement automatique`,autoProvisionHint:`Créer automatiquement un compte BamBuddy lors de la première connexion LDAP`,defaultGroup:`Groupe par défaut`,defaultGroupNone:`— Aucun (pas de repli) —`,defaultGroupHint:`Groupe de repli attribué lorsqu'un utilisateur LDAP s'authentifie mais n'est dans aucun groupe LDAP mappé. Laissez vide pour laisser les utilisateurs non mappés sans autorisations.`,groupMapping:`Mappage de groupes (JSON)`,groupMappingHint:`Associer les DN de groupes LDAP aux groupes BamBuddy. Groupes disponibles : `,testConnection:`Tester la connexion`,settingsSaved:`Paramètres LDAP enregistrés`,errors:{serverRequired:`L'URL du serveur LDAP est requise`,searchBaseRequired:`Le DN de base de recherche est requis`,enableAuthFirst:`Activez d'abord l'authentification`,configureLdapFirst:`Enregistrez d'abord les paramètres LDAP`}},email:{smtpSettings:`Configuration SMTP`,smtpHost:`Serveur SMTP`,smtpPort:`Port SMTP`,security:`Sécurité`,authentication:`Authentification`,username:`Utilisateur`,password:`Mot de passe`,fromEmail:`Email expéditeur`,fromName:`Nom expéditeur`,testConnection:`Tester la connexion SMTP`,testRecipient:`Email test destinataire`,sendTest:`Envoyer email test`,sending:`Envoi...`,save:`Enregistrer les paramètres`,saving:`Enregistrement...`,advancedAuth:`Authentification avancée`,advancedAuthEnabled:`L'authentification avancée est activée`,advancedAuthEnabledDesc:`La gestion des utilisateurs par email est active. Les nouveaux utilisateurs recevront un mot de passe auto-généré.`,advancedAuthDisabled:`Authentification avancée désactivée`,advancedAuthDisabledDesc:`Activez pour les fonctionnalités liées à l'email (mot de passe oublié, etc).`,enable:`Activer`,disable:`Désactiver`,feature1:`Génération auto et envoi de mots de passe par email`,feature2:`Connexion par utilisateur ou email`,feature3:`Réinitialisation mot de passe oublié disponible`,feature4:`Réinitialisation admin par email`,errors:{requiredFields:`Remplissez tous les champs requis`,usernameRequired:`L'utilisateur est requis pour l'authentification`,enterTestEmail:`Entrez une adresse email de test`,smtpServerAndEmail:`Serveur et expéditeur requis pour le test`,usernamePasswordRequired:`Utilisateur et mot de passe requis pour l'auth`,configureSmtpFirst:`Configurez et testez le SMTP d'abord`,enableAuthFirst:`Veuillez d'abord activer l'authentification pour utiliser les fonctionnalités basées sur le courrier électronique.`},success:{settingsSaved:`Paramètres SMTP enregistrés`},securityOptions:{starttls:`STARTTLS (Port 587)`,ssl:`SSL/TLS (Port 465)`,none:`Aucun (Port 25)`},authOptions:{enabled:`Activée`,disabled:`Désactivée`}},appearance:`Apparence`,notifications:`Notifications`,smartPlugs:`Prises connectées`,spoolman:`Spoolman`,updates:`Mises à jour`,language:`Langue`,languageDescription:`Choisissez votre langue`,theme:`Thème`,themeLight:`Clair`,themeDark:`Sombre`,themeSystem:`Système`,defaultView:`Vue par défaut`,defaultViewDescription:`Page affichée au démarrage`,checkForUpdates:`Vérifier les mises à jour`,autoUpdate:`Mise à jour auto`,currentVersion:`Version actuelle`,latestVersion:`Dernière version`,upToDate:`Bambuddy est à jour`,updateAvailable:`Mise à jour disponible`,notificationLanguage:`Langue des notifications`,notificationLanguageDescription:`Langue pour les notifications push`,bedCooledThreshold:`Seuil de refroidissement du plateau`,bedCooledThresholdDescription:`Température en dessous de laquelle le plateau est considéré comme refroidi`,userNotificationsEnabled:`Notifications utilisateur`,userNotificationsEnabledDescription:`Active le menu de notifications utilisateur et les notifications par e-mail pour les événements d'impression. Nécessite l'authentification avancée.`,userNotificationsDisabledHint:`Activez l'authentification avancée pour utiliser les notifications utilisateur.`,notificationProviders:`Fournisseurs de notifications`,addProvider:`Ajouter un fournisseur`,editProvider:`Modifier le fournisseur`,providerType:`Type de fournisseur`,testNotification:`Tester la notification`,testSuccess:`Notification de test envoyée`,testFailed:`Échec de l'envoi du test`,quietHours:`Heures de silence`,quietHoursDescription:`Ne pas déranger pendant ces heures`,quietHoursStart:`Début`,quietHoursEnd:`Fin`,events:{title:`Événements de notification`,printStart:`Impression démarrée`,printComplete:`Impression terminée`,printFailed:`Impression échouée`,printStopped:`Impression arrêtée`,printProgress:`Jalons de progression`,printProgressDescription:`Notifier à 25%, 50%, 75%`,printerOffline:`Imprimante hors ligne`,printerError:`Erreur imprimante`,filamentLow:`Filament bas`,maintenanceDue:`Maintenance due`,maintenanceDueDescription:`Notifier quand une tâche est due`},smartPlug:{title:`Prises connectées`,add:`Ajouter une prise`,edit:`Modifier la prise`,name:`Nom`,ipAddress:`Adresse IP`,linkedPrinter:`Imprimante liée`,autoOn:`Allumage auto`,autoOnDescription:`Allumer au début de l'impression`,autoOff:`Extinction auto`,autoOffDescription:`Éteindre après l'impression`,offDelay:`Délai d'extinction`,offDelayMinutes:`Minutes après fin`,offDelayTemp:`Quand la buse est sous`,currentState:`État actuel`,turnOn:`Allumer`,turnOff:`Éteindre`},filamentTracking:`Suivi de Filament`,filamentTrackingDesc:`Choisissez comment suivre vos bobines. Utilisez l'inventaire intégré ou connectez un serveur Spoolman.`,autoAddUnknownRfid:`Ajouter automatiquement les bobines RFID inconnues`,autoAddUnknownRfidDesc:`Crée automatiquement une entrée d'inventaire lorsqu'une bobine avec un tag RFID inconnu est détectée. Désactivez si vous enregistrez manuellement les nouvelles bobines à l'avance pour éviter les doublons.`,filamentChecks:`Vérifications du filament`,disableFilamentWarnings:`Désactiver les avertissements de filament`,disableFilamentWarningsDesc:`Ne pas afficher les avertissements de filament insuffisant lors de l'impression ou de la mise en file d'attente`,preferLowestFilament:`Préférer le filament le plus bas`,preferLowestFilamentDesc:`Lorsque plusieurs bobines correspondent, utiliser celle avec le moins de filament restant`,preferLowestFilamentBackupNote:`Ne prend effet que si AMS Filament Backup est activé sur l'imprimante — sinon, l'imprimante ne peut pas basculer vers une seconde bobine quand celle choisie est vide.`,trackingModeBuiltIn:`Inventaire Intégré`,trackingModeBuiltInDesc:`Correspondance RFID et suivi de consommation inclus`,trackingModeSpoolmanDesc:`Serveur de gestion externe`,builtInFeatureRfid:`Détecte auto les bobines RFID Bambu Lab dans l'AMS`,builtInFeatureUsage:`Suit la consommation par impression`,builtInFeatureCatalog:`Gère bobines, couleurs et profils facteur K`,builtInFeatureThirdParty:`Les bobines tierces peuvent être assignées aux bobines d'inventaire`,amsSyncButton:`Synchroniser les poids depuis l'AMS`,amsSyncTitle:`Synchroniser les poids des bobines depuis l'AMS`,amsSyncMessage:`Tous les poids des bobines de l'inventaire seront écrasés par les valeurs actuelles de l'AMS des imprimantes connectées. Utilisez ceci pour récupérer des données de poids corrompues. Les imprimantes doivent être en ligne.`,amsSyncing:`Synchronisation...`,amsSyncSuccess:`{{synced}} bobine(s) synchronisée(s), {{skipped}} ignorée(s)`,amsSyncError:`Échec de la synchronisation des poids depuis l'AMS`,spoolmanAmsSyncButton:`Synchroniser les poids Spoolman depuis l'AMS`,spoolmanAmsSyncTitle:`Synchroniser les poids des bobines Spoolman depuis l'AMS`,spoolmanAmsSyncMessage:`Cela mettra à jour les poids des bobines Spoolman en fonction des valeurs de remplissage AMS actuelles des imprimantes connectées. Les imprimantes doivent être en ligne.`,spoolmanAmsSyncing:`Synchronisation...`,spoolmanAmsSyncSuccess:`{{synced}} bobine(s) synchronisée(s), {{skipped}} ignorée(s)`,spoolmanAmsSyncError:`Échec de la synchronisation des poids Spoolman depuis l'AMS`,spoolmanAmsSyncErrorUnreachable:`Échec de la synchronisation (Spoolman inaccessible)`,spoolmanAmsSyncErrorNotConfigured:`Échec de la synchronisation (Spoolman non configuré)`,nativeTagsTitle:`Tags natifs de Spoolman`,nativeTagsDesc:`Spoolman 0.27 associe lui-même les tags NFC. Copiez-y les tags que Bambuddy conserve dans extra.tag, afin que Spoolman et les autres lecteurs trouvent aussi les bobines. extra.tag reste inchangé.`,nativeTagsCheck:`Vérifier les tags`,nativeTagsToMove:`À copier`,nativeTagsAlready:`Déjà dans Spoolman`,nativeTagsSlotIds:`ID d’emplacement AMS (restent dans extra.tag)`,nativeTagsConflicts:`Conflits`,nativeTagsConflictSpool:`Bobine #{{spool}} : le tag {{tag}} appartient déjà à la bobine #{{holder}}`,nativeTagsConflictElsewhere:`Bobine #{{spool}} : le tag {{tag}} appartient déjà à un filament ou à un emplacement`,nativeTagsMove:`Copier les tags`,nativeTagsMoved:`Tags copiés dans Spoolman : {{count}}`,nativeTagsNothing:`Tous les tags sont dans Spoolman.`,nativeTagsError:`Impossible de copier les tags dans Spoolman`,spoolmanNotConfigured:`Spoolman non configuré`,spoolmanFilamentCatalogTitle:`Catalogue de filaments Spoolman`,spoolmanFilamentCatalogDesc:`Noms de filaments et poids à vide depuis votre instance Spoolman. Le nom et le poids bobine sont modifiables ici ; toutes les autres propriétés sont gérées directement dans Spoolman.`,spoolmanUrl:`URL Spoolman`,spoolmanUrlHint:`URL de votre serveur Spoolman (ex: http://localhost:7912)`,spoolmanConnected:`Connecté`,spoolmanDisconnected:`Déconnecté`,status:`Statut`,connect:`Connecter`,disconnect:`Déconnecter`,howSyncWorks:`Fonctionnement de la Sync`,syncInfoRfidOnly:`Seules les bobines officielles RFID sont synchronisées`,syncInfoAutoCreate:`Les bobines sont créées dans Spoolman à la 1ère sync`,syncInfoThirdPartySkipped:`Les bobines tierces ou rechargées sont ignorées`,linkingExistingSpools:`Lier des bobines existantes`,linkingExistingSpoolsDesc:`Pour lier une bobine Spoolman, survolez un slot AMS et cliquez sur "Lier à Spoolman".`,syncMode:`Mode de Sync`,syncModeAuto:`Automatique`,syncModeManual:`Manuel uniquement`,syncModeAutoDesc:`Sync auto lors de changements AMS`,syncModeManualDesc:`Sync uniquement sur déclenchement manuel`,syncAmsData:`Synchroniser AMS`,syncAmsDataDesc:`Synchroniser manuellement les données vers Spoolman`,allPrinters:`Toutes les imprimantes`,noDefaultPrinter:`Aucune par défaut (demander à chaque fois)`,sidebarOrder:`Ordre de la barre latérale`,saveThumbnails:`Enregistrer les vignettes`,captureFinishPhoto:`Prendre une photo à la fin`,noPrintersConfigured:`Aucune imprimante configurée`,archiveMode:{always:`Toujours créer une archive`,never:`Ne jamais créer d'archive`,ask:`Demander à chaque fois`},checkForUpdatesLabel:`Vérifier les mises à jour`,checkPrinterFirmware:`Vérifier le firmware imprimante`,includeBetaUpdates:`Inclure les versions bêta`,includeBetaUpdatesDesc:`Notifier des versions bêta et préliminaires lors de la vérification des mises à jour`,announcementsEnabled:`Recevoir les annonces`,announcementsEnabledDesc:`Messages des développeurs de Bambuddy, comme les correctifs de sécurité et les changements incompatibles. Bambuddy télécharge un fichier signé depuis GitHub toutes les quelques heures ; rien sur cette installation n'est envoyé.`,announcementsLearnMore:`En savoir plus`,announcementsAllUsers:`Afficher à tous les utilisateurs`,announcementsAllUsersDesc:`Désactivé : seuls les administrateurs les voient. Sans effet tant que l'authentification est désactivée.`,localLogin:{disable:`Désactiver la connexion locale par nom d'utilisateur/mot de passe`,disableHint:`Quand activée, seuls les fournisseurs SSO peuvent se connecter. LDAP n'est pas affecté. Définissez BAMBUDDY_LOCAL_LOGIN=true sur le serveur pour conserver une voie de récupération.`},enableRetry:`Activer la rétentative`,homeAssistantDescription:`Contrôler les prises via Home Assistant`,environmentManagedLabel:`(Géré par l'environnement)`,autoEnabledViaEnv:`Activé via variables d'environnement`,urlFromEnvReadOnly:`Valeur HA_URL (lecture seule)`,tokenFromEnvReadOnly:`Valeur HA_TOKEN (lecture seule)`,mqttConnectedTo:`Connecté à`,prometheusDescription:`Exposer les données au format Prometheus`,noSmartPlugsTitle:`Aucune prise configurée`,noSmartPlugsDescription:`Ajoutez une prise Tasmota pour suivre l'énergie et automatiser.`,noProvidersTitle:`Aucun fournisseur configuré`,noProvidersDescription:`Ajoutez un fournisseur pour recevoir des alertes.`,noTemplatesAvailable:`Aucun modèle dispo. Redémarrez pour les générer.`,apiPermissionView:`Voir statut et file`,apiPermissionEdit:`Gérer la file d'attente`,apiKeysEmptyTitle:`Aucune clé API`,apiKeysEmptyDescription:`Créez une clé pour vos intégrations.`,noUsersFound:`Aucun utilisateur trouvé`,noGroupsFound:`Aucun groupe trouvé`,noGroupsAvailable:`Aucun groupe disponible`,passwordsDoNotMatch:`Les mots de passe ne correspondent pas`,systemGroupWarning:`Les noms des groupes système sont fixes`,authDisabledTitle:`Authentification désactivée`,authDisabledFeature1:`Requis pour accéder au système`,authDisabledFeature2:`Gestion multi-utilisateurs et groupes`,authDisabledFeature3:`Plus de 50 permissions granulaires`,userHasCreated:`Cet utilisateur a créé :`,userItemsQuestion:`Que faire de ces éléments ?`,deleteUserConfirm:`Supprimer cet utilisateur ?`,actionCannotBeUndone:`Cette action est irréversible.`,addFirstSmartPlug:`Ajoutez votre première prise`,providers:`Fournisseurs`,log:`Journal`,testAll:`Tout tester`,testResults:`Résultats du test`,testPassedCount:`{{count}} succès`,testFailedCount:`{{count}} échecs`,messageTemplates:`Modèles de message`,messageTemplatesDescription:`Personnalisez les messages par événement.`,apiKeys:`Clés API`,apiKeysDescription:`Créez des clés pour webhooks et API.`,createKey:`Créer une clé`,apiKeyCreated:`Clé API créée avec succès`,apiKeyCopyWarning:`Copiez cette clé maintenant - elle ne sera plus affichée !`,useInApiBrowser:`Utiliser dans l'explorateur API`,apiKeyQrButton:`Code QR`,apiKeyQrTitle:`Scanner pour configurer`,apiKeyQrCaption:`Scannez avec votre application mobile pour ajouter ce serveur et cette clé API.`,apiKeyQrWarning:`Contient votre clé API secrète — ne la partagez pas et ne la capturez pas là où d'autres peuvent la voir.`,createNewApiKey:`Nouvelle clé API`,keyName:`Nom de la clé`,keyNamePlaceholder:`ex: Home Assistant, OctoPrint`,readStatus:`Lire le statut`,readStatusDescription:`Voir l'état des imprimantes, la file, la bibliothèque, les archives et les pipelines du trancheur`,manageQueue:`Gérer la file`,manageQueueDescription:`Ajouter/retirer des éléments. Avec "Gérer la bibliothèque", exécuter des pipelines du trancheur`,controlPrinter:`Contrôler l'imprimante`,controlPrinterDescription:`Pause, reprise, arrêt`,manageLibrary:`Gérer la bibliothèque`,manageLibraryDescription:`Téléverser, renommer, supprimer et trancher des fichiers de la bibliothèque ; importer des modèles depuis MakerWorld. Avec "Gérer la file", exécuter des pipelines du trancheur`,manageInventory:`Gérer l'inventaire`,manageInventoryDescription:`Créer, modifier et supprimer des bobines et des entrées d'inventaire. Requis pour les bornes SpoolBuddy (scan NFC, lectures de balance, commandes système de la borne).`,manageMaintenance:`Gérer la maintenance`,manageMaintenanceDescription:`Enregistrer les maintenances effectuées, réinitialiser les compteurs, modifier les intervalles et gérer le catalogue des types de maintenance. Adapté aux automatisations Home Assistant qui consignent "J'ai nettoyé la buse" sans accorder un contrôle plus large de l'imprimante.`,manageArchives:`Gérer les archives`,manageArchivesDescription:`Modifier et supprimer les archives d'impression, y compris la suppression des anciennes impressions et de leur contribution aux statistiques. Adapté aux automatisations qui élaguent l'historique d'impression.`,manageProjects:`Gérer les projets`,manageProjectsDescription:`Créer, modifier et supprimer des projets, et y ajouter des archives. Adapté aux automatisations qui organisent les impressions en projets.`,maintenanceBadge:`Maintenance`,archivesBadge:`Archives`,projectsBadge:`Projets`,libraryBadge:`Bibliothèque`,inventoryBadge:`Inventaire`,cloudAccess:`Autoriser l'accès cloud`,cloudAccessDescription:`Lit les préréglages et filaments Bambu Cloud en votre nom. Nécessite d'être connecté à Bambu Cloud.`,cloudBadge:`Cloud`,updateEnergyCost:`Mettre à jour le tarif électrique`,updateEnergyCostDescription:`Autoriser cette clé à POSTer un nouveau tarif électrique par kWh sur /settings/electricity-price. Utile pour les automatisations Home Assistant à tarif dynamique (Tibber, Octopus, etc.). Il s'agit du seul champ de paramètres modifiable via clé API.`,energyCostBadge:`Énergie`,sendNotifications:`Envoyer des notifications`,sendNotificationsDescription:`Autorise cette clé à envoyer des messages via les canaux de notification qui acceptent les messages des applications connectées (POST /notifications/app-message). Pour des applications comme Bambuddy Orders. Rien d'autre : la clé ne peut ni lire ni modifier les canaux.`,sendNotificationsBadge:`Notif.`,legacyKey:`Hérité`,legacyKeyTooltip:`Créé avant la propriété par utilisateur ; recréez pour l'accès cloud`,unnamedKey:`Clé sans nom`,lastUsed:`Dernière utilisation`,read:`Lecture`,control:`Contrôle`,createFirstKey:`Créez votre première clé`,webhookEndpoints:`Points de terminaison Webhook`,webhookApiKeyHint:`Utilisez la clé dans l'en-tête X-API-Key.`,webhook:{getAllStatus:`Tous les statuts`,getSpecificStatus:`Statut spécifique`,addToQueue:`Ajouter à la file`,pausePrint:`Pause`,resumePrint:`Reprise`,stopPrint:`Arrêt`},apiBrowser:`Explorateur API`,apiBrowserDescription:`Testez les endpoints API.`,apiKeyForTesting:`Clé API pour test`,apiKeyPlaceholder:`Collez votre clé pour tester...`,apiKeyHint:`Sera envoyée via l'en-tête X-API-Key.`,deleteApiKeyTitle:`Supprimer la clé API`,deleteApiKeyMessage:`Les intégrations utilisant cette clé cesseront de fonctionner.`,deleteKey:`Supprimer la clé`,amsDisplayThresholds:`Seuils d'affichage AMS`,amsThresholdsDescription:`Seuils de couleur pour humidité et température.`,humidity:`Humidité`,goodGreen:`Bon (vert)`,fairOrange:`Moyen (orange)`,aboveFairBad:`Au-dessus = rouge (mauvais)`,fairAlsoDryingThreshold:`Ce seuil est aussi utilisé pour déclencher le séchage automatique`,fairBelowDryingFloor:`Le séchage automatique ne peut pas atteindre cette valeur : un AMS indique {{floor}} % ou plus lorsqu'il chauffe, donc chaque cycle se terminerait puis redémarrerait aussitôt. Passez au-dessus de {{floor}} % si le séchage automatique est activé.`,temperature:`Température`,goodBlue:`Bon (bleu)`,aboveFairHot:`Au-dessus = rouge (chaud)`,tempAlarmThreshold:`Alerte au-dessus de`,tempAlarmSeparateFromBand:`Seul le seuil d'alerte envoie des notifications — Bon et Correct ne font que colorer l'affichage. Laissez vide pour alerter au seuil correct, comme avant.`,tempAlarmMustBePositive:`Un seuil de 0 ou moins est ignoré — l'alerte utilise alors le seuil correct.`,historyRetention:`Rétention d'historique`,keepSensorHistory:`Garder l'historique pendant`,historyRetentionDescription:`Les anciennes données seront supprimées.`,defaultPrintOptions:`Options d'impression par défaut`,defaultPrintOptionsDescription:`Définir les valeurs par défaut des options d'impression. Modifiables dans la boîte de dialogue d'impression.`,defaultBedLevelling:`Nivellement du lit`,defaultBedLevellingDesc:`Niveler automatiquement le lit avant l'impression`,defaultFlowCali:`Calibration du flux`,defaultFlowCaliDesc:`Calibrer le flux d'extrusion`,defaultVibrationCali:`Calibration des vibrations`,defaultVibrationCaliDesc:`Réduire les artefacts de ringing`,defaultLayerInspect:`Inspection première couche`,defaultLayerInspectDesc:`Inspection IA de la première couche`,defaultTimelapse:`Time-lapse`,defaultTimelapseDesc:`Enregistrer une vidéo timelapse`,defaultConfirmOutcome:`Demander le résultat`,defaultConfirmOutcomeDesc:`Demander si l'impression est bien sortie une fois terminée`,confirmOutcomeExternalPrints:`Demander aussi pour les impressions lancées hors de Bambuddy`,confirmOutcomeExternalPrintsDesc:`Les impressions lancées sur l'imprimante, dans Bambu Studio ou dans l'application Handy sont elles aussi archivées par Bambuddy. Avec cette option, elles reçoivent la même demande de résultat que les travaux de la file d'attente.`,confirmDefaultGoodOnPlateClear:`Compter les résultats sans réponse comme bons à la libération du plateau`,confirmDefaultGoodOnPlateClearDescription:`Lorsque le plateau est libéré (manuellement ou par l'impression suivante en file d'attente) et que la demande de résultat de l'impression reste sans réponse, l'enregistrer automatiquement comme bonne pièce. Une fois le plateau libéré, la pièce compte comme bonne ; une réponse ultérieure par Telegram ou par lien affiche seulement le résultat enregistré.`,defaultNozzleOffsetCali:`Calibration du décalage des buses`,defaultNozzleOffsetCaliDesc:`Calibrer les décalages entre les buses`,tempFanPresetsTitle:`Préréglages de température et de ventilateur`,tempFanPresetsDescription:`Personnalisez les valeurs de sélection rapide affichées dans les fenêtres contextuelles de température et de vitesse du ventilateur de la carte imprimante. Le bouton Arrêt est toujours affiché.`,tempFanPresetsNozzle:`Température de la buse`,tempFanPresetsBed:`Température du plateau`,tempFanPresetsChamber:`Température de la chambre`,tempFanPresetsFan:`Vitesse du ventilateur`,tempFanPresetsReset:`Rétablir les valeurs par défaut`,concurrentUploadsTitle:`Envois simultanés`,concurrentUploadsDescription:`Nombre d'imprimantes auxquelles la file d'attente peut envoyer des fichiers en même temps. Les imprimantes reçoivent les fichiers lentement (une grosse impression peut prendre plusieurs minutes) et chacune attend son tour : sur un parc important, augmenter cette valeur évite que la dernière imprimante d'un lot doive attendre la fin de tous les transferts précédents. Réduisez-la si votre réseau ou votre hôte Bambuddy supporte mal les transferts parallèles.`,concurrentUploadsLabel:`Imprimantes servies simultanément`,concurrentUploadsHelp:`1 n'envoie qu'à une imprimante à la fois (l'ancien comportement). Valeur par défaut : 4.`,staggeredStart:`Démarrage échelonné`,staggeredStartDescription:`Taille de groupe et intervalle par défaut lors de l'échelonnement des démarrages de lots multi-imprimantes. Modifiable par lot dans la fenêtre d'impression.`,preheatTitle:`Préchauffage & Heat Soak`,preheatDescription:`Chauffe le plateau (et la chambre, si pris en charge) et maintient la température avant le démarrage de chaque impression de la file. Utile pour les filaments techniques (PA, ABS) sur les imprimantes sans chauffage actif de la chambre — le plateau chauffe la chambre par rayonnement pendant que le minuteur de soak s'écoule. La température cible du plateau provient du fichier d'impression ; le comportement de la chambre dépend du modèle d'imprimante.`,preheatEnabled:`Activer préchauffage & soak`,preheatEnabledDesc:`Si désactivé, les impressions en file démarrent immédiatement. Chaque élément peut surcharger par impression.`,preheatFilamentTargetsLabel:`Cible chambre par filament (°C)`,preheatFilamentTargetsHint:`Bambuddy choisit la cible la plus haute parmi les slots AMS chargés. Une impression dont tous les slots donnent 0 — PLA, PETG, TPU, PVA — saute entièrement le préchauffage et démarre immédiatement.`,preheatFilamentTargetsReset:`Restaurer les valeurs par défaut`,preheatFilamentTargetsDefaultRow:`Autre / non mappé`,preheatMaxWait:`Attente max (secondes)`,preheatMaxWaitHelp:`Plafond de la phase de chauffe de la chambre avant passage au soak.`,preheatSoak:`Soak (secondes)`,preheatSoakHelp:`Maintien après l'atteinte de la cible ou l'expiration de l'attente max.`,preheatHardwareTitle:`Comportement par imprimante :`,preheatHardwareDetail:`H2C/H2D/H2D Pro/H2S/X2D/X1E chauffent activement la chambre via M141. X1C/P2S lisent la température mais ne chauffent la chambre que par rayonnement du plateau. P1S/P1P/A1/A1 Mini n'ont pas de capteur de chambre — seul le minuteur de soak s'applique.`,preheatPerItemDesc:`Chauffe le plateau et la chambre avant le démarrage de cette impression. Utilise par défaut le commutateur global de Paramètres → Workflow.`,preheatOverride_inherit:`Hériter`,preheatOverride_on:`Activé`,preheatOverride_off:`Désactivé`,calibrationMode_off:`Désactivé`,calibrationMode_on:`Activé`,calibrationMode_auto:`Auto`,preheatTargetOverride:`Surcharger la cible chambre (°C, vide = par filament)`,preheatTargetOverrideHelp:`0 chauffe le plateau et exécute le maintien sans la chambre. Laissé vide, une impression sans besoin de chambre saute entièrement le préchauffage.`,plateClear:`Confirmation de plateau libre`,requirePlateClear:`Exiger la confirmation de plateau libre`,requirePlateClearDescription:`Lorsque cette option est activée, le planificateur attend une confirmation de plateau libre par imprimante avant de lancer les impressions en file d'attente sur les imprimantes ayant terminé. La désactiver masque également le badge d'état du plateau et le bouton « Marquer le plateau comme dégagé » sur les cartes d'imprimante.`,keepBedWarm:`Maintenir le plateau chaud entre les impressions`,keepBedWarmDesc:`En attendant la confirmation de plateau libéré, maintient le plateau à la température de maintien au chaud ci-dessous pour que la chambre reste chaude — ou à la température de plateau de l'impression suivante si elle est plus élevée. S'applique uniquement lorsque l'impression suivante nécessite un chauffage de chambre (ASA, ABS, PA, PC, etc.). Nécessite l'activation de la confirmation de plateau libéré.`,keepWarmBedTemp:`Température du plateau en maintien au chaud (°C)`,keepWarmBedTempHelp:`Utilisé lorsque le plateau sert à chauffer la chambre : pendant le maintien au chaud et lors du préchauffage si le fichier d'impression ne contient pas de température de plateau. Une température plus élevée issue du fichier est toujours prioritaire.`,keepWarmMaxMinutes:`Arrêter le maintien au chaud après (minutes)`,keepWarmMaxMinutesHelp:`Si le plateau n'est pas libéré dans ce délai, les chauffages sont coupés au lieu d'être maintenus indéfiniment.`,gcodeInjection:`Injection de G-code`,gcodeInjectionDescription:`Configurez du G-code personnalisé à injecter au début et/ou à la fin des impressions pour les systèmes d'auto-impression comme Farmloop, SwapMod, AutoClear et Printflow 3D. Les snippets sont configurés par modèle d'imprimante et appliqués lorsque « Injecter le G-code » est activé sur un élément de file d'attente.`,gcodeInjectionNoPrinters:`Aucune imprimante trouvée. Ajoutez des imprimantes pour configurer les snippets G-code.`,gcodeStartLabel:`G-code de début`,gcodeEndLabel:`G-code de fin`,gcodeStartPlaceholder:`G-code ajouté avant le début de l'impression...`,gcodeEndPlaceholder:`G-code ajouté après la fin de l'impression...`,staggerGroupSize:`Taille du groupe`,staggerGroupSizeHelp:`Imprimantes à démarrer simultanément par groupe`,staggerInterval:`Intervalle (minutes)`,staggerIntervalHelp:`Délai entre chaque démarrage de groupe`,queueDrying:`Séchage automatique`,queueDryingDescription:`Sécher automatiquement le filament AMS lorsque l'imprimante est inactive entre les impressions. Utilise le seuil d'humidité ci-dessus.`,queueDryingEnabled:`Activer le séchage automatique`,queueDryingEnabledDescription:`Démarrer le séchage AMS automatiquement lorsque l'imprimante est inactive et l'humidité dépasse le seuil`,queueDryingBlock:`Attendre la fin du séchage`,queueDryingBlockDescription:`Bloquer la file d'attente jusqu'à la fin du séchage. Désactivé, les impressions sont prioritaires.`,ambientDryingEnabled:`Séchage ambiant`,ambientDryingEnabledDescription:`Sécher automatiquement le filament sur les imprimantes inactives lorsque l'humidité dépasse le seuil, même sans impressions en file.`,ambientDryingSustainedEnabled:`Exiger une humidité soutenue`,ambientDryingSustainedDescription:`Attendre que l'humidité soit restée au-dessus du seuil pendant une durée définie avant de démarrer un séchage ambiant — absorbe le pic dû à l'ouverture du couvercle de l'AMS.`,ambientDryingSustainedMinutes:`Durée soutenue (minutes)`,printDryingEnabled:`Séchage pendant l'impression`,printDryingEnabledDescription:`Autorise le séchage automatique à continuer pendant une impression sur le matériel pris en charge (H2D, H2C, H2S, P2S, H2D Pro, X2D, X1C, A2L avec firmware récent). La température de séchage est automatiquement limitée à 5°C sous le préréglage en attente pour protéger les bobines.`,dryingPresets:`Préréglages de séchage`,dryingPresetsDescription:`Température et durée par type de filament. AMS 2 Pro utilise des températures plus basses, AMS-HT supporte des températures plus élevées.`,dryingFilament:`Filament`,humidityThresholds:`Seuils d'humidité`,humidityThresholdsDescription:`Déclencheur d'humidité par type de filament pour le séchage auto et les alarmes. Charges mixtes dans un AMS utilisent le seuil le plus bas.`,humidityThresholdCol:`Seuil`,humidityThresholdDefault:`Par défaut (types inconnus)`,printModal:`Fenêtre d'impression`,expandCustomMapping:`Étendre le mapping personnalisé par défaut`,expandCustomMappingDescription:`Affiche le mapping AMS par imprimante étendu.`,authentication:`Authentification`,authEnabledDescription:`L'instance est sécurisée`,authDisabledDescription:`Activez pour restreindre l'accès`,authDisabledMessage:`Activez l'authentification pour gérer comptes et permissions.`,enableAuthentication:`Activer l'authentification`,currentUser:`Utilisateur actuel`,changePassword:`Changer le mot de passe`,admin:`Administrateur`,users:`Utilisateurs`,addUser:`Ajouter un utilisateur`,groups:`Groupes`,addGroup:`Ajouter un groupe`,system:`Système`,noDescription:`Pas de description`,userCount:`{{count}} utilisateurs`,permissionCount:`{{count}} permissions`,createUser:`Créer un utilisateur`,username:`Nom d'utilisateur`,enterUsername:`Entrez l'utilisateur`,password:`Mot de passe`,enterPassword:`Entrez le mot de passe`,passwordRequirements:`Au moins 8 caractères, avec une majuscule, une minuscule, un chiffre et un caractère spécial.`,confirmPassword:`Confirmer le mot de passe`,confirmPasswordPlaceholder:`Confirmez le mot de passe`,viewReleaseOnGitHub:`Voir la version sur GitHub`,turnAllPlugsOn:`Tout allumer`,turnAllPlugsOff:`Tout éteindre`,clearNotificationLogs:`Effacer les journaux`,clearLogsMessage:`Efface définitivement les logs de plus de 30 jours.`,clearLogs:`Effacer les logs`,resetUiPreferences:`Réinitialiser l'UI`,resetUiPreferencesMessage:`Réinitialise l'ordre, thème, widgets, etc. N'affecte pas vos données.`,resetPreferences:`Réinitialiser`,deleteGroupTitle:`Supprimer le groupe`,deleteGroupMessage:`Les utilisateurs de ce groupe perdront ces permissions.`,deleteGroup:`Supprimer le groupe`,disableAuthenticationTitle:`Désactiver l'authentification`,disableAuthenticationMessage:`Instance accessible sans connexion. Les comptes sont conservés.`,disableAuthentication:`Désactiver`,configureBambuddy:`Configurer Bambuddy`,systemDefault:`Défaut système`,archiveSettings:`Réglages Archives`,newWindow:`Nouvelle fenêtre`,embeddedOverlay:`Superposition intégrée`,preferredSlicer:`Slicer préféré`,preferredSlicerDescription:`Slicer utilisé pour le tranchage intégré via le sidecar API`,openInSlicerLabel:`Ouvrir dans le slicer`,openInSlicerInherit:`Identique au slicer API`,openInSlicerDescription:`Slicer de bureau utilisé par le bouton « Ouvrir dans le slicer ». Laissez sur « Identique au slicer API » pour hériter, ou choisissez un slicer différent pour un usage local.`,orcaslicerKnownIssuesWarning:`OrcaSlicer 2.3.2 / 2.4.0-dev ont des bugs CLI connus qui bloquent le découpage de nombreux 3MF créés par Bambu — voir les issues amont #12426 (segfault sur fichiers multi-extrudeurs peints) et #13386 (rejet de validation stricte des plages de paramètres). Bambu Studio est recommandé jusqu'à ce que les correctifs amont arrivent.`,useSlicerApi:`Utiliser l'API Slicer`,useSlicerApiDescription:`Lorsque activé, les actions "Slice" ouvrent le slicer intégré et appellent le sidecar slicer-API. Lorsque désactivé (par défaut), elles redirigent vers le slicer desktop via le schéma URI.`,slicerCard:`Slicer`,orcaslicerApiUrl:`OrcaSlicer sidecar URL`,bambuStudioApiUrl:`Bambu Studio sidecar URL`,slicerStallTimeout:`Delai d'inactivite du trancheur (minutes)`,slicerStallTimeoutDescription:`Abandonne un decoupage apres cette duree sans progression du sidecar. Les modeles lourds qui continuent a signaler leur progression ne sont jamais interrompus, quel que soit le temps necessaire. Les sidecars qui ne signalent pas de progression utilisent cette valeur comme limite de duree totale.`,slicerApiUrlDescription:`URL du conteneur sidecar slicer-API. Laisser vide pour utiliser les variables d'environnement SLICER_API_URL / BAMBU_STUDIO_API_URL.`,externalCameras:`Caméras externes`,costTracking:`Suivi des coûts`,printsOnly:`Impressions uniquement`,totalConsumption:`Consommation totale`,dataManagement:`Gestion des données`,storageUsage:`Utilisation du stockage`,storageUsageDescription:`Répartition de l'utilisation des données par catégorie`,storageUsageTotal:`Total`,storageUsageErrors:`Erreurs`,storageUsageOtherBreakdown:`Autre (inclut ressources statiques, scripts et fichiers de configuration)`,storageUsageSystem:`Système`,storageUsageData:`Données`,storageUsageUnavailable:`Informations d'utilisation du stockage non disponibles`,clearNotificationLogsDescription:`Supprimer logs de plus de 30 jours`,resetUiPreferencesDescription:`Réinitialise thèmes et affichage sans toucher aux données.`,enableHomeAssistant:`Activer Home Assistant`,enableMqtt:`Activer MQTT`,useTls:`Utiliser TLS`,enableMetricsEndpoint:`Activer l'endpoint Metrics`,availableMetrics:`Metrics disponibles`,billingEnabled:`Activer la facturation`,billingEnabledDescription:`Facturer les utilisateurs pour les impressions et activer les fonctionnalités financières`,printerKillSwitch:`Interrupteur d'arrêt automatique`,printerKillSwitchDescription:`Arrêter immédiatement les impressions qui démarrent sans autorisation`,financeBudgetReset:`Réinitialisation mensuelle du budget financier`,financeBudgetResetDay:`Jour de réinitialisation`,financeBudgetResetDayHelp:`Pour les mois courts, la réinitialisation utilise le dernier jour du mois.`,financeBudgetResetTimezone:`Fuseau horaire de réinitialisation`,financeBudgetResetTimezoneHelp:`Le fuseau horaire utilisé pour déterminer le moment de la réinitialisation du budget chaque mois.`,rebuildLedger:`Reconstruire le grand livre du portefeuille`,rebuildLedgerStarted:`Reconstruction du grand livre commencée`,rebuildLedgerConfirmTitle:`Reconstruire le grand livre du portefeuille?`,rebuildLedgerConfirmMessage:`Cela reconstruira le grand livre du portefeuille pour réparer les valeurs de solde historiques. Exécutez ceci uniquement si vous savez ce que vous faites.`,rebuildLedgerInProgress:`Reconstruction en cours de démarrage...`,editUser:`Modifier l'utilisateur`,deleteUserTitle:`Supprimer l'utilisateur`,groupName:`Nom du groupe`,leaveEmptyForAnonymous:`Vide pour anonyme`,leaveEmptyForNoAuth:`Vide si pas d'auth`,enterNewPassword:`Nouveau mot de passe`,confirmNewPassword:`Confirmer nouveau mdp`,enterGroupName:`Entrez le nom du groupe`,enterDescriptionOptional:`Description (optionnel)`,enterCurrentPassword:`Mdp actuel`,enterNewPasswordMin6:`Nouveau mdp (min 6 char)`,toast:{keyCopied:`Clé copiée`,copyFailed:`Échec copie`,keyAddedToBrowser:`Clé ajoutée à l'explorateur`,clearLogsFailed:`Échec effacement logs`,uiPreferencesReset:`Préférences UI réinitialisées. Rafraîchissement...`,authDisabled:`Authentification désactivée`,authDisableFailed:`Échec désactivation`,apiKeyCreated:`Clé API créée`,apiKeyDeleted:`Clé API supprimée`,userCreated:`Utilisateur créé`,userUpdated:`Utilisateur mis à jour`,userDeleted:`Utilisateur supprimé`,groupCreated:`Groupe créé`,groupUpdated:`Groupe mis à jour`,groupDeleted:`Groupe supprimé`,fillRequiredFields:`Remplissez les champs requis`,passwordsDoNotMatch:`Les mots de passe ne correspondent pas`,passwordTooShort:`Le mot de passe doit contenir au moins 8 caractères`,passwordNeedsUppercase:`Le mot de passe doit contenir au moins une majuscule`,passwordNeedsLowercase:`Le mot de passe doit contenir au moins une minuscule`,passwordNeedsDigit:`Le mot de passe doit contenir au moins un chiffre`,passwordNeedsSpecial:`Le mot de passe doit contenir au moins un caractère spécial`,enterGroupName:`Entrez un nom de groupe`,settingsSaved:`Paramètres enregistrés`,noPermissionUpdate:`Vous n'avez pas l'autorisation de modifier les paramètres`,cameraSettingsSaved:`Réglages caméra enregistrés`,enterCameraUrl:`Entrez une URL caméra`,passwordChanged:`Mot de passe modifié`,connectionFailed:`Échec connexion`,testFailed:`Échec test`,cameraConnected:`Caméra connectée {{resolution}}`,cameraConnectedCoalesced:`Caméra connectée {{resolution}} (partagée avec une capture déjà en cours)`},testConnection:`Tester la connexion`,catalog:{spoolCatalog:`Catalogue de Bobines`,spoolCatalogDescription:`Poids des bobines vides par marque/type. Utilisé pour le calcul auto du poids restant.`,searchCatalog:`Chercher dans le catalogue...`,addNewEntry:`Nouvelle Entrée`,namePlaceholder:`Nom (ex: Bambu Lab - Plastique)`,weight:`Poids`,type:`Type`,default:`Défaut`,custom:`Perso`,noMatch:`Aucune entrée correspondante`,empty:`Catalogue vide`,deleteEntry:`Supprimer l'entrée`,deleteConfirm:`Supprimer "{{name}}" ?`,resetCatalog:`Réinitialiser le catalogue`,resetConfirm:`Réinitialiser aux valeurs par défaut ? Vos entrées personnalisées seront supprimées.`,loadFailed:`Échec chargement catalogue`,nameWeightRequired:`Nom et poids requis`,entryAdded:`Entrée ajoutée`,addFailed:`Échec ajout`,entryUpdated:`Entrée mise à jour`,updateFailed:`Échec mise à jour`,entryDeleted:`Entrée supprimée`,deleteFailed:`Échec suppression`,resetSuccess:`Catalogue réinitialisé`,resetFailed:`Échec réinitialisation`,exported:`{{count}} entrées exportées`,imported:`{{added}} entrées importées ({{skipped}} ignorées)`,importFailed:`Échec import : format JSON invalide`,exportTooltip:`Exporter en JSON`,importTooltip:`Importer depuis JSON`,resetTooltip:`Réinitialiser par défaut`,selectedCount:`{{count}} sélectionnés`,deleteSelected:`Supprimer la sélection`,bulkDeleteConfirm:`Supprimer {{count}} entrées ?`,bulkDeleted:`{{count}} entrées supprimées`,bulkDeleteFailed:`Échec de la suppression`,material:`Matériau`,spoolWeight:`Poids bobine`,color:`Couleur`,updateSpoolWeight:`Mettre à jour le poids bobine`,filamentUpdated:`Filament mis à jour`,filamentUpdateFailed:`Échec de la mise à jour du filament`,filamentUpdateInvalid:`Données de filament invalides`,keepExistingSpoolWeight:`Conserver l'ancien poids pour les bobines existantes`,keepExistingSpoolWeightDesc:`Les bobines déjà créées avec ce type de filament conservent l'ancien poids à vide. Les nouvelles bobines utilisent la valeur mise à jour.`,applyToAllSpools:`Appliquer à toutes les bobines`,applyToAllSpoolsDesc:`Tous les calculs de poids pour ce type de filament utilisent immédiatement le nouveau poids à vide.`},colorCatalog:{title:`Catalogue de Couleurs`,description:`Couleurs de filament par fabricant. Utilisé pour la recherche auto lors de l'ajout de bobines.`,searchColors:`Chercher couleurs...`,allManufacturers:`Tous les fabricants`,addNewColor:`Nouvelle Couleur`,manufacturer:`Fabricant`,colorName:`Nom couleur`,hex:`Hex`,materialOptional:`Matériau (optionnel)`,showing:`Affichage {{filtered}} sur {{total}} couleurs`,noMatch:`Aucune couleur correspondante`,empty:`Catalogue vide`,deleteColor:`Supprimer couleur`,deleteConfirm:`Supprimer "{{name}}" ?`,resetCatalog:`Réinitialiser catalogue couleurs`,resetConfirm:`Réinitialiser aux valeurs par défaut ?`,sync:`Synchro.`,starting:`Démarrage...`,syncTooltip:`Sync depuis FilamentColors.xyz (2000+ couleurs, peut être long)`,loadFailed:`Échec chargement catalogue couleurs`,fieldsRequired:`Fabricant, nom et code Hex requis`,colorAdded:`Couleur ajoutée`,addFailed:`Échec ajout`,colorUpdated:`Couleur mise à jour`,updateFailed:`Échec mise à jour`,colorDeleted:`Couleur supprimée`,deleteFailed:`Échec suppression`,resetSuccess:`Catalogue réinitialisé`,resetFailed:`Échec réinitialisation`,syncUpToDate:`Déjà à jour ({{count}} couleurs vérifiées)`,syncComplete:`{{added}} couleurs ajoutées ({{skipped}} déjà présentes)`,syncError:`Erreur de sync`,syncFailed:`Échec sync FilamentColors.xyz`,exported:`{{count}} couleurs exportées`,imported:`{{added}} couleurs importées ({{skipped}} ignorées)`,importFailed:`Échec import : format JSON invalide`,selectedCount:`{{count}} sélectionnés`,deleteSelected:`Supprimer la sélection`,bulkDeleteConfirm:`Supprimer {{count}} couleurs ?`,bulkDeleted:`{{count}} couleurs supprimées`,bulkDeleteFailed:`Échec de la suppression des couleurs`},dateFormat:`Format de date`,dateFormatUs:`US (MM/JJ/AAAA)`,dateFormatEu:`EU (JJ/MM/AAAA)`,dateFormatIso:`ISO (AAAA-MM-JJ)`,timeFormat:`Format horaire`,timeFormat12:`12 heures (3:30 PM)`,timeFormat24:`24 heures (15:30)`,defaultPrinter:`Imprimante par défaut`,defaultPrinterDescription:`Présélectionner cette imprimante pour les téléversements, réimpressions et autres opérations.`,slicerBambuStudio:`Bambu Studio`,slicerOrcaSlicer:`OrcaSlicer`,sidebarOrderDescription:`Utilisez la disposition de la barre latérale pour réorganiser les éléments, réinitialiser la visibilité et gérer les liens personnalisés.`,setDefault:`Définir par défaut`,sidebarOrderSetDefaultHint:`Définir par défaut applique l'ordre actuel du menu aux utilisateurs qui n'ont pas encore personnalisé le leur.`,sidebarDefaultSet:`L'ordre du menu par défaut a été défini.`,sidebarDefaultCleared:`Ordre du menu par défaut effacé.`,sidebarDefaultFailed:`Échec de la définition de l'ordre du menu par défaut.`,reset:`Réinitialiser`,darkMode:`Mode sombre`,lightMode:`Mode clair`,active:`(actif)`,background:`Arrière-plan`,accent:`Accent`,style:`Style`,bgNeutral:`Neutre`,bgWarm:`Chaud`,bgCool:`Froid`,bgOled:`OLED Noir`,bgSlate:`Bleu ardoise`,bgForest:`Vert forêt`,accentGreen:`Vert`,accentTeal:`Sarcelle`,accentBlue:`Bleu`,accentOrange:`Orange`,accentPurple:`Violet`,accentRed:`Rouge`,styleClassic:`Classique`,styleGlow:`Lumineux`,styleVibrant:`Vif`,themeToggleHint:`Basculer entre le mode sombre, clair et système avec l'icône dans la barre latérale.`,progressInTitle:`Progression dans l'onglet`,progressInTitleDescription:`Affiche le pourcentage de l'impression en cours et un anneau de progression dans l'onglet du navigateur.`,autoArchivePrints:`Archiver automatiquement les impressions`,autoArchiveDescription:`Sauvegarder automatiquement les fichiers 3MF à la fin des impressions`,saveThumbnailsDescription:`Extraire et sauvegarder les images d'aperçu des fichiers 3MF`,captureFinishPhotoDescription:`Prendre une photo avec la caméra de l'imprimante à la fin de l'impression. Bambuddy enregistre un court timelapse pendant l'impression afin que la photo puisse provenir du moment précédant l'abaissement du plateau ; le fichier du timelapse est conservé si vous avez activé le timelapse pour cette impression, sinon il est supprimé automatiquement après la capture de la photo.`,finishPhotoRestorePlate:`Remonter le plateau pour la photo finale`,finishPhotoRestorePlateDescription:`L'imprimante abaisse le plateau d'environ 100 mm à la fin d'une impression, plaçant l'objet terminé sous le cadrage de la caméra. Bambuddy le remonte juste au-dessus de la dernière couche imprimée, prend la photo, puis le rabaisse. Ignoré si la hauteur d'impression est inconnue ou si un autre travail est en file d'attente.`,ffmpegNotInstalled:`ffmpeg non installé`,ffmpegRequired:`La capture caméra nécessite ffmpeg. Installez-le via brew install ffmpeg (macOS) ou apt install ffmpeg (Linux).`,camera:`Caméra`,cameraViewMode:`Mode d'affichage caméra`,cameraOverlayDescription:`La caméra s'ouvre dans un overlay redimensionnable sur l'écran principal`,cameraWindowDescription:`La caméra s'ouvre dans une fenêtre de navigateur séparée`,externalCamerasDescription:`Configurer des caméras externes pour remplacer la caméra intégrée. Supporte les flux MJPEG, RTSP, snapshots HTTP et caméras USB (V4L2). Lorsqu'activée, la caméra externe est utilisée pour la vue en direct et les photos de fin.`,cameraPlaceholderUsb:`Chemin du périphérique (/dev/video0)`,cameraPlaceholderUrl:`URL caméra (rtsp://... ou http://...)`,cameraTypeMjpeg:`Flux MJPEG`,cameraTypeRtsp:`Flux RTSP`,cameraTypeSnapshot:`Snapshot HTTP`,cameraTypeUsb:`Caméra USB (V4L2)`,cameraSnapshotUrl:`URL de capture (facultatif)`,cameraSnapshotUrlPlaceholder:`http://192.168.1.61:1984/api/frame.jpeg?src=printer`,cameraSnapshotUrlHelp:`URL d'image unique utilisée pour les miniatures de notification, photos de fin, frames de timelapse par couche et détection de plaque. Le timelapse et la détection de plaque nécessitent chacun leur propre bascule par imprimante — cette URL est juste la source d'image qu'ils utilisent lorsqu'activés. Laisser vide pour capturer depuis le flux en direct ci-dessus. Utile pour go2rtc (/api/frame.jpeg) et caméras IP avec un point de terminaison de capture dédié.`,cameraRotation:`Rotation`,cameraLight:`Allumer l'éclairage de la chambre pour la caméra`,cameraLightHint:`Allume l'éclairage pendant que quelqu'un regarde la caméra et pour les captures automatiques, comme les photos des notifications, les photos de fin et les images pour Home Assistant. L'éteint ensuite, mais seulement si Bambuddy l'a allumé.`,cameraLightDelay:`Attente avant la capture`,cameraLightDelayHint:`Uniquement si l'éclairage était éteint. Laisse à l'éclairage, et à toute lampe synchronisée avec lui, le temps de s'allumer.`,cameraLightMode_off:`Désactivé`,cameraLightMode_all:`Toutes les imprimantes`,cameraLightMode_selected:`Imprimantes choisies`,cameraLightDelayUnit:`secondes`,cameraLightNoneSelected:`Aucune imprimante choisie pour l'instant.`,cameraLightAddPrinter:`Ajouter une imprimante`,cameraLightRemovePrinter:`Retirer {{name}}`,externalCameraAdd:`Ajouter une caméra externe`,externalCameraRemove:`Retirer la caméra externe de {{name}}`,printerPickerSearch:`Rechercher des imprimantes`,printerPickerNoMatch:`Aucune imprimante ne correspond.`,cameraShowSettings:`Réglages de la caméra`,test:`Tester`,connected:`Connecté`,disconnected:`Déconnecté`,currency:`Devise`,defaultFilamentCost:`Coût filament par défaut (par kg)`,electricityCost:`Coût électricité par kWh`,energyPriceSource:`Source du prix de l'électricité`,energyPriceSourceFixed:`Prix fixe`,energyPriceSourceHomeAssistant:`Capteur Home Assistant`,energyPriceHaEntity:`Capteur de prix`,energyPriceLastRead:`Dernier prix lu par kWh`,energyPriceFixedHint:`Un nouveau prix s'applique à l'énergie consommée à partir de ce moment ; l'énergie déjà consommée garde le prix auquel elle a été consommée.`,energyPriceHaHint:`Lu toutes les heures ainsi qu'au début et à la fin de chaque impression, et chaque heure d'énergie est comptée à son propre prix. Le capteur doit donner le prix par kWh (par MWh et par Wh sont convertis).`,energyPriceHaNotConfigured:`Home Assistant n'est pas configuré. Connectez-le dans Paramètres → Réseau → Home Assistant.`,energyDisplayMode:`Mode d'affichage énergie`,energyModePrintDescription:`Le tableau de bord affiche la somme de l'énergie utilisée pendant les impressions`,energyModeTotalDescription:`Le tableau de bord affiche l'énergie totale des prises connectées`,fileManager:`Gestionnaire de fichiers`,createArchiveEntry:`Créer une entrée d'archive lors de l'impression`,createArchiveEntryDescription:`Lors de l'impression depuis le gestionnaire de fichiers, créer optionnellement une entrée d'archive`,lowDiskSpaceWarning:`Avertissement espace disque faible`,lowDiskSpaceDescription:`Afficher un avertissement lorsque l'espace disque libre descend sous ce seuil`,printerFirmware:`Firmware imprimante`,checkFirmwareDescription:`Vérifier les mises à jour firmware de Bambu Lab`,bambuddySoftware:`Logiciel Bambuddy`,autoCheckDescription:`Vérifier automatiquement les nouvelles versions au démarrage`,checkNow:`Vérifier maintenant`,updateAvailableVersion:`Mise à jour disponible : v{{version}}`,releaseNotes:`Notes de version`,updateViaDocker:`Mettre à jour via Docker Compose :`,composeDirectory:`Répertoire Compose`,composeDirectoryHint:`Répertoire contenant votre docker-compose.yml. Laissez vide pour omettre le cd.`,copyUpdateCommand:`Copier la commande de mise à jour`,updateViaHomeAssistant:`Les mises à jour sont gérées par le superviseur Home Assistant. Ouvrez Paramètres → Modules complémentaires → Bambuddy dans Home Assistant pour installer la nouvelle version.`,updateViaWindowsInstaller:`Les installations Windows se mettent à jour en relançant l'installateur. Téléchargez la nouvelle version ci-dessous — vos données, paramètres et imprimantes sont préservés.`,downloadWindowsInstaller:`Télécharger l'installateur pour la v{{version}}`,installUpdate:`Installer la mise à jour`,latestVersionRunning:`Vous utilisez la dernière version`,failedToCheckUpdates:`Échec de la vérification des mises à jour : {{error}}`,backupRestore:`Sauvegarde & Restauration`,backupRestoreDescription:`Exporter/importer les paramètres et configurer la sauvegarde GitHub`,goToBackup:`Aller à la sauvegarde`,externalUrl:`URL externe`,externalUrlDescription:`L'URL externe où Bambuddy est accessible. Utilisée pour les images de notification et les intégrations externes.`,bambuddyUrl:`URL Bambuddy`,externalUrlHint:`Inclure le protocole et le port (ex : http://192.168.1.100:8000)`,ftpRetry:`Réessai FTP`,ftpRetryDescription:`Réessayer les opérations FTP lorsque le WiFi de l'imprimante est instable. S'applique aux téléchargements 3MF, uploads d'impression, téléchargements timelapse et mises à jour firmware.`,autoRetryDescription:`Réessayer automatiquement les opérations FTP échouées`,retryAttempts:`Tentatives de réessai`,retryDelay:`Délai de réessai`,connectionTimeout:`Délai de connexion`,time_one:`{{count}} fois`,time_other:`{{count}} fois`,second_one:`{{count}} seconde`,second_other:`{{count}} secondes`,nSeconds:`{{count}} secondes`,increaseForWeakWifi:`Augmenter pour les imprimantes avec un WiFi faible`,homeAssistant:`Home Assistant`,homeAssistantFullDescription:`Se connecter à Home Assistant pour contrôler les prises connectées via l'API REST HA. Supporte les entités switch, light, input_boolean et script.`,homeAssistantUrl:`URL Home Assistant`,longLivedAccessToken:`Token d'accès longue durée`,haTokenHint:`Créer un token dans HA : Profil → Tokens d'accès longue durée → Créer un token`,connectionSuccessful:`Connexion réussie`,connectionFailed:`Connexion échouée`,haConnectionSuccess:`Connexion à Home Assistant réussie.`,haConnectionFailed:`Échec de la connexion à Home Assistant.`,mqttPublishing:`Publication MQTT`,mqttDescription:`Publier les événements BamBuddy vers un broker MQTT externe pour l'intégration avec Node-RED, Home Assistant et d'autres systèmes d'automatisation.`,mqttEnableDescription:`Publier les événements vers un broker MQTT externe`,brokerHostname:`Nom d'hôte du broker`,port:`Port`,usernameOptional:`Nom d'utilisateur (optionnel)`,passwordOptional:`Mot de passe (optionnel)`,topicPrefix:`Préfixe de topic`,topicPrefixHint:`Les topics seront : {{prefix}}/printers//status, etc.`,prometheusMetrics:`Métriques Prometheus`,prometheusEndpointDescription:`Exposer les métriques imprimante sur /api/v1/metrics pour la surveillance Prometheus/Grafana.`,bearerTokenOptional:`Token Bearer (optionnel)`,bearerTokenHint:`Si défini, les requêtes doivent inclure Authorization: Bearer `,metricsConnectionStatus:`État de connexion`,metricsPrinterState:`État imprimante (idle/printing/etc)`,metricsPrintProgress:`Progression impression 0-100%`,metricsBedTemp:`Température du plateau`,metricsNozzleTemp:`Température de la buse`,metricsPrintsTotal:`Total impressions par résultat`,metricsMore:`...et plus (couches, ventilateurs, file d'attente, utilisation filament)`,smartPlugsDescription:`Connecter des prises connectées (Tasmota ou Home Assistant) pour automatiser le contrôle de l'alimentation et suivre la consommation d'énergie de vos imprimantes.`,allOn:`Tout allumer`,allOff:`Tout éteindre`,addSmartPlug:`Ajouter une prise`,energySummary:`Résumé énergétique`,currentPower:`Puissance actuelle`,plugsOnline:`{{reachable}}/{{total}} prises en ligne`,today:`Aujourd'hui`,yesterday:`Hier`,total:`Total`,enablePlugsForSummary:`Activer les prises pour voir le résumé énergétique`,addNotificationProvider:`Ajouter`,systemBadge:`(Système)`,creating:`Création...`,changing:`Modification...`,deleteUserAndItems:`Supprimer l'utilisateur ET ses éléments`,deleteUserKeepItems:`Supprimer l'utilisateur, garder les éléments (deviennent sans propriétaire)`,ok:`OK`,twoFa:{totpTitle:`Application Authenticator (TOTP)`,totpDesc:`Utilisez une application comme Google Authenticator, Aegis ou Authy.`,emailOtpTitle:`OTP par e-mail`,emailOtpDesc:`Envoyez un code à usage unique à {{email}} lors de la connexion.`,emailOtpNoEmail:`Ajoutez une adresse e-mail à votre compte pour activer cette méthode.`,addEmailFirst:`Votre compte n'a pas d'adresse e-mail. Demandez à un administrateur d'en ajouter une.`,setupTotp:`Configurer l'application Authenticator`,setupAuthApp:`Configurer l'application Authenticator`,setupInstructions:`Scannez le QR code avec votre application authenticator, puis confirmez avec un code.`,manualEntry:`Impossible de scanner ? Entrez ce secret manuellement :`,scannedContinue:`Code scanné — continuer`,enterCodeToConfirm:`Entrez le code à 6 chiffres de votre application authenticator pour confirmer.`,activate:`Activer`,disableTotp:`Désactiver l'Authenticator`,disableConfirmHint:`Entrez un code TOTP valide ou un code de secours pour désactiver l'authenticator.`,totpDisabled:`Application Authenticator désactivée.`,emailOtpEnabled:`OTP par e-mail activé.`,emailOtpDisabled:`OTP par e-mail désactivé.`,smtpRequired:`Veuillez d'abord configurer et tester les paramètres SMTP.`,invalidCode:`Code invalide. Veuillez réessayer.`,enableEmailOtp:`Activer OTP par e-mail`,disableEmailOtp:`Désactiver OTP par e-mail`,emailSetupEnterCode:`Un code de vérification a été envoyé à votre adresse e-mail. Entrez-le ci-dessous pour confirmer que vous possédez cette boîte de réception.`,verifyAndEnable:`Vérifier et activer`,emailDisablePasswordHint:`Entrez le mot de passe de votre compte pour confirmer la désactivation de l'OTP par e-mail.`,passwordPlaceholder:`Entrez votre mot de passe`,backupCodesTitle:`Sauvegardez vos codes de secours`,backupCodesWarning:`Conservez ces codes en lieu sûr. Chaque code ne peut être utilisé qu'une seule fois et ne sera plus affiché.`,backupCodesRemaining:`{{count}} codes de secours restants`,savedCodes:`Codes sauvegardés`,regenBackup:`Régénérer les codes de secours`,regenBackupHint:`Entrez votre code TOTP actuel pour générer 10 nouveaux codes de secours. Tous les codes existants seront invalidés.`,newBackupCodes:`Nouveaux codes de secours`,linkedAccounts:`Comptes SSO liés`,linkedAccountsDesc:`Ces fournisseurs d'identité externes sont liés à votre compte.`,oidcUnlinked:`Compte dissocié.`},sessionPolicy:{title:`Politique de session`,description:`Durée maximale des sessions pour les nouvelles connexions utilisateur. Les jetons déjà émis conservent leur expiration d'origine.`,preset24h:`24 heures`,preset7d:`7 jours`,preset30d:`30 jours`,customHoursLabel:`Durée de session personnalisée en heures`,hoursSuffix:`heures`,warning:`Les sessions plus longues réduisent la protection de déconnexion automatique. Recommandé uniquement pour les déploiements mono-utilisateur de confiance.`},oidc:{title:`Fournisseurs SSO / OIDC`,desc:`Configurez des fournisseurs OpenID Connect pour l'authentification unique.`,addProvider:`Ajouter un fournisseur`,newProvider:`Nouveau fournisseur`,empty:`Aucun fournisseur OIDC configuré.`,created:`Fournisseur créé.`,updated:`Fournisseur mis à jour.`,deleted:`Fournisseur supprimé.`,refreshIcon:`Actualiser l'icône`,removeIcon:`Supprimer l'icône`,iconRefreshed:`Icône actualisée.`,iconRemoved:`Icône supprimée.`,iconFetchFailed:`Impossible de récupérer l'icône depuis l'URL du fournisseur.`,deleteTitle:`Supprimer le fournisseur`,deleteMessage:`Supprimer "{{name}}" ? Tous les comptes liés seront déconnectés.`,form:{name:`Nom d'affichage`,issuerUrl:`URL de l'émetteur`,clientId:`ID client`,clientSecret:`Secret client`,scopes:`Portées`,iconUrl:`URL de l'icône (optionnel)`,enabled:`Activé`,autoCreate:`Créer les utilisateurs automatiquement`,autoCreateDesc:`Crée automatiquement un compte local lors de la première connexion.`,autoLink:`Lier automatiquement les comptes existants`,autoLinkDesc:`Lie les comptes locaux existants par e-mail lors de la première connexion.`,secretHint:`laisser vide pour conserver`,secretPlaceholder:`nouveau secret`,emailClaim:`Claim e-mail`,emailClaimDesc:`Claim JWT utilisé comme identité e-mail. Utiliser 'preferred_username' ou 'upn' pour Azure Entra ID (qui n'envoie pas email_verified). Utiliser uniquement des noms de claims de confiance.`,emailClaimPlaceholder:`e-mail`,emailClaimCustomClaimAutoLinkWarning:`Les revendications personnalisées sont sûres pour la liaison auto uniquement lorsque la valeur est administrée par le tenant (par ex. Azure Entra ID upn / preferred_username). N'activez pas la liaison auto si votre IdP permet aux utilisateurs de s'auto-attribuer cette revendication.`,requireEmailVerified:`Exiger la vérification e-mail`,requireEmailVerifiedDesc:`N'accepter le claim e-mail que si le fournisseur le marque comme vérifié.`,requireEmailVerifiedWarning:`Avertissement : l'e-mail sera accepté sans vérification. À utiliser uniquement avec des fournisseurs de confiance.`,requireEmailVerifiedAutoLink:`Désactiver le lien automatique d'abord pour modifier ce paramètre.`,defaultGroup:`Groupe par défaut`,defaultGroupDesc:`Groupe attribué aux utilisateurs créés automatiquement. Repli sur Viewers si non défini.`,defaultGroupViewersFallback:`Viewers (par défaut)`,autologin:`Connexion automatique`,autologinDesc:`Rediriger les visiteurs non authentifiés directement vers ce fournisseur. Un seul fournisseur peut porter cet indicateur.`,groupClaim:`Claim de groupes`,groupClaimDesc:`Claim JWT contenant les groupes de l'utilisateur auprès du fournisseur d'identité. La plupart des fournisseurs utilisent 'groups' ; la valeur peut être un tableau JSON ou une chaîne.`,groupMapping:`Mappage des groupes`,groupMappingDesc:`Les groupes mappés sont synchronisés à chaque connexion. Les groupes non mentionnés ici ne sont pas modifiés, afin que les affectations manuelles soient conservées. Laisser vide pour désactiver la synchronisation des groupes.`,groupSync:`Synchronisation des groupes`,groupSyncOn:`Active`,groupMappingIdpGroupPlaceholder:`Nom du groupe auprès du fournisseur d'identité`,groupMappingSelectGroup:`Sélectionner un groupe Bambuddy…`,groupMappingAddRow:`Ajouter un mappage`,groupMappingDeletedGroupOption:`{{group}} (supprimé)`,groupMappingDeletedGroupWarning:`Ce groupe Bambuddy a été supprimé. Choisissez un remplaçant ou supprimez ce mappage.`,groupMappingIncompleteRow:`Saisissez le groupe du fournisseur d'identité et choisissez un groupe Bambuddy, ou supprimez ce mappage.`,groupMappingDuplicateRow:`Ce groupe du fournisseur d'identité est déjà mappé plus haut. Les noms de groupe sont comparés sans tenir compte de la casse.`}},encryption:{title:`Statut du chiffrement MFA`,enabledFromEnv:`Chiffrement au repos activé (clé depuis la variable d'environnement MFA_ENCRYPTION_KEY)`,enabledFromFile:`Chiffrement au repos activé (clé chargée depuis le répertoire de données)`,enabledGenerated:`Chiffrement au repos activé avec une clé auto-générée`,notConfigured:`Chiffrement au repos non configuré`,notConfiguredDesc:`Les secrets TOTP et client_secrets OIDC sont stockés en clair. Définissez MFA_ENCRYPTION_KEY ou redémarrez Bambuddy avec un répertoire de données accessible en écriture pour en générer un automatiquement.`,allEncrypted:`Tous les secrets MFA sont chiffrés au repos.`,legacyRowsLabel:`Lignes héritées en clair`,encryptedRowsLabel:`Lignes chiffrées`,legacyRowsWarning:`{{count}} ligne(s) héritée(s) en clair détectée(s). Réenregistrez le fournisseur OIDC ou réinscrivez l'application d'authentification de l'utilisateur pour migrer vers le stockage chiffré.`,backupHint:`La clé auto-générée est stockée dans DATA_DIR/.mfa_encryption_key et incluse dans les ZIP de sauvegarde locale. Conservez vos sauvegardes en sécurité ou définissez MFA_ENCRYPTION_KEY explicitement.`,decryptionBrokenTitle:`Clé de chiffrement manquante`,decryptionBrokenError:`{{count}} enregistrement(s) chiffré(s) ne peuvent pas être déchiffrés car la clé de chiffrement n'est plus disponible. Restaurez le MFA_ENCRYPTION_KEY précédent ou DATA_DIR/.mfa_encryption_key pour récupérer.`,migrationErrorWarning:`{{count}} ligne(s) ancienne(s) n'ont pas pu être rechiffrée(s) au démarrage. Vérifiez les journaux du serveur et redémarrez Bambuddy pour réessayer.`},spoolbuddy:{infoTitle:`Périphériques SpoolBuddy`,infoBody:`Les bornes SpoolBuddy s'enregistrent automatiquement via heartbeat. Désinscrivez ici un appareil qui n'est plus utilisé ou un doublon obsolète laissé par un crash du daemon.`,duplicatesTitle:`{{count}} appareils enregistrés`,duplicatesBody:`Seul le premier appareil enregistré est utilisé par l'interface du kiosk. Si l'un de ces appareils est un doublon obsolète issu d'un crash, désinscrivez-le — un appareil en ligne se ré-enregistrera automatiquement au prochain heartbeat.`,empty:`Aucun appareil SpoolBuddy enregistré pour le moment.`,online:`En ligne`,offline:`Hors ligne`,unregister:`Désinscrire`,unregisterSuccess:`Appareil désinscrit`,unregisterError:`Échec de la désinscription`,confirmTitle:`Désinscrire l'appareil SpoolBuddy ?`,confirmBody:`Cela retirera "{{hostname}}" ({{deviceId}}) de la base de données. Si l'appareil est en ligne, il se ré-enregistrera automatiquement au prochain heartbeat.`,ipAddress:`Adresse IP`,firmware:`Micrologiciel`,lastSeen:`Dernière activité`,daemonUptime:`Uptime du daemon`,systemUptime:`Uptime système`,never:`jamais`,nfc:`NFC`,scale:`Balance`,cpuTemp:`Temp. CPU`,cpuLoad:`Charge CPU`,memory:`Mémoire`,disk:`Disque`,update:`Mettre à jour`,updateConfirmTitle:`Mettre à jour le daemon Spoolbuddy ?`,updateConfirmBody:`Déclencher une mise à jour logicielle sur "{{hostname}}" ? Le daemon redémarrera une fois la mise à jour appliquée.`,restartBrowser:`Redémarrer le navigateur`,restartBrowserConfirmTitle:`Redémarrer le navigateur du kiosk ?`,restartBrowserConfirmBody:`Redémarrer le navigateur du kiosk sur "{{hostname}}" ? L'écran sera momentanément vide.`,restartDaemon:`Redémarrer le daemon`,restartDaemonConfirmTitle:`Redémarrer le daemon Spoolbuddy ?`,restartDaemonConfirmBody:`Redémarrer le daemon Spoolbuddy sur "{{hostname}}" ? L'appareil sera hors ligne quelques secondes.`,reboot:`Redémarrer`,rebootConfirmTitle:`Redémarrer l'appareil ?`,rebootConfirmBody:`Redémarrer "{{hostname}}" ? L'appareil sera hors ligne pendant environ une minute.`,shutdown:`Éteindre`,shutdownConfirmTitle:`Éteindre l'appareil ?`,shutdownConfirmBody:`Éteindre "{{hostname}}" ? Vous aurez besoin d'un accès physique pour le rallumer.`,commandConfirm:`Confirmer`,commandQueued:`Commande en file d'attente`,commandError:`Échec de l'envoi de la commande`},pipelineLimits:{title:`Limites des pipelines du trancheur`,maxCopiesLabel:`Copies maximales par exécution`,maxCopiesDesc:`Limite supérieure du nombre de copies que les opérateurs peuvent demander lors de l'exécution d'un pipeline. La limite stricte côté serveur est 1000.`},pipelines:{title:`Pipelines du Trancheur`,subtitle:`Lots de préréglages réutilisables (imprimante + processus + filaments + type de plateau). Enregistrez-en un depuis le dialogue Trancher et appliquez-le en un clic au fichier suivant.`,loading:`Chargement des pipelines…`,loadError:`Impossible de charger les pipelines.`,confirmDelete:`Supprimer ce pipeline ? Cela ne peut pas être annulé.`,staleWarning:`Un ou plusieurs préréglages référencés n'existent plus. Réenregistrez ce pipeline depuis le dialogue Trancher pour le corriger.`,empty:{title:`Aucun pipeline pour le moment.`,howto:`Ouvrez le dialogue Trancher pour n'importe quel fichier, choisissez imprimante / processus / filaments / plateau, puis cliquez sur « Enregistrer comme pipeline ». Vos pipelines enregistrés apparaîtront ici.`},field:{name:`Nom du pipeline`,description:`Description`,targetPrinter:`Imprimante cible`,noTarget:`— Aucune cible —`,targetKind:`Type de cible`,targetKindSpecific:`Imprimante spécifique`,targetKindClass:`Classe d'imprimante`,targetModelClass:`Modèle d'imprimante`,fanoutStrategy:`Stratégie de distribution`,fanout:{max_parallel:`Max parallèle — distribuer sur toute imprimante libre correspondante`,round_robin:`Round robin — alterner entre imprimantes éligibles`,fill_one_first:`Remplir une d'abord — épingler toutes les copies à une imprimante`},fanoutShort:{max_parallel:`parallèle`,round_robin:`round robin`,fill_one_first:`remplir une`}},action:{save:`Enregistrer`,cancel:`Annuler`,rename:`Renommer`,delete:`Supprimer`},slot:{printer:`Imprimante`,process:`Processus`,filament:`Filament`,filamentN:`Filament {{n}}`,filamentAll:`Tous les {{n}} emplacements`,bed:`Plateau`},group:{profiles:`Profils`,filaments:`Filaments`},searchPlaceholder:`Rechercher des pipelines…`,filterTargetType:`Filtrer par type de cible`,filterTarget:`Filtrer par cible`,filter:{all:`Toutes les cibles`,noTarget:`Aucune cible`,count:`{{shown}} / {{total}}`,noMatches:`Aucun pipeline ne correspond aux filtres actuels.`},toast:{saved:`Pipeline enregistré`,saveFailed:`Échec de l'enregistrement`,deleted:`Pipeline supprimé`,deleteFailed:`Échec de la suppression`},noTargetHint:`Définissez une imprimante cible pour exécuter`,noTargetWarning:`Définissez une imprimante cible avant d'exécuter ce pipeline.`,runs:{lastRun:`Dernière exécution`,status:{queued:`en file`,slicing:`tranchage`,dispatching:`envoi`,in_progress:`impression`,completed:`terminé`,failed:`échec`,partial_failure:`échec partiel`,cancelled:`annulé`}}}},notification:{printStarted:{title:`Impression démarrée`,body:`{{printer}} : {{filename}} commence l'impression`},printCompleted:{title:`Impression terminée`,body:`{{printer}} : {{filename}} a réussi`},printFailed:{title:`Impression échouée`,body:`{{printer}} : {{filename}} a échoué`},printStopped:{title:`Impression arrêtée`,body:`{{printer}} : {{filename}} a été arrêtée`},printProgress:{title:`Progression d'impression`,body:`{{printer}} : {{filename}} est à {{percent}}%`},printerOffline:{title:`Imprimante hors ligne`,body:`{{printer}} est déconnectée`},printerError:{title:`Erreur imprimante`,body:`{{printer}} : {{error}}`},filamentLow:{title:`Filament bas`,body:`{{printer}} : Le filament est presque vide`},maintenanceDue:{title:`Maintenance due`,body:`{{printer}} : {{items}} demandent votre attention`}},errors:{generic:`Une erreur est survenue`,networkError:`Erreur réseau. Vérifiez votre connexion.`,notFound:`Non trouvé`,unauthorized:`Non autorisé`,serverError:`Erreur serveur`,validationError:`Vérifiez vos saisies`,printerConnectionFailed:`Échec connexion imprimante`,saveFailed:`Échec enregistrement`,deleteFailed:`Échec suppression`,loadFailed:`Échec chargement`},hmsErrors:{title:`Erreurs - {{name}}`,noErrors:`Aucune erreur`,viewOnWiki:`Voir sur le Wiki Bambu Lab`,mqttVerifyFailedRemedy:`Activez le mode developpeur sur l'imprimante, redemarrez l'imprimante, puis relancez la tache.`,mqttVerifyFailedDescription:`L'imprimante a refusé une commande parce qu'elle n'a pas pu la vérifier. Les impressions, changements de température et chargements de filament envoyés depuis Bambuddy seront ignorés tant que ce n'est pas corrigé.`,severityError:`Erreur`,severityWarning:`Avertissement`,severityNotice:`Avis`,severityUnknown:`Niveau inconnu`,uncountedSummary:`Également signalés, non comptés ({{n}})`,uncountedHint:`Avis qui ne demandent aucune action, et codes pour lesquels Bambu ne publie aucun texte. Ils ne comptent pas comme problèmes sur la carte de l'imprimante et n'envoient pas de notification.`,unknownCode:`Code HMS inconnu — consultez le wiki Bambu Lab pour plus de détails.`,clearInstructions:`Effacez les erreurs sur l'imprimante pour les retirer ici.`,clearErrors:`Effacer les erreurs`,clearSuccess:`Erreurs HMS effacées`,clearFailed:`Échec de l'effacement des erreurs HMS`,actionSuccess:`Action envoyée à l'imprimante`,actionFailed:`Échec de l'envoi de l'action`,runoutExpectedSlot:`Le filament est épuisé dans {{ranOut}}. L'imprimante attend maintenant du filament compatible dans {{expected}}. Insérez une bobine dans {{expected}}, puis sélectionnez Réessayer.`,runoutExpectedSlotOnly:`L'imprimante attend du filament compatible dans {{expected}}. Insérez-y une bobine, puis sélectionnez Réessayer.`,runoutSlotUnknown:`Le filament est épuisé et l'impression est en pause. Bambuddy n'a pas pu déterminer quel emplacement l'imprimante attend désormais — vérifiez l'écran de l'imprimante pour l'emplacement demandé.`,actions:{RESUME_PRINTING:`Reprendre l'impression`,RESUME_PRINTING_DEFECTS:`Reprendre (défauts acceptables)`,RESUME_PRINTING_PROBELM_SOLVED:`Reprendre (problème résolu)`,STOP_PRINTING:`Arrêter l'impression`,CHECK_ASSISTANT:`Ouvrir l'assistant`,FILAMENT_EXTRUDED:`Filament extrudé, continuer`,RETRY_FILAMENT_EXTRUDED:`Pas encore extrudé, réessayer`,CONTINUE:`Terminé, continuer`,LOAD_VIRTUAL_TRAY:`Charger le filament`,OK_BUTTON:`OK`,FILAMENT_LOAD_RESUME:`Filament chargé, reprendre`,JUMP_TO_LIVEVIEW:`Voir en direct`,NO_REMINDER_NEXT_TIME:`Ne plus rappeler la prochaine fois`,REFRESH_NOZZLE:`Revérifier`,IGNORE_NO_REMINDER_NEXT_TIME:`Ignorer et ne plus rappeler`,IGNORE_RESUME:`Ignorer et reprendre`,PROBLEM_SOLVED_RESUME:`Problème résolu, reprendre`,TURN_OFF_FIRE_ALARM:`Compris, désactiver l'alarme incendie`,RETRY_PROBLEM_SOLVED:`Réessayer (problème résolu)`,CANCLE:`Annuler`,STOP_DRYING:`Arrêter le séchage`,PROCEED:`Continuer`,OK_JUMP_RACK:`OK`,ABORT:`Annuler`,DISABLE_PURIFICATION:`Désactiver la purification pour cette impression`,DONT_REMIND_NEXT_TIME:`Ne plus me rappeler`,DBL_CHECK_CANCEL:`Annuler`,DBL_CHECK_DONE:`Terminé`,DBL_CHECK_RETRY:`Réessayer`,DBL_CHECK_RESUME:`Reprendre`,DBL_CHECK_OK:`Confirmer`,REMOVE_CLOSE_BTN:`Fermer`}},mqttDebug:{title:`Journal de débogage MQTT`,searchPlaceholder:`Chercher topic ou message...`,noMessages:`Aucun message enregistré`,startLoggingHint:`Cliquez sur "Démarrer" pour capturer les messages MQTT`,noMessagesMatch:`Aucun message ne correspond`,adjustFilterHint:`Ajustez votre recherche`,incoming:`Entrant`,outgoing:`Sortant`,loggingStopped:`Enregistrement arrêté`,loggingActive:`Enregistrement actif - rafraîchissement auto`,startLogging:`Démarrer`,stopLogging:`Arrêter`,clearLog:`Effacer le journal`,topic:`Sujet`,timestamp:`Horodatage`,direction:`Direction`,all:`Tous`},printerFiles:{zipStarted_one:`Téléchargement ZIP de {{count}} fichier démarré`,zipStarted_other:`Téléchargement ZIP de {{count}} fichiers démarré`,zipPartial:`Le téléchargement ZIP a démarré avec {{successful}} fichiers sur {{total}} ; les autres n’ont pas pu être récupérés`,downloadFailed:`Échec du téléchargement : {{error}}`,unknownError:`Erreur inconnue`,shiftSelectHint:`Maj-clic pour sélectionner une plage`,selectFile:`Sélectionner {{name}}`,deselectFile:`Désélectionner {{name}}`,title:`Gestionnaire de fichiers`,storageUsed:`Utilisé :`,storageFree:`Libre :`,filterPlaceholder:`Filtrer les fichiers...`,deleteButton:`Supprimer`,deleteFiles:`Supprimer {{count}} fichiers`,deleteFileConfirm:`Supprimer "{{name}}" ?`,deleteFilesConfirm:`Supprimer les {{count}} fichiers sélectionnés ?`,noFiles:`Aucun fichier sur l'imprimante`,printerUnavailable:`Le service de fichiers de l'imprimante est indisponible. Réessayez lorsque l'imprimante est accessible.`,loadingFiles:`Chargement...`,failedToLoad:`Échec chargement fichiers`,toast:{filesDeleted:`{{count}} fichier(s) supprimé(s)`,deleteFailed:`Échec suppression : {{error}}`}},confirm:{delete:`Voulez-vous vraiment supprimer cet élément ?`,unsavedChanges:`Changements non sauvegardés. Voulez-vous quitter ?`,clearQueue:`Voulez-vous vraiment vider la file d'attente ?`},login:{title:`Connexion Bambuddy`,subtitle:`Connectez-vous à votre compte`,username:`Utilisateur`,usernamePlaceholder:`Entrez votre utilisateur`,usernameOrEmail:`Utilisateur ou Email`,usernameOrEmailPlaceholder:`Utilisateur ou @ Email`,password:`Mot de passe`,passwordPlaceholder:`Entrez votre mot de passe`,signIn:`Se connecter`,signingIn:`Connexion...`,rememberMe:`Se souvenir de moi`,forgotPassword:`Mot de passe oublié ?`,autologinFailed:`La connexion SSO automatique a échoué. Choisissez un fournisseur ci-dessous pour continuer.`,localDisabledNotice:`La connexion locale est désactivée. Utilisez l'un des fournisseurs SSO ci-dessous.`,loginSuccess:`Connecté avec succès`,loginFailed:`Échec de connexion`,enterCredentials:`Entrez vos identifiants`,enterEmail:`Veuillez entrer votre adresse e-mail`,oidcLoginFailed:`Échec de la connexion OIDC`,oidcErrors:{providerError:`Le fournisseur d'identité a renvoyé une erreur`,missingParameters:`Il manque des paramètres requis dans le callback OIDC`,invalidState:`L'état OIDC est invalide ou a déjà été utilisé`,stateExpired:`La session OIDC a expiré — veuillez réessayer`,providerNotFound:`Fournisseur OIDC introuvable`,discoveryFailed:`Impossible de récupérer le document de découverte OIDC`,invalidDiscovery:`Le document de découverte OIDC est invalide`,networkError:`Erreur réseau lors de l'échange de jeton OIDC`,badResponse:`Réponse inattendue lors de l'échange de jeton OIDC`,noIdToken:`Le fournisseur OIDC n'a pas renvoyé de jeton d'identité`,validationFailed:`La validation du jeton OIDC a échoué`,nonceMismatch:`Le nonce OIDC ne correspond pas — possible attaque par rejeu`,missingSubClaim:`Le jeton OIDC est dépourvu de la revendication sub`,noLinkedAccount:`Aucun compte local est lié à cette identité OIDC`,accountInactive:`Votre compte est inactif`,userResolutionFailed:`Impossible de résoudre votre compte`,internalError:`Une erreur interne est survenue lors de la connexion OIDC`,tokenExchangeFailed:`L'échange de jeton OIDC a échoué`},forgotPasswordTitle:`Mot de passe oublié`,forgotPasswordMessage:`Contactez votre administrateur pour réinitialiser votre accès.`,forgotPasswordEmailMessage:`Entrez votre email pour recevoir un nouveau mot de passe.`,emailAddress:`Adresse Email`,emailPlaceholder:`votre.email@exemple.com`,cancel:`Annuler`,sending:`Envoi...`,sendResetEmail:`Envoyer l'email`,howToReset:`Comment réinitialiser :`,resetStep1:`Contactez votre admin Bambuddy`,resetStep2:`Demandez une réinitialisation dans la Gestion Utilisateurs`,resetStep3:`Il vous donnera un mot de passe temporaire`,resetStep4:`Connectez-vous et changez-le dans les Paramètres`,gotIt:`Compris`,twoFA:{title:`Authentification à deux facteurs`,subtitle:`Votre compte est protégé par la 2FA. Saisissez le code de vérification ci-dessous.`,methodAuthenticator:`Application d'authentification`,methodEmail:`Code par e-mail`,methodBackup:`Code de récupération`,instructionsTotp:`Ouvrez votre application d'authentification et saisissez le code à 6 chiffres pour Bambuddy.`,instructionsEmail:`Un code à 6 chiffres a été envoyé à votre adresse e-mail. Il est valable 10 minutes.`,instructionsEmailNotSent:`Cliquez ci-dessous pour recevoir un code de vérification par e-mail.`,instructionsBackup:`Saisissez l'un de vos codes de récupération à 8 caractères. Chaque code ne peut être utilisé qu'une seule fois.`,sendCodeButton:`Envoyer le code par e-mail`,sendingCode:`Envoi en cours...`,resendCode:`Renvoyer le code`,codeLabel:`Code de vérification`,backupCodeLabel:`Code de récupération`,codePlaceholder:`000000`,backupCodePlaceholder:`XXXXXXXX`,verifyButton:`Vérifier`,verifyingButton:`Vérification en cours...`,backToLogin:`← Retour à la connexion`,orContinueWith:`ou continuer avec`,signInWith:`Se connecter avec {{provider}}`,enterCode:`Veuillez entrer le code de vérification`,sendCodeFailed:`Échec de l'envoi du code de vérification`,invalidCode:`Code invalide. Veuillez réessayer.`},resetPassword:{title:`Définir un nouveau mot de passe`,subtitle:`Saisissez et confirmez votre nouveau mot de passe ci-dessous.`,newPassword:`Nouveau mot de passe`,newPasswordPlaceholder:`Au moins 8 caractères`,confirmPassword:`Confirmer le mot de passe`,confirmPasswordPlaceholder:`Répéter le nouveau mot de passe`,saving:`Enregistrement…`,submit:`Définir le mot de passe`,backToLogin:`Retour à la connexion`,passwordsDoNotMatch:`Les mots de passe ne correspondent pas`,passwordTooShort:`Le mot de passe doit contenir au moins 8 caractères`,resetFailed:`Échec de la réinitialisation. Le lien a peut-être expiré.`}},setup:{title:`Configuration Bambuddy`,subtitle:`Configurez l'authentification`,enableAuth:`Activer l'authentification`,adminAccount:`Compte Admin`,adminAccountDesc:`Si des admins existent, ils seront utilisés. Sinon, créez-en un ci-dessous.`,adminUsername:`Utilisateur Admin`,adminPassword:`Mot de passe Admin`,optionalIfAdminExists:`(optionnel si admin existe)`,adminUsernamePlaceholder:`Nom admin (optionnel)`,adminPasswordPlaceholder:`Mdp admin (optionnel)`,confirmPassword:`Confirmer mdp`,confirmPasswordPlaceholder:`Confirmez mdp admin`,settingUp:`Configuration...`,completeSetup:`Terminer la configuration`,toast:{authEnabledAdminCreated:`Authentification activée et admin créé`,authEnabledExistingAdmins:`Authentification activée avec admins existants`,setupCompleted:`Configuration terminée`,enterBothCredentials:`Entrez les deux ou laissez vide pour utiliser les admins existants`,passwordsDoNotMatch:`Les mots de passe ne correspondent pas`,passwordTooShort:`Minimum 6 caractères`}},changePassword:{title:`Changer le mot de passe`,currentPassword:`Mot de passe actuel`,currentPasswordPlaceholder:`Entrez mdp actuel`,newPassword:`Nouveau mot de passe`,newPasswordPlaceholder:`Nouveau mdp (min 6 char)`,confirmPassword:`Confirmer nouveau mdp`,confirmPasswordPlaceholder:`Confirmez nouveau mdp`,passwordsDoNotMatch:`Les mots de passe ne correspondent pas`,passwordTooShort:`Minimum 6 caractères`,changing:`Changement...`,success:`Mot de passe modifié`,failed:`Échec modification`},plateAlert:{title:`Impression en Pause !`,message:`Objets détectés sur le plateau. L'impression a été suspendue automatiquement. Videz le plateau avant de reprendre.`,understand:`J'ai compris`},camera:{title:`Vue Caméra`,invalidPrinterId:`ID imprimante invalide`,live:`Direct`,snapshot:`Instantané`,restartStream:`Redémarrer le flux`,refreshSnapshot:`Rafraîchir l'image`,fullscreen:`Plein écran`,exitFullscreen:`Quitter plein écran`,connectingToCamera:`Connexion caméra...`,capturingSnapshot:`Capture...`,connectionLost:`Connexion perdue`,connectionFailed:`Échec connexion caméra`,reconnecting:`Reconnexion dans {{countdown}}s... (essai {{attempt}}/{{max}})`,reconnectNow:`Reconnexion immédiate`,cameraUnavailable:`Caméra indisponible`,cameraUnavailableDesc:`Vérifiez que l'imprimante est allumée.`,noCamera:`Aucune caméra disponible`,retry:`Réessayer`,cameraStream:`Flux caméra`,zoomOut:`Zoom arrière`,zoomIn:`Zoom avant`,resetZoom:`Réinitialiser zoom`,recording:`Enregistrement`,startRecording:`Démarrer l'enregistrement`,stopRecording:`Arrêter l'enregistrement`,chamberLight:`Basculer lumière chambre`,unavailable:`Caméra indisponible`,diagnose:{button:`Diagnostic`,modalTitle:`Diagnostic de la caméra`,running:`Diagnostic en cours...`,runFailed:`Impossible d'exécuter le diagnostic : {{error}}`,retry:`Relancer`,stage:{tcp_reachable:`Accessibilité réseau`,first_frame:`Capture d'image`,live_stream_active:`Flux en direct actif`},summary:{all_ok:`La caméra fonctionne. Toutes les étapes du diagnostic ont réussi.`,live_stream_active_healthy:`La caméra diffuse actuellement avec des images récentes — aucun test nécessaire.`,printer_unreachable:`L'imprimante n'est pas joignable. Vérifiez l'adresse IP, la connexion réseau et que l'imprimante est allumée.`,camera_port_closed:`L'imprimante répond mais le port de la caméra est fermé. Assurez-vous que le mode LAN et le mode développeur sont activés dans les paramètres de l'imprimante.`,no_frame:`Connexion à la caméra établie mais aucune image reçue. Réessayez ou vérifiez que la caméra est activée dans les paramètres de l'imprimante.`,unknown_failure:`Le diagnostic de la caméra a échoué pour une raison inconnue. Consultez le journal de support pour plus de détails.`},meta:{protocol:`Protocole`,port:`Port`,profile:`Profil`}}},groups:{title:`Gestion des Groupes`,subtitle:`Gérez les permissions pour le contrôle d'accès`,backToSettings:`Retour aux paramètres`,createGroup:`Créer un groupe`,noPermission:`Accès refusé.`,system:`Système`,noDescription:`Pas de description`,usersCount:`{{count}} utilisateurs`,permissionsCount:`{{count}} permissions`,edit:`Modifier`,delete:`Supprimer`,toast:{created:`Groupe créé`,updated:`Groupe mis à jour`,deleted:`Groupe supprimé`,enterGroupName:`Entrez un nom de groupe`},modal:{editGroup:`Modifier le groupe`,createGroup:`Créer un groupe`,cancel:`Annuler`,saving:`Enregistrement...`,creating:`Création...`,saveChanges:`Enregistrer`},form:{groupName:`Nom du groupe`,groupNamePlaceholder:`Nom du groupe`,systemGroupWarning:`Les groupes système sont fixes`,description:`Description`,descriptionPlaceholder:`Description (optionnel)`,permissions:`Permissions ({{count}} sélectionnées)`},deleteModal:{title:`Supprimer le groupe`,message:`Les utilisateurs de ce groupe perdront ces permissions.`,confirm:`Supprimer`},editor:{title:`Modifier le groupe`,createTitle:`Créer un groupe`,search:`Rechercher des permissions...`,selectAll:`Tout sélectionner`,clearAll:`Tout désélectionner`,permissionsSelected:`{{count}} sélectionnée(s)`,noResults:`Aucune permission ne correspond à votre recherche`,websocketHint:`Requis pour les mises à jour en direct. Sans cette permission, l'interface bascule sur une actualisation périodique.`,printerAccess:`Accès aux imprimantes`,adminsSeeAllPrinters:`Les administrateurs voient toujours toutes les imprimantes.`,printerAccessAfterCreate:`Une fois le groupe créé, choisissez ses imprimantes dans Paramètres → Authentification → Accès aux imprimantes.`,printerAccessLimited:`Limité : {{printers}} imprimantes choisies, {{locations}} emplacements`,printerAccessOpen:`Non limité : les membres voient toutes les imprimantes.`,managePrinterAccess:`Gérer l'accès aux imprimantes`}},printerAccess:{tab:`Accès aux imprimantes`,intro:`Choisissez les imprimantes que les membres de chaque groupe peuvent voir et contrôler. Un groupe non limité ne restreint rien : un utilisateur qui n'est dans aucun groupe limité voit toutes les imprimantes, tout comme les administrateurs.`,byGroup:`Par groupe`,byPrinter:`Par imprimante`,searchGroups:`Rechercher des groupes`,groupFilter:{all:`Tous`,limited:`Limités`,open:`Non limités`},noGroupsMatch:`Aucun groupe ne correspond.`,alwaysAll:`Toujours toutes les imprimantes`,notLimited:`Toutes les imprimantes`,reachShort:`{{count}} imprimantes sur {{total}}`,unsaved:`Modifications non enregistrées`,pickGroup:`Choisissez un groupe pour sélectionner ses imprimantes.`,memberCount:`Membres : {{count}}`,editGroup:`Modifier le groupe`,adminsSeeAll:`Les administrateurs voient toujours toutes les imprimantes.`,limit:`Limiter les membres aux imprimantes et emplacements choisis ici`,limitHint:`Désactivé : ce groupe ne restreint pas les imprimantes que voient ses membres.`,reach:`Les membres peuvent utiliser {{count}} imprimantes sur {{total}}.`,noneGranted:`Rien de sélectionné : les membres de ce groupe ne verront aucune imprimante.`,noPrinters:`Aucune imprimante n'a encore été ajoutée.`,searchPrinters:`Rechercher par nom, modèle, numéro de série ou emplacement`,allLocations:`Tous les emplacements`,noLocation:`Aucun emplacement`,allModels:`Tous les modèles`,accessFilter:`Accès`,accessAll:`Avec et sans accès`,accessWith:`Avec accès`,accessWithout:`Sans accès`,tickShown:`Cocher tout l'affichage`,untickShown:`Décocher tout l'affichage`,emptyLocation:`aucune imprimante ici pour le moment`,wholeLocation:`Emplacement entier`,wholeLocationHint:`Toutes les imprimantes de {{location}}, y compris celles ajoutées plus tard`,noPrintersMatch:`Aucune imprimante ne correspond.`,viaLocation:`via l'emplacement`,alsoVisible:`En plus des groupes listés ici, chaque imprimante est visible par les administrateurs et par les utilisateurs qui ne sont dans aucun groupe limité.`,openUsers:`Utilisateurs dans aucun groupe limité : {{names}}`,noOpenUsers:`Tous les utilisateurs, hormis les administrateurs, sont dans un groupe limité.`,noLimitedGroups:`Aucun groupe n'est encore limité, donc chaque utilisateur voit toutes les imprimantes. Limitez un groupe dans « Par groupe ».`,noLimitedGroupReaches:`Aucun groupe limité`,showingOne:`Une seule imprimante affichée.`,showAll:`Afficher toutes les imprimantes`,viaLocationTitle:`Via l'emplacement {{location}}. Modifiez-le dans « Par groupe ».`,removeGroup:`Retirer l'accès pour {{group}}`,addGroup:`Donner l'accès à…`,changedGroups:`Modifications non enregistrées : {{names}}`,discard:`Annuler`,saved:`Accès aux imprimantes enregistré`,whoHasAccess:`Qui a accès`,moveWarning:`Déplacer cette imprimante vers un autre emplacement change qui peut l'utiliser : {{groups}}.`},users:{title:`Gestion des Utilisateurs`,subtitle:`Gérez les accès à Bambuddy`,backToSettings:`Retour aux paramètres`,createUser:`Créer un utilisateur`,noPermission:`Accès refusé.`,admin:`Administrateur`,noGroups:`Aucun groupe`,active:`Actif`,inactive:`Inactif`,edit:`Modifier`,delete:`Supprimer`,system:`Système`,noGroupsAvailable:`Aucun groupe disponible`,table:{username:`Utilisateur`,groups:`Groupes`,status:`Statut`,actions:`Actions`},toast:{created:`Utilisateur créé`,updated:`Utilisateur mis à jour`,deleted:`Utilisateur supprimé`,fillRequired:`Remplissez les champs requis`,passwordsDoNotMatch:`Les mots de passe ne correspondent pas`,passwordTooShort:`Minimum 6 caractères`,ldapProvisioned:`Utilisateur LDAP "{{username}}" provisionné`},modal:{createUser:`Créer utilisateur`,editUser:`Modifier utilisateur`,cancel:`Annuler`,creating:`Création...`,saving:`Enregistrement...`,saveChanges:`Enregistrer`,advancedAuthSubtitle:`avec Authentification Avancée`,tabsAriaLabel:`Source utilisateur`,localTab:`Local`,ldapTab:`LDAP`,ldapSearchLabel:`Rechercher dans l'annuaire`,ldapSearchPlaceholder:`Tapez un nom d'utilisateur, un nom ou un e-mail...`,ldapMinChars:`Tapez au moins 2 caractères pour rechercher`,ldapTypeToSearch:`Commencez à taper pour rechercher dans l'annuaire LDAP`,ldapSearching:`Recherche dans l'annuaire...`,ldapNoResults:`Aucun utilisateur correspondant dans l'annuaire`,ldapSearchError:`Échec de la recherche dans l'annuaire. Vérifiez l'état du serveur LDAP.`,ldapAlreadyProvisioned:`Déjà provisionné`,ldapSelectedLabel:`Sélectionné`,ldapProvision:`Provisionner l'utilisateur`,ldapProvisioning:`Provisionnement...`,ldapErrorProvision:`Échec du provisionnement. Vérifiez l'état du serveur LDAP et réessayez.`},form:{username:`Utilisateur`,usernamePlaceholder:`Nom utilisateur`,email:`E-mail`,emailPlaceholder:`utilisateur@exemple.com`,password:`Mot de passe`,passwordPlaceholder:`Mot de passe`,confirmPassword:`Confirmer mdp`,confirmPasswordPlaceholder:`Confirmez mdp`,newPasswordPlaceholder:`Nouveau mdp`,confirmNewPasswordPlaceholder:`Confirmez nouveau mdp`,leaveBlankToKeep:`Laissez vide pour conserver l'actuel`,groups:`Groupes`,optional:`optionnel`,autoGeneratedPassword:`Un mot de passe sera généré et envoyé par email.`,passwordManagedByAdvancedAuth:`Géré par Auth Avancée. Utilisez "Réinitialiser" pour envoyer un nouveau mdp par email.`,resetPassword:`Réinitialiser le mot de passe`,resettingPassword:`Réinitialisation...`},deleteModal:{title:`Supprimer utilisateur`,message:`Cette action est irréversible.`,confirm:`Supprimer`}},streamOverlay:{branding:{title:`Identité visuelle`,hint:`Un logo partagé pour cette installation. PNG ou WebP, jusqu’à 2 Mio et 4 millions de pixels. Son remplacement ou sa suppression affecte les incrustations qui l’utilisent.`,upload:`Importer un logo`,logo:`Logo personnalisé`,from:`Couleur de départ`,to:`Couleur de fin`,reset:`Réinitialiser les couleurs`,failed:`Impossible d’enregistrer le logo. Vérifiez le format et la taille.`},title:`Superposition Flux`,invalidPrinterId:`ID invalide`,cameraStream:`Flux caméra`,progress:`Progression`,eta:`Fin estimée`,printerIdle:`Imprimante inactive`,printerOffline:`Imprimante hors ligne`,layer:`Couche`,remaining:`Temps restant`,builder:{backgroundTransparency:`Transparence du fond`,backgroundTransparencyHint:`Estompe uniquement les fonds sombres. Le texte, les logos et la caméra restent visibles.`,layout:`Disposition`,landscape:`Paysage`,portrait:`Format portrait`,both:`Les deux`,orientationUrl:`URL {{orientation}}`,orientationPreview:`Aperçu {{orientation}}`,sourceDimensions:`Source navigateur : {{width}} × {{height}} px`,artwork:`Habillage`,artworkClassic:`Classique`,artworkV2:`Version 2`,createToken:`Créer un jeton de superposition`,showToken:`Afficher le jeton`,hideToken:`Masquer le jeton`,credentialHint:`Créez un jeton ci-dessus, saisissez un jeton existant ou importez une URL de superposition. Copiez l’URL avant de quitter : les jetons restent uniquement en mémoire et ne peuvent pas être récupérés depuis leur empreinte enregistrée.`,importUrl:`URL de superposition existante`,importAction:`Importer l’URL`,importHint:`Importez une URL localement pour réutiliser son jeton et ses réglages sur ce serveur. Les réglages que Bambuddy ne reconnaît pas sont ignorés.`,rememberedHint:`Vos choix sont mémorisés dans ce navigateur. Le jeton ne l'est pas.`,resetChoices:`Réinitialiser les choix`,importError:`Saisissez une URL de superposition HTTP(S) valide avec un numéro d’imprimante positif, au plus un jeton et sans nom d’utilisateur ni mot de passe.`,manualToken:`Jeton manuel`,title:`Incrustation de diffusion`,description:`Compose l'URL d'une incrustation de diffusion — une vue caméra plein écran avec les données d'impression en direct par-dessus, pour OBS, un écran mural ou toute source navigateur. Choisissez les champs voulus et copiez l'URL.`,printer:`Imprimante`,size:`Taille du texte`,sizeSmall:`Petite`,sizeMedium:`Moyenne`,sizeLarge:`Grande`,fps:`Fréquence d'images`,fpsHint:`Les caméras A1 et P1 plafonnent autour de 5 images par seconde, quelle que soit la valeur demandée.`,tokenWarning:`Cette URL contient un jeton — quiconque peut la lire peut voir le flux et le nom du fichier. Révoquez le jeton pour couper l'accès.`,fields:`Champs à afficher`,fieldPrinter:`Nom de l'imprimante`,fieldModel:`Modèle d'imprimante`,fieldFilename:`Nom du fichier`,fieldStatus:`Statut`,fieldProgress:`Barre de progression`,fieldLayers:`Nombre de couches`,fieldEta:`Temps restant et heure de fin`,fieldCamera:`Flux caméra`,chamberHint:`La température du caisson n'apparaît que sur les modèles dotés d'un vrai capteur — les P1 et A1 renvoient une valeur sans signification, elle est donc omise.`,urlTitle:`URL de l'incrustation`,open:`Ouvrir`,showPreview:`Afficher l'aperçu`,hidePreview:`Masquer l'aperçu`,previewTitle:`Aperçu de l'incrustation`},status:{printing:`Impression`,paused:`En pause`,finished:`Terminée`,failed:`Échouée`,idle:`Inactive`,unknown:`Inconnue`}},profiles:{title:`Profils`,subtitle:`Gérez vos presets slicer et calibrations Pressure Advance`,tabs:{bambuCloud:`Bambu Cloud`,orcaCloud:`Orca Cloud`,local:`Profils Locaux`,kprofiles:`Profils K`},orcaCloud:{connectedAs:`Connecté en tant que`,connectedShort:`Connecté à Orca Cloud`,logout:`Déconnecter`,noLogoutPermission:`Vous n'avez pas la permission de vous déconnecter`,noConnectPermission:`Vous n'avez pas la permission de vous connecter à Orca Cloud`,retry:`Réessayer`,connectButton:`Connecter Orca Cloud`,connect:{title:`Se connecter à Orca Cloud`,description:`Connectez-vous à votre compte Orca Cloud pour synchroniser vos profils de slicer dans Bambuddy.`},device:{title:`Approuver Bambuddy dans Orca Cloud`,instruction:`Ouvrez Orca Cloud et approuvez ce code. Bambuddy se connecte automatiquement dès que vous l'approuvez.`,codeLabel:`Votre code d'appairage`,openButton:`Ouvrir la page d'approbation d'Orca Cloud`,manualHint:`Ou rendez-vous sur {{url}} et saisissez le code ci-dessus.`,waiting:`En attente de votre approbation…`,cancel:`Annuler`},profiles:{title:`Vos profils Orca Cloud ({{count}})`,refresh:`Actualiser`,empty:`Aucun profil trouvé dans votre compte Orca Cloud pour le moment.`},toast:{disconnected:`Déconnecté d'Orca Cloud`},errors:{startFailed:`Impossible de démarrer la connexion à Orca Cloud.`,denied:`L'appairage a été refusé dans Orca Cloud.`,expired:`Le code d'appairage a expiré. Cliquez sur Connecter pour réessayer.`,pollFailed:`La connexion a été perdue pendant l'attente de l'approbation. Veuillez réessayer.`}},localProfiles:{title:`Profils Locaux`,subtitle:`Gérez vos presets OrcaSlicer`,import:`Importer Profils`,importDesc:`Déposez les fichiers .bbscfg, .bbsflmt, .orca_filament, .zip ou .json`,importing:`Importation...`,search:`Chercher un preset...`,noPresets:`Aucun preset local`,noSearchResults:`Aucun preset ne correspond à votre recherche`,badge:`Local`,edit:`Modifier`,delete:`Supprimer`,cancel:`Annuler`,deleteConfirmTitle:`Supprimer Preset`,deleteConfirm:`Supprimer définitivement ce preset ?`,source:`Source`,inheritsFrom:`Hérite de`,filamentType:`Type`,vendor:`Vendeur`,compatiblePrinters:`Imprimantes`,nozzleTemp:`Temp Buse`,cost:`Coût`,density:`Densité`,pressureAdvance:`Pressure Advance`,filament:`Filament`,process:`Processus`,printer:`Imprimante`,toast:{importSuccess:`{{count}} profil(s) importé(s)`,importSkipped:`{{count}} profil(s) ignoré(s) (doublons)`,importError:`{{count}} erreur(s) d'import`,deleted:`Preset supprimé`,updated:`Preset mis à jour`}},connectedAs:`Connecté en tant que`,signInExpiredTitle:`Session Bambu Cloud expirée`,signInExpiredBody:`Bambu Lab n'accepte plus le jeton enregistré. Reconnectez-vous pour rétablir les profils cloud, les imports MakerWorld et la vérification des firmwares.`,logout:`Déconnexion`,noLogoutPermission:`Pas d'autorisation de déconnexion`,failedToLoad:`Échec chargement profils`,retry:`Réessayer`,time:{justNow:`À l'instant`,minsAgo:`Il y a {{count}}m`,hoursAgo:`Il y a {{count}}h`,daysAgo:`Il y a {{count}}j`},toast:{loggedOut:`Déconnecté`},login:{title:`Connexion Bambu Cloud`,subtitle:`Synchronisez vos presets slicer`,email:`E-mail`,password:`Mot de passe`,region:`Région`,regionGlobal:`Global`,regionChina:`Chine`,verificationCode:`Code de vérification`,totpCode:`Code Authenticator`,checkEmail:`Code envoyé à {{email}}`,enterTotpHint:`Entrez le code 2FA`,accessToken:`Jeton d'accès (Access Token)`,accessTokenHint:`Collez votre jeton Bambu Cloud. Les comptes de la région Chine doivent passer par ici (liés à un numéro de téléphone — pas de connexion par e-mail). Le wiki explique comment récupérer le jeton depuis les cookies MakerWorld.`,back:`Retour`,loginButton:`Connexion`,verifyButton:`Vérifier`,setTokenButton:`Définir Jeton`,useToken:`Utiliser jeton d'accès`,captchaTitle:`Bambu Cloud demande un CAPTCHA`,captchaBody:`Bambu impose un CAPTCHA à votre réseau avant d'accepter une connexion, et ce défi ne peut pas être résolu depuis Bambuddy. Votre e-mail et votre mot de passe ne sont pas en cause. Le blocage est lié à votre adresse IP publique et disparaît généralement de lui-même en quelques heures ; réessayer sans cesse le prolonge. Pour vous connecter maintenant, utilisez plutôt un jeton d'accès issu d'une session de navigateur.`,useEmail:`Connexion par email`,toast:{loggedIn:`Connecté avec succès`,codeSent:`Code envoyé par email`,enterTotp:`Entrez le code Authenticator`,tokenSet:`Jeton défini`}},presets:{myPreset:`Mon preset (modifiable)`,duplicate:`Dupliquer`,editable:`Modifiable`,failedToLoadDetails:`Échec détails preset`,deleteConfirm:`Supprimer ce preset ?`,deleteWarning:`Ceci supprimera "{{name}}" de Bambu Cloud définitivement.`,noDuplicatePermission:`Pas d'autorisation duplication`,noEditPermission:`Pas d'autorisation modification`,noDeletePermission:`Pas d'autorisation suppression`,types:{filament:`Preset filament`,printer:`Preset imprimante`,process:`Preset processus`},toast:{deleted:`Preset supprimé`,created:`Preset créé`,updated:`Preset mis à jour`,duplicated:`Preset dupliqué`,fieldAdded:`Champ "{{key}}" ajouté`,exported:`Preset exporté`},baseLabel:`Base : {{name}}`,currentLabel:`Actuel : {{name}}`,newPreset:`Nouveau Preset`,editPreset:`Modifier Preset`,duplicatePreset:`Dupliquer Preset`,createNewPreset:`Créer un nouveau Preset`,customizeSettings:`Personnalisez vos réglages`,compareWithBase:`Comparer avec la base`,compare:`Comparer`,basePreset:`Preset de base`,selectBasePreset:`Choisir preset de base...`,presetName:`Nom du preset`,myCustomPreset:`Mon preset personnalisé`,inheritsFrom:`Hérite de`,dropJsonToImport:`Glissez JSON pour importer`,tabs:{common:`Commun`,allFields:`Tous les champs`},availableFields:`Champs disponibles`,searchFieldsPlaceholder:`Chercher un champ...`,noMatchingFields:`Aucun champ trouvé`,allFieldsAdded:`Tous les champs sont ajoutés`,addCustomField:`Ajouter un champ personnalisé`,yourOverrides:`Vos modifications`,noOverridesYet:`Aucune modification`,clickFieldsToAdd:`Cliquez à gauche pour ajouter`,saveAsTemplate:`Enregistrer comme modèle`,jsonTip:`Conseil : Glissez un .json pour importer les réglages`},cloudView:{searchPlaceholder:`Chercher presets...`,templates:`Modèles`,refresh:`Rafraîchir`,newPreset:`Nouveau Preset`,clearFilters:`Effacer filtres`,compareMode:`Mode Comparaison`,selectAnotherPreset:`Choisir un autre preset {{type}}`,clickTwoPresets:`Choisissez deux presets de même type`,selectFirst:`1. Sélectionner premier`,selectSecond:`2. Sélectionner second`,compareNow:`Comparer maintenant`,lastSynced:`Synchronisé :`,showingCount:`{{showing}} sur {{total}} presets`,noPresetsFound:`Aucun preset trouvé`,columns:{filament:`Filament`,process:`Processus`,printer:`Imprimante`},noFilamentPresets:`Pas de preset filament`,noProcessPresets:`Pas de preset processus`,noPrinterPresets:`Pas de preset imprimante`,filters:{type:`Type`,owner:`Propriétaire`,printer:`Imprimante`,nozzle:`Buse`,filament:`Filament`,layer:`Couche`,all:`Tous`,myPresets:`Mes Presets`,builtIn:`Inclus`,process:`Processus`},noTemplatesPermission:`Pas d'autorisation modèles`,noRefreshPermission:`Pas d'autorisation rafraîchissement`,noCreatePermission:`Pas d'autorisation création`},templates:{title:`Modèles rapides`,noTemplates:`Aucun modèle`,createFirst:`Créez-en depuis l'éditeur de preset`,typeFilter:`Type :`,deleteTitle:`Supprimer modèle`,deleteWarning:`Action irréversible`,deleteConfirm:`Supprimer "{{name}}" ?`,namePlaceholder:`Nom du modèle`,descriptionPlaceholder:`Description`,settingsJson:`Paramètres (JSON)`,fieldsCount:`{{count}} champs`,shownInModals:`Visible dans fenêtres`,hiddenInModals:`Masqué dans fenêtres`,apply:`Appliquer`,toast:{deleted:`Modèle supprimé`,updated:`Modèle mis à jour`,created:`Modèle créé`,applied:`Modèle appliqué`}}},support:{debugLoggingActive:`Débogage actif`,manageLogs:`Gérer`,collectItem7:`Connectivité et versions firmware`,collectItem8:`Statut intégrations (Spoolman, MQTT, HA)`,collectItem9:`Interfaces réseau (sous-réseaux)`,collectItem10:`Versions packages Python`,collectItem11:`Santé base de données`,collectItem12:`Détails environnement Docker`,bundleGenerating:`Génération du paquet...`,bundleStepConnection:`Vérification de la connectivité des imprimantes`,bundleStepVirtualPrinters:`Vérification de la configuration des imprimantes virtuelles`,bundleStepLogScan:`Analyse des journaux récents pour les problèmes connus`,bundleStepBuild:`Création du ZIP du paquet de support`},fileManager:{combine:{action:`Combiner en 3MF`,tooltip:`Combiner les STL sélectionnés en un seul 3MF pour les trancher sur un seul plateau`,title:`Combiner en 3MF`,description:`Crée un 3MF contenant tous les modèles ci-dessous, prêt à être tranché sur un seul plateau. Activez l'agencement automatique lors du tranchage pour les répartir sur le plateau.`,nameLabel:`Nom du fichier`,defaultName:`{{name}} + {{count}} autres`,model:`Modèle`,copies:`Copies`,copiesFor:`Copies de {{filename}}`,total:`Objets sur le plateau : {{count}}`,tooMany:`{{max}} objets maximum par plateau`,sliceNext:`Ouvrir le trancheur ensuite`,submit:`Combiner`,done:`{{filename}} créé avec {{count}} objets`},variants:{badge:`Versions : {{count}}`,groupAction:`Grouper comme versions`,groupTooltip:`Marquer ces fichiers comme le même travail tranché pour différentes imprimantes`,grouped:`{{count}} fichiers groupés comme versions`,printAlternatives:`Imprimer ({{count}} alternatives)`},title:`Gestionnaire de fichiers`,subtitle:`Organisez vos fichiers d'impression`,uploadFiles:`Téléverser fichiers`,newFolder:`Nouveau dossier`,folderName:`Nom du dossier`,folderNamePlaceholder:`ex: Pièces Utiles`,renameFile:`Renommer fichier`,renameFolder:`Renommer dossier`,invalidFilenameChar:`Le caractère "{{char}}" n'est pas autorisé dans les noms de fichier d'impression. La carte SD de l'imprimante refuse : < > : " / \\ | ? *`,moveFiles:`Déplacer {{count}} fichier(s)`,rootNoFolder:`Racine (aucun dossier)`,current:`actuel`,linkFolder:`Lier le dossier`,linkFolderDescription:`Lier "{{name}}" à un projet ou archive.`,project:`Projet`,archive:`Archive`,noProjectsFound:`Aucun projet trouvé`,noArchivesFound:`Aucune archive trouvée`,unlink:`Délier`,link:`Lier`,dragDropFiles:`Glissez les fichiers ici`,dropFilesHere:`Déposez ici`,releaseToUpload:`Relâcher pour téléverser`,orClickToBrowse:`ou cliquez pour parcourir`,allFileTypesSupported:`Tous types supportés. ZIP extraits.`,zipFilesDetected:`ZIP détectés`,zipExtractOptions:`Choix de structure pour ZIP :`,preserveZipStructure:`Garder structure ZIP`,createFolderFromZip:`Dossier par nom du ZIP`,stlThumbnailGeneration:`Vignettes STL`,zipMayContainStl:`Extraction vignettes possible pour STL.`,thumbnailsCanBeGenerated:`Génération vignettes (peut être long).`,generateThumbnailsForStl:`Générer vignettes STL`,threemfDetected:`Fichiers 3MF détectés`,threemfExtractionInfo:`Réglages extraits auto du 3MF.`,willBeExtracted:`Sera extrait`,filesExtracted:`{{count}} fichiers extraits`,uploadComplete:`Terminé : {{succeeded}} succès`,uploadFailed:`Échec du téléversement`,zipFilesFailed:`{{count}} fichiers échoués`,uploading:`Téléversement...`,changeLink:`Modifier lien...`,linkTo:`Lier à...`,linkToProjectOrArchive:`Lier à projet ou archive`,generateThumbnail:`Générer vignette`,generateThumbnails:`Générer vignettes`,generateThumbnailsForMissing:`Vignettes STL et PDF manquantes`,gridView:`Grille`,listView:`Liste`,columnsView:`Colonnes`,lowDiskSpaceWarning:`Espace disque faible`,lowDiskSpaceDetails:`{{free}} libre sur {{total}}. Seuil : {{threshold}} Go.`,files:`Fichiers`,folders:`Dossiers`,size:`Taille`,free:`Libre`,allFiles:`Tous les fichiers`,allExternal:`Externes`,externalIsEmpty:`Aucun fichier externe`,externalEmptyDescription:`Les fichiers de vos dossiers externes liés apparaîtront ici.`,wrap:`Retour ligne`,enableTextWrapping:`Activer retour ligne`,disableTextWrapping:`Désactiver retour ligne`,collapse:`Réduire`,collapseFoldersByDefault:`Réduire les dossiers par défaut`,expandFoldersByDefault:`Développer les dossiers par défaut`,folderSort:`Trier les dossiers`,folderSortByName:`Par nom`,folderSortByActivity:`Par activité récente`,dragToResizeTooltip:`Glisser pour redimensionner, double-clic reset`,searchFiles:`Chercher fichiers...`,searchSubfoldersHint:`Sous-dossiers inclus`,readme:{truncated:`Tronqué`,show:`Afficher le README`,hide:`Masquer le README`,label:`README`},tags:{title:`Étiquettes`,subtitle:`Étiquetez les fichiers pour des filtres transversaux — jouets, adapté aux enfants, PETG uniquement, etc.`,manage:`Étiquettes`,manageTitle:`Gérer le catalogue d'étiquettes`,add:`Nouvelle étiquette`,edit:`Renommer l'étiquette`,name:`Nom`,fileCount:`Fichiers`,empty:`Aucune étiquette pour le moment. Créez-en une pour commencer.`,noMatches:`Aucune étiquette correspondante.`,createPlaceholder:`ex. jouets, kid-safe, petg`,createButton:`Créer`,nameRequired:`Le nom est requis.`,searchPlaceholder:`Filtrer les étiquettes...`,created:`Étiquette créée.`,updated:`Étiquette renommée.`,deleted:`Étiquette supprimée.`,saveFailed:`Impossible d'enregistrer l'étiquette.`,deleteFailed:`Impossible de supprimer l'étiquette.`,applyFailed:`Impossible d'appliquer les étiquettes.`,applyAdd:`Ajouter des étiquettes`,applyRemove:`Retirer des étiquettes`,applyAddSuccess:`{{count}} étiquette(s) ajoutée(s) sur {{files}} fichier(s).`,applyRemoveSuccess:`{{count}} étiquette(s) retirée(s) sur {{files}} fichier(s).`,actionAdd:`Ajouter aux fichiers sélectionnés`,actionRemove:`Retirer des fichiers sélectionnés`,tagAction:`Étiqueter`,bulkTitle:`Étiqueter {{count}} fichier(s) sélectionné(s)`,bulkTooltip:`Ajouter ou retirer des étiquettes sur chaque fichier sélectionné.`,noPermission:`Vous n'avez pas la permission d'étiqueter les fichiers.`,filterLabel:`Filtré par :`,clearAll:`Tout effacer`,confirmDelete:`Supprimer l'étiquette « {{name}} » ?`,confirmDeleteMessage:`Cela supprime l'étiquette du catalogue. Les fichiers conservent leurs autres étiquettes.`,confirmDeleteInUseMessage:`Cette étiquette est sur {{count}} fichier(s). La suppression la retire de tous ; les fichiers eux-mêmes ne sont pas touchés.`,editAria:`Modifier {{name}}`,deleteAria:`Supprimer {{name}}`},allTypes:`Tous types`,prints:`Impressions`,ascending:`Croissant`,descending:`Décroissant`,showModified:`Afficher les dates de modification`,hideModified:`Masquer les dates de modification`,lastModified:`Dernière modification`,lastActivity:`Dernière activité`,resultsCount:`{{showing}} sur {{total}} fichiers`,selectAll:`Tout sélectionner`,deselectAll:`Tout désélectionner`,selected:`{{count}} sélectionnés`,adding:`Ajout...`,loadingFiles:`Chargement...`,folderIsEmpty:`Dossier vide`,noFilesOutsideFolders:`Aucun fichier hors des dossiers`,noFilesYet:`Aucun fichier`,folderEmptyDescription:`Téléversez ou déplacez des fichiers ici.`,noFilesDescription:`Téléversez des fichiers pour organiser.`,noMatchingFiles:`Aucun fichier correspondant`,noMatchingFilesDescription:`Ajustez votre recherche.`,clearFilters:`Effacer filtres`,printedCount:`Imprimé {{count}}x`,uploadedBy:`Téléversé par`,deleteFolder:`Supprimer dossier`,deleteFile:`Supprimer fichier`,deleteFilesCount:`Supprimer {{count}} fichiers`,deleteFolderConfirm:`Supprimer le dossier et son contenu ?`,deleteFileConfirm:`Supprimer ce fichier ?`,deleteFilesConfirm:`Supprimer {{count}} fichiers définitivement ?`,deleting:`Suppression...`,noPermissionRenameFolder:`Pas d'autorisation renommage`,noPermissionLinkFolder:`Pas d'autorisation lien`,noPermissionDeleteFolder:`Pas d'autorisation suppression dossier`,onlyOwnFoldersDeletable:`Vous ne pouvez supprimer que vos propres dossiers dont tout le contenu vous appartient, ou des dossiers vides sans propriétaire`,shareFolder:`Partager avec tout le monde`,unshareFolder:`Ne plus partager`,shareFolderHint:`Les dossiers partagés sont visibles par tous les utilisateurs, qui peuvent y ajouter des fichiers et des sous-dossiers`,sharedFolder:`Partagé avec tout le monde`,folderNotWritable:`Vous ne pouvez ajouter qu'à vos propres dossiers et aux dossiers partagés avec tout le monde`,noPermissionPrint:`Pas d'autorisation impression`,noPermissionSlice:`Vous n'avez pas la permission de découper des fichiers`,noPermissionAddToQueue:`Pas d'autorisation file`,noPermissionDownload:`Pas d'autorisation téléchargement`,noPermissionPreview:`Vous n'avez pas la permission de prévisualiser les fichiers`,preview3d:`Aperçu 3D`,preview:{open:`Aperçu`,error:`Ce fichier ne peut pas être prévisualisé.`,tooLarge:`Le fichier est trop volumineux pour être prévisualisé ({{size}}).`,page:`Page {{current}} sur {{total}}`,prevPage:`Page précédente`,nextPage:`Page suivante`,zoomIn:`Zoom avant`,zoomOut:`Zoom arrière`,resetZoom:`Réinitialiser le zoom`,fullscreen:`Plein écran`,exitFullscreen:`Quitter plein écran`,emptySheet:`Cette feuille est vide`,truncatedRows:`Affichage des {{shown}} premières lignes sur {{total}}`,truncatedCols:`Affichage des {{shown}} premières colonnes sur {{total}}`},details:{title:`Détails du fichier`,size:`Taille`,type:`Type`,printName:`Nom d'impression`,printTime:`Temps d'impression`,filament:`Filament`,slicedFor:`Tranché pour`,source:`Source`,created:`Créé`,modified:`Modifié`,notes:`Notes`,notesPlaceholder:`Réglages d'impression, astuces, ce qui a fonctionné...`,externalLink:`Lien externe`,externalLinkPlaceholder:`https://printables.com/model/...`,openLink:`Ouvrir le lien`,photos:`Photos`,addPhoto:`Ajouter une photo`,noPhotos:`Pas encore de photos`,deletePhoto:`Supprimer la photo`,photoCount_one:`{{count}} photo`,photoCount_other:`{{count}} photos`,hasNotes:`Contient des notes`,save:`Enregistrer`,saved:`Détails du fichier enregistrés`,saveFailed:`Échec de l'enregistrement des détails du fichier`,uploadFailed:`Échec de l'envoi de la photo`,deleteFailed:`Échec de la suppression de la photo`},noPermissionRenameFile:`Pas d'autorisation renommage fichier`,noPermissionGenerateThumbnail:`Pas d'autorisation vignettes`,noPermissionDeleteFile:`Pas d'autorisation suppression fichier`,noPermissionCreateFolder:`Pas d'autorisation nouveau dossier`,noPermissionUpload:`Pas d'autorisation téléversement`,noPermissionMoveFiles:`Pas d'autorisation déplacement`,noPermissionDeleteFiles:`Pas d'autorisation suppression groupée`,linkExternal:`Lier externe`,linkExternalFolder:`Lier un dossier externe`,linkExternalFolderDescription:`Monter un répertoire hôte (NAS, USB, partage réseau) dans le gestionnaire de fichiers. Les fichiers ne sont pas copiés — ils sont lus directement depuis le chemin d'origine.`,externalFolderNamePlaceholder:`ex. Impressions NAS`,externalPath:`Chemin hôte`,externalPathHelp:`Chemin absolu du répertoire sur l'hôte Docker. Doit être monté en bind dans le conteneur.`,readOnly:`Lecture seule`,readOnlyHelp:`empêche les téléversements et suppressions`,showHiddenFiles:`Afficher les fichiers cachés (fichiers point)`,externalFolder:`Dossier externe`,scanFolder:`Scanner`,toast:{folderCreated:`Dossier créé`,openInSlicerFailed:`Impossible d'ouvrir dans le slicer`,folderDeleted:`Dossier supprimé`,fileDeleted:`Fichier supprimé`,filesDeleted:`{{count}} fichiers supprimés`,filesMoved:`Fichiers déplacés`,folderLinked:`Dossier lié`,folderUnlinked:`Dossier délié`,externalFolderLinked:`Dossier externe lié et scanné`,folderScanned:`Scan terminé : {{added}} ajoutés, {{removed}} supprimés`,addedToQueue:`{{count}} fichier(s) ajouté(s)`,addedToQueuePartial:`{{added}} ajoutés, {{failed}} échecs`,failedToAddToQueue:`Échec ajout file : {{error}}`,fileRenamed:`Fichier renommé`,folderRenamed:`Dossier renommé`,folderShared:`Dossier partagé avec tout le monde`,folderUnshared:`Le dossier n'est plus partagé`,thumbnailsGenerated:`{{count}} vignette(s) générée(s)`,thumbnailsGeneratedPartial:`{{succeeded}} succès, {{failed}} échecs`,noStlMissingThumbnails:`Aucun STL ni PDF sans vignette`,failedToGenerateThumbnails:`Échec vignettes : {{error}}`,thumbnailGenerated:`Vignette générée`,failedToGenerateThumbnail:`Échec vignette : {{error}}`}},projects:{parentLabel:`Projet parent`,parentNone:`Aucun (projet de premier niveau)`,parentHint:`Imbriquer ce projet dans un autre pour que ses chiffres remontent vers un projet principal`,partOf:`Fait partie de {{name}}`,subProjectCount:`{{count}} sous-projets`,subProjectsOf:`Sous-projets de {{name}}`,collapseSubProjects:`Réduire les sous-projets`,expandSubProjects:`Développer les sous-projets`,title:`Projets`,subtitle:`Suivez vos projets d'impression 3D`,newProject:`Nouveau Projet`,editProject:`Modifier Projet`,deleteProject:`Supprimer Projet`,projectName:`Nom du Projet`,description:`Description`,noProjects:`Aucun projet`,noProjectsFiltered:`Aucun projet {{status}}`,noProjectsFilteredHelp:`Vous n'avez aucun projet "{{status}}". Les projets apparaîtront ici lorsque leur statut changera.`,createFirst:`Créez votre premier projet pour organiser vos builds.`,createFirstButton:`Créer votre premier projet`,create:`Créer`,files:`Fichiers`,prints:`Impressions`,plates:`plateaux`,parts:`pièces`,lastModified:`Modifié le`,deleteConfirm:`Supprimer ce projet ? Les archives seront déliées mais conservées.`,addFiles:`Ajouter fichiers`,removeFile:`Retirer fichier`,viewDetails:`Détails`,namePlaceholder:`ex: Build Voron 2.4`,descriptionPlaceholder:`Description optionnelle...`,urlLabel:`URL`,urlPlaceholder:`https://makerworld.com/...`,urlInvalid:`L'URL doit commencer par http:// ou https://`,openExternalUrl:`Ouvrir l’URL du projet`,coverImageLabel:`Photo de couverture`,coverImageAlt:`Photo de couverture du projet`,coverImageUpload:`Téléverser`,coverImageReplace:`Remplacer`,coverImageRemove:`Supprimer`,color:`Couleur`,targetPlates:`Plateaux cibles`,targetPlatesPlaceholder:`ex: 25`,targetPlatesHelp:`Nombre total de jobs`,targetParts:`Pièces cibles`,targetPartsPlaceholder:`ex: 150`,targetPartsHelp:`Nombre total d'objets`,targetSets:`Copies par fichier`,targetSetsPlaceholder:`ex. 10`,targetSetsHelp:`Nombre d'impressions de chaque fichier imprimable`,tagsLabel:`Tags (séparés par virgules)`,tagsPlaceholder:`ex: voron, cadeau`,dueDate:`Échéance`,priority:`Priorité`,priorityLow:`Basse`,priorityNormal:`Normale`,priorityHigh:`Haute`,priorityUrgent:`Urgente`,statusActive:`Actif`,statusCompleted:`Terminé`,statusArchived:`Archivé`,done:`Fait`,completed:`terminé`,failed:`échoué`,inQueue:`en file`,noPrintsYet:`Aucune impression`,printJobs:`Jobs (plateaux)`,partsPrinted:`Pièces imprimées`,failedParts:`Pièces échouées`,import:`Importer`,export:`Exporter`,importProject:`Importer projet`,exportAll:`Exporter tous les projets`,loading:`Chargement des projets...`,noEditPermission:`Pas d'autorisation de modification`,noDeletePermission:`Pas d'autorisation de suppression`,noCreatePermission:`Pas d'autorisation de création`,noImportPermission:`Pas d'autorisation d'import`,noExportPermission:`Pas d'autorisation d'export`,toast:{created:`Projet créé`,updated:`Projet mis à jour`,deleted:`Projet supprimé`,imported:`Projet importé`,multipleImported:`{{count}} projets importés`,importFailed:`Échec d'import`,exported:`Projets exportés (métadonnées)`}},projectDetail:{notFound:`Projet non trouvé`,backToProjects:`Retour aux Projets`,export:`Exporter`,exportProject:`Exporter projet`,noExportPermission:`Pas d'autorisation export`,noEditPermission:`Pas d'autorisation modification`,partOf:`Fait partie de :`,priorityLabel:`Priorité :`,noPrints:`Aucune impression dans ce projet`,status:{active:`Actif`,completed:`Terminé`,archived:`Archivé`},priority:{low:`Basse`,normal:`Normale`,high:`Haute`,urgent:`Urgente`},dueDate:{overdue:`En retard`,today:`Aujourd'hui`,daysLeft:`{{count}} jours restants`},progress:{platesProgress:`Progression Plateaux`,partsProgress:`Progression Pièces`,setsProgress:`Jeux complets`,sets:`jeux`,setsHint:`Un jeu est complet quand chaque fichier imprimable atteint ce nombre`,printJobs:`jobs d'impression`,parts:`pièces`,percentComplete:`{{percent}}% terminé`,remaining:`{{count}} restant(s)`},stats:{printJobs:`Jobs d'Impression`,total:`total`,failed:`{{count}} échecs`,partsPrinted:`{{count}} pièces imprimées`,printTime:`Temps d'Impression`,filamentUsed:`Filament utilisé`},cost:{title:`Suivi des coûts`,filamentCost:`Coût Filament`,energy:`Énergie`,totalCost:`Coût Total`,total:`Total`,includesBom:`BOM incluse`,wear:`Usure de l'imprimante`,budget:`Budget`,remaining:`Restant`},subProjects:{title:`Sous-projets ({{count}})`,jobs:`{{count}} travaux`},rollup:{title:`Y compris {{count}} sous-projets`,progress:`Progression globale`,percentComplete:`{{percent}}% terminé`},notes:{title:`Notes`,noEditPermission:`Pas d'autorisation modification`,placeholder:`Ajouter des notes...`,empty:`Aucune note. Cliquez sur modifier.`},files:{title:`Fichiers`,linkFolders:`Liez des dossiers depuis le gestionnaire`,forQuickAccess:`pour un accès rapide.`,fileCount:`{{count}} fichier(s)`,empty:`Aucun dossier lié.`,printedCount:`Imprimé {{count}} fois`,progressTooltip:`{{done}} sur {{target}} impressions terminées`,noFiles:`Aucun fichier dans ce dossier.`},bom:{title:`BOM (Liste matériel)`,acquired:`{{completed}}/{{total}} acquis`,showAll:`Tout afficher`,hideDone:`Masquer acquis`,addPart:`Ajouter matériel`,noAddPermission:`Pas d'autorisation ajout`,partNamePlaceholder:`Nom (ex: Vis M3x8)`,partName:`Nom de pièce`,qty:`Qté`,price:`Prix ({{currency}})`,sourcingUrlPlaceholder:`Lien d'achat (optionnel)`,remarksPlaceholder:`Remarques (optionnel)`,deletePart:`Supprimer pièce`,deleteConfirm:`Supprimer "{{name}}" ?`,noUpdatePermission:`Pas d'autorisation mise à jour`,noEditPermission:`Pas d'autorisation modification`,noDeletePermission:`Pas d'autorisation suppression`,totalCost:`Coût total :`,empty:`BOM vide. Ajoutez du matériel ou de l'électronique.`},timeline:{title:`Historique d'activité`,empty:`Aucune activité.`},template:{saveAsTemplate:`Enregistrer comme modèle`,noCreatePermission:`Pas d'autorisation modèle`},queue:{title:`File d'attente`,viewAll:`Tout voir`,printing:`{{count}} en cours`,queued:`{{count}} en file`},prints:{title:`Impressions ({{count}})`},toast:{projectUpdated:`Projet mis à jour`,partAdded:`Pièce ajoutée`,partRemoved:`Pièce retirée`,exportFailed:`Échec export`,projectExported:`Projet exporté`,templateCreated:`Modèle créé`}},system:{title:`Informations Système`,version:`Version`,uptime:`Temps de fonctionnement`,cpuUsage:`Utilisation CPU`,memoryUsage:`Utilisation RAM`,diskUsage:`Utilisation Disque`,networkInfo:`Infos Réseau`,logs:`Journaux`,debugMode:`Mode Débogage`,enableDebug:`Activer débogage`,disableDebug:`Désactiver débogage`,downloadLogs:`Télécharger logs`,clearLogs:`Effacer logs`,dockerInfo:`Infos Docker`,containerName:`Nom conteneur`,imageName:`Nom image`,platform:`Plateforme`,architecture:`Architecture`},sponsors:{sectionTitle:`Indépendant & financé par la communauté`,tagline:`Bambuddy est gratuit et le reste parce que des personnes choisissent de le soutenir. Pas de VC, pas de verrouillage cloud.`,viewSupporters:`Voir les soutiens`,toastPrints:`Tu as terminé {{count}} impressions avec Bambuddy. Bambuddy reste gratuit grâce à ceux qui le soutiennent.`,toastCost:`Tu as suivi {{total}} de filament avec Bambuddy. Vois qui garde le projet indépendant.`,toastArchives:`{{count}} impressions archivées avec Bambuddy. Vois qui le garde indépendant.`,toastAnniversary:`Un an avec Bambuddy ! Vois qui garde le projet indépendant.`,toastVersionUpdate:`Mis à jour vers v{{version}}. Bambuddy reste gratuit grâce à ceux qui le soutiennent.`,toastBusiness:`Vous utilisez Bambuddy sur {{count}} imprimantes ? Il existe une offre de support pour les équipes : corrections prioritaires, facturation et contact direct avec le mainteneur.`,businessCta:`Bambuddy pour les entreprises`,businessTitle:`Bambuddy pour les entreprises`,businessTagline:`Vous gérez {{count}} imprimantes. Support prioritaire, licences commerciales et facturation sont disponibles pour les équipes et les fermes d'impression.`},library:{title:`Bibliothèque Filament`,addFilament:`Ajouter Filament`,editFilament:`Modifier Filament`,deleteFilament:`Supprimer Filament`,vendor:`Vendeur`,material:`Matériau`,color:`Couleur`,kFactor:`Facteur K`,temperature:`Température`,noFilaments:`Bibliothèque vide`,deleteConfirm:`Supprimer ce filament ?`,importFromPrinter:`Importer de l'imprimante`,exportToFile:`Exporter vers fichier`,runWithPipeline:{actionLabel:`Exécuter avec un pipeline`,noPermission:`Vous n'avez pas la permission d'exécuter des pipelines`,modalTitle:`Exécuter avec un pipeline`,confirmTitle:`Confirmer l'exécution`,confirmIntro:`Le pré-vol a trouvé des problèmes avec cette exécution`,sourceHint:`Source`,pipelineHint:`Pipeline`,targetHint:`Cible`,pipelineListAria:`Pipelines disponibles`,runAnyway:`Exécuter quand même`,loading:`Chargement…`,empty:`Aucun pipeline enregistré pour le moment. Ouvrez le dialogue Trancher et cliquez sur « Enregistrer comme pipeline » pour en créer un.`,noTarget:`Aucune imprimante cible définie`,noTargetMessage:`Ce pipeline n'a pas d'imprimante cible. Ouvrez-le dans les Paramètres pour en choisir une.`,copies:`Copies`,copiesHint:`max {{n}}`,classTarget:`N'importe quel {{model}}`,toast:{started:`Exécution de pipeline démarrée`,failed:`Impossible de démarrer l'exécution`},issue:{printerNotSet:`Aucune imprimante cible définie pour ce pipeline.`,printerNotFound:`L'imprimante cible n'existe plus.`,printerDisabled:`L'imprimante cible est désactivée.`,printerOffline:`L'imprimante cible est hors ligne.`,filamentType:`Emplacement filament {{slot}} : attendu {{expected}}, AMS a {{actual}}`,filamentColor:`Emplacement filament {{slot}} : couleur différente (attendu {{expected}}, AMS a {{actual}})`,amsSlotMissing:`Emplacement AMS {{slot}} indisponible sur cette imprimante`,filamentUnverified:`L'emplacement filament {{slot}} provient d'un préréglage cloud / standard et n'a pas pu être vérifié statiquement.`,noClassMatches:`Aucune imprimante de cette installation ne correspond à la classe de modèle cible du pipeline ({{expected}}).`,classNotSet:`La cible du pipeline est une classe d'imprimante mais aucun modèle n'a été choisi.`}}},slicerSettings:{presetValuesOutdatedSidecar:`Valeurs par défaut du trancheur affichées : votre sidecar est plus ancien que cette fonctionnalité et ne peut pas fournir les valeurs d'un profil. Mettez à jour l'image du sidecar pour les voir. Tout ce que vous ne modifiez pas utilise toujours le profil.`,presetValuesNotConfigured:`Valeurs par défaut du trancheur affichées : aucun sidecar n'est configuré, les valeurs d'un profil ne peuvent donc pas être lues. Tout ce que vous ne modifiez pas utilise toujours le profil.`,presetValuesSidecarUnavailable:`Valeurs par défaut du trancheur affichées : le sidecar n'a pas répondu, les valeurs d'un profil ne peuvent donc pas être lues. Tout ce que vous ne modifiez pas utilise toujours le profil.`,presetValuesUnavailable:`Valeurs par défaut du trancheur affichées : celles du profil choisi n'ont pas pu être lues. Tout ce que vous ne modifiez pas utilise toujours le profil.`,filamentDefault:`Par défaut`,fromFile:`du fichier`,fromFileHint:`Le concepteur a modifié ce paramètre dans le fichier source. Sa valeur est {{value}}.`,fromFilePrinterCoupled:`imprimante du concepteur`,fromFilePrinterCoupledHint:`Réglé pour l'imprimante pour laquelle ce fichier a été conçu — peut être incorrect ou hors plage sur la vôtre.`,fromFileOverridesPreset:`remplace le profil`,fromFileOverridesPresetHint:`Le fichier impose {{value}} alors que le profil choisi utilise {{preset}}. À cocher uniquement si le fichier doit primer.`,useFromFile:`Utiliser la valeur du fichier source pour {{option}}`,otherFromFile:`Autres paramètres de ce fichier`,fromFileSummary:`Le concepteur a modifié {{count}} réglages de process dans ce fichier. Seuls ceux que vous cochez sont utilisés.`,fromFileUseAll:`Utiliser les réglages du concepteur`,fromFileUseAllHint:`Coche les réglages transposables d'une imprimante à l'autre. Ceux calés sur l'imprimante du concepteur, et ceux qui définissent le profil choisi, restent décochés.`,fromFileClear:`Effacer {{count}}`,loading:`Chargement des paramètres du trancheur…`,mode:{simple:`Simple`,advanced:`Avancé`,expert:`Expert`},searchPlaceholder:`Rechercher un paramètre`,resetAll:`Réinitialiser {{count}}`,resetOption:`Réinitialiser à la valeur par défaut`,noMatches:`Aucun paramètre ne correspond à cette recherche.`},slice:{filamentSlotUnset:`non défini`,processSettingsEmbedded:`Inutilisé tant que « Utiliser les paramètres intégrés du fichier » est activé : ce sont les paramètres du fichier qui pilotent ce découpage.`,processSettingsInactive:`Inactif`,presetsHidden:`{{count}} masqués`,showAllPresets:`Tout afficher`,showFewerPresets:`Afficher moins`,processSettings:`Paramètres de process`,processSettingsHint:`Ajustez le profil choisi pour ce découpage. Tout ce que vous ne modifiez pas reste tel que défini par le profil.`,processSettingsChanged:`{{count}} modifiés`,processSettingsUnchanged:`Valeurs du profil`,title:`Slicer le modèle`,action:`Slicer`,actionAll:`Slicer les {{count}} plateaux`,actionAllTitle:`Slicer tous les plateaux dans une sortie multi-plateaux (une seule archive). La sélection de filament couvre chaque emplacement défini par le projet.`,allPlatesToggle:`Slicer les {{count}} plateaux`,slicing:`Découpage…`,printer:`Profil d'imprimante`,process:`Profil de processus`,filament:`Profil de filament`,filamentSlot:`Filament {{index}} – {{type}}`,filamentColour:`Couleur du filament`,selectPreset:`— Sélectionner un préréglage —`,loadingPresets:`Chargement des préréglages…`,analyzingPlateFilaments:`Analyse des filaments de la plaque…`,analyzingPlateFilamentsHint:`Exécution d'un découpage d'aperçu pour identifier les emplacements AMS utilisés. Mis en cache après — la réouverture est instantanée.`,previewToast:`Analyse de {{name}} – {{elapsed}}`,previewWithProgress:`Analyse de {{name}} – {{stage}} ({{percent}} %) – {{elapsed}}`,notUsedByPlate:`— non utilisé par cette plaque`,noPresetsForSlot:`Aucun préréglage disponible`,otherPrinters:`Autres imprimantes`,presetsLoadFailed:`Échec du chargement des préréglages. Ouvrez Paramètres → Profils pour les importer d'abord.`,refreshPresets:`Actualiser`,refreshPresetsTitle:`Actualiser les préréglages — récupérer les dernières listes Cloud et bundle (à utiliser après avoir supprimé un préréglage dans Bambu Studio ou Bambu Handy)`,allPresetsRequired:`Tous les préréglages doivent être sélectionnés`,useEmbedded:`Utiliser les réglages intégrés du fichier`,useEmbeddedHint:`Slicer tel que le concepteur l'a configuré (parois, remplissage, filament) au lieu des profils ci-dessus. Proposé car votre imprimante correspond à celle du fichier.`,autoOrient:`Orienter les objets automatiquement`,autoOrientHint:`Le trancheur fait pivoter chaque objet sur sa meilleure face d'impression avant de trancher. Remplace l'orientation enregistrée dans le fichier.`,autoArrange:`Disposer automatiquement sur le plateau`,autoArrangeHint:`Le trancheur place les objets pour qu'ils ne se chevauchent plus. Remplace la disposition du fichier.`,enqueuing:`Envoi du travail de découpage…`,queued:`En file d'attente…`,failed:`Échec du découpage. Vérifiez les journaux du sidecar.`,startedToast:`Découpage de {{name}} en arrière-plan…`,queuedToast:`En attente : {{name}} – {{elapsed}}`,runningToast:`Découpage {{name}} – {{elapsed}}`,runningWithProgress:`{{name}} – {{stage}} ({{percent}} %) – {{elapsed}}`,runningWithProgressMultiPlate:`Plateau {{plateIndex}} sur {{plateCount}} • {{name}} – {{stage}} ({{percent}} %) – {{elapsed}}`,completedToast:`{{name}} découpé`,externalWriteFallbackToast:`Enregistré dans la bibliothèque interne : impossible d'écrire dans le dossier externe`,failedTitle:`Échec du découpage`,failedToast:`Échec du découpage de {{name}} : {{detail}}`,tier:{local:`Importé`,cloud:`Bambu Cloud`,orcaCloud:`Orca Cloud`,standard:`Standard`},cloud:{notAuthenticated:`Connectez-vous à Bambu Cloud (Paramètres → Profils → Bambu Cloud) pour voir vos préréglages cloud.`,expired:`Session Bambu Cloud expirée – reconnectez-vous pour actualiser vos préréglages cloud.`,unreachable:`Bambu Cloud est inaccessible. Les préréglages locaux et standards fonctionnent encore.`},orcaCloud:{notAuthenticated:`Connectez-vous à Orca Cloud (Profils → Orca Cloud) pour voir vos préréglages Orca.`,expired:`Session Orca Cloud expirée — reconnectez-vous pour actualiser vos préréglages Orca.`,unreachable:`Orca Cloud est indisponible pour le moment. Les autres préréglages fonctionnent toujours.`},bedType:{label:`Plateau d'impression`,auto:`Auto (utiliser le préréglage de processus)`,coolPlate:`Cool Plate`,coolPlateSuperTack:`Cool Plate SuperTack`,engineering:`Engineering Plate`,highTemp:`High Temp Plate`,texturedPEI:`Textured PEI Plate`,smoothPEI:`Smooth PEI Plate`},filters:{onlyConnectedModels:`Uniquement les imprimantes en ligne`,onlyConnectedModelsHint:`Profils d'imprimante des modèles connectés en ce moment, pour toutes les tailles de buse.`,onlyLoadedSpools:`Uniquement les bobines chargées`,onlyLoadedSpoolsHint:`Profils de filament des bobines dans les imprimantes connectées du modèle choisi. Un profil choisi par vous est conservé.`,noneOnline:`Aucune imprimante n'est en ligne, tous les profils sont donc affichés.`,noneLoaded:`Aucune bobine chargée n'a de profil pour cette imprimante, tous les profils de filament sont donc affichés.`,notOnline:`Hors ligne`,notLoaded:`Non chargé`},loadedSpools:{title:`Bobines chargées`,pick:`Choisir`,pickTitle:`Choisir une bobine chargée dans une imprimante connectée`,none:`Aucune imprimante de ce modèle n'est en ligne.`,nothingLoaded:`Ni AMS ni bobine externe.`,unknownSpool:`Bobine non identifiée`,empty:`Vide`,noProfile:`Aucun profil pour l'imprimante choisie`,noProfileShort:`Aucun profil pour cette imprimante`},pipelines:{label:`Pipeline`,applyAria:`Appliquer le pipeline`,applyPrompt:`Appliquer un pipeline…`,empty:`Aucun pipeline enregistré`,saveButton:`Enregistrer comme pipeline`,saveTitle:`Enregistrer la sélection actuelle des quatre emplacements comme pipeline réutilisable`,namePlaceholder:`Nom du pipeline`,nameAria:`Nouveau nom de pipeline`,toast:{applied:`« {{name}} » appliqué`,saved:`Pipeline enregistré`,saveFailed:`Échec de l'enregistrement`}}},spoolman:{title:`Intégration Spoolman`,enabled:`Spoolman Activé`,url:`URL Spoolman`,connected:`Connecté`,disconnected:`Non Connecté`,testConnection:`Tester connexion`,sync:`Synchroniser`,syncing:`Sync...`,lastSync:`Dernière Sync`,linkToSpoolman:`Lier à Spoolman`,openInSpoolman:`Ouvrir Spoolman`,unlinkSpool:`Délier bobine`,unlinkConfirmTitle:`Désassigner la bobine ?`,unlinkConfirmMessage:`Cela retirera la bobine de cet emplacement. Les données de la bobine elles-mêmes resteront inchangées.`,selectSpool:`Choisir bobine`,noUnlinkedSpools:`Pas de bobine libre`,linkSuccess:`Bobine assignée avec succès`,linkFailed:`Échec de l’assignation`,unlinkSuccess:`Bobine désassignée avec succès`,unlinkFailed:`Échec du désassignement`,linkedSpool:`Bobine assignée`,spoolId:`ID Bobine`,fillSourceLabel:`(Spoolman)`,weight:`Poids`,remaining:`Restant`,disableWeightSync:`Désactiver Sync poids estimé AMS`,disableWeightSyncDesc:`Ne pas utiliser les estimations AMS. Utile si vous préférez le suivi Spoolman.`,reportPartialUsage:`Rapporter consommation partielle pour échecs`,reportPartialUsageDesc:`Si l'impression échoue, rapporte le filament consommé selon les couches.`},locations:{title:`Emplacements de stockage`,subtitle:`Gérez étagères, tiroirs et autres emplacements physiques pour vos bobines`,add:`Ajouter un emplacement`,addShort:`Ajouter`,edit:`Modifier l'emplacement`,name:`Nom`,spools:`Bobines`,sensors:`Capteurs`,empty:`Aucun emplacement de stockage. Créez votre première étagère ou tiroir.`,manage:`Emplacements`,createPlaceholder:`ex. Étagère A, Tiroir 1`,nameRequired:`Le nom de l'emplacement est requis`,created:`Emplacement créé`,updated:`Emplacement mis à jour`,deleted:`Emplacement supprimé`,saveFailed:`Échec de l'enregistrement de l'emplacement`,deleteFailed:`Échec de la suppression de l'emplacement`,deleteBlocked:`Retirez d'abord toutes les bobines de cet emplacement`,confirmDelete:`Supprimer « {{name}} » ?`,confirmDeleteMessage:`Cet emplacement sera retiré du catalogue. Déplacez d'abord les bobines.`,confirmDeleteMessageWithSensors:`Cet emplacement sera retiré du catalogue. Déplacez d'abord les bobines. Les capteurs connectés seront également supprimés.`},inventory:{title:`Inventaire de Bobines`,subtitle:`Gérez vos bobines`,addToInventory:`Ajouter à l'inventaire`,addToInventoryPending:`Ajout...`,addToInventorySuccess:`Bobine ajoutée à l'inventaire`,addToInventoryFailed:`Échec de l'ajout de la bobine à l'inventaire`,unknownSpoolTitle:`Nouveau filament détecté`,unknownSpoolMessage:`Une bobine avec un tag RFID inconnu a été détectée à {{location}}. L'ajouter à votre inventaire maintenant ?`,unknownSpoolSlot:`Emplacement`,bulk:{selectAllVisible:`Tout sélectionner (visible)`,selectRow:`Sélectionner la ligne`,selectGroup:`Sélectionner le groupe`,selectionCount:`{{count}} sélectionnée(s)`,edit:`Modifier`,printLabels:`Imprimer les étiquettes`,resetUsage:`Réinitialiser l'utilisation`,restore:`Restaurer`,archive:`Archiver`,delete:`Supprimer`,clearSelection:`Effacer la sélection`,editTitle:`Modification groupée des bobines`,editSubtitle:`S'applique à {{count}} bobines sélectionnées. Seuls les champs cochés seront mis à jour.`,editHint:`Tapez dans un champ pour le marquer comme à mettre à jour — seules les lignes cochées sont envoyées. Un champ laissé vide laisse les bobines inchangées (vider un champ se fait par bobine).`,useCustom:`Utiliser « {{value}} »`,toggleField:`Activer la mise à jour de ce champ`,changeCount:`{{count}} champ(s) seront mis à jour.`,applyPending:`Application...`,applyButton:`Appliquer à {{count}} bobines`,deleteTitle:`Supprimer les bobines sélectionnées`,archiveTitle:`Archiver les bobines sélectionnées`,restoreTitle:`Restaurer les bobines sélectionnées`,resetUsageTitle:`Réinitialiser l'utilisation des bobines sélectionnées`,deleteMessage:`Supprimer définitivement {{count}} bobines ? Cette action est irréversible.`,archiveMessage:`Archiver {{count}} bobines ? Elles pourront être restaurées plus tard.`,restoreMessage:`Restaurer {{count}} bobines archivées ?`,resetUsageMessage:`Réinitialiser le compteur « Total consommé » sur {{count}} bobines ? Le poids restant est préservé.`,updateSuccess:`{{count}} bobines mises à jour`,updateFailed:`Mise à jour groupée échouée`,updatePartial:`{{ok}} bobines mises à jour, {{failed}} échouées`,updateAllFailed:`Les {{count}} mises à jour ont échoué — la sélection est conservée pour réessayer`,deleteSuccess:`{{count}} bobines supprimées`,deleteFailed:`Suppression groupée échouée`,deletePartial:`{{ok}} bobines supprimées, {{failed}} échouées`,deleteAllFailed:`Les {{count}} suppressions ont échoué — la sélection est conservée pour réessayer`,archiveSuccess:`{{count}} bobines archivées`,archiveFailed:`Archivage groupé échoué`,archivePartial:`{{ok}} bobines archivées, {{failed}} échouées`,archiveAllFailed:`Les {{count}} archivages ont échoué — la sélection est conservée pour réessayer`,restoreSuccess:`{{count}} bobines restaurées`,restoreFailed:`Restauration groupée échouée`,restorePartial:`{{ok}} bobines restaurées, {{failed}} échouées`,restoreAllFailed:`Les {{count}} restaurations ont échoué — la sélection est conservée pour réessayer`,invalidHex:`Saisissez 6 caractères hex (RRVVBB) ou 8 (RRVVBBAA). Sinon le champ ne sera pas appliqué.`},spoolmanMixedContentTitle:`Spoolman ne peut pas se charger en HTTPS — contenu mixte bloqué par votre navigateur`,spoolmanMixedContentBody:`Bambuddy est servi en HTTPS (via votre reverse proxy), mais votre URL Spoolman est encore en HTTP. Les navigateurs bloquent le contenu mixte pour des raisons de sécurité, donc l'interface Spoolman intégrée ne peut pas s'afficher. Spoolman doit être accessible en HTTPS.`,spoolmanMixedContentFixReverseProxy:`Placez Spoolman derrière le même reverse proxy que Bambuddy (Traefik / Nginx / Caddy) en HTTPS, puis mettez à jour l'URL Spoolman dans les Paramètres avec la nouvelle adresse HTTPS.`,spoolmanMixedContentFixOpenNewTab:`Alternative : ouvrez Spoolman dans un nouvel onglet en HTTP — les règles de contenu mixte ne s'appliquent qu'aux cadres intégrés, un onglet autonome fonctionne.`,spoolmanOpenInNewTab:`Ouvrir Spoolman dans un nouvel onglet`,labels:{title:`Imprimer étiquettes de bobines`,selectedCount:`{{count}} sélectionné`,pickSpools:`Choisissez les bobines pour lesquelles imprimer des étiquettes :`,monochrome:`Monochrome (imprimante noir et blanc)`,monochromeHint:`Supprime la pastille de couleur et élargit le texte`,startingPosition:`Position de départ de l’étiquette`,startingPositionInvalid:`Saisissez un nombre entier de 1 à {{capacity}}.`,startingPositionFirst:`L’impression commence à la position 1.`,startingPositionSkipped:`Les positions 1 à {{lastPosition}} resteront vides sur la première feuille.`,searchPlaceholder:`Rechercher par nom, marque ou #ID`,filterByMaterial:`Matériau :`,allMaterials:`Tout`,selectVisible:`Sélectionner tout visible ({{count}})`,deselectVisible:`Désélectionner visible`,clearAll:`Tout effacer`,noSpoolsToShow:`Aucune bobine à afficher. Ajustez votre filtre et réessayez.`,noMatches:`Aucune bobine ne correspond à la recherche ou au filtre actuel.`,printOne:`Imprimer l'étiquette de cette bobine`,printLabels:`Imprimer les étiquettes…`,bulkTitle:`Choisissez les bobines à étiqueter parmi les {{count}} affichées`,noSpoolsTitle:`Aucune bobine à étiqueter`,error:`Impossible de générer les étiquettes : {{msg}}`,template:`Taille d'étiquette`,preview:`Aperçu`,previewOf:`Aperçu de #{{id}}`,previewNoSelection:`Sélectionnez une bobine pour voir son étiquette.`,previewError:`Impossible de générer l'aperçu : {{msg}}`,previewAlt:`Aperçu de l'étiquette`,previewHint:`Les lignes qui ne tiennent pas sur cette taille d'étiquette sont omises.`,content:`Imprimer sur l'étiquette`,resetFields:`Rétablir les valeurs par défaut`,format:`Sortie :`,dpi:`Résolution`,pngHint:`Pour les logiciels d'imprimante d'étiquettes qui utilisent des images. Choisissez la résolution de votre imprimante ; plusieurs étiquettes sont fournies dans un ZIP.`,createPdf:`Créer le PDF`,downloadPng:`Télécharger le PNG`,selectedTitle:`Imprimer les étiquettes des {{count}} bobines sélectionnées`,fields:{brand:`Marque`,material:`Matériau et sous-type`,hex:`Code couleur`,name:`Nom de la couleur ou du filament`,location:`Emplacement de stockage`,materialNumber:`Numéro de matériau`,temps:`Température de la buse`,weight:`Poids net`,note:`Remarque`,added:`Date d'ajout`,qr:`Code QR`,spoolId:`ID de la bobine`},sortBy:{label:`Trier :`,id:`Par ID`,color:`Par couleur`},templates:{amsHolderSmall:{label:`Support AMS — petit (74 × 33 mm)`,hint:`Une étiquette par page ; correspond à l'étiquette imprimable du modèle MakerWorld 752566 (Support d'étiquettes pour filament AMS).`},amsHolderLarge:{label:`Support AMS — grand (75 × 55 mm)`,hint:`Une étiquette par page ; s'adapte à la variante carton du support d'étiquettes pour filament AMS. Assez d'espace pour pastille, marque, matériau, ID et QR code.`},box40x30:{label:`Étiquette boîte (40 × 30 mm)`,hint:`Une étiquette par page ; taille de rouleau DK/Brother courante, idéale pour étiqueter sachets de filament et bacs de stockage.`},box:{label:`Box label (62 × 29 mm)`,hint:`Une étiquette par page ; dimensionnée pour Brother PT/QL et petites étiquettes Dymo.`},averyL7160:{label:`Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)`,hint:`Format de feuille UE ; 21 étiquettes par page A4.`},avery5160:{label:`Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)`,hint:`Format de feuille US ; 30 étiquettes par page Letter.`}}},csv:{importButton:`Importer CSV`,exportButton:`Exporter CSV`,modalTitle:`Importer des bobines depuis un CSV`,selectFile:`Choisissez un fichier CSV ou glissez-le ici`,dragHint:`En-tête : material (requis), brand, subtype, color_name, rgba, …`,parsing:`Lecture du fichier…`,previewError:`Impossible de lire le fichier CSV`,validCount:`{{count}} valides`,errorCount:`{{count}} en erreur`,skippedCount:`{{count}} ignorées`,colRow:`Ligne`,colStatus:`Statut`,colColor:`Couleur`,colorResolved:`Couleur remplie depuis le catalogue`,colorCrossMaterial:`Couleur reprise d'un autre matériau — aucune correspondance exacte dans le catalogue`,duplicateExisting:`Une bobine avec ce matériau, cette marque et cette couleur existe déjà — elle sera tout de même importée comme une nouvelle bobine`,spoolmanHint:`En mode Spoolman, utilisez l'import/export CSV intégré de Spoolman.`,importValidRows:`Importer {{count}} lignes valides`,noValidRows:`Aucune ligne valide`,importing:`Importation…`,importSuccess:`{{count}} bobines importées`,importError:`Échec de l'importation`,exportError:`Échec de l'exportation`},addSpool:`Ajouter Bobine`,editSpool:`Modifier Bobine`,copySpool:`Copier Bobine`,material:`Matériau`,selectMaterial:`Choisir matériau...`,subtype:`Sous-type`,brand:`Marque`,searchBrand:`Chercher marque...`,useCustomBrand:`Utiliser "{{brand}}"`,useCustomMaterial:`Utiliser un matériau personnalisé : {{material}}`,suggestedOptions:`Suggérés`,allOptions:`Tous`,colorName:`Nom de couleur`,colorNamePlaceholder:`Blanc Jade, Rouge Feu...`,color:`Couleur`,hexColor:`Code Hex`,pickColor:`Choisir couleur perso`,labelWeight:`Poids net`,coreWeight:`Poids bobine vide`,searchSpoolWeight:`Chercher poids bobine...`,weightUsed:`Consommé`,currentWeight:`Poids restant`,measuredWeight:`Poids mesuré`,spoolName:`Bobine`,costPerKg:`Coût par kg`,storageLocation:`Emplacement de stockage`,temperature:`Température`,humidity:`Humidité`,battery:`Batterie`,storageLocationPlaceholder:`ex. Étagère A, Tiroir 1`,openInInventory:`Ouvrir dans l'inventaire`,measuredWeightError:`Le poids mesuré doit être entre {{min}}g et {{max}}g.`,slicerFilament:`Filament Slicer`,slicerFilamentName:`Nom du Preset Slicer`,slicerPreset:`Preset Slicer`,searchPresets:`Chercher presets...`,selectedPreset:`Sélectionné`,noPresetsFound:`Aucun preset trouvé`,tempOverrides:`Exceptions Température`,note:`Note`,notePlaceholder:`Notes additionnelles sur cette bobine...`,category:`Catégorie`,categoryPlaceholder:`ex. Production, Prototype, Client A`,categoryNone:`Sans catégorie`,storageLocationNone:`Aucun emplacement défini`,lowStockThresholdOverride:`Seuil bas (cette bobine)`,lowStockThresholdOverrideHelp:`Laisser vide pour utiliser le seuil global ({{global}} %).`,materialNumber:`N° matière`,materialNumberPlaceholder:`ex. 15`,materialNumberHelp:`Numéro d'achat interne - partagé par toutes les bobines de ce produit. Les nouvelles bobines du même produit en héritent.`,lastDried:`Dernier séchage`,lastDriedNow:`Maintenant`,lastDriedHelp:`Renseigné à la fin d'un séchage AMS ayant duré au moins la moitié de sa durée. Indiquez-le ici pour une bobine séchée ailleurs.`,materialNumberNone:`Aucun numéro de matière`,suppliers:{label:`Fournisseurs`,none:`Aucun fournisseur`,addSupplier:`Ajouter un fournisseur…`,searchPlaceholder:`Rechercher des fournisseurs…`,noneLeft:`Tous les fournisseurs sont déjà associés`,createNew:`Créer « {{name}} »`,createFailed:`Échec de la création du fournisseur`,purchaseSource:`Acheté ici`,purchaseSourceHelp:`Indique où cette bobine a réellement été achetée ; les autres entrées sont des sources alternatives.`,articleNumberPlaceholder:`Réf. article fournisseur`,pricePlaceholder:`Prix proposé/kg`,priceHelp:`Prix proposé chez ce fournisseur, pour comparer les sources — le coût par kg propre à la bobine reste la base de coût.`,help:`Où ce produit peut être acheté. L'entrée mise en évidence est celle où cette bobine a été achetée.`,saveFailed:`Échec de l'enregistrement des fournisseurs associés`,title:`Fournisseurs`,description:`Gérez où vous achetez votre filament — à distinguer de la marque, qui désigne le fabricant. Associez les fournisseurs aux bobines dans la boîte de dialogue de la bobine ; un fournisseur encore associé à des bobines ne peut pas être supprimé.`,search:`Rechercher des fournisseurs...`,addNew:`Ajouter un nouveau fournisseur`,namePlaceholder:`Nom (ex. Filament24)`,websitePlaceholder:`Site web / URL de la boutique`,customerNumberPlaceholder:`N° client`,notePlaceholder:`Note`,nameRequired:`Le nom est requis`,duplicateName:`Un fournisseur portant ce nom existe déjà`,customerNumber:`N° client`,spools:`Bobines`,noMatch:`Aucun fournisseur ne correspond à votre recherche`,empty:`Aucun fournisseur pour le moment`,added:`Fournisseur ajouté`,addFailed:`Échec de l'ajout du fournisseur`,updated:`Fournisseur mis à jour`,updateFailed:`Échec de la mise à jour du fournisseur`,deleted:`Fournisseur supprimé`,deleteFailed:`Échec de la suppression du fournisseur`,deleteBlocked:`Suppression impossible : encore associé à {{count}} bobine(s)`,loadFailed:`Échec du chargement des fournisseurs`,deleteTitle:`Supprimer le fournisseur`,deleteConfirm:`Supprimer « {{name}} » ?`,deleteConfirmReferenced:`« {{name}} » est associé à {{count}} bobine(s). La suppression est bloquée tant que ces associations ne sont pas retirées.`},clearRfid:`Effacer le tag RFID`,rfidCleared:`Tag RFID effacé`,archive:`Archiver`,restore:`Restaurer`,noSpools:`Aucune bobine. Ajoutez votre première bobine pour commencer.`,noAvailableSpools:`Aucune bobine disponible. Ajoutez une bobine à votre inventaire ou désaffectez-en une d'un autre emplacement.`,kProfiles:`Profils K`,addKProfile:`Ajouter K-Profile`,assignSpool:`Assigner Bobine`,unassignSpool:`Désassigner`,assignSuccess:`Bobine assignée et slot AMS configuré`,assignPendingInsert:`Assigné. Le slot sera configuré lors de l'insertion de la bobine.`,assignFailed:`Échec assignation`,selectSpool:`Choisir une bobine pour ce slot`,assigned:`Assigné`,assigning:`Assignation...`,searchSpools:`Chercher bobines...`,showAllSpools:`Afficher toutes les bobines`,spoolmanSpools:`Bobines Spoolman`,allMaterials:`Tous Matériaux`,filterByBrand:`Filtrer par marque...`,showArchived:`Afficher archivées`,quickAdd:`Ajout rapide (Stock)`,quantity:`Quantité`,stock:`Stock`,configured:`Configuré`,spoolsCreated:`{{count}} bobines créées`,spoolsPartiallyCreated:`{{created}} sur {{total}} bobines créées (certaines ont échoué)`,spoolCreated:`Bobine créée`,spoolUpdated:`Bobine mise à jour`,spoolDeleted:`Bobine supprimée`,deepLinkSpoolNotFound:`Bobine introuvable`,deepLinkFetchFailed:`Impossible de charger la bobine — réessayez`,spoolArchived:`Bobine archivée`,spoolRestored:`Bobine restaurée`,kProfileSaveFailed:`Les paramètres de profil K n'ont pas pu être enregistrés`,syncWeightSpoolNotFound:`Bobine introuvable — elle a peut-être été supprimée`,syncWeightSpoolmanUnreachable:`Spoolman est inaccessible — réessayez plus tard`,syncWeightFailed:`Échec de la synchronisation du poids`,spoolmanUnreachable:`Spoolman est inaccessible — veuillez réessayer plus tard`,deleteSpoolNotFound:`Bobine introuvable — elle a peut-être déjà été supprimée`,deleteFailed:`Impossible de supprimer la bobine`,archiveSpoolNotFound:`Bobine introuvable — elle a peut-être déjà été supprimée`,archiveFailed:`Impossible d'archiver la bobine`,restoreSpoolNotFound:`Bobine introuvable — elle a peut-être déjà été supprimée`,restoreFailed:`Impossible de restaurer la bobine`,saveFailed:`Impossible d'enregistrer les modifications`,tagClearFailed:`Impossible de supprimer le tag`,deleteConfirm:`Supprimer définitivement cette bobine ?`,archiveConfirm:`Voulez-vous vraiment archiver cette bobine ?`,advancedSettings:`Paramètres Avancés`,filamentInfoTab:`Infos Filament`,paProfileTab:`Profil PA`,colorAndCostTab:`Couleur et coût`,printersTab:`Imprimantes`,filamentInfo:`Filament`,additional:`Additionnel`,loadingPresets:`Chargement des presets cloud...`,cloudConnected:`Cloud connecté`,cloudNotConnected:`Cloud déconnecté (valeurs par défaut)`,recentColors:`Récentes`,searchColors:`Chercher couleurs...`,searchResults:`Résultats`,allColors:`Toutes`,commonColors:`Communes`,showLess:`Moins`,showAll:`Toutes`,noColorsFound:`Aucune couleur correspondante`,noResults:`Aucun résultat`,extraColorsLabel:`Couleurs supplémentaires`,extraColorsPlaceholder:`EC984C,#6CD4BC,A66EB9,D87694`,extraColorsHint:`Collez 2 à 8 stops hex, séparés par des virgules. Affiché en dégradé.`,extraColorsInvalid:`Hex non valides ignorés : {{tokens}}`,colorEffectLabel:`Effet`,colorEffect:{none:`Aucun`,sparkle:`Pailleté`,wood:`Bois`,marble:`Marbre`,glow:`Lueur`,matte:`Mat`,silk:`Soie`,galaxy:`Galaxie`,rainbow:`Arc-en-ciel`,metal:`Métal`,translucent:`Translucide`,gradient:`Dégradé`,dualColor:`Bicolore`,triColor:`Tricolore`,multicolor:`Multicolore`},selectMaterialFirst:`Veuillez choisir un matériau dans l'onglet Infos Filament.`,noPrintersConfigured:`Ajoutez une imprimante pour utiliser les profils PA.`,matchingFilter:`Correspondant`,anyBrand:`Toute marque`,anyVariant:`Toute variante`,autoSelect:`Auto-sélection`,matches:`correspondances`,match:`correspondance`,noMatches:`Aucune correspondance`,connected:`Connecté`,offline:`Hors ligne`,printerOffline:`Imprimante hors ligne. Connectez-vous pour voir les profils.`,noKProfilesMatch:`Aucun profil K ne correspond au filament.`,leftNozzle:`Buse Gauche`,rightNozzle:`Buse Droite`,profilesSelected:`profil(s) de calibration sélectionné(s)`,filamentPreset:`Préréglage de filament`,presetUseSpoolDefault:`Utiliser le préréglage de la bobine`,presetInherited:`hérité`,presetOverride:`personnalisé`,presetNeedsModel:`Cette imprimante n'a pas encore indiqué son modèle, elle ne peut donc pas avoir son propre préréglage.`,autoMatchPresets:`Association automatique`,autoMatchPresetsHint:`Trouver la variante du préréglage de la bobine qui nomme chaque modèle`,kProfilesPerPrinter:`Profils K`,kProfileNotSet:`Non défini`,kProfileFlowMismatch:`Ce profil a été mesuré avec une buse {{profile}} alors qu'une buse {{fitted}} est installée : il ne sera pas appliqué`,nozzle:`Buse`,unknownModel:`Modèle inconnu`,onePrinter:`1 imprimante`,nPrinters:`{{n}} imprimantes`,filamentPresetsLoadFailed:`Impossible de charger les préréglages par modèle de cette bobine`,filamentPresetSaveFailed:`Impossible d'enregistrer les préréglages par modèle`,totalInventory:`Total Inventaire`,totalConsumed:`Total Consommé`,byMaterial:`Par Matériau`,inPrinter:`Dans Imprimante`,lowStock:`Stock Bas`,sinceTracking:`Depuis le début du suivi`,resetConsumedCounter:`Réinitialiser le compteur`,resetConsumedCounterTooltip:`Remettre à zéro le compteur de grammes consommés pour cette bobine. Le poids restant n'est pas modifié.`,resetConsumedCounterConfirm:`Remettre à 0 le compteur de grammes consommés de cette bobine ? Les futures impressions repartiront de zéro. La bobine, son calcul de poids restant et vos paramètres ne sont pas modifiés.`,resetAllConsumedCounters:`Réinitialiser tous les compteurs`,resetAllConsumedCountersTooltip:`Remettre à zéro le compteur de grammes consommés sur chaque bobine. Les poids restants ne sont pas modifiés.`,resetAllConsumedCountersConfirm:`Remettre à 0 le compteur de grammes consommés sur les {{count}} bobines (archivées incluses) ? Cela efface la valeur « Total Consommé » pour que les futures impressions repartent de zéro. Les bobines et les poids restants ne sont pas modifiés.`,consumedCounterReset:`Compteur réinitialisé`,allConsumedCountersReset:`Compteur réinitialisé pour {{count}} bobine(s)`,resetConsumedCounterFailed:`Échec de la réinitialisation du compteur`,loadedInAms:`Chargé dans AMS/Ext`,remaining:`Restant`,weightCheck:`Vérification poids`,lastWeighed:`Dernière pesée`,neverWeighed:`Jamais pesé`,search:`Chercher bobines...`,showing:`Affichage`,to:`à`,of:`sur`,show:`Voir`,spools:`bobines`,spool:`bobine`,page:`Page`,noSpoolsMatch:`Aucun résultat trouvé`,noSpoolsMatchDesc:`Ajustez votre recherche ou vos filtres.`,active:`Actif`,archived:`Archivé`,all:`Tous`,used:`Occasion`,new:`Neuf`,clearFilters:`Effacer filtres`,table:`Tableau`,cards:`Cartes`,net:`Réseau`,groupSimilar:`Grouper`,groupedSpools:`{{count}} bobines identiques`,groupedRows:`lignes`,columns:`Colonnes`,configureColumns:`Configurer Colonnes`,configureColumnsDesc:`Glissez pour ordonner ou utilisez les flèches. Cliquez sur l'œil pour masquer.`,visible:`visible`,reset:`Réinitialiser`,cancel:`Annuler`,applyChanges:`Appliquer`,moveUp:`Monter`,moveDown:`Descendre`,hideColumn:`Masquer`,showColumn:`Afficher`,linkToSpool:`Lier à une Bobine`,tagLinked:`Tag lié à la bobine`,tagLinkFailed:`Échec lien tag`,tagAlreadyLinked:`Tag déjà lié à la bobine #{{id}}`,unknownTag:`Tag RFID inconnu détecté`,usageHistory:`Historique de Consommation`,noUsageHistory:`Aucune consommation enregistrée`,printName:`Nom Impression`,weightConsumed:`Poids consommé`,clearHistory:`Effacer`,historyCleared:`Historique effacé`,fillSourceLabel:`(Inv)`,lowStockThresholdError:`Le seuil doit être compris entre 0.1 et 99.9`,assignMismatchTitle:`Incompatibilité de matériau`,assignMismatchMessage:`Le matériau de la bobine sélectionnée "{{spoolMaterial}}" ne correspond pas au matériau du plateau "{{trayMaterial}}" pour {{location}}. Assigner quand même ?`,assignMismatchConfirm:`Assigner quand même`,assignPartialMismatchMessage:`Le matériau de la bobine "{{spoolMaterial}}" est similaire, mais ne correspond pas exactement à "{{trayMaterial}}" dans {{location}}. Voulez-vous continuer ?`,assignProfileMismatchMessage:`Le profil de la bobine "{{spoolProfile}}" ne correspond pas au profil du plateau "{{trayProfile}}" dans {{location}}. Voulez-vous continuer ?`,assignReconfigureNote:`Le slot AMS sera reconfiguré pour utiliser le profil de la bobine.`,spoolmanFilamentCatalog:`Catalogue de filaments Spoolman`,pickFromSpoolmanCatalog:`Choisir dans le catalogue Spoolman…`,spoolmanFilamentSelected:`Filament sélectionné depuis le catalogue Spoolman`,spoolmanFilamentUnlinked:`Lien avec le catalogue de filaments supprimé`,noSpoolmanFilaments:`Aucun filament trouvé dans le catalogue Spoolman`,spoolmanFilamentColorSwatch:`Couleur du filament`,spoolmanCatalogLoadFailed:`Impossible de charger le catalogue Spoolman`},timelapse:{title:`Time-lapse`,create:`Créer Timelapse`,download:`Télécharger`,delete:`Supprimer`,preview:`Aperçu`,frameRate:`Images/sec`,quality:`Qualité`,processing:`Traitement...`,noTimelapses:`Aucun timelapse`},ams:{title:`AMS`,slot:`Emplacement`,empty:`Vide`,emptySlot:`Slot vide`,slotEmpty:`Vide`,slotUnconfigured:`?`,emptySlotReset:`Aucune bobine assignée`,unknown:`Inconnu`,humidity:`Humidité`,temperature:`Température`,filamentType:`Type filament`,filamentColor:`Couleur`,remaining:`Restant`,history:`Historique AMS`,noHistory:`Aucun historique`,configureSlot:`Configurer Slot`,externalSpool:`Bobine externe`,profile:`Profil`,kFactor:`Facteur K`,kFactorShort:`K`,fill:`Remplir`,configure:`Configurer`,used:`utilisé`,remainingUnit:`restant`},printModal:{variants:{editNote:`Ces alternatives ont été définies lors de la mise en file. Annulez et remettez en file pour les modifier.`,title:`Alternatives d'imprimante`,help:`Un travail, une place dans la file. La première imprimante compatible qui se libère imprime son fichier.`,unknownModel:`Modèle inconnu`,plateFor:`Plateau pour {{filename}}`,moveUp:`Monter`,moveDown:`Descendre`,queued:`Mis en file avec {{count}} alternatives`},selectPrinter:`Choisir l'imprimante`,selectPlate:`Choisir le plateau`,filamentMapping:`Mapping Filament`,useArchiveMapping:`Mappage`,useArchiveMappingTooltip:`Sélectionner tous les emplacements à partir du mappage AMS enregistré avec cette archive (depuis le slicer), au lieu de faire correspondre par type/couleur.`,clickToChangeSlot:`Cliquez pour modifier l'attribution de l'emplacement`,reRead:`Relire`,plateN:`Plateau {{n}}`,plateFilamentsUnreadable:`Les filaments d'un plateau sélectionné n'ont pas pu être lus, il est donc impossible de l'affecter. Désélectionnez-le pour mettre les autres en file.`,totalCost:`Coût total :`,slotRemainingShort:` - {{grams}}g rest.`,printSettings:`Réglages d'impression`,bedLeveling:`Nivellement plateau`,flowCalibration:`Calibration débit`,vibrationCalibration:`Vibration (Input Shaper)`,layerInspection:`Inspection 1ère couche`,timelapse:`Time-lapse`,cancel:`Annuler`,noPrintersAvailable:`Aucune imprimante disponible`,printerBusy:`L'imprimante est occupée`,printerOffline:`L'imprimante est hors ligne`,sameTypeDifferentColor:`Même type, couleur différente`,filamentTypeNotLoaded:`Type de filament non chargé`,statusReady:`Prêt`,statusColorMismatch:`Couleur différente`,statusTypeNotFound:`Type introuvable`,requiredTooltip:`Requis : {{name}} - {{color}}`,manuallySelected:`Sélectionné manuellement`,autoMatched:`Associé automatiquement`,selectSlot:`Choisir un emplacement`,exactColorMatch:`Correspondance exacte des couleurs`,slotForFilament:`Emplacement imprimante pour {{name}}`,overrideForFilament:`Remplacement de filament pour {{name}}`,sameTypeDifferentColorDetail:`Même type, couleur différente : requiert {{required}}, l’emplacement contient {{loaded}}`,requiredTypeNotInPrinter:`Type de filament requis introuvable dans l’imprimante.`,whenToPrint:`Quand imprimer`,asap:`Dès que possible`,queue:`File`,schedule:`Planifier`,dateTime:`Date et heure`,invalidDateTime:`Veuillez saisir une date et une heure valides`,openCalendar:`Ouvrir calendrier`,requireManualStart:`Démarrage manuel requis`,awaitingReviewNote:`Votre impression attend une validation : elle démarre quand une personne qui gère la file la lance.`,requirePreviousSuccess:`Démarrer seulement si l'impression précédente a réussi`,autoOffAfter:`Éteindre l'imprimante à la fin`,helpAsap:`L'impression sera ajoutée en haut de la file et démarrera dès qu'une imprimante éligible sera inactive.`,helpSchedule:`L'impression démarrera à l'heure planifiée si l'imprimante est inactive. Si elle est occupée, elle attendra qu'elle soit disponible.`,helpQueue:`L'impression sera ajoutée à la fin de la file.`,leftNozzle:`G`,rightNozzle:`D`,leftNozzleTooltip:`Buse gauche`,rightNozzleTooltip:`Buse droite`,ftsSameInletHint:`Tous les filaments de cette impression sont sur le sélecteur de chemin de filament IN-{{inlet}}. Changer entre des filaments d'une même entrée est plus lent — déplacez-en un vers un AMS de l'autre entrée.`,rackPosition:`Position du rack`,rackPositionTooltip:`Quelle buse du rack imprime ce filament. Les positions sont numérotées comme sur l'imprimante.`,rackEmptyPosition:`Cette position du rack est vide`,rackWrongNozzle:`Contient une buse {{has}} ; ce filament nécessite {{needs}}`,filamentOverride:`Remplacement de filament`,filamentOverrideHint:`Remplacez optionnellement les filaments pour l'affectation par modèle. Le planificateur utilisera vos filaments sélectionnés au lieu des valeurs 3MF d'origine.`,originalFilament:`Original`,overrideWith:`Remplacer par`,resetToOriginal:`Revenir à l'original`,insufficientFilamentTitle:`Filament insuffisant`,waitingForAmsStatus:`En attente de l'état de l'AMS de {{printer}}…`,insufficientFilamentMessage:`Certaines bobines assignées ont moins de filament restant que nécessaire pour cette impression :`,insufficientFilamentLine:`{{printer}} - {{slot}} : nécessite {{required}}g, restant {{remaining}}g`,insufficientFilamentLinePooled:`{{printer}} - {{slot}} : nécessite {{required}}g, {{remaining}}g disponibles sur les bobines correspondantes (AMS Filament Backup)`,printAnyway:`Imprimer quand même`,forceColorMatch:`Forcer correspondance des couleurs`,staggerPrinterStarts:`Échelonner démarrages`,staggerGroupSize:`Taille du groupe`,staggerInterval:`Intervalle (min)`,staggerPreview:`{{printers}} imprimantes → {{groups}} groupes de {{size}}, démarrage toutes les {{interval}} min`,staggerLastGroup:`dernier groupe : {{count}}`,staggerTotal:`total : {{minutes}} min`,staggerToPrinters:`Échelonner sur {{count}} imprimantes`,gcodeInjection:`Injecter le G-code auto-impression`,insufficientBudget:`Budget insuffisant`,unlimitedNoBudget:`Illimité – aucune limite de budget n’est définie.`,noPrintableCostCenters:`Aucun centre de coûts actif n’est disponible pour l’impression. Demandez à un administrateur de vous accorder l’accès à l’impression.`,askForOutcome:`Demander le résultat`,askForOutcomeTitle:`Demander comment l’impression s’est déroulée une fois terminée`},backup:{includesEncryptionKey:`Les sauvegardes locales incluent le fichier de clé de chiffrement MFA (DATA_DIR/.mfa_encryption_key), donc un ZIP de sauvegarde est autonome. Traitez le ZIP comme sensible — quiconque possède le fichier peut déchiffrer les secrets client OIDC et TOTP qu'il contient.`,title:`Sauvegarde & Restauration`,createBackup:`Créer Sauvegarde`,restoreBackup:`Restaurer Sauvegarde`,restoreDescription:`Remplace les données par un fichier de sauvegarde`,downloadBackup:`Télécharger Sauvegarde`,uploadBackup:`Téléverser Sauvegarde`,lastBackup:`Dernière sauvegarde`,autoBackup:`Sauvegarde auto`,backupNow:`Sauvegarder maintenant`,restoreWarning:`Attention : Écrase TOUTES les données actuelles.`,includeArchives:`Inclure Archives`,includeSettings:`Inclure Paramètres`,includeProfiles:`Inclure Profils`,backupSuccess:`Sauvegarde réussie`,restoreSuccess:`Restauration réussie`,backupFailed:`Échec sauvegarde`,restoreFailed:`Échec restauration`,restoreNote:`L'imprimante virtuelle sera arrêtée pendant la restauration`,githubBackup:`Sauvegarde GitHub`,enabled:`Activé`,cloudLoginRequired:`Connexion Bambu Cloud requise. Connectez-vous sous Profils → Profils Cloud pour activer la sauvegarde GitHub.`,cloudLoginRequiredShort:`Connexion Cloud requise`,githubDescription:`Synchronisez automatiquement vos profils vers un dépôt GitHub privé pour la sauvegarde et l'historique des versions.`,repoIsPrivate:`Le dépôt est privé — la sauvegarde peut s'y faire en toute sécurité.`,repoIsPublicWarning:`Le dépôt est PUBLIC. Les sauvegardes Bambuddy contiennent les identifiants MQTT, les jetons Home Assistant, les jetons Prometheus, votre adresse Bambu Cloud, et les codes d'accès des imprimantes via les K-profils. L'enregistrement est bloqué tant que le dépôt n'est pas passé en privé dans les paramètres de votre hébergeur.`,repoVisibilityUnknown:`Impossible de déterminer la visibilité du dépôt. Bambuddy refuse toute sauvegarde vers un dépôt non confirmé privé ; l'enregistrement sera bloqué.`,repositoryUrl:`URL du dépôt`,repoUrlPlaceholderGitHub:`https://github.com/username/repo-name`,repoUrlPlaceholderGitea:`https://gitea.example.com/username/repo-name`,repoUrlPlaceholderForgejo:`https://forgejo.example.com/username/repo-name`,repoUrlPlaceholderGitLab:`https://gitlab.com/username/repo-name`,allowInsecureHttp:`Autoriser HTTP non sécurisé`,allowInsecureHttpHint:`Activer pour les instances auto-hébergées sur des réseaux privés sans TLS`,personalAccessToken:`Jeton d'accès personnel`,tokenSaved:`(enregistré)`,enterNewToken:`Entrez un nouveau jeton pour mettre à jour`,tokenHintGitHub:`Jeton à granularité fine avec accès en lecture et écriture à Contents, ou jeton classique avec la portée repo.`,tokenHintGitLab:`Jeton avec la portée api, ou read_repository et write_repository ensemble.`,tokenHintGitea:`Jeton avec la portée write:repository.`,tokenHintForgejo:`Jeton avec la portée write:repository. Un jeton limité à ce seul dépôt suffit.`,branch:`Branche`,provider:`Fournisseur Git`,providerGitHub:`GitHub`,providerGitLab:`GitLab`,providerGitea:`Gitea`,providerForgejo:`Forgejo`,manualOnly:`Manuel uniquement`,hourly:`Toutes les heures`,daily:`Quotidien`,weekly:`Hebdomadaire`,includeInBackup:`Inclure dans la sauvegarde`,kProfiles:`K-Profils`,kProfilesDescription:`Calibration de l'avance de pression des imprimantes connectées`,noPrintersConnected:`Aucune imprimante connectée`,printersConnected:`{{connected}}/{{total}} connectées`,cloudProfiles:`Profils Cloud`,cloudProfilesDescription:`Préréglages de filament, imprimante et processus depuis Bambu Cloud et Orca Cloud`,cloudProfilesAccounts:`Comptes connectés — Bambu Cloud : {{bambu}}, Orca Cloud : {{orca}}`,appSettings:`Paramètres de l'application`,appSettingsDescription:`Configuration Bambuddy (base de données complète)`,spoolInventory:`Inventaire des bobines`,spoolInventoryDescription:`Bobines de filament, historique d'utilisation et suivi des coûts`,printArchives:`Archives d'impression`,printArchivesDescription:`Métadonnées de l'historique d'impression (pas de fichiers gcode/3MF)`,lastBackupAt:`Dernière sauvegarde :`,noBackupsYet:`Aucune sauvegarde pour l'instant`,next:`Prochaine :`,startingBackup:`Démarrage de la sauvegarde...`,test:`Tester`,enableBackup:`Activer la sauvegarde`,testConnection:`Tester la connexion`,enterRepoUrl:`Entrez l'URL du dépôt`,enterRepoAndToken:`Entrez l'URL du dépôt et le jeton d'accès`,repoRequired:`L'URL du dépôt est requise`,tokenRequired:`Le jeton d'accès est requis`,githubBackupEnabled:`Sauvegarde GitHub activée`,tokenUpdated:`Jeton mis à jour`,settingsSaved:`Paramètres enregistrés`,failedToSave:`Échec de l'enregistrement : {{message}}`,backupCompleteFiles:`Sauvegarde terminée - {{count}} fichiers mis à jour`,backupSkippedNoChanges:`Sauvegarde ignorée - aucun changement`,backupFailed2:`Échec de la sauvegarde : {{message}}`,clearedLogs:`{{count}} journaux supprimés`,failedToClearLogs:`Échec de la suppression des journaux : {{message}}`,restoreFromGit:{button:`Restaurer depuis Git`,title:`Restaurer depuis la sauvegarde Git`,subtitle:`Choisissez un commit et ce qui doit être restauré`,commitLabel:`Commit de sauvegarde`,latestCommit:`Dernière sauvegarde (tête de branche)`,categoriesLabel:`Éléments à restaurer`,inspecting:`Lecture du contenu de la sauvegarde...`,itemCount:`{{count}} dans la sauvegarde`,overwriteLabel:`Écraser les entrées existantes`,overwriteOn:`Les entrées existantes seront mises à jour depuis la sauvegarde.`,overwriteOff:`Seules les entrées manquantes sont ajoutées ; les existantes ne sont pas modifiées.`,selectedCount:`{{count}} sélectionné(s)`,restoring:`Restauration...`,confirmTitle:`Restaurer depuis la sauvegarde ?`,confirmMessage:`Les catégories sélectionnées seront restaurées depuis ce commit. Les entrées manquantes sont ajoutées, les existantes restent inchangées.`,confirmMessageOverwrite:`Les catégories sélectionnées seront restaurées depuis ce commit et les entrées déjà présentes localement seront écrasées. Cette action est irréversible.`,kprofilesOverwriteCaveat:`Les profils K sont l'exception : écrire un emplacement remplace toujours la calibration sur l'imprimante.`,tally:`{{restored}} restaurés, {{skipped}} ignorés, {{failed}} en échec`,reloadHint:`Rechargez Bambuddy pour que les données restaurées apparaissent partout.`,partialHint:`Les catégories listées ci-dessus sont terminées et enregistrées. Celles qui manquent n'ont pas été exécutées.`,failed:`Échec de la restauration.`,loadFailed:`Impossible de lire le dépôt de sauvegarde.`,details:{notPresent:`Absent de ce commit de sauvegarde`,unreadableJson:`JSON illisible : {{paths}}`,settingsNoPayload:`Aucun réglage dans les données`,settingsCredentialsWillSkip:`{{count}} clés ressemblant à des identifiants seront ignorées`,settingsCompanionWillSkip:`{{count}} clés ressemblant à des identifiants seront ignorées, et {{companion}} interrupteurs qui en dépendent resteront désactivés`,settingsCompanionOnlyWillSkip:`{{companion}} interrupteurs resteront désactivés - les identifiants dont chacun a besoin ne peuvent pas être restaurés depuis une sauvegarde`,spoolsUsageCount:`dont {{count}} enregistrements de consommation`,archivesMetadataOnly:`Métadonnées uniquement - les fichiers 3MF et les miniatures ne sont pas dans une sauvegarde Git`,kprofilesPrinterCount:`sur {{count}} imprimantes`},notes:{noData:`Aucune donnée de ce type dans cette sauvegarde`,archivesPrinterMissing:`Certaines archives référençaient des imprimantes qui n'existent plus - lien effacé`,archivesProjectMissing:`Certaines archives référençaient des projets qui n'existent plus - lien effacé`,archivesOwnerCleared:`Certaines archives référençaient des utilisateurs qui n'existent plus - propriétaire effacé, elles ne sont donc visibles que par les utilisateurs disposant de la permission archives:read_all jusqu'à ce qu'un administrateur les réattribue`,archivesOwnerUnmatched:`Certaines archives désignent un propriétaire absent de cette instance - le propriétaire a été effacé plutôt que déduit de l'identifiant utilisateur de la sauvegarde, elles ne sont donc visibles que par les utilisateurs disposant de la permission archives:read_all jusqu'à ce qu'un administrateur les réattribue`,archivesOwnerUnknown:`Certaines archives ont été restaurées sans propriétaire - cette sauvegarde n'en enregistre aucun, elles ne sont donc visibles que par les utilisateurs disposant de la permission archives:read_all jusqu'à ce qu'un administrateur les réattribue`,archivesUndeleted:`Les archives supprimées depuis la sauvegarde sont de nouveau visibles - l'écrasement était activé`,archivesMetadataOnly:`Les archives restaurées ne contiennent que des métadonnées - les fichiers 3MF et les miniatures ne sont pas dans une sauvegarde Git`,spoolUsageUnresolved:`{{count}} enregistrements de consommation ignorés - leur bobine ne figure pas dans la liste des bobines de cette sauvegarde, il n'y a donc rien à quoi les rattacher.`,spoolUsageUnlinked:`{{count}} enregistrements de consommation restaurés sans leur lien vers l'historique d'impression - sélectionnez Archives d'impression en même temps que l'Inventaire des bobines pour le conserver.`,spoolTagKept:`{{count}} étiquettes de bobine laissées telles quelles - la sauvegarde aurait effacé une étiquette scannée depuis, ou l'aurait déplacée sur une seconde bobine.`,settingsCredentialsSkipped:`{{count}} clés ressemblant à des identifiants ignorées - ressaisissez les secrets manuellement`,settingsAuthSkipped:`{{count}} réglages d'authentification ignorés - modifiez-les dans Réglages > Authentification pour que les contrôles de verrouillage s'appliquent`,settingsCompanionSkipped:`{{keys}} laissés désactivés - l'identifiant dont chacun a besoin ne peut pas être restauré depuis une sauvegarde et cette instance n'en a aucun enregistré ; les activer laisserait donc l'intégration sans authentification`,settingsMqttRelayFailed:`Réglages MQTT restaurés, mais le relais n'a pas pu être reconnecté - redémarrez Bambuddy`,kprofilesAlwaysOverwrite:`Les profils K écrasent toujours l'emplacement correspondant sur l'imprimante`,kprofilesAckUnreliable:`Une imprimante qui ne répond pas compte quand même comme restaurée - vérifiez les profils sur l'imprimante`,kprofilesPrinterMissing:`Aucune imprimante avec le numéro de série {{serial}} - ignoré`,kprofilesPrinterOffline:`{{printer}} ({{serial}}) n'est pas connectée - ignoré`,kprofilesUnknownNozzle:`Diamètre de buse inattendu {{nozzle}} pour {{serial}} - envoyé tel quel`,kprofilesUnmatched:`{{count}} profils pour {{nozzle}} n'avaient pas d'équivalent sur {{printer}} - ajoutés comme nouveaux profils`,kprofilesSendFailed:`Impossible d'envoyer les profils {{nozzle}} à {{printer}} ({{serial}})`,kprofilesRefused:`{{printer}} ({{serial}}) a refusé les profils {{nozzle}} : {{reason}}`,kprofilesStepFailed:`L'étape des profils K n'a pas pu être terminée - {{reason}}. Ce qui a été restauré auparavant reste enregistré.`}},history:`Historique`,clear:`Effacer`,date:`Date`,status:`Statut`,trigger:`Type`,triggers:{manual:`Sauvegarde (manuelle)`,scheduled:`Sauvegarde (planifiée)`,restore:`Restauration`},commit:`Commit`,localBackup:`Sauvegarde locale`,localBackupDescription:`Créez une sauvegarde complète de vos données Bambuddy incluant la base de données, les archives, les téléchargements et tous les fichiers.`,downloadBackupLabel:`Télécharger la sauvegarde`,completeBackupZip:`Sauvegarde complète : base de données + tous les fichiers (ZIP)`,download:`Télécharger`,preparingBackup:`Préparation de la sauvegarde...`,creatingArchive:`Création de l'archive de sauvegarde... Cela peut prendre un moment pour les archives volumineuses.`,downloadingFile:`Téléchargement du fichier de sauvegarde...`,backupDownloaded:`Sauvegarde téléchargée avec succès`,failedToCreateBackup:`Échec de la création de la sauvegarde : {{message}}`,restore:`Restaurer`,restoreReplacesAll:`La restauration remplace toutes les données.`,restoreReplacesAllDetail:`Votre base de données et vos fichiers actuels seront complètement remplacés. Un redémarrage est nécessaire après la restauration.`,restoreConfirmTitle:`Restaurer la sauvegarde`,restoreConfirmMessage:`Êtes-vous sûr de vouloir restaurer depuis "{{filename}}" ? Cela remplacera complètement votre base de données et tous vos fichiers. L'application devra être redémarrée après la restauration.`,restoreConfirmButton:`Restaurer la sauvegarde`,uploadingFile:`Téléchargement du fichier de sauvegarde...`,backupRestoredRestart:`Sauvegarde restaurée. Veuillez redémarrer Bambuddy.`,failedToRestore:`Échec de la restauration. Veuillez vérifier le format du fichier.`,reloadNow:`Recharger maintenant`,creatingBackup:`Création de la sauvegarde`,restoringBackup:`Restauration de la sauvegarde`,preparing:`Préparation...`,processing:`Traitement...`,doNotClosePage:`Veuillez ne pas fermer cette page ni naviguer ailleurs. Cette opération peut prendre plusieurs minutes pour les sauvegardes volumineuses.`,restoring:`Restauration...`,restoreComplete:`Restauration terminée`,restoreFailed2:`Échec de la restauration`,importSettings:`Importer les paramètres depuis un fichier de sauvegarde`,pleaseWaitRestoring:`Veuillez patienter pendant la restauration de vos données`,selectBackupFile:`Cliquez pour sélectionner un fichier de sauvegarde (.json ou .zip)`,duplicateHandling:`Comment fonctionne la gestion des doublons :`,matchPrinters:`Imprimantes`,matchPrintersBy:`correspondance par numéro de série`,matchSmartPlugs:`Prises connectées`,matchSmartPlugsBy:`correspondance par adresse IP`,matchNotificationProviders:`Fournisseurs de notifications`,matchNotificationProvidersBy:`correspondance par nom`,matchFilaments:`Filaments`,matchFilamentsBy:`correspondance par nom + type + marque`,matchArchives:`Archives`,matchArchivesBy:`correspondance par hash de contenu (toujours ignoré)`,matchPendingUploads:`Téléchargements en attente`,matchPendingUploadsBy:`correspondance par nom de fichier`,matchSettingsTemplates:`Paramètres et modèles`,matchSettingsTemplatesBy:`toujours écrasés`,replaceExisting:`Remplacer les données existantes`,keepExisting:`Conserver les données existantes`,overwriteDescription:`Écraser les éléments qui existent déjà avec les données de sauvegarde`,keepDescription:`Restaurer uniquement les éléments qui n'existent pas encore`,overwriteCaution:`Attention :`,overwriteWarning:`L'écrasement remplacera vos configurations actuelles par les données de la sauvegarde. Les codes d'accès des imprimantes ne sont jamais écrasés pour des raisons de sécurité.`,cancel:`Annuler`,processingBackup:`Traitement du fichier de sauvegarde...`,itemsRestored:`Éléments restaurés`,itemsSkipped:`Éléments ignorés`,restored:`Restaurés`,skippedAlreadyExist:`Ignorés (existent déjà)`,filesCategory:`Fichiers (3MF, miniatures, etc.)`,andMore:`...et {{count}} de plus`,newApiKeysGenerated:`Nouvelles clés API générées`,keysShownOnce:`Ces clés ne sont affichées qu'une seule fois. Copiez-les maintenant !`,copy:`Copier`,noDataFound:`Aucune donnée à restaurer n'a été trouvée dans le fichier de sauvegarde.`,close:`Fermer`,scheduledBackup:`Sauvegardes planifiées`,scheduledBackupDescription:`Crée automatiquement des instantanés de sauvegarde selon un planning. Le répertoire de sortie peut être monté sur un NAS ou un stockage externe.`,frequency:`Fréquence`,backupTime:`Temps`,retention:`Rétention`,retentionDescription:`Nombre de sauvegardes à conserver`,outputPath:`Chemin de sortie`,outputPathPlaceholder:`Par défaut : {{path}}`,outputPathDescription:`Laisser vide pour l'emplacement par défaut`,runNow:`Exécuter maintenant`,backupFiles:`Fichiers de sauvegarde`,noScheduledBackups:`Aucune sauvegarde`,deleteBackup:`Supprimer`,deleteBackupConfirm:`Supprimer ce fichier de sauvegarde ?`,backupRunning:`Sauvegarde en cours...`,scheduledBackupComplete:`Sauvegarde terminée avec succès`,scheduledBackupFailed:`Échec de la sauvegarde`,nextBackup:`Prochaine sauvegarde`,backupSize:`Taille`,localTimeHint:`Heure locale ({{tz}})`,defaultPathLabel:`Par défaut :`,pathCheck:{title:`Bambuddy ne peut pas écrire dans ce répertoire`,howToFix:`Comment corriger :`,sandboxed:`Le service Bambuddy ne peut pas écrire dans {{path}}. Son unité systemd s'exécute avec ProtectSystem=strict, ce qui rend tout répertoire en dehors des répertoires d'installation, de données et de journaux en lecture seule pour le service - même un répertoire dans lequel vous pouvez écrire depuis votre propre shell.`,read_only:`{{path}} se trouve sur un système de fichiers en lecture seule.`,permission_denied:`Bambuddy n'est pas autorisé à écrire dans {{path}}. Vérifiez le propriétaire et les permissions du répertoire.`,no_space:`Le système de fichiers contenant {{path}} est plein.`,not_a_directory:`{{path}} existe mais n'est pas un répertoire.`,missing:`{{path}} n'existe pas et n'a pas pu être créé.`,error:`Bambuddy ne peut pas écrire dans {{path}}.`,ephemeralTitle:`Ces sauvegardes ne survivront pas à la recréation du conteneur`,container_ephemeral:`{{path}} se trouve dans le conteneur Bambuddy, pas sur l'hôte. Les sauvegardes qui y sont écrites sont perdues à la recréation du conteneur. Montez le répertoire depuis l'hôte :`},categories:{settings:`Paramètres`,notification_providers:`Fournisseurs de notifications`,notification_templates:`Modèles de notifications`,smart_plugs:`Prises connectées`,printers:`Imprimantes`,filaments:`Filaments`,maintenance_types:`Types de maintenance`,archives:`Archives`,projects:`Projets`,pending_uploads:`Téléchargements en attente`,external_links:`Liens externes`,api_keys:`Clés API`}},tags:{title:`Étiquettes`,addTag:`Ajouter Tag`,editTag:`Modifier Tag`,deleteTag:`Supprimer Tag`,tagName:`Nom du Tag`,tagColor:`Couleur du Tag`,noTags:`Aucun tag`,deleteConfirm:`Supprimer ce tag ?`,manageTags:`Gérer les Tags`},uploadModal:{title:`Téléverser des fichiers 3MF`,dragDrop:`Glissez les fichiers .3mf ici`,or:`ou`,browseFiles:`Parcourir`,extractionInfo:`Le modèle d'imprimante est extrait des métadonnées 3MF.`,uploaded:`téléversé`,failed:`échoué`,uploading:`En cours...`,upload:`Téléverser`,uploadFailed:`Échec du téléversement`},confirmOutcome:{title:`Comment votre impression est-elle sortie ?`,good:`Bonne`,reject:`Rebut`,later:`Me redemander plus tard`,noPhoto:`Aucune photo de fin disponible`,savedGood:`Marquée comme bonne pièce`,savedReject:`Marquée comme rebut`,saveFailed:`Impossible d'enregistrer le verdict`,rejectReason:`Raison du rebut (facultatif)`,noReason:`Aucune raison`,saveReject:`Enregistrer`,rejectAndReprint:`Réimprimer`,alreadyGood:`Déjà confirmée comme bonne pièce.`,alreadyRejected:`Déjà marquée comme rebut.`,cardPrompt:`Comment est-elle sortie ?`,sources:{dialog:`Enregistré depuis Bambuddy.`,link:`Enregistré via un lien rapide.`,plateClear:`Enregistré lors de la libération du plateau.`,printerCard:`Enregistré depuis la carte imprimante.`,api:`Enregistré par API.`,reaction:`Enregistré par une réaction dans le chat.`}},editArchive:{title:`Modifier l'archive`,name:`Nom`,namePlaceholder:`Nom de l'impression`,printer:`Imprimante`,noPrinter:`Aucune imprimante`,project:`Projet`,noProject:`Aucun projet`,itemsPrinted:`Nombre de pièces`,itemsPrintedHelp:`Nombre d'objets produits. Indiquez 0 si tout le plateau est raté.`,filamentUsed:`Filament utilisé (g)`,filamentUsedPlaceholder:`p. ex. 46.16`,filamentUsedHelp:`À saisir à la main lorsqu'une impression a été archivée sans son 3MF, afin qu'elle compte quand même dans les totaux de filament. Une nouvelle analyse d'une archive qui possède son 3MF relit la valeur depuis le fichier.`,notes:`Notes`,notesPlaceholder:`Notes sur l'impression...`,externalLink:`Lien externe`,externalLinkPlaceholder:`https://...`,externalLinkHelp:`Lien vers Printables, Thingiverse, etc.`,tags:`Étiquettes`,tagsPlaceholder:`Ajouter des tags...`,addMoreTags:`Plus de tags...`,matchingTags:`Correspondant à "{{query}}"`,existingTags:`Tags existants`,clickToAdd:`(cliquer pour ajouter)`,status:`Statut`,userVerdict:`Verdict de résultat`,verdicts:{none:`Non défini`,good:`Bonne pièce`,reject:`Rebutée`},failureReason:`Raison de l'échec`,selectReason:`Choisir raison...`,photos:`Photos du résultat`,photosHelp:`Cliquez sur + pour ajouter des photos`,printResult:`Résultat d'impression`,saving:`Enregistrement...`,failureReasons:{adhesionFailure:`Défaut d'adhésion`,spaghettiDetached:`Spaghetti / Détaché`,layerShift:`Décalage de couche`,cloggedNozzle:`Buse bouchée`,filamentRunout:`Filament fini`,warping:`Warping (Déformation)`,stringing:`Stringing (Cheveux d'ange)`,underExtrusion:`Sous-extrusion`,powerFailure:`Coupure courant`,userCancelled:`Annulé par l'utilisateur`,noStatusUpdate:`Aucune mise à jour d'état reçue`,other:`Autre`},statuses:{completed:`Réussie`,failed:`Échouée`,aborted:`Annulée`,printing:`Impression`}},kProfiles:{title:`Profils K`,noPrintersConfigured:`Aucune imprimante configurée`,addPrinterInSettings:`Ajoutez une imprimante pour gérer les K-profiles`,noActivePrinters:`Aucune imprimante active`,enablePrinterConnection:`Activez la connexion pour voir les K-profiles`,loadingProfiles:`Chargement des K-Profiles...`,printerOffline:`Imprimante hors ligne`,printerOfflineDesc:`L'imprimante doit être allumée.`,noMatchingProfiles:`Aucun profil correspondant`,noMatchingProfilesDesc:`Ajustez votre recherche`,noKProfiles:`Aucun K-Profile`,noKProfilesDesc:`Aucun profil trouvé pour une buse de {{diameter}}mm`,createFirstProfile:`Créer le premier profil`,printer:`Imprimante`,nozzle:`Buse`,refresh:`Rafraîchir`,addProfile:`Ajouter Profil`,export:`Exporter`,import:`Importer`,select:`Choisir`,selectAll:`Tout sélectionner`,delete:`Supprimer`,searchPlaceholder:`Nom ou filament...`,allExtruders:`Tous les extrudeurs`,leftOnly:`Gauche uniquement`,rightOnly:`Droite uniquement`,allFlow:`Tout débit`,hfOnly:`HF uniquement`,sOnly:`S uniquement`,sortName:`Tri : Nom`,sortKValue:`Tri : Valeur K`,sortFilament:`Tri : Filament`,leftExtruder:`Extrudeur gauche`,rightExtruder:`Extrudeur droit`,modal:{addTitle:`Ajouter K-Profile`,editTitle:`Modifier K-Profile`,profileName:`Nom du profil`,profileNamePlaceholder:`ex: Mon profil PLA`,kValue:`Valeur K`,kValuePlaceholder:`0.020`,kValueHelp:`Plage type : 0.01-0.06 (PLA), 0.02-0.10 (PETG)`,filament:`Filament`,selectFilament:`Choisir filament...`,source:{local:`Importé`,orcaCloud:`Orca Cloud`,bambuCloud:`Bambu Cloud`,builtin:`Inclus`},noFilamentsHelp:`Aucun filament disponible. Connectez-vous à Bambu Cloud ou importez des préréglages dans Profils → Profils locaux.`,searchFilaments:`Rechercher des filaments...`,noFilamentMatches:`Aucun filament ne correspond à cette recherche`,flowType:`Type de débit`,highFlow:`Haut Débit (HF)`,standard:`Standard`,nozzleSize:`Taille buse`,extruder:`Extrudeur`,extruders:`Extrudeurs`,left:`Gauche`,right:`Droite`,notes:`Notes (locales)`,notesPlaceholder:`Notes sur ce profil...`,notesHelp:`Enregistré dans Bambuddy, pas sur l'imprimante`,syncing:`Sync avec l'imprimante...`,savingExtruder:`Sauvegarde extrudeur {{current}}/{{total}}...`,pleaseWait:`Patientez...`},deleteConfirm:{title:`Supprimer profil`,cannotUndo:`Action irréversible`,message:`Supprimer "{{name}}" de l'imprimante ?`},bulkDelete:{title:`Supprimer les profils`,cannotUndo:`Action irréversible`,message:`Supprimer les {{count}} profils de l'imprimante ?`},toast:{profileSaved:`Profil K enregistré`,profilesSaved:`Profil K enregistré sur {{count}} extrudeur(s)`,selectAtLeastOneExtruder:`Sélectionnez un extrudeur`,selectFilament:`Sélectionnez d’abord un filament`,filamentNotResolvable:`Aucun identifiant de filament Bambu pour {{name}} — l’imprimante ne peut pas enregistrer de profil`,profileDeleted:`Profil K supprimé`,profilesDeleted:`{{count}} profils supprimés`,exportedProfiles:`{{count}} profils exportés`,importedProfiles:`{{count}} sur {{total}} profils importés`,noProfilesToExport:`Rien à exporter`,invalidFileFormat:`Format invalide`,failedToParseImport:`Échec analyse fichier`,failedToSaveBatch:`Échec enregistrement groupé`,noteSaved:`Note enregistrée`,failedToSaveNote:`Échec note`},permission:{noRead:`Pas d'autorisation lecture`,noCreate:`Pas d'autorisation création`,noUpdate:`Pas d'autorisation mise à jour`,noDelete:`Pas d'autorisation suppression`,noExport:`Pas d'autorisation export`,noImport:`Pas d'autorisation import`}},virtualPrinter:{title:`Imprimante Virtuelle`,running:`En cours`,stopped:`Arrêtée`,description:{default:`Active une imprimante qui apparaît dans Bambu Studio. Les fichiers envoyés sont archivés sans impression.`,proxy:`Active un proxy qui relaie le trafic vers une imprimante réelle, permettant l'impression à distance.`},enable:{title:`Activer l'imprimante virtuelle`,visibleInSlicer:`Visible comme "Bambuddy" dans le Slicer`,proxyingTo:`Proxy vers {{name}}`,notActive:`Inactive`},model:{title:`Modèle d'imprimante`,description:`Choisissez le modèle à émuler.`,restartWarning:`Changer le modèle redémarrera le service`},accessCode:{title:`Code d'accès`,isSet:`Code défini`,notSet:`Code requis pour activer`,placeholder:`Code 8 char`,placeholderChange:`Entrez nouveau code`,hint:`Exactement 8 caractères. Sert à l'auth du Slicer.`,charCount:`({{count}}/8)`,inheritedFromTarget:`Hérité de l'imprimante cible`,derivedFromTargetHint:`Utilise le code d'accès de l'imprimante cible. Le pont transmet l'authentification du slicer à l'imprimante réelle, donc les codes doivent correspondre — modifiez le code dans les paramètres de l'imprimante.`,reveal:`Afficher le code d'accès`,hide:`Masquer le code d'accès`},targetPrinter:{title:`Imprimante cible`,configured:`Cible configurée`,notConfigured:`Imprimante requise pour mode Proxy`,placeholder:`Choisir imprimante...`,hint:`L'imprimante doit être en mode LAN.`,noPrinters:`Ajoutez une imprimante réelle d'abord.`},remoteInterface:{title:`Exception Interface Réseau`,configured:`Override actif`,optional:`Optionnel - si IP auto est fausse (VPN, Docker, multi-NIC).`,placeholder:`Auto (défaut)...`,hint:`Force l'IP annoncée via SSDP.`},mode:{title:`Mode`,archive:`Archiver`,archiveDesc:`Archive immédiatement`,review:`Revue`,reviewDesc:`Attendre revue avant archive`,queue:`File`,queueDesc:`Archiver et ajouter à la file`,proxy:`Proxy`,proxyDesc:`Relais vers imprimante réelle`},autoDispatch:{title:`Lancement automatique`,description:`Lancer automatiquement les impressions ajoutées à la file. Désactivé, les impressions attendent un lancement manuel.`},queueForceColorMatch:{title:`Forcer la correspondance des couleurs`,description:`Refuser l'envoi vers une imprimante qui n'a pas exactement le type de filament et la couleur chargés. Désactivé par défaut — sans cela, la file d'attente utilise uniquement la correspondance par modèle et peut choisir une imprimante avec la mauvaise couleur.`},saveAmsMapping:{title:`Enregistrer le mappage AMS`,description:`Conserve dans l'archive le choix d'emplacement AMS propre au slicer (depuis la commande MQTT project_file), afin qu'une réimpression ultérieure réutilise la même bobine physique au lieu de la redéduire à partir du type/de la couleur du fichier. Désactivé par défaut.`},gcodeInjection:{title:`Injection G-code`,description:`Applique les extraits de G-code configurés par modèle dans les Paramètres aux travaux de ce VP. Désactivé par défaut.`},tailscaleDisabled:{title:`Intégration Tailscale`,description:`Activez pour marquer ce VP comme exposé via Tailscale. Affiche l'adresse Tailscale de l'hôte pour que vous sachiez quelle IP coller dans le slicer. L'étape d'import CA est inchangée — cette bascule n'a aucun effet sur les certificats.`},setupRequired:{title:`Configuration requise`,description:`Nécessite des réglages système (ports, pare-feu).`,readGuide:`Lire le guide de configuration`},howItWorks:{title:`Fonctionnement`,step1:`Sur le même LAN, les imprimantes virtuelles apparaissent automatiquement dans votre slicer (Bambu Studio / OrcaSlicer). Depuis d'autres réseaux, ajoutez-les manuellement par adresse IP et code d'accès.`,step2:`En mode Archive, Revue et File d'attente, utilisez le bouton "Envoyer" dans votre slicer pour envoyer des fichiers 3MF à Bambuddy. Le slicer affichera "Impression réussie" — le fichier est stocké, pas imprimé.`,step3:`En mode Proxy, l'imprimante virtuelle relaie tout le trafic vers une vraie imprimante — les impressions démarrent immédiatement comme en connexion directe.`},status:{title:`Détails du statut`,printerName:`Nom`,model:`Modèle`,serialNumber:`Série`,mode:`Mode`,pendingFiles:`Fichiers en attente`,targetPrinter:`Cible`,ftpPort:`Port FTP`,mqttPort:`Port MQTT`,ftpConnections:`Connexions FTP`,mqttConnections:`Connexions MQTT`},toast:{updated:`Réglages virtuels mis à jour`,failedToUpdate:`Échec mise à jour`,copyFailed:`Échec de la copie — veuillez sélectionner le texte manuellement`,accessCodeRequired:`Code d'accès requis`,targetPrinterRequired:`Imprimante cible requise`,bindIpRequired:`Veuillez d'abord définir une adresse IP`,accessCodeEmpty:`Le code ne peut pas être vide`,accessCodeLength:`Le code doit faire 8 caractères`,targetCodeChangedRebind:`Le code d'accès correspond désormais à la nouvelle imprimante cible. Réajoutez cet appareil dans votre slicer pour récupérer le nouveau code.`,created:`Imprimante virtuelle créée`,failedToCreate:`Échec de la création de l'imprimante virtuelle`,deleted:`Imprimante virtuelle supprimée`,failedToDelete:`Échec de la suppression de l'imprimante virtuelle`},list:{title:`Imprimantes virtuelles`,add:`Ajouter`,addFirst:`Ajouter une imprimante virtuelle`,empty:`Aucune imprimante virtuelle configurée. Ajoutez-en une pour commencer.`},bindIp:{title:`Interface réseau`,placeholder:`Sélectionner interface...`,hint:`Interface réseau sur laquelle cette imprimante virtuelle écoute. Doit être unique par imprimante.`},proxy:{accessCodeHint:`En mode proxy, utilisez le code d'accès de l'imprimante cible dans le slicer. La connexion est transmise de manière transparente à l'imprimante réelle.`},addDialog:{title:`Ajouter une imprimante virtuelle`,name:`Nom`,hint:`Vous pourrez configurer le code d'accès, l'imprimante cible et d'autres paramètres après la création.`,create:`Créer`},deleteConfirm:{title:`Supprimer l'imprimante virtuelle`,message:`Êtes-vous sûr de vouloir supprimer "{{name}}" ? Cela arrêtera tous les services de cette imprimante.`},archiveNameSource:{title:`Source du nom d'archive`,description:`Choisissez comment les nouvelles archives sont nommées lorsque les fichiers arrivent via l'imprimante virtuelle. "Métadonnées" utilise le titre intégré par le slicer dans le 3MF (par défaut). "Nom de fichier" utilise le nom envoyé par Bambu Studio en FTP. Note : Bambu Studio écrase le nom que vous saisissez dans la boîte "envoyer à l'imprimante" avec le champ Titre du 3MF lorsque celui-ci est présent, les deux modes produisent donc souvent la même chaîne.`,metadata:`Métadonnées`,filename:`Nom de fichier`},caCert:{title:`Certificat du slicer`,description:`Les imprimantes virtuelles utilisent un certificat TLS signé par l'autorité de certification Bambuddy. Importez ce certificat CA dans le magasin de confiance de votre slicer une seule fois pour qu'il accepte la connexion — plus besoin de le copier depuis la ligne de commande.`,copy:`Copier`,copied:`Copié`,download:`Télécharger`,fingerprint:`SHA-256`}},modelViewer:{stepConverting:`Conversion du modèle STEP… {{seconds}} s`,stepSlowHint:`Les gros fichiers STEP peuvent prendre une minute ou plus.`,openInSlicer:`Ouvrir dans le Slicer`,openInSlicerWith:`Ouvrir dans {{slicer}}`,moreSlicerOptions:`Plus d'options de slicer`,openInSlicerFailed:`Impossible d'ouvrir dans le slicer`,tabs:{model:`Modèle 3D`},notAvailable:`indisponible`,plates:`Plateaux`,allPlates:`Tous les plateaux`,plateNumber:`Plateau {{number}}`,plateCount:`{{count}} plateau`,plateCount_other:`{{count}} plateaux`,objectCount:`{{count}} objet`,objectCount_other:`{{count}} objets`,filamentCount:`{{count}} filament`,filamentCount_other:`{{count}} filaments`,eta:`Fin {{minutes}} min`,noPreview:`Aucun aperçu pour ce fichier`,pagination:{pageOf:`Page {{current}} sur {{total}}`,prev:`Préc`,next:`Suiv`},errors:{failedToLoad:`Échec chargement fichier`,noMeshes:`Aucun maillage trouvé dans le 3MF`,unsupportedFormat:`Format non supporté`}},maintenanceDescriptions:{lubricateCarbonRods:`Appliquer du lubrifiant sur les tiges carbone pour un mouvement fluide`,lubricateRails:`Appliquer du lubrifiant sur les rails linéaires`,cleanNozzle:`Nettoyer buse et hotend anti-bouchage`,checkBelts:`Tension des courroies pour la précision`,cleanBuildPlate:`Nettoyage plateau pour l'adhésion`,checkExtruder:`Usure des engrenages de l'extrudeur`,checkCooling:`Bon fonctionnement des ventilateurs`,generalInspection:`Inspection générale de la machine`,cleanCarbonRods:`Nettoyer les tiges carbone (friction)`,lubricateSteelRods:`Appliquer du lubrifiant sur les tiges en acier pour un mouvement fluide`,cleanSteelRods:`Nettoyer les tiges en acier (friction)`,cleanLinearRails:`Essuyer les rails linéaires (poussière/débris)`,checkPtfeTube:`Usure ou dommage du tube PTFE`,replaceHepaFilter:`Filtre HEPA pour la qualité de l'air`,replaceCarbonFilter:`Filtre charbon actif (odeurs)`,lubricateLeftNozzleRail:`Lubrifier le rail de buse gauche (Série H2)`},haSensors:{label:`Capteurs`,unavailable:`Indisponible`,blocksPrints:`{{entity}} — retient les impressions tant que l'alerte est active`,states:{open:`Ouvert`,closed:`Fermé`,unlocked:`Déverrouillé`,locked:`Verrouillé`,detected:`Détecté`,clear:`Dégagé`,wet:`Humide`,dry:`Sec`,problem:`Problème`,ok:`OK`,running:`En marche`,stopped:`Arrêté`,on:`Activé`,off:`Désactivé`},sectionTitle:`Capteurs Home Assistant (imprimantes)`,add:`Ajouter un capteur`,addTitle:`Ajouter un capteur Home Assistant`,editTitle:`Modifier le capteur Home Assistant`,empty:`Aucun capteur pour l'instant. Liez un contact de porte ou un thermomètre depuis Home Assistant pour l'afficher sur la carte imprimante.`,unknownPrinter:`Imprimante inconnue`,badgeBlocks:`Retient les impressions`,badgeNotifies:`Notifie`,badgeHidden:`Masqué sur la carte`,printer:`Imprimante`,entity:`Entité`,searchPlaceholder:`Rechercher des entités...`,noEntities:`Aucune entité correspondante`,name:`Nom affiché`,alertWhen:`Alerter quand`,alertNever:`Jamais — affichage seul`,alertAbove:`Au-dessus de`,alertBelow:`En dessous de`,alertHint:`L'état d'alerte met le capteur en évidence sur la carte imprimante et active les options ci-dessous.`,showOnCard:`Afficher sur la carte imprimante`,notifyOnAlert:`Envoyer une notification au déclenchement de l'alerte`,blockPrint:`Retenir les impressions en file tant que l'alerte est active`,blockPrintHint:`Les travaux restent en file et démarrent d'eux-mêmes une fois le capteur revenu à la normale. Ignoré tant que Home Assistant est injoignable.`,toast:{created:`Capteur ajouté`,updated:`Capteur enregistré`,deleted:`Capteur supprimé`},error:{pickEntity:`Choisissez une entité Home Assistant`,nameRequired:`Saisissez un nom affiché`,printerRequired:`Choisissez une imprimante`,alertRequired:`Définissez d'abord une condition d'alerte`}},locationHaSensors:{sectionTitle:`Capteurs Home Assistant (emplacements de stockage)`,sectionDescription:`Associez des capteurs de température, d'humidité ou de batterie Home Assistant à vos emplacements de stockage pour afficher les relevés en direct sur la fiche du filament et dans le tableau. Un seul capteur par catégorie est autorisé par emplacement.`,add:`Ajouter un capteur`,addTitle:`Ajouter un capteur Home Assistant`,editTitle:`Modifier le capteur Home Assistant`,empty:`Aucun capteur pour l'instant. Liez un capteur de température ou d'humidité depuis Home Assistant pour l'afficher sur la carte filament.`,unknownLocation:`Emplacement inconnu`,location:`Emplacement de stockage`,showOnCard:`Afficher sur la carte filament`,overwriteConfirm:{title:`Remplacer le capteur existant\xA0?`,messageTemperature:`« {{location}} » a déjà un capteur de température lié : {{name}}. Continuer le remplacera.`,messageHumidity:`« {{location}} » a déjà un capteur d'humidité lié : {{name}}. Continuer le remplacera.`,messageBattery:`« {{location}} » a déjà un capteur de batterie lié : {{name}}. Continuer le remplacera.`},autoAdd:{confirmTitle:`Ajouter aussi les autres capteurs ?`,confirmMessage:`Bambuddy a également trouvé d'autres capteurs pour cet emplacement. Choisissez ceux à ajouter aussi.`,added:`Également ajouté : {{names}}`,noneFound:`Aucun capteur de température, d'humidité ou de batterie correspondant trouvé pour cet emplacement.`,onlyThisOne:`Seulement celui-ci`},options:{buttonLabel:`Options des capteurs`,title:`Options des capteurs d'emplacement`,description:`Ces valeurs sont utilisées lorsqu'un capteur de température, d'humidité ou de batterie est lié automatiquement avec le premier capteur d'un emplacement.`,generalSettings:`Paramètres généraux`,pollInterval:`Intervalle de mise à jour (secondes)`,pollIntervalHint:`Fréquence à laquelle Bambuddy interroge Home Assistant et actualise les valeurs des capteurs à l'écran. Minimum 60 secondes.`,colorizeValues:`Colorer les valeurs des capteurs selon leurs seuils d'alerte`,aboveColor:`Couleur au-dessus du seuil`,belowColor:`Couleur en dessous du seuil`,optimalColor:`Couleur pour la valeur optimale`,colors:{red:`Rouge`,orange:`Orange`,yellow:`Jaune`,green:`Vert`,blue:`Bleu`,purple:`Violet`,pink:`Rose`},saved:`Options enregistrées`,saveFailed:`Échec de l'enregistrement des options`,reset:`Réinitialiser`,resetConfirm:{title:`Réinitialiser tous les capteurs d'emplacement existants ?`,message:`Cela écrase les seuils d'alerte, les notifications et la visibilité sur la carte de tous les capteurs de température, d'humidité et de batterie d'emplacement existants avec les valeurs configurées ci-dessus, et restaure le nom de chaque capteur avec son nom convivial Home Assistant — les capteurs d'imprimante ne sont pas concernés. Cette action est irréversible. Selon le nombre de capteurs, cela peut prendre un moment.`},resetDone:`Appliqué à {{count}} capteurs d'emplacement`,resetFailed:`Échec de la réinitialisation des capteurs d'emplacement`},deleteAllConfirm:{title:`Supprimer tous les capteurs ?`,message:`Cela supprime les {{count}} capteurs liés à « {{location}} ». Cette action est irréversible.`},currentlyBound:`Actuellement lié : {{entity}}`,error:{locationRequired:`Choisissez un emplacement de stockage`},toast:{created:`Capteur ajouté`,updated:`Capteur enregistré`,deleted:`Capteur supprimé`}},smartPlugs:{offline:`Hors ligne`,admin:`Administrateur`,openPlugAdminPage:`Page admin de la prise`,deleteSmartPlug:`Supprimer la prise`,turnOnSmartPlug:`Allumer la prise`,turnOffSmartPlug:`Éteindre la prise`,turnOn:`Allumer`,turnOff:`Éteindre`,addSmartPlug:{scanningNetwork:`Scan réseau...`,chooseEntity:`Choisir une entité...`,connectionFailed:`Échec connexion`,searchEntities:`Chercher entités...`,searchPowerSensors:`Capteurs puissance...`,searchEnergySensors:`Capteurs énergie...`,placeholders:{plugName:`Prise Salon`,mqttStateOnValue:`ON, true, 1`,mqttSameAsPower:`Identique au topic puissance, ou différent`}},linkedTo:`Lié à :`,monitorOnly:`Surveillance uniquement`,alerts:`Alertes`,scheduleOn:`À {{time}}`,scheduleOff:`Désactivé {{time}}`,on:`On`,off:`Désactivé`,power:`Puissance`,kwhToday:`kWh Aujourd'hui`,settings:`Paramètres`,automationSettings:`Paramètres d'automatisation`,showInSwitchbar:`Afficher dans la barre de commutateurs`,quickAccessSidebar:`Accès rapide depuis la barre latérale`,enabled:`Activé`,enableAutomation:`Activer l'automatisation pour cette prise`,autoOn:`Auto Activé`,autoOnDescription:`Allumer au démarrage de l'impression`,autoOff:`Auto Désactivé`,autoOffDescription:`Éteindre à la fin de l'impression (unique)`,autoOffPersistent:`Garder activé`,autoOffPersistentDescription:`Rester activé entre les impressions au lieu d'une seule fois`,controlsPrinterPower:`Alimente l'imprimante`,controlsPrinterPowerDescription:`Désactivez si cette prise n'alimente qu'un accessoire (ventilateur de filtre, éclairage). Sinon, l'éteindre marque l'imprimante hors ligne.`,autoOffAfterDrying:`Arrêt auto après séchage`,autoOffAfterDryingDescription:`Éteindre à la fin du séchage de l'AMS`,delayAfterDryingMinutes:`Délai après séchage (minutes)`,turnOffDelayMode:`Mode de délai d'extinction`,time:`Temps`,temp:`Temp.`,delayMinutes:`Délai (minutes)`,tempThreshold:`Seuil de température (°C)`,tempThresholdDescription:`S'éteint lorsque la buse refroidit en dessous de cette température`,edit:`Modifier`,deleteConfirm:`Êtes-vous sûr de vouloir supprimer "{{name}}" ? Cette action est irréversible.`,turnOnConfirm:`Êtes-vous sûr de vouloir allumer "{{name}}" ?`,turnOffConfirm:`Êtes-vous sûr de vouloir éteindre "{{name}}" ? Cela coupera l'alimentation de l'appareil connecté.`,failedToTurn:`Impossible de {{action}} "{{name}}"`,unknown:`Inconnu`,addTitle:`Ajouter une prise connectée`,editTitle:`Modifier la prise connectée`,stopScanning:`Arrêter le scan`,discoverTasmota:`Découvrir les appareils Tasmota`,foundDevices:`{{count}} appareil(s) trouvé(s) - cliquez pour sélectionner :`,noDevicesFound:`Aucun appareil Tasmota trouvé sur votre réseau`,haNotConfigured:`Home Assistant n'est pas configuré. Configurez-le dans`,haSettingsPath:`Paramètres → Réseau → Home Assistant`,selectEntity:`Sélectionner l'entité *`,ipAddress:`Adresse IP *`,nameLabel:`Nom *`,username:`Nom d'utilisateur`,password:`Mot de passe`,authHint:`Laissez vide si votre appareil Tasmota ne nécessite pas d'authentification`,linkToPrinter:`Lier à l'imprimante`,noPrinter:`Pas d'imprimante (contrôle manuel uniquement)`,linkingDescription:`La liaison permet l'allumage/extinction automatique au début/fin de l'impression`,powerAlerts:`Alertes de puissance`,alertAbove:`Alerte si au-dessus (W)`,alertBelow:`Alerte si en dessous (W)`,alertDescription:`Recevoir une notification lorsque la consommation dépasse ces seuils. Laisser vide pour désactiver cette direction.`,dailySchedule:`Planification quotidienne`,turnOnAt:`Allumer à`,turnOffAt:`Éteindre à`,scheduleDescription:`Allumer/éteindre automatiquement la prise à ces heures chaque jour. Laisser vide pour ignorer cette action.`,showOnPrinterCard:`Afficher sur la carte imprimante`,displayOnPrinterCard:`Afficher le bouton sur la carte imprimante`,connectedResult:`Connecté !`,deviceLabel:`Appareil : {{name}} - `,stateLabel:`État : {{state}}`,test:`Tester`,delete:`Supprimer`,save:`Enregistrer`,add:`Ajouter`,cancel:`Annuler`,failedToStartScan:`Impossible de démarrer le scan`,nameRequired:`Le nom est requis`,entityRequired:`L'entité est requise pour les prises Home Assistant`,mqttTopicRequired:`Au moins un topic MQTT doit être configuré pour la puissance, l'énergie ou la surveillance d'état`,loadingEntities:`Chargement des entités...`,loading:`Chargement...`,failedToLoadEntities:`Échec du chargement des entités : {{error}}`,noEntitiesMatching:`Aucune entité trouvée correspondant à "{{search}}"`,noEntitiesAvailable:`Aucune entité disponible`,searchingEntities:`Recherche de toutes les entités ({{count}} trouvées)`,showingEntities:`Affichage switch, light, input_boolean ({{count}} disponibles)`,energyMonitoringOptional:`Surveillance énergétique (Optionnel)`,energyMonitoringHint:`Recherchez et sélectionnez les capteurs fournissant des données de puissance/énergie.`,powerSensorW:`Capteur de puissance (W)`,energyTodayKwh:`Énergie aujourd'hui (kWh)`,totalEnergyKwh:`Énergie totale (kWh)`,noMatchingSensors:`Aucun capteur correspondant`,none:`Aucun`,mqttNotConfigured:`Broker MQTT non configuré. Définissez l'adresse du broker dans`,mqttSettingsPath:`Paramètres → Réseau → Publication MQTT`,mqttNotConfiguredSuffix:`(vous n'avez pas besoin d'activer la publication, remplissez simplement les détails du broker).`,mqttMonitorOnlyDescription:`Les prises MQTT reçoivent les données de puissance/énergie via un abonnement MQTT. Le contrôle on/off n'est pas disponible - utilisez votre broker MQTT ou système domotique.`,powerMonitoring:`Surveillance de puissance`,energyMonitoring:`Surveillance énergétique`,stateMonitoring:`Surveillance d'état`,optional:`optionnel`,topic:`Sujet`,jsonPath:`Chemin JSON`,multiplier:`Multiplicateur`,onValue:`Valeur ON`,mqttPowerHint:`Le chemin JSON extrait la valeur du payload JSON (ex: "power_l1"). Laisser vide si le topic publie des valeurs numériques brutes. +Utiliser le multiplicateur 0.001 pour mW→W, 1000 pour kW→W.`,mqttEnergyHint:`Le chemin JSON extrait la valeur du payload JSON. Laisser vide pour les valeurs brutes. +Utiliser le multiplicateur 0.001 pour Wh→kWh, 1000 pour MWh→kWh.`,mqttStateHint:`Le chemin JSON extrait la valeur du payload JSON. Laisser vide pour les valeurs brutes. +Valeur ON : la chaîne exacte signifiant "ON". Laisser vide pour la détection auto (ON, true, 1).`,restControl:`Contrôle`,restOnUrl:`URL d'activation`,restOffUrl:`URL de désactivation`,restOnBody:`Corps de requête ON`,restOffBody:`Corps de requête OFF`,restMethod:`Méthode HTTP`,restHeaders:`Custom Headers (JSON)`,restStatusUrl:`URL de statut`,restStatusPath:`Chemin JSON état`,restStatusOnValue:`Valeur ON`,restPowerUrl:`URL de puissance`,restPowerPath:`Chemin JSON puissance`,restPowerMultiplier:`Multiplicateur de puissance`,restEnergyUrl:`URL d'énergie`,restEnergyPath:`Chemin JSON de l'énergie (aujourd'hui)`,restEnergyTotalPath:`Chemin JSON de l'énergie (compteur total)`,restEnergyTotalMultiplier:`Multiplicateur du compteur total`,restEnergyTotalPathHint:`ex. aenergy.total`,restEnergyTotalHint:`Beaucoup de prises — tous les Shelly notamment — ne fournissent qu'un compteur cumulé qui ne se remet jamais à zéro. Il va ici, pas dans le champ ci-dessus : lu comme la consommation du jour, il ne repartirait jamais de zéro à minuit, et Hier et Total resteraient vides. Bambuddy en déduit Aujourd'hui et Hier, ce qui demande un à deux jours de relevés. Un Shelly renvoie des wattheures : utilisez un multiplicateur de 0.001.`,restEnergyMultiplier:`Multiplicateur d'énergie`,restUrlRequired:`Au moins une URL (ON ou OFF) est requise pour les prises REST`,restHeadersHint:`par ex. {"Authorization": "Bearer your-token"}`,restBodyHint:`par ex. ON, {"state": "on"}`,restStatusHint:`URL pour interroger l'état actuel`,restPathHint:`par ex. state ou data.power.status`,restPowerUrlHint:`URL séparée pour les données de puissance (utilise l'URL de statut si vide)`,restEnergyUrlHint:`URL séparée pour les données d'énergie (utilise l'URL de statut si vide)`,restEnergyHint:`Chaque valeur peut utiliser sa propre URL ou se rabattre sur l'URL de statut. Utilisez les multiplicateurs pour la conversion d'unités (ex : 0.001 pour convertir Wh en kWh).`,testConnection:`Tester la connexion`,connectionSuccess:`Connexion réussie`,noSwitchesInSwitchbar:`Aucun commutateur dans la barre`,enableSwitchbarHint:`Activez "Afficher dans la barre de commutateurs" dans Paramètres > Smart Plugs`},notifications:{notifyLockScreenWidgets:`Widgets de l’écran verrouillé (iOS)`,notifyLockScreenWidgetsHelp:`Seules les imprimantes actives hors mode maintenance reçoivent des widgets. Notify! autorise un total de 10 widgets par appareil. Ajoutez un widget Notify! via la personnalisation de l’écran verrouillé iOS et sélectionnez une imprimante. Il affiche l’état, la progression et les problèmes sans compte à rebours en direct. iOS actualise environ toutes les 15 minutes ou plus.`,notifyPhotoUnavailable:`Les destinataires de navigateur et de groupe ne prennent en charge que les notifications textuelles ; les photos jointes ne sont pas disponibles.`,notifyShowStage:`Afficher l’étape d’impression`,notifyTimeSensitive:`Alertes de problème urgentes`,notifyTimeSensitiveHelp:`Marque les impressions échouées ou arrêtées et les problèmes d’imprimante ou d’IA comme urgents. Les autres notifications restent normales.`,notifyPrivacy:`Masquer le nom du fichier sur la vignette`,notifyPrivacyHelp:`Masque les noms de fichiers uniquement dans l’activité en direct. Le texte des notifications utilise toujours les modèles de notification.`,notifyStyle:`Style de progression`,notifyStyleBar:`Barre de progression`,notifyStyleSegments:`Segments de progression`,notifyStyleNone:`Aucun indicateur de progression`,notifyDashboardUrl:`URL du tableau de bord (facultatif)`,notifySymbol:`Symbole (facultatif)`,notifyTint:`Couleur (facultatif)`,notifyAppearance:`Apparence de l’activité en direct`,notifyMetrics:`Mesures`,notifyMetricsHelp:`Le minuteur est affiché par défaut. Les mesures facultatives remplacent la ligne du nom de fichier.`,notifyDeviceId:`Identifiant de l’appareil ou du groupe`,notifyToken:`Jeton Notify!`,notifyIconUrl:`URL de l’icône (facultatif)`,notifyGroupType:`Fil de notifications (facultatif)`,notifyGroupTypeHelp:`Laissez vide pour regrouper les notifications par imprimante. Une valeur personnalisée les regroupe dans le même fil.`,notifyLiveActivities:`Activités en direct (iOS)`,notifyLiveActivitiesHelp:`Suivez les impressions sur l’écran verrouillé iOS et dans la Dynamic Island. Utilisez un identifiant d’appareil iOS et ajoutez un fournisseur distinct pour les notifications de groupe.`,notifyLifecycleHelp:`Les activités en direct suivent automatiquement chaque impression. Les interrupteurs ci-dessous ne contrôlent que les notifications push. Les heures silencieuses bloquent les nouvelles activités ; celles en cours continuent à se mettre à jour et à se terminer. Les résumés quotidiens ne retardent pas les activités.`,notifyIosFeaturesUnavailable:`Les activités en direct et les widgets de l’écran verrouillé nécessitent un identifiant d’appareil iOS. Les identifiants de groupe, de navigateur et de macOS utilisent uniquement les notifications push.`,notifyTestHelp:`Le test envoie une notification push. Une activité en direct commence au démarrage d’une impression.`,providerTypes:{notify:`Notify!`,callmebot:`CallMeBot/WhatsApp`,ntfy:`ntfy`,pushover:`Pushover`,telegram:`Telegram`,email:`E-mail`,discord:`Discord`,webhook:`Webhook`,homeassistant:`Home Assistant`,bark:`Bark`,gotify:`Gotify`},providerDescriptions:{notify:`Notifications push et activités en direct iOS via Notify!`,email:`Notifications par e-mail SMTP`,telegram:`Notifications via un bot Telegram`,discord:`Envoyer vers un canal Discord via webhook`,ntfy:`Notifications push gratuites, auto-hébergeables`,pushover:`Notifications push simples et fiables`,callmebot:`Notifications WhatsApp gratuites via CallMeBot`,webhook:`POST HTTP générique vers n'importe quelle URL`,homeassistant:`Notifications persistantes dans le tableau de bord Home Assistant`,bark:`Notifications push iOS via Bark (auto-hébergeable)`,gotify:`Notifications push via votre propre serveur Gotify`},lastSuccess:`Dernier : {{date}}`,error:`Erreur`,printer:`Imprimante :`,allPrinters:`Toutes les imprimantes`,sendTestNotification:`Envoyer une notification de test`,eventSettings:`Paramètres des événements`,enabled:`Activé`,sendFromProvider:`Envoyer des notifications depuis ce fournisseur`,printEvents:`Événements d'impression`,printerStatus:`État de l'imprimante`,amsAlarms:`Alarmes AMS`,amsHtAlarms:`Alarmes AMS-HT`,printQueue:`File d'attente d'impression`,start:`Début`,plateCheck:`Vérification du plateau`,complete:`Terminé`,failed:`Échoué`,stopped:`Arrêté`,progress:`Progression`,offline:`Hors ligne`,lowFilament:`Filament bas`,maintenance:`Maintenance`,amsHumidity:`Humidité AMS`,amsTemp:`Temp. AMS`,amsDryingSuspended:`Séchage suspendu`,amsHtHumidity:`Humidité AMS-HT`,amsHtTemp:`Temp. AMS-HT`,bedCooled:`Plateau refroidi`,firstLayer:`Première couche`,quiet:`Silencieux`,digest:`Résumé {{time}}`,noPhoto:`Pas de photo`,printStarted:`Impression démarrée`,plateNotEmpty:`Plateau non vide`,plateNotEmptyDescription:`Objets détectés avant l'impression`,plateClearRequired:`Plateau à libérer`,plateClearRequiredDescription:`Impression terminée, la file attend la confirmation`,printConfirmRequest:`Confirmation du résultat`,printConfirmRequestDescription:`Demander un verdict bon/rebut avec des liens en un clic à la fin d'une impression ayant activé l'option`,plateClear:`Plateau libre`,printCompleted:`Impression terminée`,bedCooledLabel:`Plateau refroidi`,bedCooledDescription:`Plateau refroidi sous le seuil après l'impression`,firstLayerCompleteLabel:`Première couche terminée`,firstLayerCompleteDescription:`Notification avec photo après la première couche`,connectedApps:`Applications connectées`,appMessages:`Messages des applications connectées`,appMessagesDescription:`Transmettre les messages que d'autres applications envoient via Bambuddy, p. ex. Bambuddy Orders`,appMessagesBadge:`Apps`,missingSpoolAssignmentLabel:`Affectation de bobine manquante`,billingChargeFailedLabel:`Échec de facturation`,billingChargeFailedDescription:`Notifier lorsque les coûts d'impression ne peuvent pas être enregistrés`,missingSpoolAssignmentDescription:`Notifier quand une impression démarre et que des bacs requis n'ont pas de bobine assignée`,printFailed:`Impression échouée`,printStopped:`Impression arrêtée`,progressMilestones:`Jalons de progression`,progressMilestonesDescription:`Notifier à 25 %, 50 %, 75 %`,printerOffline:`Imprimante hors ligne`,printerError:`Erreur de l'imprimante`,aiFailureDetection:`Détection de défaillance par IA`,aiFailureDetectionDescription:`Notifier lorsque l'IA Obico détecte une défaillance d'impression possible`,lowFilamentLabel:`Filament bas`,maintenanceDue:`Maintenance requise`,maintenanceDueDescription:`Notifier lorsqu'une maintenance est nécessaire`,amsHumidityHigh:`Humidité AMS élevée`,amsHumidityHighDescription:`L'humidité de l'AMS standard dépasse le seuil`,amsTemperatureHigh:`Température AMS élevée`,amsTemperatureHighDescription:`La température de l'AMS standard dépasse le seuil`,amsDryingSuspendedTitle:`Séchage automatique suspendu`,amsDryingSuspendedDescription:`Le séchage automatique a abandonné une unité AMS car l'humidité n'est jamais descendue sous le seuil`,amsHtHumidityHigh:`Humidité AMS-HT élevée`,amsHtHumidityHighDescription:`L'humidité de l'AMS-HT dépasse le seuil`,amsHtTemperatureHigh:`Température AMS-HT élevée`,amsHtTemperatureHighDescription:`La température de l'AMS-HT dépasse le seuil`,inventoryAlerts:`Alertes de stock`,stockReorderAlert:`Alerte de réapprovisionnement`,stockReorderAlertDescription:`Le SKU a atteint son point de réapprovisionnement`,stockBreakAlert:`Alerte de rupture de stock`,stockBreakAlertDescription:`Le stock sera épuisé avant l'arrivée du réapprovisionnement`,jobAdded:`Tâche ajoutée`,jobAddedDescription:`Tâche ajoutée à la file d'attente`,jobAssigned:`Tâche assignée`,jobAssignedDescription:`Tâche basée sur le modèle assignée à l'imprimante`,jobStarted:`Tâche démarrée`,jobStartedDescription:`La tâche de la file a commencé l'impression`,jobWaiting:`Tâche en attente`,jobWaitingDescription:`Tâche en attente de filament ou imprimante`,jobSkipped:`Tâche ignorée`,jobSkippedDescription:`Tâche ignorée (échec précédent)`,jobFailed:`Tâche échouée`,jobFailedDescription:`La tâche n'a pas pu démarrer`,queueComplete:`File d'attente terminée`,queueCompleteDescription:`Toutes les tâches de la file sont terminées`,quietHours:`Heures silencieuses`,noNotificationsDuring:`Aucune notification pendant ces heures`,editProviderToChangeQuietHours:`Modifier le fournisseur pour changer les heures silencieuses`,dailyDigest:`Résumé quotidien`,batchNotifications:`Regrouper les notifications en un seul résumé quotidien`,sendAt:`Envoyer à {{time}}`,editProviderToChangeDigestTime:`Modifier le fournisseur pour changer l'heure du résumé`,edit:`Modifier`,deleteProvider:`Supprimer le fournisseur de notifications`,deleteConfirm:`Êtes-vous sûr de vouloir supprimer « {{name}} » ? Cette action est irréversible.`,delete:`Supprimer`,addTitle:`Ajouter un fournisseur de notifications`,editTitle:`Modifier le fournisseur de notifications`,nameLabel:`Nom *`,namePlaceholder:`Mes notifications`,providerTypeLabel:`Type de fournisseur *`,configuration:`Configuration`,testConfiguration:`Tester la configuration`,printerFilter:`Filtre d'imprimante`,onlyFromPrinter:`Envoyer uniquement les notifications pour les événements de cette imprimante`,attachPhotoLabel:`Joindre une photo`,attachPhotoDescription:`Inclure une capture de la caméra dans les notifications, lorsqu'une capture a été prise pour l'événement`,quietHoursDnd:`Heures silencieuses (Ne pas déranger)`,quietStart:`Début`,quietEnd:`Fin`,dailyDigestLabel:`Résumé quotidien`,sendDigestAt:`Envoyer le résumé à`,digestCollected:`Les événements seront collectés et envoyés en un seul résumé à cette heure`,notificationEvents:`Événements de notification`,progressPercent:`(25 %, 50 %, 75 %)`,bedCooledAfterPrint:`(après la fin de l'impression)`,haSensorAlert:`Alerte de capteur d'imprimante`,haSensorAlertDescription:`(un capteur Home Assistant lié nécessite votre attention)`,locationHaSensorAlert:`Alerte de capteur d'emplacement`,locationHaSensorAlertDescription:`(un capteur Home Assistant lié à un emplacement de stockage nécessite votre attention)`,eventPriority:{sectionTitle:`Priorité ntfy`,helpNtfy:`Choisissez une priorité pour chaque événement activé. ntfy l'utilise pour faire remonter les alertes (son, visibilité, comportement push). Les niveaux non définis ici utilisent la valeur par défaut du serveur ntfy.`,sectionTitleGotify:`Priorité Gotify`,helpGotify:`Choisissez une priorité pour chaque événement activé. Bambuddy envoie Min., Basse, Par défaut, Haute et Urgente à Gotify sous la forme 0, 2, 5, 8 et 10. Dans l'application Android de Gotify, Par défaut et au-dessus émettent un son, Haute et Urgente s'affichent en surimpression.`,min:`Min.`,low:`Basse`,default:`Par défaut`,high:`Haute`,urgent:`Urgente`},cancel:`Annuler`,save:`Enregistrer`,add:`Ajouter`,nameRequired:`Le nom est requis`,fieldRequired:`{{field}} est requis`,haDataInvalid:`Le champ Data doit être un objet JSON valide, p. ex. {"priority": "high", "ttl": 0}`,haServiceHelp:`Facultatif — par défaut, une notification persistante dans l'interface de Home Assistant. Indiquez un service notify (p. ex. notify.mobile_app_myphone) pour recevoir des notifications push sur votre téléphone ; une capture de la caméra y est alors jointe automatiquement lorsqu'elle est disponible et que l'URL externe est définie dans Paramètres → Réseau.`,phoneNumber:`Numéro de téléphone`,apiKey:`Clé API`,serverUrl:`URL du serveur`,topic:`Sujet`,authToken:`Jeton d'authentification`,userKey:`Clé utilisateur`,appToken:`Jeton d'application`,priority:`Priorité`,pushoverRetry:`Réessai urgence (s)`,pushoverExpire:`Expiration urgence (s)`,botToken:`Jeton du bot`,chatId:`ID du chat`,telegramThreadId:`ID du sujet de forum`,telegramThreadIdHelp:`Facultatif. Envoie dans un seul sujet d'un groupe forum : le dernier nombre du lien du sujet (t.me/c/.../25). Laisser vide pour le sujet General.`,telegramThreadIdInvalid:`L'ID du sujet de forum doit être un nombre.`,telegramVerdictMode:`Verdict du résultat via`,telegramVerdictModeButtons:`Boutons inline (lien)`,telegramVerdictModeReactions:`Réaction (👍 / 👎)`,telegramVerdictModeBoth:`Boutons et réaction`,telegramVerdictModeHelp:`Comment répondre à la demande de résultat. Les réactions ne nécessitent ni connexion entrante ni URL externe : Bambuddy les récupère auprès du bot. Pour les réactions, utilisez un bot que seul Bambuddy utilise : une autre application qui interroge le même bot (Home Assistant, par exemple) ne reçoit plus ses messages, même après le retour aux boutons. Dans un groupe, le bot doit être administrateur pour voir les réactions.`,telegramVerdictBadgeReactions:`Réactions`,telegramVerdictBadgeBoth:`Boutons + réactions`,smtpServer:`Serveur SMTP`,smtpPort:`Port SMTP`,security:`Sécurité`,authentication:`Authentification`,username:`Nom d'utilisateur`,password:`Mot de passe`,fromEmail:`E-mail expéditeur`,toEmail:`E-mail destinataire`,webhookUrl:`URL du webhook`,payloadFormat:`Format du payload`,authorization:`Autorisation`,titleFieldName:`Nom du champ titre`,messageFieldName:`Nom du champ message`,editTemplate:`Modifier le modèle : {{name}}`,titleLabel:`Titre`,bodyLabel:`Corps`,titlePlaceholder:`Titre de la notification...`,bodyPlaceholder:`Corps de la notification...`,availableVariables:`Variables disponibles`,clickToInsert:`Cliquer pour insérer à la position du curseur dans le corps`,livePreview:`Aperçu en direct`,hide:`Masquer`,show:`Afficher`,loadingPreview:`Chargement de l'aperçu...`,enterTemplateContent:`Saisir le contenu du modèle pour voir l'aperçu`,titlePreview:`Titre :`,bodyPreview:`Corps :`,photoPreview:`Photo :`,photoPreviewNote:`Exemple uniquement — les fournisseurs qui acceptent les pièces jointes (ntfy, Pushover, Telegram, Discord, Home Assistant, Bark, Slack webhook) incluent automatiquement une capture de la caméra lorsqu'une capture a été prise, quel que soit le contenu du corps ci-dessus.`,photoPreviewNoteWithEmail:`Exemple uniquement — jointe automatiquement pour les fournisseurs compatibles (ntfy, Pushover, Telegram, Discord, Home Assistant, Bark, Slack webhook) lorsqu'une capture a été prise. Pour l'e-mail, ajoutez {finish_photo_url} au corps ci-dessus pour l'intégrer.`,photoPreviewNoteEmailOnly:`Exemple uniquement — il s'agit toujours d'un e-mail. Ajoutez {finish_photo_url} au corps ci-dessus pour intégrer la photo ; sans cela, seul le texte est envoyé.`,resetToDefault:`Réinitialiser par défaut`,titleRequired:`Le titre est requis`,bodyRequired:`Le corps est requis`,notificationLog:`Journal des notifications`,showFailedOnly:`Échecs uniquement`,last24Hours:`Dernières 24 heures`,last7Days:`7 derniers jours`,last30Days:`30 derniers jours`,last90Days:`90 derniers jours`,justNow:`À l'instant`,noFailedNotifications:`Aucune notification échouée`,noNotificationsLogged:`Aucune notification enregistrée`,unknownProvider:`Fournisseur inconnu`,logTitle:`Titre`,logMessage:`Message`,logError:`Erreur`,logProvider:`Fournisseur : {{type}}`,logTime:`Heure : {{time}}`,refresh:`Actualiser`,clearOld:`Purger les anciens`,statsSummary:`{{days}} derniers jours :`,statsNotifications:`notifications`,statsSent:`{{count}} envoyées`,statsFailed:`{{count}} échouées`,eventTypes:{print_start:`Impression démarrée`,print_complete:`Impression terminée`,print_failed:`Impression échouée`,print_stopped:`Impression arrêtée`,print_progress:`Progression`,printer_offline:`Imprimante hors ligne`,printer_error:`Erreur de l'imprimante`,filament_low:`Filament bas`,maintenance_due:`Maintenance requise`,test:`Tester`},userEmail:{title:`Notifications`,emailNotifications:`Notifications par e-mail`,emailNotificationsDesc:`Recevez des notifications par e-mail pour vos propres travaux d'impression. Les e-mails sont envoyés via les paramètres SMTP configurés dans l'authentification avancée.`,sendingTo:`Les notifications seront envoyées à`,noEmailWarning:`Votre compte n'a pas d'adresse e-mail. Contactez un administrateur pour en ajouter une.`,printJobNotifications:`Notifications de travaux d'impression`,printJobNotificationsDesc:`Choisissez quels événements déclenchent des notifications par e-mail pour les travaux d'impression que vous soumettez.`,printJobStarts:`Démarrage du travail d'impression`,printJobStartsDesc:`Être notifié quand votre travail d'impression commence.`,printJobFinishes:`Fin du travail d'impression`,printJobFinishesDesc:`Être notifié quand votre travail d'impression se termine avec succès.`,printErrors:`Erreurs d'impression`,printErrorsDesc:`Être notifié quand votre travail d'impression échoue ou rencontre une erreur.`,printJobStops:`Travail d'impression arrêté`,printJobStopsDesc:`Être notifié quand votre travail d'impression est annulé ou arrêté.`,saveSuccess:`Préférences de notification sauvegardées.`,saveError:`Impossible de sauvegarder les préférences de notification.`}},richTextEditor:{bold:`Gras`,italic:`Italique`,underline:`Souligné`,bulletList:`Liste à puces`,numberedList:`Liste numérotée`,alignLeft:`Aligner à gauche`,alignCenter:`Centrer`,alignRight:`Aligner à droite`,addLink:`Ajouter lien`,removeLink:`Retirer lien`},externalLinks:{title:`Liens de la barre latérale`,sidebarLayout:`Barre latérale`,sidebarLayoutDescription:`Affichez ou masquez les pages intégrées, ajoutez des liens externes et faites glisser les éléments pour réorganiser la navigation latérale.`,systemPages:`Pages Bambuddy`,externalLinks:`Liens externes`,visibleInSidebar:`Visible dans la barre latérale`,hiddenFromSidebar:`Masqué dans la barre latérale`,requiredInSidebar:`Obligatoire dans la barre latérale`,hidePage:`Masquer la page`,showPage:`Afficher la page`,settingsCannotBeHidden:`Les paramètres ne peuvent pas être masqués`,noLinksConfigured:`Aucun lien externe configuré`,deleteLink:`Supprimer lien`,removeCustomIcon:`Retirer icône personnalisée`,openInNewTab:`Ouvrir dans un nouvel onglet`,placeholders:{linkName:`Mon Lien`}},keyboardShortcuts:{title:`Raccourcis Clavier`,navigation:`Navigation`,archivesSection:`Archives`,kProfilesSection:`Profils K`,generalSection:`Général`,shortcuts:{goToPrinters:`Aller aux Imprimantes`,goToArchives:`Aller aux Archives`,goToQueue:`Aller à la File`,goToStats:`Aller aux Stats`,goToProfiles:`Aller aux Profils Cloud`,goToSettings:`Aller aux Paramètres`,focusSearch:`Focus recherche`,openUploadModal:`Ouvrir téléversement`,clearSelection:`Tout déselectionner`,contextMenu:`Menu contextuel (cartes)`,refreshProfiles:`Rafraîchir profils`,newProfile:`Nouveau profil`,exitSelectionMode:`Quitter mode sélection`,showHelp:`Afficher cette aide`},footer:`Échap ou clic extérieur pour fermer`},notificationLog:{title:`Journal de Notification`,events:{printStarted:`Début impression`,printComplete:`Fin impression`,printFailed:`Échec impression`,printStopped:`Arrêt impression`,progress:`Progression`,printerOffline:`Hors ligne`,printerError:`Erreur`,lowFilament:`Filament bas`,maintenanceDue:`Maintenance`,test:`Tester`},timeAgo:{justNow:`À l'instant`,minutesAgo:`Il y a {{minutes}}m`,hoursAgo:`Il y a {{hours}}h`}},restoreBackup:{title:`Restaurer Sauvegarde`,restoring:`Restauration...`,restoreComplete:`Restauration terminée`,restoreFailed:`Échec restauration`,importSettings:`Importer les réglages d'un fichier`,pleaseWait:`Patientez pendant la restauration`,clickToSelect:`Fichier .json ou .zip`,howDuplicateHandling:`Gestion des doublons :`,categories:{printers:`Imprimantes`,smartPlugs:`Prises`,notificationProviders:`Fournisseurs`,filaments:`Filaments`,archives:`Archives`,pendingUploads:`Téléversements en attente`,settingsTemplates:`Réglages & Modèles`},matchingInfo:{printers:`par numéro de série`,smartPlugs:`par adresse IP`,notificationProviders:`par nom`,filaments:`par nom+type+marque`,archives:`par empreinte numérique (hash)`,pendingUploads:`par nom de fichier`,settingsTemplates:`toujours écrasés`},replaceExisting:`Remplacer existant`,keepExisting:`Garder existant`,replaceDescription:`Écrase les doublons avec la sauvegarde`,keepDescription:`Ne restaure que les éléments absents`,caution:`Attention :`,cautionText:`L'écrasement remplacera vos réglages. Les codes d'accès imprimantes sont exclus par sécurité.`,itemsRestored:`Éléments restaurés`,itemsSkipped:`Éléments ignorés`,restored:`Restaurés`,skipped:`Ignorés (déjà présents)`,filesLabel:`Fichiers (3MF, vignettes, etc.)`,newApiKeysGenerated:`Nouvelles clés API générées`,newApiKeysWarning:`Copiées maintenant, elles ne seront plus visibles !`,processingBackup:`Traitement du fichier...`,noDataFound:`Aucune donnée trouvée dans le fichier.`,failedToRestore:`Échec restaure. Vérifiez le format.`},backupExport:{title:`Exporter Sauvegarde`,selectData:`Données à inclure`,selectAll:`Tout sélectionner`,selectNone:`Ne rien sélectionner`,categoryDescriptions:{settings:`Langue, thèmes, préférences`,notifications:`ntfy, Pushover, Discord, etc.`,templates:`Modèles de messages personnalisés`,smartPlugs:`Configuration des prises Tasmota`,externalLinks:`Liens externes de la barre latérale`,printers:`Infos imprimantes (codes d'accès exclus par défaut)`,plateDetection:`Images références des plateaux vides`,filaments:`Types et coûts filaments`,maintenance:`Plannings de maintenance personnalisés`,archives:`Données impressions + fichiers (3MF, vignettes, etc.)`,projects:`Projets, BOM, pièces jointes`,pendingUploads:`En attente revue virtuelle`,apiKeys:`Clés Webhook (nouvelles clés générées à l'import)`},requiresPrinters:`Nécessite sélection des imprimantes`,zipFileWarning:`Fichier ZIP créé.`,zipFileDescription:`Contient tous les médias. Peut être volumineux.`,includeAccessCodes:`Inclure Codes d'accès`,includeAccessCodesDescription:`Pour migrer vers une autre machine`,includeAccessCodesWarning:`Codes en texte clair. Sécurisez ce fichier !`,categoriesSelected:`{{selectedCount}} catégories choisies`},pendingUploads:{placeholders:{notes:`Notes sur l'impression...`},discardUpload:`Rejeter`,archiveAllUploads:`Tout archiver`,discardAllUploads:`Tout rejeter`,archive:`Archiver`,timeAgo:{justNow:`À l'instant`,minutesAgo:`Il y a {{minutes}}m`,hoursAgo:`Il y a {{hours}}h`,daysAgo:`Il y a {{days}}j`}},apiBrowser:{placeholders:{requestBody:`Corps JSON...`,searchEndpoints:`Chercher endpoints...`}},configureAmsSlot:{title:`Configurer le slot AMS`,slotConfigured:`Slot configuré !`,configuringSlot:`Configuration du slot :`,slotLabel:`{{ams}} – Emplacement {{slot}}`,searchPresets:`Chercher presets...`,colorPlaceholder:`Nom couleur ou hex (ex: brown, FF8800)`,clearCustomColor:`Effacer couleur perso`,noCloudPresets:`Profils Cloud absents. Connectez-vous.`,noPresetsAvailable:`Aucun preset disponible. Connectez-vous à Bambu Cloud ou importez des profils locaux.`,noMatchingPresets:`Aucun profil trouvé.`,custom:`Perso`,builtin:`Inclus`,orcaCloud:`Orca Cloud`,bambuCloud:`Bambu Cloud`,settingsSentToPrinter:`Réglages envoyés`,filamentProfile:`Profil Filament`,kProfileLabel:`Profil K (Pressure Advance)`,filteringFor:`Filtrage pour : {{material}}`,noKProfile:`Pas de profil K (utiliser défaut 0.020)`,noMatchingKProfiles:`Aucun profil K trouvé. K=0.020 par défaut sera utilisé.`,otherKProfiles:`Autres profils K sur cette imprimante`,selectFilamentFirst:`Sélectionnez d'abord un profil filament`,kFromCalibration:`K={{value}} de la calibration imprimante`,customColorLabel:`Couleur personnalisée (optionnel)`,presetColors:`Couleurs {{name}} :`,showLessColors:`Moins de couleurs`,showMoreColors:`Plus de couleurs`,clear:`Effacer`,hexLabel:`Hex : #{{hex}}`,resetting:`Réinitialisation...`,resetSlot:`Réinitialiser le slot`,cancel:`Annuler`,configuring:`Configuration...`,configureSlot:`Configurer le slot`,orcaFallback:{no_filament_id:`Ce profil Orca n’a pas d’identifiant de filament propre : OrcaSlicer verra cet emplacement comme Generic {{material}}.`,lookup_failed:`Impossible de lire l’identifiant de filament de ce profil depuis Orca Cloud : OrcaSlicer verra cet emplacement comme Generic {{material}}. Réessayez dans un instant.`,no_permission:`Vous n’avez pas accès à Orca Cloud, l’identifiant de filament de ce profil n’a donc pas pu être lu. OrcaSlicer verra cet emplacement comme Generic {{material}}.`}},githubBackup:{title:`Sauvegarde Git`,history:`Historique`,downloadBackup:`Télécharger`,restoreBackup:`Restaurer`,noBackupsYet:`Aucune sauvegarde`},emailSettings:{placeholders:{fromName:`Bambuddy`}},tagManagement:{searchTags:`Chercher tags...`,renameTag:`Renommer tag`,deleteTag:`Supprimer tag`},notificationTemplates:{placeholders:{title:`Titre notification...`,body:`Message notification...`}},batchTag:{placeholders:{newTag:`Nouveau tag...`}},photoGallery:{deletePhoto:`Supprimer photo`},filamentHoverCard:{copySpoolUuid:`Copier UUID bobine`},kProfilesView:{hasNote:`A une note`,copyProfile:`Copier profil`},layout:{openMenu:`Ouvrir menu`,noPermissionSystemInfo:`Pas d'autorisation système`},dashboard:{dragToReorder:`Glisser pour réorganiser`,hideWidget:`Masquer widget`},notificationProviderCard:{deleteNotificationProvider:`Supprimer fournisseur`},fileManagerModal:{closeFileManager:`Fermer gestionnaire`,sortFiles:`Trier fichiers`,goToParentFolder:`Dossier parent`,threeView:`Vue 3D`},embeddedCameraViewer:{refreshStream:`Actualiser flux`,close:`Fermer`,zoomOut:`Zoom -`,resetZoom:`Réinitialiser le zoom`,zoomIn:`Zoom +`,dragToResize:`Glisser pour dimension`},timelapseViewer:{skipBack5s:`-5s`,skipForward5s:`+5s`},notificationProviders:{descriptions:{email:`Notifications par email SMTP`,telegram:`Via bot Telegram`,discord:`Via webhook Discord`,ntfy:`Push auto-hébergé (ntfy)`,pushover:`Push fiable (Pushover)`,callmebot:`WhatsApp gratuit via CallMeBot`,webhook:`Requête HTTP POST personnalisée`}},logViewer:{searchPlaceholder:`Message ou nom...`,noLogEntries:`Aucune entrée journal`},switchbarPopover:{noSwitchesInSwitchbar:`Aucun interrupteur`},projectPageModal:{placeholders:{title:`Titre`,designer:`Designer`,license:`Licence`,description:`Description...`,profileTitle:`Titre du profil`,profileDescription:`Description du profil...`}},spoolmanSettings:{},time:{unknown:`-`,waiting:`En attente`,justNow:`À l'instant`,now:`Maintenant`,minsAgo:`il y a {{count}}m`,inMins:`dans {{count}}m`,hoursAgo:`il y a {{count}}h`,inHours:`dans {{count}}h`,daysAgo:`il y a {{count}}j`,inDays:`dans {{count}}j`},spoolbuddy:{nav:{dashboard:`Tableau de bord`,ams:`AMS`,inventory:`Inventaire`,writeTag:`Écrire`,settings:`Paramètres`},status:{nfcReady:`NFC prêt`,nfcOff:`NFC désactivé`,offline:`Hors ligne`,online:`En ligne`,noPrinters:`Aucune imprimante`,deviceOffline:`Appareil hors ligne`,waitingConnection:`En attente de connexion...`,systemReady:`Système prêt`,status:`Statut`},dashboard:{readyToScan:`Prêt à scanner`,idleMessage:`Placez une bobine sur la balance pour l'identifier`,nfcHint:`Le tag NFC sera lu automatiquement`,device:`Appareil`,syncWeight:`Sync. poids`,weightSynced:`Synchronisé !`,unknownTag:`Tag inconnu`,newTag:`Nouveau tag détecté`,onScale:`sur la balance`,linkSpool:`Lier à une bobine`,linkTagTitle:`Lier le tag à une bobine`,linkTag:`Lier le tag`,selectSpool:`Sélectionnez une bobine à lier à ce tag :`,noUntagged:`Aucune bobine sans tag trouvée`,tagDetected:`Tag détecté`,noTag:`Pas de tag`,tagId:`Étiquette`,grossWeight:`Poids brut`,spoolSize:`Taille bobine`,close:`Fermer`,currentSpool:`Bobine actuelle`,plateReady:`Plateau prêt : {{name}}`,plateReadyLabel:`Plateaux à libérer`,plateClearAction:`Libérer`,plateClearedToast:`Plateau marqué comme libéré`,plateClearFailed:`Impossible de marquer le plateau comme libéré`},modal:{spoolDetected:`Bobine détectée`,assignToAms:`Assigner à l'AMS`,syncWeight:`Synchroniser le poids`,weightSynced:`Synchronisé !`,syncing:`Synchronisation...`,newTagDetected:`Nouveau tag détecté`,addToInventory:`Ajouter à l'inventaire`,assignToAmsTitle:`Assigner à l'AMS`,selectSlot:`Sélectionner un emplacement`,assign:`Assigner`,assigning:`Attribution...`,assignSuccess:`Assigné !`,assignPendingInsert:`Assigné. Le slot sera configuré lors de l'insertion de la bobine.`,assignError:`Échec de l'attribution de la bobine. Veuillez réessayer.`,noPrinterSelected:`Sélectionner une imprimante...`,noAmsDetected:`Aucun AMS détecté sur cette imprimante`,slot:`Emplacement`},weight:{noReading:`Pas de lecture`,stable:`Stable`,measuring:`Mesure...`,tare:`Tarer`,calibrate:`Calibrer`},spool:{remaining:`Restant`,material:`Matériau`,brand:`Marque`,color:`Couleur`,coreWeight:`Noyau`,labelWeight:`Étiquette`,scaleWeight:`Balance`,netWeight:`Réseau`,lastUsed:`Dernière utilisation`,unknownColor:`Couleur inconnue`},ams:{noData:`Aucun AMS détecté`,connectAms:`Connectez un AMS pour voir les slots`,noPrinter:`Aucune imprimante sélectionnée`,selectPrinter:`Sélectionnez une imprimante dans la barre supérieure`,printerDisconnected:`Imprimante déconnectée`,humidity:`Humidité`,level:`Niveau`,active:`Actif`,slot:`Emplacement`,empty:`Vide`},inventory:{search:`Rechercher des bobines...`,empty:`Aucune bobine dans l'inventaire`,noResults:`Aucune bobine correspondante`,spools:`bobines`,addSpool:`Ajouter une bobine`},settings:{tabDevice:`Appareil`,tabDisplay:`Affichage`,tabScale:`Balance`,tabUpdates:`Mises à jour`,nfcReader:`Lecteur NFC`,type:`Type`,connection:`Connexion`,notConnected:`N/D`,deviceInfo:`Info appareil`,hostname:`Hôte`,uptime:`Temps de fonctionnement`,brightness:`Luminosité`,saved:`Enregistré`,noBacklight:`Aucun rétroéclairage DSI détecté. Le contrôle de luminosité nécessite un écran DSI.`,screenBlank:`Délai d'extinction`,screenBlankDesc:`L'écran s'éteint après inactivité. Touchez pour réveiller.`,displayNote:`La luminosité est appliquée comme filtre logiciel.`,scaleCalibration:`Calibration de la balance`,currentWeight:`Poids actuel`,tareOffset:`Tare`,calFactor:`Facteur`,knownWeight:`Poids connu`,calStep1:`Retirez tout de la balance et appuyez sur Mettre à zéro.`,calStep2:`Placez le poids connu sur la balance.`,setZero:`Mettre à zéro`,calibrateNow:`Calibrer`,calibrated:`Calibré`,tareSet:`Commande de tare envoyée. En attente de l'appareil...`,tareComplete:`Tare terminée !`,tareTimedOut:`Délai de tare dépassé — le daemon SpoolBuddy fonctionne-t-il ?`,tareFailed:`Échec de l'envoi de la commande de tare`,zeroSet:`Point zéro défini. Placez le poids connu sur la balance.`,calibrationDone:`Calibration terminée !`,calibrationFailed:`Échec de la calibration`,lastCalibrated:`Dernière calibration`,stable:`Stable`,settling:`Stabilisation...`,firmware:`Micrologiciel`,scale:`Balance`,noDevice:`Aucun appareil SpoolBuddy trouvé`,daemonVersion:`Version du daemon`,currentVersion:`Actuelle`,versionPending:`En attente du daemon...`,checking:`Vérification...`,checkUpdates:`Vérifier les mises à jour`,updateAvailable:`Mise à jour disponible`,updateInstructions:`Mise à jour via SSH : exécutez le script d'installation SpoolBuddy.`,upToDate:`À jour`,includeBeta:`Inclure les versions bêta`,systemConfig:`Backend & authentification`,backendUrl:`URL du backend Bambuddy`,apiToken:`Jeton d'API`,apiTokenPlaceholder:`Saisir un jeton d'API`,saveConfig:`Enregistrer la configuration`,systemQueued:`Configuration mise en file.`,systemFieldsRequired:`L'URL du backend est obligatoire.`,nfcDiagnostic:`Diagnostic NFC`,scaleDiagnostic:`Diagnostic balance`,readTagDiagnostic:`Diagnostic lecture de tag`,testNfc:`Tester le lecteur`,testScale:`Tester la précision`,testReadTag:`Lire un tag`},writeTag:{tabExisting:`Bobine existante`,tabNew:`Nouvelle bobine`,tabReplace:`Remplacer le tag`,searchPlaceholder:`Rechercher par matériau, couleur, marque...`,noUntaggedSpools:`Aucune bobine sans tag`,noTaggedSpools:`Aucune bobine avec tag`,selectSpool:`Sélectionnez une bobine, puis placez un NTAG sur le lecteur`,placeTag:`Placez un NTAG sur le lecteur`,tagReady:`Tag détecté — prêt à écrire`,writeTag:`Écrire le tag`,replaceTag:`Remplacer le tag`,writing:`Écriture du tag...`,waiting:`En attente de SpoolBuddy...`,writeSuccess:`Tag écrit avec succès !`,writeFailed:`Échec de l'écriture`,queueFailed:`Impossible de mettre en file la commande d'écriture`,tryAgain:`Réessayer`,cancel:`Annuler`,replaceWarning:`L'ancien tag sera dissocié. Le nouveau tag le remplacera.`,deviceOffline:`SpoolBuddy est hors ligne`,material:`Matériau`,colorName:`Nom de la couleur`,color:`Couleur`,brand:`Marque`,weight:`Poids (g)`,createSpool:`Créer la bobine`,creating:`Création...`,spoolCreated:`Bobine créée ! Prêt à écrire.`,createFailed:`Impossible de créer la bobine`,incompleteDataWarning:`Tag écrit avec des données Spoolman incomplètes`},quickMenu:{printerPower:`Alimentation imprimante`,systemControls:`Système`,restartDaemon:`Redémarrer le daemon`,restartBrowser:`Redémarrer le navigateur`,reboot:`Redémarrer`,shutdown:`Éteindre`,swipeToClose:`Glisser vers le bas pour fermer`,confirmTitle:`Confirmer`,confirmShutdown:`Êtes-vous sûr de vouloir éteindre le SpoolBuddy ? Vous aurez besoin d'un accès physique pour le rallumer.`,confirmReboot:`Êtes-vous sûr de vouloir redémarrer le SpoolBuddy ?`,confirmRestartDaemon:`Redémarrer le daemon SpoolBuddy ? Le NFC et la balance seront temporairement indisponibles.`,confirmRestartBrowser:`Redémarrer le navigateur kiosque ? L'écran sera brièvement noir.`,confirm:`Confirmer`,confirmPlugOn:`Allumer {{name}} ?`,confirmPlugOff:`Éteindre {{name}} ?`,turnOn:`Allumer`,turnOff:`Éteindre`}},diagnostic:{modalTitle:`Diagnostic de connexion — {{name}}`,running:`Diagnostic en cours...`,runningElapsed:`Diagnostic en cours... ({{elapsed}}s)`,waitingForReportHint:`En attente que l'imprimante publie un rapport d'état — cela peut prendre jusqu'à {{max}} secondes.`,runFailed:`Le diagnostic n'a pas pu s'exécuter : {{error}}`,retry:`Relancer`,runButton:`Lancer le diagnostic`,sectionTitle:`Diagnostic de connexion`,sectionDescription:`Vérifiez pourquoi une imprimante ne se connecte pas ou n'imprime pas — accessibilité des ports, mode développeur LAN, mode réseau Docker et identifiants.`,noPrinters:`Aucune imprimante configurée.`,overall:{ok:`Aucun problème détecté — la connexion de l'imprimante semble correcte.`,warnings:`L'imprimante devrait fonctionner, mais certains points nécessitent votre attention.`,problems:`Des problèmes expliquant pourquoi l'imprimante ne se connecte pas ou n'imprime pas ont été détectés.`},check:{port_mqtt:{title:`Port de contrôle (MQTT 8883)`,pass:`Accessible — l'imprimante accepte les connexions de contrôle.`,fail:`Le port 8883 est inaccessible. L'imprimante est éteinte, possède une autre adresse IP, ou un pare-feu la bloque. Vérifiez l'IP de l'imprimante et qu'aucun élément ne bloque le port 8883.`},port_ftps:{title:`Port de transfert de fichiers (FTPS 990)`,pass:`Accessible — l'envoi de fichiers d'impression fonctionnera.`,warn:`Le port 990 est inaccessible. La surveillance peut toujours fonctionner, mais l'envoi d'impressions vers l'imprimante échouera. Assurez-vous que le port 990 n'est pas bloqué.`,warn_no_tls:`Le port 990 est ouvert, mais le service de fichiers de l'imprimante ne termine pas la négociation TLS. Les fichiers d'impression, les aperçus et les timelapses ne peuvent pas être récupérés, les archives restent donc vides. Redémarrez l'imprimante — débloquer le port n'y changera rien.`},external_storage:{title:`Stocker les fichiers envoyés sur stockage externe (étape 4 de l'installation)`,pass:`L'imprimante signale que cette option est activée — les fichiers envoyés seront stockés sur la carte SD et les archives auront des miniatures et des métadonnées slicer.`,fail:`L'imprimante signale que cette option est désactivée. Activez « Stocker les fichiers envoyés sur stockage externe » — sur les firmwares récents (P2S 01.02 / Bambu Studio 2.6+) l'interrupteur se trouve dans les Paramètres d'impression de l'imprimante ; sur les versions antérieures, il est dans l'onglet Périphérique de Bambu Studio / OrcaSlicer. Sans cette option, chaque impression archivée est dépourvue de miniature et de métadonnées slicer.`,skip:`Non vérifié — une connexion MQTT active est requise. Sur les slicers plus anciens où ce paramètre n'existe que dans le slicer, l'imprimante ne le signale pas, donc cette vérification passe même si l'option est désactivée — vérifiez l'étape 4 de l'installation manuellement.`,skip_unsupported_model:`Ce modèle a un emplacement SD mais aucun moyen d'activer l'option — le firmware actuel de la série P1 n'affiche pas le bouton dans Bambu Studio et l'imprimante n'a pas d'écran. Il n'y a rien à corriger ici ; les impressions archivées peuvent manquer de miniatures et de métadonnées du slicer jusqu'à ce que Bambu Lab l'ajoute par firmware.`,fail_no_media:`L'option est activée, mais l'imprimante ne signale ni carte ni clé dans son emplacement : les fichiers envoyés n'ont nulle part où aller. Insérez-en une et relancez une impression — d'ici là, chaque impression archivée sera dépourvue de miniature et de métadonnées slicer.`,warn_internal_storage:`L'option est activée et un stockage est présent, mais la dernière impression est tout de même allée dans le stockage interne de l'imprimante, que Bambuddy ne peut pas lire. Sur les séries H2, P2S et X2D, le bouton « Imprimer » de Bambu Studio y envoie toujours, quel que soit ce réglage. Les impressions sont archivées avec leur nom et leurs durées, mais sans miniature ni métadonnées slicer. Pour des archives complètes, lancez les impressions depuis Bambuddy ou tranchez dans OrcaSlicer, ou bien dans Bambu Studio utilisez « Envoyer » avec « Externe » puis lancez l'impression.`,warn_internal_history:`L'option est activée et un stockage est présent, mais la dernière impression est partie d'un fichier déjà présent sur l'imprimante : une réimpression depuis son écran, un lancement depuis Handy ou un fichier envoyé plus tôt. Cette bibliothèque réside dans le stockage interne, que Bambuddy ne peut pas lire, et aucun réglage n'y change rien, puisque rien n'a été envoyé pour cette impression. Elle reste archivée avec son nom et ses durées, mais sans miniature ni métadonnées slicer. Pour des archives complètes, lancez les impressions depuis Bambuddy ou envoyez-les depuis le trancheur.`},port_rtsps:{title:`Port caméra ({{protocol}} {{port}})`,pass:`Accessible — le flux de la caméra fonctionnera.`,warn:`Le port {{port}} est inaccessible. La vue caméra en direct ne fonctionnera pas. Cela n'affecte pas l'impression.`},macos_local_network:{title:`Autorisation « Réseau local » de macOS`,pass:`macOS autorise Bambuddy à accéder au réseau local.`,warn_unsigned:`Le Python qui exécute Bambuddy n’a pas de signature de code : macOS n’a donc rien à quoi rattacher l’autorisation « Réseau local » et rejette silencieusement toutes les connexions vers l’imprimante, sans erreur ni demande. Lancez le script de mise à jour de Bambuddy (install/update_macos.sh), qui le signe, puis redémarrez Bambuddy. Interpréteur : {{executable}}`,warn_permission:`Si l’imprimante est allumée et joignable à cette adresse, ouvrez Réglages Système > Confidentialité et sécurité > Réseau local et vérifiez que le Python de Bambuddy est activé. Sinon macOS rejette les connexions locales en silence, et une mise à jour de Python peut laisser l’ancienne autorisation derrière elle.`},network_mode:{title:`Mode réseau du conteneur`,genericRuntime:`un conteneur`,pass:`Fonctionne dans {{runtime}} en réseau host.`,warn:`Bambuddy fonctionne dans {{runtime}} en réseau bridge. La découverte d'imprimantes et l'imprimante virtuelle nécessitent le mode réseau host — recréez le conteneur en réseau host ("network_mode: host" dans docker-compose, "--network=host" pour Podman).`,skip:`Ne fonctionne pas dans un conteneur — non applicable.`,skip_unknown:`Bambuddy fonctionne dans {{runtime}}, mais son mode réseau n'a pas pu être déterminé. Si la découverte d'imprimantes ou l'imprimante virtuelle ne fonctionnent pas, recréez le conteneur en réseau host.`,skip_system_container:`Bambuddy fonctionne dans un conteneur système {{runtime}}, présent sur le LAN comme une machine virtuelle — non applicable.`},subnet:{title:`Sous-réseau`,pass:`L'imprimante et Bambuddy sont sur le même sous-réseau.`,warn:`L'imprimante ({{printer_ip}}) et Bambuddy ({{host_ip}}) sont sur des sous-réseaux différents. Ils peuvent ne pas se joindre, sauf si un routage entre les sous-réseaux est configuré.`,skip:`Le sous-réseau n'a pas pu être déterminé — ignoré.`},mqtt_auth:{title:`Identifiants de l'imprimante`,pass:`L'imprimante a accepté la connexion.`,fail:`L'imprimante est accessible mais Bambuddy n'y est pas connecté. Le code d'accès ou le numéro de série est très probablement incorrect — le code d'accès change chaque fois que le mode LAN uniquement ou le mode développeur est activé/désactivé, recopiez-le donc depuis l'écran de l'imprimante. Une imprimante en cours de redémarrage, ou ayant déjà atteint sa limite de connexions simultanées, produit le même résultat.`,fail_auth_rejected:`L'imprimante a refusé les identifiants de Bambuddy. Le code d'accès ou le numéro de série est incorrect — le code d'accès change chaque fois que le mode LAN uniquement ou le mode développeur est activé/désactivé. Recopiez-le depuis l'écran de l'imprimante et enregistrez-le dans les paramètres de l'imprimante.`,skip:`Non vérifié — l'imprimante n'a pas pu être jointe.`},developer_mode:{title:`Mode développeur LAN`,pass:`Le mode développeur est activé.`,fail:`Le mode développeur est DÉSACTIVÉ sur l'imprimante. Activez-le dans les paramètres LAN de l'imprimante — et confirmez avec OK. Sans lui, les impressions ne démarreront pas.`,skip:`Impossible à vérifier — nécessite une connexion active à l'imprimante.`},printer_publishing:{title:`L'imprimante publie son état`,pass:`L'imprimante publie des mises à jour d'état — l'AMS, les filaments et les profils K seront correctement reflétés dans le slicer.`,fail:`Le broker MQTT a accepté la connexion mais l'imprimante n'a publié aucun rapport d'état. Il s'agit presque toujours d'un numéro de série erroné ou mal capitalisé — le topic device//report est sensible à la casse. Vérifiez le numéro de série dans les paramètres de l'imprimante par rapport à l'écran de la machine.`,skip:`Impossible à vérifier — nécessite une connexion active à l'imprimante.`}}},systemHealth:{sectionTitle:`État du système`,sectionDescription:`Analyse les journaux récents à la recherche de problèmes connus que vous pouvez généralement résoudre vous-même, avant qu'ils ne deviennent un ticket de support.`,rescan:`Relancer l'analyse`,clean:`Aucun problème connu trouvé dans les {{times}} dernières entrées de journal.`,logUnavailable:`La journalisation dans un fichier est désactivée, les journaux ne peuvent donc pas être analysés. Activez la journalisation dans un fichier pour utiliser cette vérification.`,learnMore:`Comment corriger`,fixLabel:`Correctif :`,occurrences:`Vu {{times}}× — dernière fois à {{lastSeen}}`,category:{layer8:`Vous pouvez corriger ceci`,environment:`Environnement`,bug:`Merci de le signaler`},signature:{"ftp-auth-rejected":{name:`L'imprimante a refusé le code d'accès`,cause:`L'imprimante a refusé la connexion de transfert de fichiers. Le code d'accès est incorrect, ou il a changé après l'activation du mode développeur.`,fix:`Recopiez le code d'accès depuis l'écran de l'imprimante (paramètres LAN) et mettez-le à jour dans les paramètres de l'imprimante dans Bambuddy.`},"ftp-connection-timeout":{name:`Délai de connexion de transfert de fichiers dépassé`,cause:`Bambuddy n'a pas pu atteindre le port de transfert de fichiers de l'imprimante (FTPS 990). Le port est bloqué, ou l'imprimante est éteinte ou sur un autre sous-réseau.`,fix:`Assurez-vous que rien ne bloque le port 990 entre Bambuddy et l'imprimante, et que les deux sont sur le même réseau.`},"ftp-ssl-error":{name:`Échec de la négociation sécurisée du transfert de fichiers`,cause:`Le service de fichiers de l'imprimante a répondu sur le port 990 sans TLS. Son serveur de fichiers est bloqué : c'est une panne côté imprimante, pas un problème de pare-feu ou de micrologiciel.`,fix:`Redémarrez l'imprimante. D'ici là, les fichiers d'impression, les vignettes et les timelapses ne peuvent pas être récupérés ; l'impression elle-même n'est pas affectée.`},"bambu-cloud-captcha":{name:`Bambu Cloud demande un CAPTCHA`,cause:`La protection anti-abus de Bambu contrôle ce réseau, aucune connexion à Bambu Cloud ne peut donc aboutir. Cela dépend de l'adresse IP publique, pas de votre compte ni de cette installation.`,fix:`Patientez : cela disparaît généralement en quelques heures, et les tentatives répétées le prolongent. En attendant, connectez-vous avec un jeton d'accès issu d'une session de navigateur.`},"mqtt-connection-flapping":{name:`La connexion à l'imprimante se coupe sans cesse`,cause:`La connexion de contrôle (MQTT 8883) se déconnecte et se reconnecte à répétition — généralement à cause d'un réseau faible ou d'un port partiellement bloqué.`,fix:`Vérifiez le signal Wi-Fi près de l'imprimante, privilégiez une connexion filaire et assurez-vous que le port 8883 est accessible de façon fiable.`},"camera-connection-refused":{name:`Flux de la caméra inaccessible`,cause:`La caméra en direct n'a pas pu être atteinte sur le port RTSPS 322. Le port est bloqué, ou la caméra ou la vue en direct par LAN est désactivée sur l'imprimante.`,fix:`Activez la caméra et la vue en direct par LAN sur l'imprimante, et assurez-vous que le port 322 n'est pas bloqué. Cela n'affecte pas l'impression.`},"database-locked":{name:`Conflits d'écriture dans la base de données`,cause:`La base de données SQLite rencontre des erreurs "database is locked" sous charge — fréquent lorsque plusieurs imprimantes sont utilisées en même temps.`,fix:`Faites passer Bambuddy à une base de données PostgreSQL externe. Consultez le guide PostgreSQL dans la documentation.`}}},vpDiagnostic:{title:`Vérification de configuration — {{name}}`,runButton:`Lancer la vérification`,running:`Vérification de configuration en cours...`,runFailed:`Impossible de lancer la vérification de configuration : {{error}}`,retry:`Relancer`,overall:{ok:`Toutes les vérifications ont réussi — cette imprimante virtuelle est correctement configurée.`,warnings:`L'imprimante virtuelle devrait fonctionner, mais certains points nécessitent votre attention.`,problems:`Des problèmes ont été trouvés qui expliquent pourquoi le slicer ne voit pas ou ne peut pas utiliser cette imprimante virtuelle.`},check:{enabled:{title:`Imprimante virtuelle activée`,fail:`Cette imprimante virtuelle est désactivée. Activez-la pour qu'elle soit détectable.`},running:{title:`Services en cours d'exécution`,fail:`L'imprimante virtuelle est activée mais ses services ne sont pas en cours d'exécution. Consultez le journal Bambuddy — un conflit d'IP de liaison ou une erreur de permission les arrête généralement.`},bind_interface:{title:`Interface réseau de liaison`,fail:`L'interface de liaison n'est pas définie ou n'existe plus sur cet hôte. Choisissez une interface actuelle dans la liste "Interface de liaison".`},access_code:{title:`Code d'accès défini`,fail:`Aucun code d'accès n'est défini. Le slicer doit recevoir le même code d'accès à 8 caractères que celui que vous définissez ici.`},target_printer:{title:`Imprimante cible`,fail:`Aucune imprimante cible n'est sélectionnée. Le mode proxy a besoin d'une vraie imprimante vers laquelle transférer.`,warn:`L'imprimante cible est hors ligne pour le moment — le transfert reprendra dès qu'elle se reconnectera.`},port_ftps:{title:`Service de téléversement de fichiers (port {{port}})`,fail:`Rien n'écoute sur le port {{port}} de l'IP de liaison, le slicer ne peut donc pas téléverser de fichiers. La cause habituelle est un conflit de port sur cette interface.`},port_mqtt:{title:`Service de contrôle (port {{port}})`,fail:`Rien n'écoute sur le port {{port}} de l'IP de liaison, le slicer ne peut donc pas se connecter ni afficher l'état.`},port_bind:{title:`Service de détection (port {{port}})`,fail:`Rien n'écoute sur le port {{port}} de l'IP de liaison, la poignée de main de détection du slicer échoue donc.`},privileged_ports:{title:`Liaison aux ports privilégiés`,fail:`Le port {{port}} est inférieur à 1024 et ce service n'est pas autorisé à s'y lier — c'est pourquoi rien n'écoute ci-dessus. Ajoutez AmbientCapabilities=CAP_NET_BIND_SERVICE dans /etc/systemd/system/bambuddy.service puis redémarrez, ou exécutez "sudo setcap cap_net_bind_service=+ep $(readlink -f $(which python3))". Sous Docker, ajoutez cap_add: [NET_BIND_SERVICE].`},certificate:{title:`Certificat TLS`,pass:`Certificat prêt. Assurez-vous que le certificat CA Bambuddy (ci-dessus) est importé dans le magasin de confiance de votre slicer.`,fail:`Le certificat TLS de cette imprimante virtuelle est manquant. Vérifiez que le répertoire de données Bambuddy est accessible en écriture.`}}},bugReport:{logHealthSummary:`Problèmes connus trouvés dans vos journaux`,logHealthIntro:`Les journaux récents correspondent à des problèmes connus. Consultez les correctifs ci-dessous — les résoudre pourrait régler votre problème sans rapport de bogue. Vous pouvez tout de même envoyer un rapport ci-dessous.`,title:`Signaler un bug`,description:`Description`,descriptionPlaceholder:`Qu'est-ce qui n'a pas fonctionné ? Veuillez décrire le problème...`,email:`E-mail (optionnel)`,emailPlaceholder:`votre@email.fr`,emailPrivacy:`Si fourni, votre e-mail sera inclus dans une section repliée de l'issue GitHub pour que le mainteneur puisse vous contacter.`,screenshot:`Capture d'écran`,uploadOrPaste:`Télécharger, coller ou glisser une image`,dataCollectedSummary:`Quelles données sont incluses dans le rapport ?`,dataIncluded:`Inclus :`,dataIncludedList:`Version de l'app, OS, architecture, version Python, statistiques de base de données (compteurs uniquement), modèles d'imprimantes, nombre de buses, versions firmware, état de connexion, état des intégrations (Spoolman, MQTT, HA), paramètres non sensibles, nombre d'interfaces réseau, détails Docker, versions des dépendances.`,dataNeverIncluded:`Jamais inclus :`,dataNeverIncludedList:`Noms d'imprimantes, numéros de série, codes d'accès, mots de passe, adresses IP, adresses e-mail, clés API, tokens, URLs de webhook, noms d'hôtes ou noms d'utilisateurs.`,submit:`Envoyer`,startLogging:`Lancer la journalisation`,stepEnableLogging:`Journalisation activée`,stepReproduce:`Reproduisez le problème`,stepStopLogging:`Arrêter & envoyer`,stopAndSubmit:`Arrêter & Envoyer`,maxDuration:`Arrêt auto après {{minutes}} min`,stoppingLogs:`Collecte des journaux & envoi...`,submitting:`Envoi du rapport de bug...`,submittingStepConnection:`Vérification de la connectivité des imprimantes`,submittingStepVirtualPrinters:`Vérification de la configuration des imprimantes virtuelles`,submittingStepLogScan:`Analyse des journaux récents pour les problèmes connus`,submittingStepSubmit:`Envoi du rapport vers GitHub`,submitSuccess:`Rapport de bug envoyé avec succès !`,submitFailed:`Échec de l'envoi du rapport de bug`,diagnosticChecking:`Vérification des connexions des imprimantes...`,diagnosticHealthy:`Vérification de connexion réussie — aucun problème détecté sur vos imprimantes.`,diagnosticSummary:`{{problems}} imprimante(s) sur {{total}} ont des problèmes de connexion`,diagnosticIntro:`Une ou plusieurs imprimantes ont un problème de connexion qui pourrait être à l'origine de votre problème. Dépliez une imprimante ci-dessous pour voir la solution — la résoudre pourrait régler le problème sans rapport de bug. Vous pouvez tout de même envoyer un rapport ci-dessous.`,thankYou:`Merci !`,submitted:`Votre rapport de bug a été soumis.`,viewIssue:`Voir l'issue`,closeKeepsRecording:`Vous pouvez fermer ce panneau pendant que vous reproduisez le problème : l'enregistrement continue et sa réouverture vous ramènera ici.`,resumeRecording:`Rapport de bogue en cours d'enregistrement — {{elapsed}}. Cliquez pour terminer.`,resumeReport:`Reprendre le rapport`,unexpectedError:`Une erreur inattendue est survenue`},failureDetection:{title:`Détection d'échec par IA`,description:`Surveille les impressions via une API ML Obico auto-hébergée et agit automatiquement sur les échecs détectés.`,mlUrl:`URL de l'API ML Obico`,mlUrlHint:`URL de base de votre conteneur Obico ml_api auto-hébergé (ex. http://192.168.1.10:3333).`,bambuddyInternalUrl:`URL interne de Bambuddy (facultatif)`,bambuddyInternalUrlHint:`Adresse de Bambuddy accessible depuis l’API ML, par exemple un nom de service Docker ou une IP du réseau local. Laissez vide pour utiliser l’URL externe. Les autres intégrations continuent d’utiliser l’URL externe.`,bambuddyInternalUrlInvalid:`Doit commencer par http:// ou https:// (par exemple http://bambuddy:8000). Non enregistrée tant que ce n’est pas le cas.`,mlToken:`Jeton de l'API ML (facultatif)`,mlTokenPlaceholder:`Laissez vide si le serveur fonctionne sans ML_API_TOKEN`,mlTokenHint:`Doit correspondre à la variable d'environnement ML_API_TOKEN de votre conteneur Obico ml_api. Laissez vide si le conteneur fonctionne sans jeton.`,test:`Tester`,testSuccess:`API ML accessible et fonctionnelle.`,testSuccessTokenUnknown:`API ML accessible et fonctionnelle. Le jeton n'a pas pu être vérifié.`,testFailed:`Impossible d'atteindre l'API ML.`,sensitivity:`Sensibilité`,sensitivityLow:`Basse (moins de faux positifs)`,sensitivityMedium:`Moyenne (équilibrée)`,sensitivityHigh:`Haute (détection précoce, plus de faux positifs)`,sensitivityHint:`Ajuste les seuils de confiance qui déclenchent les avertissements et les échecs.`,action:`Action sur échec détecté`,actionNotify:`Notifier uniquement`,actionPause:`Mettre en pause`,actionPauseOff:`Pause et couper l'alimentation`,pollInterval:`Intervalle de vérification (secondes)`,pollIntervalHint:`Fréquence de vérification de chaque imprimante pendant l'impression. Minimum 5s, maximum 120s.`,externalUrlMissing:`Aucune adresse n’est définie pour que l’API ML récupère les captures.`,externalUrlHint:`Définissez ici l’URL interne de Bambuddy ou l’URL externe dans Paramètres → Réseau pour que l’API ML puisse récupérer les captures.`,perPrinterTitle:`Imprimantes surveillées`,perPrinterHint:`Choisissez quelles imprimantes le service de détection surveille.`,monitorAll:`Surveiller toutes les imprimantes connectées`,statusTitle:`Statut`,serviceRunning:`Service en cours d'exécution`,thresholds:`Seuils bas / haut`,activePrinters:`Impressions actives`,noActivePrints:`Aucune impression en cours.`,historyTitle:`Détections récentes`,noHistory:`Aucune détection pour le moment.`},modelSources:{title:`Sources de modèles`,tabMakerworld:`MakerWorld`,tabManyfold:`Manyfold`},manyfold:{description:`Parcourez et recherchez votre bibliothèque Manyfold, puis importez ses fichiers pour les trancher et les imprimer.`,notConnectedTitle:`Manyfold n'est pas connecté`,notConnectedBody:`Demandez à un administrateur de connecter votre bibliothèque Manyfold.`,connectionTitle:`Connexion à Manyfold`,connectionHelp:`Dans Manyfold, ouvrez Paramètres → API et créez une application avec les autorisations "public" et "read". Saisissez ici son identifiant client et son secret. Bambuddy voit les modèles visibles par le propriétaire de l'application.`,url:`URL de Manyfold`,urlPlaceholder:`http://192.168.1.10:3214`,clientId:`Identifiant client`,clientSecret:`Secret client`,clientSecretStored:`Enregistré. Laissez vide pour le conserver.`,test:`Tester la connexion`,testOk:`Connecté. Modèles visibles par Bambuddy : {{count}}`,disconnect:`Déconnecter`,disconnectTitle:`Déconnecter Manyfold ?`,disconnectBody:`Bambuddy oublie l'URL, l'identifiant client et le secret de Manyfold. Les fichiers importés restent dans votre bibliothèque.`,disconnected:`Manyfold déconnecté`,editConnection:`Connexion`,searchPlaceholder:`Rechercher des modèles`,modelCount:`Modèles : {{count}}`,noModels:`Aucun modèle trouvé.`,previous:`Précédent`,next:`Suivant`,page:`Page {{page}}`,back:`Retour aux modèles`,openInManyfold:`Ouvrir dans Manyfold`,license:`Licence`,files:`Fichiers`,noFiles:`Ce modèle n'a aucun fichier.`,importTo:`Importer dans`,folderAuto:`Dossier « Manyfold »`,import:`Importer`,importing:`Importation…`,imported:`{{filename}} importé`,alreadyInLibrary:`Déjà dans votre bibliothèque`,inLibrary:`Dans la bibliothèque`,showInLibrary:`Afficher dans la bibliothèque`,notImportable:`Bambuddy ne peut ni trancher ni imprimer ce type de fichier`,selectAll:`Tout sélectionner`,selectFile:`Sélectionner {{name}}`,importSelected:`Importer la sélection ({{count}})`,importAll:`Tout importer`,importProgress:`Importation {{current}}/{{total}}`,bulkDone:`Importés : {{imported}} · déjà dans la bibliothèque : {{existing}} · échecs : {{failed}}`,bulkFailed:`Non importés : {{names}}. {{reason}}`,bulkNothing:`Rien à importer : tous les fichiers imprimables sont déjà dans votre bibliothèque.`,selectModel:`Sélectionner {{name}}`,selectPage:`Sélectionner la page`,modelsSelected:`Modèles sélectionnés : {{count}}`,importModels:`Importer leurs fichiers`,clearSelection:`Effacer la sélection`,collectProgress:`Lecture des modèles {{current}}/{{total}}`,modelsUnreadable:`Lecture impossible : {{names}}`,errors:{manyfold_not_configured:`Manyfold n'est pas connecté.`,manyfold_credentials:`Manyfold n'a pas accepté l'identifiant client ou le secret.`,manyfold_scope:`L'application Manyfold a besoin de l'autorisation "read". Modifiez-la dans Manyfold sous Paramètres → API.`,manyfold_rate_limited:`Manyfold limite les connexions. Réessayez dans quelques minutes.`,manyfold_unreachable:`Bambuddy ne parvient pas à joindre Manyfold. Vérifiez l'URL et que Manyfold fonctionne.`,manyfold_forbidden:`Manyfold a refusé l'accès. Vérifiez que le propriétaire de l'application peut voir ce modèle.`,manyfold_not_found:`Manyfold ne trouve pas ce modèle ou ce fichier.`,manyfold_too_large:`Le fichier dépasse 200 Mo.`,manyfold_not_importable:`Seuls les fichiers 3MF, STL et STEP peuvent être importés.`,manyfold_bad_url:`Saisissez l'URL de Manyfold en commençant par http:// ou https://.`,manyfold_secret_required:`Saisissez le secret client.`,manyfold_failed:`Manyfold a répondu par une erreur.`}},makerworld:{title:`MakerWorld`,description:`Collez une URL de modèle MakerWorld pour l'importer et l'imprimer directement depuis Bambuddy — sans passer par l'application Bambu Handy.`,pasteUrlHeader:`Importer depuis MakerWorld`,pasteUrlPlaceholder:`https://makerworld.com/en/models/… ou collez n'importe quel lien MakerWorld`,resolveButton:`Résoudre`,signInRequiredTitle:`Connexion Bambu Cloud requise pour télécharger`,signInRequiredBody:`Vous pouvez consulter les détails du modèle anonymement, mais MakerWorld nécessite un compte Bambu Cloud pour télécharger les fichiers 3MF.`,signInExpiredTitle:`Session Bambu Cloud expirée`,signInExpiredBody:`Vous êtes toujours connecté à Bambuddy, mais Bambu Lab n'accepte plus le jeton enregistré : les téléchargements échoueront. Reconnectez-vous à Bambu Cloud.`,openCloudSettings:`Ouvrir les paramètres Cloud`,untitledModel:`Modèle sans titre`,byCreator:`par {{name}}`,downloadsCount:`{{count}} téléchargements`,licensePrefix:`Licence`,alreadyImported:`Déjà dans la bibliothèque`,openOnMakerworld:`Ouvrir sur MakerWorld`,alreadyInLibrary:`Ce modèle est déjà dans votre bibliothèque — retrouvez-le dans Gestionnaire de fichiers → MakerWorld`,importSuccess:`{{filename}} importé — enregistré dans Gestionnaire de fichiers → MakerWorld`,platesHeader:`Plateaux ({{count}})`,plateDefaultName:`Plateau {{n}}`,materialCount:`{{count}} filaments`,amsRequired:`AMS requis`,slicedFor:`Découpé pour {{printer}}`,alsoCompatible:`Également marqué compatible : {{printers}}`,importToLibrary:`Enregistrer`,sliceIn:`Enregistrer et découper dans {{slicer}}`,disclaimer:`L'intégration MakerWorld utilise des points de terminaison API documentés par la communauté. Bambuddy n'est ni affilié ni approuvé par MakerWorld ou Bambu Lab.`,lastImportSuccess:`Importé dans votre bibliothèque`,lastImportAlreadyInLibrary:`Déjà dans votre bibliothèque`,viewInLibrary:`Voir dans le Gestionnaire de fichiers`,openInBambuStudio:`Ouvrir dans Bambu Studio`,openInOrcaSlicer:`Ouvrir dans OrcaSlicer`,importTo:`Importer dans le Gestionnaire de fichiers`,recentImportsHeader:`Imports récents`,phaseResolving:`Résolution`,phaseDownloading:`Téléchargement`,folderAuto:`MakerWorld (par défaut)`,importAll:`Tout importer`,importAllProgress:`Importation de {{current}}/{{total}}`,openGallery:`Ouvrir la galerie d'images`,galleryPrev:`Image précédente`,galleryNext:`Image suivante`,deleteImport:`Retirer de la bibliothèque`,importDeleting:`Suppression…`,importDeleted:`Retiré de la bibliothèque`,confirmDelete:`Retirer {{filename}} de la bibliothèque ? Le fichier local est supprimé, mais la plaque peut être ré-importée depuis MakerWorld.`,errors:{resolveFailed:`Impossible de résoudre cette URL MakerWorld.`,downloadFailed:`Le téléchargement a échoué. Veuillez réessayer.`,deleteFailed:`Impossible de retirer le fichier de la bibliothèque.`}},gcodeViewer:{filamentSlot:`Filament {{n}}`,loading:`Lecture de la trajectoire…`,loadFailed:`Impossible de charger le G-code de ce fichier.`,showTravel:`Déplacements à vide`,topLayer:`Couche supérieure`,bottomLayer:`Couche inférieure`,noSource:`Aucun fichier à prévisualiser n’a été indiqué.`,view:{filament:`Filament`,feature:`Élément`,height:`Hauteur`,width:`Largeur`},feature:{wall:`Parois`,sparseInfill:`Remplissage clairsemé`,solidInfill:`Remplissage plein`,bridge:`Pont / surplomb`,support:`Support`,skirt:`Jupe / bordure`,gapFill:`Remplissage des vides`,ironing:`Lissage`,primeTower:`Tour de purge`},back:`Retour`,backToArchives:`Retour aux archives d'impression`,backToFiles:`Retour au gestionnaire de fichiers`,plates:`Plateaux`,plateN:`Plaque {{n}}`},libraryTrash:{title:`Corbeille`,headerButton:`Corbeille`,headerTooltip:`Voir les fichiers déplacés dans la corbeille`,backToFiles:`Retour au gestionnaire de fichiers`,subtitleAdmin:`Les fichiers supprimés restent ici pendant {{days}} jours, puis sont supprimés automatiquement. Cette vue affiche la corbeille de tous les utilisateurs.`,subtitleUser:`Les fichiers supprimés restent ici pendant {{days}} jours, puis sont supprimés automatiquement.`,loading:`Chargement de la corbeille…`,loadError:`Impossible de charger la corbeille.`,empty:`La corbeille est vide.`,summary:`{{count}} fichiers · {{size}}`,emptyTrash:`Vider la corbeille`,restore:`Restaurer`,purgeNow:`Supprimer maintenant`,autoPurgeIn:`Suppression automatique dans {{when}}`,days:`jours`,retentionLabel:`Supprimer automatiquement après`,selectAll:`Tout sélectionner`,selectOne:`Sélectionner {{filename}}`,selectionCount:`{{count}} sélectionné(s)`,bulkRestore:`Restaurer la sélection`,bulkPurge:`Supprimer la sélection`,col:{filename:`Fichier`,folder:`Dossier`,size:`Taille`,deleted:`Mis à la corbeille`,autoPurge:`Suppression auto.`,owner:`Propriétaire`,actions:`Actions`},confirm:{purgeTitle:`Supprimer définitivement ?`,purgeBody:`{{filename}} sera supprimé du disque et ne pourra pas être restauré.`,emptyTitle:`Vider la corbeille ?`,emptyBody:`Tous les {{count}} fichiers seront supprimés du disque. Cette action est irréversible.`,bulkPurgeTitle:`Supprimer définitivement les fichiers sélectionnés ?`,bulkPurgeBody:`Les {{count}} fichiers sélectionnés seront supprimés du disque et ne pourront pas être restaurés.`,cta:`Supprimer définitivement`},toast:{restored:`Fichier restauré.`,restoreFailed:`Impossible de restaurer le fichier.`,purged:`Fichier supprimé définitivement.`,purgeFailed:`Impossible de supprimer le fichier.`,emptied:`{{count}} fichier(s) supprimé(s) de la corbeille.`,emptyFailed:`Impossible de vider la corbeille.`,retentionSaved:`Suppression automatique réglée sur {{days}} jours.`,retentionFailed:`Impossible d'enregistrer le réglage de rétention.`,bulkRestored:`{{count}} fichier(s) restauré(s).`,bulkPurged:`{{count}} fichier(s) supprimé(s).`}},libraryPurge:{title:`Purger les anciens fichiers`,headerButton:`Purger`,headerTooltip:`Déplacer en masse les anciens fichiers vers la corbeille`,description:`Les fichiers plus anciens que le seuil seront déplacés vers la corbeille. Les dossiers externes sont ignorés. Vous pouvez restaurer depuis la corbeille avant la suppression automatique.`,ageLabel:`Déplacer les fichiers plus anciens que`,days:`jours`,includeNeverPrinted:`Inclure les fichiers jamais imprimés`,effectsTitle:`Ce qui se passe lorsque vous cliquez sur Purger`,effect1:`Les fichiers correspondants sont déplacés vers la corbeille — pas encore supprimés du disque.`,effect2:`Vous pouvez les restaurer depuis la corbeille jusqu'à l'expiration de la fenêtre de rétention.`,effect3:`Après la période de rétention, le balayeur de corbeille les supprime définitivement.`,effect4:`Les fichiers dans les dossiers externes (liés) sont ignorés — Bambuddy ne supprime jamais d'octets qu'il ne possède pas.`,previewLoading:`Vérification du nombre de fichiers concernés…`,previewFailed:`Impossible de prévisualiser la purge.`,previewSummary:`{{count}} fichiers · {{size}} seraient déplacés vers la corbeille`,andMore:`…et {{count}} de plus`,warning:`Les fichiers sont supprimés en douceur — vous pouvez les restaurer depuis la corbeille jusqu'à l'expiration de la période de rétention.`,confirmCta:`Déplacer {{count}} vers la corbeille`,purging:`Déplacement vers la corbeille…`,toast:{success:`{{count}} fichier(s) déplacé(s) vers la corbeille.`,failed:`Impossible de purger les fichiers.`}},libraryAutoPurge:{enableLabel:`Purge automatique des anciens fichiers`,enableDescription:`Exécute la purge administrateur une fois par jour. Les fichiers sont d'abord déplacés vers la corbeille — ils ne sont pas supprimés immédiatement.`,ageLabel:`Purger automatiquement les fichiers plus anciens que`,ageDescription:`Minimum 7 jours, maximum 10 ans. Utilise la même règle d'ancienneté que le bouton Purger manuel.`,days:`jours`,includeNeverPrinted:`Inclure les fichiers jamais imprimés`,saveFailed:`Impossible d'enregistrer les paramètres de purge automatique.`},archivePurge:{headerButton:`Purger les anciens`,headerTooltip:`Suppression groupée d'anciennes archives`,title:`Purger les anciennes archives`,description:`Effacer l'ancien historique d'impression. Chaque archive vieillit selon sa dernière impression terminée — réimprimer une archive remet son âge à zéro, donc le travail actif n'est jamais purgé.`,ageLabel:`Supprimer les archives non imprimées depuis`,days:`jours`,effectsTitle:`Ce qui se passe lorsque vous cliquez sur Purger`,effect1:`Chaque archive correspondante est masquée des listes et ses fichiers sont retirés du disque (3MF, miniature, timelapse, 3MF source, F3D, photos).`,effect2:`La ligne d'archive reste en base pour que les statistiques rapides conservent la contribution en filament, temps, coût et énergie — même comportement que la suppression individuelle par défaut.`,effect3:`Cochez « Aussi retirer des statistiques » ci-dessous pour également supprimer la contribution des statistiques rapides (équivalent à l'option de la suppression individuelle). Ce chemin est irréversible.`,effect4:`Réimprimer une archive remet son compteur à zéro, les archives actives sont donc protégées.`,purgeStatsLabel:`Aussi retirer des statistiques`,purgeStatsHint:`Supprime les archives correspondantes des statistiques rapides (filament, temps, coût, énergie). Sans cette option, les statistiques conservent chaque contribution et seuls les fichiers quittent le disque.`,previewLoading:`Vérification du nombre d'archives correspondantes…`,previewFailed:`Impossible de prévisualiser la purge.`,previewSummary:`{{count}} archives · {{size}} seraient retirées`,andMore:`…et {{count}} de plus`,warning:`Les fichiers sont retirés du disque et ne peuvent pas être restaurés. Téléchargez ou marquez comme favori avant de continuer.`,confirmCta:`Retirer {{count}} archive(s)`,purging:`Retrait en cours…`,toast:{success:`{{count}} archive(s) retirée(s).`,failed:`Impossible de purger les archives.`}},archiveAutoPurge:{enableLabel:`Purger auto. les anciennes archives`,enableDescription:`Une fois par jour, masque des listes les archives non imprimées dans le seuil et retire leurs fichiers du disque. Réimprimer remet le compteur à zéro.`,ageLabel:`Suppression auto. des archives non imprimées depuis`,ageDescription:`Minimum 7 jours, maximum 10 ans. Basé sur la dernière impression terminée — réimprimer remet l'âge à zéro. Retire 3MF, miniature, timelapse, 3MF source, F3D et photos.`,days:`jours`,purgeStatsLabel:`Aussi retirer des statistiques`,purgeStatsDescription:`Lorsqu'activé, le nettoyage quotidien supprime aussi la contribution de chaque archive purgée des statistiques rapides (filament, temps, coût, énergie). Désactivé par défaut — les statistiques conservent la contribution et seuls les fichiers quittent le disque.`,runNow:`Purger les archives maintenant`,saveFailed:`Impossible d'enregistrer les paramètres de purge automatique.`},connectedApps:{title:`Applications connectées`,description:`Applications auxquelles on se connecte avec son compte Bambuddy. Chaque application reçoit un identifiant client et un secret, et Bambuddy n'envoie une connexion qu'à l'URL de retour enregistrée ici.`,requiresAuth:`Les applications connectées nécessitent l'authentification Bambuddy. Activez-la d'abord dans Utilisateurs.`,name:`Nom de l'application`,namePlaceholder:`p. ex. Gestion des commandes`,callbackUrl:`URL de retour`,callbackHint:`La documentation de l'application indique son URL de retour. Elle doit correspondre exactement.`,add:`Ajouter une application`,empty:`Aucune application connectée pour l'instant.`,clientId:`Identifiant client`,clientSecret:`Secret client`,lastUsed:`Dernière connexion`,disabledBadge:`Désactivée`,enable:`Activer`,disable:`Désactiver`,rotate:`Nouveau secret`,delete:`Supprimer`,cancel:`Annuler`,copy:`Copier`,secret:{title:`{{name}} : copiez le secret maintenant`,warning:`Collez l'identifiant client et le secret dans l'application. Le secret n'est affiché qu'une seule fois ; s'il est perdu, créez-en un nouveau.`,dismiss:`Je l'ai enregistré`},confirmRotate:{title:`Créer un nouveau secret ?`,body:`« {{name}} » ne pourra plus connecter personne tant que vous n'y aurez pas collé le nouveau secret.`},confirmDelete:{title:`Supprimer cette application ?`,body:`« {{name}} » ne pourra plus connecter personne. Si elle est ajoutée à nouveau, chacun devra redonner son autorisation.`},toast:{created:`Application ajoutée`,enabled:`Application activée`,disabled:`Application désactivée`,rotated:`Nouveau secret créé`,deleted:`Application supprimée`,copied:`Copié dans le presse-papiers`,copyFailed:`Échec de la copie. Sélectionnez le texte et copiez-le manuellement.`,failed:`Une erreur s'est produite`},authorize:{checking:`Vérification de la demande de connexion…`,redirecting:`Connexion en cours…`,errorTitle:`Connexion impossible`,invalidRequest:`Cette demande de connexion n'est pas valide : l'application n'est pas enregistrée, est désactivée ou utilise une autre URL de retour. Demandez à votre administrateur Bambuddy de vérifier Paramètres > Clés API > Applications connectées.`,authDisabled:`La connexion avec Bambuddy n'est pas disponible car l'authentification Bambuddy est désactivée. Utilisez plutôt la connexion propre à l'application.`,failed:`La connexion a échoué. Revenez à l'application et réessayez.`,title:`{{app}} souhaite vous connecter`,signedInAs:`Connecté à Bambuddy en tant que {{username}}`,sharedData:`{{app}} verra votre nom d'utilisateur, votre adresse e-mail, vos groupes et vos autorisations. Elle n'obtient ni votre mot de passe ni votre session Bambuddy.`,allow:`Autoriser`,deny:`Annuler`}},cameraTokens:{scope:{camera_stream:`Flux de caméra`,camwall:`Mur de caméras`,overlay:`Incrustation de streaming`},title:`Jetons API caméra`,navTitle:`Jetons API caméra`,description:`Jetons de longue durée pour intégrer le flux de caméra dans Home Assistant, Frigate, des écrans en mode kiosque ou tout autre outil nécessitant une adresse stable. La portée se choisit à la création ; un jeton peut être révoqué à tout moment.`,loading:`Chargement…`,confirmRevoke:{title:`Révoquer ce jeton ?`,body:`Tout appareil utilisant "{{name}}" perdra l'accès immédiatement. Action irréversible.`,cancel:`Annuler`,confirm:`Révoquer`},create:{scopeLabel:`Portée`,hintCameraStream:`Un jeton de flux de caméra ne peut récupérer que des flux et des instantanés. À utiliser pour Home Assistant, Frigate ou tout ce qui intègre une seule caméra.`,hintCamWall:`Un jeton Mur de caméras ouvre /camwall sur un écran sans connexion. Il voit le nom et l'état de chaque imprimante, ainsi que leurs flux de caméra. Il ne voit ni les noms de fichiers, ni les adresses, ni les codes d'accès.`,hintOverlay:`Un jeton Incrustation de streaming ouvre /overlay/{printerId} sur un écran sans connexion — pour OBS ou tout autre flux en direct. Il voit le flux de caméra d'une imprimante ainsi que son état d'impression en direct, y compris le nom de fichier affiché à l'écran. Il ne voit ni les adresses ni les codes d'accès.`,title:`Créer un nouveau jeton`,nameLabel:`Nom du jeton`,namePlaceholder:`par ex. Home Assistant`,daysLabel:`Jours avant expiration`,submit:`Créer`,hint:`Durée de vie maximale 365 jours. La valeur du jeton n'est affichée qu'une seule fois — copiez-la maintenant.`},created:{camWallUrlTitle:`Adresse du mur de caméras pour cet écran`,camWallUrlHint:`Ouvrez cette adresse sur l'écran. Quiconque peut lire l'adresse peut regarder le mur : traitez-la comme une clé. Révoquez le jeton pour couper l'écran.`,overlayUrlTitle:`Adresse d'incrustation pour OBS`,overlayUrlHint:`Ajoutez ceci comme Source navigateur dans OBS. Remplacez le numéro dans /overlay/1 par le numéro de votre imprimante (indiqué dans son adresse sur la page Imprimantes). Quiconque peut lire l'adresse peut regarder le flux : traitez-la comme une clé et révoquez le jeton pour couper l'accès.`,title:`Jeton créé – copiez-le maintenant`,warning:`C'est la seule fois où ce jeton sera visible. Après la fermeture de ce dialogue, vous ne pourrez plus jamais le voir.`,copy:`Copier`,dismiss:`Je l'ai enregistré`},list:{scope:`Portée`,myTitle:`Mes jetons`,allTitle:`Tous les utilisateurs (vue admin)`,empty:`Aucun jeton pour le moment.`,name:`Nom`,owner:`Propriétaire`,prefix:`Préfixe`,created:`Créé`,expires:`Expire`,lastUsed:`Dernière utilisation`,revoke:`Révoquer`,expired:`Expiré`},toast:{created:`Jeton créé`,createFailed:`Échec de la création du jeton`,revoked:`Jeton révoqué`,revokeFailed:`Échec de la révocation du jeton`,loadFailed:`Échec du chargement des jetons`,copied:`Copié dans le presse-papiers`,copyFailed:`Échec de la copie – sélectionnez et copiez manuellement`}},forecast:{title:`Prévision des stocks`,noSpools:`Aucune bobine active trouvée. Ajoutez des bobines à votre inventaire pour voir les données de prévision.`,noUsageData:`Aucune donnée d'utilisation disponible — impossible de projeter la chronologie des stocks.`,sku:`SKU`,material:`Matériau`,stock:`Stock`,dailyRate:`Cadence`,daysLeft:`Jours restants`,emptyBy:`Épuisé le`,reorderBy:`Réapprovisionner avant le`,actions:`Actions`,trend:`Tendance`,estimated:`Est.`,noData:`Aucune donnée`,timeframe:`Période`,chartTitle:`Prévision du stock — Top 5 matériaux`,dashedLinesROP:`Lignes pointillées = points de réapprovisionnement`,stockLevel:`Niveau de stock`,reorderPoint:`Point de réapprovisionnement`,safetyMargin:`Marge de sécurité`,trendLegend:`Tendance (basée sur l'historique, niveau de service 95 %)`,estimatedLegend:`Estimée (delta de poids)`,noDataLegend:`Aucune donnée`,ropLabel:`PR`,ssLabel:`SS`,safetyStockLegend:`Stock de sécurité`,stockArrivalLegend:`Arrivée du stock`,stockoutLegend:`Rupture de stock`,alertCount_one:`{{count}} alerte`,alertCount_other:`{{count}} alertes`,order:`Commander`,globalLeadTime:`Délai global`,globalLeadTimeHint:`Délai global minimum — utilisé dans le calcul du point de réapprovisionnement pour tous les SKUs`,save:`Enregistrer`,cancel:`Annuler`,settingsSaved:`Paramètres enregistrés`,failedSaveSettings:`Échec de l'enregistrement des paramètres`,globalLeadTimeSaved:`Délai global enregistré`,skuLeadTimeOverride:`Délai spécifique au SKU`,skuLeadTimeHint:`0 = utiliser le délai global. Définir >0 pour remplacer ce SKU.`,safetyMarginLabel:`Marge de sécurité`,effectiveLeadTime:`Délai effectif`,effectiveLeadTimeHint:`max(global {{global}}j, SKU {{sku}}j)`,reorderPointHint:`d̄ × LT + safety margin — commander quand le stock atteint ce niveau`,safetyMarginHint:`Stock de sécurité statistique (z=1,65 × σ × √LT) + tampon défini par l'utilisateur`,safetyMarginHintDays:`Tampon ajouté par-dessus le stock de sécurité statistique.{{approx}}`,safetyMarginHintDaysApprox:` ≈ {{g}}g au taux actuel.`,safetyMarginHintG:`Tampon de poids fixe ajouté par-dessus le stock de sécurité statistique.{{approx}}`,safetyMarginHintGApprox:` ≈ {{days}}j au taux actuel.`,individualSpools:`Bobines individuelles`,labelWeight:`Étiquette`,spoolCount_one:`{{count}} bobine`,spoolCount_other:`{{count}} bobines`,stockBreakRisk:`Risque de rupture de stock`,stockBreakBefore:`Rupture de stock avant réapprovisionnement`,stockBreakDetail:`{{days}}j restants, délai {{lt}}j.`,reorderNow:`Réapprovisionner maintenant`,reorderTriggerPassed:`La date de déclenchement {{date}} est passée.`,shoppingList:`Liste d'achats`,shoppingListItems_one:`({{count}} article)`,shoppingListItems_other:`({{count}} articles)`,shoppingListEmpty:`La liste d'achats est vide. Cliquez sur l'icône panier d'une ligne pour ajouter des articles.`,addToCart:`Ajouter à la liste d'achats`,alertsSnoozed:`Désactiver les alertes pour ce SKU`,alertsEnabled:`Activer les alertes pour ce SKU`,addedToCart:`Ajouté à la liste de courses`,failedAddItem:`Impossible d'ajouter l'article`,listView:`Liste`,logisticsView:`Logistique`,qty:`Qté`,weight:`Poids`,leadTime:`Délai`,expectedRestock:`Réapprovisionnement prévu`,status:`Statut`,note:`Note`,pending:`En attente`,purchased:`Commandé`,received:`Reçu`,markPurchased:`Marquer comme commandé`,markReceived:`Marquer comme reçu — ajoute les bobines au stock`,resetToPending:`Remettre en attente`,remove:`Supprimer`,clearAll:`Tout effacer`,downloadCsv:`CSV`,addToCartTitle:`Ajouter à la liste de courses`,byQuantity:`Par quantité`,byDuration:`Par durée`,numberOfSpools:`Nombre de bobines`,lastHowManyDays:`Combien de jours doit-il durer ?`,noUsageQty:`Pas de données d'utilisation — quantité définie à 1.`,noteOptional:`Note (optionnel)`,notePlaceholder:`ex. pour le projet X, urgent…`,addNSpools_one:`Ajouter {{count}} bobine`,addNSpools_other:`Ajouter {{count}} bobines`,onArrival:`À la livraison`,stockBreakIn:`Rupture de stock dans {{days}}j.`,stockRunsOutBefore:`Le stock s'épuise avant la fin du délai de {{lt}}j.`,atRate:`À {{rate}}g/jour, vous avez besoin de`,moreSpools_one:`{{count}} bobine supplémentaire`,moreSpools_other:`{{count}} bobines supplémentaires`,bridgeGap:`pour combler l'écart.`,noReadAccess:`Vous n'avez pas la permission de consulter les prévisions de stock.`,noWriteAccess:`Vous n'avez pas la permission de modifier les paramètres de prévision.`}};export{e as default}; \ No newline at end of file diff --git a/static/assets/funnel-C3dyAMK9.js b/static/assets/funnel-C3dyAMK9.js new file mode 100644 index 000000000..8017a93ab --- /dev/null +++ b/static/assets/funnel-C3dyAMK9.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/gauge-D21zgWMb.js b/static/assets/gauge-D21zgWMb.js new file mode 100644 index 000000000..3728a94f0 --- /dev/null +++ b/static/assets/gauge-D21zgWMb.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/git-compare-J4KX0xAJ.js b/static/assets/git-compare-J4KX0xAJ.js new file mode 100644 index 000000000..e82f3de3d --- /dev/null +++ b/static/assets/git-compare-J4KX0xAJ.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/grip-vertical-C_1RDxRw.js b/static/assets/grip-vertical-C_1RDxRw.js new file mode 100644 index 000000000..e7e6693bf --- /dev/null +++ b/static/assets/grip-vertical-C_1RDxRw.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/haSensorDisplay-lPbcOxD8.js b/static/assets/haSensorDisplay-lPbcOxD8.js new file mode 100644 index 000000000..be2c2c380 --- /dev/null +++ b/static/assets/haSensorDisplay-lPbcOxD8.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";import{t}from"./gauge-D21zgWMb.js";import{t as n}from"./lock-MLqgWH4Q.js";import{n as r,t as i}from"./wind-CI8UoBMf.js";import{t as a}from"./triangle-alert-Dt_1FcBy.js";var o=e(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),s=e(`battery`,[[`path`,{d:`M 22 14 L 22 10`,key:`nqc4tb`}],[`rect`,{x:`2`,y:`6`,width:`16`,height:`12`,rx:`2`,key:`13zb55`}]]),c=e(`door-closed`,[[`path`,{d:`M10 12h.01`,key:`1kxr2c`}],[`path`,{d:`M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14`,key:`36qu9e`}],[`path`,{d:`M2 20h20`,key:`owomy5`}]]),l=e(`door-open`,[[`path`,{d:`M11 20H2`,key:`nlcfvz`}],[`path`,{d:`M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z`,key:`au4z13`}],[`path`,{d:`M11 4H8a2 2 0 0 0-2 2v14`,key:`74r1mk`}],[`path`,{d:`M14 12h.01`,key:`1jfl7z`}],[`path`,{d:`M22 20h-3`,key:`vhrsz`}]]),u=e(`droplets`,[[`path`,{d:`M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z`,key:`1ptgy4`}],[`path`,{d:`M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97`,key:`1sl1rz`}]]),d=e(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),f=e(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),p={door:{on:`open`,off:`closed`},garage_door:{on:`open`,off:`closed`},window:{on:`open`,off:`closed`},opening:{on:`open`,off:`closed`},lock:{on:`unlocked`,off:`locked`},motion:{on:`detected`,off:`clear`},occupancy:{on:`detected`,off:`clear`},presence:{on:`detected`,off:`clear`},smoke:{on:`detected`,off:`clear`},gas:{on:`detected`,off:`clear`},moisture:{on:`wet`,off:`dry`},problem:{on:`problem`,off:`ok`},safety:{on:`problem`,off:`ok`},running:{on:`running`,off:`stopped`}},m={door:l,garage_door:l,window:l,opening:l,lock:d,temperature:r,humidity:u,moisture:u,battery:s,motion:o,occupancy:o,presence:o,smoke:a,gas:a,problem:a,safety:a,running:i};function h(e,t,n){if(!e.reachable||e.state===null)return t(`haSensors.unavailable`);if(e.kind===`numeric`){if(e.value===null)return e.state;let t=n?.decimals===void 0?String(e.value):e.value.toFixed(n.decimals);return e.unit?`${t} ${e.unit}`:t}let r=p[e.device_class??``],i=r?r[e.state===`on`?`on`:`off`]:e.state;return t(`haSensors.states.${i}`,{defaultValue:i})}function g(e){let r=e.device_class??``;if(e.state===`off`){if(m[r]===l)return c;if(m[r]===d)return n}return m[r]??(e.kind===`numeric`?t:o)}export{d as a,c,f as i,s as l,h as n,u as o,g as r,l as s,p as t,o as u}; \ No newline at end of file diff --git a/static/assets/hard-drive-CgXAHN37.js b/static/assets/hard-drive-CgXAHN37.js new file mode 100644 index 000000000..6c602fc09 --- /dev/null +++ b/static/assets/hard-drive-CgXAHN37.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`hard-drive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/history-B4lOLL01.js b/static/assets/history-B4lOLL01.js new file mode 100644 index 000000000..43569fcd1 --- /dev/null +++ b/static/assets/history-B4lOLL01.js @@ -0,0 +1 @@ +import{t as e}from"./createLucideIcon-DvBYJlWL.js";var t=e(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]);export{t}; \ No newline at end of file diff --git a/static/assets/index-CovRLYqQ.js b/static/assets/index-CovRLYqQ.js new file mode 100644 index 000000000..f55986624 --- /dev/null +++ b/static/assets/index-CovRLYqQ.js @@ -0,0 +1,24 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PrintersPage-CQ9ERKo2.js","assets/chunk-aKtaBQYM.js","assets/CartesianChart-BAcHzPFb.js","assets/createLucideIcon-DvBYJlWL.js","assets/client-DnySrlFv.js","assets/react-dom-B8Dg6xzp.js","assets/with-selector-CsEuXInf.js","assets/QueryClientProvider-Ce8_sN3w.js","assets/useMutation-B-Tr2hIP.js","assets/useQuery-BBCjCezC.js","assets/ErrorBarContext-CcijMMkA.js","assets/FileUploadModal-AIFgu8X7.js","assets/info-ROUoQhJR.js","assets/ToastContext-BRX0SW3C.js","assets/loader-circle-BEmFtawu.js","assets/x-DR-Trv6U.js","assets/file-DDkFXH-b.js","assets/ContextMenu-Bt5_A0ZU.js","assets/search-0n0CBc74.js","assets/zoom-out-DNNe6DMN.js","assets/OrbitControls-Bbqf07B-.js","assets/Button-DDr6eAFy.js","assets/haSensorDisplay-lPbcOxD8.js","assets/gauge-D21zgWMb.js","assets/lock-MLqgWH4Q.js","assets/wind-CI8UoBMf.js","assets/triangle-alert-Dt_1FcBy.js","assets/arrow-down-Cj0DZhNf.js","assets/arrow-left-0Q6F2rjC.js","assets/arrow-right-DedpIMhP.js","assets/arrow-up-down-BdyOV_2F.js","assets/arrow-up-D-pfJ3WZ.js","assets/ReferenceLine-clJprXoH.js","assets/box-DAdKb9s5.js","assets/fan-D6AmXZMv.js","assets/calendar-BLKPnWqV.js","assets/check-Ck0cMLU4.js","assets/copy-Cu_0GKCU.js","assets/ellipsis-vertical-t2D7cYyp.js","assets/eye-off-6CkaxYwP.js","assets/file-box-04V4jZ9_.js","assets/GcodeToolpathViewer-Cg6UnTDw.js","assets/scan-search-BDoNAXzz.js","assets/funnel-C3dyAMK9.js","assets/grip-vertical-C_1RDxRw.js","assets/hard-drive-CgXAHN37.js","assets/layout-grid-DkD3u6wa.js","assets/log-in-n0ckHxnD.js","assets/maximize-2-kPQ77q72.js","assets/minimize-2-dqT-k7oI.js","assets/CameraDiagnoseModal-RgByyfP2.js","assets/minus-DypeGjGR.js","assets/CopyButton-C5In5weo.js","assets/move-Bc1EIjTD.js","assets/package-BGUevlqS.js","assets/pause-DFb6GX_6.js","assets/play-DIDYtk2S.js","assets/settings-2-Cvn837lh.js","assets/unlink-C098nwOf.js","assets/CameraWall-lBUed8MZ.js","assets/useQueries-Be6PMvSC.js","assets/date-G9KUauqz.js","assets/ConfigureAmsSlotModal-CpOmPM3O.js","assets/utils-dMg0ogiz.js","assets/useCancellableTimeout-3XQzNJkJ.js","assets/inventorySearch-CtBW7_f5.js","assets/slicerPrinterMatch-CUdoNag2.js","assets/Card-Bzc64K35.js","assets/Toggle-KiqA_5fU.js","assets/filamentSwatchHelpers-D3oXQSGk.js","assets/printerModel-DrNvERGQ.js","assets/queueItemName-UFY7kpjG.js","assets/ArchivesPage-C-m2N5Wj.js","assets/RichTextEditor-CuGcRbGW.js","assets/list-CLcpeoSz.js","assets/purify.es-F_7NWVtX.js","assets/chevrons-right-DTJgqnxZ.js","assets/cog-Dol1I0kq.js","assets/coins-4u6IPkR-.js","assets/columns-2-DVEObeDC.js","assets/file-spreadsheet-WxOA9vYy.js","assets/git-compare-J4KX0xAJ.js","assets/SliceModal-2Iz_Qz3v.js","assets/cloud-off-DfYbNG2N.js","assets/history-B4lOLL01.js","assets/pen-line-BWR04BX-.js","assets/qr-code-CCCo2-Br.js","assets/skip-forward-BsuMfFkw.js","assets/sticky-note-BH0LPqRx.js","assets/ColumnConfigModal-gVVhKfHC.js","assets/PhotoGalleryModal-CHRwUNN5.js","assets/filamentTypes-Dysa4k6j.js","assets/slicer-DgCA7cW6.js","assets/QueuePage-Cx8xPABc.js","assets/sortable.esm-D2bGix-3.js","assets/timer-GUTR9dAu.js","assets/workflow-BgT0wW83.js","assets/StatsPage-CuJD7mWH.js","assets/dollar-sign-Cj_Yhud4.js","assets/target-B40GQtrA.js","assets/AreaChart-DJpIJXxF.js","assets/SettingsPage-TND5EBtx.js","assets/briefcase-Dau7xqMY.js","assets/cpu-BKWEtc8k.js","assets/link-2-MI-QCMh8.js","assets/locationSensorDefaults-zb4rpqFF.js","assets/scale-CD6XdXUk.js","assets/shield-bODVqOJd.js","assets/smartphone-DaDGaGLT.js","assets/OverlayFrame-fLmufrTC.js","assets/FinancePage-90vCG868.js","assets/ProfilesPage-B8UohL29.js","assets/droplet-CqYXMF2u.js","assets/sparkles-DRqKNlhr.js","assets/MaintenancePage-DUkfiEWj.js","assets/ProjectsPage-thNs0J44.js","assets/ProjectDetailPage-x9_vyzmk.js","assets/libraryFiles-B0B1SFfn.js","assets/FileManagerPage-CSExcpmf.js","assets/usePreviewFullscreen-ButueZqN.js","assets/LibraryTrashPage-Ch5GUozX.js","assets/CameraPage-6_IS1759.js","assets/CamWallPage-C6KBEffK.js","assets/StreamOverlayPage-Ck7DNYWg.js","assets/StreamOverlayPage-CA9KpVK8.css","assets/ExternalLinkPage-B6dDCCBN.js","assets/GroupEditPage-n-or9M-C.js","assets/PrinterLocationsPage-Bh8TYbzi.js","assets/InventoryPage-6lFm9yo0.js","assets/AdditionalSection-ZKpgGfxh.js","assets/AssignToAmsModal-DOax3BGf.js","assets/AmsUnitCard-CRqkD3Lg.js","assets/spoolPaint-CrvpHqdD.js","assets/ModelSourcesPage-COtV7L7T.js","assets/SystemInfoPage-Btg_r_Hv.js","assets/LoginPage-COCFpNMo.js","assets/ConnectAuthorizePage-kYDbSdif.js","assets/SetupPage-Dzw-F49q.js","assets/NotificationsPage-PUM7obke.js","assets/GCodeViewerPage-DsmGciSh.js","assets/SpoolBuddyDashboard-1rrNfFCt.js","assets/SpoolIcon-DE8TbEec.js","assets/SpoolBuddyAmsPage-CbOxHSuL.js","assets/SpoolBuddySettingsPage-C6SPF9Jm.js","assets/SpoolBuddyCalibrationPage-CsuD4P08.js","assets/SpoolBuddyWriteTagPage-DGVWhIOm.js","assets/SpoolBuddyInventoryPage-C7DfINfT.js"])))=>i.map(i=>d[i]); +import{i as e,t}from"./chunk-aKtaBQYM.js";import{C as n,D as r,E as i,_ as a,a as o,d as s,g as c,h as l,i as u,l as d,m as f,o as p,p as m,t as h,u as g,v as _,w as v,x as y,y as b}from"./client-DnySrlFv.js";import{t as x}from"./react-dom-B8Dg6xzp.js";import{A as S,C,D as w,N as T,S as E,_ as D,b as O,c as k,d as A,f as j,g as M,h as N,m as P,n as F,p as I,s as ee,t as te,u as ne,x as L}from"./QueryClientProvider-Ce8_sN3w.js";import{f as R,t as z}from"./useQuery-BBCjCezC.js";import{n as re,t as ie}from"./useMutation-B-Tr2hIP.js";import{t as B}from"./useQueries-Be6PMvSC.js";import{t as V}from"./createLucideIcon-DvBYJlWL.js";import{t as ae}from"./arrow-down-Cj0DZhNf.js";import{t as oe}from"./arrow-up-D-pfJ3WZ.js";import{t as se}from"./calendar-BLKPnWqV.js";import{t as ce}from"./check-Ck0cMLU4.js";import{a as le,i as H,n as ue,r as de,t as U}from"./info-ROUoQhJR.js";import{n as fe,r as pe,t as me}from"./ToastContext-BRX0SW3C.js";import{t as he}from"./loader-circle-BEmFtawu.js";import{t as ge}from"./triangle-alert-Dt_1FcBy.js";import{t as _e}from"./x-DR-Trv6U.js";import{i as ve,n as ye,t as be}from"./Card-Bzc64K35.js";import{t as xe}from"./Button-DDr6eAFy.js";import{_ as Se,d as Ce,f as we,g as Te,i as Ee,m as De,o as Oe,p as ke,r as Ae,v as je,y as Me}from"./date-G9KUauqz.js";import{n as Ne,r as Pe}from"./filamentSwatchHelpers-D3oXQSGk.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Fe=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Ie=t(((e,t)=>{t.exports=Fe()})),Le=t((e=>{var t=Ie(),n=r(),i=x();function a(e){var t=`https://react.dev/errors/`+e;if(1ne||(e.current=te[ne],te[ne]=null,ne--)}function z(e,t){ne++,te[ne]=e.current,e.current=t}var re=L(null),ie=L(null),B=L(null),V=L(null);function ae(e,t){switch(z(B,t),z(ie,e),z(re,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(re),z(re,e)}function oe(){R(re),R(ie),R(B)}function se(e){e.memoizedState!==null&&z(V,e);var t=re.current,n=Hd(t,e.type);t!==n&&(z(ie,e),z(re,n))}function ce(e){ie.current===e&&(R(re),R(ie)),V.current===e&&(R(V),Qf._currentValue=ee)}var le,H;function ue(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,H=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{de=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ue(n):``}function fe(e,t){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue(`Lazy`);case 13:return e.child!==t&&t!==null?ue(`Suspense Fallback`):ue(`Suspense`);case 19:return ue(`SuspenseList`);case 0:case 15:return U(e.type,!1);case 11:return U(e.type.render,!1);case 1:return U(e.type,!0);case 31:return ue(`Activity`);default:return``}}function pe(e){try{var t=``,n=null;do t+=fe(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var me=Object.prototype.hasOwnProperty,he=t.unstable_scheduleCallback,ge=t.unstable_cancelCallback,_e=t.unstable_shouldYield,ve=t.unstable_requestPaint,ye=t.unstable_now,be=t.unstable_getCurrentPriorityLevel,xe=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Ce=t.unstable_NormalPriority,we=t.unstable_LowPriority,Te=t.unstable_IdlePriority,Ee=t.log,De=t.unstable_setDisableYieldValue,Oe=null,ke=null;function Ae(e){if(typeof Ee==`function`&&De(e),ke&&typeof ke.setStrictMode==`function`)try{ke.setStrictMode(Oe,e)}catch{}}var je=Math.clz32?Math.clz32:Pe,Me=Math.log,Ne=Math.LN2;function Pe(e){return e>>>=0,e===0?32:31-(Me(e)/Ne|0)|0}var Fe=256,Le=262144,Re=4194304;function W(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ze(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=W(n))):i=W(o):i=W(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=W(n))):i=W(o)):i=W(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function G(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Be(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ve(){var e=Re;return Re<<=1,!(Re&62914560)&&(Re=4194304),e}function He(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ue(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function We(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),nn=!1;if(tn)try{var rn={};Object.defineProperty(rn,"passive",{get:function(){nn=!0}}),window.addEventListener(`test`,rn,rn),window.removeEventListener(`test`,rn,rn)}catch{nn=!1}var an=null,on=null,sn=null;function cn(){if(sn)return sn;var e,t=on,n=t.length,r,i=`value`in an?an.value:an.textContent,a=i.length;for(e=0;e=Rn),Vn=` `,Hn=!1;function Un(e,t){switch(e){case`keyup`:return In.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Wn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Gn=!1;function Kn(e,t){switch(e){case`compositionend`:return Wn(t);case`keypress`:return t.which===32?(Hn=!0,Vn):null;case`textInput`:return e=t.data,e===Vn&&Hn?null:e;default:return null}}function qn(e,t){if(Gn)return e===`compositionend`||!Ln&&Un(e,t)?(e=cn(),sn=on=an=null,Gn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=hr(n)}}function _r(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_r(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function vr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=kt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=kt(e.document)}return t}function yr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var br=tn&&`documentMode`in document&&11>=document.documentMode,xr=null,Sr=null,Cr=null,wr=!1;function Tr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wr||xr==null||xr!==kt(r)||(r=xr,`selectionStart`in r&&yr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Cr&&mr(Cr,r)||(Cr=r,r=Td(Sr,`onSelect`),0>=o,i-=o,_i=1<<32-je(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),J&&yi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),J&&yi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return J&&yi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),J&&yi(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&va(l)===r.type){n(e,r.sibling),c=i(r,o.props),Ta(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===_?(c=ii(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ri(o.type,o.key,o.props,null,e.mode,c),Ta(c,o),c.return=e,e=c)}return s(e);case g:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=si(o,e.mode,c),c.return=e,e=c}return s(e);case D:return o=va(o),b(e,r,o,c)}if(P(o))return v(e,r,o,c);if(j(o)){if(l=j(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,wa(o),c);if(o.$$typeof===S)return b(e,r,Ki(e,o),c);Ea(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=ai(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ca=0;var i=b(e,t,n,r);return Sa=null,i}catch(t){if(t===fa||t===ma)throw t;var a=$r(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Oa=Da(!0),ka=Da(!1),Aa=!1;function ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ma(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Nl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Xr(e),Yr(e,null,n),t}return Kr(e,r,t,n),Xr(e)}function Fa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ke(e,n)}}function Ia(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var La=!1;function Ra(){if(La){var e=ra;if(e!==null)throw e}}function za(e,t,n,r){La=!1;var i=e.updateQueue;Aa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,m=f!==s.lane;if(m?(Fl&f)===f:(r&f)===f){f!==0&&f===na&&(La=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=p({},d,f);break a;case 2:Aa=!0}}f=s.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[f]:m.push(f))}else m={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ba(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function Va(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=F.T,s={};F.T=s,Es(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ts(e,t,oa(c,r),du(e)):Ts(e,t,r,du(e))}catch(n){Ts(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{I.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function gs(){}function _s(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=vs(e).queue;hs(e,i,t,ee,n===null?gs:function(){return ys(e),n(r)})}function vs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ys(e){var t=vs(e);t.next===null&&(t=e.alternate.memoizedState),Ts(e,t.next.queue,{},du())}function bs(){return Gi(Qf)}function xs(){return Co().memoizedState}function Ss(){return Co().memoizedState}function Cs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Na(n);var r=Pa(t,e,n);r!==null&&(pu(r,t,n),Fa(r,t,n)),t={cache:Qi()},e.payload=t;return}t=t.return}}function ws(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ds(e)?Os(t,n):(n=qr(e,t,n,r),n!==null&&(pu(n,e,r),ks(n,t,r)))}function Z(e,t,n){Ts(e,t,n,du())}function Ts(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ds(e))Os(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,pr(s,o))return Kr(e,t,i,0),Pl===null&&Gr(),!1}catch{}if(n=qr(e,t,i,r),n!==null)return pu(n,e,r),ks(n,t,r),!0}return!1}function Es(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ds(e)){if(t)throw Error(a(479))}else t=qr(e,n,r,2),t!==null&&pu(t,e,2)}function Ds(e){var t=e.alternate;return e===X||t!==null&&t===X}function Os(e,t){oo=ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ks(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ke(e,n)}}var As={readContext:Gi,use:Eo,useCallback:po,useContext:po,useEffect:po,useImperativeHandle:po,useLayoutEffect:po,useInsertionEffect:po,useMemo:po,useReducer:po,useRef:po,useState:po,useDebugValue:po,useDeferredValue:po,useTransition:po,useSyncExternalStore:po,useId:po,useHostTransitionStatus:po,useFormState:po,useActionState:po,useOptimistic:po,useMemoCache:po,useCacheRefresh:po};As.useEffectEvent=po;var js={readContext:Gi,use:Eo,useCallback:function(e,t){return So().memoizedState=[e,t===void 0?null:t],e},useContext:Gi,useEffect:ns,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),es(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){es(4,2,e,t)},useMemo:function(e,t){var n=So();t=t===void 0?null:t;var r=e();if(so){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=So();if(n!==void 0){var i=n(t);if(so){Ae(!0);try{n(t)}finally{Ae(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ws.bind(null,X,e),[r.memoizedState,e]},useRef:function(e){var t=So();return e={current:e},t.memoizedState=e},useState:function(e){e=Ro(e);var t=e.queue,n=Z.bind(null,X,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:us,useDeferredValue:function(e,t){return ps(So(),e,t)},useTransition:function(){var e=Ro(!1);return e=hs.bind(null,X,e.queue,!0,!1),So().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=X,i=So();if(J){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),Pl===null)throw Error(a(349));Fl&127||No(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,ns(Fo.bind(null,r,o,e),[e]),r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,o,n,t),null),n},useId:function(){var e=So(),t=Pl.identifierPrefix;if(J){var n=vi,r=_i;n=(r&~(1<<32-je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=co++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[$e]=t,o[et]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Tc(t)}}return Ac(t),Ec(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Tc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=B.current,ji(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=wi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[$e]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Oi(t,!0)}else e=Bd(e).createTextNode(r),e[$e]=t,t.stateNode=e}return Ac(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ji(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[$e]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ac(t),e=!1}else n=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?($a(t),t):($a(t),null);if(t.flags&128)throw Error(a(558))}return Ac(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ji(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[$e]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ac(t),i=!1}else i=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?($a(t),t):($a(t),null)}return $a(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Oc(t,t.updateQueue),Ac(t),null);case 4:return oe(),e===null&&xd(t.stateNode.containerInfo),Ac(t),null;case 10:return zi(t.type),Ac(t),null;case 19:if(R(eo),r=t.memoizedState,r===null)return Ac(t),null;if(i=(t.flags&128)!=0,o=r.rendering,o===null)if(i)kc(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=to(e),o!==null){for(t.flags|=128,kc(r,!1),e=o.updateQueue,t.updateQueue=e,Oc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ni(n,e),n=n.sibling;return z(eo,eo.current&1|2),J&&yi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ye()>$l&&(t.flags|=128,i=!0,kc(r,!1),t.lanes=4194304)}else{if(!i)if(e=to(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Oc(t,e),kc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!J)return Ac(t),null}else 2*ye()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,i=!0,kc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Ac(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ye(),e.sibling=null,n=eo.current,z(eo,i?n&1|2:n&1),J&&yi(t,r.treeForkCount),e);case 22:case 23:return $a(t),Ka(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ac(t),t.subtreeFlags&6&&(t.flags|=8192)):Ac(t),n=t.updateQueue,n!==null&&Oc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&R(ca),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),zi(Zi),Ac(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Mc(e,t){switch(Si(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zi(Zi),oe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ce(t),null;case 31:if(t.memoizedState!==null){if($a(t),t.alternate===null)throw Error(a(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($a(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(eo),null;case 4:return oe(),null;case 10:return zi(t.type),null;case 22:case 23:return $a(t),Ka(),e!==null&&R(ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zi(Zi),null;case 25:return null;default:return null}}function Nc(e,t){switch(Si(t),t.tag){case 3:zi(Zi),oe();break;case 26:case 27:case 5:ce(t);break;case 4:oe();break;case 31:t.memoizedState!==null&&$a(t);break;case 13:$a(t);break;case 19:R(eo);break;case 10:zi(t.type);break;case 22:case 23:$a(t),Ka(),e!==null&&R(ca);break;case 24:zi(Zi)}}function Pc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function Fc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function Ic(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Va(t,n)}catch(t){Uu(e,e.return,t)}}}function Lc(e,t,n){n.props=Rs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function Rc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function zc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}function Bc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Vc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[et]=t}catch(t){Uu(e,e.return,t)}}function Hc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Uc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Hc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Kt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[$e]=e,t[et]=n}catch(t){Uu(e,e.return,t)}}var qc=!1,Jc=!1,Yc=!1,Xc=typeof WeakSet==`function`?WeakSet:Set,Zc=null;function Qc(e,t){if(e=e.containerInfo,Rd=sp,e=vr(e),yr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Zc=t;Zc!==null;)if(t=Zc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Zc=e;else for(;Zc!==null;){switch(t=Zc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(o,r,n),o[$e]=e,ft(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=gr(s,h),v=gr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,F.T=null,n=su,su=null;var o=ru,s=au;if(nu=0,iu=ru=null,au=0,Nl&6)throw Error(a(331));var c=Nl;if(Nl|=4,Ol(o.current),bl(o,o.current,s,n),Nl=c,rd(0,!1),ke&&typeof ke.onPostCommitFiberRoot==`function`)try{ke.onPostCommitFiberRoot(Oe,o)}catch{}return!0}finally{I.p=i,F.T=r,zu(e,t)}}function Hu(e,t,n){t=li(n,t),t=Ws(e.stateNode,t,2),e=Pa(e,t,2),e!==null&&(Ue(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=li(n,e),n=Gs(2),r=Pa(t,n,2),r!==null&&(Ks(n,r,t,e),Ue(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ml;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Bl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Pl===e&&(Fl&n)===n&&(Hl===4||Hl===3&&(Fl&62914560)===Fl&&300>ye()-Zl?!(Nl&2)&&bu(e,0):Gl|=n,ql===Fl&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Ve()),e=Jr(e,t),e!==null&&(Ue(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return he(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-je(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Fl,a=ze(r,r===Pl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||G(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=ye(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=jt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),ft(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+jt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+jt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+jt(n.imageSizes)+`"]`)):i+=`[href="`+jt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),ft(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+jt(r)+`"][href="`+jt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=p({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),ft(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=dt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);ft(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=dt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ft(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=dt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ft(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=B.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=dt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=dt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=dt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+jt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),ft(t),e.head.appendChild(t))}function Pf(e){return`[src="`+jt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+jt(n.href)+`"]`);if(r)return t.instance=r,ft(r),r;var i=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ft(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,ft(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,ft(i),i):(r=n,(i=mf.get(o))&&(r=p({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),ft(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ft(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Le()})),W=e(r(),1),ze=Re(),G=e=>typeof e==`string`,Be=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Ve=e=>e==null?``:``+e,He=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},Ue=/###/g,We=e=>e&&e.indexOf(`###`)>-1?e.replace(Ue,`.`):e,Ge=e=>!e||G(e),Ke=(e,t,n)=>{let r=G(t)?t.split(`.`):t,i=0;for(;i{let{obj:r,k:i}=Ke(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=Ke(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=Ke(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},Je=(e,t,n,r)=>{let{obj:i,k:a}=Ke(e,t,Object);i[a]=i[a]||[],i[a].push(n)},Ye=(e,t)=>{let{obj:n,k:r}=Ke(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Xe=(e,t,n)=>{let r=Ye(e,n);return r===void 0?Ye(t,n):r},Ze=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?G(e[r])||e[r]instanceof String||G(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Ze(e[r],t[r],n):e[r]=t[r]);return e},Qe=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),$e={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},et=e=>G(e)?e.replace(/[&<>"'\/]/g,e=>$e[e]):e,tt=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},nt=[` `,`,`,`?`,`!`,`;`],rt=new tt(20),it=(e,t,n)=>{t||=``,n||=``;let r=nt.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=rt.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},at=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e-1&&oe?.replace(`_`,`-`),st={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},ct=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||st,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(G(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},lt=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r{for(let i=0;i-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.indexOf(`.`)>-1?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):G(n)&&i?o.push(...n.split(i)):o.push(n)));let s=Ye(this.data,o);return!s&&!t&&!n&&e.indexOf(`.`)>-1&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!G(n)?s:at(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),qe(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(G(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=Ye(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Ze(s,n,i):s={...s,...n},qe(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},dt={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},ft=Symbol(`i18next/PATH_KEY`);function pt(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===ft?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function mt(e,t){let{[ft]:n}=e(pt());return n.join(t?.keySeparator??`.`)}var ht={},gt=e=>!G(e)&&typeof e!=`boolean`&&typeof e!=`number`,_t=class e extends lt{constructor(e,t={}){super(),He([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=ct.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=gt(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!it(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:G(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:G(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=mt(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]);let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!G(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=gt(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&_.indexOf(O)<0&&!(G(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:gt(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&G(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=G(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!G(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;oi?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=G(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=dt.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return G(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!G(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(G(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!ht[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(ht[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.indexOf(i)===0&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.indexOf(i)===0&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!G(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},vt=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ct.create(`languageUtils`)}getScriptPartFromCode(e){if(e=ot(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=ot(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(G(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),G(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return G(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):G(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&i(this.formatLanguageCode(e))}),r}},yt={zero:0,one:1,two:2,few:3,many:4,other:5},bt={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},xt=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=ct.create(`pluralResolver`),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=ot(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(!Intl)return this.logger.error(`No Intl support, please use an Intl polyfill!`),bt;if(!e.match(/-|_/))return bt;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>yt[e]-yt[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},St=(e,t,n,r=`.`,i=!0)=>{let a=Xe(e,t,n);return!a&&i&&G(n)&&(a=at(e,n,r),a===void 0&&(a=at(t,n,r))),a},Ct=e=>e.replace(/\$/g,`$$$$`),wt=class{constructor(e={}){this.logger=ct.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?et:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?Qe(i):a||`{{`,this.suffix=o?Qe(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?Qe(d):f||Qe(`$t(`),this.nestingSuffix=p?Qe(p):m||Qe(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_===void 0?!1:_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(e.indexOf(this.formatSeparator)<0){let i=St(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(St(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp();let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>Ct(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Ct(this.escape(e)):Ct(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=G(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else !G(a)&&!this.useRawValueToEscape&&(a=Ve(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${n}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!G(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!G(i))return i;G(i)||(i=Ve(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},Tt=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},Et=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(ot(r),i),t[o]=s),s(n)}},Dt=e=>(t,n,r)=>e(ot(n),r)(t),Ot=class{constructor(e={}){this.logger=ct.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?Et:Dt;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Et(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=Tt(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},kt=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},At=class extends lt{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=ct.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{Je(n.loaded,[i],a),kt(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();G(e)&&(e=this.languageUtils.toResolveHierarchy(e)),G(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},jt=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,simplifyPluralSuffix:!0,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),G(e[1])&&(t.defaultValue=e[1]),G(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Mt=e=>(G(e.ns)&&(e.ns=[e.ns]),G(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),G(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),Nt=()=>{},Pt=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Ft=class e extends lt{constructor(e={},t){if(super(),this.options=Mt(e),this.services={},this.logger=ct,this.modules={external:[]},Pt(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(G(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let n=jt();this.options={...n,...this.options,...Mt(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?ct.init(r(this.modules.logger),this.options):ct.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Ot;let t=new vt(this.options);this.store=new ut(this.options.resources,this.options);let i=this.services;i.logger=ct,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new xt(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(i.formatter=r(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new wt(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new At(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new _t(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=Nt,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=Be(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=Nt){let n=t,r=G(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=Be();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=Nt,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&dt.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!([`cimode`,`dev`].indexOf(e)>-1)){for(let e=0;e-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=Be();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=G(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(G(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){let r=(e,t,...i)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(i)),a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);let o=this.options.keySeparator||`.`,s;return a.keyPrefix&&Array.isArray(e)?s=e.map(e=>(typeof e==`function`&&(e=mt(e,{...this.options,...t})),`${a.keyPrefix}${o}${e}`)):(typeof e==`function`&&(e=mt(e,{...this.options,...t})),s=a.keyPrefix?`${a.keyPrefix}${o}${e}`:e),this.t(s,a)};return G(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=Be();return this.options.ns?(G(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=Be();G(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new vt(jt());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=Nt){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);return(t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new ut(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),a.translator=new _t(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();Ft.createInstance,Ft.dir,Ft.init,Ft.loadResources,Ft.reloadResources,Ft.use,Ft.changeLanguage,Ft.getFixedT,Ft.t,Ft.exists,Ft.setDefaultNamespace,Ft.hasLoadedNamespace,Ft.loadNamespaces,Ft.loadLanguages;var{slice:It,forEach:Lt}=[];function Rt(e){return Lt.call(It.call(arguments,1),t=>{if(t)for(let n in t)e[n]===void 0&&(e[n]=t[n])}),e}function zt(e){return typeof e==`string`?[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(t=>t.test(e)):!1}var Bt=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Vt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:`/`},r=`${e}=${encodeURIComponent(t)}`;if(n.maxAge>0){let e=n.maxAge-0;if(Number.isNaN(e))throw Error(`maxAge should be a Number`);r+=`; Max-Age=${Math.floor(e)}`}if(n.domain){if(!Bt.test(n.domain))throw TypeError(`option domain is invalid`);r+=`; Domain=${n.domain}`}if(n.path){if(!Bt.test(n.path))throw TypeError(`option path is invalid`);r+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!=`function`)throw TypeError(`option expires is invalid`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:r+=`; SameSite=Strict`;break;case`lax`:r+=`; SameSite=Lax`;break;case`strict`:r+=`; SameSite=Strict`;break;case`none`:r+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return n.partitioned&&(r+=`; Partitioned`),r},Ht={create(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:`/`,sameSite:`strict`};n&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+n*60*1e3)),r&&(i.domain=r),document.cookie=Vt(e,t,i)},read(e){let t=`${e}=`,n=document.cookie.split(`;`);for(let e=0;e-1&&(e=window.location.hash.substring(window.location.hash.indexOf(`?`)));let r=e.substring(1).split(`&`);for(let e=0;e0&&r[e].substring(0,i)===t&&(n=r[e].substring(i+1))}}return n}},Gt={name:`hash`,lookup(e){let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window<`u`){let{hash:e}=window.location;if(e&&e.length>2){let i=e.substring(1);if(t){let e=i.split(`&`);for(let n=0;n0&&e[n].substring(0,i)===t&&(r=e[n].substring(i+1))}}if(r)return r;if(!r&&n>-1){let t=e.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?t[typeof n==`number`?n:0]?.replace(`/`,``):void 0}}}return r}},Kt=null,qt=()=>{if(Kt!==null)return Kt;try{if(Kt=typeof window<`u`&&window.localStorage!==null,!Kt)return!1;let e=`i18next.translate.boo`;window.localStorage.setItem(e,`foo`),window.localStorage.removeItem(e)}catch{Kt=!1}return Kt},Jt={name:`localStorage`,lookup(e){let{lookupLocalStorage:t}=e;if(t&&qt())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&qt()&&window.localStorage.setItem(n,e)}},Yt=null,Xt=()=>{if(Yt!==null)return Yt;try{if(Yt=typeof window<`u`&&window.sessionStorage!==null,!Yt)return!1;let e=`i18next.translate.boo`;window.sessionStorage.setItem(e,`foo`),window.sessionStorage.removeItem(e)}catch{Yt=!1}return Yt},Zt={name:`sessionStorage`,lookup(e){let{lookupSessionStorage:t}=e;if(t&&Xt())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&Xt()&&window.sessionStorage.setItem(n,e)}},Qt={name:`navigator`,lookup(e){let t=[];if(typeof navigator<`u`){let{languages:e,userLanguage:n,language:r}=navigator;if(e)for(let n=0;n0?t:void 0}},$t={name:`htmlTag`,lookup(e){let{htmlTag:t}=e,n,r=t||(typeof document<`u`?document.documentElement:null);return r&&typeof r.getAttribute==`function`&&(n=r.getAttribute(`lang`)),n}},en={name:`path`,lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>`u`)return;let n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(Array.isArray(n))return n[typeof t==`number`?t:0]?.replace(`/`,``)}},tn={name:`subdomain`,lookup(e){let{lookupFromSubdomainIndex:t}=e,n=typeof t==`number`?t+1:1,r=typeof window<`u`&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}},nn=!1;try{document.cookie,nn=!0}catch{}var rn=[`querystring`,`cookie`,`localStorage`,`sessionStorage`,`navigator`,`htmlTag`];nn||rn.splice(1,1);var an=()=>({order:rn,lookupQuerystring:`lng`,lookupCookie:`i18next`,lookupLocalStorage:`i18nextLng`,lookupSessionStorage:`i18nextLng`,caches:[`localStorage`],excludeCacheFor:[`cimode`],convertDetectedLanguage:e=>e}),on=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type=`languageDetector`,this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=Rt(t,this.options||{},an()),typeof this.options.convertDetectedLanguage==`string`&&this.options.convertDetectedLanguage.indexOf(`15897`)>-1&&(this.options.convertDetectedLanguage=e=>e.replace(`-`,`_`)),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Ut),this.addDetector(Wt),this.addDetector(Jt),this.addDetector(Zt),this.addDetector(Qt),this.addDetector($t),this.addDetector(en),this.addDetector(tn),this.addDetector(Gt)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,t=[];return e.forEach(e=>{if(this.detectors[e]){let n=this.detectors[e].lookup(this.options);n&&typeof n==`string`&&(n=[n]),n&&(t=t.concat(n))}}),t=t.filter(e=>e!=null&&!zt(e)).map(e=>this.options.convertDetectedLanguage(e)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)}))}};on.type=`languageDetector`;var sn=`bambuddy_chunk_reload_at`,cn=1e4,ln=3e3,un=!1;function dn(){if(un)return!0;try{let e=Number(window.sessionStorage.getItem(sn));if(e&&Date.now()-esetTimeout(e,ln));return dn()}function K(e,t){return(0,W.lazy)(async()=>{try{return{default:(await e())[t]}}catch(e){if(await pn())return new Promise(()=>{});throw e}})}var mn={nav:{printers:`Printers`,archives:`Archives`,queue:`Print Queue`,stats:`Statistics`,profiles:`Profiles`,maintenance:`Maintenance`,projects:`Projects`,finance:`Finance`,inventory:`Filament`,files:`File Manager`,makerworld:`MakerWorld`,modelSources:`Model Sources`,notifications:`Notifications`,settings:`Settings`,system:`System`,collapseSidebar:`Collapse sidebar`,expandSidebar:`Expand sidebar`,update:`Update`,updateAvailable:`Update available: v{{version}}`,updateAvailableBanner:`Version {{version}} is available!`,viewUpdate:`View update`,viewOnGithub:`View on GitHub`,keyboardShortcuts:`Keyboard shortcuts (?)`,switchToLight:`Switch to light mode`,switchToDark:`Switch to dark mode`,switchToSystem:`Switch to system mode`,smartSwitches:`Smart Switches`,logout:`Logout`,installApp:`Install app`,installAppSuccess:`Bambuddy was installed`},announcements:{title:`Announcements`,unread:`Unread announcements: {{count}}`,empty:`No announcements right now.`,earlier:`Earlier ({{count}})`,new:`New`,readMore:`Read more`,readMoreCount:`Read more (+{{count}})`,gotIt:`Got it`,source:`From the Bambuddy maintainers, fetched from GitHub. You can turn them off in Settings.`,level:{info:`Info`,important:`Important`,critical:`Critical`}},common:{plusNMore:`+{{count}} more`,save:`Save`,saving:`Saving...`,cancel:`Cancel`,delete:`Delete`,edit:`Edit`,add:`Add`,close:`Close`,confirm:`Confirm`,loading:`Loading...`,error:`Error`,errorLoading:`Error loading data`,retry:`Retry`,success:`Success`,warning:`Warning`,enabled:`Enabled`,disabled:`Disabled`,yes:`Yes`,no:`No`,on:`On`,off:`Off`,all:`All`,none:`None`,search:`Search`,filter:`Filter`,sort:`Sort`,refresh:`Refresh`,download:`Download`,upload:`Upload`,uploading:`Uploading...`,uploadFailed:`Upload failed`,actions:`Actions`,status:`Status`,name:`Name`,user:`User`,description:`Description`,date:`Date`,time:`Time`,hours:`hours`,minutes:`minutes`,seconds:`seconds`,days:`days`,enable:`Enable`,disable:`Disable`,permissions:`Permissions`,noPrinters:`No printers configured`,noData:`No data available`,linkNotFound:`Link not found`,required:`Required`,optional:`Optional`,dismiss:`Dismiss`,apply:`Apply`,reset:`Reset`,export:`Export`,import:`Import`,clear:`Clear`,selectAll:`Select All`,deselectAll:`Deselect All`,noChange:`— No change —`,unchanged:`Unchanged`,unassigned:`Unassigned`,unknown:`Unknown`,unknownError:`Unknown error`,today:`Today`,tomorrow:`Tomorrow`,asap:`ASAP`,overdue:`Overdue`,now:`Now`,collapse:`Collapse`,expand:`Expand`,previous:`Previous`,next:`Next`,viewArchive:`View archive`,viewInFileManager:`View in File Manager`,addedBy:`Added by {{username}}`,prints:`prints`,more:`+{{count}} more`,ascending:`Ascending`,descending:`Descending`,back:`Back`,copy:`Copy`,copied:`Copied!`,printer:`Printer`,remove:`Remove`,type:`Type`,print:`Print`,rename:`Rename`,move:`Move`,create:`Create`,duplicate:`Duplicate`,left:`Left`,right:`Right`,run:`Run`,running:`Running...`},finance:{allTypes:`All types`,allCostCenters:`All cost centers`,title:`Finance`,subtitle:`Wallet, personal transactions, and cost centers`,noAccess:`You do not have permission to view finance data.`,personalView:`Personal view`,adminView:`Admin view`,createCostCenter:`Create cost center`,adjustWallet:`Adjust wallet`,addManualPrint:`Add manual print`,manageMembers:`Manage cost center members`,currentBalance:`Personal balance`,transactions:`Transactions`,personalTransactions:`Personal transactions`,costCenters:`Cost centers`,availableForPrinting:`Available for print assignment`,costCenterName:`Name`,budgetType:`Budget type`,monthlyBudget:`Monthly budget`,totalBudget:`Total budget`,noBudget:`No budget`,create:`Create`,selectUser:`Select user`,transactionType:`Type`,amount:`Amount`,noCostCenter:`No cost center`,descriptionOptional:`Description (optional)`,applyAdjustment:`Apply adjustment`,memberCanPrint:`Member can print`,addMember:`Add member`,canPrint:`Can print`,noMembers:`No members assigned.`,editCostCenter:`Edit cost center`,myCostCenters:`My cost centers`,costCentersHint:`Review budget limits and keep costs under control`,noCostCenters:`No cost centers found.`,owner:`Owner`,balance:`Account balance`,unlimited:`Unlimited`,budgetPolicyHint:`Account balances track costs. Printing is limited only by the selected cost center budget; without a budget, printing is unlimited.`,budget:`Budget`,shared:`Shared`,cannotEditPrivateCostCenter:`Private cost centers cannot be edited here`,recentTransactions:`Recent transactions`,transactionsHint:`Filter by type and cost center`,first:`First`,prev:`Previous`,next:`Next`,last:`Last`,pageNumberOf:`Page {{page}} of {{total}}`,noTransactions:`No transactions available.`,noTransactionsForFilter:`No transactions match the selected filters.`,costCenter:`Cost center`,balanceAfter:`Balance after`,userWithId:`User #{{id}}`,partial:`Partial`,editTransaction:`Edit Transaction`,selectCostCenter:`Select cost center...`,costCenterRequired:`Please select a cost center`,amountExample:`e.g., 4.00`,manualAdjustmentExample:`e.g., Manual adjustment`,userRequired:`Please select a user`,amountInvalid:`Amount must be a valid number`,createdCostCenter:`Cost center created`,createCostCenterFailed:`Failed to create cost center`,transactionDeleted:`Transaction deleted`,deleteTransactionFailed:`Failed to delete transaction`,transactionEdited:`Transaction updated and ledger recalculated`,editTransactionFailed:`Failed to edit transaction`,manualPrintCreated:`Manual print charge added and ledger recalculated`,manualPrintFailed:`Failed to create manual print`,memberSaved:`Member saved`,memberSaveFailed:`Failed to save member`,memberRemoved:`Member removed`,memberRemoveFailed:`Failed to remove member`,costCenterNameRequired:`Cost center name is required`,costCenterUpdated:`Cost center updated`,costCenterUpdateFailed:`Failed to update cost center`,confirmDeleteCostCenter:`Delete cost center "{{name}}"?`,costCenterDeleted:`Cost center deleted`,costCenterDeleteFailed:`Failed to delete cost center`,deleteTransactionConfirm:`Delete this transaction? Balances will be recalculated automatically.`,deposit:`Deposit`,withdraw:`Withdraw`,printCharge:`Print charge`,deleteTransaction:`Delete transaction`},printers:{locations:{title:`Printer Locations`,backToPrinters:`Back to Printers`,subtitle:`{{grouped}} in a location, {{ungrouped}} without one`,search:`Search locations...`,showEmpty:`Show empty`,hideEmpty:`Hide empty`,select:`Select`,done:`Done`,sortNameAsc:`Name A→Z`,sortNameDesc:`Name Z→A`,sortCountAsc:`Fewest printers`,sortCountDesc:`Most printers`,create:`New Location`,createTitle:`Create Location`,editTitle:`Edit Location`,namePlaceholder:`Location name`,icon:`Icon`,color:`Color`,noColor:`No color`,none:`No printer locations yet`,noResults:`No locations match your search`,printerCount:`Printers: {{count}}`,noPrinters:`No printers in this location`,selectPrinter:`Select printer`,move:`Move to another location`,moveButton:`Move`,removeFromLocation:`Remove from location`,ungroupedPrinters:`Printers without a location: {{count}}`,selected:`Selected: {{count}}`,deleteSelected:`Delete selected`,moveTitle:`Move printer`,moveTitleMany:`Move printers ({{count}})`,targetPlaceholder:`Select a location...`,noLocation:`No location`,deleteTitle:`Delete location`,deleteTitleMany:`Delete locations ({{count}})`,deleteMessage:`Delete {{names}}? Printers left without a location: {{count}}.`,created:`Location created`,saved:`Location updated`,deleted:`Locations deleted: {{count}}`,moved:`Printers moved: {{count}}`,failed:`Could not save the change: {{error}}`},title:`Printers`,addPrinter:`Add Printer`,addPreflight:{checking:`Checking connection...`,warning:`Some connection checks failed. This printer may show as offline. Review the checks below, fix what you can, or save anyway.`,back:`Back`,saveAnyway:`Save anyway`},editPrinter:`Edit Printer`,deletePrinter:`Delete Printer`,printerName:`Printer Name`,serialNumber:`Serial Number`,ipAddress:`IP Address / Hostname`,accessCode:`Access Code`,model:`Model`,nozzleCount:`Nozzle Count`,autoArchive:`Auto Archive`,status:{available:`Available`,idle:`Idle`,printing:`Printing`,paused:`Paused`,offline:`Offline`,problem:`Problem`,error:`Error`,finished:`Finished`,unknown:`Unknown`},temperatures:{nozzle:`Nozzle`,bed:`Bed`,chamber:`Chamber`},heaterHistory:{title:`Heater History`,openLabel:`View heater history`,nozzle:`Nozzle`,nozzle2:`Nozzle 2`,bed:`Bed`,chamber:`Chamber`,error:`Failed to load history`,empty:`No data recorded yet`},progress:`{{percent}}% complete`,timeRemaining:`{{time}} remaining`,deleteConfirm:`Are you sure you want to delete "{{name}}"?`,maintenanceOk:`Maintenance OK`,maintenanceWarning:`{{count}} warning`,maintenanceWarning_plural:`{{count}} warnings`,maintenanceDue:`{{count}} due`,maintenanceDue_plural:`{{count}} due`,sort:{name:`Name`,status:`Status`,model:`Model`,location:`Location`,eta:`ETA`,ascending:`Sort ascending`,descending:`Sort descending`},cardSize:{small:`Small cards`,medium:`Medium cards`,large:`Large cards`,extraLarge:`Extra large cards`},pageView:{openCamWallPage:`Open cam wall as page`,cards:`Cards`,camWall:`Cam wall`},camWall:{page:{tokenRejected:`This Cam Wall link is no longer valid. The token may have expired or been revoked.`,loadFailed:`Could not load the printers.`},tileSize:{small:`Small tiles`,medium:`Medium tiles`,large:`Large tiles`,extraLarge:`Extra large tiles`},noPrinters:`No printers to show`,noSignal:`No signal`,live:`Live`,snap:`Snap`,off:`Off`,summary:`{{live}} live, {{snap}} snapshots, {{total}} total`,layer:`Layer {{cur}}/{{total}}`,timeLeft:`{{time}} left`,statusMode:{off:`Off`,compact:`Compact`,full:`Full`},settings:{title:`Cam wall settings`,maxLive:`Max live streams`,maxLiveHint:`How many tiles stream live at once. Others refresh as snapshots.`,snapshotInterval:`Snapshot interval (seconds)`,snapshotIntervalHint:`How often non-live tiles fetch a fresh snapshot.`,statusOverlay:`Status overlay`,statusOverlayHint:`Compact: state badge only. Full: + progress, layer, time left.`}},hideOffline:`Hide offline`,nextAvailable:`Next available`,powerOn:`Power On`,offlinePrintersWithPlugs:`Offline printers with smart plugs`,noPrintersConfigured:`No printers configured yet`,search:`Search printers...`,noSearchResults:`No printers match your search or filters`,filter:{allStatuses:`All statuses`,allLocations:`All locations`},toolbar:{filters:`Filters`,view:`View`,actions:`Actions`},readyToPrint:`Ready to print`,external:`External`,ext:`Ext`,extL:`Ext-L`,extR:`Ext-R`,deleteArchives:`Delete print archives`,noLabel:`No label`,printPreview:`Print preview`,width:`Width`,height:`Height`,noObjectsFound:`No objects found`,objectsLoadedOnPrintStart:`Objects are loaded when a print starts`,willBeSkipped:`Will be skipped`,name:`Name`,serialCannotBeChanged:`Serial number cannot be changed`,locationHelp:`Used to group printers and filter queue jobs`,wifiSignal:{veryWeak:`Very weak`,weak:`Weak`,fair:`Fair`,good:`Good`,excellent:`Excellent`},maintenanceUpToDate:`All maintenance up to date - Click to view`,maintenance:{title:`In Maintenance`,subtitle:`This printer is paused — not connected, not eligible for the queue, not sending notifications.`,pillLabel:`Maintenance`,exitButton:`Exit maintenance`,menuEnter:`Enter maintenance mode`,menuExit:`Exit maintenance mode`,toastEntered:`{{name}} is now in maintenance mode`,toastExited:`{{name}} is back online`,confirmMidPrintTitle:`Enter maintenance mode mid-print?`,confirmMidPrintMessage:`{{name}} is currently printing. Entering maintenance mode will disconnect MQTT and stop progress tracking and completion notifications for this job. Continue?`,editFieldLabel:`Maintenance mode`,editFieldHelp:`When on, this printer is paused from MQTT, queue dispatch and notifications — useful for repair, parallel Bambuddy installs, or temporary suspension.`},chamberLightOn:`Turn on chamber light`,chamberLightOff:`Turn off chamber light`,files:`Files`,browseFiles:`Browse printer files`,autoOffAfterPrint:`Auto power-off after print`,autoOffExecuted:`Auto-off was executed - turn printer on to reset`,hmsErrors:`HMS Errors`,viewHmsErrors:`View {{count}} HMS error(s)`,resume:`Resume`,pause:`Pause`,stop:`Stop`,camera:`Camera`,skipObject:`Skip Object`,reconnect:`Reconnect`,forceRefresh:`Force Refresh`,forceRefreshSuccess:`Refresh requested`,mqttDebug:`MQTT Debug`,printerInformation:`Printer Information`,copyToClipboard:`Copy`,copied:`Copied!`,state:`State`,wifiSignalLabel:`WiFi Signal`,developerMode:`Developer Mode`,enabled:`Enabled`,disabled:`Disabled`,addedOn:`Added`,sdCard:`SD Card`,inserted:`Inserted`,notInserted:`Not inserted`,totalPrintHours:`Print Hours`,activeNozzle:`Active: {{nozzle}} nozzle`,amsSwitchInletTooltip:`Filament Track Switch IN-{{inlet}} ({{side}}) — feeds both nozzles`,nozzleRack:`Nozzle Rack`,nozzleDocked:`Docked`,nozzleMounted:`Mounted`,nozzleActive:`Active`,nozzleIdle:`Idle`,nozzleDiameter:`Diameter`,nozzleType:`Type`,nozzleStatus:`Status`,nozzleFilament:`Filament`,nozzleWear:`Wear`,nozzleMaxTemp:`Max Temp`,nozzleSerial:`Serial`,nozzleHardenedSteel:`Hardened Steel`,nozzleStainlessSteel:`Stainless Steel`,nozzleTungstenCarbide:`Tungsten Carbide`,nozzleFlow:`Flow`,nozzleHighFlow:`High Flow`,nozzleStandardFlow:`Standard`,firmwareUpdate:`Firmware Update`,firmwareInstructions:`On the printer's touchscreen, go to`,firmwareNav:`Navigate to`,settings:`Settings`,firmware:`Firmware`,discoverPrinters:`Discover Printers`,searching:`Searching...`,manualEntry:`Manual Entry`,addFromCloud:`Add from Cloud`,toast:{printerDeleted:`Printer deleted`,missingSpoolAssignment:`Print started on {{printer}}. Missing spool assignment for: {{slots}}`,killSwitchTriggered:`The billing kill switch stopped an unauthorized print on {{printer}}: {{filename}}`,billingChargeFailed:`Billing failed for {{filename}} on {{printer}}. The budget reservation was retained; check the server logs.`,assignmentVerified:`Filament loaded on slot {{slot}} ({{printer}})`,assignmentVerifiedNoKprofile:`Slot {{slot}} on {{printer}} loaded, but the flow calibration (K-profile) was not applied`,assignmentNotConfirmed:`Could not confirm the assignment for slot {{slot}} on {{printer}} — check the AMS slot`,printerAdded:`Printer added`,printerUpdated:`Printer updated`,failedToDelete:`Failed to delete printer`,failedToAdd:`Failed to add printer`,connectionFailedNotAdded:`Could not connect to the printer. Verify the IP, serial number, and access code, and confirm LAN-only mode is on. The printer was not added.`,failedToUpdate:`Failed to update printer`,commandSent:`Command sent`,failedToSendCommand:`Failed to send command`,turnedOn:`{{name}} turned on`,failedToPowerOn:`Failed to power on {{name}}`,scriptTriggered:`Script triggered`,printStopped:`Print stopped`,printPaused:`Print paused`,printResumed:`Print resumed`,referenceDeleted:`Reference deleted`,detectionAreaSaved:`Detection area saved`,failedToRunScript:`Failed to run script`,failedToStopPrint:`Failed to stop print`,failedToPausePrint:`Failed to pause print`,failedToResumePrint:`Failed to resume print`,failedToControlChamberLight:`Failed to control chamber light`,failedToSetSpeed:`Failed to set print speed`,failedToUpdateSetting:`Failed to update setting`,failedToSkipObjects:`Failed to skip objects`,failedToRereadRfid:`Failed to re-read RFID`,failedToCheckPlate:`Failed to check plate`,failedToUpdateLabel:`Failed to update label`,failedToDeleteReference:`Failed to delete reference`,failedToSaveDetectionArea:`Failed to save detection area`,plateCheckEnabled:`Plate check enabled`,plateCheckDisabled:`Plate check disabled`,calibrationSaved:`Calibration saved!`,calibrationFailed:`Calibration failed`,rfidRereadInitiated:`RFID re-read initiated`,loadInitiated:`Loading filament…`,unloadInitiated:`Unloading filament…`,failedToLoad:`Failed to load filament`,failedToUnload:`Failed to unload filament`},connection:{connected:`Connected`,offline:`Offline`},plateStatus:{markCleared:`Mark plate as cleared`,cleared:`Plate Clear`,notCleared:`Plate not Clear`,inUse:`Plate in Use`},queue:{inQueue:`{{count}} print in queue`,inQueue_plural:`{{count}} prints in queue`},controls:`Controls`,rfid:{reread:`Re-read RFID`},ams:{load:`Load`,unload:`Unload`,feedTitle:`Load {{slot}} to which nozzle?`,feedPrompt:`The Filament Track Switch can route this slot to either hotend. Choose which one to feed.`,feedLeft:`Left nozzle`,feedRight:`Right nozzle`,feedAlreadyLoaded:`Already loaded`,switchNotReady:`The Filament Track Switch is not set up yet. Assign every AMS to an inlet on the printer, then try again.`},bedJog:{limitWarning:`Travel limits are not enforced during manual moves — a Bambu firmware bug ignores software endstops for remote commands. Move carefully to avoid a collision.`,title:`Jog Controls`,bed:`Bed`,step:`Step (mm)`,up:`Move plate up`,down:`Move plate down`,toolheadUp:`Move toolhead up`,toolheadDown:`Move toolhead down`,disabledWhilePrinting:`Disabled while printing`,notHomedTitle:`Printer is not homed`,notHomedMessage:`The printer has not been homed since the last print. Run auto-home first for safe positioning (parks the toolhead, then homes X, Y, and Z), or move anyway — soft endstops will be bypassed.`,homeZ:`Auto Home`,moveAnyway:`Move anyway`,homingStarted:`Auto-homing printer…`},permission:{noAdd:`You do not have permission to add printers`,noEdit:`You do not have permission to edit printers`,noDelete:`You do not have permission to delete printers`,noControl:`You do not have permission to control printers`,noFiles:`You do not have permission to access printer files`,noAmsRfid:`You do not have permission to re-read AMS RFID`,noSmartPlugControl:`You do not have permission to control smart plugs`,noCamera:`You do not have permission to view cameras`},modal:{addTitle:`Add Printer`,editTitle:`Edit Printer`,myPrinter:`My Printer`,selectModel:`Select model...`,locationGroup:`Location / Group (optional)`,locationPlaceholder:`e.g., Workshop, Office, Basement`,autoArchiveLabel:`Auto-archive completed prints`,wearCostLabel:`Wear cost per printing hour ({{currency}})`,wearCostHelp:`What an hour of printing costs this printer in wear and parts. It is added to the cost of every print from now on; earlier prints are not changed. Leave empty to turn it off.`,fromPrinterSettings:`From printer settings`,modelOptional:`Model (optional)`,saveChanges:`Save Changes`},skipObjects:{tooltip:`Skip objects`,onlyWhilePrinting:`Skip objects (only while printing)`,requiresMultiple:`Skip objects (requires 2+ objects)`,title:`Skip Objects`,matchIdsInfo:`Match IDs with your printer display`,printerShowsIds:`The printer screen shows object IDs on the build plate`,skipSelected:`Skip Selected`,skipping:`Skipping...`,noObjectsSelected:`No objects selected`,selectObjectsToSkip:`Select objects you want to skip from the current print`,skipped:`skipped`,objectsSkipped:`Objects skipped`,activeCount:`{{count}} active`,waitForLayer:`Wait for layer 2+ to skip objects (currently layer {{layer}})`,skip:`Skip`,confirmTitle:`Skip Object?`,confirmMessage:`Are you sure you want to skip "{{name}}"? This cannot be undone.`,confirmAllMessage:`All remaining objects are selected. This will stop the print job. Continue?`,confirmMultipleMessage:`Skip {{count}} selected objects? This cannot be undone.`},confirm:{deleteTitle:`Delete Printer`,deleteMessage:`Are you sure you want to delete "{{name}}"? This will remove all connection settings.`,deleteArchivesNote:`All print history for this printer will be permanently deleted.`,keepArchivesNote:`Print history will be kept but no longer associated with this printer.`,stopTitle:`Stop Print`,stopMessage:`Are you sure you want to stop the current print on "{{name}}"? This will cancel the print job.`,stopButton:`Stop Print`,pauseTitle:`Pause Print`,pauseMessage:`Are you sure you want to pause the current print on "{{name}}"?`,pauseButton:`Pause Print`,resumeTitle:`Resume Print`,resumeMessage:`Are you sure you want to resume the print on "{{name}}"?`,resumeButton:`Resume Print`,powerOnTitle:`Power On Printer`,powerOnMessage:`Are you sure you want to turn ON the power for "{{name}}"?`,powerOnButton:`Power On`,powerOffTitle:`Power Off Printer`,powerOffMessage:`Are you sure you want to turn OFF the power for "{{name}}"?`,powerOffWarning:`WARNING: "{{name}}" is currently printing! Are you sure you want to turn OFF the power? This will interrupt the print and may damage the printer.`,powerOffButton:`Power Off`,haToggleTitle:`Toggle "{{name}}"`,haToggleMessage:`Toggle the Home Assistant entity {{entity}}? This may turn power off if it is currently on.`,haToggleWarning:`WARNING: "{{name}}" is currently printing! Toggling {{entity}} may cut power and interrupt the print. Continue?`,haToggleButton:`Toggle`},bulk:{select:`Select`,selectAll:`Select All`,selectByLocation:`Select by Location`,selected:`{{count}} selected`,actions:{stop:`Stop`,pause:`Pause`,resume:`Resume`,clearPlate:`Clear Bed`,clearHMS:`Clear Notifications`},confirm:{stopTitle:`Stop {{count}} Prints`,stopMessage:`This will cancel active prints on {{count}} printer(s). This action cannot be undone.`,stopButton:`Stop All`,pauseTitle:`Pause {{count}} Prints`,pauseMessage:`This will pause active prints on {{count}} printer(s).`,pauseButton:`Pause All`,clearPlateTitle:`Clear {{count}} Print Beds`,clearPlateMessage:`This will clear the print bed on {{count}} printer(s) and may trigger queued jobs.`,clearPlateButton:`Clear All`},success:`{{action}} completed on {{count}} printer(s)`,partial:`{{succeeded}} succeeded, {{failed}} failed`,noneApplicable:`No selected printers are in the right state for this action`,selectByState:`Select by State`},discovery:{title:`Discover Printers`,searching:`Searching...`,scanning:`Scanning...`,scanProgress:`Scanning... {{scanned}}/{{total}}`,foundPrinters:`Found {{count}} printer(s)`,noPrintersFound:`No printers found`,noPrintersFoundSubnet:`No printers found in the specified subnet.`,noPrintersFoundNetwork:`No printers found on the network.`,allConfigured:`All discovered printers are already configured.`,alreadyAdded:`Already added`,select:`Select`,manualEntry:`Manual Entry`,addFromCloud:`Add from Cloud`,subnetToScan:`Subnet to scan`,dockerNote:`Docker detected. Enter your printer's subnet in CIDR notation. Requires network_mode: host in docker-compose.yml.`,scanSubnet:`Scan Subnet for Printers`,discoverNetwork:`Discover Printers on Network`,scanningSubnet:`Scanning subnet for Bambu printers...`,scanningNetwork:`Scanning network...`,serialRequired:`Serial required`,unknown:`Unknown`,failedToStart:`Failed to start discovery`,customSubnetOption:`Custom subnet...`,customSubnetLabel:`Custom subnet (CIDR)`,customSubnetNote:`Use a custom subnet if your printer is on a different network than this server. The FTP (990) and MQTT (8883) ports must be reachable across the routing boundary.`},drying:{start:`Start Drying`,stop:`Stop Drying`,temperature:`Temperature`,duration:`Duration`,hours:`hours`,timeRemaining:`{{time}} left`,active:`Drying`,notRunning:`Drying not running`,notRunningHint:`The printer holds a drying timer, but the countdown has stopped and the AMS reports no drying phase. The cycle never started or was paused, for example by the power limit or the current print.`,targetSummary:`{{filament}} @ {{temp}}°C`,notSupported:`Drying not supported`,powerRequired:`Connect AMS power adapter to enable drying`,cannotDryNow:`AMS can't start drying right now`,startingDrying:`Starting drying...`,toastCommandSent:`Drying command sent`,toastStopped:`Drying stopped`,toastNotStarted:`The printer accepted the command but the AMS never started drying. Check that the AMS power adapter is connected and that the printer is idle.`,screenOnly:`AMS drying on this printer can only be controlled from the printer's own screen (Bambu limitation)`,stoppingDrying:`Stopping drying...`,rotateTray:`Rotate spool during drying`,rotateUnavailableReason:`Unavailable — a slot in this AMS is loaded to the toolhead. The spool is locked by the feed tube and cannot rotate. Retract the filament first.`,startMode:`Start time`,modeNow:`Now`,modeDelay:`After delay`,modeAtTime:`At time`,schedule:`Schedule`,scheduledFor:`Drying scheduled for {{time}}`,scheduledAsap:`Drying scheduled (waiting for printer)`,cancelScheduled:`Cancel scheduled drying`,scheduleFailed:`Failed to schedule drying`,retractFilament:`Retract the filament at the AMS outlet to start drying`,waitingAmsNotFound:`Waiting for the AMS to be detected`,waitingOffline:`Waiting for the printer to come online`,waitingPrinterBusy:`Waiting for the printer to be free`,waitingAlreadyDrying:`Waiting for the current drying cycle to finish`,waitingInterrupted:`Interrupted, will restart when the printer is free`,scheduleFailedReason:`Scheduled drying failed: {{reason}}`,scheduleFailedUnknown:`Unknown error`,scheduleFailedDidNotStart:`The printer accepted the command, but the AMS did not start drying`,dismissFailed:`Dismiss`},amsBackup:{titleOn:`AMS Filament Backup is ON. Click to disable.`,titleOff:`AMS Filament Backup is OFF. Click to enable.`,titleUnknown:`AMS Filament Backup status unavailable on this printer.`,toastEnabled:`AMS Filament Backup enabled`,toastDisabled:`AMS Filament Backup disabled`,modalTitle:`AMS Filament Backup`,modalHelp:`When the active slot runs out, the printer cycles through any matching same-preset, same-colour slots in this order.`,modalNoSlots:`No filament loaded.`,modalNoPairs:`No backup pairs — no two slots share the same filament profile and colour.`,extruderRightShort:`R`,extruderLeftShort:`L`,stateOn:`Enabled`,stateOff:`Disabled`,stateUnknown:`Unsupported on this printer`},activeJobSlot:{title:`This slot is filament {{n}} in the active print`,ariaLabel:`Active print slot {{n}}`},expectedSlot:{title:`The printer is waiting for filament in this slot`,ariaLabel:`Expected filament slot {{n}}`,label:`{{ams}} · Slot {{slot}}`,external:`External spool`},filaments:`Filaments`,externalSpool:{hide:`Hide external spool`,show:`Show external spool`},openCameraOverlay:`Open camera overlay`,openCameraWindow:`Open camera in new window`,firmwareUpdateAvailable:`Firmware update available: {{current}} → {{latest}}`,firmwareUpToDate:`Firmware {{version}} — Up to date`,firmwareUpdateButton:`Update`,plateDetection:{noPermission:`You do not have permission to update printers`,enabledClick:`Plate check enabled - Click to disable`,disabledClick:`Plate check disabled - Click to enable`,manageCalibration:`Manage plate detection calibration`,calibrationRequired:`Calibration Required`,calibrationInstructions:`Please ensure the build plate is completely empty, then click Calibrate.`,calibrationDescription:`Calibration captures a reference image of the empty plate. Future checks will compare against this reference to detect objects.`,calibrationTip:`Tip: You can store up to 5 calibrations for different plates. The system automatically uses the best match when checking.`,plateEmpty:`Plate appears empty`,objectsDetected:`Objects detected on plate`,confidence:`Confidence`,difference:`Difference`,analysisPreview:`Analysis preview:`,analysisLegend:`Green box = detection area, Red overlay = differences from calibration`,savedReferences:`Saved References ({{count}}/{{max}})`,deleteReference:`Delete reference`,labelPlaceholder:`Label...`,clickToEdit:`{{label}} - Click to edit`,clickToAddLabel:`Click to add label`},speed:{title:`Print Speed`,silent:`Silent (50%)`,standard:`Standard (100%)`,sport:`Sport (124%)`,ludicrous:`Ludicrous (166%)`},airduct:{title:`Airduct Mode`,cooling:`Cooling`,heating:`Heating`},noSdCard:`No SD`,door:{open:`Open`,closed:`Closed`},fans:{partCooling:`Part Cooling Fan`,auxiliary:`Auxiliary Fan`,leftAuxiliary:`Left Auxiliary Fan`,exhaust:`Exhaust`,chamber:`Chamber Fan`},clickToViewHmsErrors:`Click to view HMS errors`,aiDetection:{safe:`Safe`,warning:`Warning`,failure:`Failure`,idle:`Idle`,error:`Not checking`,unknown:`Starting`,tooltipError:`AI Failure Detection is not checking this print: {{reason}} - click for details`,tooltipUnknown:`AI Failure Detection: waiting for the first result - click for details`,errorHint:`This print is not being checked. Detection resumes automatically once the problem below is fixed.`,tooltip:`AI Failure Detection: {{status}} (score {{score}}) - click for details`,tooltipIdle:`AI Failure Detection enabled - monitoring starts with the next print - click for details`,modalTitle:`AI Failure Detection - {{name}}`,currentStatus:`Status`,score:`Score`,framesAnalyzed:`Frames analyzed`,idleHint:`No print is being monitored right now. Monitoring starts automatically with the next print.`,lastError:`Last error`,openSettings:`Open settings`},estimatedCompletion:`Estimated completion time`,plateNumber:`Plate {{number}}`,slotOptions:`Slot options`,amsPopup:{friendlyName:`AMS Name`,friendlyNamePlaceholder:`e.g. AMS Friendly Name`,serialNumber:`Serial Number`,firmwareVersion:`Firmware`,save:`Save`,clear:`Clear`,noEditPermission:`You do not have permission to rename AMS units`},firmwareModal:{title:`Firmware Update`,titleUpToDate:`Firmware Info`,currentVersion:`Current:`,latestVersion:`Latest:`,releaseNotes:`Release Notes`,checkingPrereqs:`Checking prerequisites...`,sdCardReady:`SD card ready. Click below to upload firmware.`,uploadedSuccess:`Firmware uploaded to SD card!`,applyInstructions:`To apply the update on your printer:`,step1:`On the printer's touchscreen, go to Settings`,step2:`Navigate to Firmware`,step3:`Select Update from SD card`,step4:`The update will take 10-20 minutes`,done:`Done`,starting:`Starting...`,uploadFirmware:`Upload Firmware`,uploadFailed:`Failed to start upload: {{error}}`,uploadedToast:`Firmware uploaded! Trigger update from printer screen.`,availableVersions:`Available versions`,usable:`Usable`,unavailable:`Unavailable`,installed:`Installed`,newerBadge:`newer`,olderBadge:`older`,currentBadge:`current`},accessCodePlaceholder:`Leave empty to keep current`,roi:{title:`Detection Area (ROI)`,xStart:`X Start`,yStart:`Y Start`,width:`Width`,height:`Height`,instruction:`Adjust the detection area to focus on the build plate. The green box in the preview shows the current area.`},developerModeWarning:`Developer LAN mode is not enabled on: {{names}}. Some features may not work.`,howToEnable:`How to enable`,incompatibleFile:`This file was sliced for {{slicedFor}}, but this printer is a {{printerModel}}`,dropNotPrintable:`Only .gcode and .gcode.3mf files can be printed`,dropToPrint:`Drop to print`,dropToQueue:`Drop to queue`},archives:{media:{title:`Print videos`,download:`Download print videos`,searching:`Checking the printer for videos…`,searchFailed:`Could not check the printer for videos.`,none:`No timelapse or IP camera chunks were found for this print.`,attachedTimelapse:`Attached timelapse`,printerFiles:`Files still on the printer`,downloadSelected:`Download selected`,printerMissing:`Printer is no longer configured`,timelapseUnavailable:`The timelapse directory could not be read`,ipcamUnavailable:`The IP camera directory could not be read`},title:`Print Archives`,no3mfBanner:{title:`Some recent prints couldn't be archived with thumbnails`,body:`The slicer didn't leave the .gcode.3mf on the printer's SD card, so Bambuddy couldn't pull the thumbnail or slicer metadata. This is usually because "Store sent files on external storage" is off in the slicer (Bambu Studio / OrcaSlicer Device tab).`,docsLink:`See install step 4`,dismissLabel:`Dismiss this notice`,docsLinkInternalStorage:`Why this happens`,titleInternalStorage:`Some recent prints stayed on the printer's internal storage`,bodyInternalStorage:`Bambu Studio put the sliced file on the printer's internal storage instead of the card, so there was nothing for Bambuddy to read over FTP. On H2-series, P2S and X2D its Print button always does that — only Send offers a choice, and that defaults to Cache too. Those prints are still archived with their name and timing, just without a thumbnail or slicer metadata. For complete archives, start the print from Bambuddy, or slice in OrcaSlicer — or in Bambu Studio use Send with External selected and start the print afterwards. All of them need a card or stick in the printer.`,titleNoExternalStorage:`Some recent prints couldn't be archived — no storage in the printer`,bodyNoExternalStorage:`The printer reports no card or stick in its slot, so the sliced file had nowhere to land and Bambuddy had nothing to read. Insert one and the next print will archive in full.`,titleInternalHistory:`Some recent prints were started from a file already on the printer`,bodyInternalHistory:`Those prints ran from the printer's own library — a re-print from its screen, a start from Handy, or a file sent earlier and printed later. Bambuddy reads print files over FTP, which serves only the card or stick, while the printer keeps that library in an area FTP cannot reach, so there was no 3MF to read. No slicer setting changes this, because nothing was sent for these prints. They are still archived with their name and timing, and Edit Archive lets you fill in the filament used by hand. For a complete archive, start the print from Bambuddy or from your slicer instead.`,titleFtpsCooloff:`Some recent prints couldn't be archived — the printer refused the file connection`,bodyFtpsCooloff:`Bambuddy opened the printer's file-transfer port (FTPS 990) and the printer answered with something that is not TLS, so nothing could be read from it. Those prints are still archived with their name and timing, just without a thumbnail or slicer metadata. This is not a slicer setting and not something you changed — the same models and firmware run normally on other installs, and an affected printer usually works again later on its own. After such a failure Bambuddy pauses transfers to that printer for five minutes and comes back for the file once the pause clears, so a short episode fills itself in; a card still empty means the refusal outlasted the retry. What triggers it is not yet known. If it keeps happening, turn on debug logging on the System page and attach a support bundle to your report.`,titleFtpTransferFailed:`Some recent prints couldn't be archived — the file transfer ran out of time`,bodyFtpTransferFailed:`The sliced file was on the printer's card and the printer served it, but the transfer did not finish in the time allowed. At print start the printer is also handling its camera, its status messages and the job upload, and a large 3MF does not always get through against all that. Those prints are still archived with their name and timing, just without a thumbnail or slicer metadata. This is not a slicer setting and not something you changed. Bambuddy comes back for the file three times over the following ten minutes, so most of these fill themselves in; a card still empty means every attempt ran out of time too. If it keeps happening, raise Connection Timeout under Settings > Network > FTP Retry.`},searchPlaceholder:`Search archives...`,filterByPrinter:`Filter by printer`,filterByStatus:`Filter by status`,sortBy:`Sort by`,sortNewest:`Newest first`,sortOldest:`Oldest first`,sortName:`Name`,sortDuration:`Duration`,sortLargest:`Largest first`,sortSmallest:`Smallest first`,sortSize:`Size`,noArchives:`No archives found`,noArchivesSearch:`No archives match your search`,originalPrintNotVisible:`Original print not visible - try clearing filters`,noArchivesYet:`No archives yet`,prints:`prints`,pagination:{showing:`Showing`,to:`to`,of:`of`,show:`Show`,page:`Page`,all:`All`},loadingArchives:`Loading archives...`,releaseToUpload:`Release to upload`,showAll:`Show all`,showFavoritesOnly:`Show favorites only`,gridView:`Grid view`,listView:`List view`,calendarView:`Calendar view`,logView:`Print Log`,manageTags:`Manage Tags`,showFailedPrints:`Show failed prints`,hideFailedPrints:`Hide failed prints`,hideDuplicates:`Hide Duplicates`,filterUnconfirmed:`Unconfirmed`,filterUnconfirmedTitle:`Show only prints still waiting for their outcome verdict`,viewOriginalPrint:`Click to view original print (#{{id}})`,printTime:`Print Time`,filamentUsed:`Filament Used`,cost:`Cost`,preview:`Preview`,deleteArchive:`Delete Archive`,deleteConfirm:`Are you sure you want to delete this archive?`,favorite:`Favorite`,unfavorite:`Remove from favorites`,viewDetails:`View Details`,status:{completed:`Completed`,failed:`Failed`,stopped:`Stopped`},toast:{source3mfAttached:`Source 3MF attached: {{filename}}`,failedUploadSource3mf:`Failed to upload source 3MF`,source3mfRemoved:`Source 3MF removed`,failedRemoveSource3mf:`Failed to remove source 3MF`,f3dAttached:`F3D attached: {{filename}}`,failedUploadF3d:`Failed to upload F3D`,f3dRemoved:`F3D removed`,failedRemoveF3d:`Failed to remove F3D`,timelapseAttached:`Timelapse attached: {{filename}}`,timelapseAlreadyAttached:`Timelapse already attached`,noMatchingTimelapse:`No matching timelapse found`,failedScanTimelapse:`Failed to scan for timelapse`,failedAttachTimelapse:`Failed to attach timelapse`,timelapseRemoved:`Timelapse removed`,failedRemoveTimelapse:`Failed to remove timelapse`,timelapseUploaded:`Timelapse uploaded: {{filename}}`,failedUploadTimelapse:`Failed to upload timelapse`,archiveDeleted:`Archive deleted`,failedDeleteArchive:`Failed to delete archive`,addedToFavorites:`Added to favorites`,removedFromFavorites:`Removed from favorites`,projectUpdated:`Project updated`,failedUpdateProject:`Failed to update project`,linkCopied:`Link copied to clipboard`,failedCopyLink:`Failed to copy link`,photoDeleted:`Photo deleted`,failedDeletePhoto:`Failed to delete photo`,failedDeleteArchives:`Failed to delete archives`,failedUpdateFavorites:`Failed to update favorites`,exportDownloaded:`Export downloaded`,exportFailed:`Export failed`},menu:{print:`Print`,openInBambuStudio:`Open in Slicer`,slice:`Slice`,externalLink:`External Link`,viewOnMakerWorld:`View on MakerWorld`,confirmOutcome:`Confirm Outcome`,preview3d:`3D Preview`,viewTimelapse:`View Timelapse`,scanForTimelapse:`Scan for Timelapse`,uploadTimelapse:`Upload Timelapse`,removeTimelapse:`Remove Timelapse`,downloadSource3mf:`Download Source 3MF`,uploadSource3mf:`Upload Source 3MF`,replaceSource3mf:`Replace Source 3MF`,removeSource3mf:`Remove Source 3MF`,uploadF3d:`Upload F3D`,replaceF3d:`Replace F3D`,downloadF3d:`Download F3D`,removeF3d:`Remove F3D`,download:`Download`,copyDownloadLink:`Copy Download Link`,qrCode:`QR Code`,viewPhotos:`View Photos`,viewPhotosCount:`View Photos ({{count}})`,projectPage:`Project Page`,addToFavorites:`Add to Favorites`,removeFromFavorites:`Remove from Favorites`,edit:`Edit`,printLog:`Print Log`,goToProject:`Go to Project: {{name}}`,addToProject:`Add to Project`,removeFromProject:`Remove from Project`,loading:`Loading...`,noProjectsAvailable:`No projects available`,searchProjects:`Search projects…`,select:`Select`,deselect:`Deselect`,delete:`Delete`},permission:{noReprint:`You do not have permission to reprint this archive`,noAddToQueue:`You do not have permission to add to queue`,noUpdateArchives:`You do not have permission to update archives`,noUploadFiles:`You do not have permission to upload files`,noDownload:`You do not have permission to download archives`,noCopyLink:`You do not have permission to copy download links`,noDelete:`You do not have permission to delete this archive`,noEdit:`You do not have permission to edit this entry`,noCreate:`You do not have permission to create archives`},platePicker:{title:`Select plate to preview`,hint:`This archive has multiple plates. Pick one to open in the GCode viewer.`,plateLabel:`Plate {{index}}`,objectCount:`{{count}} object`,objectCount_plural:`{{count}} objects`,noGcode:`This archive has no sliced G-code to preview. Open it in Bambu Studio to slice first.`},card:{previousPlate:`Previous plate`,nextPlate:`Next plate`,plateNumber:`Plate {{index}}`,moreOptions:`Right-click for more options`,addToFavorites:`Add to favorites`,removeFromFavorites:`Remove from favorites`,cancelled:`cancelled`,failed:`failed`,confirmPending:`outcome?`,confirmPendingTitle:`This print asked for an outcome verdict — click to answer`,rejected:`rejected`,rejectedTitle:`Completed on the printer, marked as reject by the user`,confirmedGood:`good`,confirmedGoodTitle:`Confirmed as a good part by the user`,duplicate:`duplicate`,duplicateTitle:`This model has been printed before`,openSource3mf:`Open source 3MF in Bambu Studio (right-click for more options)`,downloadF3d:`Download Fusion 360 design file`,viewTimelapse:`View timelapse`,viewPhoto:`View 1 photo`,viewPhotos:`View {{count}} photos`,openFolder:`Open folder: {{name}}`,slicedFile:`Sliced file - ready to print`,sourceFile:`Source file only - no AMS mapping available`,gcode:`GCODE`,source:`SOURCE`,project:`Project: {{name}}`,runsBadge:`{{count}} prints`,runsBadgeTitle:`{{count}} prints total — {{successful}} successful, {{failed}} failed. Click to see the full print log.`,estimated:`Estimated: {{time}}`,actual:`Actual: {{time}}`,accuracy:`Accuracy: {{percent}}%`,filament:`{{weight}}g`,layer:`{{count}} layer`,layers:`{{count}} layers`,wearCost:`Printer wear`,costEstimate:`Estimate — the final cost is set when the print finishes`,object:`{{count}} object`,objects:`{{count}} objects`,slicedFor:`Sliced for {{model}}`,uploadedBy:`Uploaded By`,noPermissionReprint:`You do not have permission to reprint`,noFileForReprint:`No 3MF file available — the file could not be downloaded from the printer when the print was recorded`,slicerAmsMapping:`AMS mapping saved ({{printer}})`,slicerAmsMappingTooltip:`The slicer's own AMS slot choice was saved for {{printer}}. Tray numbers only mean something on that printer, so a reprint reuses them only when it targets {{printer}} again.`,noPermissionEdit:`You do not have permission to edit archives`,noPermissionDelete:`You do not have permission to delete archives`,openInBambuStudio:`Open in Slicer`,openInBambuStudioToSlice:`Open in Slicer to slice`,slice:`Slice`,externalLink:`External Link`,makerWorld:`MakerWorld: {{designer}}`,viewProject:`View project`,noExternalLink:`No external link`,preview3d:`3D Preview`,download:`Download`,edit:`Edit`,delete:`Delete`},runLog:{title:`Print Log`,modalTitle:`Print Log — {{name}}`,modalTitleFallback:`this archive`,empty:`No print events recorded for this archive yet.`,col:{date:`Date`,status:`Status`,duration:`Duration`,filament:`Filament`,cost:`Cost`},status:{completed:`Completed`,failed:`Failed`,cancelled:`Cancelled`,stopped:`Stopped`,skipped:`Skipped`,printing:`Printing`}},modal:{deleteArchive:`Delete Archive`,deleteConfirm:`Are you sure you want to delete "{{name}}"? This action cannot be undone.`,deleteButton:`Delete`,deletePurgeStats:`Also remove this print from Quick Stats (filament, time, cost, energy)`,deleteQueueItemsWarning:`{{count}} queue item(s) linked to this archive will also be removed.`,deleteBlockedByPrinting:`Cannot delete — {{count}} queue item(s) are currently printing. Stop the print first, then retry.`,removeSource3mf:`Remove Source 3MF`,removeSource3mfConfirm:`Are you sure you want to remove the source 3MF file from "{{name}}"? This will delete the original slicer project file.`,removeButton:`Remove`,removeF3d:`Remove F3D`,removeF3dConfirm:`Are you sure you want to remove the Fusion 360 design file from "{{name}}"?`,removeTimelapse:`Remove Timelapse`,removeTimelapseConfirm:`Are you sure you want to remove the timelapse video from "{{name}}"?`,timelapse:`{{name}} - Timelapse`,selectTimelapse:`Select Timelapse`,selectTimelapseDesc:`No auto-match found. Select the timelapse for this print:`,deleteArchives:`Delete Archives`,deleteArchivesConfirm:`Are you sure you want to delete {{count}} archive(s)? This action cannot be undone.`,deleteCount:`Delete {{count}}`},page:{title:`Archives`,printsCount:`{{filtered}} of {{total}} prints`,dropFilesHere:`Drop .3mf files here`,releaseToUpload:`Release to upload`,only3mfSupported:`Only .3mf files are supported`,close:`Close`,selected:`{{count}} selected`,selectAll:`Select All`,tags:`Tags`,project:`Project`,favorite:`Favorite`,delete:`Delete`,toggledFavorites:`Toggled favorites for {{count}} archive(s)`,failedUpdateFavorites:`Failed to update favorites`,archivesDeleted:`{{count}} archive(s) deleted`,failedDeleteArchives:`Failed to delete archives`,photoDeleted:`Photo deleted`,failedDeletePhoto:`Failed to delete photo`},list:{name:`Name`,printer:`Printer`,date:`Date`,size:`Size`,actions:`Actions`,hasTimelapse:`Has timelapse`},log:{date:`Date`,printName:`Print Name`,printer:`Printer`,user:`User`,status:`Status`,duration:`Duration`,filament:`Filament`,filamentUsed:`Filament Used`,cost:`Cost`,energy:`Energy`,energyCost:`Energy Cost`,wearCost:`Wear Cost`,completedAt:`Finished`,columns:`Columns`,sortBy:`Sort by {{column}}`,allPrinters:`All Printers`,allUsers:`All Users`,allStatuses:`All Statuses`,cancelled:`Cancelled`,skipped:`Skipped`,dateFrom:`From`,dateTo:`To`,noEntries:`No print log entries found`,showing:`Showing {{count}} of {{total}} entries`,rowsPerPage:`Rows`,page:`Page`,prev:`Prev`,next:`Next`,clearLog:`Clear Log`,clearLogTitle:`Clear Print Log`,clearLogConfirm:`All print log entries will be permanently deleted. Archives and queue items are not affected. This action cannot be undone. Are you sure?`,clearLogButton:`Clear All`,cleared:`{{count}} log entries cleared`,clearFailed:`Failed to clear print log`,deleteEntryTitle:`Delete print log entry`,deleteEntryConfirm:`This entry will be removed from the log and its filament, time, and cost contributions will drop out of Quick Stats. The matching archive (if any) is not affected. This action cannot be undone.`,entryDeleted:`Print log entry deleted`,entryDeleteFailed:`Failed to delete print log entry`,editEntryTitle:`Edit print log entry`,editEntryDescription:`Classify this print run. The Failure Analysis widget groups by these values, so updates flow through to stats immediately.`,entryUpdated:`Print log entry updated`,entryUpdateFailed:`Failed to update print log entry`,statuses:{completed:`Completed`,failed:`Failed`,stopped:`Stopped`,cancelled:`Cancelled`,skipped:`Skipped`}}},dispatchToast:{untitled:`Print job`,startingPrints:`Starting prints`,progressSummary:`{{complete}}/{{total}} complete • Processing: {{processing}}`,expandDetails:`Expand dispatch details`,collapseDetails:`Collapse dispatch details`,awaitingPrinter:`Awaiting printer…`,status:{processing:`Processing`,completed:`Completed`,failed:`Failed`},failed:{generic:`Dispatch failed`,upload_failed:`Upload to printer failed`,start_command_failed:`Printer rejected start command`},dismiss:`Dismiss`},pipelineRuns:{title:`Pipeline Runs`,loading:`Loading…`,empty:`No pipeline runs yet.`,filter:{pipeline:`Pipeline`,status:`Status`,target:`Target`,all:`All`,allPipelines:`All pipelines`,allStatus:`All statuses`,allTargets:`All targets`,clear:`Clear filters`,noMatches:`No runs match the current filters.`},totalCount_one:`{{n}} run`,totalCount_other:`{{n}} runs`,copies:`{{n}} copies`,failedCount:`{{n}} failed`,copyN:`Copy {{n}}`,retryFailed:`Retry failed`,retryOf:`retry of #{{n}}`,pagination:`{{start}}–{{end}} of {{total}}`,cancelledByUser:`Cancelled by user`,toast:{cancelled:`Run cancelled`,cancelFailed:`Cancel failed`,retryStarted:`Retry started`,retryFailed:`Retry failed`,cleared:`{{n}} runs cleared`,clearFailed:`Clear failed`},clearLog:`Clear log`,clearConfirmTitle:`Clear log?`,clearConfirmBody:`Delete every completed, failed, cancelled, and partial-failure pipeline run? In-flight runs are kept. This cannot be undone.`,clearConfirmAction:`Clear`,jobStatus:{pending:`pending`,awaiting_printer:`awaiting printer`,queued:`queued`,printing:`printing`,completed:`completed`,failed:`failed`,cancelled:`cancelled`}},queue:{title:`Print Queue`,subtitle:`Schedule and manage your print jobs`,filamentShort:{rowBadge:`Insufficient filament for the assigned spool`,rowTooltip:`The dispatch scheduler flagged this item. Click Play to see the per-slot deficit and decide whether to print anyway.`,confirmTitle:`Insufficient filament`,confirmIntro:`The assigned spool cannot satisfy at least one slot. Print anyway?`,lineItem:`Slot {{slot}}: needs {{required}} g, {{remaining}} g remaining`,unknown:`unknown`,printAnyway:`Print Anyway`},filamentMissing:{confirmTitle:`Filament not loaded`,confirmIntro:`The printer has no tray with this filament. Load it and press Start again, or print anyway:`},slicerAmsMapping:{rowBadge:`AMS slots saved for this printer`,rowTooltip:`This archive carries the exact AMS slots the slicer picked, saved for the printer this item targets. A reprint on it can reuse those trays instead of matching again by type and colour.`},editQueueItem:`Edit Queue Item`,selectAllPlates:`Select All {{count}} Plates`,deselectAll:`Deselect All`,printQueued:`Print queued`,printQueuedWillStartWhenIdle:`Will start when printer is idle`,itemsQueued:`{{count}} items queued`,sending:`Sending...`,sendingProgress:`Sending {{current}}/{{total}}...`,adding:`Adding...`,addingProgress:`Adding {{current}}/{{total}}...`,savingProgress:`Saving {{current}}/{{total}}...`,clearQueue:`Clear Queue`,clearHistory:`Clear History`,emptyQueue:`Queue is empty`,position:`Position`,scheduledTime:`Scheduled Time`,moveUp:`Move Up`,moveDown:`Move Down`,startNow:`Start Now`,printingInProgress:`Printing in progress...`,viewArchive:`View archive`,viewInFileManager:`View in File Manager`,itemCount:`{{count}} item`,itemCount_plural:`{{count}} items`,dragToReorder:`Drag to reorder (ASAP only)`,reorderHint:`Position only affects ASAP items. Scheduled items run at their set time.`,sjf:{label:`SJF`,tooltip:`Shortest Job First — scheduler prioritizes shorter prints`},addedBy:`Added by {{name}}`,nextInQueue:`Next in queue`,clearPlateSuccess:`Plate cleared — ready for next print`,plateNumber:`Plate {{index}}`,quantity:`Quantity`,quantityHint:`Creates {{count}} queue items`,plateQuantityLabel:`Runs of {{plate}}`,plateQuantityTotal_one:`{{count}} run in total`,plateQuantityTotal_other:`{{count}} runs in total`,batchOrders:{title:`Batch Orders`,emptyTitle:`No batch orders`,emptyDescription:`Queue a multi-plate file, or more than one copy of a plate, and the order shows up here with its progress.`,filter:{active:`Active`,completed:`Completed`,cancelled:`Cancelled`,all:`All`},status:{active:`Active`,completed:`Completed`,cancelled:`Cancelled`},noTargets:`Grouping only`,noTargetsHint:`Created before per-plate targets existed, so it tracks the runs it queued rather than a target.`,dispatchRemaining:`Queue {{count}} remaining`,dispatchPlate:`Queue remaining`,strandedPlate:`Nothing left to copy settings from`,strandedNotice:`Cannot queue {{runs}} of the {{owed}} runs still owed: that plate has no queued or finished run left to copy settings from. Queue the plate once from the file, or cancel the order.`,dispatched:`Queued the remaining runs for {{name}}`,plateProgress:`{{completed}} of {{target}} done`,remaining:`{{count}} still owed`,failed:`{{count}} failed`,printing:`{{count}} printing`,wholeFile:`Whole file`,due:`Due {{date}}`,costSoFar:`{{amount}} so far`,costRemaining:`({{amount}} to go)`},activeBatches:`Active Batches`,batchProgress:`{{completed}} of {{total}} completed`,cancelBatch:`Cancel Remaining`,batchCancelled:`Remaining batch items cancelled`,cancelBatchConfirmTitle:`Cancel Batch`,cancelBatchConfirmMessage:`Close this order? Any runs still queued are cancelled, and it stops asking for what it has not produced.`,batch:{defaultName:`Batch`,label:`{{count}} item`,label_plural:`{{count}} items`,pendingCount:`{{count}} pending`,pendingCount_plural:`{{count}} pending`,expand:`Expand batch`,collapse:`Collapse batch`,groupAsBatch:`Group as batch…`,groupAsBatchDescription:`Combine the {{count}} selected items into a single collapsible batch.`,nameLabel:`Batch name`,namePlaceholder:`e.g. Friday gifts`,create:`Create batch`,ungroup:`Ungroup`,ungroupConfirmTitle:`Ungroup batch?`,ungroupConfirmMessage:`The items will stay in the queue but no longer be grouped together.`,dragGroup:`Drag group`},tabs:{batches:`Batches`,queue:`Queue`,history:`History`,timeline:`Timeline`,pipelines:`Pipelines`},layout:{flatList:`List`,byPrinter:`By Printer`,groupByPrinter:`Group by Printer`},history:{emptyTitle:`No history yet`,emptyDescription:`Completed, cancelled, and failed prints will appear here.`,showMore:`Show more`,showingCount:`Showing {{shown}} of {{total}}`},dragGhost:{multiCount:`{{count}} items`,batch:`{{name}} ({{count}} copy)`,batch_plural:`{{name}} ({{count}} copies)`},sections:{currentlyPrinting:`Currently Printing`,queued:`Queued`,history:`History`},status:{pending:`Pending`,waiting:`Waiting`,printing:`Printing`,paused:`Paused`,completed:`Completed`,failed:`Failed`,skipped:`Skipped`,cancelled:`Cancelled`},summary:{printing:`Printing`,queued:`Queued`,totalTime:`Total Queue Time`,totalWeight:`Total Queue Weight`,history:`History`},filter:{allPrinters:`All Printers`,unassigned:`Unassigned`,allStatus:`All Status`,allLocations:`All Locations`,any:`Any`},sort:{byPosition:`Sort by Position`,byName:`Sort by Name`,byPrinter:`Sort by Printer`,bySchedule:`Sort by Schedule`,byDate:`Sort by Date`,ascendingOldest:`Ascending (oldest first)`,descendingNewest:`Descending (newest first)`},badges:{awaitingReview:`Waiting for review`,staged:`Staged`,requiresPrevious:`Requires previous success`,autoPowerOff:`Auto power off`,gcodeInjection:`G-code`,confirmOutcome:`Outcome prompt`,confirmOutcomeTitle:`Asks how the print came out after it completes`},empty:{title:`No prints scheduled`,description:`Schedule a print from the Archives page using the "Schedule" option in the context menu, or drag and drop files to get started.`},time:{etaIfStartedNow:`Completion time if this job started now`,whenFree:`When a printer is free`,overdue:`Overdue`,now:`Now`,lessThanMinute:`In less than a minute`,inMinutes:`In {{count}} min`,inHours:`In {{count}} hours`},actions:{startPrint:`Start Print`,stopPrint:`Stop Print`,requeue:`Re-queue`},bulkEdit:{title:`Edit {{count}} Item`,title_plural:`Edit {{count}} Items`,description:`Only changed settings will be applied to selected items.`,printer:`Printer`,noChange:`— No change —`,queueOptions:`Queue Options`,staged:`Staged (manual start)`,autoPowerOff:`Auto power off after print`,requirePrevious:`Require previous success`,gcodeInjection:`Inject G-code`,printOptions:`Print Options`,bedLevelling:`Bed levelling`,flowCalibration:`Flow calibration`,vibrationCalibration:`Vibration calibration`,layerInspection:`First layer inspection`,timelapse:`Timelapse`,useAms:`Use AMS`,confirmOutcome:`Ask for outcome`,nozzleOffsetCali:`Nozzle offset calibration`,applyChanges:`Apply Changes`,selectAll:`Select All`,deselectAll:`Deselect All`,selected:`{{count}} selected`,editSelected:`Edit Selected`,cancelSelected:`Cancel Selected`},confirm:{cancelTitle:`Cancel Scheduled Print`,cancelMessage:`Are you sure you want to cancel "{{name}}"?`,stopTitle:`Stop Print`,stopMessage:`Are you sure you want to stop the current print "{{name}}"? This will cancel the print job on the printer.`,removeTitle:`Remove from History`,removeMessage:`Are you sure you want to remove "{{name}}" from the queue history?`,clearHistoryTitle:`Clear History`,clearHistoryMessage:`Are you sure you want to remove all {{count}} item(s) from the history?`,cancelButton:`Cancel Print`,stopButton:`Stop Print`,thisPrint:`this print`,thisItem:`this item`},toast:{cancelled:`Queue item cancelled`,cancelFailed:`Failed to cancel item`,removed:`Queue item removed`,keptForOrder:`Cancelled instead of removed: this is the only run its batch order can re-queue this plate from`,historyKeptForOrders:`Kept {{kept}} that batch orders still need.`,removeFailed:`Failed to remove item`,stopped:`Print stopped`,stopFailed:`Failed to stop print`,released:`Print released to queue`,startFailed:`Failed to start print`,reorderFailed:`Failed to reorder queue`,historyCleared:`Cleared {{count}} history item(s)`,clearHistoryFailed:`Failed to clear history`,updateFailed:`Failed to update items`,bulkCancelled:`Cancelled {{count}} item(s)`,bulkCancelFailed:`Failed to cancel items`,batchCreated:`Batch "{{name}}" created`,batchCreateFailed:`Failed to create batch`,batchUngrouped:`Ungrouped {{count}} item(s)`,batchUngroupFailed:`Failed to ungroup batch`,resumedAfterFailure:`Resumed queue — {{restored}} job(s) restored to pending`,resumeAfterFailureFailed:`Failed to resume queue`},resumeAfterFailure:{banner:`{{printer}} is blocked by a previous-print failure — {{count}} job(s) skipped`,bannerHint:`Fix the printer issue, then resume to restore the skipped jobs and clear the gate.`,button:`Resume after failure`,confirmTitle:`Resume queue after failure?`,confirmMessage:`Restore {{count}} skipped job(s) on {{printer}} to pending and clear the previous-print gate. Make sure the printer is ready before continuing.`},timeline:{listView:`List`,timelineView:`Timeline`,unassigned:`Unassigned`,noData:`No scheduled prints for this day`,nothingCommitted:`No committed schedules in this window. Staged items, waiting items, and ASAP jobs on idle printers are not shown — set a scheduled time or release a staged item to see it here.`,allDoneBy:`All prints estimated done by {{time}}`,staged:`Staged`,filterAll:`Show All`,filterPrinting:`Printing`,filterQueued:`Queued`,time:{anyMoment:`any moment`,minutesLeft:`{{minutes}}m left`,hoursLeft:`{{hours}}h left`,hoursMinutesLeft:`{{hours}}h {{minutes}}m left`},day:{previous:`Previous day`,next:`Next day`,today:`Today`},window:{back12h:`Back 12 hours`,forward12h:`Forward 12 hours`,now:`Now`},printerColumnHeader:`Printer`},permissions:{noStopPrint:`You do not have permission to stop prints`,noStartPrint:`You do not have permission to start prints`,awaitingReview:`Waiting for review: someone who manages the queue starts this job`,noEdit:`You do not have permission to edit this queue item`,noCancel:`You do not have permission to cancel this queue item`,noRequeue:`You do not have permission to re-queue items`,noRemove:`You do not have permission to remove this queue item`,noClearHistory:`You do not have permission to clear all history`,noEditItems:`You do not have permission to edit queue items`,noCancelItems:`You do not have permission to cancel queue items`}},stats:{title:`Statistics`,subtitle:`Drag widgets to rearrange. Click the eye icon to hide.`,overview:`Overview`,totalPrints:`Total Prints`,successRate:`Success Rate`,totalPrintTime:`Total Print Time`,printTime:`Print Time`,totalFilament:`Total Filament Used`,filamentUsed:`Filament Used`,filamentCost:`Filament Cost`,totalCost:`Total Cost`,energyUsed:`Energy Used`,energyCost:`Energy Cost`,wearCost:`Wear Cost`,energyWarmingUpTooltip:`Energy tracking is still collecting hourly snapshots. Date-range totals will become accurate once at least one snapshot exists before the selected range. Early values may undercount.`,averagePrintTime:`Average Print Time`,printsPerDay:`Prints per Day`,byPrinter:`By Printer`,printsByPrinter:`Prints by Printer`,byMaterial:`By Material`,byMonth:`By Month`,last7Days:`Last 7 Days`,last30Days:`Last 30 Days`,last90Days:`Last 90 Days`,allTime:`All Time`,quickStats:`Quick Stats`,printActivity:`Print Activity`,filamentTypes:`Filament Types`,filamentTrends:`Filament Trends`,materialNumbers:{title:`By Material Number`,empty:`No material numbers assigned yet. Add them to spools in the inventory to group consumption and costs here.`,loadFailed:`Could not load the material number statistics.`,spools:`Spools`,remaining:`Remaining`,consumed:`Consumed`,cost:`Cost`},suppliers:{title:`By Supplier`,empty:`No purchases recorded yet. Mark on a spool which supplier it was bought from to group consumption and costs here.`,error:`Could not load supplier statistics`,supplier:`Supplier`,spools:`Spools`,remaining:`Remaining`,consumed:`Consumed`,cost:`Cost`},failureAnalysis:`Failure Analysis`,timeAccuracy:`Time Accuracy`,successful:`Successful:`,failed:`Failed:`,cancelled:`Cancelled:`,perfectEstimate:`100% = perfect estimate`,noTimeAccuracyData:`No time accuracy data yet`,noFilamentData:`No filament data available`,noPrinterData:`No printer data available`,noPrintData:`No print data available`,noPrintDataLast30Days:`No print data in the last 30 days`,failureReasons:`Failure Reasons`,topFailureReasons:`Top Failure Reasons`,failedPrintsCount:`{{failed}} / {{total}} prints failed`,rejectedPrintsCount:`{{rejected}} rejected after completion`,yieldRate:`Yield: {{rate}}%`,lastWeekRate:`Last week: {{rate}}%`,resetLayout:`Reset Layout`,recalculateCosts:`Recalculate Costs`,recalculateCostsHint:`Recalculate all archive costs using current filament prices`,exportStats:`Export Stats`,exportAsCsv:`Export as CSV`,exportAsExcel:`Export as Excel`,hiddenCount:`{{count}} Hidden`,exportDownloaded:`Export downloaded`,exportFailed:`Export failed`,layoutReset:`Layout reset`,recalculatedCosts:`Recalculated costs for {{count}} archives`,recalculateFailed:`Failed to recalculate costs`,loadingStats:`Loading statistics...`,noPermissionResetLayout:`You do not have permission to reset layout`,noPermissionRecalculate:`You do not have permission to recalculate costs`,noPrintDataInRange:`No print data in selected range`,periodFilament:`Period Filament`,periodCost:`Period Cost`,avgPerPrint:`Avg per Print`,usageOverTime:`Usage Over Time`,energyOverTime:`Energy Over Time`,filamentByWeight:`Weight`,printDuration:`Print Duration`,printerUtilization:`Printer Utilization`,filamentSuccess:`Success by Material`,printHabits:`Print Habits`,printTimeOfDay:`Print Time of Day`,colorDistribution:`Color Distribution`,noColorData:`No color data available`,records:`Records`,longestPrint:`Longest Print`,heaviestPrint:`Heaviest Print`,mostExpensivePrint:`Most Expensive`,busiestDay:`Busiest Day`,successStreak:`Success Streak`,streakPrint:`consecutive print`,streakPrints:`{{count}} consecutive prints`,printerStats:`Printer Stats`,hours:`hours`,avgPrints:`Avg. prints`,noArchiveData:`No print data available`,filamentByTime:`Time`,avgWeight:`Avg. weight`,avgTime:`Avg. time`,filamentByPrints:`Prints`,timeframe:{today:`Today`,"this-week":`This Week`,"this-month":`This Month`,"last-7":`Last 7 Days`,"last-30":`Last 30 Days`,"last-90":`Last 90 Days`,"this-year":`This Year`,"all-time":`All Time`,custom:`Custom Range`,from:`From`,to:`To`},allUsers:`All Users`,noUser:`No User (System)`,filterByUser:`Filter by User`},maintenance:{title:`Maintenance`,overview:`Overview`,allOk:`All maintenance up to date`,dueCount:`{{count}} item due`,dueCount_plural:`{{count}} items due`,warningCount:`{{count}} warning`,warningCount_plural:`{{count}} warnings`,totalPrintTime:`Total Print Time`,nextMaintenance:`Next Maintenance`,nothingDue:`Nothing due`,tasks:`Tasks`,lastPerformed:`Last performed`,interval:`Interval`,hoursRemaining:`{{hours}}h remaining`,hoursOverdue:`{{hours}}h overdue`,markDone:`Mark as Done`,performMaintenance:`Perform Maintenance`,history:`History`,noHistory:`No maintenance history`,editPrintHours:`Edit Print Hours`,currentHours:`Current Hours`,statusTab:`Status`,settingsTab:`Settings`,overdueCount:`{{count}} overdue`,dueSoonCount:`{{count}} due soon`,dueSoon:`Due soon`,allGood:`All good`,overdueBy:`Overdue by {{duration}}`,dueIn:`Due in {{duration}}`,timeLeft:`{{duration}} left`,day:`1 day`,days:`{{count}} days`,week:`1 week`,weeks:`{{count}} weeks`,month:`1 month`,months:`{{count}} months`,year:`1 year`,maintenanceTypes:`Maintenance Types`,maintenanceTypesDescription:`System types and your custom maintenance tasks`,addCustomType:`Add Custom Type`,restoreDefaults:`Restore Default Tasks`,intervalType:`Interval Type`,intervalValue:`Interval ({{type}})`,icon:`Icon`,documentationLink:`Documentation Link (optional)`,assignToPrinters:`Assign to Printers`,selectAtLeastOnePrinter:`Select at least one printer`,addType:`Add Type`,custom:`Custom`,printHours:`Print Hours`,calendarDays:`Calendar Days`,exampleName:`e.g., Replace HEPA Filter`,viewDocumentation:`View documentation`,timeBasedInterval:`Time-based interval`,intervalOverrides:`Interval Overrides`,intervalOverridesDescription:`Customize intervals for specific printers`,assignedToPrinters:`Assigned to printers:`,noPrintersAssigned:`No printers assigned`,addPrinterShort:`Add:`,printersAssignedClick:`{{count}} printer(s) assigned - click to manage`,removeFromPrinter:`Remove from this printer`,types:{lubricateCarbonRods:`Lubricate Carbon Rods`,lubricateRails:`Lubricate Linear Rails`,cleanNozzle:`Clean Nozzle/Hotend`,checkBelts:`Check Belt Tension`,cleanBuildPlate:`Clean Build Plate`,checkExtruder:`Check Extruder Gears`,checkCooling:`Check Cooling Fans`,generalInspection:`General Inspection`,cleanCarbonRods:`Clean Carbon Rods`,lubricateSteelRods:`Lubricate Steel Rods`,cleanSteelRods:`Clean Steel Rods`,cleanLinearRails:`Clean Linear Rails`,checkPtfeTube:`Check PTFE Tube`,replaceHepaFilter:`Replace HEPA Filter`,replaceCarbonFilter:`Replace Carbon Filter`,lubricateLeftNozzleRail:`Lubricate Left Nozzle Rail`},maintenanceComplete:`Maintenance marked as complete`,typeUpdated:`Maintenance type updated`,typeDeleted:`Maintenance type deleted`,defaultsRestored:`Restored {{count}} default task(s)`,printHoursUpdated:`Print hours updated`,printerAssigned:`Printer assigned`,printerRemoved:`Printer removed`,deleteTypeConfirm:`Delete "{{name}}"?`,deleteSystemTypeTitle:`Delete default maintenance task?`,deleteSystemTypeMessage:`Are you sure you want to delete the default maintenance task "{{name}}"?`,noPermissionUpdate:`You do not have permission to update maintenance items`,noPermissionPerform:`You do not have permission to perform maintenance`,noPermissionEditTypes:`You do not have permission to edit maintenance types`,noPermissionDeleteTypes:`You do not have permission to delete maintenance types`,noPermissionEditHours:`You do not have permission to edit print hours`,noPermissionRemovePrinter:`You do not have permission to remove printer assignments`,noPermissionAssignPrinter:`You do not have permission to assign printers`,noPermissionEditIntervals:`You do not have permission to edit intervals`,configureSettings:`Configure maintenance types and intervals`},settings:{sliceEngine:`Slice engine`,sliceEngineSidecar:`Server sidecar`,sliceEngineSidecarHint:`Slicing runs on the server, in the slicer sidecar container.`,sliceEngineBrowser:`In browser`,sliceEngineBrowserHint:`Slicing runs on this device, with no server involved.`,title:`Settings`,general:`General`,tabs:{general:`General`,smartPlugs:`Smart Plugs`,sensors:`Sensors`,notifications:`Notifications`,queue:`Workflow`,queueDispatch:`Queue & Dispatch`,queuePipelines:`Pipelines`,filament:`Filament`,camera:`Camera`,network:`Network`,apiKeys:`API Keys`,virtualPrinter:`Virtual Printer`,spoolbuddy:`SpoolBuddy`,failureDetection:`Failure Detection`,users:`Authentication`,backup:`Backup`,emailAuth:`Email Authentication`,ldap:`LDAP`,twoFa:`Two-Factor Auth`,oidc:`SSO / OIDC`,security:`Security`},spoolbuddy:{infoTitle:`SpoolBuddy devices`,infoBody:`SpoolBuddy kiosks register themselves automatically via heartbeat. Unregister a device here if it is no longer in use or if a stale duplicate was left behind by a daemon crash.`,duplicatesTitle:`{{count}} devices registered`,duplicatesBody:`Only the first registered device is used by the kiosk UI. If one of these is a stale duplicate from a crash, unregister it — an online device will re-register itself on its next heartbeat.`,empty:`No SpoolBuddy devices registered yet.`,online:`Online`,offline:`Offline`,unregister:`Unregister`,unregisterSuccess:`Device unregistered`,unregisterError:`Failed to unregister device`,confirmTitle:`Unregister SpoolBuddy device?`,confirmBody:`This will remove "{{hostname}}" ({{deviceId}}) from the database. If the device is online, it will re-register itself on its next heartbeat.`,ipAddress:`IP address`,firmware:`Firmware`,lastSeen:`Last seen`,daemonUptime:`Daemon uptime`,systemUptime:`System uptime`,never:`never`,nfc:`NFC`,scale:`Scale`,cpuTemp:`CPU temp`,cpuLoad:`CPU load`,memory:`Memory`,disk:`Disk`,update:`Update`,updateConfirmTitle:`Update Spoolbuddy daemon?`,updateConfirmBody:`Trigger a software update on "{{hostname}}"? The daemon will restart once the update is applied.`,restartBrowser:`Restart Browser`,restartBrowserConfirmTitle:`Restart kiosk browser?`,restartBrowserConfirmBody:`Restart the kiosk browser on "{{hostname}}"? The display will blank briefly.`,restartDaemon:`Restart Daemon`,restartDaemonConfirmTitle:`Restart Spoolbuddy daemon?`,restartDaemonConfirmBody:`Restart the Spoolbuddy daemon on "{{hostname}}"? The device will go offline for a few seconds.`,reboot:`Reboot`,rebootConfirmTitle:`Reboot device?`,rebootConfirmBody:`Reboot "{{hostname}}"? The device will be offline for around a minute.`,shutdown:`Shutdown`,shutdownConfirmTitle:`Shutdown device?`,shutdownConfirmBody:`Shutdown "{{hostname}}"? You will need physical access to power it back on.`,commandConfirm:`Confirm`,commandQueued:`Command queued`,commandError:`Failed to send command`},ldap:{title:`LDAP Authentication`,enabledDesc:`LDAP authentication is enabled`,disabledDesc:`LDAP authentication is disabled`,disabledHint:`Configure and save LDAP settings below, then enable.`,enabled:`LDAP authentication enabled`,disabled:`LDAP authentication disabled`,feature1:`Users can login with LDAP credentials`,feature2:`Local admin account remains as fallback`,feature3:`LDAP groups are mapped to BamBuddy groups on login`,serverConfig:`LDAP Server Configuration`,serverUrl:`Server URL`,serverUrlHint:`Use ldaps:// for SSL or ldap:// with StartTLS`,security:`Security`,securityHint:`StartTLS upgrades a plain connection to TLS. LDAPS uses TLS from the start.`,bindDn:`Bind DN (Service Account)`,bindPassword:`Bind Password`,searchBase:`Search Base DN`,userFilter:`User Search Filter`,userFilterHint:`{username} is replaced with the login username. Use (uid={username}) for OpenLDAP.`,advanced:`Advanced`,autoProvision:`Auto-provision users`,autoProvisionHint:`Automatically create a BamBuddy account on first LDAP login`,defaultGroup:`Default group`,defaultGroupNone:`— None (no fallback) —`,defaultGroupHint:`Fallback group assigned when an LDAP user authenticates but is not listed in any mapped LDAP group. Leave empty to leave unmapped users without permissions.`,groupMapping:`Group Mapping (JSON)`,groupMappingHint:`Map LDAP group DNs to BamBuddy groups. Available groups: `,testConnection:`Test Connection`,settingsSaved:`LDAP settings saved`,errors:{serverRequired:`LDAP server URL is required`,searchBaseRequired:`Search base DN is required`,enableAuthFirst:`Enable authentication first`,configureLdapFirst:`Save LDAP settings first`}},email:{smtpSettings:`SMTP Configuration`,smtpHost:`SMTP Server`,smtpPort:`SMTP Port`,security:`Security`,authentication:`Authentication`,username:`Username`,password:`Password`,fromEmail:`From Email`,fromName:`From Name`,testConnection:`Test SMTP Connection`,testRecipient:`Test Recipient Email`,sendTest:`Send Test Email`,sending:`Sending...`,save:`Save Settings`,saving:`Saving...`,advancedAuth:`Advanced Authentication`,advancedAuthEnabled:`Advanced Authentication is enabled`,advancedAuthEnabledDesc:`Email-based user management features are active. New users will receive auto-generated passwords via email, and users can reset their passwords through the forgot password feature.`,advancedAuthDisabled:`Advanced Authentication is disabled`,advancedAuthDisabledDesc:`Enable advanced authentication to activate email-based features for user management.`,enable:`Enable`,disable:`Disable`,feature1:`Passwords are auto-generated and emailed to new users`,feature2:`Users can login with username or email`,feature3:`Forgot password feature is available`,feature4:`Admins can reset user passwords via email`,errors:{requiredFields:`Please fill in all required fields`,usernameRequired:`Username is required when authentication is enabled`,enterTestEmail:`Please enter a test email address`,smtpServerAndEmail:`Please fill in SMTP Server and From Email before testing`,usernamePasswordRequired:`Username and Password are required when authentication is enabled`,configureSmtpFirst:`Please configure and test SMTP settings first`,enableAuthFirst:`Please enable authentication first to use email-based features.`},success:{settingsSaved:`SMTP settings saved successfully`},securityOptions:{starttls:`STARTTLS (Port 587)`,ssl:`SSL/TLS (Port 465)`,none:`None (Port 25)`},authOptions:{enabled:`Enabled`,disabled:`Disabled`}},appearance:`Appearance`,notifications:`Notifications`,smartPlugs:`Smart Plugs`,spoolman:`Spoolman`,updates:`Updates`,language:`Language`,languageDescription:`Select your preferred language`,theme:`Theme`,themeLight:`Light`,themeDark:`Dark`,themeSystem:`System`,defaultView:`Default View`,defaultViewDescription:`Page to show when opening the app`,checkForUpdates:`Check for Updates`,autoUpdate:`Auto Update`,currentVersion:`Current Version`,latestVersion:`Latest Version`,upToDate:`You are up to date`,updateAvailable:`Update available`,notificationLanguage:`Notification Language`,notificationLanguageDescription:`Language for push notifications`,bedCooledThreshold:`Bed Cooled Threshold`,bedCooledThresholdDescription:`Temperature below which the bed is considered cooled after a print`,userNotificationsEnabled:`User Notifications`,userNotificationsEnabledDescription:`Enable the user notifications menu and email notifications for print job events. Requires Advanced Authentication.`,userNotificationsDisabledHint:`Enable Advanced Authentication to use user notifications.`,notificationProviders:`Notification Providers`,addProvider:`Add Provider`,editProvider:`Edit Provider`,providerType:`Provider Type`,testNotification:`Test Notification`,testSuccess:`Test notification sent successfully`,testFailed:`Failed to send test notification`,quietHours:`Quiet Hours`,quietHoursDescription:`Do not disturb during these hours`,quietHoursStart:`Start`,quietHoursEnd:`End`,events:{title:`Notification Events`,printStart:`Print Started`,printComplete:`Print Completed`,printFailed:`Print Failed`,printStopped:`Print Stopped`,printProgress:`Progress Milestones`,printProgressDescription:`Notify at 25%, 50%, 75%`,printerOffline:`Printer Offline`,printerError:`Printer Error`,filamentLow:`Low Filament`,maintenanceDue:`Maintenance Due`,maintenanceDueDescription:`Notify when maintenance is needed`},smartPlug:{title:`Smart Plugs`,add:`Add Smart Plug`,edit:`Edit Smart Plug`,name:`Name`,ipAddress:`IP Address`,linkedPrinter:`Linked Printer`,autoOn:`Auto Power On`,autoOnDescription:`Turn on when print starts`,autoOff:`Auto Power Off`,autoOffDescription:`Turn off after print completes`,offDelay:`Off Delay`,offDelayMinutes:`Minutes after print`,offDelayTemp:`When nozzle below temperature`,currentState:`Current State`,turnOn:`Turn On`,turnOff:`Turn Off`},filamentTracking:`Filament Tracking`,filamentTrackingDesc:`Choose how to track your filament spools. You can use the built-in inventory or connect an external Spoolman server.`,autoAddUnknownRfid:`Auto-add unknown RFID spools`,autoAddUnknownRfidDesc:`Automatically create an inventory entry when a spool with an unknown RFID tag is detected. Turn off if you pre-register new spools manually to avoid duplicates.`,filamentChecks:`Filament checks`,disableFilamentWarnings:`Disable filament warnings`,disableFilamentWarningsDesc:`Don't show warnings about insufficient filament when printing or queueing`,preferLowestFilament:`Prefer lowest remaining filament`,preferLowestFilamentDesc:`When multiple spools match, use the one with the least filament remaining`,preferLowestFilamentBackupNote:`Only takes effect when AMS Filament Backup is enabled on the printer — otherwise the printer cannot switch to a second spool when the picked one runs out.`,trackingModeBuiltIn:`Built-in Inventory`,trackingModeBuiltInDesc:`RFID auto-matching and usage tracking included`,trackingModeSpoolmanDesc:`External filament management server`,builtInFeatureRfid:`Automatically detects Bambu Lab RFID spools in AMS`,builtInFeatureUsage:`Tracks filament consumption per print`,builtInFeatureCatalog:`Manage spools, colors, and K-factor profiles`,builtInFeatureThirdParty:`Third-party spools can be assigned to inventory spools`,amsSyncButton:`Sync Weights from AMS`,amsSyncTitle:`Sync Spool Weights from AMS`,amsSyncMessage:`This will overwrite all inventory spool weights with the current AMS remain% values from connected printers. Use this to recover from corrupted weight data. Printers must be online.`,amsSyncing:`Syncing...`,amsSyncSuccess:`{{synced}} spool(s) synced, {{skipped}} skipped`,amsSyncError:`Failed to sync weights from AMS`,spoolmanAmsSyncButton:`Sync Spoolman Weights from AMS`,spoolmanAmsSyncTitle:`Sync Spoolman Spool Weights from AMS`,spoolmanAmsSyncMessage:`This will update all Spoolman spool weights based on the current AMS remain% values from connected printers. Printers must be online.`,spoolmanAmsSyncing:`Syncing...`,spoolmanAmsSyncSuccess:`{{synced}} spool(s) synced, {{skipped}} skipped`,spoolmanAmsSyncError:`Failed to sync Spoolman weights from AMS`,spoolmanAmsSyncErrorUnreachable:`Failed to sync Spoolman weights (Spoolman unreachable)`,spoolmanAmsSyncErrorNotConfigured:`Failed to sync Spoolman weights (Spoolman not configured)`,nativeTagsTitle:`Spoolman native tags`,nativeTagsDesc:`Spoolman 0.27 links NFC tags itself. Copy the tags Bambuddy keeps in extra.tag over, so Spoolman and other readers find the spools too. extra.tag stays as it is.`,nativeTagsCheck:`Check tags`,nativeTagsToMove:`To copy`,nativeTagsAlready:`Already in Spoolman`,nativeTagsSlotIds:`AMS slot IDs (stay in extra.tag)`,nativeTagsConflicts:`Conflicts`,nativeTagsConflictSpool:`Spool #{{spool}}: tag {{tag}} already belongs to spool #{{holder}}`,nativeTagsConflictElsewhere:`Spool #{{spool}}: tag {{tag}} already belongs to a filament or location`,nativeTagsMove:`Copy tags`,nativeTagsMoved:`Tags copied to Spoolman: {{count}}`,nativeTagsNothing:`Every tag is in Spoolman.`,nativeTagsError:`Could not copy the tags to Spoolman`,spoolmanNotConfigured:`Spoolman not configured`,spoolmanFilamentCatalogTitle:`Spoolman Filament Catalog`,spoolmanFilamentCatalogDesc:`Filament names and tare weights from your Spoolman instance. Name and spool weight are editable here; all other properties are managed directly in Spoolman.`,spoolmanUrl:`Spoolman URL`,spoolmanUrlHint:`URL of your Spoolman server (e.g., http://localhost:7912)`,spoolmanConnected:`Connected`,spoolmanDisconnected:`Disconnected`,status:`Status`,connect:`Connect`,disconnect:`Disconnect`,howSyncWorks:`How Sync Works`,syncInfoRfidOnly:`Only official Bambu Lab spools with RFID are synced`,syncInfoAutoCreate:`New spools are auto-created in Spoolman on first sync`,syncInfoThirdPartySkipped:`Non-Bambu Lab spools (third-party, refilled) are skipped`,linkingExistingSpools:`Linking Existing Spools`,linkingExistingSpoolsDesc:`To link existing Spoolman spools to your AMS, hover over an AMS slot and click "Link to Spoolman".`,syncMode:`Sync Mode`,syncModeAuto:`Automatic`,syncModeManual:`Manual Only`,syncModeAutoDesc:`AMS data syncs automatically when changes are detected`,syncModeManualDesc:`Only sync when manually triggered`,syncAmsData:`Sync AMS Data`,syncAmsDataDesc:`Manually sync printer AMS data to Spoolman`,allPrinters:`All Printers`,noDefaultPrinter:`No default (ask each time)`,sidebarOrder:`Sidebar order`,saveThumbnails:`Save thumbnails`,captureFinishPhoto:`Capture finish photo`,noPrintersConfigured:`No printers configured`,archiveMode:{always:`Always create archive entry`,never:`Never create archive entry`,ask:`Ask each time`},checkForUpdatesLabel:`Check for updates`,checkPrinterFirmware:`Check printer firmware`,includeBetaUpdates:`Include beta versions`,includeBetaUpdatesDesc:`Notify about beta and prerelease versions when checking for updates`,announcementsEnabled:`Receive announcements`,announcementsEnabledDesc:`Messages from the Bambuddy maintainers, such as security fixes and breaking changes. Bambuddy fetches a signed file from GitHub every few hours; nothing about this install is sent.`,announcementsLearnMore:`Learn more`,announcementsAllUsers:`Show to all users`,announcementsAllUsersDesc:`Off: only administrators see them. Has no effect while authentication is off.`,localLogin:{disable:`Disable local username/password login`,disableHint:`When enabled, only SSO providers can sign in. LDAP is unaffected. Set BAMBUDDY_LOCAL_LOGIN=true on the server to keep a recovery path.`},enableRetry:`Enable retry`,homeAssistantDescription:`Control smart plugs via Home Assistant`,environmentManagedLabel:`(Environment Managed)`,autoEnabledViaEnv:`Automatically enabled via environment variables`,urlFromEnvReadOnly:`Value set by HA_URL environment variable (read-only)`,tokenFromEnvReadOnly:`Value set by HA_TOKEN environment variable (read-only)`,mqttConnectedTo:`Connected to`,prometheusDescription:`Expose printer data in Prometheus format`,noSmartPlugsTitle:`No smart plugs configured`,noSmartPlugsDescription:`Add a Tasmota-based smart plug to track energy usage and automate power control.`,noProvidersTitle:`No providers configured`,noProvidersDescription:`Add a provider to receive alerts.`,noTemplatesAvailable:`No templates available. Restart the backend to seed default templates.`,apiPermissionView:`View printer status and queue`,apiPermissionEdit:`Add and remove items from print queue`,apiKeysEmptyTitle:`No API keys`,apiKeysEmptyDescription:`Create an API key to integrate with external services.`,noUsersFound:`No users found`,noGroupsFound:`No groups found`,noGroupsAvailable:`No groups available`,passwordsDoNotMatch:`Passwords do not match`,systemGroupWarning:`System group names cannot be changed`,authDisabledTitle:`Authentication is Disabled`,authDisabledFeature1:`Require login to access the system`,authDisabledFeature2:`Create multiple users with group-based permissions`,authDisabledFeature3:`Control access with 50+ granular permissions`,userHasCreated:`This user has created:`,userItemsQuestion:`What would you like to do with these items?`,deleteUserConfirm:`Are you sure you want to delete this user?`,actionCannotBeUndone:`This action cannot be undone.`,addFirstSmartPlug:`Add Your First Smart Plug`,providers:`Providers`,log:`Log`,testAll:`Test All`,testResults:`Test Results`,testPassedCount:`{{count}} passed`,testFailedCount:`{{count}} failed`,messageTemplates:`Message Templates`,messageTemplatesDescription:`Customize notification messages for each event.`,apiKeys:`API Keys`,apiKeysDescription:`Create API keys for external integrations and webhooks.`,createKey:`Create Key`,apiKeyCreated:`API Key Created Successfully`,apiKeyCopyWarning:`Copy this key now - it won't be shown again!`,useInApiBrowser:`Use in API Browser`,apiKeyQrButton:`QR code`,apiKeyQrTitle:`Scan to configure`,apiKeyQrCaption:`Scan with your mobile app to add this server and API key.`,apiKeyQrWarning:`Contains your secret API key — don't share or screenshot it where others can see.`,createNewApiKey:`Create New API Key`,keyName:`Key Name`,keyNamePlaceholder:`e.g., Home Assistant, OctoPrint`,readStatus:`Read Status`,readStatusDescription:`View printer status, queue, library, archives, and slicer pipelines`,manageQueue:`Manage Queue`,manageQueueDescription:`Add and remove items from print queue. With Manage Library, run slicer pipelines`,controlPrinter:`Control Printer`,controlPrinterDescription:`Pause, resume, and stop prints`,manageLibrary:`Manage Library`,manageLibraryDescription:`Upload, rename, delete, and slice library files; import models from MakerWorld. With Manage Queue, run slicer pipelines`,manageInventory:`Manage Inventory`,manageInventoryDescription:`Create, update, and delete spools and inventory records. Required for SpoolBuddy kiosks (NFC scan, scale readings, kiosk system commands).`,manageMaintenance:`Manage Maintenance`,manageMaintenanceDescription:`Log completed maintenance, reset counters, edit intervals, and manage the maintenance-type catalog. Suited to Home Assistant automations that record "I cleaned the nozzle" without granting broader printer control.`,manageArchives:`Manage Archives`,manageArchivesDescription:`Edit and delete print archives, including removing old prints and their contribution to statistics. Suited to automations that prune the print history.`,manageProjects:`Manage Projects`,manageProjectsDescription:`Create, update, and delete projects, and add archives to them. Suited to automations that organize prints into projects.`,libraryBadge:`Library`,inventoryBadge:`Inventory`,maintenanceBadge:`Maintenance`,archivesBadge:`Archives`,projectsBadge:`Projects`,cloudAccess:`Allow cloud access`,cloudAccessDescription:`Read Bambu Cloud presets and filaments on your behalf. Requires you to be signed into Bambu Cloud.`,cloudBadge:`Cloud`,updateEnergyCost:`Update electricity price`,updateEnergyCostDescription:`Allow this key to POST a new per-kWh electricity price to /settings/electricity-price. Useful for Home Assistant dynamic-tariff automations (Tibber, Octopus, etc.). This is the only settings field writable via API key.`,energyCostBadge:`Energy`,sendNotifications:`Send notifications`,sendNotificationsDescription:`Allow this key to send messages through the notification channels that accept messages from connected apps (POST /notifications/app-message). For apps like Bambuddy Orders. Nothing else: the key can't read or change the channels.`,sendNotificationsBadge:`Notify`,legacyKey:`Legacy`,legacyKeyTooltip:`Created before per-user ownership; recreate to use cloud access`,unnamedKey:`Unnamed Key`,lastUsed:`Last used`,read:`Read`,control:`Control`,createFirstKey:`Create Your First Key`,webhookEndpoints:`Webhook Endpoints`,webhookApiKeyHint:`Use your API key in the X-API-Key header.`,webhook:{getAllStatus:`Get all printer status`,getSpecificStatus:`Get specific printer status`,addToQueue:`Add to print queue`,pausePrint:`Pause print`,resumePrint:`Resume print`,stopPrint:`Stop print`},apiBrowser:`API Browser`,apiBrowserDescription:`Explore and test all available API endpoints.`,apiKeyForTesting:`API Key for Testing`,apiKeyPlaceholder:`Paste your API key here to test authenticated endpoints...`,apiKeyHint:`This key will be sent as X-API-Key header with requests.`,deleteApiKeyTitle:`Delete API Key`,deleteApiKeyMessage:`Are you sure you want to delete this API key? Any integrations using this key will stop working.`,deleteKey:`Delete Key`,amsDisplayThresholds:`AMS Display Thresholds`,amsThresholdsDescription:`Configure color thresholds for AMS humidity and temperature indicators.`,humidity:`Humidity`,goodGreen:`Good (green)`,fairOrange:`Fair (orange)`,aboveFairBad:`Above fair threshold shows as red (bad)`,fairAlsoDryingThreshold:`This threshold is also used to trigger auto-drying when enabled`,fairBelowDryingFloor:`Auto-drying cannot reach this value: an AMS reads {{floor}}% or more while its heater runs, so every cycle would end and restart immediately. Raise it above {{floor}}% if auto-drying is on.`,temperature:`Temperature`,goodBlue:`Good (blue)`,aboveFairHot:`Above fair threshold shows as red (hot)`,tempAlarmThreshold:`Alarm above`,tempAlarmSeparateFromBand:`Only the alarm threshold sends notifications — Good and Fair colour the display. Leave it empty to alarm at the fair threshold, as before.`,tempAlarmMustBePositive:`A threshold of 0 or less is ignored — the alarm falls back to the fair threshold.`,historyRetention:`History Retention`,keepSensorHistory:`Keep sensor history for`,historyRetentionDescription:`Older humidity and temperature data will be automatically deleted`,defaultPrintOptions:`Default Print Options`,defaultPrintOptionsDescription:`Set default values for print options when starting new prints. These can be overridden per print in the print dialog.`,defaultBedLevelling:`Bed Levelling`,defaultBedLevellingDesc:`Auto-level bed before print`,defaultFlowCali:`Flow Calibration`,defaultFlowCaliDesc:`Calibrate extrusion flow`,defaultVibrationCali:`Vibration Calibration`,defaultVibrationCaliDesc:`Reduce ringing artifacts`,defaultLayerInspect:`First Layer Inspection`,defaultLayerInspectDesc:`AI inspection of first layer`,defaultTimelapse:`Timelapse`,defaultTimelapseDesc:`Record timelapse video`,defaultConfirmOutcome:`Ask for Outcome`,defaultConfirmOutcomeDesc:`Ask whether the print came out well after it completes`,confirmOutcomeExternalPrints:`Also ask for prints started outside Bambuddy`,confirmOutcomeExternalPrintsDesc:`Prints started at the printer, in Bambu Studio or in the Handy app are archived by Bambuddy too. With this on, they get the same outcome prompt as queued prints.`,confirmDefaultGoodOnPlateClear:`Count unanswered outcomes as good on plate release`,confirmDefaultGoodOnPlateClearDescription:`When the plate is released (manually or by the next queued print) and the print's outcome prompt is still unanswered, record it as a good part automatically. The print then counts as good as soon as the plate is released; a Telegram or link answer after that only shows the recorded result.`,defaultNozzleOffsetCali:`Nozzle Offset Calibration`,defaultNozzleOffsetCaliDesc:`Calibrate nozzle offsets between extruders`,tempFanPresetsTitle:`Temperature & Fan Presets`,tempFanPresetsDescription:`Customize the quick-select values shown in printer-card temperature and fan-speed popovers. The Off button is always shown.`,tempFanPresetsNozzle:`Nozzle temperature`,tempFanPresetsBed:`Bed temperature`,tempFanPresetsChamber:`Chamber temperature`,tempFanPresetsFan:`Fan speed`,tempFanPresetsReset:`Reset to defaults`,concurrentUploadsTitle:`Concurrent Uploads`,concurrentUploadsDescription:`How many printers the queue may send files to at the same time. Printers receive files slowly (a large print can take several minutes), and each one waits its turn — so on a bigger fleet, raising this is what stops the last printer in a batch from waiting out every transfer before it. Lower it if your network or Bambuddy host struggles with parallel transfers.`,concurrentUploadsLabel:`Printers uploaded to at once`,concurrentUploadsHelp:`1 sends to one printer at a time (the old behaviour). Default is 4.`,staggeredStart:`Staggered Start`,staggeredStartDescription:`Default group size and interval when staggering multi-printer batch starts. Can be overridden per batch in the print modal.`,preheatTitle:`Preheat & Heat Soak`,preheatDescription:`Heat the bed (and chamber, if supported) and hold at temperature before each queued print starts. Helpful for engineering filaments (PA, ABS) on printers without an active chamber heater — the bed warms the chamber by radiation while the soak timer runs. The bed target is read from the print file; chamber behaviour depends on printer model.`,preheatEnabled:`Enable preheat & soak`,preheatEnabledDesc:`When off, queued prints dispatch immediately. Each queue item can override per print.`,preheatFilamentTargetsLabel:`Per-filament chamber target (°C)`,preheatFilamentTargetsHint:`Bambuddy picks the highest target across the loaded AMS slots. A print whose slots all derive 0 — PLA, PETG, TPU, PVA — skips preheat entirely and starts immediately.`,preheatFilamentTargetsReset:`Reset to defaults`,preheatFilamentTargetsDefaultRow:`Other / unmapped`,preheatMaxWait:`Max wait (seconds)`,preheatMaxWaitHelp:`Cap on the chamber warm-up phase before falling through.`,preheatSoak:`Soak (seconds)`,preheatSoakHelp:`Hold time after target reached or max-wait elapsed.`,preheatHardwareTitle:`Per-printer behaviour:`,preheatHardwareDetail:`H2C/H2D/H2D Pro/H2S/X2D/X1E actively heat the chamber via M141. X1C/P2S read chamber temp but rely on bed-radiation heating. P1S/P1P/A1/A1 Mini have no chamber sensor — only the soak timer applies.`,preheatPerItemDesc:`Heat the bed and chamber before this print starts. Defaults to the global Settings → Workflow toggle.`,preheatOverride_inherit:`Inherit`,preheatOverride_on:`On`,preheatOverride_off:`Off`,calibrationMode_off:`Off`,calibrationMode_on:`On`,calibrationMode_auto:`Auto`,preheatTargetOverride:`Chamber target override (°C, blank = filament default)`,preheatTargetOverrideHelp:`0 heats the bed and runs the soak without the chamber. Leave blank and a print with no chamber requirement skips preheat entirely.`,plateClear:`Plate-Clear Confirmation`,requirePlateClear:`Require plate-clear confirmation`,requirePlateClearDescription:`When enabled, the scheduler waits for per-printer plate-clear confirmation before starting queued prints on printers with finished jobs. Disabling this also hides the plate status badge and the "Mark plate as cleared" button on printer cards.`,keepBedWarm:`Keep bed warm between prints`,keepBedWarmDesc:`While awaiting plate-clear, hold the bed at the keep-warm temperature below so the chamber stays hot — or at the next print's own bed temperature when that is higher. Only applies when the next print needs chamber heating (ASA, ABS, PA, PC etc.). Requires plate-clear confirmation to be enabled.`,keepWarmBedTemp:`Keep-warm bed temperature (°C)`,keepWarmBedTempHelp:`Used whenever the bed's job is to heat the chamber — the keep-warm hold, and preheat when the print file carries no bed temperature. A higher bed temperature from the print file always wins.`,keepWarmMaxMinutes:`Stop keeping warm after (minutes)`,keepWarmMaxMinutesHelp:`If the plate is not cleared within this time, the heaters are switched off rather than held indefinitely.`,gcodeInjection:`G-code Injection`,gcodeInjectionDescription:`Configure custom G-code to inject at the start and/or end of prints for auto-print systems like Farmloop, SwapMod, AutoClear, and Printflow 3D. Snippets are configured per printer model and applied when "Inject G-code" is enabled on a queue item.`,gcodeInjectionNoPrinters:`No printers found. Add printers to configure G-code snippets.`,gcodeStartLabel:`Start G-code`,gcodeEndLabel:`End G-code`,gcodeStartPlaceholder:`G-code prepended before the print starts...`,gcodeEndPlaceholder:`G-code appended after the print ends...`,staggerGroupSize:`Group size`,staggerGroupSizeHelp:`Printers to start simultaneously per group`,staggerInterval:`Interval (minutes)`,staggerIntervalHelp:`Delay between each group starting`,queueDrying:`Queue Auto-Drying`,queueDryingDescription:`Automatically dry AMS filament when printer is idle between queued prints. Uses humidity threshold above to trigger drying.`,queueDryingEnabled:`Enable auto-drying`,queueDryingEnabledDescription:`Start AMS drying automatically when printer is idle and humidity is above threshold`,queueDryingBlock:`Wait for drying to complete`,queueDryingBlockDescription:`Block the print queue until drying finishes. When off, prints take priority over drying.`,ambientDryingEnabled:`Ambient drying`,ambientDryingEnabledDescription:`Automatically dry filament on idle printers when humidity exceeds threshold, even without queued prints.`,ambientDryingSustainedEnabled:`Require sustained humidity`,ambientDryingSustainedDescription:`Wait until humidity has stayed above the threshold for a set time before starting an ambient dry — rides out the spike from opening the AMS lid.`,ambientDryingSustainedMinutes:`Sustained time (minutes)`,printDryingEnabled:`Continue drying while printing`,printDryingEnabledDescription:`Allow auto-drying to keep running during a print on supported hardware (H2D, H2C, H2S, P2S, H2D Pro, X2D, X1C, A2L on recent firmware). Drying temperature is automatically capped 5°C below the idle preset to protect spools.`,dryingPresets:`Drying Presets`,dryingPresetsDescription:`Temperature and duration per filament type. AMS 2 Pro uses lower temps, AMS-HT supports higher temps.`,dryingFilament:`Filament`,humidityThresholds:`Humidity Thresholds`,humidityThresholdsDescription:`Per-filament humidity trigger for auto-drying and alarms. Mixed loads in one AMS use the lowest threshold.`,humidityThresholdCol:`Threshold`,humidityThresholdDefault:`Default (unknown types)`,printModal:`Print Modal`,expandCustomMapping:`Expand custom mapping by default`,expandCustomMappingDescription:`When printing to multiple printers, show per-printer AMS mapping expanded`,authentication:`Authentication`,authEnabledDescription:`Your instance is secured with user authentication`,authDisabledDescription:`Enable to require login and manage user access`,authDisabledMessage:`Enable authentication to create user accounts, manage permissions, and secure your Bambuddy instance.`,enableAuthentication:`Enable Authentication`,currentUser:`Current User`,changePassword:`Change Password`,admin:`Admin`,users:`Users`,addUser:`Add User`,groups:`Groups`,addGroup:`Add Group`,system:`System`,noDescription:`No description`,userCount:`{{count}} users`,permissionCount:`{{count}} permissions`,createUser:`Create User`,username:`Username`,enterUsername:`Enter username`,password:`Password`,enterPassword:`Enter password`,passwordRequirements:`At least 8 characters, with one uppercase, one lowercase, one digit, and one special character.`,confirmPassword:`Confirm Password`,confirmPasswordPlaceholder:`Confirm password`,viewReleaseOnGitHub:`View release on GitHub`,turnAllPlugsOn:`Turn all plugs on`,turnAllPlugsOff:`Turn all plugs off`,clearNotificationLogs:`Clear Notification Logs`,clearLogsMessage:`This will permanently delete all notification logs older than 30 days. This action cannot be undone.`,clearLogs:`Clear Logs`,resetUiPreferences:`Reset UI Preferences`,resetUiPreferencesMessage:`This will reset all UI preferences to defaults: sidebar order, theme, dashboard layout, view modes, and sorting preferences. Your printers, archives, and server settings will NOT be affected. The page will reload after clearing.`,resetPreferences:`Reset Preferences`,deleteGroupTitle:`Delete Group`,deleteGroupMessage:`Are you sure you want to delete this group? Users in this group will lose these permissions.`,deleteGroup:`Delete Group`,disableAuthenticationTitle:`Disable Authentication`,disableAuthenticationMessage:`Are you sure you want to disable authentication? This will make your Bambuddy instance accessible without login. All users will remain in the database but authentication will be disabled.`,disableAuthentication:`Disable Authentication`,configureBambuddy:`Configure Bambuddy`,systemDefault:`System Default`,archiveSettings:`Archive Settings`,newWindow:`New Window`,embeddedOverlay:`Embedded Overlay`,preferredSlicer:`Preferred Slicer`,preferredSlicerDescription:`Slicer used for in-app slicing via the API sidecar`,openInSlicerLabel:`Open in Slicer`,openInSlicerInherit:`Same as API slicer`,openInSlicerDescription:`Desktop slicer used by the 'Open in Slicer' button. Leave on 'Same as API slicer' to inherit, or pick a different slicer to use locally.`,orcaslicerKnownIssuesWarning:`OrcaSlicer 2.3.2 / 2.4.0-dev have known CLI bugs that block slicing many Bambu-authored 3MFs — see upstream issues #12426 (segfault on painted multi-extruder files) and #13386 (parameter-range strict-validation reject). Bambu Studio is recommended until the upstream fixes land.`,useSlicerApi:`Use Slicer API`,useSlicerApiDescription:`When on, "Slice" actions open the in-app slicer modal and call the slicer-API sidecar. When off (default), they hand off to the desktop slicer via URI scheme.`,slicerCard:`Slicer`,orcaslicerApiUrl:`OrcaSlicer sidecar URL`,bambuStudioApiUrl:`Bambu Studio sidecar URL`,slicerStallTimeout:`Slicer stall timeout (minutes)`,slicerStallTimeoutDescription:`Give up on a slice after this long with no progress from the sidecar. Heavy models that keep reporting progress are never cut off, however long they take. Sidecars that do not report progress use this as a total time limit instead.`,slicerApiUrlDescription:`URL of the slicer-API sidecar container. Leave blank to use the SLICER_API_URL / BAMBU_STUDIO_API_URL env var defaults.`,externalCameras:`External Cameras`,costTracking:`Cost Tracking`,billingEnabled:`Enable Billing`,billingEnabledDescription:`Charge users for prints and enable finance features`,printerKillSwitch:`Unauthorized print kill switch`,printerKillSwitchDescription:`Immediately stop prints that start without authorization.`,financeBudgetReset:`Finance Monthly Budget Reset`,financeBudgetResetDay:`Reset Day`,financeBudgetResetDayHelp:`For short months, reset uses the last day of the month.`,financeBudgetResetTimezone:`Reset timezone`,financeBudgetResetTimezoneHelp:`Budget window start is calculated in this timezone.")`,rebuildLedger:`Rebuild wallet ledger`,rebuildLedgerStarted:`Ledger rebuild started`,rebuildLedgerConfirmTitle:`Rebuild wallet ledger?`,rebuildLedgerConfirmMessage:`This will rebuild the wallet ledger to repair historical balance values. Run this only if you know what you are doing.`,rebuildLedgerInProgress:`Starting rebuild...`,printsOnly:`Prints Only`,totalConsumption:`Total Consumption`,dataManagement:`Data Management`,storageUsage:`Storage Usage`,storageUsageDescription:`Breakdown of data usage by category`,storageUsageTotal:`Total`,storageUsageErrors:`Errors`,storageUsageOtherBreakdown:`Other (includes static assets, scripts, and configuration files)`,storageUsageSystem:`System`,storageUsageData:`Data`,storageUsageUnavailable:`Storage usage information unavailable`,clearNotificationLogsDescription:`Delete notification logs older than 30 days`,resetUiPreferencesDescription:`Reset sidebar order, theme, view modes, and layout preferences. Printers, archives, and settings are not affected.`,enableHomeAssistant:`Enable Home Assistant`,enableMqtt:`Enable MQTT`,useTls:`Use TLS`,enableMetricsEndpoint:`Enable Metrics Endpoint`,availableMetrics:`Available Metrics`,editUser:`Edit User`,deleteUserTitle:`Delete User`,groupName:`Group Name`,leaveEmptyForAnonymous:`Leave empty for anonymous`,leaveEmptyForNoAuth:`Leave empty for no authentication`,enterNewPassword:`Enter new password`,confirmNewPassword:`Confirm new password`,enterGroupName:`Enter group name`,enterDescriptionOptional:`Enter description (optional)`,enterCurrentPassword:`Enter current password`,enterNewPasswordMin6:`Enter new password (min 6 characters)`,toast:{keyCopied:`Key copied to clipboard`,copyFailed:`Failed to copy key`,keyAddedToBrowser:`Key added to API Browser`,clearLogsFailed:`Failed to clear logs`,uiPreferencesReset:`UI preferences reset. Refreshing...`,authDisabled:`Authentication disabled successfully`,authDisableFailed:`Failed to disable authentication`,apiKeyCreated:`API key created`,apiKeyDeleted:`API key deleted`,userCreated:`User created successfully`,userUpdated:`User updated successfully`,userDeleted:`User deleted successfully`,groupCreated:`Group created successfully`,groupUpdated:`Group updated successfully`,groupDeleted:`Group deleted successfully`,fillRequiredFields:`Please fill in all required fields`,passwordsDoNotMatch:`Passwords do not match`,passwordTooShort:`Password must be at least 8 characters`,passwordNeedsUppercase:`Password must contain at least one uppercase letter`,passwordNeedsLowercase:`Password must contain at least one lowercase letter`,passwordNeedsDigit:`Password must contain at least one digit`,passwordNeedsSpecial:`Password must contain at least one special character`,enterGroupName:`Please enter a group name`,settingsSaved:`Settings saved`,noPermissionUpdate:`You do not have permission to change settings`,cameraSettingsSaved:`Camera settings saved`,enterCameraUrl:`Please enter a camera URL`,passwordChanged:`Password changed successfully`,connectionFailed:`Connection failed`,testFailed:`Test failed`,cameraConnected:`Camera connected{{resolution}}`,cameraConnectedCoalesced:`Camera connected{{resolution}} (shared with a capture already running)`},testConnection:`Test Connection`,catalog:{spoolCatalog:`Spool Catalog`,spoolCatalogDescription:`Empty spool weights by brand/type. Used for automatic weight lookup when adding spools.`,searchCatalog:`Search catalog...`,addNewEntry:`Add New Entry`,namePlaceholder:`Name (e.g., Bambu Lab - Plastic)`,weight:`Weight`,type:`Type`,default:`Default`,custom:`Custom`,noMatch:`No entries match your search`,empty:`No entries in catalog`,deleteEntry:`Delete Entry`,deleteConfirm:`Are you sure you want to delete "{{name}}"?`,resetCatalog:`Reset Catalog`,resetConfirm:`Reset catalog to defaults? This will remove all custom entries.`,loadFailed:`Failed to load spool catalog`,nameWeightRequired:`Name and weight are required`,entryAdded:`Entry added`,addFailed:`Failed to add entry`,entryUpdated:`Entry updated`,updateFailed:`Failed to update entry`,entryDeleted:`Entry deleted`,deleteFailed:`Failed to delete entry`,resetSuccess:`Catalog reset to defaults`,resetFailed:`Failed to reset catalog`,exported:`Exported {{count}} entries`,imported:`Imported {{added}} entries ({{skipped}} skipped)`,importFailed:`Failed to import: invalid JSON format`,exportTooltip:`Export catalog to JSON`,importTooltip:`Import catalog from JSON`,resetTooltip:`Reset to defaults`,selectedCount:`{{count}} selected`,deleteSelected:`Delete Selected`,bulkDeleteConfirm:`Are you sure you want to delete {{count}} entries?`,bulkDeleted:`Deleted {{count}} entries`,bulkDeleteFailed:`Failed to delete entries`,material:`Material`,spoolWeight:`Spool Weight`,color:`Color`,updateSpoolWeight:`Update Spool Weight`,filamentUpdated:`Filament updated`,filamentUpdateFailed:`Failed to update filament`,filamentUpdateInvalid:`Invalid filament data`,keepExistingSpoolWeight:`Keep old weight for existing spools`,keepExistingSpoolWeightDesc:`Spools already created with this filament type retain the old tare weight. New spools use the updated value.`,applyToAllSpools:`Apply to all spools`,applyToAllSpoolsDesc:`All weight calculations for this filament type immediately use the new tare weight.`},colorCatalog:{title:`Color Catalog`,description:`Filament colors by manufacturer/material. Used for automatic color lookup when adding spools.`,searchColors:`Search colors...`,allManufacturers:`All manufacturers`,addNewColor:`Add New Color`,manufacturer:`Manufacturer`,colorName:`Color Name`,hex:`Hex`,materialOptional:`Material (optional)`,showing:`Showing {{filtered}} of {{total}} colors`,noMatch:`No colors match your search`,empty:`No colors in catalog`,deleteColor:`Delete Color`,deleteConfirm:`Are you sure you want to delete "{{name}}"?`,resetCatalog:`Reset Color Catalog`,resetConfirm:`Reset catalog to defaults? This will remove all custom colors.`,sync:`Sync`,starting:`Starting...`,syncTooltip:`Sync from FilamentColors.xyz (2000+ colors, may take a minute)`,loadFailed:`Failed to load color catalog`,fieldsRequired:`Manufacturer, color name, and hex color are required`,colorAdded:`Color added`,addFailed:`Failed to add color`,colorUpdated:`Color updated`,updateFailed:`Failed to update color`,colorDeleted:`Color deleted`,deleteFailed:`Failed to delete color`,resetSuccess:`Color catalog reset to defaults`,resetFailed:`Failed to reset catalog`,syncUpToDate:`Already up to date ({{count}} colors checked)`,syncComplete:`Added {{added}} new colors ({{skipped}} already existed)`,syncError:`Sync error`,syncFailed:`Failed to sync from FilamentColors.xyz`,exported:`Exported {{count}} colors`,imported:`Imported {{added}} colors ({{skipped}} skipped)`,importFailed:`Failed to import: invalid JSON format`,selectedCount:`{{count}} selected`,deleteSelected:`Delete Selected`,bulkDeleteConfirm:`Are you sure you want to delete {{count}} colors?`,bulkDeleted:`Deleted {{count}} colors`,bulkDeleteFailed:`Failed to delete colors`},dateFormat:`Date Format`,dateFormatUs:`US (MM/DD/YYYY)`,dateFormatEu:`EU (DD/MM/YYYY)`,dateFormatIso:`ISO (YYYY-MM-DD)`,timeFormat:`Time Format`,timeFormat12:`12-hour (3:30 PM)`,timeFormat24:`24-hour (15:30)`,defaultPrinter:`Default Printer`,defaultPrinterDescription:`Pre-select this printer for uploads, reprints, and other operations.`,slicerBambuStudio:`Bambu Studio`,slicerOrcaSlicer:`OrcaSlicer`,sidebarOrderDescription:`Use Sidebar to reorder items, reset visibility, and manage custom links.`,setDefault:`Set Default`,sidebarOrderSetDefaultHint:`Set default applies the current menu order to users who haven't customized theirs.`,sidebarDefaultSet:`Default menu order has been set.`,sidebarDefaultCleared:`Default menu order cleared.`,sidebarDefaultFailed:`Failed to set default menu order.`,reset:`Reset`,darkMode:`Dark Mode`,lightMode:`Light Mode`,active:`(active)`,background:`Background`,accent:`Accent`,style:`Style`,bgNeutral:`Neutral`,bgWarm:`Warm`,bgCool:`Cool`,bgOled:`OLED Black`,bgSlate:`Slate Blue`,bgForest:`Forest Green`,accentGreen:`Green`,accentTeal:`Teal`,accentBlue:`Blue`,accentOrange:`Orange`,accentPurple:`Purple`,accentRed:`Red`,styleClassic:`Classic`,styleGlow:`Glow`,styleVibrant:`Vibrant`,themeToggleHint:`Toggle between dark, light, and system mode using the icon in the sidebar.`,progressInTitle:`Print progress in tab`,progressInTitleDescription:`Show the active print's percentage and a progress ring in the browser tab.`,autoArchivePrints:`Auto-archive prints`,autoArchiveDescription:`Automatically save 3MF files when prints complete`,saveThumbnailsDescription:`Extract and save preview images from 3MF files`,captureFinishPhotoDescription:`Take a photo from printer camera when print completes. Bambuddy records a brief timelapse during the print so the photo can be sourced from the moment before the bed drops; the timelapse file is kept if you enabled timelapse for this print, otherwise it is deleted automatically after the photo is captured.`,finishPhotoRestorePlate:`Restore plate for finish photo`,finishPhotoRestorePlateDescription:`The printer drops the build plate about 100 mm when a print ends, leaving the finished print below the camera's framing. Bambuddy raises it back to just above the last printed layer, takes the photo, then lowers it again. Skipped when the print height is unknown or another job is queued.`,ffmpegNotInstalled:`ffmpeg not installed`,ffmpegRequired:`Camera capture requires ffmpeg. Install it via brew install ffmpeg (macOS) or apt install ffmpeg (Linux).`,camera:`Camera`,cameraViewMode:`Camera View Mode`,cameraOverlayDescription:`Camera opens in a resizable overlay on the main screen`,cameraWindowDescription:`Camera opens in a separate browser window`,externalCamerasDescription:`Configure external cameras to replace the built-in printer camera. Supports MJPEG streams, RTSP, HTTP snapshots, and USB cameras (V4L2). When enabled, the external camera is used for live view and finish photos.`,cameraPlaceholderUsb:`Device path (/dev/video0)`,cameraPlaceholderUrl:`Camera URL (rtsp://... or http://...)`,cameraTypeMjpeg:`MJPEG Stream`,cameraTypeRtsp:`RTSP Stream`,cameraTypeSnapshot:`HTTP Snapshot`,cameraTypeUsb:`USB Camera (V4L2)`,cameraSnapshotUrl:`Snapshot URL (optional)`,cameraSnapshotUrlPlaceholder:`http://192.168.1.61:1984/api/frame.jpeg?src=printer`,cameraSnapshotUrlHelp:`Single-frame URL used for notification thumbnails, finish photos, layer-timelapse frames, and plate detection. Timelapse and plate detection each require their own per-printer toggle — this URL is just the image source they pull from when active. Leave blank to capture from the live stream above. Useful for go2rtc (/api/frame.jpeg) and IP cameras with a dedicated snapshot endpoint.`,cameraRotation:`Rotation`,cameraLight:`Turn on chamber light for camera`,cameraLightHint:`Turns the light on while someone watches the camera and for automatic snapshots such as notification photos, finish photos and Home Assistant pictures. Turns it off again afterwards, but only if Bambuddy turned it on.`,cameraLightDelay:`Wait before snapshot`,cameraLightDelayHint:`Only when the light was off. Gives the light, and any light synced to it, time to come on.`,cameraLightMode_off:`Off`,cameraLightMode_all:`All printers`,cameraLightMode_selected:`Selected printers`,cameraLightDelayUnit:`seconds`,cameraLightNoneSelected:`No printer picked yet.`,cameraLightAddPrinter:`Add printer`,cameraLightRemovePrinter:`Remove {{name}}`,externalCameraAdd:`Add external camera`,externalCameraRemove:`Remove the external camera from {{name}}`,printerPickerSearch:`Search printers`,printerPickerNoMatch:`No printer matches.`,cameraShowSettings:`Camera settings`,test:`Test`,connected:`Connected`,disconnected:`Disconnected`,currency:`Currency`,defaultFilamentCost:`Default filament cost (per kg)`,electricityCost:`Electricity cost per kWh`,energyPriceSource:`Electricity price source`,energyPriceSourceFixed:`Fixed price`,energyPriceSourceHomeAssistant:`Home Assistant sensor`,energyPriceHaEntity:`Price sensor`,energyPriceLastRead:`Last price read per kWh`,energyPriceFixedHint:`A new price applies to the energy used from then on; energy already used keeps the price it was used at.`,energyPriceHaHint:`Read every hour and at the start and end of each print, and each hour of energy is costed at its own price. The sensor must give the price per kWh (per MWh and per Wh are converted).`,energyPriceHaNotConfigured:`Home Assistant is not set up. Connect it under Settings → Network → Home Assistant.`,energyDisplayMode:`Energy display mode`,energyModePrintDescription:`Dashboard shows sum of energy used during prints`,energyModeTotalDescription:`Dashboard shows lifetime energy from smart plugs`,fileManager:`File Manager`,createArchiveEntry:`Create Archive Entry When Printing`,createArchiveEntryDescription:`When printing from File Manager, optionally create an archive entry`,lowDiskSpaceWarning:`Low Disk Space Warning`,lowDiskSpaceDescription:`Show warning when free disk space falls below this threshold`,printerFirmware:`Printer Firmware`,checkFirmwareDescription:`Check for printer firmware updates from Bambu Lab`,bambuddySoftware:`Bambuddy Software`,autoCheckDescription:`Automatically check for new versions on startup`,checkNow:`Check now`,updateAvailableVersion:`Update available: v{{version}}`,releaseNotes:`Release Notes`,updateViaDocker:`Update via Docker Compose:`,composeDirectory:`Compose directory`,composeDirectoryHint:`Directory containing your docker-compose.yml. Leave blank to omit the cd.`,copyUpdateCommand:`Copy update command`,updateViaHomeAssistant:`Updates are managed by the Home Assistant Supervisor. Open Settings → Add-ons → Bambuddy in Home Assistant to install the new version.`,updateViaWindowsInstaller:`Windows installations are updated by re-running the installer. Download the new version below — your data, settings and printers are preserved.`,downloadWindowsInstaller:`Download installer for v{{version}}`,installUpdate:`Install Update`,latestVersionRunning:`You're running the latest version`,failedToCheckUpdates:`Failed to check for updates: {{error}}`,backupRestore:`Backup & Restore`,backupRestoreDescription:`Export/import settings and configure GitHub backup`,goToBackup:`Go to Backup`,externalUrl:`External URL`,externalUrlDescription:`The external URL where Bambuddy is accessible. Used for notification images and external integrations.`,bambuddyUrl:`Bambuddy URL`,externalUrlHint:`Include protocol and port (e.g., http://192.168.1.100:8000)`,ftpRetry:`FTP Retry`,ftpRetryDescription:`Retry FTP operations when printer WiFi is unreliable. Applies to 3MF downloads, print uploads, timelapse downloads, and firmware updates.`,autoRetryDescription:`Automatically retry failed FTP operations`,retryAttempts:`Retry attempts`,retryDelay:`Retry delay`,connectionTimeout:`Connection timeout`,time_one:`{{count}} time`,time_other:`{{count}} times`,second_one:`{{count}} second`,second_other:`{{count}} seconds`,nSeconds:`{{count}} seconds`,increaseForWeakWifi:`Increase for printers with weak WiFi`,homeAssistant:`Home Assistant`,homeAssistantFullDescription:`Connect to Home Assistant to control smart plugs via HA's REST API. Supports switch, light, input_boolean, and script entities.`,homeAssistantUrl:`Home Assistant URL`,longLivedAccessToken:`Long-Lived Access Token`,haTokenHint:`Create a token in HA: Profile → Long-Lived Access Tokens → Create Token`,connectionSuccessful:`Connection Successful`,connectionFailed:`Connection Failed`,haConnectionSuccess:`Successfully connected to Home Assistant.`,haConnectionFailed:`Failed to connect to Home Assistant.`,mqttPublishing:`MQTT Publishing`,mqttDescription:`Publish BamBuddy events to an external MQTT broker for integration with Node-RED, Home Assistant, and other automation systems.`,mqttEnableDescription:`Publish events to external MQTT broker`,brokerHostname:`Broker hostname`,port:`Port`,usernameOptional:`Username (optional)`,passwordOptional:`Password (optional)`,topicPrefix:`Topic prefix`,topicPrefixHint:`Topics will be: {{prefix}}/printers//status, etc.`,prometheusMetrics:`Prometheus Metrics`,prometheusEndpointDescription:`Expose printer metrics at /api/v1/metrics for Prometheus/Grafana monitoring.`,bearerTokenOptional:`Bearer Token (optional)`,bearerTokenHint:`If set, requests must include Authorization: Bearer `,metricsConnectionStatus:`Connection status`,metricsPrinterState:`Printer state (idle/printing/etc)`,metricsPrintProgress:`Print progress 0-100%`,metricsBedTemp:`Bed temperature`,metricsNozzleTemp:`Nozzle temperature`,metricsPrintsTotal:`Total prints by result`,metricsMore:`...and more (layers, fans, queue, filament usage)`,smartPlugsDescription:`Connect smart plugs (Tasmota or Home Assistant) to automate power control and track energy usage for your printers.`,allOn:`All On`,allOff:`All Off`,addSmartPlug:`Add Smart Plug`,energySummary:`Energy Summary`,currentPower:`Current Power`,plugsOnline:`{{reachable}}/{{total}} plugs online`,today:`Today`,yesterday:`Yesterday`,total:`Total`,enablePlugsForSummary:`Enable plugs to see energy summary`,addNotificationProvider:`Add`,systemBadge:`(System)`,creating:`Creating...`,changing:`Changing...`,deleteUserAndItems:`Delete user AND their items`,deleteUserKeepItems:`Delete user, keep items (become ownerless)`,ok:`OK`,twoFa:{totpTitle:`Authenticator App (TOTP)`,totpDesc:`Use an authenticator app like Google Authenticator, Aegis or Authy.`,emailOtpTitle:`Email OTP`,emailOtpDesc:`Send a one-time code to {{email}} when you log in.`,emailOtpNoEmail:`Add an email address to your account to enable this method.`,addEmailFirst:`Your account has no email address. Ask an admin to add one before enabling Email OTP.`,setupTotp:`Set up Authenticator App`,setupAuthApp:`Set up Authenticator App`,setupInstructions:`Scan the QR code below with your authenticator app, then confirm with a code.`,manualEntry:`Can't scan? Enter this secret manually:`,scannedContinue:`I've scanned the code — continue`,enterCodeToConfirm:`Enter the 6-digit code from your authenticator app to confirm setup.`,activate:`Activate`,disableTotp:`Disable Authenticator`,disableConfirmHint:`Enter a valid TOTP code or a backup code to disable the authenticator.`,totpDisabled:`Authenticator app disabled.`,emailOtpEnabled:`Email OTP enabled.`,emailOtpDisabled:`Email OTP disabled.`,smtpRequired:`Please configure and test SMTP settings first.`,invalidCode:`Invalid code. Please try again.`,enableEmailOtp:`Enable Email OTP`,disableEmailOtp:`Disable Email OTP`,emailSetupEnterCode:`A verification code has been sent to your email address. Enter it below to confirm you own this inbox.`,verifyAndEnable:`Verify & Enable`,emailDisablePasswordHint:`Enter your account password to confirm disabling email OTP.`,passwordPlaceholder:`Enter your password`,backupCodesTitle:`Save your backup codes`,backupCodesWarning:`Save these codes somewhere safe. Each code can only be used once and they will not be shown again.`,backupCodesRemaining:`{{count}} backup codes remaining`,savedCodes:`I've saved my codes`,regenBackup:`Regenerate Backup Codes`,regenBackupHint:`Enter your current TOTP code to generate 10 new backup codes. All existing backup codes will be invalidated.`,newBackupCodes:`New backup codes`,linkedAccounts:`Linked SSO Accounts`,linkedAccountsDesc:`These external identity providers are linked to your account.`,oidcUnlinked:`Account unlinked.`},sessionPolicy:{title:`Session Policy`,description:`Maximum session lifetime for new user logins. Already-issued tokens keep their original expiry.`,preset24h:`24 hours`,preset7d:`7 days`,preset30d:`30 days`,customHoursLabel:`Custom session lifetime in hours`,hoursSuffix:`hours`,warning:`Longer sessions reduce automatic logout protection. Recommended only for trusted single-user deployments.`},oidc:{title:`SSO / OIDC Providers`,desc:`Configure OpenID Connect providers to allow single sign-on via external identity providers.`,addProvider:`Add Provider`,newProvider:`New Provider`,empty:`No OIDC providers configured yet.`,created:`Provider created.`,updated:`Provider updated.`,deleted:`Provider deleted.`,refreshIcon:`Refresh icon`,removeIcon:`Remove icon`,iconRefreshed:`Icon refreshed.`,iconRemoved:`Icon removed.`,iconFetchFailed:`Icon could not be fetched from the provider URL.`,deleteTitle:`Delete Provider`,deleteMessage:`Delete "{{name}}"? All linked user accounts will be disconnected.`,form:{name:`Display Name`,issuerUrl:`Issuer URL`,clientId:`Client ID`,clientSecret:`Client Secret`,scopes:`Scopes`,iconUrl:`Icon URL (optional)`,enabled:`Enabled`,autoCreate:`Auto-create users`,autoCreateDesc:`Automatically create a local account on first login.`,autoLink:`Auto-link existing accounts`,autoLinkDesc:`Link existing local accounts by matching email on first login.`,secretHint:`leave blank to keep current`,secretPlaceholder:`new secret`,emailClaim:`Email Claim`,emailClaimDesc:`JWT claim used as email identity. Use 'preferred_username' or 'upn' for Azure Entra ID (which does not send email_verified). Only use trusted claim names.`,emailClaimPlaceholder:`email`,emailClaimCustomClaimAutoLinkWarning:`Custom claims are safe for auto-link only when the value is tenant-administered (e.g. Azure Entra ID upn / preferred_username). Do not enable auto-link if your IdP allows users to self-assert this claim.`,requireEmailVerified:`Require email verified`,requireEmailVerifiedDesc:`Only accept the email claim when the provider marks it as verified.`,requireEmailVerifiedWarning:`Warning: email will be accepted even without verification. Use only with trusted providers.`,requireEmailVerifiedAutoLink:`Disable auto-link first to change this setting.`,defaultGroup:`Default Group`,defaultGroupDesc:`Group assigned to auto-created users. Falls back to Viewers if not set.`,defaultGroupViewersFallback:`Viewers (default)`,autologin:`Autologin`,autologinDesc:`Redirect unauthenticated visitors straight to this provider. Only one provider can carry this flag.`,groupClaim:`Group Claim`,groupClaimDesc:`JWT claim that holds the user's groups at the identity provider. Most providers use 'groups'; values can be a JSON array or a string.`,groupMapping:`Group Mapping`,groupMappingDesc:`Mapped groups are synced on every login. Groups not named here are left untouched, so manual assignments survive. Leave empty to disable group sync.`,groupMappingIdpGroupPlaceholder:`Identity provider group name`,groupMappingSelectGroup:`Select Bambuddy group…`,groupMappingAddRow:`Add Mapping`,groupMappingDeletedGroupOption:`{{group}} (deleted)`,groupMappingDeletedGroupWarning:`This Bambuddy group has been deleted. Pick a replacement or remove this mapping.`,groupMappingIncompleteRow:`Enter the identity provider group and pick a Bambuddy group, or remove this mapping.`,groupMappingDuplicateRow:`This identity provider group is already mapped above. Group names are compared ignoring case.`,groupSync:`Group Sync`,groupSyncOn:`On`}},encryption:{title:`MFA Encryption Status`,enabledFromEnv:`At-rest encryption enabled (key from MFA_ENCRYPTION_KEY environment variable)`,enabledFromFile:`At-rest encryption enabled (key loaded from data directory)`,enabledGenerated:`At-rest encryption enabled with auto-generated key`,notConfigured:`At-rest encryption not configured`,notConfiguredDesc:`TOTP secrets and OIDC client_secrets are stored in plaintext. Set MFA_ENCRYPTION_KEY or restart Bambuddy with a writable data directory to auto-generate one.`,allEncrypted:`All MFA secrets are encrypted at rest.`,legacyRowsLabel:`Legacy plaintext rows`,encryptedRowsLabel:`Encrypted rows`,legacyRowsWarning:`{{count}} legacy plaintext row(s) detected. Re-save the OIDC provider or re-enroll the user’s authenticator app to migrate to encrypted storage.`,backupHint:`The auto-generated key is stored at DATA_DIR/.mfa_encryption_key and is included in local backup ZIPs. Keep your backups secure or set MFA_ENCRYPTION_KEY explicitly.`,decryptionBrokenTitle:`Encryption key missing`,decryptionBrokenError:`{{count}} encrypted record(s) cannot be decrypted because the encryption key is no longer available. Restore the previous MFA_ENCRYPTION_KEY or DATA_DIR/.mfa_encryption_key to recover.`,migrationErrorWarning:`{{count}} legacy row(s) failed to re-encrypt at startup. Check server logs and restart Bambuddy to retry.`},pipelineLimits:{title:`Slicer Pipeline limits`,maxCopiesLabel:`Max copies per run`,maxCopiesDesc:`Upper bound on the copies operators can request when running a pipeline. Server-side hard cap is 1000.`},pipelines:{title:`Slicer Pipelines`,subtitle:`Reusable preset bundles (printer + process + filaments + bed type). Save one from the Slice dialog and apply it with a single click on the next file.`,loading:`Loading pipelines…`,loadError:`Could not load pipelines.`,confirmDelete:`Delete this pipeline? This cannot be undone.`,staleWarning:`One or more referenced presets no longer exist. Re-save this pipeline from the Slice dialog to fix.`,empty:{title:`No pipelines yet.`,howto:`Open the Slice dialog for any file, pick your printer / process / filaments / bed type, then click "Save as pipeline". Your saved pipelines will appear here.`},field:{name:`Pipeline name`,description:`Description`,targetPrinter:`Target printer`,noTarget:`— No target —`,targetKind:`Target type`,targetKindSpecific:`Specific printer`,targetKindClass:`Printer class`,targetModelClass:`Printer model`,fanoutStrategy:`Fanout strategy`,fanout:{max_parallel:`Max parallel — distribute across any idle matching printer`,round_robin:`Round robin — cycle through eligible printers`,fill_one_first:`Fill one first — pin all copies to one printer`},fanoutShort:{max_parallel:`parallel`,round_robin:`round robin`,fill_one_first:`fill one first`}},action:{save:`Save`,cancel:`Cancel`,rename:`Rename`,delete:`Delete`},slot:{printer:`Printer`,process:`Process`,filament:`Filament`,filamentN:`Filament {{n}}`,filamentAll:`All {{n}} slots`,bed:`Bed`},group:{profiles:`Profiles`,filaments:`Filaments`},searchPlaceholder:`Search pipelines…`,filterTargetType:`Filter by target type`,filterTarget:`Filter by target`,filter:{all:`All targets`,noTarget:`No target set`,count:`{{shown}} / {{total}}`,noMatches:`No pipelines match the current filters.`},toast:{saved:`Pipeline saved`,saveFailed:`Save failed`,deleted:`Pipeline deleted`,deleteFailed:`Delete failed`},noTargetHint:`Set a target printer to run this`,noTargetWarning:`Set a target printer before running this pipeline.`,runs:{lastRun:`Last run`,status:{queued:`queued`,slicing:`slicing`,dispatching:`dispatching`,in_progress:`printing`,completed:`completed`,failed:`failed`,partial_failure:`partial failure`,cancelled:`cancelled`}}}},notification:{printStarted:{title:`Print Started`,body:`{{printer}}: {{filename}} has started printing`},printCompleted:{title:`Print Completed`,body:`{{printer}}: {{filename}} completed successfully`},printFailed:{title:`Print Failed`,body:`{{printer}}: {{filename}} has failed`},printStopped:{title:`Print Stopped`,body:`{{printer}}: {{filename}} was stopped`},printProgress:{title:`Print Progress`,body:`{{printer}}: {{filename}} is {{percent}}% complete`},printerOffline:{title:`Printer Offline`,body:`{{printer}} is offline`},printerError:{title:`Printer Error`,body:`{{printer}}: {{error}}`},filamentLow:{title:`Low Filament`,body:`{{printer}}: Filament is running low`},maintenanceDue:{title:`Maintenance Due`,body:`{{printer}}: {{items}} need attention`}},errors:{generic:`Something went wrong`,networkError:`Network error. Please check your connection.`,notFound:`Not found`,unauthorized:`Unauthorized`,serverError:`Server error`,validationError:`Please check your input`,printerConnectionFailed:`Failed to connect to printer`,saveFailed:`Failed to save changes`,deleteFailed:`Failed to delete`,loadFailed:`Failed to load data`},hmsErrors:{title:`Errors - {{name}}`,noErrors:`No errors`,viewOnWiki:`View on Bambu Lab Wiki`,mqttVerifyFailedRemedy:`Enable Developer Mode on the printer, restart the printer, then start the job again.`,mqttVerifyFailedDescription:`The printer rejected a command because it could not verify it. Prints, temperature changes and filament loads sent from Bambuddy will be ignored until this is fixed.`,severityError:`Error`,severityWarning:`Warning`,severityNotice:`Notice`,severityUnknown:`Unknown level`,uncountedSummary:`Also reported, not counted ({{n}})`,uncountedHint:`Notices that don't need you, and codes Bambu publishes no text for. They don't count as problems on the printer card and don't send notifications.`,unknownCode:`Unknown HMS code — see the Bambu Lab wiki for details.`,clearInstructions:`Clear errors on the printer to dismiss them here.`,clearErrors:`Clear Errors`,clearSuccess:`HMS errors cleared`,clearFailed:`Failed to clear HMS errors`,actionSuccess:`Action sent to printer`,actionFailed:`Failed to send action`,runoutExpectedSlot:`Filament ran out in {{ranOut}}. The printer is now waiting for compatible filament in {{expected}}. Insert a spool into {{expected}}, then select Retry.`,runoutExpectedSlotOnly:`The printer is waiting for compatible filament in {{expected}}. Insert a spool there, then select Retry.`,runoutSlotUnknown:`Filament ran out and the print is paused. Bambuddy could not determine which slot the printer now expects — check the printer screen for the requested slot.`,actions:{RESUME_PRINTING:`Resume Printing`,RESUME_PRINTING_DEFECTS:`Resume (defects acceptable)`,RESUME_PRINTING_PROBELM_SOLVED:`Resume (problem solved)`,STOP_PRINTING:`Stop Printing`,CHECK_ASSISTANT:`Check Assistant`,FILAMENT_EXTRUDED:`Filament Extruded, Continue`,RETRY_FILAMENT_EXTRUDED:`Not Extruded Yet, Retry`,CONTINUE:`Finished, Continue`,LOAD_VIRTUAL_TRAY:`Load Filament`,OK_BUTTON:`OK`,FILAMENT_LOAD_RESUME:`Filament Loaded, Resume`,JUMP_TO_LIVEVIEW:`View Liveview`,NO_REMINDER_NEXT_TIME:`No Reminder Next Time`,REFRESH_NOZZLE:`Recheck`,IGNORE_NO_REMINDER_NEXT_TIME:`Ignore. Don't Remind Next Time`,IGNORE_RESUME:`Ignore this and Resume`,PROBLEM_SOLVED_RESUME:`Problem Solved and Resume`,TURN_OFF_FIRE_ALARM:`Got it, Turn off the Fire Alarm.`,RETRY_PROBLEM_SOLVED:`Retry (problem solved)`,CANCLE:`Cancle`,STOP_DRYING:`Stop Drying`,PROCEED:`Proceed`,OK_JUMP_RACK:`OK`,ABORT:`Abort`,DISABLE_PURIFICATION:`Disable Purification for This Print`,DONT_REMIND_NEXT_TIME:`Don't Remind Me`,DBL_CHECK_CANCEL:`Cancel`,DBL_CHECK_DONE:`Done`,DBL_CHECK_RETRY:`Retry`,DBL_CHECK_RESUME:`Resume`,DBL_CHECK_OK:`Confirm`,REMOVE_CLOSE_BTN:`Close`}},mqttDebug:{title:`MQTT Debug Log`,searchPlaceholder:`Search topic or payload...`,noMessages:`No messages logged yet`,startLoggingHint:`Click "Start Logging" to begin capturing MQTT messages`,noMessagesMatch:`No messages match your filter`,adjustFilterHint:`Try adjusting your search or filter criteria`,incoming:`Incoming`,outgoing:`Outgoing`,loggingStopped:`Logging stopped`,loggingActive:`Logging active - messages will auto-refresh`,startLogging:`Start Logging`,stopLogging:`Stop Logging`,clearLog:`Clear Log`,topic:`Topic`,timestamp:`Timestamp`,direction:`Direction`,all:`All`},printerFiles:{zipStarted_one:`Started ZIP download for {{count}} file`,zipStarted_other:`Started ZIP download for {{count}} files`,zipPartial:`ZIP download started with {{successful}} of {{total}} files; the rest could not be retrieved`,downloadFailed:`Download failed: {{error}}`,unknownError:`Unknown error`,shiftSelectHint:`Shift-click to select a range`,selectFile:`Select {{name}}`,deselectFile:`Deselect {{name}}`,title:`File Manager`,storageUsed:`Used:`,storageFree:`Free:`,filterPlaceholder:`Filter files...`,deleteButton:`Delete`,deleteFiles:`Delete {{count}} Files`,deleteFileConfirm:`Delete "{{name}}"? This cannot be undone.`,deleteFilesConfirm:`Delete {{count}} selected files? This cannot be undone.`,noFiles:`No files on printer`,printerUnavailable:`The printer file service is unavailable. Try again when the printer is reachable.`,loadingFiles:`Loading files...`,failedToLoad:`Failed to load files`,toast:{filesDeleted:`Deleted {{count}} file(s)`,deleteFailed:`Delete failed: {{error}}`}},confirm:{delete:`Are you sure you want to delete this?`,unsavedChanges:`You have unsaved changes. Are you sure you want to leave?`,clearQueue:`Are you sure you want to clear the queue?`},login:{title:`Bambuddy Login`,subtitle:`Sign in to your account`,username:`Username`,usernamePlaceholder:`Enter your username`,usernameOrEmail:`Username or Email`,usernameOrEmailPlaceholder:`Username or @ Email`,password:`Password`,passwordPlaceholder:`Enter your password`,signIn:`Sign in`,signingIn:`Logging in...`,rememberMe:`Remember Me`,forgotPassword:`Forgot your password?`,autologinFailed:`Automatic SSO sign-in failed. Pick a provider below to continue.`,localDisabledNotice:`Local sign-in is disabled. Use one of the SSO providers below.`,loginSuccess:`Logged in successfully`,loginFailed:`Login failed`,enterCredentials:`Please enter username and password`,enterEmail:`Please enter your email address`,oidcLoginFailed:`OIDC login failed`,oidcErrors:{providerError:`The identity provider returned an error`,missingParameters:`OIDC callback is missing required parameters`,invalidState:`OIDC state is invalid or has already been used`,stateExpired:`OIDC login session expired — please try again`,providerNotFound:`OIDC provider not found`,discoveryFailed:`Failed to fetch OIDC discovery document`,invalidDiscovery:`OIDC discovery document is invalid`,networkError:`Network error during OIDC token exchange`,badResponse:`Unexpected response during OIDC token exchange`,noIdToken:`OIDC provider did not return an ID token`,validationFailed:`OIDC token validation failed`,nonceMismatch:`OIDC nonce mismatch — possible replay attack`,missingSubClaim:`OIDC token is missing the sub claim`,noLinkedAccount:`No local account is linked to this OIDC identity`,accountInactive:`Your account is inactive`,userResolutionFailed:`Failed to resolve your account`,internalError:`An internal error occurred during OIDC login`,tokenExchangeFailed:`OIDC token exchange failed`},forgotPasswordTitle:`Forgot Password`,forgotPasswordMessage:`If you've forgotten your password, please contact your system administrator to reset it.`,forgotPasswordEmailMessage:`Enter your email address and we'll send you a new password.`,emailAddress:`Email Address`,emailPlaceholder:`your.email@example.com`,cancel:`Cancel`,sending:`Sending...`,sendResetEmail:`Send Reset Email`,howToReset:`How to reset your password:`,resetStep1:`Contact your Bambuddy administrator`,resetStep2:`Ask them to reset your password in User Management`,resetStep3:`They can set a new temporary password for you`,resetStep4:`Log in with the new password and change it in Settings`,gotIt:`Got it`,resetPassword:{title:`Set New Password`,subtitle:`Enter and confirm your new password below.`,newPassword:`New Password`,newPasswordPlaceholder:`At least 8 characters`,confirmPassword:`Confirm Password`,confirmPasswordPlaceholder:`Repeat new password`,saving:`Saving…`,submit:`Set New Password`,backToLogin:`Back to login`,passwordsDoNotMatch:`Passwords do not match`,passwordTooShort:`Password must be at least 8 characters`,resetFailed:`Password reset failed. The link may have expired.`},twoFA:{title:`Two-Factor Authentication`,subtitle:`Your account is protected with 2FA. Enter the verification code below.`,methodAuthenticator:`Authenticator App`,methodEmail:`Email Code`,methodBackup:`Backup Code`,instructionsTotp:`Open your authenticator app and enter the 6-digit code for Bambuddy.`,instructionsEmail:`A 6-digit code has been sent to your email address. It expires in 10 minutes.`,instructionsEmailNotSent:`Click the button below to receive a verification code via email.`,instructionsBackup:`Enter one of your 8-character backup recovery codes. Each code can only be used once.`,sendCodeButton:`Send Code via Email`,sendingCode:`Sending...`,resendCode:`Resend code`,codeLabel:`Verification Code`,backupCodeLabel:`Backup Code`,codePlaceholder:`000000`,backupCodePlaceholder:`XXXXXXXX`,verifyButton:`Verify`,verifyingButton:`Verifying...`,backToLogin:`← Back to login`,orContinueWith:`or continue with`,signInWith:`Sign in with {{provider}}`,enterCode:`Please enter the verification code`,sendCodeFailed:`Failed to send verification code`,invalidCode:`Invalid code. Please try again.`}},setup:{title:`Bambuddy Setup`,subtitle:`Configure authentication for your Bambuddy instance`,enableAuth:`Enable Authentication`,adminAccount:`Admin Account`,adminAccountDesc:`If admin users already exist, authentication will be enabled using the existing admin accounts. Leave the fields below empty to use existing admins, or enter new credentials to create a new admin user.`,adminUsername:`Admin Username`,adminPassword:`Admin Password`,optionalIfAdminExists:`(optional if admin users exist)`,adminUsernamePlaceholder:`Enter admin username (optional)`,adminPasswordPlaceholder:`Enter admin password (optional)`,confirmPassword:`Confirm Password`,confirmPasswordPlaceholder:`Confirm admin password`,settingUp:`Setting up...`,completeSetup:`Complete Setup`,toast:{authEnabledAdminCreated:`Authentication enabled and admin user created`,authEnabledExistingAdmins:`Authentication enabled using existing admin users`,setupCompleted:`Setup completed`,enterBothCredentials:`Please enter both admin username and password, or leave both empty to use existing admin users`,passwordsDoNotMatch:`Passwords do not match`,passwordTooShort:`Password must be at least 6 characters`}},changePassword:{title:`Change Password`,currentPassword:`Current Password`,currentPasswordPlaceholder:`Enter current password`,newPassword:`New Password`,newPasswordPlaceholder:`Enter new password (min 6 characters)`,confirmPassword:`Confirm New Password`,confirmPasswordPlaceholder:`Confirm new password`,passwordsDoNotMatch:`Passwords do not match`,passwordTooShort:`Password must be at least 6 characters`,changing:`Changing...`,success:`Password changed successfully`,failed:`Failed to change password`},plateAlert:{title:`Print Paused!`,message:`Objects detected on build plate. The print has been automatically paused. Please clear the plate and resume the print.`,understand:`I Understand`},camera:{title:`Camera View`,invalidPrinterId:`Invalid printer ID`,live:`Live`,snapshot:`Snapshot`,restartStream:`Restart stream`,refreshSnapshot:`Refresh snapshot`,fullscreen:`Fullscreen`,exitFullscreen:`Exit fullscreen`,connectingToCamera:`Connecting to camera...`,capturingSnapshot:`Capturing snapshot...`,connectionLost:`Connection lost`,connectionFailed:`Camera connection failed`,reconnecting:`Reconnecting in {{countdown}}s... (attempt {{attempt}}/{{max}})`,reconnectNow:`Reconnect now`,cameraUnavailable:`Camera unavailable`,cameraUnavailableDesc:`Make sure the printer is powered on and connected.`,noCamera:`No camera available`,retry:`Retry`,cameraStream:`Camera stream`,zoomOut:`Zoom out`,zoomIn:`Zoom in`,resetZoom:`Reset zoom`,recording:`Recording`,startRecording:`Start Recording`,stopRecording:`Stop Recording`,chamberLight:`Toggle chamber light`,unavailable:`Camera unavailable`,diagnose:{button:`Diagnose`,modalTitle:`Camera diagnostic`,running:`Running diagnostic...`,runFailed:`Diagnostic could not run: {{error}}`,retry:`Run again`,stage:{tcp_reachable:`Network reachability`,first_frame:`Frame capture`,live_stream_active:`Live stream active`},summary:{all_ok:`Camera is working. The diagnostic completed all stages successfully.`,live_stream_active_healthy:`Camera is currently streaming with recent frames — no test needed.`,printer_unreachable:`Printer is not reachable. Check the IP address, network connection, and that the printer is powered on.`,camera_port_closed:`Printer is reachable but the camera port is closed. Make sure LAN-only mode and Developer Mode are enabled in the printer settings.`,no_frame:`Connected to the camera but no frames were received. Try again, or check that the camera is enabled in the printer settings.`,unknown_failure:`Camera diagnostic failed for an unknown reason. Check the support log for details.`},meta:{protocol:`Protocol`,port:`Port`,profile:`Profile`}}},groups:{title:`Group Management`,subtitle:`Manage permission groups for access control`,backToSettings:`Back to Settings`,createGroup:`Create Group`,noPermission:`You do not have permission to access this page.`,system:`System`,noDescription:`No description`,usersCount:`{{count}} users`,permissionsCount:`{{count}} permissions`,edit:`Edit`,delete:`Delete`,toast:{created:`Group created successfully`,updated:`Group updated successfully`,deleted:`Group deleted successfully`,enterGroupName:`Please enter a group name`},modal:{editGroup:`Edit Group`,createGroup:`Create Group`,cancel:`Cancel`,saving:`Saving...`,creating:`Creating...`,saveChanges:`Save Changes`},form:{groupName:`Group Name`,groupNamePlaceholder:`Enter group name`,systemGroupWarning:`System group names cannot be changed`,description:`Description`,descriptionPlaceholder:`Enter description (optional)`,permissions:`Permissions ({{count}} selected)`},deleteModal:{title:`Delete Group`,message:`Are you sure you want to delete this group? Users in this group will lose these permissions.`,confirm:`Delete Group`},editor:{title:`Edit Group`,createTitle:`Create Group`,search:`Search permissions...`,selectAll:`Select All`,clearAll:`Clear All`,permissionsSelected:`{{count}} selected`,noResults:`No permissions match your search`,websocketHint:`Required for live updates. Without it, the interface falls back to periodic polling.`,printerAccess:`Printer access`,adminsSeeAllPrinters:`Administrators always see every printer.`,printerAccessAfterCreate:`Once the group is created, choose its printers under Settings → Authentication → Printer access.`,printerAccessLimited:`Limited: {{printers}} printers picked, {{locations}} locations`,printerAccessOpen:`Not limited: members see every printer.`,managePrinterAccess:`Manage printer access`}},printerAccess:{tab:`Printer access`,intro:`Choose which printers each group's members may see and control. A group that isn't limited narrows nothing: a user who is in no limited group sees every printer, and administrators always do.`,byGroup:`By group`,byPrinter:`By printer`,searchGroups:`Search groups`,groupFilter:{all:`All`,limited:`Limited`,open:`Not limited`},noGroupsMatch:`No groups match.`,alwaysAll:`Always every printer`,notLimited:`Every printer`,reachShort:`{{count}} of {{total}} printers`,unsaved:`Unsaved changes`,pickGroup:`Pick a group to choose its printers.`,memberCount:`Members: {{count}}`,editGroup:`Edit group`,adminsSeeAll:`Administrators always see every printer.`,limit:`Limit members to the printers and locations chosen here`,limitHint:`Off: this group doesn't narrow which printers its members see.`,reach:`Members can use {{count}} of {{total}} printers.`,noneGranted:`Nothing chosen: members of this group won't see any printer.`,noPrinters:`No printers have been added yet.`,searchPrinters:`Search name, model, serial or location`,allLocations:`All locations`,noLocation:`No location`,allModels:`All models`,accessFilter:`Access`,accessAll:`With and without access`,accessWith:`With access`,accessWithout:`Without access`,tickShown:`Tick all shown`,untickShown:`Untick all shown`,emptyLocation:`no printer is here at the moment`,wholeLocation:`Whole location`,wholeLocationHint:`Every printer in {{location}}, including printers added there later`,noPrintersMatch:`No printers match.`,viaLocation:`via location`,alsoVisible:`Besides the groups listed here, every printer is visible to administrators and to users who are in no limited group.`,openUsers:`Users in no limited group: {{names}}`,noOpenUsers:`Every user apart from administrators is in a limited group.`,noLimitedGroups:`No group is limited yet, so every user sees every printer. Limit a group under By group.`,noLimitedGroupReaches:`No limited group`,showingOne:`Showing one printer.`,showAll:`Show all printers`,viaLocationTitle:`Through location {{location}}. Change it under By group.`,removeGroup:`Remove access for {{group}}`,addGroup:`Give access to…`,changedGroups:`Unsaved changes: {{names}}`,discard:`Discard`,saved:`Printer access saved`,whoHasAccess:`Who has access`,moveWarning:`Moving this printer to another location changes who can use it: {{groups}}.`},users:{title:`User Management`,subtitle:`Manage users and their access to your Bambuddy instance`,backToSettings:`Back to Settings`,createUser:`Create User`,noPermission:`You do not have permission to access this page.`,admin:`Admin`,noGroups:`No groups`,active:`Active`,inactive:`Inactive`,edit:`Edit`,delete:`Delete`,system:`System`,noGroupsAvailable:`No groups available`,table:{username:`Username`,groups:`Groups`,status:`Status`,actions:`Actions`},toast:{created:`User created successfully`,updated:`User updated successfully`,deleted:`User deleted successfully`,fillRequired:`Please fill in all required fields`,passwordsDoNotMatch:`Passwords do not match`,passwordTooShort:`Password must be at least 6 characters`,ldapProvisioned:`Provisioned LDAP user "{{username}}"`},modal:{createUser:`Create User`,editUser:`Edit User`,cancel:`Cancel`,creating:`Creating...`,saving:`Saving...`,saveChanges:`Save Changes`,advancedAuthSubtitle:`with Advanced Authentication`,tabsAriaLabel:`User source`,localTab:`Local`,ldapTab:`LDAP`,ldapSearchLabel:`Search directory`,ldapSearchPlaceholder:`Type a username, name, or email...`,ldapMinChars:`Type at least 2 characters to search`,ldapTypeToSearch:`Start typing to search the LDAP directory`,ldapSearching:`Searching directory...`,ldapNoResults:`No matching users in the directory`,ldapSearchError:`Directory search failed. Check the LDAP server status.`,ldapAlreadyProvisioned:`Already provisioned`,ldapSelectedLabel:`Selected`,ldapProvision:`Provision user`,ldapProvisioning:`Provisioning...`,ldapErrorProvision:`Provisioning failed. Check the LDAP server status and try again.`},form:{username:`Username`,usernamePlaceholder:`Enter username`,email:`Email`,emailPlaceholder:`user@example.com`,password:`Password`,passwordPlaceholder:`Enter password`,confirmPassword:`Confirm Password`,confirmPasswordPlaceholder:`Confirm password`,newPasswordPlaceholder:`Enter new password`,confirmNewPasswordPlaceholder:`Confirm new password`,leaveBlankToKeep:`leave blank to keep current`,groups:`Groups`,optional:`optional`,autoGeneratedPassword:`A secure password will be automatically generated and emailed to the user.`,passwordManagedByAdvancedAuth:`Password is managed by Advanced Authentication. Use "Reset Password" to send a new password to the user via email.`,resetPassword:`Reset Password`,resettingPassword:`Resetting Password...`},deleteModal:{title:`Delete User`,message:`Are you sure you want to delete this user? This action cannot be undone.`,confirm:`Delete User`}},streamOverlay:{branding:{title:`Branding`,hint:`One shared logo for this installation. PNG or WebP, up to 2 MiB and 4 million pixels. Replacing or removing it affects overlays using it.`,upload:`Upload logo`,logo:`Custom logo`,from:`From colour`,to:`To colour`,reset:`Reset colours`,failed:`Could not save the logo. Check the image format and size.`},title:`Stream Overlay`,invalidPrinterId:`Invalid printer ID`,cameraStream:`Camera stream`,progress:`Progress`,eta:`ETA`,printerIdle:`Printer is idle`,printerOffline:`Printer offline`,layer:`Layer`,remaining:`Remaining`,builder:{backgroundTransparency:`Background transparency`,backgroundTransparencyHint:`Fade the dark backgrounds only. Text, logos and camera stay visible.`,layout:`Layout`,landscape:`Landscape`,portrait:`Portrait`,both:`Both`,orientationUrl:`{{orientation}} URL`,orientationPreview:`{{orientation}} preview`,sourceDimensions:`Browser source: {{width}} × {{height}} px`,artwork:`Artwork`,artworkClassic:`Classic`,artworkV2:`Version 2`,createToken:`Create overlay token`,showToken:`Show token`,hideToken:`Hide token`,credentialHint:`Create a token above, enter an existing token, or import an overlay URL. Copy the URL before leaving: tokens are held only in memory and cannot be recovered from their stored hash.`,importUrl:`Existing overlay URL`,importAction:`Import URL`,importHint:`Import a URL locally to reuse its token and settings on this server. Settings Bambuddy doesn't recognise are ignored.`,rememberedHint:`Your choices are remembered in this browser. The token is not.`,resetChoices:`Reset choices`,importError:`Enter a valid HTTP(S) overlay URL with a positive printer number, at most one token and no user name or password.`,manualToken:`Manual token`,title:`Streaming Overlay`,description:`Build the URL for a streaming overlay — a full-screen camera view with live print data drawn over it, for OBS, a wall display, or any browser source. Pick the fields you want and copy the URL.`,printer:`Printer`,size:`Text size`,sizeSmall:`Small`,sizeMedium:`Medium`,sizeLarge:`Large`,fps:`Frame rate`,fpsHint:`A1 and P1 cameras top out around 5 fps whatever you ask for.`,tokenWarning:`This URL contains a token — anyone who can read it can watch the stream and see the file name. Revoke the token to cut it off.`,fields:`Fields to show`,fieldPrinter:`Printer name`,fieldModel:`Printer model`,fieldFilename:`File name`,fieldStatus:`Status`,fieldProgress:`Progress bar`,fieldLayers:`Layer count`,fieldEta:`Time remaining and ETA`,fieldCamera:`Camera feed`,chamberHint:`Chamber temperature only appears on models with a real chamber sensor — P1 and A1 printers report a meaningless value, so it is left out there.`,urlTitle:`Overlay URL`,open:`Open`,showPreview:`Show preview`,hidePreview:`Hide preview`,previewTitle:`Overlay preview`},status:{printing:`Printing`,paused:`Paused`,finished:`Finished`,failed:`Failed`,idle:`Idle`,unknown:`Unknown`}},profiles:{title:`Profiles`,subtitle:`Manage your slicer presets and pressure advance calibrations`,tabs:{bambuCloud:`Bambu Cloud`,orcaCloud:`Orca Cloud`,local:`Local Profiles`,kprofiles:`K-Profiles`},orcaCloud:{connectedAs:`Connected as`,connectedShort:`Connected to Orca Cloud`,logout:`Disconnect`,noLogoutPermission:`You do not have permission to disconnect`,noConnectPermission:`You do not have permission to connect to Orca Cloud`,retry:`Retry`,connectButton:`Connect Orca Cloud`,connect:{title:`Connect to Orca Cloud`,description:`Sign in to your Orca Cloud account to sync your slicer profiles into Bambuddy.`},device:{title:`Approve Bambuddy in Orca Cloud`,instruction:`Open Orca Cloud and approve this code. Bambuddy connects automatically once you approve.`,codeLabel:`Your pairing code`,openButton:`Open Orca Cloud approval page`,manualHint:`Or go to {{url}} and enter the code above.`,waiting:`Waiting for you to approve…`,cancel:`Cancel`},profiles:{title:`Your Orca Cloud profiles ({{count}})`,refresh:`Refresh`,empty:`No profiles found in your Orca Cloud account yet.`},toast:{disconnected:`Disconnected from Orca Cloud`},errors:{startFailed:`Could not start Orca Cloud pairing.`,denied:`The pairing was denied in Orca Cloud.`,expired:`The pairing code expired. Click Connect to try again.`,pollFailed:`Lost the connection while waiting for approval. Please try again.`}},localProfiles:{title:`Local Profiles`,subtitle:`Import and manage slicer presets from OrcaSlicer`,import:`Import Profiles`,importDesc:`Drop .bbscfg, .bbsflmt, .orca_filament, .zip, or .json files here`,importing:`Importing...`,search:`Search local presets...`,noPresets:`No local presets yet`,noSearchResults:`No presets match your search`,badge:`Local`,edit:`Edit`,delete:`Delete`,cancel:`Cancel`,deleteConfirmTitle:`Delete Preset`,deleteConfirm:`Are you sure you want to delete this preset? This cannot be undone.`,source:`Source`,inheritsFrom:`Inherits`,filamentType:`Type`,vendor:`Vendor`,compatiblePrinters:`Printers`,nozzleTemp:`Nozzle Temp`,cost:`Cost`,density:`Density`,pressureAdvance:`Pressure Advance`,filament:`Filament`,process:`Process`,printer:`Printer`,toast:{importSuccess:`{{count}} preset(s) imported`,importSkipped:`{{count}} preset(s) skipped (duplicates)`,importError:`{{count}} error(s) during import`,deleted:`Preset deleted`,updated:`Preset updated`}},connectedAs:`Connected as`,signInExpiredTitle:`Bambu Cloud sign-in expired`,signInExpiredBody:`Bambu Lab no longer accepts the stored token. Sign in again to restore cloud profiles, MakerWorld imports and firmware checks.`,logout:`Logout`,noLogoutPermission:`You do not have permission to logout`,failedToLoad:`Failed to load profiles`,retry:`Retry`,time:{justNow:`Just now`,minsAgo:`{{count}}m ago`,hoursAgo:`{{count}}h ago`,daysAgo:`{{count}}d ago`},toast:{loggedOut:`Logged out`},login:{title:`Connect to Bambu Cloud`,subtitle:`Sync your slicer presets across devices`,email:`Email`,password:`Password`,region:`Region`,regionGlobal:`Global`,regionChina:`China`,verificationCode:`Verification Code`,totpCode:`Authenticator Code`,checkEmail:`Check your email ({{email}}) for a 6-digit code`,enterTotpHint:`Enter the 6-digit code from your authenticator app`,accessToken:`Access Token`,accessTokenHint:`Paste your Bambu Cloud access token. China-region accounts must use this path (phone-bound — email login unavailable). See the wiki for how to retrieve the token from MakerWorld cookies.`,back:`Back`,loginButton:`Login`,verifyButton:`Verify`,setTokenButton:`Set Token`,useToken:`Use access token instead`,captchaTitle:`Bambu Cloud is asking for a CAPTCHA`,captchaBody:`Bambu is challenging your network before it will accept a sign-in, and the challenge cannot be answered from Bambuddy. Your email and password are not the problem. The block is tied to your public IP address and normally clears by itself within a few hours — retrying repeatedly makes it last longer. To sign in now, use an access token from a browser session instead.`,useEmail:`Login with email instead`,toast:{loggedIn:`Logged in successfully`,codeSent:`Verification code sent to your email`,enterTotp:`Enter code from your authenticator app`,tokenSet:`Token set successfully`}},presets:{myPreset:`My preset (editable)`,duplicate:`Duplicate`,editable:`Editable`,failedToLoadDetails:`Failed to load preset details`,deleteConfirm:`Delete this preset?`,deleteWarning:`This will permanently delete "{{name}}" from Bambu Cloud. This cannot be undone.`,noDuplicatePermission:`You do not have permission to duplicate presets`,noEditPermission:`You do not have permission to edit presets`,noDeletePermission:`You do not have permission to delete presets`,types:{filament:`Filament preset`,printer:`Printer preset`,process:`Process preset`},toast:{deleted:`Preset deleted`,created:`Preset created`,updated:`Preset updated`,duplicated:`Preset duplicated`,fieldAdded:`Field "{{key}}" added`,exported:`Preset exported`},baseLabel:`Base: {{name}}`,currentLabel:`Current: {{name}}`,newPreset:`New Preset`,editPreset:`Edit Preset`,duplicatePreset:`Duplicate Preset`,createNewPreset:`Create New Preset`,customizeSettings:`Customize settings for your new preset`,compareWithBase:`Compare with base preset`,compare:`Compare`,basePreset:`Base Preset`,selectBasePreset:`Select base preset...`,presetName:`Preset Name`,myCustomPreset:`My custom preset`,inheritsFrom:`Inherits from`,dropJsonToImport:`Drop JSON to import`,tabs:{common:`Common`,allFields:`All Fields`},availableFields:`Available Fields`,searchFieldsPlaceholder:`Search fields...`,noMatchingFields:`No matching fields`,allFieldsAdded:`All fields added`,addCustomField:`Add custom field`,yourOverrides:`Your Overrides`,noOverridesYet:`No overrides yet`,clickFieldsToAdd:`Click fields on the left to add them`,saveAsTemplate:`Save as template`,jsonTip:`Tip: Drag & drop a .json file anywhere on this modal to import settings`},cloudView:{searchPlaceholder:`Search presets...`,templates:`Templates`,refresh:`Refresh`,newPreset:`New Preset`,clearFilters:`Clear filters`,compareMode:`Compare Mode`,selectAnotherPreset:`Select another {{type}} preset`,clickTwoPresets:`Click two presets of the same type to compare`,selectFirst:`1. Select first`,selectSecond:`2. Select second`,compareNow:`Compare Now`,lastSynced:`Last synced:`,showingCount:`Showing {{showing}} of {{total}} presets`,noPresetsFound:`No presets found`,columns:{filament:`Filament`,process:`Process`,printer:`Printer`},noFilamentPresets:`No filament presets`,noProcessPresets:`No process presets`,noPrinterPresets:`No printer presets`,filters:{type:`Type`,owner:`Owner`,printer:`Printer`,nozzle:`Nozzle`,filament:`Filament`,layer:`Layer`,all:`All`,myPresets:`My Presets`,builtIn:`Built-in`,process:`Process`},noTemplatesPermission:`You do not have permission to manage templates`,noRefreshPermission:`You do not have permission to refresh profiles`,noCreatePermission:`You do not have permission to create presets`},templates:{title:`Quick Templates`,noTemplates:`No templates yet`,createFirst:`Create templates from the preset editor`,typeFilter:`Type:`,deleteTitle:`Delete Template`,deleteWarning:`This action cannot be undone`,deleteConfirm:`Are you sure you want to delete "{{name}}"?`,namePlaceholder:`Template name`,descriptionPlaceholder:`Description`,settingsJson:`Settings (JSON)`,fieldsCount:`{{count}} fields`,shownInModals:`Shown in modals`,hiddenInModals:`Hidden in modals`,apply:`Apply`,toast:{deleted:`Template deleted`,updated:`Template updated`,created:`Template created`,applied:`Template applied`}}},support:{debugLoggingActive:`Debug logging is active`,manageLogs:`Manage`,collectItem7:`Printer connectivity and firmware versions`,collectItem8:`Integration status (Spoolman, MQTT, HA)`,collectItem9:`Network interfaces (subnets only)`,collectItem10:`Python package versions`,collectItem11:`Database health checks`,collectItem12:`Docker environment details`,bundleGenerating:`Generating bundle...`,bundleStepConnection:`Running printer connectivity checks`,bundleStepVirtualPrinters:`Running virtual-printer setup checks`,bundleStepLogScan:`Scanning recent logs for known issues`,bundleStepBuild:`Building the support bundle ZIP`},fileManager:{combine:{action:`Combine to 3MF`,tooltip:`Combine the selected STLs into one 3MF so they can be sliced on a single plate`,title:`Combine to 3MF`,description:`Builds one 3MF with every model below, ready to slice on a single plate. Turn on auto-arrange when slicing to lay them out on the bed.`,nameLabel:`File name`,defaultName:`{{name}} + {{count}} more`,model:`Model`,copies:`Copies`,copiesFor:`Copies of {{filename}}`,total:`Objects on the plate: {{count}}`,tooMany:`At most {{max}} objects per plate`,sliceNext:`Open the slicer when done`,submit:`Combine`,done:`Created {{filename}} with {{count}} objects`},variants:{badge:`{{count}} versions`,groupAction:`Group as versions`,groupTooltip:`Mark these files as the same job sliced for different printers`,grouped:`Grouped {{count}} files as versions`,printAlternatives:`Print ({{count}} alternatives)`},title:`File Manager`,subtitle:`Organize and manage your print files`,uploadFiles:`Upload Files`,newFolder:`New Folder`,folderName:`Folder Name`,folderNamePlaceholder:`e.g., Functional Parts`,renameFile:`Rename File`,renameFolder:`Rename Folder`,invalidFilenameChar:`The character "{{char}}" is not allowed in print filenames. The printer SD card rejects: < > : " / \\ | ? *`,moveFiles:`Move {{count}} File(s)`,rootNoFolder:`Root (No Folder)`,current:`current`,linkFolder:`Link Folder`,linkFolderDescription:`Link "{{name}}" to a project or archive for quick access.`,project:`Project`,archive:`Archive`,noProjectsFound:`No projects found`,noArchivesFound:`No archives found`,unlink:`Unlink`,link:`Link`,dragDropFiles:`Drag & drop files here`,dropFilesHere:`Drop files here`,releaseToUpload:`Release to upload`,orClickToBrowse:`or click to browse`,allFileTypesSupported:`All file types supported. ZIP files will be extracted.`,zipFilesDetected:`ZIP files detected`,zipExtractOptions:`ZIP files will be extracted. Choose how to handle folder structure:`,preserveZipStructure:`Preserve folder structure from ZIP`,createFolderFromZip:`Create folder from ZIP filename`,stlThumbnailGeneration:`STL thumbnail generation`,zipMayContainStl:`ZIP files may contain STL files. Thumbnails can be generated during extraction.`,thumbnailsCanBeGenerated:`Thumbnails can be generated for STL files. Large models may take longer to process.`,generateThumbnailsForStl:`Generate thumbnails for STL files`,threemfDetected:`3MF files detected`,threemfExtractionInfo:`Printer model, material, color, and print settings will be automatically extracted from 3MF files.`,willBeExtracted:`Will be extracted`,filesExtracted:`{{count}} files extracted`,uploadComplete:`Upload complete: {{succeeded}} succeeded`,uploadFailed:`Upload failed`,zipFilesFailed:`{{count}} files failed`,uploading:`Uploading...`,changeLink:`Change Link...`,linkTo:`Link to...`,linkToProjectOrArchive:`Link to project or archive`,generateThumbnail:`Generate Thumbnail`,generateThumbnails:`Generate Thumbnails`,generateThumbnailsForMissing:`Generate thumbnails for STL and PDF files missing them`,gridView:`Grid view`,listView:`List view`,columnsView:`Column view`,lowDiskSpaceWarning:`Low disk space warning`,lowDiskSpaceDetails:`Only {{free}} free of {{total}} total. Threshold is set to {{threshold}} GB in settings.`,files:`Files`,folders:`Folders`,size:`Size`,free:`Free`,allFiles:`All Files`,allExternal:`External`,externalIsEmpty:`No external files`,externalEmptyDescription:`Files in your linked external folders will appear here.`,wrap:`Wrap`,enableTextWrapping:`Enable text wrapping`,disableTextWrapping:`Disable text wrapping`,collapse:`Collapse`,collapseFoldersByDefault:`Collapse folders by default`,expandFoldersByDefault:`Expand folders by default`,folderSort:`Sort folders`,folderSortByName:`By name`,folderSortByActivity:`By recent activity`,dragToResizeTooltip:`Drag to resize, double-click to reset`,searchFiles:`Search files...`,searchSubfoldersHint:`Including subfolders`,readme:{truncated:`Truncated`,show:`Show README`,hide:`Hide README`,label:`README`},tags:{title:`Tags`,subtitle:`Label files for cross-cutting filtering — toys, kid-safe, PETG-only, anything.`,manage:`Tags`,manageTitle:`Manage tag catalog`,add:`New tag`,edit:`Rename tag`,name:`Name`,fileCount:`Files`,empty:`No tags yet. Create one to start labelling files.`,noMatches:`No matching tags.`,createPlaceholder:`e.g. toys, kid-safe, petg`,createButton:`Create`,nameRequired:`Name is required.`,searchPlaceholder:`Filter tags...`,created:`Tag created.`,updated:`Tag renamed.`,deleted:`Tag removed.`,saveFailed:`Could not save tag.`,deleteFailed:`Could not remove tag.`,applyFailed:`Could not apply tags.`,applyAdd:`Add tags`,applyRemove:`Remove tags`,applyAddSuccess:`Added {{count}} tag(s) across {{files}} file(s).`,applyRemoveSuccess:`Removed {{count}} tag(s) across {{files}} file(s).`,actionAdd:`Add to selected files`,actionRemove:`Remove from selected files`,tagAction:`Tag`,bulkTitle:`Tag {{count}} selected file(s)`,bulkTooltip:`Add or remove tags on every selected file.`,noPermission:`You do not have permission to tag files.`,filterLabel:`Filtering by:`,clearAll:`Clear all`,confirmDelete:`Delete tag "{{name}}"?`,confirmDeleteMessage:`This removes the tag from the catalog. Files keep their other tags.`,confirmDeleteInUseMessage:`This tag is on {{count}} file(s). Deleting removes the chip from all of them; files themselves are untouched.`,editAria:`Edit {{name}}`,deleteAria:`Delete {{name}}`},allTypes:`All types`,prints:`Prints`,ascending:`Ascending`,descending:`Descending`,showModified:`Show modified dates`,hideModified:`Hide modified dates`,lastModified:`Last modified`,lastActivity:`Last activity`,resultsCount:`{{showing}} of {{total}} files`,selectAll:`Select All`,deselectAll:`Deselect All`,selected:`{{count}} selected`,adding:`Adding...`,loadingFiles:`Loading files...`,folderIsEmpty:`Folder is empty`,noFilesOutsideFolders:`No files outside folders`,noFilesYet:`No files yet`,folderEmptyDescription:`Upload files or move files into this folder to get started.`,noFilesDescription:`Upload files to start organizing your print-related files.`,noMatchingFiles:`No matching files`,noMatchingFilesDescription:`No files match your current search or filter criteria.`,clearFilters:`Clear filters`,printedCount:`Printed {{count}}x`,uploadedBy:`Uploaded By`,deleteFolder:`Delete Folder`,deleteFile:`Delete File`,deleteFilesCount:`Delete {{count}} Files`,deleteFolderConfirm:`Are you sure you want to delete this folder? All files inside will also be deleted.`,deleteFileConfirm:`Are you sure you want to delete this file?`,deleteFilesConfirm:`Are you sure you want to delete {{count}} selected files? This action cannot be undone.`,deleting:`Deleting...`,noPermissionRenameFolder:`You do not have permission to rename folders`,noPermissionLinkFolder:`You do not have permission to link folders`,noPermissionDeleteFolder:`You do not have permission to delete folders`,onlyOwnFoldersDeletable:`You can only delete your own folders when everything in them is yours, or empty folders without an owner`,shareFolder:`Share with everyone`,unshareFolder:`Stop sharing`,shareFolderHint:`Shared folders are visible to every user, who can add files and subfolders to them`,sharedFolder:`Shared with everyone`,folderNotWritable:`You can only add to your own folders and folders shared with everyone`,noPermissionPrint:`You do not have permission to print`,noPermissionAddToQueue:`You do not have permission to add to queue`,noPermissionSlice:`You do not have permission to slice files`,noPermissionDownload:`You do not have permission to download files`,noPermissionPreview:`You do not have permission to preview files`,preview3d:`3D Preview`,preview:{open:`Preview`,error:`This file cannot be previewed.`,tooLarge:`File is too large to preview ({{size}}).`,page:`Page {{current}} of {{total}}`,prevPage:`Previous page`,nextPage:`Next page`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,resetZoom:`Reset zoom`,fullscreen:`Fullscreen`,exitFullscreen:`Exit fullscreen`,emptySheet:`This sheet is empty`,truncatedRows:`Showing the first {{shown}} of {{total}} rows`,truncatedCols:`Showing the first {{shown}} of {{total}} columns`},details:{title:`File details`,size:`Size`,type:`Type`,printName:`Print name`,printTime:`Print time`,filament:`Filament`,slicedFor:`Sliced for`,source:`Source`,created:`Created`,modified:`Modified`,notes:`Notes`,notesPlaceholder:`Print settings, tips, what worked...`,externalLink:`External link`,externalLinkPlaceholder:`https://printables.com/model/...`,openLink:`Open link`,photos:`Photos`,addPhoto:`Add photo`,noPhotos:`No photos yet`,deletePhoto:`Delete photo`,photoCount_one:`{{count}} photo`,photoCount_other:`{{count}} photos`,hasNotes:`Has notes`,save:`Save`,saved:`File details saved`,saveFailed:`Failed to save file details`,uploadFailed:`Failed to upload photo`,deleteFailed:`Failed to delete photo`},noPermissionRenameFile:`You do not have permission to rename this file`,noPermissionGenerateThumbnail:`You do not have permission to generate thumbnails`,noPermissionDeleteFile:`You do not have permission to delete this file`,noPermissionCreateFolder:`You do not have permission to create folders`,noPermissionUpload:`You do not have permission to upload files`,noPermissionMoveFiles:`You do not have permission to move files`,noPermissionDeleteFiles:`You do not have permission to delete files`,linkExternal:`Link External`,linkExternalFolder:`Link External Folder`,linkExternalFolderDescription:`Mount a host directory (NAS, USB, network share) into the File Manager. Files are not copied — they are accessed directly from the original path.`,externalFolderNamePlaceholder:`e.g., NAS Prints`,externalPath:`Host Path`,externalPathHelp:`Absolute path to the directory on the Docker host. Must be bind-mounted into the container.`,readOnly:`Read Only`,readOnlyHelp:`prevents uploads and deletions`,showHiddenFiles:`Show hidden files (dotfiles)`,externalFolder:`External Folder`,scanFolder:`Scan`,toast:{folderCreated:`Folder created`,openInSlicerFailed:`Could not open in slicer`,folderDeleted:`Folder deleted`,fileDeleted:`File deleted`,filesDeleted:`Deleted {{count}} files`,filesMoved:`Files moved`,folderLinked:`Folder linked`,folderUnlinked:`Folder unlinked`,externalFolderLinked:`External folder linked and scanned`,folderScanned:`Scan complete: {{added}} added, {{removed}} removed`,addedToQueue:`Added {{count}} file(s) to queue`,addedToQueuePartial:`Added {{added}} file(s), {{failed}} failed`,failedToAddToQueue:`Failed to add files: {{error}}`,fileRenamed:`File renamed`,folderRenamed:`Folder renamed`,folderShared:`Folder shared with everyone`,folderUnshared:`Folder no longer shared`,thumbnailsGenerated:`Generated {{count}} thumbnail(s)`,thumbnailsGeneratedPartial:`Generated {{succeeded}} thumbnail(s), {{failed}} failed`,noStlMissingThumbnails:`No STL or PDF files missing thumbnails`,failedToGenerateThumbnails:`Failed to generate thumbnails: {{error}}`,thumbnailGenerated:`Thumbnail generated`,failedToGenerateThumbnail:`Failed to generate thumbnail: {{error}}`}},projects:{parentLabel:`Parent project`,parentNone:`None (top-level project)`,parentHint:`Nest this project under another one so its figures roll up into a master project`,partOf:`Part of {{name}}`,subProjectCount:`{{count}} sub-projects`,subProjectsOf:`Sub-projects of {{name}}`,collapseSubProjects:`Collapse sub-projects`,expandSubProjects:`Expand sub-projects`,title:`Projects`,subtitle:`Organize and track your 3D printing projects`,newProject:`New Project`,editProject:`Edit Project`,deleteProject:`Delete Project`,projectName:`Project Name`,description:`Description`,noProjects:`No projects yet`,noProjectsFiltered:`No {{status}} projects`,noProjectsFilteredHelp:`You don't have any {{status}} projects. Projects will appear here when their status changes.`,createFirst:`Create your first project to start organizing related prints, tracking progress, and managing your builds.`,createFirstButton:`Create Your First Project`,create:`Create`,files:`Files`,prints:`Prints`,plates:`plates`,parts:`parts`,lastModified:`Last Modified`,deleteConfirm:`Are you sure you want to delete this project? Archives and queue items will be unlinked but not deleted.`,addFiles:`Add Files`,removeFile:`Remove File`,viewDetails:`View Details`,namePlaceholder:`e.g., Voron 2.4 Build`,descriptionPlaceholder:`Optional description...`,urlLabel:`URL`,urlPlaceholder:`https://makerworld.com/...`,urlInvalid:`URL must start with http:// or https://`,openExternalUrl:`Open project URL`,coverImageLabel:`Cover photo`,coverImageAlt:`Project cover photo`,coverImageUpload:`Upload`,coverImageReplace:`Replace`,coverImageRemove:`Remove`,color:`Color`,targetPlates:`Target Plates`,targetPlatesPlaceholder:`e.g., 25`,targetPlatesHelp:`Number of print jobs`,targetParts:`Target Parts`,targetPartsPlaceholder:`e.g., 150`,targetPartsHelp:`Total objects needed`,targetSets:`Copies per File`,targetSetsPlaceholder:`e.g., 10`,targetSetsHelp:`Times each printable file should be printed`,tagsLabel:`Tags (comma-separated)`,tagsPlaceholder:`e.g., voron, functional, gift`,dueDate:`Due Date`,priority:`Priority`,priorityLow:`Low`,priorityNormal:`Normal`,priorityHigh:`High`,priorityUrgent:`Urgent`,statusActive:`Active`,statusCompleted:`Completed`,statusArchived:`Archived`,done:`Done`,completed:`completed`,failed:`failed`,inQueue:`in queue`,noPrintsYet:`No prints yet`,printJobs:`Print jobs (plates)`,partsPrinted:`Parts printed`,failedParts:`Failed parts`,import:`Import`,export:`Export`,importProject:`Import project`,exportAll:`Export all projects`,loading:`Loading projects...`,noEditPermission:`You do not have permission to edit projects`,noDeletePermission:`You do not have permission to delete projects`,noCreatePermission:`You do not have permission to create projects`,noImportPermission:`You do not have permission to import projects`,noExportPermission:`You do not have permission to export projects`,toast:{created:`Project created`,updated:`Project updated`,deleted:`Project deleted`,imported:`Project imported`,multipleImported:`{{count}} projects imported`,importFailed:`Import failed`,exported:`Projects exported (metadata only)`}},projectDetail:{notFound:`Project not found`,backToProjects:`Back to Projects`,export:`Export`,exportProject:`Export project`,noExportPermission:`You do not have permission to export projects`,noEditPermission:`You do not have permission to edit projects`,partOf:`Part of:`,priorityLabel:`Priority:`,noPrints:`No prints in this project yet`,status:{active:`Active`,completed:`Completed`,archived:`Archived`},priority:{low:`Low`,normal:`Normal`,high:`High`,urgent:`Urgent`},dueDate:{overdue:`Overdue`,today:`Due today`,daysLeft:`{{count}} days left`},progress:{platesProgress:`Plates Progress`,partsProgress:`Parts Progress`,setsProgress:`Complete Sets`,sets:`sets`,setsHint:`A set is complete once every printable file has reached this count`,printJobs:`print jobs`,parts:`parts`,percentComplete:`{{percent}}% complete`,remaining:`{{count}} remaining`},stats:{printJobs:`Print Jobs`,total:`total`,failed:`{{count}} failed`,partsPrinted:`{{count}} parts printed`,printTime:`Print Time`,filamentUsed:`Filament Used`},cost:{title:`Cost Tracking`,filamentCost:`Filament Cost`,energy:`Energy`,totalCost:`Estimated Cost`,total:`Total`,includesBom:`incl. BOM`,wear:`Printer Wear`,budget:`Budget`,remaining:`Remaining`},subProjects:{title:`Sub-projects ({{count}})`,jobs:`{{count}} jobs`},rollup:{title:`Including {{count}} sub-projects`,progress:`Overall progress`,percentComplete:`{{percent}}% complete`},notes:{title:`Notes`,noEditPermission:`You do not have permission to edit notes`,placeholder:`Add notes about this project...`,empty:`No notes yet. Click Edit to add notes.`},files:{title:`Files`,linkFolders:`Link folders from the File Manager`,forQuickAccess:`to this project for quick access.`,fileCount:`{{count}} file(s)`,empty:`No folders linked. Go to File Manager and link a folder to this project.`,printedCount:`Printed {{count}} time(s)`,progressTooltip:`{{done}} of {{target}} completed prints`,noFiles:`No files in this folder.`},bom:{title:`Bill of Materials`,acquired:`{{completed}}/{{total}} acquired`,showAll:`Show all`,hideDone:`Hide done`,addPart:`Add Part`,noAddPermission:`You do not have permission to add parts`,partNamePlaceholder:`Part name (e.g., M3x8 screws)`,partName:`Part name`,qty:`Qty`,price:`Price ({{currency}})`,sourcingUrlPlaceholder:`Sourcing URL (optional)`,remarksPlaceholder:`Remarks (optional)`,deletePart:`Delete Part`,deleteConfirm:`Are you sure you want to delete "{{name}}"?`,noUpdatePermission:`You do not have permission to update parts`,noEditPermission:`You do not have permission to edit parts`,noDeletePermission:`You do not have permission to delete parts`,totalCost:`Total cost:`,empty:`No parts in the bill of materials. Add hardware, electronics, or other components to track what needs to be sourced.`},timeline:{title:`Activity Timeline`,empty:`No activity yet.`},template:{saveAsTemplate:`Save as Template`,noCreatePermission:`You do not have permission to create templates`},queue:{title:`Queue`,viewAll:`View all`,printing:`{{count}} printing`,queued:`{{count}} queued`},prints:{title:`Prints ({{count}})`},toast:{projectUpdated:`Project updated`,partAdded:`Part added`,partRemoved:`Part removed`,exportFailed:`Export failed`,projectExported:`Project exported`,templateCreated:`Template created`}},system:{title:`System Information`,version:`Version`,uptime:`Uptime`,cpuUsage:`CPU Usage`,memoryUsage:`Memory Usage`,diskUsage:`Disk Usage`,networkInfo:`Network Info`,logs:`Logs`,debugMode:`Debug Mode`,enableDebug:`Enable Debug Logging`,disableDebug:`Disable Debug Logging`,downloadLogs:`Download Logs`,clearLogs:`Clear Logs`,dockerInfo:`Docker Info`,containerName:`Container Name`,imageName:`Image Name`,platform:`Platform`,architecture:`Architecture`},sponsors:{sectionTitle:`Independent & community-funded`,tagline:`Bambuddy is free and stays that way because people choose to support it. No VC, no cloud lock-in.`,viewSupporters:`View supporters`,toastPrints:`You've completed {{count}} prints with Bambuddy. Bambuddy stays free thanks to its supporters.`,toastCost:`You've tracked {{total}} in filament with Bambuddy. See who keeps the project independent.`,toastArchives:`{{count}} prints archived with Bambuddy. See who keeps it independent.`,toastAnniversary:`One year with Bambuddy! See who keeps the project independent.`,toastVersionUpdate:`Updated to v{{version}}. Bambuddy stays free thanks to its supporters.`,toastBusiness:`Running Bambuddy on {{count}} printers? There's a support plan for teams — priority fixes, invoicing, and a direct line to the maintainer.`,businessCta:`Bambuddy for business`,businessTitle:`Bambuddy for business`,businessTagline:`You're running {{count}} printers. Priority support, commercial licensing and invoicing are available for teams and print farms.`},library:{title:`Filament Library`,addFilament:`Add Filament`,editFilament:`Edit Filament`,deleteFilament:`Delete Filament`,vendor:`Vendor`,material:`Material`,color:`Color`,kFactor:`K Factor`,temperature:`Temperature`,noFilaments:`No filaments in library`,deleteConfirm:`Are you sure you want to delete this filament?`,importFromPrinter:`Import from Printer`,exportToFile:`Export to File`,runWithPipeline:{actionLabel:`Run with pipeline`,noPermission:`You do not have permission to run pipelines`,modalTitle:`Run with pipeline`,confirmTitle:`Confirm run`,confirmIntro:`Pre-flight found issues with this run`,sourceHint:`Source`,pipelineHint:`Pipeline`,targetHint:`Target`,pipelineListAria:`Available pipelines`,runAnyway:`Run anyway`,loading:`Loading…`,empty:`No pipelines saved yet. Open the Slice dialog and click "Save as pipeline" to create one.`,noTarget:`No target printer set`,noTargetMessage:`This pipeline has no target printer set. Open it in Settings to pick one.`,copies:`Copies`,copiesHint:`max {{n}}`,classTarget:`Any {{model}}`,toast:{started:`Pipeline run started`,failed:`Could not start run`},issue:{printerNotSet:`No target printer set on this pipeline.`,printerNotFound:`Target printer no longer exists.`,printerDisabled:`Target printer is disabled.`,printerOffline:`Target printer is offline.`,filamentType:`Filament slot {{slot}}: expected {{expected}}, AMS has {{actual}}`,filamentColor:`Filament slot {{slot}}: colour differs (expected {{expected}}, AMS has {{actual}})`,amsSlotMissing:`AMS slot {{slot}} not available on this printer`,filamentUnverified:`Filament slot {{slot}} comes from a cloud / standard preset and could not be statically verified.`,noClassMatches:`No printers in this install match the pipeline's target model class ({{expected}}).`,classNotSet:`Pipeline target is set to a printer class but no model was chosen.`}}},slicerSettings:{presetValuesOutdatedSidecar:`Showing slicer defaults: your slicer sidecar is older than this feature and can't report a preset's values. Update the sidecar image to see them. Anything you don't change still uses the preset.`,presetValuesNotConfigured:`Showing slicer defaults: no slicer sidecar is configured, so a preset's values can't be read. Anything you don't change still uses the preset.`,presetValuesSidecarUnavailable:`Showing slicer defaults: the slicer sidecar did not answer, so a preset's values can't be read. Anything you don't change still uses the preset.`,presetValuesUnavailable:`Showing slicer defaults: the picked preset's own values could not be read. Anything you don't change still uses the preset.`,filamentDefault:`Default`,fromFile:`from file`,fromFileHint:`The designer changed this in the source file. Its value is {{value}}.`,fromFilePrinterCoupled:`designer's printer`,fromFilePrinterCoupledHint:`Tuned for the printer this file was designed for -- may be wrong or out of range on yours.`,fromFileOverridesPreset:`overrides preset`,fromFileOverridesPresetHint:`The file sets this to {{value}} where the preset you picked uses {{preset}}. Tick it only if the file should win.`,useFromFile:`Use the source file's value for {{option}}`,otherFromFile:`Other settings from this file`,fromFileSummary:`The designer changed {{count}} process settings in this file. Only the ones you tick are used.`,fromFileUseAll:`Use the designer's settings`,fromFileUseAllHint:`Ticks the settings that carry across printers. The ones tuned for the designer's own printer, and the ones that define the preset you picked, stay off.`,fromFileClear:`Clear {{count}}`,loading:`Loading slicer settings…`,mode:{simple:`Simple`,advanced:`Advanced`,expert:`Expert`},searchPlaceholder:`Search settings`,resetAll:`Reset {{count}}`,resetOption:`Reset to default`,noMatches:`No settings match this search.`},slice:{filamentSlotUnset:`not set`,processSettingsEmbedded:`Not used while "Use the file's built-in settings" is on -- the file's own settings drive this slice.`,processSettingsInactive:`Inactive`,presetsHidden:`{{count}} hidden`,showAllPresets:`Show all`,showFewerPresets:`Show fewer`,processSettings:`Process settings`,processSettingsHint:`Adjust the picked preset for this slice. Anything you don't touch stays as the preset defines it.`,processSettingsChanged:`{{count}} changed`,processSettingsUnchanged:`Preset defaults`,title:`Slice model`,action:`Slice`,actionAll:`Slice all {{count}} plates`,actionAllTitle:`Slice every plate into one multi-plate output (single archive). Filament selection covers every slot the project defines.`,allPlatesToggle:`Slice all {{count}} plates`,slicing:`Slicing…`,printer:`Printer profile`,process:`Process profile`,filament:`Filament profile`,filamentSlot:`Filament {{index}} ({{type}})`,filamentColour:`Filament colour`,selectPreset:`— Select a preset —`,loadingPresets:`Loading presets…`,analyzingPlateFilaments:`Analyzing plate filaments…`,analyzingPlateFilamentsHint:`Running a preview slice to discover which AMS slots this plate uses. Cached after — re-opening is instant.`,previewToast:`Analyzing {{name}} — {{elapsed}}`,previewWithProgress:`Analyzing {{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,notUsedByPlate:`— not used by this plate`,noPresetsForSlot:`No presets available`,otherPrinters:`Other printers`,presetsLoadFailed:`Failed to load presets. Open Settings → Profiles to import them first.`,refreshPresets:`Refresh`,refreshPresetsTitle:`Refresh presets — fetch the latest cloud and bundled listings (use after deleting a preset in Bambu Studio or Bambu Handy)`,allPresetsRequired:`All presets must be selected`,useEmbedded:`Use the file's built-in settings`,useEmbeddedHint:`Slice it the way the designer set it up (walls, infill, filament) instead of the profiles above. Offered because your printer matches the file's.`,autoOrient:`Auto-orient objects`,autoOrientHint:`Let the slicer turn each object onto its best printing side first. Overrides the way the model was laid down in the file.`,autoArrange:`Auto-arrange on the plate`,autoArrangeHint:`Let the slicer position the objects so they no longer overlap. Replaces the layout the file came with.`,enqueuing:`Submitting slice job…`,queued:`Queued…`,failed:`Slicing failed. Check the slicer sidecar logs.`,startedToast:`Slicing {{name}} in the background…`,queuedToast:`Queued: {{name}} — {{elapsed}}`,runningToast:`Slicing {{name}} — {{elapsed}}`,runningWithProgress:`{{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,runningWithProgressMultiPlate:`Plate {{plateIndex}} of {{plateCount}} • {{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,completedToast:`Sliced {{name}}`,externalWriteFallbackToast:`Saved to the internal library: the external folder could not be written to`,failedTitle:`Slicing failed`,failedToast:`Slicing {{name}} failed: {{detail}}`,tier:{local:`Imported`,cloud:`Bambu Cloud`,orcaCloud:`Orca Cloud`,standard:`Standard`},cloud:{notAuthenticated:`Sign in to Bambu Cloud (Settings → Profiles → Bambu Cloud) to see your cloud presets.`,expired:`Bambu Cloud session expired — sign in again to refresh your cloud presets.`,unreachable:`Bambu Cloud is unreachable right now. Local and standard presets still work.`},orcaCloud:{notAuthenticated:`Sign in to Orca Cloud (Profiles → Orca Cloud) to see your Orca presets.`,expired:`Orca Cloud session expired — sign in again to refresh your Orca presets.`,unreachable:`Orca Cloud is unreachable right now. Other presets still work.`},bedType:{label:`Build plate`,auto:`Auto (use process preset)`,coolPlate:`Cool Plate`,coolPlateSuperTack:`Cool Plate SuperTack`,engineering:`Engineering Plate`,highTemp:`High Temp Plate`,texturedPEI:`Textured PEI Plate`,smoothPEI:`Smooth PEI Plate`},filters:{onlyConnectedModels:`Only printers that are online`,onlyConnectedModelsHint:`Printer profiles for the models online right now, at every nozzle size.`,onlyLoadedSpools:`Only spools that are loaded`,onlyLoadedSpoolsHint:`Filament profiles of the spools in the online printers of the selected model. A profile you pick yourself stays.`,noneOnline:`No printer is online, so every profile is shown.`,noneLoaded:`No loaded spool has a profile for this printer, so every filament profile is shown.`,notOnline:`Not online`,notLoaded:`Not loaded`},loadedSpools:{title:`Loaded spools`,pick:`Pick`,pickTitle:`Pick a spool loaded in a connected printer`,none:`No printer of this model is online.`,nothingLoaded:`No AMS and no external spool.`,unknownSpool:`Unidentified spool`,empty:`Empty`,noProfile:`No profile for the selected printer`,noProfileShort:`No profile for this printer`},pipelines:{label:`Pipeline`,applyAria:`Apply pipeline`,applyPrompt:`Apply pipeline…`,empty:`No saved pipelines`,saveButton:`Save as pipeline`,saveTitle:`Save the current four-slot selection as a reusable pipeline`,namePlaceholder:`Pipeline name`,nameAria:`New pipeline name`,toast:{applied:`Applied "{{name}}"`,saved:`Pipeline saved`,saveFailed:`Save failed`}}},spoolman:{title:`Spoolman Integration`,enabled:`Spoolman Enabled`,url:`Spoolman URL`,connected:`Connected`,disconnected:`Not Connected`,testConnection:`Test Connection`,sync:`Sync`,syncing:`Syncing...`,lastSync:`Last Sync`,linkToSpoolman:`Link to Spoolman`,openInSpoolman:`Open in Spoolman`,unlinkSpool:`Unlink Spool`,unlinkConfirmTitle:`Unassign Spool?`,unlinkConfirmMessage:`This will remove the spool from this slot. The spool data itself will remain unchanged.`,selectSpool:`Select Spool`,noUnlinkedSpools:`No unassigned spools available`,linkSuccess:`Spool assigned successfully`,linkFailed:`Failed to assign spool`,unlinkSuccess:`Spool unassigned successfully`,unlinkFailed:`Failed to unassign spool`,linkedSpool:`Assigned spool`,spoolId:`Spool ID`,fillSourceLabel:`(Spoolman)`,weight:`Weight`,remaining:`Remaining`,disableWeightSync:`Disable AMS Estimated Weight Sync`,disableWeightSyncDesc:`Don't update remaining capacity from AMS estimates. Use this if you prefer Spoolman's usage tracking over AMS percentage-based estimates. New spools will still use the AMS estimate as their initial weight.`,reportPartialUsage:`Report Partial Usage for Failed Prints`,reportPartialUsageDesc:`When a print fails or is cancelled, report the estimated filament used up to that point based on layer progress.`},locations:{title:`Storage Locations`,subtitle:`Manage shelves, drawers, and other physical storage spots for your spools`,add:`Add Location`,addShort:`Add`,edit:`Edit Location`,name:`Name`,spools:`Spools`,sensors:`Sensors`,empty:`No storage locations yet. Create your first shelf or drawer.`,manage:`Locations`,createPlaceholder:`e.g. Shelf A, Drawer 1`,nameRequired:`Location name is required`,created:`Location created`,updated:`Location updated`,deleted:`Location deleted`,saveFailed:`Failed to save location`,deleteFailed:`Failed to delete location`,deleteBlocked:`Remove all spools from this location before deleting`,confirmDelete:`Delete "{{name}}"?`,confirmDeleteMessage:`This location will be removed from the catalog. Spools must be moved first.`,confirmDeleteMessageWithSensors:`This location will be removed from the catalog. Spools must be moved first. Connected sensors will also be deleted.`},inventory:{title:`Spool Inventory`,subtitle:`Manage your spools`,addToInventory:`Add to Inventory`,addToInventoryPending:`Adding...`,addToInventorySuccess:`Spool added to inventory`,addToInventoryFailed:`Failed to add spool to inventory`,unknownSpoolTitle:`New filament detected`,unknownSpoolMessage:`A spool with an unknown RFID tag was detected at {{location}}. Add it to your inventory now?`,unknownSpoolSlot:`Slot`,bulk:{selectAllVisible:`Select all visible`,selectRow:`Select row`,selectGroup:`Select group`,selectionCount:`{{count}} selected`,edit:`Edit`,printLabels:`Print labels`,resetUsage:`Reset usage`,restore:`Restore`,archive:`Archive`,delete:`Delete`,clearSelection:`Clear selection`,editTitle:`Bulk edit spools`,editSubtitle:`Applies to {{count}} selected spools. Only fields you tick get updated.`,editHint:`Type into a field to mark it for update — only ticked rows are sent. Leaving a field empty leaves the spools unchanged (clearing fields is per-spool only).`,useCustom:`Use "{{value}}"`,toggleField:`Toggle update for this field`,changeCount:`{{count}} fields will be updated.`,applyPending:`Applying...`,applyButton:`Apply to {{count}} spools`,deleteTitle:`Delete selected spools`,archiveTitle:`Archive selected spools`,restoreTitle:`Restore selected spools`,resetUsageTitle:`Reset usage on selected spools`,deleteMessage:`Permanently delete {{count}} spools? This cannot be undone.`,archiveMessage:`Archive {{count}} spools? They can be restored later.`,restoreMessage:`Restore {{count}} archived spools?`,resetUsageMessage:`Reset the "Total Consumed" counter on {{count}} spools? Remaining weight is preserved.`,updateSuccess:`{{count}} spools updated`,updateFailed:`Bulk update failed`,updatePartial:`{{ok}} spools updated, {{failed}} failed`,updateAllFailed:`All {{count}} spool updates failed — selection kept so you can retry`,deleteSuccess:`{{count}} spools deleted`,deleteFailed:`Bulk delete failed`,deletePartial:`{{ok}} spools deleted, {{failed}} failed`,deleteAllFailed:`All {{count}} spool deletions failed — selection kept so you can retry`,archiveSuccess:`{{count}} spools archived`,archiveFailed:`Bulk archive failed`,archivePartial:`{{ok}} spools archived, {{failed}} failed`,archiveAllFailed:`All {{count}} spool archives failed — selection kept so you can retry`,restoreSuccess:`{{count}} spools restored`,restoreFailed:`Bulk restore failed`,restorePartial:`{{ok}} spools restored, {{failed}} failed`,restoreAllFailed:`All {{count}} spool restores failed — selection kept so you can retry`,invalidHex:`Enter 6 hex characters (RRGGBB) or 8 (RRGGBBAA). The field will not be applied otherwise.`},spoolmanMixedContentTitle:`Spoolman can't load over HTTPS — mixed-content blocked by your browser`,spoolmanMixedContentBody:`Bambuddy is served over HTTPS (via your reverse proxy), but your Spoolman URL is still plain HTTP. Browsers block mixed content for security, so the embedded Spoolman UI can't render. Spoolman needs to be reachable over HTTPS for this to work.`,spoolmanMixedContentFixReverseProxy:`Put Spoolman behind the same reverse proxy as Bambuddy (Traefik / Nginx / Caddy) with HTTPS, then update the Spoolman URL in Settings to the new HTTPS address.`,spoolmanMixedContentFixOpenNewTab:`As a workaround, open Spoolman in a new browser tab over HTTP — mixed-content rules only apply to embedded frames, so a standalone tab still works.`,spoolmanOpenInNewTab:`Open Spoolman in a new tab`,labels:{title:`Print spool labels`,selectedCount:`{{count}} selected`,pickSpools:`Pick which spools to print labels for:`,monochrome:`Monochrome (black & white printer)`,monochromeHint:`Drops the colour swatch and widens the text`,startingPosition:`Starting label position`,startingPositionInvalid:`Enter a whole number from 1 to {{capacity}}.`,startingPositionFirst:`Printing starts at position 1.`,startingPositionSkipped:`Positions 1 through {{lastPosition}} will be left blank on the first sheet.`,searchPlaceholder:`Search name, brand, or #ID`,filterByMaterial:`Material:`,allMaterials:`All`,selectVisible:`Select all visible ({{count}})`,deselectVisible:`Deselect visible`,clearAll:`Clear all`,noSpoolsToShow:`No spools to show. Adjust your filter and try again.`,noMatches:`No spools match the current search or filter.`,printOne:`Print label for this spool`,printLabels:`Print labels…`,bulkTitle:`Pick spools to print labels for from the {{count}} currently shown`,noSpoolsTitle:`No spools to label`,error:`Could not generate labels: {{msg}}`,template:`Label size`,preview:`Preview`,previewOf:`Preview of #{{id}}`,previewNoSelection:`Select a spool to see its label.`,previewError:`Could not render the preview: {{msg}}`,previewAlt:`Label preview`,previewHint:`Lines that don't fit on this label size are left out.`,content:`Print on the label`,resetFields:`Reset to default`,format:`Output:`,dpi:`Resolution`,pngHint:`For label printer software that takes images. Match your printer's resolution; several labels come as a ZIP.`,createPdf:`Create PDF`,downloadPng:`Download PNG`,selectedTitle:`Print labels for the {{count}} selected spools`,fields:{brand:`Brand`,material:`Material and subtype`,hex:`Colour code`,name:`Colour or filament name`,location:`Storage location`,materialNumber:`Material number`,temps:`Nozzle temperature`,weight:`Net weight`,note:`Note`,added:`Date added`,qr:`QR code`,spoolId:`Spool ID`},sortBy:{label:`Sort:`,id:`By ID`,color:`By colour`},templates:{amsHolderSmall:{label:`AMS holder — small (74 × 33 mm)`,hint:`Single label per page; matches the printable label from MakerWorld model 752566 (AMS Filament Label Holder).`},amsHolderLarge:{label:`AMS holder — large (75 × 55 mm)`,hint:`Single label per page; fits the cardstock-insert variant of the AMS Filament Label Holder. Roomy enough for swatch, brand, material, ID, and QR code.`},box40x30:{label:`Box label (40 × 30 mm)`,hint:`Single label per page; common DK/Brother roll size, good for filament-bag and storage-bin labels.`},box:{label:`Box label (62 × 29 mm)`,hint:`Single label per page; sized for Brother PT/QL and Dymo small labels.`},averyL7160:{label:`Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)`,hint:`EU sheet stock; 21 labels per A4 page.`},avery5160:{label:`Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)`,hint:`US sheet stock; 30 labels per Letter page.`}}},csv:{importButton:`Import CSV`,exportButton:`Export CSV`,modalTitle:`Import spools from CSV`,selectFile:`Choose a CSV file or drag it here`,dragHint:`Header: material (required), brand, subtype, color_name, rgba, …`,parsing:`Reading file…`,previewError:`Could not read the CSV file`,validCount:`{{count}} valid`,errorCount:`{{count}} error`,skippedCount:`{{count}} skipped`,colRow:`Row`,colStatus:`Status`,colColor:`Color`,colorResolved:`Color filled from catalog`,colorCrossMaterial:`Color taken from a different material — no exact match in catalog`,duplicateExisting:`A spool with this material, brand and color already exists — it will still be imported as a new spool`,spoolmanHint:`In Spoolman mode, use Spoolman's built-in CSV import/export.`,importValidRows:`Import {{count}} valid rows`,noValidRows:`No valid rows`,importing:`Importing…`,importSuccess:`{{count}} spools imported`,importError:`Import failed`,exportError:`Export failed`},addSpool:`Add Spool`,editSpool:`Edit Spool`,copySpool:`Copy Spool`,material:`Material`,selectMaterial:`Select material...`,subtype:`Subtype`,brand:`Brand`,searchBrand:`Search brand...`,useCustomBrand:`Use "{{brand}}"`,useCustomMaterial:`Use custom material: {{material}}`,suggestedOptions:`Suggested`,allOptions:`All`,colorName:`Color Name`,colorNamePlaceholder:`Jade White, Fire Red...`,color:`Color`,hexColor:`Hex Color`,pickColor:`Pick custom color`,labelWeight:`Label Weight`,coreWeight:`Empty Spool Weight`,searchSpoolWeight:`Search spool weight...`,weightUsed:`Used`,currentWeight:`Remaining Weight`,measuredWeight:`Measured Weight`,spoolName:`Spool`,costPerKg:`Cost per kg`,storageLocation:`Storage Location`,temperature:`Temperature`,humidity:`Humidity`,battery:`Battery`,storageLocationPlaceholder:`e.g. Shelf A, Drawer 1`,openInInventory:`Open in Inventory`,measuredWeightError:`Measured weight must be between {{min}}g and {{max}}g.`,slicerFilament:`Slicer Filament`,slicerFilamentName:`Slicer Preset Name`,slicerPreset:`Slicer Preset`,searchPresets:`Search filament presets...`,selectedPreset:`Selected`,noPresetsFound:`No presets found`,tempOverrides:`Temperature Overrides`,note:`Note`,notePlaceholder:`Any additional notes about this spool...`,category:`Category`,categoryPlaceholder:`e.g. Production, Prototype, Client A`,categoryNone:`Uncategorized`,storageLocationNone:`No location set`,lowStockThresholdOverride:`Low-stock threshold (this spool)`,lowStockThresholdOverrideHelp:`Leave blank to use the global threshold ({{global}}%).`,materialNumber:`Material No.`,materialNumberPlaceholder:`e.g. 15`,materialNumberHelp:`Internal purchasing number — shared by all spools of this product. New spools of the same product inherit it.`,lastDried:`Last dried`,lastDriedNow:`Now`,lastDriedHelp:`Filled in when an AMS drying run of at least half its length ends. Set it here for a spool dried elsewhere.`,materialNumberNone:`No material number`,suppliers:{label:`Suppliers`,none:`No supplier`,addSupplier:`Add supplier…`,searchPlaceholder:`Search suppliers…`,noneLeft:`All suppliers are already assigned`,createNew:`Create "{{name}}"`,createFailed:`Failed to create supplier`,purchaseSource:`Bought here`,purchaseSourceHelp:`Marks where this spool was actually purchased; the other entries are alternative sources.`,articleNumberPlaceholder:`Supplier article no.`,pricePlaceholder:`Quoted price/kg`,priceHelp:`Quoted price at this supplier, for comparing sources — the spool's own cost per kg stays the cost basis.`,help:`Where this product can be bought. The highlighted entry is where this spool was purchased.`,saveFailed:`Failed to save supplier assignments`,title:`Suppliers`,description:`Manage where you buy filament — distinct from brand, which is who made it. Assign suppliers to spools in the spool dialog; a supplier that is still assigned to spools cannot be deleted.`,search:`Search suppliers...`,addNew:`Add new supplier`,namePlaceholder:`Name (e.g. Filament24)`,websitePlaceholder:`Website / shop URL`,customerNumberPlaceholder:`Customer no.`,notePlaceholder:`Note`,nameRequired:`Name is required`,duplicateName:`A supplier with this name already exists`,customerNumber:`Customer no.`,spools:`Spools`,noMatch:`No suppliers match your search`,empty:`No suppliers yet`,added:`Supplier added`,addFailed:`Failed to add supplier`,updated:`Supplier updated`,updateFailed:`Failed to update supplier`,deleted:`Supplier deleted`,deleteFailed:`Failed to delete supplier`,deleteBlocked:`Cannot delete: still assigned to {{count}} spool(s)`,loadFailed:`Failed to load suppliers`,deleteTitle:`Delete Supplier`,deleteConfirm:`Delete "{{name}}"?`,deleteConfirmReferenced:`"{{name}}" is assigned to {{count}} spool(s). Deleting is blocked until those assignments are removed.`},clearRfid:`Clear RFID Tag`,rfidCleared:`RFID tag cleared`,archive:`Archive`,restore:`Restore`,noSpools:`No spools yet. Add your first spool to get started.`,noAvailableSpools:`No spools available. Add a spool to your inventory or unassign one from another slot first.`,kProfiles:`K-Profiles`,addKProfile:`Add K-Profile`,assignSpool:`Assign Spool`,unassignSpool:`Unassign`,assignSuccess:`Spool assigned and AMS slot configured`,assignPendingInsert:`Assigned. Slot will configure when you insert the spool.`,assignFailed:`Failed to assign spool`,selectSpool:`Select a spool to assign to this slot`,assigned:`Assigned`,assigning:`Assigning...`,searchSpools:`Search spools...`,showAllSpools:`Show all spools`,spoolmanSpools:`Spoolman Spools`,allMaterials:`All Materials`,filterByBrand:`Filter by brand...`,showArchived:`Show archived`,quickAdd:`Quick Add (Stock)`,quantity:`Quantity`,stock:`Stock`,configured:`Configured`,spoolsCreated:`{{count}} spools created`,spoolsPartiallyCreated:`{{created}} of {{total}} spools created (some failed)`,spoolCreated:`Spool created`,spoolUpdated:`Spool updated`,spoolDeleted:`Spool deleted`,deepLinkSpoolNotFound:`Spool not found`,deepLinkFetchFailed:`Could not load spool — try again`,spoolArchived:`Spool archived`,spoolRestored:`Spool restored`,kProfileSaveFailed:`K-profile settings could not be saved`,syncWeightSpoolNotFound:`Spool not found — it may have been deleted`,syncWeightSpoolmanUnreachable:`Spoolman is unreachable — try again later`,syncWeightFailed:`Failed to sync weight`,spoolmanUnreachable:`Spoolman is not reachable — please try again later`,deleteSpoolNotFound:`Spool not found — it may have already been deleted`,deleteFailed:`Failed to delete spool`,archiveSpoolNotFound:`Spool not found — it may have already been deleted`,archiveFailed:`Failed to archive spool`,restoreSpoolNotFound:`Spool not found — it may have already been deleted`,restoreFailed:`Failed to restore spool`,saveFailed:`Failed to save changes`,tagClearFailed:`Failed to clear tag`,deleteConfirm:`Are you sure you want to delete this spool? This cannot be undone.`,archiveConfirm:`Are you sure you want to archive this spool?`,advancedSettings:`Advanced Settings`,filamentInfoTab:`Filament Info`,paProfileTab:`PA Profile`,colorAndCostTab:`Color & Cost`,printersTab:`Printers`,filamentInfo:`Filament`,additional:`Additional`,loadingPresets:`Loading cloud presets...`,cloudConnected:`Cloud connected`,cloudNotConnected:`Cloud not connected (using defaults)`,recentColors:`Recent`,searchColors:`Search colors...`,searchResults:`Search results`,allColors:`All colors`,commonColors:`Common colors`,showLess:`Show less`,showAll:`Show all`,noColorsFound:`No colors match your search`,noResults:`No matches found`,extraColorsLabel:`Extra colors`,extraColorsPlaceholder:`EC984C,#6CD4BC,A66EB9,D87694`,extraColorsHint:`Paste 2 to 8 hex stops, separated by commas. Renders as a gradient.`,extraColorsInvalid:`Ignored invalid hex: {{tokens}}`,colorEffectLabel:`Effect`,colorEffect:{none:`None`,sparkle:`Sparkle`,wood:`Wood`,marble:`Marble`,glow:`Glow`,matte:`Matte`,silk:`Silk`,galaxy:`Galaxy`,rainbow:`Rainbow`,metal:`Metal`,translucent:`Translucent`,gradient:`Gradient`,dualColor:`Dual Color`,triColor:`Tri Color`,multicolor:`Multicolor`},selectMaterialFirst:`Please select a material first in the Filament Info tab.`,noPrintersConfigured:`No printers configured. Add printers to use PA profiles.`,matchingFilter:`Matching`,anyBrand:`Any brand`,anyVariant:`Any variant`,autoSelect:`Auto-select`,matches:`matches`,match:`match`,noMatches:`No matches`,connected:`Connected`,offline:`Offline`,printerOffline:`Printer is offline. Connect to view calibration profiles.`,noKProfilesMatch:`No K-profiles match the selected filament.`,leftNozzle:`Left Nozzle`,rightNozzle:`Right Nozzle`,profilesSelected:`calibration profile(s) selected`,filamentPreset:`Filament preset`,presetUseSpoolDefault:`Use the spool's preset`,presetInherited:`inherited`,presetOverride:`override`,presetNeedsModel:`This printer has not reported its model yet, so it cannot have its own preset.`,autoMatchPresets:`Auto-match`,autoMatchPresetsHint:`Find the variant of this spool's preset that names each model`,kProfilesPerPrinter:`K profiles`,kProfileNotSet:`Not set`,kProfileFlowMismatch:`This profile was measured on a {{profile}} nozzle but a {{fitted}} nozzle is fitted, so it will not be applied`,nozzle:`Nozzle`,unknownModel:`Unknown model`,onePrinter:`1 printer`,nPrinters:`{{n}} printers`,filamentPresetsLoadFailed:`Could not load this spool's per-model presets`,filamentPresetSaveFailed:`Could not save the per-model presets`,totalInventory:`Total Inventory`,totalConsumed:`Total Consumed`,byMaterial:`By Material`,inPrinter:`In Printer`,lowStock:`Low Stock`,sinceTracking:`Since tracking started`,resetConsumedCounter:`Reset counter`,resetConsumedCounterTooltip:`Zero the consumed-grams counter for this spool. Remaining weight is not changed.`,resetConsumedCounterConfirm:`Reset this spool's consumed-grams counter to 0? Future prints will track from zero again. The spool itself, its remaining weight calculation, and your settings are not changed.`,resetAllConsumedCounters:`Reset all counters`,resetAllConsumedCountersTooltip:`Zero the consumed-grams counter on every spool. Remaining weights are not changed.`,resetAllConsumedCountersConfirm:`Reset the consumed-grams counter to 0 on all {{count}} spools (archived ones included)? This clears the "Total Consumed" stat so future prints track from zero. Spools and remaining weights are not changed.`,consumedCounterReset:`Counter reset`,allConsumedCountersReset:`Counter reset for {{count}} spool(s)`,resetConsumedCounterFailed:`Failed to reset counter`,loadedInAms:`Loaded in AMS/Ext`,remaining:`Remaining`,weightCheck:`Weight Check`,lastWeighed:`Last weighed`,neverWeighed:`Never weighed`,search:`Search spools...`,showing:`Showing`,to:`to`,of:`of`,show:`Show`,spools:`spools`,spool:`spool`,page:`Page`,noSpoolsMatch:`No results found`,noSpoolsMatchDesc:`Try adjusting your search or filters to find what you're looking for.`,active:`Active`,archived:`Archived`,all:`All`,used:`Used`,new:`New`,clearFilters:`Clear filters`,table:`Table`,cards:`Cards`,net:`Net`,groupSimilar:`Group`,groupedSpools:`{{count}} identical spools`,groupedRows:`rows`,columns:`Columns`,configureColumns:`Configure Columns`,configureColumnsDesc:`Drag to reorder columns or use arrows. Toggle visibility with the eye icon.`,visible:`visible`,reset:`Reset`,cancel:`Cancel`,applyChanges:`Apply Changes`,moveUp:`Move up`,moveDown:`Move down`,hideColumn:`Hide column`,showColumn:`Show column`,linkToSpool:`Link to Spool`,tagLinked:`Tag linked to spool`,tagLinkFailed:`Failed to link tag`,tagAlreadyLinked:`Tag already linked to spool #{{id}}`,unknownTag:`Unknown RFID tag detected`,usageHistory:`Usage History`,noUsageHistory:`No usage recorded yet`,printName:`Print Name`,weightConsumed:`Weight Consumed`,clearHistory:`Clear`,historyCleared:`Usage history cleared`,fillSourceLabel:`(Inv)`,lowStockThresholdError:`Threshold must be between 0.1 and 99.9`,assignMismatchTitle:`Material mismatch`,assignMismatchMessage:`The selected spool material "{{spoolMaterial}}" does not match the tray material "{{trayMaterial}}" for {{location}}. Assign anyway?`,assignMismatchConfirm:`Assign Anyway`,assignPartialMismatchMessage:`The spool material "{{spoolMaterial}}" is similar to but not exactly matching "{{trayMaterial}}" in {{location}}. Do you want to proceed?`,assignProfileMismatchMessage:`The spool profile "{{spoolProfile}}" does not match the tray profile "{{trayProfile}}" in {{location}}. Do you want to proceed?`,assignReconfigureNote:`The AMS slot will be reconfigured to use the spool's profile.`,spoolmanFilamentCatalog:`Spoolman Filament Catalog`,pickFromSpoolmanCatalog:`Pick from Spoolman catalog…`,spoolmanFilamentSelected:`Filament selected from Spoolman catalog`,spoolmanFilamentUnlinked:`Filament catalog link cleared`,noSpoolmanFilaments:`No filaments found in Spoolman catalog`,spoolmanFilamentColorSwatch:`Filament color`,spoolmanCatalogLoadFailed:`Failed to load Spoolman filament catalog`},timelapse:{title:`Timelapse`,create:`Create Timelapse`,download:`Download`,delete:`Delete`,preview:`Preview`,frameRate:`Frame Rate`,quality:`Quality`,processing:`Processing...`,noTimelapses:`No timelapses available`},ams:{title:`AMS`,slot:`Slot`,empty:`Empty`,emptySlot:`Empty slot`,slotEmpty:`Empty`,slotUnconfigured:`?`,emptySlotReset:`No filament assigned`,unknown:`Unknown`,humidity:`Humidity`,temperature:`Temperature`,filamentType:`Filament Type`,filamentColor:`Color`,remaining:`Remaining`,history:`AMS History`,noHistory:`No history available`,configureSlot:`Configure Slot`,externalSpool:`External Spool`,profile:`Profile`,kFactor:`K Factor`,kFactorShort:`K`,fill:`Fill`,configure:`Configure`,used:`used`,remainingUnit:`remaining`},printModal:{variants:{editNote:`These alternatives were set when the job was queued. Cancel and re-queue to change them.`,title:`Printer alternatives`,help:`One job, one queue slot. The first matching printer to free up runs its file.`,unknownModel:`Unknown model`,plateFor:`Plate for {{filename}}`,moveUp:`Move up`,moveDown:`Move down`,queued:`Queued with {{count}} alternatives`},selectPrinter:`Select Printer`,selectPlate:`Select Plate`,filamentMapping:`Filament Mapping`,useArchiveMapping:`Mapping`,useArchiveMappingTooltip:`Select every slot from the AMS mapping saved with this archive (from the slicer), instead of matching by type/color.`,clickToChangeSlot:`Click to change slot assignment`,reRead:`Re-read`,plateN:`Plate {{n}}`,plateFilamentsUnreadable:`The filaments of a selected plate could not be read, so it can't be mapped. Deselect it to queue the others.`,totalCost:`Total cost:`,slotRemainingShort:` - {{grams}}g left`,printSettings:`Print Settings`,bedLeveling:`Bed Leveling`,flowCalibration:`Flow Calibration`,vibrationCalibration:`Vibration Calibration`,layerInspection:`First Layer Inspection`,timelapse:`Timelapse`,cancel:`Cancel`,noPrintersAvailable:`No printers available`,printerBusy:`Printer is busy`,printerOffline:`Printer is offline`,sameTypeDifferentColor:`Same type, different color`,filamentTypeNotLoaded:`Filament type not loaded`,statusReady:`Ready`,statusColorMismatch:`Color mismatch`,statusTypeNotFound:`Type not found`,requiredTooltip:`Required: {{name}} - {{color}}`,manuallySelected:`Manually selected`,autoMatched:`Auto-matched`,selectSlot:`Select slot`,exactColorMatch:`Exact colour match`,slotForFilament:`Printer slot for {{name}}`,overrideForFilament:`Filament override for {{name}}`,sameTypeDifferentColorDetail:`Same type, different color: needs {{required}}, slot has {{loaded}}`,requiredTypeNotInPrinter:`Required filament type not found in printer.`,whenToPrint:`When to print`,asap:`ASAP`,queue:`Queue`,schedule:`Schedule`,dateTime:`Date & Time`,invalidDateTime:`Please enter a valid date and time`,openCalendar:`Open calendar`,requireManualStart:`Require manual start`,awaitingReviewNote:`Your print waits for review: it starts once someone who manages the queue starts it.`,requirePreviousSuccess:`Only start if previous print succeeded`,autoOffAfter:`Power off printer when done`,helpAsap:`Print will be added to the top of the queue and start as soon as an eligible printer is idle.`,helpSchedule:`Print will start at the scheduled time if the printer is idle. If busy, it will wait until the printer becomes available.`,helpQueue:`Print will be added to the back of the queue.`,leftNozzle:`L`,rightNozzle:`R`,leftNozzleTooltip:`Left nozzle`,rightNozzleTooltip:`Right nozzle`,ftsSameInletHint:`All filaments for this print are on Filament Track Switch IN-{{inlet}}. Switching between filaments on the same inlet is slower — move one to an AMS on the other inlet to speed it up.`,rackPosition:`Rack position`,rackPositionTooltip:`Which nozzle on the rack prints this filament. Positions are numbered as on the printer.`,rackEmptyPosition:`This rack position is empty`,rackWrongNozzle:`Holds a {{has}} nozzle; this filament needs {{needs}}`,filamentOverride:`Filament Override`,filamentOverrideHint:`Optionally override filaments for model-based assignment. The scheduler will match against your selected filaments instead of the original 3MF values.`,originalFilament:`Original`,overrideWith:`Override with`,resetToOriginal:`Reset to original`,insufficientFilamentTitle:`Not enough filament`,waitingForAmsStatus:`Waiting for AMS status from {{printer}}…`,insufficientFilamentMessage:`Some assigned spools have less filament remaining than this print needs:`,insufficientFilamentLine:`{{printer}} - {{slot}}: needs {{required}}g, remaining {{remaining}}g`,insufficientFilamentLinePooled:`{{printer}} - {{slot}}: needs {{required}}g, {{remaining}}g available across matching spools (AMS Filament Backup)`,printAnyway:`Print anyway`,forceColorMatch:`Force color match`,staggerPrinterStarts:`Stagger printer starts`,staggerGroupSize:`Group size`,staggerInterval:`Interval (min)`,staggerPreview:`{{printers}} printers → {{groups}} groups of {{size}}, starting every {{interval}} min`,staggerLastGroup:`last group: {{count}}`,staggerTotal:`total: {{minutes}} min`,staggerToPrinters:`Stagger to {{count}} printers`,gcodeInjection:`Inject auto-print G-code`,insufficientBudget:`Insufficient Budget`,unlimitedNoBudget:`Unlimited – no budget limit is set.`,noPrintableCostCenters:`No active cost center is available for printing. Ask an administrator to grant you print access.`,askForOutcome:`Ask for Outcome`,askForOutcomeTitle:`Ask how the print came out after it completes`},backup:{includesEncryptionKey:`Local backups include the MFA encryption key file (DATA_DIR/.mfa_encryption_key) so a backup ZIP is self-contained. Treat the ZIP as sensitive — anyone with the file can decrypt the OIDC client secrets and TOTP secrets stored inside.`,title:`Backup & Restore`,createBackup:`Create Backup`,restoreBackup:`Restore Backup`,restoreDescription:`Replace all data from a backup file`,downloadBackup:`Download Backup`,uploadBackup:`Upload Backup`,lastBackup:`Last Backup`,autoBackup:`Auto Backup`,backupNow:`Backup Now`,restoreWarning:`Warning: Restoring a backup will overwrite all current data.`,includeArchives:`Include Archives`,includeSettings:`Include Settings`,includeProfiles:`Include Profiles`,backupSuccess:`Backup created successfully`,restoreSuccess:`Backup restored successfully`,backupFailed:`Backup failed`,restoreFailed:`Restore failed`,restoreNote:`Virtual Printer will be stopped during restore`,githubBackup:`Git Backup`,enabled:`Enabled`,cloudLoginRequired:`Bambu Cloud login required. Sign in under Profiles → Cloud Profiles to enable GitHub backup.`,cloudLoginRequiredShort:`Cloud login required`,githubDescription:`Automatically sync your profiles to a private GitHub repository for backup and version history.`,repoIsPrivate:`Repository is private — safe to back up to.`,repoIsPublicWarning:`Repository is PUBLIC. Bambuddy backups include MQTT credentials, Home Assistant tokens, Prometheus tokens, your Bambu Cloud email, and printer access codes via K-profiles. Saving is blocked until you make the repository private in your provider's settings.`,repoVisibilityUnknown:`Could not determine repository visibility. Bambuddy refuses to back up to anything not confirmed private; saving will be blocked.`,repositoryUrl:`Repository URL`,repoUrlPlaceholderGitHub:`https://github.com/username/repo-name`,repoUrlPlaceholderGitea:`https://gitea.example.com/username/repo-name`,repoUrlPlaceholderForgejo:`https://forgejo.example.com/username/repo-name`,repoUrlPlaceholderGitLab:`https://gitlab.com/username/repo-name`,allowInsecureHttp:`Allow insecure HTTP`,allowInsecureHttpHint:`Enable for self-hosted instances on private networks without TLS`,personalAccessToken:`Personal Access Token`,tokenSaved:`(saved)`,enterNewToken:`Enter new token to update`,tokenHintGitHub:`Fine-grained token with Contents read and write access, or a classic token with the repo scope.`,tokenHintGitLab:`Token with the api scope, or read_repository and write_repository together.`,tokenHintGitea:`Token with the write:repository scope.`,tokenHintForgejo:`Token with the write:repository scope. A token limited to this one repository is enough.`,branch:`Branch`,provider:`Git Provider`,providerGitHub:`GitHub`,providerGitLab:`GitLab`,providerGitea:`Gitea`,providerForgejo:`Forgejo`,manualOnly:`Manual only`,hourly:`Hourly`,daily:`Daily`,weekly:`Weekly`,includeInBackup:`Include in backup`,kProfiles:`K-Profiles`,kProfilesDescription:`Pressure advance calibration from connected printers`,noPrintersConnected:`No printers connected`,printersConnected:`{{connected}}/{{total}} connected`,cloudProfiles:`Cloud Profiles`,cloudProfilesDescription:`Filament, printer, and process presets from Bambu Cloud and Orca Cloud`,cloudProfilesAccounts:`Connected accounts — Bambu Cloud: {{bambu}}, Orca Cloud: {{orca}}`,appSettings:`App Settings`,appSettingsDescription:`Bambuddy configuration (complete database)`,spoolInventory:`Spool Inventory`,spoolInventoryDescription:`Filament spools, usage history, and cost tracking`,printArchives:`Print Archives`,printArchivesDescription:`Print history metadata (no gcode/3MF files)`,lastBackupAt:`Last backup:`,noBackupsYet:`No backups yet`,next:`Next:`,startingBackup:`Starting backup...`,test:`Test`,enableBackup:`Enable Backup`,testConnection:`Test Connection`,enterRepoUrl:`Enter repository URL`,enterRepoAndToken:`Enter repository URL and access token`,repoRequired:`Repository URL is required`,tokenRequired:`Access token is required`,githubBackupEnabled:`GitHub backup enabled`,tokenUpdated:`Token updated`,settingsSaved:`Settings saved`,failedToSave:`Failed to save: {{message}}`,backupCompleteFiles:`Backup complete - {{count}} files updated`,backupSkippedNoChanges:`Backup skipped - no changes`,backupFailed2:`Backup failed: {{message}}`,clearedLogs:`Cleared {{count}} logs`,failedToClearLogs:`Failed to clear logs: {{message}}`,restoreFromGit:{button:`Restore from Git`,title:`Restore from Git Backup`,subtitle:`Pick a commit and choose what to restore`,commitLabel:`Backup commit`,latestCommit:`Latest backup (branch tip)`,categoriesLabel:`What to restore`,inspecting:`Reading backup contents...`,itemCount:`{{count}} in backup`,overwriteLabel:`Overwrite existing entries`,overwriteOn:`Existing entries will be updated from the backup.`,overwriteOff:`Only missing entries are added; existing ones are left untouched.`,selectedCount:`{{count}} selected`,restoring:`Restoring...`,confirmTitle:`Restore from backup?`,confirmMessage:`The selected categories will be restored from this commit. Missing entries are added; existing entries stay as they are.`,confirmMessageOverwrite:`The selected categories will be restored from this commit, overwriting entries that already exist locally. This cannot be undone.`,kprofilesOverwriteCaveat:`K-profiles are the exception: writing a slot always replaces the calibration on the printer.`,tally:`{{restored}} restored, {{skipped}} skipped, {{failed}} failed`,reloadHint:`Reload Bambuddy so the restored data appears everywhere.`,partialHint:`The categories listed above finished and are on disk. Any that are missing did not run.`,failed:`Restore failed.`,loadFailed:`Could not read the backup repository.`,details:{notPresent:`Not present in this backup commit`,unreadableJson:`Unreadable JSON: {{paths}}`,settingsNoPayload:`No settings in payload`,settingsCredentialsWillSkip:`{{count}} credential-like key(s) will be skipped`,settingsCompanionWillSkip:`{{count}} credential-like key(s) will be skipped, and {{companion}} switch(es) that depend on them will be left off`,settingsCompanionOnlyWillSkip:`{{companion}} switch(es) will be left off - the credential each one needs cannot be restored from a backup`,spoolsUsageCount:`including {{count}} usage record(s)`,archivesMetadataOnly:`Metadata only - 3MF files and thumbnails are not in a Git backup`,kprofilesPrinterCount:`across {{count}} printer(s)`},notes:{noData:`No data of this kind in this backup`,archivesPrinterMissing:`Some archives referenced printers that no longer exist - link cleared`,archivesProjectMissing:`Some archives referenced projects that no longer exist - link cleared`,archivesOwnerCleared:`Some archives referenced users that no longer exist - owner cleared, so they are visible only to users with the archives:read_all permission until an admin reassigns them`,archivesOwnerUnmatched:`Some archives name an owner this instance does not have - owner cleared rather than guessed from the backup's user id, so they are visible only to users with the archives:read_all permission until an admin reassigns them`,archivesOwnerUnknown:`Some archives were restored without an owner - this backup does not record one, so they are visible only to users with the archives:read_all permission until an admin reassigns them`,archivesUndeleted:`Archive(s) deleted since the backup are visible again - overwrite was on`,archivesMetadataOnly:`Restored archives carry metadata only - the 3MF and thumbnail files are not in a Git backup`,spoolUsageUnresolved:`{{count}} usage record(s) skipped - their spool is not in this backup's spool list, so there is nothing to attach them to.`,spoolUsageUnlinked:`{{count}} usage record(s) restored without their print-history link - select Print archives alongside Spool inventory to keep it.`,spoolTagKept:`{{count}} spool tag(s) left as they are - the backup would have cleared a tag that has since been scanned, or moved one onto a second spool.`,settingsCredentialsSkipped:`{{count}} credential-like key(s) skipped - re-enter secrets manually`,settingsAuthSkipped:`{{count}} authentication setting(s) skipped - change those in Settings > Authentication so the lockout checks still run`,settingsCompanionSkipped:`{{keys}} left switched off - the credential each one needs cannot be restored from a backup and this instance has none stored, so switching them on would leave the integration unauthenticated`,settingsMqttRelayFailed:`MQTT settings restored, but the relay could not be reconnected - restart Bambuddy`,kprofilesAlwaysOverwrite:`K-profiles always overwrite the matching slot on the printer`,kprofilesAckUnreliable:`A printer that does not answer still counts as restored - verify the profiles on the printer`,kprofilesPrinterMissing:`No printer with serial {{serial}} - skipped`,kprofilesPrinterOffline:`{{printer}} ({{serial}}) is not connected - skipped`,kprofilesUnknownNozzle:`Unexpected nozzle diameter {{nozzle}} for {{serial}} - sent as-is`,kprofilesUnmatched:`{{count}} profile(s) for {{nozzle}} had no counterpart on {{printer}} - added as new profiles`,kprofilesSendFailed:`Failed to send {{nozzle}} profiles to {{printer}} ({{serial}})`,kprofilesRefused:`{{printer}} ({{serial}}) refused the {{nozzle}} profiles: {{reason}}`,kprofilesStepFailed:`The K-profile step could not be completed - {{reason}}. Anything restored before it is still saved.`}},history:`History`,clear:`Clear`,date:`Date`,status:`Status`,trigger:`Type`,triggers:{manual:`Backup (manual)`,scheduled:`Backup (scheduled)`,restore:`Restore`},commit:`Commit`,localBackup:`Local Backup`,localBackupDescription:`Create a complete backup of your Bambuddy data including the database, archives, uploads, and all files.`,downloadBackupLabel:`Download Backup`,completeBackupZip:`Complete backup: database + all files (ZIP)`,download:`Download`,preparingBackup:`Preparing backup...`,creatingArchive:`Creating backup archive... This may take a while for large archives.`,downloadingFile:`Downloading backup file...`,backupDownloaded:`Backup downloaded successfully`,failedToCreateBackup:`Failed to create backup: {{message}}`,restore:`Restore`,restoreReplacesAll:`Restore replaces all data.`,restoreReplacesAllDetail:`Your current database and files will be completely replaced. A restart is required after restore.`,restoreConfirmTitle:`Restore Backup`,restoreConfirmMessage:`Are you sure you want to restore from "{{filename}}"? This will completely replace your current database and all files. The application will need to be restarted after restore.`,restoreConfirmButton:`Restore Backup`,uploadingFile:`Uploading backup file...`,backupRestoredRestart:`Backup restored. Please restart Bambuddy.`,failedToRestore:`Failed to restore backup. Please check the file format.`,reloadNow:`Reload Now`,creatingBackup:`Creating Backup`,restoringBackup:`Restoring Backup`,preparing:`Preparing...`,processing:`Processing...`,doNotClosePage:`Please do not close this page or navigate away. This operation may take several minutes for large backups.`,restoring:`Restoring...`,restoreComplete:`Restore Complete`,restoreFailed2:`Restore Failed`,importSettings:`Import settings from a backup file`,pleaseWaitRestoring:`Please wait while your data is being restored`,selectBackupFile:`Click to select backup file (.json or .zip)`,duplicateHandling:`How duplicate handling works:`,matchPrinters:`Printers`,matchPrintersBy:`matched by serial number`,matchSmartPlugs:`Smart Plugs`,matchSmartPlugsBy:`matched by IP address`,matchNotificationProviders:`Notification Providers`,matchNotificationProvidersBy:`matched by name`,matchFilaments:`Filaments`,matchFilamentsBy:`matched by name + type + brand`,matchArchives:`Archives`,matchArchivesBy:`matched by content hash (always skipped)`,matchPendingUploads:`Pending Uploads`,matchPendingUploadsBy:`matched by filename`,matchSettingsTemplates:`Settings & Templates`,matchSettingsTemplatesBy:`always overwritten`,replaceExisting:`Replace existing data`,keepExisting:`Keep existing data`,overwriteDescription:`Overwrite items that already exist with backup data`,keepDescription:`Only restore items that don't already exist`,overwriteCaution:`Caution:`,overwriteWarning:`Overwriting will replace your current configurations with data from the backup. Printer access codes are never overwritten for security.`,cancel:`Cancel`,processingBackup:`Processing backup file...`,itemsRestored:`Items Restored`,itemsSkipped:`Items Skipped`,restored:`Restored`,skippedAlreadyExist:`Skipped (already exist)`,filesCategory:`Files (3MF, thumbnails, etc.)`,andMore:`...and {{count}} more`,newApiKeysGenerated:`New API Keys Generated`,keysShownOnce:`These keys are only shown once. Copy them now!`,copy:`Copy`,noDataFound:`No data was found to restore in the backup file.`,close:`Close`,scheduledBackup:`Scheduled Backups`,scheduledBackupDescription:`Automatically create backup snapshots on a schedule. Output directory can be mounted to a NAS or external storage.`,frequency:`Frequency`,backupTime:`Time`,retention:`Retention`,retentionDescription:`Number of backups to keep`,outputPath:`Output Path`,outputPathPlaceholder:`Default: {{path}}`,outputPathDescription:`Leave empty for default location`,runNow:`Run Now`,backupFiles:`Backup Files`,noScheduledBackups:`No backups yet`,deleteBackup:`Delete`,deleteBackupConfirm:`Delete this backup file?`,backupRunning:`Backup in progress...`,scheduledBackupComplete:`Backup completed successfully`,scheduledBackupFailed:`Backup failed`,nextBackup:`Next backup`,backupSize:`Size`,localTimeHint:`Local time ({{tz}})`,defaultPathLabel:`Default:`,pathCheck:{title:`Bambuddy cannot write to this directory`,howToFix:`How to fix:`,sandboxed:`The Bambuddy service cannot write to {{path}}. Its systemd unit runs with ProtectSystem=strict, which makes every directory outside the install, data and log directories read-only for the service - even one you can write to from your own shell.`,read_only:`{{path}} is on a read-only filesystem.`,permission_denied:`Bambuddy is not allowed to write to {{path}}. Check the directory owner and permissions.`,no_space:`The filesystem holding {{path}} is full.`,not_a_directory:`{{path}} exists but is not a directory.`,missing:`{{path}} does not exist and could not be created.`,error:`Bambuddy cannot write to {{path}}.`,ephemeralTitle:`These backups will not survive a container restart`,container_ephemeral:`{{path}} is inside the Bambuddy container, not on the host. Backups written there are lost when the container is recreated. Mount the directory from the host:`},categories:{settings:`Settings`,notification_providers:`Notification Providers`,notification_templates:`Notification Templates`,smart_plugs:`Smart Plugs`,printers:`Printers`,filaments:`Filaments`,maintenance_types:`Maintenance Types`,archives:`Archives`,projects:`Projects`,pending_uploads:`Pending Uploads`,external_links:`External Links`,api_keys:`API Keys`}},tags:{title:`Tags`,addTag:`Add Tag`,editTag:`Edit Tag`,deleteTag:`Delete Tag`,tagName:`Tag Name`,tagColor:`Tag Color`,noTags:`No tags`,deleteConfirm:`Are you sure you want to delete this tag?`,manageTags:`Manage Tags`},uploadModal:{title:`Upload 3MF Files`,dragDrop:`Drag & drop .3mf files here`,or:`or`,browseFiles:`Browse Files`,extractionInfo:`The printer model will be automatically extracted from the 3MF file metadata.`,uploaded:`uploaded`,failed:`failed`,uploading:`Uploading...`,upload:`Upload`,uploadFailed:`Upload failed`},confirmOutcome:{title:`How did your print come out?`,good:`Good`,reject:`Reject`,later:`Ask me later`,noPhoto:`No finish photo available`,savedGood:`Marked as good part`,savedReject:`Marked as rejected`,saveFailed:`Could not save the verdict`,rejectReason:`Reject reason (optional)`,noReason:`No reason`,saveReject:`Save`,rejectAndReprint:`Print again`,alreadyGood:`Already confirmed as a good part.`,alreadyRejected:`Already marked as rejected.`,cardPrompt:`How did it come out?`,sources:{dialog:`Recorded in the app.`,link:`Recorded with a one-tap link.`,plateClear:`Recorded when the plate was cleared.`,printerCard:`Recorded from the printer card.`,api:`Recorded through the API.`,reaction:`Recorded with a reaction in chat.`}},editArchive:{title:`Edit Archive`,name:`Name`,namePlaceholder:`Print name`,printer:`Printer`,noPrinter:`No printer`,project:`Project`,noProject:`No project`,itemsPrinted:`Items Printed`,itemsPrintedHelp:`Number of items produced in this print job. Use 0 if the whole plate was ruined.`,filamentUsed:`Filament used (g)`,filamentUsedPlaceholder:`e.g. 46.16`,filamentUsedHelp:`Set this by hand when a print archived without its 3MF, so it still counts towards the filament totals. Rescanning an archive that has its 3MF reads the figure back from the file.`,notes:`Notes`,notesPlaceholder:`Add notes about this print...`,externalLink:`External Link`,externalLinkPlaceholder:`https://printables.com/model/...`,externalLinkHelp:`Link to Printables, Thingiverse, or other source`,tags:`Tags`,tagsPlaceholder:`Add tags...`,addMoreTags:`Add more tags...`,matchingTags:`Matching "{{query}}"`,existingTags:`Existing tags`,clickToAdd:`(click to add)`,status:`Status`,userVerdict:`Outcome Verdict`,verdicts:{none:`Not set`,good:`Good part`,reject:`Rejected`},failureReason:`Failure Reason`,selectReason:`Select reason...`,photos:`Photos of Printed Result`,photosHelp:`Click + to add photos of your printed result`,printResult:`Print result`,saving:`Saving...`,failureReasons:{adhesionFailure:`Adhesion failure`,spaghettiDetached:`Spaghetti / Detached`,layerShift:`Layer shift`,cloggedNozzle:`Clogged nozzle`,filamentRunout:`Filament runout`,warping:`Warping`,stringing:`Stringing`,underExtrusion:`Under-extrusion`,powerFailure:`Power failure`,userCancelled:`User cancelled`,noStatusUpdate:`No status update received`,other:`Other`},statuses:{completed:`Completed`,failed:`Failed`,aborted:`Cancelled`,printing:`Printing`}},kProfiles:{title:`K-Profiles`,noPrintersConfigured:`No Printers Configured`,addPrinterInSettings:`Add a printer in Settings to manage K-profiles`,noActivePrinters:`No Active Printers`,enablePrinterConnection:`Enable a printer connection to view its K-profiles`,loadingProfiles:`Loading K-Profiles...`,printerOffline:`Printer Offline`,printerOfflineDesc:`The selected printer is not connected. Power it on to view K-profiles.`,noMatchingProfiles:`No Matching Profiles`,noMatchingProfilesDesc:`No profiles match your search criteria`,noKProfiles:`No K-Profiles`,noKProfilesDesc:`No pressure advance profiles found for {{diameter}}mm nozzle`,createFirstProfile:`Create First Profile`,printer:`Printer`,nozzle:`Nozzle`,refresh:`Refresh`,addProfile:`Add Profile`,export:`Export`,import:`Import`,select:`Select`,selectAll:`Select All`,delete:`Delete`,searchPlaceholder:`Search by name or filament...`,allExtruders:`All Extruders`,leftOnly:`Left Only`,rightOnly:`Right Only`,allFlow:`All Flow`,hfOnly:`HF Only`,sOnly:`S Only`,sortName:`Sort: Name`,sortKValue:`Sort: K-Value`,sortFilament:`Sort: Filament`,leftExtruder:`Left Extruder`,rightExtruder:`Right Extruder`,modal:{addTitle:`Add K-Profile`,editTitle:`Edit K-Profile`,profileName:`Profile Name`,profileNamePlaceholder:`My PLA Profile`,kValue:`K-Value`,kValuePlaceholder:`0.020`,kValueHelp:`Typical range: 0.01 - 0.06 for PLA, 0.02 - 0.10 for PETG`,filament:`Filament`,selectFilament:`Select filament...`,source:{local:`Imported`,orcaCloud:`Orca Cloud`,bambuCloud:`Bambu Cloud`,builtin:`Built-in`},noFilamentsHelp:`No filaments available. Sign in to Bambu Cloud, or import presets under Profiles → Local Profiles.`,searchFilaments:`Search filaments...`,noFilamentMatches:`No filament matches that search`,flowType:`Flow Type`,highFlow:`High Flow`,standard:`Standard`,nozzleSize:`Nozzle Size`,extruder:`Extruder`,extruders:`Extruders`,left:`Left`,right:`Right`,notes:`Notes (stored locally)`,notesPlaceholder:`Add notes about this profile...`,notesHelp:`Notes are saved in Bambuddy, not on the printer`,syncing:`Syncing with printer...`,savingExtruder:`Saving to extruder {{current}}/{{total}}...`,pleaseWait:`Please wait`},deleteConfirm:{title:`Delete Profile`,cannotUndo:`This cannot be undone`,message:`Are you sure you want to delete "{{name}}" from the printer?`},bulkDelete:{title:`Delete Profiles`,cannotUndo:`This cannot be undone`,message:`Are you sure you want to delete {{count}} selected profiles from the printer?`},toast:{profileSaved:`K-profile saved`,profilesSaved:`K-profile saved to {{count}} extruders`,selectAtLeastOneExtruder:`Please select at least one extruder`,selectFilament:`Select a filament first`,filamentNotResolvable:`No Bambu filament ID for {{name}} — the printer cannot store a profile for it`,profileDeleted:`K-profile deleted`,profilesDeleted:`Deleted {{count}} profiles`,exportedProfiles:`Exported {{count}} profiles`,importedProfiles:`Imported {{count}} of {{total}} profiles`,noProfilesToExport:`No profiles to export`,invalidFileFormat:`Invalid file format`,failedToParseImport:`Failed to parse import file`,failedToSaveBatch:`Failed to save K-profiles`,noteSaved:`Note saved`,failedToSaveNote:`Failed to save note`},permission:{noRead:`You do not have permission to refresh profiles`,noCreate:`You do not have permission to add profiles`,noUpdate:`You do not have permission to update K-profiles`,noDelete:`You do not have permission to delete K-profiles`,noExport:`You do not have permission to export profiles`,noImport:`You do not have permission to import profiles`}},virtualPrinter:{title:`Virtual Printer`,running:`Running`,stopped:`Stopped`,description:{default:`Enable a virtual printer that appears in Bambu Studio and OrcaSlicer. Files sent to this printer will be archived directly without printing.`,proxy:`Enable a proxy that relays slicer traffic to a real printer, allowing remote printing over any network.`},enable:{title:`Enable Virtual Printer`,visibleInSlicer:`Visible as "Bambuddy" in slicer discovery`,proxyingTo:`Proxying to {{name}}`,notActive:`Not active`},model:{title:`Printer Model`,description:`Select which printer model to emulate.`,restartWarning:`Changing the model will restart the virtual printer`},accessCode:{title:`Access Code`,isSet:`Access code is set`,notSet:`No access code set - required to enable`,placeholder:`Enter 8-char code`,placeholderChange:`Enter new code to change`,hint:`Must be exactly 8 characters. Used by slicers to authenticate.`,charCount:`({{count}}/8)`,inheritedFromTarget:`Inherited from target`,derivedFromTargetHint:`Uses the target printer's access code. The bridge forwards slicer auth to the real printer, so the codes must match — edit the printer's access code to change this value.`,reveal:`Show access code`,hide:`Hide access code`},targetPrinter:{title:`Target Printer`,configured:`Proxy target configured`,notConfigured:`No target printer selected - required for proxy mode`,placeholder:`Select a printer...`,hint:`Select the printer to proxy slicer traffic to. The printer must be in LAN mode.`,noPrinters:`No printers configured. Add a printer first to use proxy mode.`},remoteInterface:{title:`Network Interface Override`,configured:`Interface override active`,optional:`Optional - use if auto-detected IP is wrong (e.g. multiple NICs, Docker, VPN)`,placeholder:`Auto-detect (default)...`,hint:`Override the IP address advertised via SSDP and used in the TLS certificate. Useful when Bambuddy has multiple network interfaces.`},mode:{title:`Mode`,archive:`Archive`,archiveDesc:`Archive files immediately`,review:`Review`,reviewDesc:`Review before archiving`,queue:`Queue`,queueDesc:`Archive and add to queue`,proxy:`Proxy`,proxyDesc:`Relay to real printer`},autoDispatch:{title:`Auto-dispatch`,description:`Automatically start prints when added to queue. When off, prints wait for manual dispatch.`},queueForceColorMatch:{title:`Force color match`,description:`Refuse to dispatch onto a printer that does not have the exact filament type and color loaded. Off by default — without this, the queue uses model-only matching and may pick a printer with the wrong color loaded.`},saveAmsMapping:{title:`Save AMS mapping`,description:`Persist the slicer's own AMS-slot pick (from the project_file MQTT command) onto the archive, so a later reprint reuses the exact physical spool instead of re-deriving one from the file's type/color. Off by default.`},gcodeInjection:{title:`G-code injection`,description:`Apply the per-model G-code snippets configured in Settings to jobs from this VP. Off by default.`},tailscaleDisabled:{title:`Tailscale integration`,description:`Enable to mark this VP as exposed over Tailscale. Shows the host's Tailscale address so you know which IP to paste into the slicer. The CA-import step is unchanged — this toggle has no effect on certificates.`},setupRequired:{title:`Setup Required`,description:`The virtual printer feature requires additional system configuration before it will work. This includes port forwarding, firewall rules, and platform-specific settings.`,readGuide:`Read the setup guide before enabling`},archiveNameSource:{title:`Archive name source`,description:`Choose how new archives are named when files arrive via the virtual printer. "Metadata" uses the slicer-embedded Title from the 3MF (default). "Filename" uses the filename Bambu Studio sent over FTP. Note: Bambu Studio overwrites the name you type in the "send to printer" dialog with the 3MF's Title field whenever one is present, so both modes often produce the same string.`,metadata:`Metadata`,filename:`Filename`},caCert:{title:`Slicer certificate`,description:`Virtual printers use a TLS certificate signed by the Bambuddy CA. Import this CA certificate into your slicer's trust store once so it accepts the connection — no need to copy it from the command line.`,copy:`Copy`,copied:`Copied`,download:`Download`,fingerprint:`SHA-256`},howItWorks:{title:`How it works`,step1:`On the same LAN, virtual printers appear in your slicer (Bambu Studio / OrcaSlicer) automatically via discovery. From other networks, add them manually by IP address and access code.`,step2:`In Archive, Review, and Queue modes, use the "Send" button in your slicer to upload 3MF files to Bambuddy. The slicer will show "Print success" — the file is stored, not printed.`,step3:`In Proxy mode, the virtual printer relays all traffic to a real printer — prints start immediately as if connected directly.`},status:{title:`Status Details`,printerName:`Printer Name`,model:`Model`,serialNumber:`Serial Number`,mode:`Mode`,pendingFiles:`Pending Files`,targetPrinter:`Target Printer`,ftpPort:`FTP Port`,mqttPort:`MQTT Port`,ftpConnections:`FTP Connections`,mqttConnections:`MQTT Connections`},toast:{updated:`Virtual printer settings updated`,failedToUpdate:`Failed to update settings`,copyFailed:`Failed to copy — try selecting the text manually`,accessCodeRequired:`Please set an access code first`,targetPrinterRequired:`Please select a target printer first`,bindIpRequired:`Please set a bind IP first`,accessCodeEmpty:`Access code cannot be empty`,accessCodeLength:`Access code must be exactly 8 characters`,targetCodeChangedRebind:`Access code now matches the new target printer. Re-add this device in your slicer to pick up the new code.`,created:`Virtual printer created`,failedToCreate:`Failed to create virtual printer`,deleted:`Virtual printer deleted`,failedToDelete:`Failed to delete virtual printer`},list:{title:`Virtual Printers`,add:`Add`,addFirst:`Add Virtual Printer`,empty:`No virtual printers configured. Add one to get started.`},bindIp:{title:`Bind Interface`,placeholder:`Select interface...`,hint:`Network interface for this virtual printer to bind to. Must be unique per printer.`},proxy:{accessCodeHint:`In proxy mode, use your target printer's access code in the slicer. The connection is forwarded transparently to the real printer.`},addDialog:{title:`Add Virtual Printer`,name:`Name`,hint:`You can configure access code, target printer, and other settings after creating.`,create:`Create`},deleteConfirm:{title:`Delete Virtual Printer`,message:`Are you sure you want to delete "{{name}}"? This will stop all services for this printer.`}},modelViewer:{stepConverting:`Converting STEP model… {{seconds}} s`,stepSlowHint:`Large STEP files can take a minute or more.`,openInSlicer:`Open in Slicer`,openInSlicerWith:`Open in {{slicer}}`,moreSlicerOptions:`More slicer options`,openInSlicerFailed:`Could not open in slicer`,tabs:{model:`3D Model`},notAvailable:`not available`,plates:`Plates`,allPlates:`All Plates`,plateNumber:`Plate {{number}}`,plateCount:`{{count}} plate`,plateCount_other:`{{count}} plates`,objectCount:`{{count}} object`,objectCount_other:`{{count}} objects`,filamentCount:`{{count}} filament`,filamentCount_other:`{{count}} filaments`,eta:`ETA {{minutes}} min`,noPreview:`No preview available for this file`,pagination:{pageOf:`Page {{current}} of {{total}}`,prev:`Prev`,next:`Next`},errors:{failedToLoad:`Failed to load file`,noMeshes:`No meshes found in 3MF file`,unsupportedFormat:`Unsupported file format`}},maintenanceDescriptions:{lubricateCarbonRods:`Apply lubricant to carbon rods for smooth motion`,lubricateRails:`Apply lubricant to linear rails for smooth motion`,cleanNozzle:`Clean hotend and nozzle to prevent clogs`,checkBelts:`Verify belt tension for accurate prints`,cleanBuildPlate:`Clean build plate for better adhesion`,checkExtruder:`Inspect extruder gears for wear`,checkCooling:`Ensure cooling fans are working properly`,generalInspection:`General printer inspection`,cleanCarbonRods:`Clean carbon rods to reduce friction`,lubricateSteelRods:`Apply lubricant to steel rods for smooth motion`,cleanSteelRods:`Clean steel rods to reduce friction`,cleanLinearRails:`Wipe linear rails to remove dust and debris`,checkPtfeTube:`Inspect PTFE tube for wear or damage`,replaceHepaFilter:`Replace HEPA filter for air quality`,replaceCarbonFilter:`Replace activated carbon filter`,lubricateLeftNozzleRail:`Lubricate left nozzle rail (H2 series)`},haSensors:{label:`Sensors`,unavailable:`Unavailable`,blocksPrints:`{{entity}} — holds prints while alerting`,states:{open:`Open`,closed:`Closed`,unlocked:`Unlocked`,locked:`Locked`,detected:`Detected`,clear:`Clear`,wet:`Wet`,dry:`Dry`,problem:`Problem`,ok:`OK`,running:`Running`,stopped:`Stopped`,on:`On`,off:`Off`},sectionTitle:`Home Assistant Sensors (Printers)`,add:`Add Sensor`,addTitle:`Add Home Assistant Sensor`,editTitle:`Edit Home Assistant Sensor`,empty:`No sensors yet. Bind a door contact or a thermometer from Home Assistant to show it on a printer card.`,unknownPrinter:`Unknown printer`,badgeBlocks:`Holds prints`,badgeNotifies:`Notifies`,badgeHidden:`Hidden on card`,printer:`Printer`,entity:`Entity`,searchPlaceholder:`Search entities...`,noEntities:`No matching entities`,name:`Display name`,alertWhen:`Alert when`,alertNever:`Never — display only`,alertAbove:`Above`,alertBelow:`Below`,alertHint:`The alert state highlights the sensor on the printer card and enables the options below.`,showOnCard:`Show on printer card`,notifyOnAlert:`Send a notification when it starts alerting`,blockPrint:`Hold queued prints while alerting`,blockPrintHint:`Jobs stay queued and start on their own once the sensor clears. Ignored while Home Assistant is unreachable.`,toast:{created:`Sensor added`,updated:`Sensor saved`,deleted:`Sensor removed`},error:{pickEntity:`Pick a Home Assistant entity`,nameRequired:`Enter a display name`,printerRequired:`Pick a printer`,alertRequired:`Set an alert condition first`}},locationHaSensors:{sectionTitle:`Home Assistant Sensors (Storage Locations)`,sectionDescription:`Bind Home Assistant temperature, humidity, or battery sensors to your storage locations to show live readings on the filament card and in the table. Only one sensor per category is allowed per location.`,add:`Add Sensor`,addTitle:`Add Home Assistant Sensor`,editTitle:`Edit Home Assistant Sensor`,empty:`No sensors yet. Bind a temperature or humidity sensor from Home Assistant to show it on the filament card.`,unknownLocation:`Unknown location`,location:`Storage Location`,showOnCard:`Show on filament card`,overwriteConfirm:{title:`Replace existing sensor?`,messageTemperature:`"{{location}}" already has a temperature sensor bound: {{name}}. Continuing will replace it.`,messageHumidity:`"{{location}}" already has a humidity sensor bound: {{name}}. Continuing will replace it.`,messageBattery:`"{{location}}" already has a battery sensor bound: {{name}}. Continuing will replace it.`},autoAdd:{confirmTitle:`Add the other sensors too?`,confirmMessage:`Bambuddy also found other sensors for this location. Choose which ones to add too.`,added:`Also added: {{names}}`,noneFound:`No matching temperature, humidity, or battery sensors found for this location.`,onlyThisOne:`Only this one`},options:{buttonLabel:`Sensor options`,title:`Location Sensor Options`,description:`These values are used when a temperature, humidity, or battery sensor is bound automatically alongside the first sensor for a location.`,generalSettings:`General settings`,pollInterval:`Update interval (seconds)`,pollIntervalHint:`How often Bambuddy polls Home Assistant and refreshes sensor values on screen. Minimum 60 seconds.`,colorizeValues:`Colorize sensor values against their alert thresholds`,aboveColor:`Above threshold color`,belowColor:`Below threshold color`,optimalColor:`Optimal value color`,colors:{red:`Red`,orange:`Orange`,yellow:`Yellow`,green:`Green`,blue:`Blue`,purple:`Purple`,pink:`Pink`},saved:`Options saved`,saveFailed:`Failed to save options`,reset:`Reset`,resetConfirm:{title:`Reset all existing location sensors?`,message:`This overwrites the alert thresholds, notifications, and card visibility of every existing storage-location temperature, humidity, and battery sensor with the values configured above, and restores each sensor's name to its Home Assistant friendly name — printer sensors are not affected. This cannot be undone. Depending on how many sensors you have, this may take a moment.`},resetDone:`Applied to {{count}} location sensors`,resetFailed:`Failed to reset location sensors`},deleteAllConfirm:{title:`Delete all sensors?`,message:`This removes all {{count}} sensors bound to "{{location}}". This cannot be undone.`},currentlyBound:`Currently bound: {{entity}}`,error:{locationRequired:`Pick a storage location`},toast:{created:`Sensor added`,updated:`Sensor saved`,deleted:`Sensor removed`}},smartPlugs:{offline:`Offline`,admin:`Admin`,openPlugAdminPage:`Open plug admin page`,deleteSmartPlug:`Delete Smart Plug`,turnOnSmartPlug:`Turn On Smart Plug`,turnOffSmartPlug:`Turn Off Smart Plug`,turnOn:`Turn On`,turnOff:`Turn Off`,addSmartPlug:{scanningNetwork:`Scanning network...`,chooseEntity:`Choose an entity...`,connectionFailed:`Connection failed`,searchEntities:`Search entities...`,searchPowerSensors:`Search power sensors...`,searchEnergySensors:`Search energy sensors...`,placeholders:{plugName:`Living Room Plug`,mqttStateOnValue:`ON, true, 1`,mqttSameAsPower:`Same as power topic, or different`}},linkedTo:`Linked to:`,monitorOnly:`Monitor Only`,alerts:`Alerts`,scheduleOn:`On {{time}}`,scheduleOff:`Off {{time}}`,on:`On`,off:`Off`,power:`Power`,kwhToday:`kWh Today`,settings:`Settings`,automationSettings:`Automation Settings`,showInSwitchbar:`Show in Switchbar`,quickAccessSidebar:`Quick access from sidebar`,enabled:`Enabled`,enableAutomation:`Enable automation for this plug`,autoOn:`Auto On`,autoOnDescription:`Turn on when print starts`,autoOff:`Auto Off`,autoOffDescription:`Turn off when print completes (one-shot)`,autoOffPersistent:`Keep Enabled`,autoOffPersistentDescription:`Stay enabled between prints instead of one-shot`,controlsPrinterPower:`Powers the printer`,controlsPrinterPowerDescription:`Turn off if this plug only powers an accessory (filter fan, lights). Otherwise switching it off marks the printer offline.`,autoOffAfterDrying:`Auto Off After Drying`,autoOffAfterDryingDescription:`Turn off when AMS drying completes`,delayAfterDryingMinutes:`Drying delay (minutes)`,turnOffDelayMode:`Turn Off Delay Mode`,time:`Time`,temp:`Temp`,delayMinutes:`Delay (minutes)`,tempThreshold:`Temperature threshold (°C)`,tempThresholdDescription:`Turns off when nozzle cools below this temperature`,edit:`Edit`,deleteConfirm:`Are you sure you want to delete "{{name}}"? This cannot be undone.`,turnOnConfirm:`Are you sure you want to turn on "{{name}}"?`,turnOffConfirm:`Are you sure you want to turn off "{{name}}"? This will cut power to the connected device.`,failedToTurn:`Failed to turn {{action}} "{{name}}"`,unknown:`Unknown`,addTitle:`Add Smart Plug`,editTitle:`Edit Smart Plug`,stopScanning:`Stop Scanning`,discoverTasmota:`Discover Tasmota Devices`,foundDevices:`Found {{count}} device(s) - click to select:`,noDevicesFound:`No Tasmota devices found on your network`,haNotConfigured:`Home Assistant is not configured. Set it up in`,haSettingsPath:`Settings → Network → Home Assistant`,selectEntity:`Select Entity *`,ipAddress:`IP Address *`,nameLabel:`Name *`,username:`Username`,password:`Password`,authHint:`Leave empty if your Tasmota device doesn't require authentication`,linkToPrinter:`Link to Printer`,noPrinter:`No printer (manual control only)`,linkingDescription:`Linking enables automatic on/off when prints start/complete`,powerAlerts:`Power Alerts`,alertAbove:`Alert if above (W)`,alertBelow:`Alert if below (W)`,alertDescription:`Get notified when power consumption crosses these thresholds. Leave empty to disable that direction.`,dailySchedule:`Daily Schedule`,turnOnAt:`Turn On at`,turnOffAt:`Turn Off at`,scheduleDescription:`Automatically turn the plug on/off at these times daily. Leave empty to skip that action.`,showOnPrinterCard:`Show on Printer Card`,displayOnPrinterCard:`Display button on printer card`,connectedResult:`Connected!`,deviceLabel:`Device: {{name}} - `,stateLabel:`State: {{state}}`,test:`Test`,delete:`Delete`,save:`Save`,add:`Add`,cancel:`Cancel`,failedToStartScan:`Failed to start scan`,nameRequired:`Name is required`,entityRequired:`Entity is required for Home Assistant plugs`,mqttTopicRequired:`At least one MQTT topic must be configured for power, energy, or state monitoring`,loadingEntities:`Loading entities...`,loading:`Loading...`,failedToLoadEntities:`Failed to load entities: {{error}}`,noEntitiesMatching:`No entities found matching "{{search}}"`,noEntitiesAvailable:`No entities available`,searchingEntities:`Searching all entities ({{count}} found)`,showingEntities:`Showing switch, light, input_boolean ({{count}} available)`,energyMonitoringOptional:`Energy Monitoring (Optional)`,energyMonitoringHint:`Search and select sensors that provide power/energy data.`,powerSensorW:`Power Sensor (W)`,energyTodayKwh:`Energy Today (kWh)`,totalEnergyKwh:`Total Energy (kWh)`,noMatchingSensors:`No matching sensors`,none:`None`,mqttNotConfigured:`MQTT broker not configured. Set broker address in`,mqttSettingsPath:`Settings → Network → MQTT Publishing`,mqttNotConfiguredSuffix:`(you don't need to enable publishing, just fill in the broker details).`,mqttMonitorOnlyDescription:`MQTT plugs receive power/energy data via MQTT subscription. On/off control is not available - use your MQTT broker or home automation system.`,powerMonitoring:`Power Monitoring`,energyMonitoring:`Energy Monitoring`,stateMonitoring:`State Monitoring`,optional:`optional`,topic:`Topic`,jsonPath:`JSON Path`,multiplier:`Multiplier`,onValue:`ON Value`,mqttPowerHint:`JSON path extracts value from JSON payload (e.g., "power_l1"). Leave empty if topic publishes raw numeric values. +Use multiplier 0.001 for mW→W, 1000 for kW→W.`,mqttEnergyHint:`JSON path extracts value from JSON payload. Leave empty for raw values. +Use multiplier 0.001 for Wh→kWh, 1000 for MWh→kWh.`,mqttStateHint:`JSON path extracts value from JSON payload. Leave empty for raw values. +ON value: the exact string that means "ON". Leave empty for auto-detect (ON, true, 1).`,restControl:`Control`,restOnUrl:`Turn ON URL`,restOffUrl:`Turn OFF URL`,restOnBody:`ON Request Body`,restOffBody:`OFF Request Body`,restMethod:`HTTP Method`,restHeaders:`Custom Headers (JSON)`,restStatusUrl:`Status URL`,restStatusPath:`State JSON Path`,restStatusOnValue:`ON Value`,restPowerUrl:`Power URL`,restPowerPath:`Power JSON Path`,restPowerMultiplier:`Power Multiplier`,restEnergyUrl:`Energy URL`,restEnergyPath:`Energy JSON Path (today)`,restEnergyTotalPath:`Energy JSON Path (lifetime)`,restEnergyTotalMultiplier:`Lifetime Multiplier`,restEnergyTotalPathHint:`e.g. aenergy.total`,restEnergyTotalHint:`Many plugs — every Shelly among them — report only a lifetime counter that never resets. It belongs here, not in the field above: read as today's usage it would never reset at midnight, and Yesterday and Total would stay empty. Bambuddy works Today and Yesterday out from it, which takes a day or two of readings to fill in. A Shelly reports watt-hours, so use a multiplier of 0.001.`,restEnergyMultiplier:`Energy Multiplier`,restUrlRequired:`At least one URL (ON or OFF) is required for REST plugs`,restHeadersHint:`e.g. {"Authorization": "Bearer your-token"}`,restBodyHint:`e.g. ON, {"state": "on"}`,restStatusHint:`URL to poll for current state`,restPathHint:`e.g. state or data.power.status`,restPowerUrlHint:`Separate URL for power data (uses Status URL if empty)`,restEnergyUrlHint:`Separate URL for energy data (uses Status URL if empty)`,restEnergyHint:`Each value can use its own URL or fall back to the Status URL. Use multipliers for unit conversion (e.g. 0.001 to convert Wh to kWh).`,testConnection:`Test Connection`,connectionSuccess:`Connection successful`,noSwitchesInSwitchbar:`No switches in switchbar`,enableSwitchbarHint:`Enable "Show in Switchbar" in Settings > Smart Plugs`},notifications:{notifyLockScreenWidgets:`Lock Screen Widgets (iOS)`,notifyLockScreenWidgetsHelp:`Only active printers outside maintenance mode receive widgets. Notify! allows 10 widgets per device in total. Add a Notify! widget from iOS Customize Lock Screen and select a printer. It shows status, progress and problems without a live countdown. iOS refreshes roughly every 15 minutes or longer.`,notifyPhotoUnavailable:`Browser and group recipients support text notifications only; photo attachments are unavailable.`,notifyShowStage:`Show print stage`,notifyTimeSensitive:`Time Sensitive problem alerts`,notifyTimeSensitiveHelp:`Mark failed or stopped prints and printer or AI problems as Time Sensitive. Other pushes stay normal.`,notifyPrivacy:`Hide file name on tile`,notifyPrivacyHelp:`Hides file names only in the Live Activity. Push text still uses notification templates.`,notifyStyle:`Progress style`,notifyStyleBar:`Progress bar`,notifyStyleSegments:`Segments`,notifyStyleNone:`No progress indicator`,notifyDashboardUrl:`Dashboard URL (optional)`,notifySymbol:`Symbol (optional)`,notifyTint:`Tint (optional)`,notifyAppearance:`Live Activity appearance`,notifyMetrics:`Metrics`,notifyMetricsHelp:`The timer is shown by default. Optional metrics replace the file-name line.`,notifyDeviceId:`Device or group ID`,notifyToken:`Notify! token`,notifyIconUrl:`Icon URL (optional)`,notifyGroupType:`Notification thread (optional)`,notifyGroupTypeHelp:`Leave blank to group push notifications by printer. A custom value groups them in the same thread.`,notifyLiveActivities:`Live Activities (iOS)`,notifyLiveActivitiesHelp:`Track prints on your iOS Lock Screen and Dynamic Island. Use an iOS device ID; add a separate provider for group pushes.`,notifyLifecycleHelp:`Live Activities follow each print automatically. Event toggles below control push alerts only. Quiet hours block new activities; existing activities still update and end. Daily digests do not delay activities.`,notifyIosFeaturesUnavailable:`Live Activities and Lock Screen widgets require an iOS device ID. Group, browser and macOS IDs use push notifications only.`,notifyTestHelp:`Testing sends a push notification. A Live Activity starts when a print starts.`,providerTypes:{notify:`Notify!`,callmebot:`CallMeBot/WhatsApp`,ntfy:`ntfy`,pushover:`Pushover`,telegram:`Telegram`,email:`Email`,discord:`Discord`,webhook:`Webhook`,homeassistant:`Home Assistant`,bark:`Bark`,gotify:`Gotify`},providerDescriptions:{notify:`Push notifications and iOS Live Activities via Notify!`,email:`SMTP email notifications`,telegram:`Notifications via Telegram bot`,discord:`Send to Discord channel via webhook`,ntfy:`Free, self-hostable push notifications`,pushover:`Simple, reliable push notifications`,callmebot:`Free WhatsApp notifications via CallMeBot`,webhook:`Generic HTTP POST to any URL`,homeassistant:`Persistent notifications in Home Assistant dashboard`,bark:`iOS push notifications via Bark (self-hostable)`,gotify:`Push notifications via your own Gotify server`},lastSuccess:`Last: {{date}}`,error:`Error`,printer:`Printer:`,allPrinters:`All printers`,sendTestNotification:`Send Test Notification`,eventSettings:`Event Settings`,enabled:`Enabled`,sendFromProvider:`Send notifications from this provider`,printEvents:`Print Events`,printerStatus:`Printer Status`,amsAlarms:`AMS Alarms`,amsHtAlarms:`AMS-HT Alarms`,printQueue:`Print Queue`,start:`Start`,plateCheck:`Plate Check`,complete:`Complete`,failed:`Failed`,stopped:`Stopped`,progress:`Progress`,offline:`Offline`,lowFilament:`Low Filament`,maintenance:`Maintenance`,amsHumidity:`AMS Humidity`,amsTemp:`AMS Temp`,amsDryingSuspended:`Drying Suspended`,amsHtHumidity:`AMS-HT Humidity`,amsHtTemp:`AMS-HT Temp`,bedCooled:`Bed Cooled`,firstLayer:`First Layer`,quiet:`Quiet`,digest:`Digest {{time}}`,noPhoto:`No Photo`,printStarted:`Print Started`,plateNotEmpty:`Plate Not Empty`,plateNotEmptyDescription:`Objects detected before print`,plateClearRequired:`Plate Clear Required`,plateClearRequiredDescription:`Print finished, queue waits for plate confirmation`,printConfirmRequest:`Outcome Confirmation`,printConfirmRequestDescription:`Ask for a good/reject verdict with one-tap links when an opted-in print completes`,plateClear:`Plate Clear`,printCompleted:`Print Completed`,bedCooledLabel:`Bed Cooled`,bedCooledDescription:`Bed cooled below threshold after print`,firstLayerCompleteLabel:`First Layer Complete`,firstLayerCompleteDescription:`Notify with snapshot when first layer finishes`,connectedApps:`Connected apps`,appMessages:`Messages from connected apps`,appMessagesDescription:`Deliver messages other applications send through Bambuddy, e.g. Bambuddy Orders`,appMessagesBadge:`Apps`,missingSpoolAssignmentLabel:`Missing Spool Assignment`,billingChargeFailedLabel:`Billing Charge Failed`,billingChargeFailedDescription:`Notify when print costs could not be recorded`,missingSpoolAssignmentDescription:`Notify when print starts and required trays have no assigned spool`,printFailed:`Print Failed`,printStopped:`Print Stopped`,progressMilestones:`Progress Milestones`,progressMilestonesDescription:`Notify at 25%, 50%, 75%`,printerOffline:`Printer Offline`,printerError:`Printer Error`,aiFailureDetection:`AI Failure Detection`,aiFailureDetectionDescription:`Notify when Obico AI detects a possible print failure`,lowFilamentLabel:`Low Filament`,maintenanceDue:`Maintenance Due`,maintenanceDueDescription:`Notify when maintenance is needed`,amsHumidityHigh:`AMS Humidity High`,amsHumidityHighDescription:`Regular AMS humidity exceeds threshold`,amsTemperatureHigh:`AMS Temperature High`,amsTemperatureHighDescription:`Regular AMS temperature exceeds threshold`,amsDryingSuspendedTitle:`Auto-Drying Suspended`,amsDryingSuspendedDescription:`Automatic drying gave up on an AMS unit because humidity never fell below the threshold`,amsHtHumidityHigh:`AMS-HT Humidity High`,amsHtHumidityHighDescription:`AMS-HT humidity exceeds threshold`,amsHtTemperatureHigh:`AMS-HT Temperature High`,amsHtTemperatureHighDescription:`AMS-HT temperature exceeds threshold`,inventoryAlerts:`Inventory Alerts`,stockReorderAlert:`Reorder Alert`,stockReorderAlertDescription:`SKU has reached its reorder point`,stockBreakAlert:`Stock Break Alert`,stockBreakAlertDescription:`Stock will run out before replenishment arrives`,jobAdded:`Job Added`,jobAddedDescription:`Job added to queue`,jobAssigned:`Job Assigned`,jobAssignedDescription:`Model-based job assigned to printer`,jobStarted:`Job Started`,jobStartedDescription:`Queue job started printing`,jobWaiting:`Job Waiting`,jobWaitingDescription:`Job waiting for filament or printer`,jobSkipped:`Job Skipped`,jobSkippedDescription:`Job skipped (previous failed)`,jobFailed:`Job Failed`,jobFailedDescription:`Job failed to start`,queueComplete:`Queue Complete`,queueCompleteDescription:`All queue jobs finished`,quietHours:`Quiet Hours`,noNotificationsDuring:`No notifications during these hours`,editProviderToChangeQuietHours:`Edit provider to change quiet hours`,dailyDigest:`Daily Digest`,batchNotifications:`Batch notifications into a single daily summary`,sendAt:`Send at {{time}}`,editProviderToChangeDigestTime:`Edit provider to change digest time`,edit:`Edit`,deleteProvider:`Delete Notification Provider`,deleteConfirm:`Are you sure you want to delete "{{name}}"? This cannot be undone.`,delete:`Delete`,addTitle:`Add Notification Provider`,editTitle:`Edit Notification Provider`,nameLabel:`Name *`,namePlaceholder:`My Notifications`,providerTypeLabel:`Provider Type *`,configuration:`Configuration`,testConfiguration:`Test Configuration`,printerFilter:`Printer Filter`,onlyFromPrinter:`Only send notifications for events from this printer`,attachPhotoLabel:`Attach Photo`,attachPhotoDescription:`Include a camera snapshot with notifications, when one was captured for the event`,quietHoursDnd:`Quiet Hours (Do Not Disturb)`,quietStart:`Start`,quietEnd:`End`,dailyDigestLabel:`Daily Digest`,sendDigestAt:`Send digest at`,digestCollected:`Events will be collected and sent as a single summary at this time`,notificationEvents:`Notification Events`,progressPercent:`(25%, 50%, 75%)`,bedCooledAfterPrint:`(after print completes)`,haSensorAlert:`Printer Sensor Alert`,haSensorAlertDescription:`(a bound Home Assistant sensor needs attention)`,locationHaSensorAlert:`Storage Location Sensor Alert`,locationHaSensorAlertDescription:`(a Home Assistant sensor bound to a storage location needs attention)`,eventPriority:{sectionTitle:`ntfy Priority`,helpNtfy:`Pick a priority for each enabled event. ntfy uses these to escalate alerts (sound, visibility, push behavior). Levels not set here use the ntfy server default.`,sectionTitleGotify:`Gotify Priority`,helpGotify:`Pick a priority for each enabled event. Bambuddy sends Min, Low, Default, High and Urgent to Gotify as 0, 2, 5, 8 and 10. In the Gotify Android app, Default and above play a sound, and High and Urgent pop up.`,min:`Min`,low:`Low`,default:`Default`,high:`High`,urgent:`Urgent`},cancel:`Cancel`,save:`Save`,add:`Add`,nameRequired:`Name is required`,fieldRequired:`{{field}} is required`,haDataInvalid:`The Data field must be a valid JSON object, e.g. {"priority": "high", "ttl": 0}`,haServiceHelp:`Optional — defaults to a persistent notification in Home Assistant's UI. Set a notify service (e.g. notify.mobile_app_myphone) to get push notifications on your phone, which also attaches a camera snapshot automatically when one is available and External URL is set in Settings → Network.`,phoneNumber:`Phone Number`,apiKey:`API Key`,serverUrl:`Server URL`,topic:`Topic`,authToken:`Auth Token`,userKey:`User Key`,appToken:`App Token`,priority:`Priority`,pushoverRetry:`Emergency Retry (s)`,pushoverExpire:`Emergency Expire (s)`,botToken:`Bot Token`,chatId:`Chat ID`,telegramThreadId:`Forum Topic ID`,telegramThreadIdHelp:`Optional. Posts into a single topic of a forum group — the last number in the topic link (t.me/c/.../25). Leave empty for the General topic.`,telegramThreadIdInvalid:`Forum Topic ID must be a number.`,telegramVerdictMode:`Outcome verdict via`,telegramVerdictModeButtons:`Inline buttons (link)`,telegramVerdictModeReactions:`Reaction (👍 / 👎)`,telegramVerdictModeBoth:`Buttons and reaction`,telegramVerdictModeHelp:`How the outcome prompt is answered. Reactions need no inbound connectivity or external URL — Bambuddy polls the bot for them. For reactions, use a bot only Bambuddy uses: another app polling the same bot (Home Assistant, for example) stops receiving its messages, and that stays so even after switching back to buttons. In a group the bot must be an admin to see reactions.`,telegramVerdictBadgeReactions:`Reactions`,telegramVerdictBadgeBoth:`Buttons + reactions`,smtpServer:`SMTP Server`,smtpPort:`SMTP Port`,security:`Security`,authentication:`Authentication`,username:`Username`,password:`Password`,fromEmail:`From Email`,toEmail:`To Email`,webhookUrl:`Webhook URL`,payloadFormat:`Payload Format`,authorization:`Authorization`,titleFieldName:`Title Field Name`,messageFieldName:`Message Field Name`,editTemplate:`Edit Template: {{name}}`,titleLabel:`Title`,bodyLabel:`Body`,titlePlaceholder:`Notification title...`,bodyPlaceholder:`Notification body...`,availableVariables:`Available Variables`,clickToInsert:`Click to insert at cursor position in body`,livePreview:`Live Preview`,hide:`Hide`,show:`Show`,loadingPreview:`Loading preview...`,enterTemplateContent:`Enter template content to see preview`,titlePreview:`Title:`,bodyPreview:`Body:`,photoPreview:`Photo:`,photoPreviewNote:`Example only — providers that support attachments (ntfy, Pushover, Telegram, Discord, Home Assistant, Bark, Slack webhook) include a camera snapshot automatically when one was captured, regardless of what the body above says.`,photoPreviewNoteWithEmail:`Example only — attached automatically for supported providers (ntfy, Pushover, Telegram, Discord, Home Assistant, Bark, Slack webhook) when a snapshot was captured. For Email, add {finish_photo_url} to the body above to include it inline.`,photoPreviewNoteEmailOnly:`Example only — this is always an email. Add {finish_photo_url} to the body above to include the photo inline; without it, only the text is sent.`,resetToDefault:`Reset to Default`,titleRequired:`Title is required`,bodyRequired:`Body is required`,notificationLog:`Notification Log`,showFailedOnly:`Failed only`,last24Hours:`Last 24 hours`,last7Days:`Last 7 days`,last30Days:`Last 30 days`,last90Days:`Last 90 days`,justNow:`Just now`,noFailedNotifications:`No failed notifications`,noNotificationsLogged:`No notifications logged`,unknownProvider:`Unknown Provider`,logTitle:`Title`,logMessage:`Message`,logError:`Error`,logProvider:`Provider: {{type}}`,logTime:`Time: {{time}}`,refresh:`Refresh`,clearOld:`Clear Old`,statsSummary:`Last {{days}} days:`,statsNotifications:`notifications`,statsSent:`{{count}} sent`,statsFailed:`{{count}} failed`,eventTypes:{print_start:`Print Started`,print_complete:`Print Complete`,print_failed:`Print Failed`,print_stopped:`Print Stopped`,print_progress:`Progress`,printer_offline:`Printer Offline`,printer_error:`Printer Error`,filament_low:`Low Filament`,maintenance_due:`Maintenance Due`,test:`Test`},userEmail:{title:`Notifications`,emailNotifications:`Email Notifications`,emailNotificationsDesc:`Receive email notifications for your own print jobs. Emails are sent using the system SMTP settings configured in Advanced Authentication.`,sendingTo:`Notifications will be sent to`,noEmailWarning:`Your account does not have an email address. Contact an administrator to add one.`,printJobNotifications:`Print Job Notifications`,printJobNotificationsDesc:`Choose which events trigger email notifications for print jobs you submit.`,printJobStarts:`Print Job Starts`,printJobStartsDesc:`Get notified when your print job begins.`,printJobFinishes:`Print Job Finishes`,printJobFinishesDesc:`Get notified when your print job completes successfully.`,printErrors:`Print Errors`,printErrorsDesc:`Get notified when your print job fails or encounters an error.`,printJobStops:`Print Job Stops`,printJobStopsDesc:`Get notified when your print job is cancelled or stopped.`,saveSuccess:`Notification preferences saved.`,saveError:`Failed to save notification preferences.`}},richTextEditor:{bold:`Bold`,italic:`Italic`,underline:`Underline`,bulletList:`Bullet List`,numberedList:`Numbered List`,alignLeft:`Align Left`,alignCenter:`Align Center`,alignRight:`Align Right`,addLink:`Add Link`,removeLink:`Remove Link`},externalLinks:{title:`Sidebar Links`,sidebarLayout:`Sidebar`,sidebarLayoutDescription:`Show or hide built-in pages, add external links, and drag items to reorder the sidebar navigation.`,systemPages:`Bambuddy pages`,externalLinks:`External links`,visibleInSidebar:`Visible in sidebar`,hiddenFromSidebar:`Hidden from sidebar`,requiredInSidebar:`Required in sidebar`,hidePage:`Hide page`,showPage:`Show page`,settingsCannotBeHidden:`Settings cannot be hidden`,noLinksConfigured:`No external links configured`,deleteLink:`Delete Link`,removeCustomIcon:`Remove custom icon`,openInNewTab:`Open in new tab`,placeholders:{linkName:`My Link`}},keyboardShortcuts:{title:`Keyboard Shortcuts`,navigation:`Navigation`,archivesSection:`Archives`,kProfilesSection:`K-Profiles`,generalSection:`General`,shortcuts:{goToPrinters:`Go to Printers`,goToArchives:`Go to Archives`,goToQueue:`Go to Queue`,goToStats:`Go to Statistics`,goToProfiles:`Go to Cloud Profiles`,goToSettings:`Go to Settings`,focusSearch:`Focus search`,openUploadModal:`Open upload modal`,clearSelection:`Clear selection / blur input`,contextMenu:`Context menu on cards`,refreshProfiles:`Refresh profiles`,newProfile:`New profile`,exitSelectionMode:`Exit selection mode`,showHelp:`Show this help`},footer:`Press Esc or click outside to close`},notificationLog:{title:`Notification Log`,events:{printStarted:`Print Started`,printComplete:`Print Complete`,printFailed:`Print Failed`,printStopped:`Print Stopped`,progress:`Progress`,printerOffline:`Printer Offline`,printerError:`Printer Error`,lowFilament:`Low Filament`,maintenanceDue:`Maintenance Due`,test:`Test`},timeAgo:{justNow:`Just now`,minutesAgo:`{{minutes}}m ago`,hoursAgo:`{{hours}}h ago`}},restoreBackup:{title:`Restore Backup`,restoring:`Restoring...`,restoreComplete:`Restore Complete`,restoreFailed:`Restore Failed`,importSettings:`Import settings from a backup file`,pleaseWait:`Please wait while your data is being restored`,clickToSelect:`Click to select backup file (.json or .zip)`,howDuplicateHandling:`How duplicate handling works:`,categories:{printers:`Printers`,smartPlugs:`Smart Plugs`,notificationProviders:`Notification Providers`,filaments:`Filaments`,archives:`Archives`,pendingUploads:`Pending Uploads`,settingsTemplates:`Settings & Templates`},matchingInfo:{printers:`matched by serial number`,smartPlugs:`matched by IP address`,notificationProviders:`matched by name`,filaments:`matched by name + type + brand`,archives:`matched by content hash`,pendingUploads:`matched by filename`,settingsTemplates:`always overwritten`},replaceExisting:`Replace existing data`,keepExisting:`Keep existing data`,replaceDescription:`Overwrite items that already exist with backup data`,keepDescription:`Only restore items that don't already exist`,caution:`Caution:`,cautionText:`Overwriting will replace your current configurations with backup data. Printer access codes are never overwritten for security.`,itemsRestored:`Items Restored`,itemsSkipped:`Items Skipped`,restored:`Restored`,skipped:`Skipped (already exist)`,filesLabel:`Files (3MF, thumbnails, etc.)`,newApiKeysGenerated:`New API Keys Generated`,newApiKeysWarning:`These keys are only shown once. Copy them now!`,processingBackup:`Processing backup file...`,noDataFound:`No data was found to restore in the backup file.`,failedToRestore:`Failed to restore backup. Please check the file format.`},backupExport:{title:`Export Backup`,selectData:`Select data to include`,selectAll:`Select All`,selectNone:`Select None`,categoryDescriptions:{settings:`Language, theme, update preferences`,notifications:`ntfy, Pushover, Discord, etc.`,templates:`Custom message templates`,smartPlugs:`Tasmota plug configurations`,externalLinks:`Sidebar links to external services`,printers:`Printer info (access codes excluded)`,plateDetection:`Empty plate reference images`,filaments:`Filament types and costs`,maintenance:`Custom maintenance schedules`,archives:`All print data + files (3MF, thumbnails, photos)`,projects:`Projects, BOM items, and attachments`,pendingUploads:`Virtual printer uploads awaiting review`,apiKeys:`Webhook API keys (new keys generated on import)`},requiresPrinters:`Requires Printers to be selected`,zipFileWarning:`ZIP file will be created.`,zipFileDescription:`Includes all 3MF files, thumbnails, timelapses, and photos. This may take a while and result in a large file.`,includeAccessCodes:`Include Access Codes`,includeAccessCodesDescription:`For transferring to another machine`,includeAccessCodesWarning:`Access codes will be included in plain text. Keep this backup file secure!`,categoriesSelected:`{{selectedCount}} categories selected`},pendingUploads:{placeholders:{notes:`Add notes about this print...`},discardUpload:`Discard Upload`,archiveAllUploads:`Archive All Uploads`,discardAllUploads:`Discard All Uploads`,archive:`Archive`,timeAgo:{justNow:`Just now`,minutesAgo:`{{minutes}}m ago`,hoursAgo:`{{hours}}h ago`,daysAgo:`{{days}}d ago`}},apiBrowser:{placeholders:{requestBody:`JSON request body...`,searchEndpoints:`Search endpoints...`}},configureAmsSlot:{title:`Configure AMS Slot`,slotConfigured:`Slot Configured!`,configuringSlot:`Configuring slot:`,slotLabel:`{{ams}} Slot {{slot}}`,searchPresets:`Search presets...`,colorPlaceholder:`Color name or hex (e.g., brown, FF8800)`,clearCustomColor:`Clear custom color`,noCloudPresets:`No cloud presets. Login to Bambu Cloud to sync.`,noPresetsAvailable:`No presets available. Login to Bambu Cloud or import local profiles.`,noMatchingPresets:`No matching presets found.`,custom:`Custom`,builtin:`Built-in`,orcaCloud:`Orca Cloud`,bambuCloud:`Bambu Cloud`,settingsSentToPrinter:`Settings sent to printer`,filamentProfile:`Filament Profile`,kProfileLabel:`K Profile (Pressure Advance)`,filteringFor:`Filtering for: {{material}}`,noKProfile:`No K profile (use default 0.020)`,noMatchingKProfiles:`No matching K profiles found. Default K=0.020 will be used.`,otherKProfiles:`Other K profiles on this printer`,selectFilamentFirst:`Select a filament profile first`,kFromCalibration:`K={{value}} from printer calibration`,customColorLabel:`Custom Color (optional)`,presetColors:`{{name}} colors:`,showLessColors:`Show less colors`,showMoreColors:`Show more colors`,clear:`Clear`,hexLabel:`Hex: #{{hex}}`,resetting:`Resetting...`,resetSlot:`Reset Slot`,cancel:`Cancel`,configuring:`Configuring...`,configureSlot:`Configure Slot`,orcaFallback:{no_filament_id:`This Orca profile has no filament ID of its own, so OrcaSlicer will see this slot as Generic {{material}}.`,lookup_failed:`Couldn't read this profile's filament ID from Orca Cloud, so OrcaSlicer will see this slot as Generic {{material}}. Try again in a moment.`,no_permission:`You don't have Orca Cloud access, so this profile's filament ID couldn't be read. OrcaSlicer will see this slot as Generic {{material}}.`}},githubBackup:{title:`Git Backup`,history:`History`,downloadBackup:`Download Backup`,restoreBackup:`Restore Backup`,noBackupsYet:`No backups yet`},emailSettings:{placeholders:{fromName:`BamBuddy`}},tagManagement:{searchTags:`Search tags...`,renameTag:`Rename tag`,deleteTag:`Delete tag`},notificationTemplates:{placeholders:{title:`Notification title...`,body:`Notification body...`}},batchTag:{placeholders:{newTag:`Enter new tag...`}},photoGallery:{deletePhoto:`Delete Photo`},filamentHoverCard:{copySpoolUuid:`Copy spool UUID`},kProfilesView:{hasNote:`Has note`,copyProfile:`Copy profile`},layout:{openMenu:`Open menu`,noPermissionSystemInfo:`You do not have permission to view system information`},dashboard:{dragToReorder:`Drag to reorder`,hideWidget:`Hide widget`},notificationProviderCard:{deleteNotificationProvider:`Delete Notification Provider`},fileManagerModal:{closeFileManager:`Close file manager`,sortFiles:`Sort files`,goToParentFolder:`Go to parent folder`,threeView:`3D View`},embeddedCameraViewer:{refreshStream:`Refresh stream`,close:`Close`,zoomOut:`Zoom out`,resetZoom:`Reset zoom`,zoomIn:`Zoom in`,dragToResize:`Drag to resize`},timelapseViewer:{skipBack5s:`Skip back 5s`,skipForward5s:`Skip forward 5s`},notificationProviders:{descriptions:{email:`SMTP email notifications`,telegram:`Notifications via Telegram bot`,discord:`Send to Discord channel via webhook`,ntfy:`Free, self-hostable push notifications`,pushover:`Simple, reliable push notifications`,callmebot:`Free WhatsApp notifications via CallMeBot`,webhook:`Generic HTTP POST to any URL`}},logViewer:{searchPlaceholder:`Search message or logger name...`,noLogEntries:`No log entries found`},switchbarPopover:{noSwitchesInSwitchbar:`No switches in switchbar`},projectPageModal:{placeholders:{title:`Title`,designer:`Designer`,license:`License`,description:`Enter description...`,profileTitle:`Profile Title`,profileDescription:`Profile description...`}},spoolmanSettings:{},time:{unknown:`-`,waiting:`Waiting`,justNow:`Just now`,now:`Now`,minsAgo:`{{count}}m ago`,inMins:`in {{count}}m`,hoursAgo:`{{count}}h ago`,inHours:`in {{count}}h`,daysAgo:`{{count}}d ago`,inDays:`in {{count}}d`},spoolbuddy:{nav:{dashboard:`Dashboard`,ams:`AMS`,inventory:`Inventory`,writeTag:`Write`,settings:`Settings`},status:{nfcReady:`NFC Ready`,nfcOff:`NFC Off`,offline:`Offline`,online:`Online`,noPrinters:`No printers`,deviceOffline:`Device Offline`,waitingConnection:`Waiting for device connection...`,systemReady:`System Ready`,status:`Status`},dashboard:{readyToScan:`Ready to scan`,idleMessage:`Place a spool on the scale to identify it`,nfcHint:`NFC tag will be read automatically`,device:`Device`,syncWeight:`Sync Weight`,weightSynced:`Synced!`,unknownTag:`Unknown Tag`,newTag:`New Tag Detected`,onScale:`on scale`,linkSpool:`Link to Spool`,linkTagTitle:`Link Tag to Spool`,linkTag:`Link Tag`,selectSpool:`Select a spool to link this tag to:`,noUntagged:`No spools without tags found`,tagDetected:`Tag detected`,noTag:`No tag`,tagId:`Tag`,grossWeight:`Gross weight`,spoolSize:`Spool size`,close:`Close`,currentSpool:`Current Spool`,plateReady:`Plate ready: {{name}}`,plateReadyLabel:`Plates ready to clear`,plateClearAction:`Clear`,plateClearedToast:`Plate marked as cleared`,plateClearFailed:`Could not mark plate as cleared`},modal:{spoolDetected:`Spool Detected`,assignToAms:`Assign to AMS`,syncWeight:`Sync Weight`,weightSynced:`Synced!`,syncing:`Syncing...`,newTagDetected:`New Tag Detected`,addToInventory:`Add to Inventory`,assignToAmsTitle:`Assign to AMS`,selectSlot:`Select a slot`,assign:`Assign`,assigning:`Assigning...`,assignSuccess:`Assigned!`,assignPendingInsert:`Assigned. Slot will configure when you insert the spool.`,assignError:`Failed to assign spool. Please try again.`,noPrinterSelected:`Select a printer...`,noAmsDetected:`No AMS detected on this printer`,slot:`Slot`},weight:{noReading:`No reading`,stable:`Stable`,measuring:`Measuring...`,tare:`Tare`,calibrate:`Calibrate`},spool:{remaining:`Remaining`,material:`Material`,brand:`Brand`,color:`Color`,coreWeight:`Core`,labelWeight:`Label`,scaleWeight:`Scale`,netWeight:`Net`,lastUsed:`Last used`,unknownColor:`Unknown color`},ams:{noData:`No AMS detected`,connectAms:`Connect an AMS to see filament slots`,noPrinter:`No printer selected`,selectPrinter:`Select a printer from the top bar`,printerDisconnected:`Printer disconnected`,humidity:`Humidity`,level:`Level`,active:`Active`,slot:`Slot`,empty:`Empty`},inventory:{search:`Search spools...`,empty:`No spools in inventory`,noResults:`No matching spools`,spools:`spools`,addSpool:`Add Spool`},settings:{tabDevice:`Device`,tabDisplay:`Display`,tabScale:`Scale`,tabUpdates:`Updates`,nfcReader:`NFC Reader`,type:`Type`,connection:`Connection`,notConnected:`N/A`,deviceInfo:`Device Info`,hostname:`Host`,uptime:`Uptime`,systemConfig:`Backend & Auth`,backendUrl:`Bambuddy Backend URL`,apiToken:`API Token`,apiTokenPlaceholder:`Enter API token`,saveConfig:`Save Config`,systemQueued:`Config queued.`,nfcDiagnostic:`NFC Diagnostic`,scaleDiagnostic:`Scale Diagnostic`,readTagDiagnostic:`Read Tag Diagnostic`,testNfc:`Test reader`,testScale:`Test accuracy`,testReadTag:`Read tag`,systemFieldsRequired:`Backend URL is required.`,brightness:`Brightness`,saved:`Saved`,noBacklight:`No DSI backlight detected. Brightness control requires a DSI display.`,screenBlank:`Screen Blank Timeout`,screenBlankDesc:`Screen turns off after inactivity. Touch to wake.`,displayNote:`Brightness is applied as a software filter.`,scaleCalibration:`Scale Calibration`,currentWeight:`Current weight`,tareOffset:`Tare`,calFactor:`Factor`,knownWeight:`Known weight`,calStep1:`Remove all items from the scale and press Set Zero.`,calStep2:`Place known weight on scale.`,setZero:`Set Zero`,calibrateNow:`Calibrate`,calibrated:`Calibrated`,tareSet:`Tare command sent. Waiting for device...`,tareComplete:`Tare complete!`,tareTimedOut:`Tare timed out — is the SpoolBuddy daemon running?`,tareFailed:`Failed to send tare command`,zeroSet:`Zero point set. Place known weight on scale.`,calibrationDone:`Calibration complete!`,calibrationFailed:`Calibration failed`,lastCalibrated:`Last calibrated`,stable:`Stable`,settling:`Settling...`,firmware:`Firmware`,scale:`Scale`,noDevice:`No SpoolBuddy device found`,daemonVersion:`Daemon Version`,currentVersion:`Current`,versionPending:`Waiting for daemon...`,checking:`Checking...`,checkUpdates:`Check for Updates`,updateAvailable:`Update available`,updateInstructions:`Update via SSH: run the SpoolBuddy install script to upgrade.`,upToDate:`Up to date`,includeBeta:`Include beta versions`},writeTag:{tabExisting:`Existing Spool`,tabNew:`New Spool`,tabReplace:`Replace Tag`,searchPlaceholder:`Search by material, color, brand...`,noUntaggedSpools:`No spools without tags`,noTaggedSpools:`No spools with tags`,selectSpool:`Select a spool, then place a blank NTAG on the reader`,placeTag:`Place an NTAG on the reader`,tagReady:`Tag detected — ready to write`,writeTag:`Write Tag`,replaceTag:`Replace Tag`,writing:`Writing tag...`,waiting:`Waiting for SpoolBuddy...`,writeSuccess:`Tag written successfully!`,writeFailed:`Write failed`,queueFailed:`Failed to queue write command`,tryAgain:`Try Again`,cancel:`Cancel`,replaceWarning:`Old tag will be unlinked. New tag will replace it.`,deviceOffline:`SpoolBuddy is offline`,material:`Material`,colorName:`Color Name`,color:`Color`,brand:`Brand`,weight:`Weight (g)`,createSpool:`Create Spool`,creating:`Creating...`,spoolCreated:`Spool created! Ready to write.`,createFailed:`Failed to create spool`,incompleteDataWarning:`Tag written with incomplete Spoolman data`},quickMenu:{printerPower:`Printer Power`,systemControls:`System`,restartDaemon:`Restart Daemon`,restartBrowser:`Restart Browser`,reboot:`Reboot`,shutdown:`Shutdown`,swipeToClose:`Swipe down to close`,confirmTitle:`Confirm`,confirmShutdown:`Are you sure you want to shut down the SpoolBuddy? You will need physical access to turn it back on.`,confirmReboot:`Are you sure you want to reboot the SpoolBuddy?`,confirmRestartDaemon:`Restart the SpoolBuddy daemon? NFC and scale will be temporarily unavailable.`,confirmRestartBrowser:`Restart the kiosk browser? The display will briefly go blank.`,confirm:`Confirm`,confirmPlugOn:`Turn on {{name}}?`,confirmPlugOff:`Turn off {{name}}?`,turnOn:`Turn On`,turnOff:`Turn Off`}},diagnostic:{modalTitle:`Connection diagnostic — {{name}}`,running:`Running diagnostic...`,runningElapsed:`Running diagnostic... ({{elapsed}}s)`,waitingForReportHint:`Listening for the printer to publish a status report — this can take up to {{max}} seconds.`,runFailed:`Diagnostic could not run: {{error}}`,retry:`Run again`,runButton:`Run diagnostic`,sectionTitle:`Connection Diagnostic`,sectionDescription:`Check why a printer won't connect or won't print — port reachability, LAN developer mode, Docker network mode, and credentials.`,noPrinters:`No printers configured.`,overall:{ok:`No problems found — the printer connection looks healthy.`,warnings:`The printer should work, but some things need attention.`,problems:`Found problems that explain why the printer won't connect or print.`},check:{port_mqtt:{title:`Control port (MQTT 8883)`,pass:`Reachable — the printer is accepting control connections.`,fail:`Port 8883 is unreachable. The printer is powered off, on a different IP address, or a firewall is blocking it. Verify the printer IP and that nothing blocks port 8883.`},port_ftps:{title:`File transfer port (FTPS 990)`,pass:`Reachable — sending print files will work.`,warn:`Port 990 is unreachable. Monitoring may still work, but sending prints to the printer will fail. Make sure port 990 is not blocked.`,warn_no_tls:`Port 990 is open but the printer's file service is not completing a TLS handshake. Print files, covers and timelapses cannot be fetched, so archives stay empty. Restart the printer — unblocking the port will not help.`},external_storage:{title:`Store sent files on external storage (install step 4)`,pass:`The printer reports this option is on — sent files will be stored on the SD card and archives will have thumbnails and slicer metadata.`,fail:`The printer reports this option is off. Enable "Store sent files on external storage" — on newer firmware (P2S 01.02 / Bambu Studio 2.6+) the toggle lives on the printer's Print Settings; on older versions it's in Bambu Studio / OrcaSlicer's Device tab. Without it, every archived print is missing its thumbnail and slicer metadata.`,skip:`Not checked — needs a live MQTT connection. On older slicers where this setting lives only in the slicer the printer never reports it, so this check will pass even when the option is off — verify install step 4 manually.`,skip_unsupported_model:`This model has an SD slot but no way to turn the option on — current P1-series firmware doesn't expose the toggle in Bambu Studio and the printer has no screen. Nothing to fix here; archived prints may lack thumbnails and slicer metadata until Bambu Lab adds firmware support.`,fail_no_media:`The option is on, but the printer reports no card or stick in its slot, so there is nowhere for sent files to go. Insert one and print again — until then every archived print will be missing its thumbnail and slicer metadata.`,warn_internal_storage:`The option is on and storage is present, but the last print still went to the printer's internal storage, which Bambuddy cannot read. On H2-series, P2S and X2D, Bambu Studio's Print button always sends there whatever this option is set to. Prints archive with their name and timing, but without a thumbnail or slicer metadata. For complete archives, start prints from Bambuddy or slice in OrcaSlicer — or in Bambu Studio use Send with External selected, then start the print.`,warn_internal_history:`The option is on and storage is present, but the last print ran from a file that was already on the printer — a re-print from its screen, a start from Handy, or a file sent earlier. That library sits on internal storage Bambuddy cannot read, and no setting changes it, because nothing was sent for that print. It still archives with its name and timing, but without a thumbnail or slicer metadata. For complete archives, start prints from Bambuddy or send them from the slicer.`},port_rtsps:{title:`Camera port ({{protocol}} {{port}})`,pass:`Reachable — the camera stream will work.`,warn:`Port {{port}} is unreachable. The live camera view will not work. This does not affect printing.`},macos_local_network:{title:`macOS Local Network permission`,pass:`macOS is allowing Bambuddy to reach the local network.`,warn_unsigned:`The Python that runs Bambuddy has no code signature, so macOS has nothing to attach a Local Network permission to and silently drops every connection to the printer — no error and no prompt. Run the Bambuddy updater (install/update_macos.sh), which signs it, then restart Bambuddy. Interpreter: {{executable}}`,warn_permission:`If the printer is powered on and at this address, open System Settings > Privacy & Security > Local Network and make sure the Python that runs Bambuddy is enabled. macOS drops local connections silently when it is not, and updating Python can leave the old permission behind.`},network_mode:{title:`Container network mode`,genericRuntime:`a container`,pass:`Running in {{runtime}} with host networking.`,warn:`Bambuddy is running in {{runtime}} with bridge networking. Printer discovery and the Virtual Printer need host networking — recreate the container with host network mode ("network_mode: host" in docker-compose, "--network=host" for Podman).`,skip:`Not running in a container — not applicable.`,skip_unknown:`Bambuddy is running in {{runtime}}, but its network mode could not be determined. If printer discovery or the Virtual Printer do not work, recreate the container with host networking.`,skip_system_container:`Bambuddy is running in a {{runtime}} system container, which sits on the LAN like a virtual machine — not applicable.`},subnet:{title:`Network subnet`,pass:`The printer and Bambuddy are on the same subnet.`,warn:`The printer ({{printer_ip}}) and Bambuddy ({{host_ip}}) are on different subnets. They may not reach each other unless routing between the subnets is configured.`,skip:`Subnet could not be determined — skipped.`},mqtt_auth:{title:`Printer credentials`,pass:`The printer accepted the connection.`,fail:`The printer is reachable but Bambuddy is not connected to it. The access code or serial number is most likely wrong — the access code changes every time LAN Only or Developer Mode is toggled, so re-copy it from the printer screen. A printer that is rebooting, or already at its limit of simultaneous connections, can look the same.`,fail_auth_rejected:`The printer refused Bambuddy's credentials. The access code or serial number is wrong — the access code changes every time LAN Only or Developer Mode is toggled, so re-copy it from the printer screen and save it in the printer settings.`,skip:`Not checked — the printer could not be reached.`},developer_mode:{title:`LAN Developer Mode`,pass:`Developer Mode is enabled.`,fail:`Developer Mode is OFF on the printer. Enable it in the printer's LAN settings — and confirm with OK. Without it, prints will not start.`,skip:`Could not be checked — requires a live connection to the printer.`},printer_publishing:{title:`Printer is publishing status`,pass:`The printer is publishing status updates — AMS, filaments, and K-profiles will mirror correctly to the slicer.`,fail:`The MQTT broker accepted the connection but the printer has not published any status reports. This is almost always a wrong or mis-cased serial number — the device//report topic is case-sensitive. Re-check the serial in printer settings against the screen on the printer.`,skip:`Could not be checked — requires a live connection to the printer.`}}},systemHealth:{sectionTitle:`System Health`,sectionDescription:`Scans recent logs for known issues you can usually fix yourself, before they turn into a support ticket.`,rescan:`Re-scan`,clean:`No known issues found in the last {{times}} log entries.`,logUnavailable:`File logging is disabled, so logs cannot be scanned. Enable file logging to use this check.`,learnMore:`How to fix`,fixLabel:`Fix:`,occurrences:`Seen {{times}}× — last at {{lastSeen}}`,category:{layer8:`You can fix this`,environment:`Environment`,bug:`Please report this`},signature:{"ftp-auth-rejected":{name:`Printer rejected the access code`,cause:`The printer refused the file-transfer login. The access code is wrong, or it changed after Developer Mode was toggled.`,fix:`Re-copy the access code from the printer screen (LAN settings) and update it in the printer's settings in Bambuddy.`},"ftp-connection-timeout":{name:`File-transfer connection timed out`,cause:`Bambuddy could not reach the printer's file-transfer port (FTPS 990). The port is blocked, or the printer is off or on another subnet.`,fix:`Make sure nothing blocks port 990 between Bambuddy and the printer, and that both are on the same network.`},"ftp-ssl-error":{name:`Secure file-transfer handshake failed`,cause:`The printer's file service answered port 990 without TLS. Its file server has wedged — a printer-side fault, not a firewall or firmware problem.`,fix:`Restart the printer. Until then print files, covers and timelapses cannot be fetched; printing itself is unaffected.`},"bambu-cloud-captcha":{name:`Bambu Cloud is asking for a CAPTCHA`,cause:`Bambu's anti-abuse layer is challenging this network, so no Bambu Cloud sign-in can complete. It is tied to the public IP address, not to your account or this installation.`,fix:`Wait — it normally clears within a few hours, and repeated sign-in attempts prolong it. To connect meanwhile, sign in with an access token taken from a browser session.`},"mqtt-connection-flapping":{name:`Printer connection keeps dropping`,cause:`The control connection (MQTT 8883) repeatedly disconnects and reconnects — usually a weak network path or a partially blocked port.`,fix:`Check the Wi-Fi signal at the printer, prefer a wired connection, and make sure port 8883 is reliably reachable.`},"camera-connection-refused":{name:`Camera stream unreachable`,cause:`The live camera could not be reached on port RTSPS 322. The port is blocked, or the camera or LAN liveview is off on the printer.`,fix:`Enable the camera and LAN liveview on the printer, and make sure port 322 is not blocked. This does not affect printing.`},"database-locked":{name:`Database write contention`,cause:`The SQLite database is hitting "database is locked" errors under load — common when running several printers at once.`,fix:`Switch Bambuddy to an external PostgreSQL database. See the PostgreSQL guide in the documentation.`}}},vpDiagnostic:{title:`Setup check — {{name}}`,runButton:`Run setup check`,running:`Running setup check...`,runFailed:`Could not run the setup check: {{error}}`,retry:`Run again`,overall:{ok:`All checks passed — this virtual printer is set up correctly.`,warnings:`The virtual printer should work, but some things need attention.`,problems:`Found problems that explain why the slicer can't see or use this virtual printer.`},check:{enabled:{title:`Virtual printer enabled`,fail:`This virtual printer is switched off. Toggle it on to make it discoverable.`},running:{title:`Services running`,fail:`The virtual printer is enabled but its services are not running. Check the Bambuddy log — a bind IP conflict or a permission error usually stops them.`},bind_interface:{title:`Bind network interface`,fail:`The bind interface is not set, or no longer exists on this host. Pick a current interface in the Bind Interface dropdown.`},access_code:{title:`Access code set`,fail:`No access code is set. The slicer must be given the same 8-character access code you set here.`},target_printer:{title:`Target printer`,fail:`No target printer is selected. Proxy mode needs a real printer to forward to.`,warn:`The target printer is offline right now — proxying will resume once it reconnects.`},port_ftps:{title:`File-upload service (port {{port}})`,fail:`Nothing is listening on port {{port}} of the bind IP, so the slicer cannot upload files. A port conflict on this interface is the usual cause.`},port_mqtt:{title:`Control service (port {{port}})`,fail:`Nothing is listening on port {{port}} of the bind IP, so the slicer cannot connect or show status.`},port_bind:{title:`Discovery service (port {{port}})`,fail:`Nothing is listening on port {{port}} of the bind IP, so the slicer's discovery handshake fails.`},privileged_ports:{title:`Privileged port binding`,fail:`Port {{port}} is below 1024, and this service is not permitted to bind it — which is why nothing is listening above. Add AmbientCapabilities=CAP_NET_BIND_SERVICE to /etc/systemd/system/bambuddy.service and restart, or run "sudo setcap cap_net_bind_service=+ep $(readlink -f $(which python3))". On Docker, add cap_add: [NET_BIND_SERVICE].`},certificate:{title:`TLS certificate`,pass:`Certificate ready. Make sure the Bambuddy CA certificate (above) is imported into your slicer's trust store.`,fail:`The TLS certificate for this virtual printer is missing. Check that the Bambuddy data directory is writable.`}}},bugReport:{title:`Report a Bug`,description:`Description`,descriptionPlaceholder:`What went wrong? Please describe the issue...`,email:`Email (optional)`,emailPlaceholder:`your@email.com`,emailPrivacy:`If provided, your email will be included in a collapsed section of the GitHub issue so the maintainer can follow up.`,screenshot:`Screenshot`,uploadOrPaste:`Upload, paste, or drag an image`,dataCollectedSummary:`What data is included in the report?`,dataIncluded:`Included:`,dataIncludedList:`App version, OS, architecture, Python version, database stats (counts only), printer models, nozzle counts, firmware versions, connectivity status, integration status (Spoolman, MQTT, HA), non-sensitive settings, network interface count, Docker details, dependency versions.`,dataNeverIncluded:`Never included:`,dataNeverIncludedList:`Printer names, serial numbers, access codes, passwords, IP addresses, email addresses, API keys, tokens, webhook URLs, hostnames, or usernames.`,submit:`Submit`,startLogging:`Start Debug Logging`,stepEnableLogging:`Debug logging enabled`,stepReproduce:`Reproduce the issue now`,stepStopLogging:`Stop & submit report`,stopAndSubmit:`Stop & Submit`,maxDuration:`Auto-stops after {{minutes}} min`,stoppingLogs:`Collecting logs & submitting...`,submitting:`Submitting bug report...`,submittingStepConnection:`Running printer connectivity checks`,submittingStepVirtualPrinters:`Running virtual-printer setup checks`,submittingStepLogScan:`Scanning recent logs for known issues`,submittingStepSubmit:`Submitting report to GitHub`,submitSuccess:`Bug report submitted successfully!`,submitFailed:`Failed to submit bug report`,diagnosticChecking:`Checking printer connections...`,diagnosticHealthy:`Connection check passed — no problems found on your printers.`,diagnosticSummary:`{{problems}} of {{total}} printers have connection issues`,diagnosticIntro:`One or more printers have a connection problem that may be causing your issue. Expand a printer below to see the fix — resolving it could solve the problem without a bug report. You can still submit a report below.`,logHealthSummary:`Known issues found in your logs`,logHealthIntro:`Recent logs match known problems. Check the fixes below — resolving them could solve your issue without a bug report. You can still submit a report below.`,thankYou:`Thank you!`,submitted:`Your bug report has been submitted.`,viewIssue:`View Issue`,closeKeepsRecording:`You can close this panel while you reproduce the problem — recording keeps running, and reopening brings you back here.`,resumeRecording:`Bug report recording — {{elapsed}}. Click to finish.`,resumeReport:`Resume report`,unexpectedError:`An unexpected error occurred`},failureDetection:{title:`AI Failure Detection`,description:`Monitor prints with a self-hosted Obico ML API and act on detected failures automatically.`,mlUrl:`Obico ML API URL`,mlUrlHint:`Base URL of your self-hosted Obico ml_api container (e.g. http://192.168.1.10:3333).`,bambuddyInternalUrl:`Bambuddy Internal URL (optional)`,bambuddyInternalUrlHint:`Bambuddy address reachable from the ML API, such as a Docker service name or LAN IP. Leave empty to use External URL. Other integrations still use External URL.`,bambuddyInternalUrlInvalid:`Must start with http:// or https:// (for example http://bambuddy:8000). Not saved until it does.`,mlToken:`ML API Token (optional)`,mlTokenPlaceholder:`Leave empty if the server runs without ML_API_TOKEN`,mlTokenHint:`Must match the ML_API_TOKEN environment variable of your Obico ml_api container. Leave empty when the container runs without one.`,test:`Test`,testSuccess:`ML API reachable and healthy.`,testSuccessTokenUnknown:`ML API reachable and healthy. The token could not be checked.`,testFailed:`Could not reach the ML API.`,sensitivity:`Sensitivity`,sensitivityLow:`Low (fewer false positives)`,sensitivityMedium:`Medium (balanced)`,sensitivityHigh:`High (detect early, more false positives)`,sensitivityHint:`Adjusts the confidence thresholds that trigger warnings and failures.`,action:`Action on detected failure`,actionNotify:`Notify only`,actionPause:`Pause print`,actionPauseOff:`Pause and cut power`,pollInterval:`Poll interval (seconds)`,pollIntervalHint:`How often to check each printer while it is printing. Minimum 5s, maximum 120s.`,externalUrlMissing:`No address set for the ML API to fetch snapshots from.`,externalUrlHint:`Set Bambuddy Internal URL here or External URL in Settings → Network so the ML API can fetch snapshots.`,perPrinterTitle:`Monitored Printers`,perPrinterHint:`Choose which printers the detection service watches.`,monitorAll:`Monitor all connected printers`,statusTitle:`Status`,serviceRunning:`Service running`,thresholds:`Low / High thresholds`,activePrinters:`Active prints`,noActivePrints:`No prints currently running.`,historyTitle:`Recent Detections`,noHistory:`No detections yet.`},modelSources:{title:`Model Sources`,tabMakerworld:`MakerWorld`,tabManyfold:`Manyfold`},manyfold:{description:`Browse and search your Manyfold library and import its files to slice and print them.`,notConnectedTitle:`Manyfold is not connected`,notConnectedBody:`Ask an administrator to connect your Manyfold library.`,connectionTitle:`Manyfold connection`,connectionHelp:`In Manyfold, open Settings → API and create an application with the scopes "public" and "read". Enter its client ID and secret here. Bambuddy sees the models the application's owner can see.`,url:`Manyfold URL`,urlPlaceholder:`http://192.168.1.10:3214`,clientId:`Client ID`,clientSecret:`Client secret`,clientSecretStored:`Stored. Leave empty to keep it.`,test:`Test connection`,testOk:`Connected. Models Bambuddy can see: {{count}}`,disconnect:`Disconnect`,disconnectTitle:`Disconnect Manyfold?`,disconnectBody:`Bambuddy forgets the Manyfold URL, client ID and secret. Files you imported stay in your library.`,disconnected:`Manyfold disconnected`,editConnection:`Connection`,searchPlaceholder:`Search models`,modelCount:`Models: {{count}}`,noModels:`No models found.`,previous:`Previous`,next:`Next`,page:`Page {{page}}`,back:`Back to models`,openInManyfold:`Open in Manyfold`,license:`License`,files:`Files`,noFiles:`This model has no files.`,importTo:`Import to`,folderAuto:`Manyfold folder`,import:`Import`,importing:`Importing…`,imported:`Imported {{filename}}`,alreadyInLibrary:`Already in your library`,inLibrary:`In library`,showInLibrary:`Show in library`,notImportable:`Bambuddy can't slice or print this type`,selectAll:`Select all`,selectFile:`Select {{name}}`,importSelected:`Import selected ({{count}})`,importAll:`Import all`,importProgress:`Importing {{current}}/{{total}}`,bulkDone:`Imported: {{imported}} · already in library: {{existing}} · failed: {{failed}}`,bulkFailed:`Not imported: {{names}}. {{reason}}`,bulkNothing:`Nothing to import: every printable file is already in your library.`,selectModel:`Select {{name}}`,selectPage:`Select page`,modelsSelected:`Models selected: {{count}}`,importModels:`Import their files`,clearSelection:`Clear selection`,collectProgress:`Reading models {{current}}/{{total}}`,modelsUnreadable:`Could not read: {{names}}`,errors:{manyfold_not_configured:`Manyfold is not connected.`,manyfold_credentials:`Manyfold did not accept the client ID or secret.`,manyfold_scope:`The Manyfold application needs the "read" scope. Edit it in Manyfold under Settings → API.`,manyfold_rate_limited:`Manyfold is limiting sign-ins. Try again in a few minutes.`,manyfold_unreachable:`Bambuddy can't reach Manyfold. Check the URL and that Manyfold is running.`,manyfold_forbidden:`Manyfold refused access. Check that the application's owner can see this model.`,manyfold_not_found:`Manyfold can't find this model or file.`,manyfold_too_large:`The file is larger than 200 MB.`,manyfold_not_importable:`Only 3MF, STL and STEP files can be imported.`,manyfold_bad_url:`Enter the Manyfold URL starting with http:// or https://.`,manyfold_secret_required:`Enter the client secret.`,manyfold_failed:`Manyfold answered with an error.`}},makerworld:{title:`MakerWorld`,description:`Paste a MakerWorld model URL to import and print it directly from Bambuddy — without leaving for the Bambu Handy app.`,pasteUrlHeader:`Import from MakerWorld`,pasteUrlPlaceholder:`https://makerworld.com/en/models/… or paste any MakerWorld link`,resolveButton:`Resolve`,signInRequiredTitle:`Bambu Cloud sign-in required to download`,signInRequiredBody:`You can browse model details anonymously, but MakerWorld requires a Bambu Cloud account to download 3MF files.`,signInExpiredTitle:`Bambu Cloud sign-in expired`,signInExpiredBody:`You are still signed in to Bambuddy, but Bambu Lab has stopped accepting the stored token, so downloads will fail. Sign in to Bambu Cloud again.`,openCloudSettings:`Open Cloud settings`,untitledModel:`Untitled model`,byCreator:`by {{name}}`,downloadsCount:`{{count}} downloads`,licensePrefix:`License`,alreadyImported:`Already in library`,openOnMakerworld:`Open on MakerWorld`,alreadyInLibrary:`This model is already in your library — find it in File Manager → MakerWorld`,importSuccess:`Imported {{filename}} — saved to File Manager → MakerWorld`,platesHeader:`Plates ({{count}})`,plateDefaultName:`Plate {{n}}`,materialCount:`{{count}} filaments`,amsRequired:`AMS required`,slicedFor:`Sliced for {{printer}}`,alsoCompatible:`Also marked compatible: {{printers}}`,importToLibrary:`Save`,sliceIn:`Save & Slice in {{slicer}}`,disclaimer:`MakerWorld integration uses community-documented API endpoints. Bambuddy is not affiliated with or endorsed by MakerWorld or Bambu Lab.`,lastImportSuccess:`Imported to your library`,lastImportAlreadyInLibrary:`Already in your library`,viewInLibrary:`View in File Manager`,openInBambuStudio:`Open in Bambu Studio`,openInOrcaSlicer:`Open in OrcaSlicer`,importTo:`Import to file manager`,recentImportsHeader:`Recent imports`,phaseResolving:`Resolving`,phaseDownloading:`Downloading`,folderAuto:`MakerWorld (default)`,importAll:`Import all`,importAllProgress:`Importing {{current}}/{{total}}`,openGallery:`Open image gallery`,galleryPrev:`Previous image`,galleryNext:`Next image`,deleteImport:`Remove from library`,importDeleting:`Removing…`,importDeleted:`Removed from library`,confirmDelete:`Remove {{filename}} from the library? This deletes the local file but the plate can be re-imported from MakerWorld.`,errors:{resolveFailed:`Could not resolve that MakerWorld URL.`,downloadFailed:`Download failed. Please try again.`,deleteFailed:`Could not remove the file from the library.`}},gcodeViewer:{filamentSlot:`Filament {{n}}`,loading:`Reading toolpath…`,loadFailed:`Could not load the G-code for this file.`,showTravel:`Travel moves`,topLayer:`Top layer`,bottomLayer:`Bottom layer`,noSource:`No file was given to preview.`,view:{filament:`Filament`,feature:`Feature`,height:`Height`,width:`Width`},feature:{wall:`Walls`,sparseInfill:`Sparse infill`,solidInfill:`Solid infill`,bridge:`Bridge / overhang`,support:`Support`,skirt:`Skirt / brim`,gapFill:`Gap fill`,ironing:`Ironing`,primeTower:`Prime tower`},back:`Back`,backToArchives:`Back to Print Archives`,backToFiles:`Back to File Manager`,plates:`Plates`,plateN:`Plate {{n}}`},libraryTrash:{title:`Trash`,headerButton:`Trash`,headerTooltip:`View files moved to the trash`,backToFiles:`Back to File Manager`,subtitleAdmin:`Deleted files stay here for {{days}} days, then auto-delete. This view shows trashed files for all users.`,subtitleUser:`Deleted files stay here for {{days}} days, then auto-delete.`,loading:`Loading trash…`,loadError:`Could not load the trash.`,empty:`The trash is empty.`,summary:`{{count}} files · {{size}}`,emptyTrash:`Empty trash`,restore:`Restore`,purgeNow:`Delete now`,autoPurgeIn:`Auto-deletes in {{when}}`,days:`days`,retentionLabel:`Auto-delete after`,selectAll:`Select all`,selectOne:`Select {{filename}}`,selectionCount:`{{count}} selected`,bulkRestore:`Restore selected`,bulkPurge:`Delete selected`,col:{filename:`File`,folder:`Folder`,size:`Size`,deleted:`Moved to trash`,autoPurge:`Auto-deletes`,owner:`Owner`,actions:`Actions`},confirm:{purgeTitle:`Delete permanently?`,purgeBody:`{{filename}} will be deleted from disk and cannot be restored.`,emptyTitle:`Empty the trash?`,emptyBody:`All {{count}} files will be deleted from disk. This cannot be undone.`,bulkPurgeTitle:`Delete selected files permanently?`,bulkPurgeBody:`The {{count}} selected files will be deleted from disk and cannot be restored.`,cta:`Delete permanently`},toast:{restored:`File restored.`,restoreFailed:`Could not restore the file.`,purged:`File deleted permanently.`,purgeFailed:`Could not delete the file.`,emptied:`Deleted {{count}} file(s) from trash.`,emptyFailed:`Could not empty the trash.`,retentionSaved:`Auto-delete set to {{days}} days.`,retentionFailed:`Could not save retention setting.`,bulkRestored:`Restored {{count}} file(s).`,bulkPurged:`Deleted {{count}} file(s).`}},libraryPurge:{title:`Purge old files`,headerButton:`Purge old`,headerTooltip:`Bulk-move old files to trash`,description:`Sweep old files out of your library in one shot. Files with a print history are aged by their last-printed date; files that were never printed are aged by their upload date.`,ageLabel:`Move files older than`,days:`days`,includeNeverPrinted:`Include files that have never been printed`,effectsTitle:`What happens when you click Purge`,effect1:`Matching files are moved to Trash — they are not deleted from disk yet.`,effect2:`You can restore them from Trash at any time until the retention window expires.`,effect3:`After retention, the trash sweeper permanently removes them from disk.`,effect4:`Files in external (linked) folders are skipped — Bambuddy never deletes bytes it does not own.`,previewLoading:`Checking how many files match…`,previewFailed:`Could not preview the purge.`,previewSummary:`{{count}} files · {{size}} would move to trash`,andMore:`…and {{count}} more`,warning:`Trashed files still count against storage until the retention window expires. Empty the Trash afterwards to free disk immediately.`,confirmCta:`Move {{count}} to trash`,purging:`Moving to trash…`,toast:{success:`Moved {{count}} file(s) to trash.`,failed:`Could not purge files.`}},libraryAutoPurge:{enableLabel:`Auto-purge old files`,enableDescription:`Runs the admin purge once per day. Files go to Trash first — they are not deleted immediately.`,ageLabel:`Auto-purge files older than`,ageDescription:`Minimum 7 days, maximum 10 years. Uses the same age rule as the manual Purge button.`,days:`days`,includeNeverPrinted:`Include files that have never been printed`,saveFailed:`Could not save auto-purge settings.`},archivePurge:{headerButton:`Purge old`,headerTooltip:`Bulk-delete old archives`,title:`Purge old archives`,description:`Clear out old print history. Each archive is aged by its most recent print completion — reprinting an archive refreshes its age, so active work is never purged.`,ageLabel:`Delete archives not printed in the last`,days:`days`,effectsTitle:`What happens when you click Purge`,effect1:`Each matching archive is hidden from the listings and its files are removed from disk (3MF, thumbnail, timelapse, source 3MF, F3D design file, photos).`,effect2:`The archive row stays in the database so Quick Stats keeps the filament, time, cost, and energy contribution — same as the single-archive delete default.`,effect3:`Tick "Also remove from statistics" below to drop the Quick Stats contribution too (matches the single-archive delete option). That path is irreversible.`,effect4:`Reprinting an archive refreshes its age clock, so archives you still use are safe.`,purgeStatsLabel:`Also remove from statistics`,purgeStatsHint:`Drops the matching archives from Quick Stats (filament, time, cost, energy). Without this, Quick Stats keeps every contribution and only the files leave disk.`,previewLoading:`Checking how many archives match…`,previewFailed:`Could not preview the purge.`,previewSummary:`{{count}} archives · {{size}} would be removed`,andMore:`…and {{count}} more`,warning:`Files are removed from disk and cannot be restored. Download or favourite anything you want to keep before continuing.`,confirmCta:`Remove {{count}} archive(s)`,purging:`Removing…`,toast:{success:`Removed {{count}} archive(s).`,failed:`Could not purge archives.`}},archiveAutoPurge:{enableLabel:`Auto-purge old archives`,enableDescription:`Once per day, hides archives from the listings and removes their files from disk when they have not been printed within the threshold. Reprinting an archive resets the clock.`,ageLabel:`Auto-delete archives not printed in the last`,ageDescription:`Minimum 7 days, maximum 10 years. Based on the most recent print completion — reprinting an archive refreshes its age. Removes the 3MF, thumbnail, timelapse, source 3MF, F3D, and photos.`,days:`days`,purgeStatsLabel:`Also remove from statistics`,purgeStatsDescription:`When enabled, the daily sweeper also drops each purged archive from Quick Stats (filament, time, cost, energy). Default off — Quick Stats keeps the contribution, only the files leave disk.`,runNow:`Purge archives now`,saveFailed:`Could not save auto-purge settings.`},connectedApps:{title:`Connected Apps`,description:`Apps that sign people in with their Bambuddy account. Each app gets a client ID and secret, and Bambuddy only ever sends a sign-in to the callback URL registered here.`,requiresAuth:`Connected apps need Bambuddy authentication. Turn it on under Users first.`,name:`App name`,namePlaceholder:`e.g. Order manager`,callbackUrl:`Callback URL`,callbackHint:`The app's documentation gives its callback URL. It must match exactly.`,add:`Add app`,empty:`No connected apps yet.`,clientId:`Client ID`,clientSecret:`Client secret`,lastUsed:`Last sign-in`,disabledBadge:`Disabled`,enable:`Enable`,disable:`Disable`,rotate:`New secret`,delete:`Delete`,cancel:`Cancel`,copy:`Copy`,secret:{title:`{{name}}: copy the secret now`,warning:`Paste the client ID and secret into the app. The secret is shown only this once; if it's lost, create a new one.`,dismiss:`I've saved it`},confirmRotate:{title:`Create a new secret?`,body:`"{{name}}" stops signing people in until you paste the new secret into it.`},confirmDelete:{title:`Delete this app?`,body:`"{{name}}" can no longer sign anyone in. If it's added again, everyone is asked for permission again.`},toast:{created:`App added`,enabled:`App enabled`,disabled:`App disabled`,rotated:`New secret created`,deleted:`App deleted`,copied:`Copied to clipboard`,copyFailed:`Copy failed. Select the text and copy it manually.`,failed:`Something went wrong`},authorize:{checking:`Checking the sign-in request…`,redirecting:`Signing you in…`,errorTitle:`Can't sign you in`,invalidRequest:`This sign-in request isn't valid: the app isn't registered, is disabled, or uses a different callback URL. Ask your Bambuddy admin to check Settings > API Keys > Connected Apps.`,authDisabled:`Sign-in with Bambuddy isn't available because Bambuddy authentication is turned off. Use the app's own login instead.`,failed:`Sign-in failed. Go back to the app and try again.`,title:`{{app}} wants to sign you in`,signedInAs:`Signed in to Bambuddy as {{username}}`,sharedData:`{{app}} will see your username, email address, groups and permissions. It doesn't get your password or your Bambuddy session.`,allow:`Allow`,deny:`Cancel`}},cameraTokens:{scope:{camera_stream:`Camera stream`,camwall:`Cam Wall`,overlay:`Streaming Overlay`},title:`Camera API Tokens`,navTitle:`Camera API tokens`,description:`Long-lived tokens for embedding the camera stream into Home Assistant, Frigate, kiosks, or any other tool that needs a stable URL. Pick the scope when you create one; a token can be revoked at any time.`,loading:`Loading…`,confirmRevoke:{title:`Revoke this token?`,body:`Any device using "{{name}}" will lose access immediately. This cannot be undone.`,cancel:`Cancel`,confirm:`Revoke`},create:{scopeLabel:`Scope`,hintCameraStream:`A camera-stream token can only fetch camera streams and snapshots. Use it for Home Assistant, Frigate, or anything embedding a single camera.`,hintCamWall:`A Cam Wall token opens /camwall on a screen with no login. It can see every printer's name and state, and their camera streams. It cannot see filenames, addresses or access codes.`,hintOverlay:`A Streaming Overlay token opens /overlay/{printerId} on a screen with no login — for OBS or any live stream. It can see one printer's camera stream plus its live print status, including the filename shown on screen. It cannot see addresses or access codes.`,title:`Create new token`,nameLabel:`Token name`,namePlaceholder:`e.g. Home Assistant`,daysLabel:`Days until expiry`,submit:`Create`,hint:`Maximum lifetime is 365 days. The token value is shown only once on creation — copy it now.`},created:{camWallUrlTitle:`Cam Wall URL for this display`,camWallUrlHint:`Open this on the screen. Anyone who can read the URL can watch the wall, so treat it like a key — revoke the token to cut the display off.`,overlayUrlTitle:`Overlay URL for OBS`,overlayUrlHint:`Add this as a Browser Source in OBS. Change the /overlay/1 number to your printer's number (from its URL on the Printers page). Anyone who can read the URL can watch the stream, so treat it like a key — revoke the token to cut it off.`,title:`Token created — copy it now`,warning:`This is the only time this token will be visible. After you close this dialog you can never view it again.`,copy:`Copy`,dismiss:`I've saved it`},list:{scope:`Scope`,myTitle:`My tokens`,allTitle:`All users (admin view)`,empty:`No tokens yet.`,name:`Name`,owner:`Owner`,prefix:`Prefix`,created:`Created`,expires:`Expires`,lastUsed:`Last used`,revoke:`Revoke`,expired:`Expired`},toast:{created:`Token created`,createFailed:`Failed to create token`,revoked:`Token revoked`,revokeFailed:`Failed to revoke token`,loadFailed:`Failed to load tokens`,copied:`Copied to clipboard`,copyFailed:`Copy failed — select and copy manually`}},forecast:{title:`Forecast`,noSpools:`No active spools found. Add spools to your inventory to see forecast data.`,noUsageData:`No usage data available — cannot project stock timeline.`,sku:`SKU`,material:`Material`,stock:`Stock`,dailyRate:`Rate`,daysLeft:`Days Left`,emptyBy:`Empty By`,reorderBy:`Reorder By`,actions:`Actions`,trend:`Trend`,estimated:`Est.`,noData:`No data`,timeframe:`Timeframe`,chartTitle:`Projected Stock — Top 5 Materials`,dashedLinesROP:`Dashed lines = reorder points`,stockLevel:`Stock Level`,reorderPoint:`Reorder Point`,safetyMargin:`Safety Margin`,trendLegend:`Trend (history-based, 95% service level)`,estimatedLegend:`Estimated (weight delta)`,noDataLegend:`No data`,ropLabel:`ROP`,ssLabel:`SS`,safetyStockLegend:`Safety stock`,stockArrivalLegend:`Stock arrival`,stockoutLegend:`Stockout`,alertCount_one:`{{count}} alert`,alertCount_other:`{{count}} alerts`,order:`Order`,save:`Save`,cancel:`Cancel`,settingsSaved:`Settings saved`,failedSaveSettings:`Failed to save settings`,globalLeadTimeSaved:`Global lead time saved`,globalLeadTime:`Global lead time`,globalLeadTimeHint:`Global lead time floor — used in reorder point calculation for all SKUs`,skuLeadTimeOverride:`Lead Time Override`,skuLeadTimeHint:`0 = use global lead time. Set >0 to override for this SKU.`,safetyMarginLabel:`Safety Margin`,effectiveLeadTime:`Effective Lead Time`,effectiveLeadTimeHint:`max(global {{global}}d, SKU {{sku}}d)`,reorderPointHint:`d̄ × LT + safety margin — order when stock hits this level`,safetyMarginHint:`Statistical safety stock (z=1.65 × σ × √LT) + user-defined buffer`,safetyMarginHintDays:`Buffer added on top of statistical safety stock.{{approx}}`,safetyMarginHintDaysApprox:` ≈ {{g}}g at current rate.`,safetyMarginHintG:`Fixed weight buffer added on top of statistical safety stock.{{approx}}`,safetyMarginHintGApprox:` ≈ {{days}}d at current rate.`,individualSpools:`Individual spools`,labelWeight:`Label`,spoolCount_one:`{{count}} spool`,spoolCount_other:`{{count}} spools`,stockBreakRisk:`Stock break risk`,stockBreakDetail:`{{days}}d remaining, lead time {{lt}}d.`,stockBreakBefore:`Stock break before replenishment`,reorderNow:`Reorder now`,reorderTriggerPassed:`Trigger date {{date}} has passed.`,shoppingList:`Shopping List`,shoppingListItems_one:`({{count}} item)`,shoppingListItems_other:`({{count}} items)`,shoppingListEmpty:`Shopping list is empty. Click the cart icon on any row to add items.`,addToCart:`Add to shopping list`,alertsSnoozed:`Mute alerts for this SKU`,alertsEnabled:`Unmute alerts for this SKU`,addedToCart:`Added to shopping list`,failedAddItem:`Failed to add item`,listView:`List`,logisticsView:`Logistics`,qty:`Qty`,weight:`Weight`,leadTime:`Lead Time`,expectedRestock:`Expected Restock`,status:`Status`,note:`Note`,pending:`Pending`,purchased:`Purchased`,received:`Received`,markPurchased:`Mark as purchased`,markReceived:`Mark as received — adds spools to Stock inventory`,resetToPending:`Reset to pending`,remove:`Remove`,clearAll:`Clear all`,downloadCsv:`CSV`,addToCartTitle:`Add to Shopping List`,byQuantity:`By Quantity`,byDuration:`By Duration`,numberOfSpools:`Number of spools`,lastHowManyDays:`Should last how many days?`,noUsageQty:`No usage data — quantity set to 1.`,noteOptional:`Note (optional)`,notePlaceholder:`e.g. for project X, urgent…`,addNSpools_one:`Add {{count}} spool`,addNSpools_other:`Add {{count}} spools`,onArrival:`On Arrival`,stockBreakIn:`Stock break in {{days}}d.`,stockRunsOutBefore:`Stock runs out before the {{lt}}d lead time elapses.`,atRate:`At {{rate}}g/day you need`,moreSpools_one:`{{count}} more spool`,moreSpools_other:`{{count}} more spools`,bridgeGap:`to bridge the gap.`,noReadAccess:`You do not have permission to view inventory forecasts.`,noWriteAccess:`You do not have permission to modify forecast settings.`}},hn=`modulepreload`,gn=function(e){return`/`+e},_n={},q=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=gn(t,n),t in _n)return;_n[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:hn,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},vn={de:()=>q(()=>import(`./de-CL7dVdMY.js`),[]),es:()=>q(()=>import(`./es-CRlbEMPu.js`),[]),fr:()=>q(()=>import(`./fr-CvEzyKAc.js`),[]),ja:()=>q(()=>import(`./ja-BxKx1wzl.js`),[]),it:()=>q(()=>import(`./it-BwhFvMoI.js`),[]),nl:()=>q(()=>import(`./nl-CkXxNW_2.js`),[]),ko:()=>q(()=>import(`./ko-B0A-ZkcE.js`),[]),"pt-BR":()=>q(()=>import(`./pt-BR-BWeofhYg.js`),[]),"zh-CN":()=>q(()=>import(`./zh-CN-GWb1sFwd.js`),[]),"zh-TW":()=>q(()=>import(`./zh-TW-BfrMVAcn.js`),[]),sv:()=>q(()=>import(`./sv-Dw4u8Ujt.js`),[]),tr:()=>q(()=>import(`./tr-Kzte0fZD.js`),[]),ru:()=>q(()=>import(`./ru-BCObMGAT.js`),[]),uk:()=>q(()=>import(`./uk-D1RooXbx.js`),[])},yn={type:`backend`,init(){},read(e,t,n){let r=vn[e];if(!r){n(null,{});return}r().then(e=>n(null,e.default),e=>{pn().then(t=>{t||n(e,null)})})}},bn=[`en`,`de`,`es`,`fr`,`ja`,`it`,`ko`,`nl`,`pt-BR`,`ru`,`sv`,`tr`,`uk`,`zh-CN`,`zh-TW`],xn=`bambuddy_appliance_locale_consumed`,Sn=Ft.use(yn).use(on).use(i).init({resources:{en:{translation:mn}},partialBundledLanguages:!0,fallbackLng:`en`,supportedLngs:bn,detection:{order:[`localStorage`,`navigator`,`htmlTag`],lookupLocalStorage:`bambutrack_language`,caches:[`localStorage`]},interpolation:{escapeValue:!1},react:{useSuspense:!1}});function Cn(){if(typeof window>`u`||!window.localStorage)return;let e=window.localStorage;typeof e.getItem!=`function`||typeof e.setItem!=`function`||e.getItem(xn)||fetch(`/api/v1/system/appliance`).then(e=>e.ok?e.json():null).then(t=>{!t||typeof t.locale!=`string`||bn.includes(t.locale)&&(Ft.changeLanguage(t.locale),e.setItem(xn,`1`))}).catch(()=>{})}Cn();var wn=[{code:`en`,name:`English`,nativeName:`English`},{code:`de`,name:`German`,nativeName:`Deutsch`},{code:`es`,name:`Spanish`,nativeName:`Español`},{code:`fr`,name:`French`,nativeName:`Français`},{code:`ja`,name:`Japanese`,nativeName:`日本語`},{code:`it`,name:`Italian`,nativeName:`Italiano`},{code:`ko`,name:`Korean`,nativeName:`한국어`},{code:`nl`,name:`Dutch`,nativeName:`Nederlands`},{code:`pt-BR`,name:`Portuguese (Brazil)`,nativeName:`Português (Brasil)`},{code:`zh-CN`,name:`Chinese (Simplified)`,nativeName:`简体中文`},{code:`zh-TW`,name:`Chinese (Traditional)`,nativeName:`繁體中文`},{code:`sv`,name:`Swedish`,nativeName:`Svenska`},{code:`tr`,name:`Turkish`,nativeName:`Türkçe`},{code:`ru`,name:`Russian`,nativeName:`Русский`},{code:`uk`,name:`Ukrainian`,nativeName:`Українська`}],Tn=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,En=/^[\\/]{2}/;function Dn(e,t){return t+e.replace(/\\/g,`/`)}var On=`popstate`;function kn(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function An(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Fn(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:In(t)}return Rn(t,n,null,e)}function jn(e,t){if(e===!1||e==null)throw Error(t)}function Mn(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Nn(){return Math.random().toString(36).substring(2,10)}function Pn(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Fn(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Ln(t):t,state:n,key:t&&t.key||r||Nn(),mask:i}}function In({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Ln(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Rn(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=kn(e)?e:Fn(h.location,e,t);n&&n(r,e),l=u()+1;let d=Pn(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=kn(e)?e:Fn(h.location,e,t);n&&n(r,e),l=u();let i=Pn(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return zn(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(On,d),c=e,()=>{i.removeEventListener(On,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function zn(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),jn(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:In(t);return i=i.replace(/ $/,`%20`),!n&&En.test(i)&&(i=r+i),new URL(i,r)}function Bn(e,t,n=`/`){return Vn(e,t,n,!1)}function Vn(e,t,n,r,i){let a=sr((typeof t==`string`?Ln(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Un(e),s=null,c=or(a);for(let e=0;s==null&&e{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;jn(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=hr([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(jn(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Wn(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:er(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=ar(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Gn(e.path))a(e,t,!0,n)}),t}function Gn(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Gn(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Kn(e){e.sort((e,t)=>e.score===t.score?tr(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var qn=/^:[\w-]+$/,Jn=3,Yn=2,Xn=1,Zn=10,Qn=-2,$n=e=>e===`*`;function er(e,t){let n=e.split(`/`),r=n.length;return n.some($n)&&(r+=Qn),t&&(r+=Yn),n.filter(e=>!$n(e)).reduce((e,t)=>e+(qn.test(t)?Jn:t===``?Xn:Zn),r)}function tr(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function nr(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function ar(e,t=!1,n=!0){Mn(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function or(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return Mn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function sr(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function cr(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Ln(e):e,a;return n?(n=mr(n),a=n.startsWith(`/`)?lr(n.substring(1),`/`):lr(n,t)):a=t,{pathname:a,search:vr(r),hash:yr(i)}}function lr(e,t){let n=gr(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ur(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function dr(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function fr(e){let t=dr(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function pr(e,t,n,r=!1){let i;typeof e==`string`?i=Ln(e):(i={...e},jn(!i.pathname||!i.pathname.includes(`?`),ur(`?`,`pathname`,`search`,i)),jn(!i.pathname||!i.pathname.includes(`#`),ur(`#`,`pathname`,`hash`,i)),jn(!i.search||!i.search.includes(`#`),ur(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=cr(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var mr=e=>e.replace(/[\\/]{2,}/g,`/`),hr=e=>mr(e.join(`/`)),gr=e=>e.replace(/\/+$/,``),_r=e=>gr(e).replace(/^\/*/,`/`),vr=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,yr=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,br=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function xr(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Sr(e){return hr(e.map(e=>e.route.path).filter(Boolean))||`/`}var Cr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function wr(e,t){let n=e;if(typeof n!=`string`||!Tn.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Cr)try{let e=new URL(window.location.href),r=En.test(n)?new URL(Dn(n,e.protocol)):new URL(n),a=sr(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{Mn(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Tr=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Tr);var Er=[`GET`,...Tr];new Set(Er);var Dr=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Or(e){try{return Dr.includes(new URL(e).protocol)}catch{return!1}}var kr=W.createContext(null);kr.displayName=`DataRouter`;var Ar=W.createContext(null);Ar.displayName=`DataRouterState`;var jr=W.createContext(!1);function Mr(){return W.useContext(jr)}var Nr=W.createContext({isTransitioning:!1});Nr.displayName=`ViewTransition`;var Pr=W.createContext(new Map);Pr.displayName=`Fetchers`;var Fr=W.createContext(null);Fr.displayName=`Await`;var Ir=W.createContext(null);Ir.displayName=`Navigation`;var Lr=W.createContext(null);Lr.displayName=`Location`;var Rr=W.createContext({outlet:null,matches:[],isDataRoute:!1});Rr.displayName=`Route`;var zr=W.createContext(null);zr.displayName=`RouteError`;var Br=`REACT_ROUTER_ERROR`,Vr=`REDIRECT`,Hr=`ROUTE_ERROR_RESPONSE`;function Ur(e){if(e.startsWith(`${Br}:${Vr}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Wr(e){if(e.startsWith(`${Br}:${Hr}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new br(t.status,t.statusText,t.data)}catch{}}function Gr(e,{relative:t}={}){jn(Kr(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=W.useContext(Ir),{hash:i,pathname:a,search:o}=ni(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:hr([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Kr(){return W.useContext(Lr)!=null}function qr(){return jn(Kr(),`useLocation() may be used only in the context of a component.`),W.useContext(Lr).location}var Jr=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Yr(e){W.useContext(Ir).static||W.useLayoutEffect(e)}function Xr(){let{isDataRoute:e}=W.useContext(Rr);return e?xi():Zr()}function Zr(){jn(Kr(),`useNavigate() may be used only in the context of a component.`);let e=W.useContext(kr),{basename:t,navigator:n}=W.useContext(Ir),{matches:r}=W.useContext(Rr),{pathname:i}=qr(),a=JSON.stringify(fr(r)),o=W.useRef(!1);return Yr(()=>{o.current=!0}),W.useCallback((r,s={})=>{if(Mn(o.current,Jr),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=pr(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:hr([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Qr=W.createContext(null);function $r(){return W.useContext(Qr)}function ei(e){let t=W.useContext(Rr).outlet;return W.useMemo(()=>t&&W.createElement(Qr.Provider,{value:e},t),[t,e])}function ti(){let{matches:e}=W.useContext(Rr);return e[e.length-1]?.params??{}}function ni(e,{relative:t}={}){let{matches:n}=W.useContext(Rr),{pathname:r}=qr(),i=JSON.stringify(fr(n));return W.useMemo(()=>pr(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ri(e,t){return ii(e,t)}function ii(e,t,n){jn(Kr(),`useRoutes() may be used only in the context of a component.`);let{navigator:r}=W.useContext(Ir),{matches:i}=W.useContext(Rr),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Ci(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant (or called \`useRoutes()\`) at "${s}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let u=qr(),d;if(t){let e=typeof t==`string`?Ln(t):t;jn(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Bn(e,{pathname:p});Mn(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),Mn(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let h=di(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:hr([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:hr([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?W.createElement(Lr.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function ai(){let e=bi(),t=xr(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=W.createElement(W.Fragment,null,W.createElement(`p`,null,`💿 Hey developer 👋`),W.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,W.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,W.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),W.createElement(W.Fragment,null,W.createElement(`h2`,null,`Unexpected Application Error!`),W.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?W.createElement(`pre`,{style:i},n):null,o)}var oi=W.createElement(ai,null),si=class extends W.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Wr(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:W.createElement(Rr.Provider,{value:this.props.routeContext},W.createElement(zr.Provider,{value:e,children:this.props.component}));return this.context?W.createElement(li,{error:e},t):t}};si.contextType=jr;var ci=new WeakMap;function li({children:e,error:t}){let{basename:n}=W.useContext(Ir);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ur(t.digest);if(e){let r=ci.get(t);if(r)throw r;let i=wr(e.location,n),a=i.absoluteURL||i.to;if(Or(a))throw Error(`Invalid redirect location`);if(Cr&&!ci.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw ci.set(t,n),n}return W.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function ui({routeContext:e,match:t,children:n}){let r=W.useContext(kr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),W.createElement(Rr.Provider,{value:e},n)}function di(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);jn(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Sr(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||oi,o&&(s<0&&c===0?(Ci(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?W.createElement(n.route.Component,null):n.route.element?n.route.element:e,W.createElement(ui,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?W.createElement(si,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function fi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pi(e){let t=W.useContext(kr);return jn(t,fi(e)),t}function mi(e){let t=W.useContext(Ar);return jn(t,fi(e)),t}function hi(e){let t=W.useContext(Rr);return jn(t,fi(e)),t}function gi(e){let t=hi(e),n=t.matches[t.matches.length-1];return jn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function _i(){return gi(`useRouteId`)}function vi(){let e=mi(`useNavigation`);return W.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function yi(){let{matches:e,loaderData:t}=mi(`useMatches`);return W.useMemo(()=>e.map(e=>Hn(e,t)),[e,t])}function bi(){let e=W.useContext(zr),t=mi(`useRouteError`),n=gi(`useRouteError`);return e===void 0?t.errors?.[n]:e}function xi(){let{router:e}=pi(`useNavigate`),t=gi(`useNavigate`),n=W.useRef(!1);return Yr(()=>{n.current=!0}),W.useCallback(async(r,i={})=>{Mn(n.current,Jr),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Si={};function Ci(e,t,n){!t&&!Si[e]&&(Si[e]=!0,Mn(!1,n))}W.memo(wi);function wi({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return ii(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Ti({to:e,replace:t,state:n,relative:r}){jn(Kr(),` may be used only in the context of a component.`);let{static:i}=W.useContext(Ir);Mn(!i,` must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.`);let{matches:a}=W.useContext(Rr),{pathname:o}=qr(),s=Xr(),c=pr(e,fr(a),o,r===`path`),l=JSON.stringify(c);return W.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function J(e){return ei(e.context)}function Y(e){jn(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function Ei({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){jn(!Kr(),`You cannot render a inside another . You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=W.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Ln(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=W.useMemo(()=>{let e=sr(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return Mn(h!=null,` is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the won't render anything.`),h==null?null:W.createElement(Ir.Provider,{value:c},W.createElement(Lr.Provider,{children:t,value:h}))}function Di({children:e,location:t}){return ri(Oi(e),t)}W.Component;function Oi(e,t=[]){let n=[];return W.Children.forEach(e,(e,r)=>{if(!W.isValidElement(e))return;let i=[...t,r];if(e.type===W.Fragment){n.push.apply(n,Oi(e.props.children,i));return}jn(e.type===Y,`[${typeof e.type==`string`?e.type:e.type.name}] is not a component. All component children of must be a or `),jn(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Oi(e.props.children,i)),n.push(a)}),n}var ki=`get`,Ai=`application/x-www-form-urlencoded`;function ji(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Mi(e){return ji(e)&&e.tagName.toLowerCase()===`button`}function Ni(e){return ji(e)&&e.tagName.toLowerCase()===`form`}function Pi(e){return ji(e)&&e.tagName.toLowerCase()===`input`}function Fi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ii(e,t){return e.button===0&&(!t||t===`_self`)&&!Fi(e)}function Li(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Ri(e,t){let n=Li(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var zi=null;function Bi(){if(zi===null)try{new FormData(document.createElement(`form`),0),zi=!1}catch{zi=!0}return zi}var Vi=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Hi(e){return e!=null&&!Vi.has(e)?(Mn(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Ai}"`),null):e}function Ui(e,t){let n,r,i,a,o;if(Ni(e)){let o=e.getAttribute(`action`);r=o?sr(o,t):null,n=e.getAttribute(`method`)||ki,i=Hi(e.getAttribute(`enctype`))||Ai,a=new FormData(e)}else if(Mi(e)||Pi(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a