1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,811613,e=>{"use strict";var t=e.i(83790);let a={name:"circle-dashed",size:24,node:[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]};a.node;let r=(0,t.default)(a);e.s(["CircleDashed",0,r],811613)},397484,e=>{"use strict";var t=e.i(83790);let a={name:"file-spreadsheet",size:24,node:[["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"}]]};a.node;let r=(0,t.default)(a);e.s(["FileSpreadsheet",0,r],397484)},590335,e=>{"use strict";var t=e.i(83790);let a={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};a.node;let r=(0,t.default)(a);e.s(["Image",0,r],590335)},495255,e=>{"use strict";var t=e.i(83790);let a={name:"shopping-cart",size:24,node:[["path",{d:"m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18",key:"uebgi3"}],["path",{d:"M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25",key:"1j7c9p"}],["circle",{cx:"18",cy:"20",r:"2",key:"t9985n"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]};a.node;let r=(0,t.default)(a);e.s(["ShoppingCart",0,r],495255)},160647,495369,e=>{"use strict";var t=e.i(717841),a=e.i(215535),r=e.i(653889),s=e.i(956537),n=e.i(837001),i=e.i(954034),l=e.i(811613),c=e.i(83790);let o={name:"receipt-text",size:24,node:[["path",{d:"M13 16H8",key:"wsln4y"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z",key:"ycz6yz"}]]};o.node;let d=(0,c.default)(o);e.s(["ReceiptText",0,d],495369);var u=e.i(495255),m=e.i(801098),x=e.i(788513),f=e.i(519455),p=e.i(538731),h=e.i(493903),v=e.i(300271),b=e.i(185482),k=e.i(975157),g=e.i(301110),j=e.i(516696);let y=["product","configured","service"];function N(e){return e.kind??"product"}function w(e){return null===e.unitPriceMinor?0:e.priceIsJobTotal?e.unitPriceMinor:null===e.qty?0:(0,v.lineGrossMinor)({qty:e.qty,unitPriceMinor:e.unitPriceMinor})}function C({line:e,currency:a}){let r=(0,x.useTranslations)("AppChat"),s=(0,m.useLocale)(),i=e.assumptions??[],c=!0===e.priceIsJobTotal,o=null===e.qty&&!c;return(0,t.jsxs)("li",{className:"text-[13px]",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[e.ready?(0,t.jsx)(n.Check,{role:"img",className:"mt-0.5 size-3.5 shrink-0 text-[var(--ok)]","aria-label":r("blocks.draft.ready")}):(0,t.jsx)(l.CircleDashed,{className:"mt-0.5 size-3.5 shrink-0 text-[var(--warn)]","aria-label":r("blocks.draft.needsInformation")}),(0,t.jsx)("span",{className:"min-w-0 flex-1 text-[var(--text-1)]",children:(0,t.jsx)(p.KeepCodes,{text:e.summary})}),(0,t.jsx)("span",{className:"shrink-0 tabular-nums text-[var(--text-2)]",children:c?(0,t.jsxs)(t.Fragment,{children:[e.driver?(0,t.jsxs)("span",{className:"mr-1 text-[var(--text-3)]",children:[e.driver.unit?`${e.driver.value.toLocaleStr
1ing(s)} ${e.driver.unit}`:r("blocks.draft.qtyOff",{count:e.driver.value}),e.driver.derived&&(0,t.jsx)("span",{className:"ml-1 text-[10px] uppercase tracking-[0.06em] text-[var(--warn)]",children:r("blocks.draft.assumed")})]}):null!==e.qty?(0,t.jsx)("span",{className:"mr-1 text-[var(--text-3)]",children:r("blocks.draft.qtyOff",{count:e.qty})}):null,(0,t.jsx)("span",{className:"text-[var(--text-3)]",children:r("blocks.draft.batchPrice")})," ",null!==e.unitPriceMinor?(0,h.formatMoney)(e.unitPriceMinor,a,s):r("blocks.common.tbc")]}):(0,t.jsxs)(t.Fragment,{children:[o?(0,t.jsx)("span",{className:"font-medium text-[var(--warn)]",children:r("blocks.draft.notStated")}):(0,t.jsxs)(t.Fragment,{children:[e.qty,e.qtyAssumed&&(0,t.jsx)("span",{className:"ml-1 text-[10px] uppercase tracking-[0.06em] text-[var(--warn)]",children:r("blocks.draft.assumed")})]})," ","Ã"," ",null!==e.unitPriceMinor?(0,h.formatMoney)(e.unitPriceMinor,a,s):e.awaitingPick?(0,t.jsx)("span",{className:"font-medium text-[var(--accent-strong)]",children:r("blocks.draft.pickAbove")}):r("blocks.common.tbc")]})})]}),o&&(0,t.jsx)("p",{className:"ml-[22px] mt-0.5 text-[12px] text-[var(--warn)]",children:r("blocks.draft.qtyNote")}),i.length>0&&(0,t.jsx)("p",{className:"ml-[22px] mt-0.5 text-[12px] text-[var(--warn)]",children:r("blocks.draft.assumedList",{name:i.map(e=>`${e.label} ${"boolean"==typeof e.value?e.value?r("blocks.common.yes").toLowerCase():r("blocks.common.no").toLowerCase():(0,b.readableValue)(e.value,{unit:e.unit})}`).join(", ")})})]})}function M({lines:e,currency:a}){let r=(0,x.useTranslations)("AppChat"),s=(0,m.useLocale)(),n={product:r("blocks.draft.kind.product"),configured:r("blocks.draft.kind.configured"),service:r("blocks.draft.kind.service")},i=y.filter(t=>e.some(e=>N(e)===t));return i.length<=1?(0,t.jsx)("ul",{className:"space-y-1.5",children:e.map(e=>(0,t.jsx)(C,{line:e,currency:a},e.lineRef))}):(0,t.jsx)("div",{className:"space-y-3",children:i.map(i=>{let l=e.filter(e=>N(e)===i),c=l.every(e=>null===e.unitPriceMinor||null===e.qty&&!0!==e.priceIsJobTotal),o=l.reduce((e,t)=>e+w(t),0);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-1 flex items-baseline justify-between gap-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-medium uppercase tracking-[0.04em] text-[var(--text-2)]",children:n[i]}),(0,t.jsx)("span",{className:"shrink-0 text-[12px] tabular-nums text-[var(--text-2)]",children:c?r("blocks.common.tbc"):(0,h.formatMoney)(o,a,s)})]}),(0,t.jsx)("ul",{className:"space-y-1.5",children:l.map(e=>(0,t.jsx)(C,{line:e,currency:a},e.lineRef))})]},i)})})}function A({label:e,entity:a,lines:r,total:s,action:n,disabled:l=!1,alreadyCreated:c=!1}){let o=n.done||c,d=(0,x.useTranslations)("AppChat"),u=r.length>0&&r.every(e=>null===e.unitPriceMinor)&&!r.some(e=>!0===e.awaitingPick),m=r.filter(e=>null===e.unitPriceMinor&&!0===e.awaitingPick).length,p=r.filter(e=>null===e.unitPriceMinor&&!0!==e.awaitingPick).length,h=r.filter(e=>null!==e.unitPriceMinor&&null===e.qty&&!0!==e.priceIsJobTotal).length,v=p+h+m,b=p>0&&h>0?d("blocks.draft.excludedBoth",{count:p,total:h}):p>0?d("blocks.draft.excludedTbc",{count:p}):h>0?d("blocks.draft.excludedQty",{count:h}):null,k=m>0?d("blocks.draft.excludedPick",{count:m}):null;return(0,t.jsxs)("div",{className:"mt-3 border-t border-[var(--line-1)] pt-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[u?(0,t.jsx)("p",{className:"text-[13px] font-medium text-[var(--text-1)]",children:d("blocks.draft.readyToPrice")}):(0,t.jsxs)("p",{className:"text-[13px] text-[var(--text-2)]",children:[d(v>0?"blocks.draft.totalSoFar":"blocks.draft.total")," ",(0,t.jsx)("span",{className:"ml-1 text-[16px] font-semibold tabular-nums text-[var(--text-1)]",children:s})]}),(0,t.jsx)("div",{className:"ml-auto",children:o?(0,t.jsxs)("p",{role:"status",className:"m-0 inline-flex items-center gap-1.5 text-[13px] font-medium text-[var(--text-1)]",children:[(0,t.jsx)(i.CircleCheck,{className:"size-4 shrink-0 text-[var(--ok)]",strokeWidth:1.75,"aria-hidden":!0}),d("blocks.draft.created")]}):(0,t.jsx)(f.Button,{variant:"primary",size:"sm",onClick:n.run,loading:n.pending,disabled:l||n.pending,children:e})})]}),u?(0,t.jsx)(g.QuietNote,{className:"mt-1.5",children:d("quote"===a?"blocks.draft.nothingPricedQuote":"blocks.draft.nothingPricedOrder")}):(0,t.jsxs)(t.Fragment,{children:[k&&(0,t.jsx)(g.QuietNote,{className:"mt-1.5",children:k}),b&&(0,t.jsx)(g.QuietNote,{className:"mt-1.5",children:b})]}),n.note&&(0,t.jsx)(g.QuietNote,{className:"mt-1.5 text-right",children:n.note})]})}e.s(["CreatedEntityBlockView",0,function({block:e}){let a=(0,x.useTranslations)("AppChat"),n={quote:a("blocks.draft.createdAria.quote"),order:a("blocks.draft.createdAria.order"),service_item:a("blocks.draft.createdAria.serviceItem"),customer:a("blocks.draft.createdAria.customer"),ticket:a("blocks.draft.createdAria.ticket"),stock_movement:a("blocks.draft.createdAria.stockMovement"),rfq:a("blocks.draft.createdAria.rfq"),job:a("blocks.draft.createdAria.job"),enquiry_reply:a("blocks.draft.createdAria.enquiryReply"),inspect_document:a("blocks.draft.createdAria.inspectDocument"),offering:a("blocks.draft.createdAria.offering"),schema:a("blocks.draft.createdAria.schema")},l={quote:a("blocks.draft.view.quote"),order:a("blocks.draft.view.order"),service_item:a("blocks.draft.view.serviceItem"),customer:a("blocks.draft.view.customer"),ticket:a("blocks.draft.view.ticket"),stock_movement:a("blocks.draft.view.stockMovement"),rfq:a("blocks.draft.view.rfq"),job:a("blocks.draft.view.job"),enquiry_reply:a("blocks.draft.view.enquiryReply"),inspect_document:a("blocks.draft.view.inspectDocument"),offering:a("blocks.draft.view.offering"),schema:a("blocks.draft.view.schema")};return(0,t.jsx)(g.BlockCard,{"aria-label":n[e.entity],children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(i.CircleCheck,{className:"size-5 shrink-0 text-[var(--ok)]",strokeWidth:1.5,"aria-hidden":!0}),(0,t.jsxs)("p",{className:"min-w-0 flex-1 text-[14px] text-[var(--text-1)]",children:[a("blocks.draft.created")," ",(0,t.jsx)("span",{className:"font-medium",children:(0,t.jsx)(p.KeepCodes,{text:e.label})})]}),(0,t.jsxs)(r.default,{href:e.href,className:(0,k.cn)("inline-flex shrink-0 items-center gap-1 rounded-[var(--r-sm)] px-1.5 py-0.5 text-[13px] font-medium text-[var(--accent)]","transition-colors duration-[180ms] ease-[var(--ease-out)] hover:bg-[var(--accent-soft)] active:translate-y-
1px","outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus-ring)]"),children:[l[e.entity],(0,t.jsx)(s.ArrowUpRight,{className:"size-3.5","aria-hidden":!0})]})]})})},"OrderDraftBlockView",0,function({block:e,created:s=!1}){let n=(0,x.useTranslations)("AppChat"),i=(0,m.useLocale)(),l=(0,j.useEnvelopeAction)("/api/orders/from-envelope",{envelopeId:e.envelopeId,lineRefs:e.lines.map(e=>e.lineRef)}),c=e.lines.some(e=>(e.assumptions?.length??0)>0),o=e.lines.some(e=>null===e.qty),d=c||o,f=n(o&&c?"blocks.draft.order.confirmBoth":o?"blocks.draft.order.confirmQty":"blocks.draft.order.confirmAssumed"),[p,v]=a.useState(!1),b=d&&!p;return(0,t.jsxs)(g.BlockCard,{"aria-label":n("blocks.draft.order.title"),children:[(0,t.jsx)(g.BlockKicker,{icon:u.ShoppingCart,children:n("blocks.draft.order.title")}),(0,t.jsx)(M,{lines:e.lines,currency:e.currency}),e.sourceQuoteNumber&&(0,t.jsxs)("p",{className:"mt-2.5 text-[13px] text-[var(--text-2)]",children:[n("blocks.draft.order.fromQuote")," ",(0,t.jsx)("span",{className:"font-medium text-[var(--text-1)]",children:e.sourceQuoteNumber})]}),(e.customerSuggestion?.company||e.reference)&&(0,t.jsxs)("p",{className:"mt-2.5 text-[13px] text-[var(--text-2)]",children:[e.customerSuggestion?.company&&(0,t.jsxs)(t.Fragment,{children:[n("blocks.draft.order.customer")," ",e.customerSuggestion.customerId?(0,t.jsx)(r.default,{href:`/app/customers/${e.customerSuggestion.customerId}`,className:(0,k.cn)("rounded-[4px] font-medium text-[var(--accent)] hover:underline","outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus-ring)]"),children:e.customerSuggestion.company}):(0,t.jsx)("span",{className:"font-medium text-[var(--text-1)]",children:e.customerSuggestion.company})]}),e.customerSuggestion?.company&&e.reference&&" · ",e.reference&&(0,t.jsxs)(t.Fragment,{children:[n("blocks.draft.order.reference")," ",(0,t.jsx)("span",{className:"font-medium text-[var(--text-1)]",children:e.reference})]})]}),d&&(0,t.jsxs)("label",{className:"mt-2.5 flex items-start gap-2 text-[13px] text-[var(--text-2)]",children:[(0,t.jsx)("input",{type:"checkbox",checked:p,onChange:e=>v(e.target.checked),className:"mt-0.5 size-3.5 accent-[var(--accent)]"}),f]}),(0,t.jsx)(A,{label:n("blocks.draft.order.create"),entity:"order",lines:e.lines,total:(0,h.formatMoney)(e.totalMinor,e.currency,i),action:l,disabled:b,alreadyCreated:s})]})},"QuoteDraftBlockView",0,function({block:e,created:a=!1}){let s=(0,x.useTranslations)("AppChat"),n=(0,m.useLocale)(),i=(0,j.useEnvelopeAction)("/api/quotes/from-envelope",{envelopeId:e.envelopeId,lineRefs:e.lines.map(e=>e.lineRef)});return(0,t.jsxs)(g.BlockCard,{"aria-label":s("blocks.draft.quote.title"),children:[(0,t.jsx)(g.BlockKicker,{icon:d,children:s("blocks.draft.quote.title")}),(0,t.jsx)(M,{lines:e.lines,currency:e.currency}),e.customerSuggestion?.company&&(0,t.jsxs)("p",{className:"mt-2.5 text-[13px] text-[var(--text-2)]",children:[s("blocks.draft.quote.customer")," ",e.customerSuggestion.customerId?(0,t.jsx)(r.default,{href:`/app/customers/${e.customerSuggestion.customerId}`,className:(0,k.cn)("rounded-[4px] font-medium text-[var(--accent)] hover:underline","outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus-ring)]"),children:e.customerSuggestion.company}):(0,t.jsx)("span",{className:"font-medium text-[var(--text-1)]",children:e.customerSuggestion.company})]}),(0,t.jsx)(A,{label:s("blocks.draft.quote.create"),entity:"quote",lines:e.lines,total:(0,h.formatMoney)(e.totalMinor,e.currency,n),action:i,alreadyCreated:a})]})},"draftLineTotalMinor",0,w],160647)},978262,e=>{"use strict";var t=e.i(717841),a=e.i(215535),r=e.i(653889),s=e.i(956537),n=e.i(128602),i=e.i(678677),l=e.i(801098),c=e.i(788513),o=e.i(880911),d=e.i(337822),u=e.i(493903),m=e.i(975157),x=e.i(788637),f=e.i(301110),p=e.i(516696);function h(e,t){return"designed"===e.source?{href:e.designHref??"/app/design",label:t.design}:{href:`/app/catalog/${e.productId}`,label:t.product}}function v({adjustments:e}){let a=(0,c.useTranslations)("AppChat"),r=e.some(e=>e.delta<0);return(0,t.jsxs)(d.Popover,{children:[(0,t.jsx)(d.PopoverTrigger,{className:(0,m.cn)("inline-flex w-fit items-center gap-1 rounded-[var(--r-sm)] text-left text-[11px] font-medium leading-snug underline decoration-dotted underline-offset-2","outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus-ring)]",r?"text-[var(--warn)]":"text-[var(--ok)]"),children:a(r?"blocks.match.check":"blocks.match.suits")}),(0,t.jsxs)(d.PopoverContent,{className:"w-auto max-w-72 px-3 py-2 text-[13px]",children:[(0,t.jsx)("span",{className:"text-[11px] uppercase tracking-[0.06em] opacity-70",children:a("blocks.common.why")}),(0,t.jsx)("ul",{className:"mt-0.5 space-y-1",children:e.map((e,a)=>(0,t.jsx)("li",{children:e.rationale},`${e.field}-${a}`))})]})]})}let b={exact:{fit:"strong"},within:{fit:"partial"},substituted:{fit:"weak"},assumed:{fit:"weak"},assumed_mismatch:{fit:"weak"},alt:{fit:"weak"},miss:{fit:"none",className:"border-transparent bg-[color-mix(in_srgb,var(--danger)_14%,transparent)] text-[var(--danger)]"},unknown:{fit:"none"},recommended:{fit:"strong"},not_recommended:{fit:"weak"}};function k({items:e}){return 0===e.length?null:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map((e,a)=>{let r=b[e.state];return(0,t.jsxs)(o.Chip,{fit:r.fit,dot:!0,className:r.className,title:e.detail,children:[(0,t.jsx)("span",{children:w(e.field.replace(/_/g," "))}),(0,t.jsx)("span",{className:"opacity-80",children:g(e.field,e.detail)})]},`${e.field}-${a}`)})})}function g(e,t){let a=e.replace(/_/g," ").trim().toLowerCase(),r=t.trimStart();if(!r.toLowerCase().startsWith(a))return t;let s=r.slice(a.length).replace(/^\s*:\s*/,"");return s.length>0&&s.length<r.length?s:t}function j(e){return e>=80?"var(--ok)":e>=50?"var(--accent)":"var(--warn)"}function y({fit:e,size:r=48}){let s=(0,c.useTranslations)("AppChat"),n=Math.max(0,Math.min(100,e)),i=(r-4)/2,l=2*Math.PI*i,o=function(e,t=400){let[r,s]=a.useState(0);return a.useEffect(()=>{if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches){let t=requestAnimationFrame(()=>s(e));return()=>cancelAnimationFrame(t)}let a=0,r=null,n=i=>{null===r&&(r=i);let l=Math.min(1,(i-r)/t);s(Math.round(e*(1-Math.pow(1-l,3)))),l<1&&(a=requestAnimationFrame(n))};return a=requestAnimationFrame(n),()=>cancelAnimationFrame(a)},[e,t]),r}(n);return(0,t.jsxs)("div",{className:"relative shrink-0",style:{width:r,height:r},role:"img","aria-label":s("blocks.match.fitAria",{count:n}),children:[(0,t.jsxs)("svg",{width:r,height:r,className:"-rotate-90","aria-hidden":!0,
1children:[(0,t.jsx)("circle",{cx:r/2,cy:r/2,r:i,fill:"none",stroke:"var(--line-1)",strokeWidth:4}),(0,t.jsx)("circle",{cx:r/2,cy:r/2,r:i,fill:"none",stroke:j(n),strokeWidth:4,strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:l*(1-n/100),style:{transition:"stroke-dashoffset 400ms var(--ease-out)"}})]}),(0,t.jsx)("span",{className:"absolute inset-0 flex items-center justify-center text-[14px] font-semibold tabular-nums text-[var(--text-1)]",children:o})]})}function N({candidate:e}){let a=(0,c.useTranslations)("AppChat"),n=h(e,{design:a("blocks.match.openDesign"),product:a("blocks.match.viewProduct")});return(0,t.jsxs)(r.default,{href:n.href,className:(0,m.cn)("mt-auto inline-flex w-fit items-center gap-1 rounded-[var(--r-sm)] pt-1 text-[12px] font-medium text-[var(--accent)]","transition-colors duration-[180ms] ease-[var(--ease-out)] hover:underline","outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus-ring)]"),children:[n.label,(0,t.jsx)(s.ArrowUpRight,{className:"size-3","aria-hidden":!0})]})}function w(e){return e.charAt(0).toUpperCase()+e.slice(1)}e.s(["FitRing",0,y,"MatchBlockView",0,function({block:e,envelopeId:a=null}){let o=(0,c.useTranslations)("AppChat"),d=(0,l.useLocale)(),x=(0,p.useEnvelopeAction)("/api/aei/challenge",{envelopeId:a,lineRef:e.lineRef}),v=h(e,{design:o("blocks.match.openDesign"),product:o("blocks.match.viewProduct")});return(0,t.jsxs)(f.BlockCard,{"aria-label":o("blocks.match.aria",{name:e.lineRef}),children:[(0,t.jsxs)(f.BlockKicker,{icon:n.PackageSearch,children:["closest"===e.band?o("blocks.match.closest"):o("blocks.match.matched")," ·"," ",e.lineRef]}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(y,{fit:e.fit}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"font-mono text-[11px] text-[var(--text-3)]",children:e.sku}),(0,t.jsx)("p",{className:"text-[14px] font-medium text-[var(--text-1)]",children:e.title})]}),(0,t.jsx)("p",{className:"shrink-0 text-[16px] font-semibold tabular-nums text-[var(--text-1)]",children:null!==e.priceMinor?(0,u.formatMoney)(e.priceMinor,e.currency,d):o("blocks.match.noPrice")})]}),e.contract&&(0,t.jsxs)("p",{className:"mt-2 text-[13px] text-[var(--text-2)]",children:[o("blocks.contract.perItem",{name:(0,u.formatMoney)(e.contract.ratePerUnitMinor,e.contract.currency,d),total:(0,u.formatMoney)(e.contract.totalMinor,e.contract.currency,d)})," ",null===e.contract.formulaTotalMinor?null:e.contract.formulaTotalMinor===e.contract.totalMinor?o("blocks.contract.same"):o("blocks.contract.catalogue",{item:(0,u.formatMoney)(e.contract.formulaTotalMinor,e.contract.currency,d)})]}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(k,{items:e.fitBreakdown})}),"closest"===e.band&&(0,t.jsx)("p",{className:"mt-2.5 text-[13px] text-[var(--text-2)]",children:o("blocks.match.closestNote")}),e.assumptions&&e.assumptions.length>0&&(0,t.jsxs)("div",{className:"mt-2.5 rounded-[var(--r-md)] border border-[var(--line-1)] bg-[var(--surface-1)] p-2.5",children:[(0,t.jsx)("p",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-[var(--text-3)]",children:o("blocks.match.assumedHeading")}),(0,t.jsx)("ul",{className:"space-y-0.5",children:e.assumptions.map((e,a)=>(0,t.jsx)("li",{className:"text-[13px] text-[var(--text-2)]",children:e.detail},`${e.field}-${a}`))})]}),e.applicationAdjustments&&e.applicationAdjustments.length>0&&(0,t.jsx)("ul",{className:"mt-2.5 space-y-0.5",children:e.applicationAdjustments.map((e,a)=>(0,t.jsxs)("li",{className:"text-[13px] text-[var(--text-2)]",children:[(0,t.jsx)("span",{className:(0,m.cn)("font-medium",e.delta>=0?"text-[var(--ok)]":"text-[var(--warn)]"),children:e.delta>=0?o("blocks.match.fieldSuits",{field:w(e.field)}):o("blocks.match.fieldCheck",{field:e.field.toLowerCase()})})," ",/[.!?]$/.test(e.rationale.trim())?e.rationale:`${e.rationale}.`]},`${e.field}-${a}`))}),e.rationale&&(0,t.jsx)("p",{className:"mt-2.5 text-[13px] text-[var(--text-2)]",children:e.rationale}),(0,t.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-3 border-t border-[var(--line-1)] pt-2.5",children:[(0,t.jsx)("span",{className:"text-[12px] text-[var(--text-3)]",children:o("blocks.match.alternatives",{count:e.alternatives})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[a&&(0,t.jsxs)("button",{type:"button",onClick:x.run,disabled:x.pending||x.unavailable,className:(0,m.cn)("inline-flex items-center gap-1 rounded-[var(--r-sm)] px-1.5 py-0.5 text-[13px] font-medium text-[var(--text-2)]","transition-colors duration-[180ms] ease-[var(--ease-out)] hover:bg-[var(--surface-2)] hover:text-[var(--text-1)] active:translate-y-
1px","outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus-ring)]","disabled:pointer-events-none disabled:opacity-50"),children:[(0,t.jsx)(i.Scale,{className:"size-3.5","aria-hidden":!0}),x.pending?o("blocks.match.reassessing"):o("blocks.match.challenge")]}),(0,t.jsxs)(r.default,{href:v.href,className:(0,m.cn)("inline-flex items-center gap-1 rounded-[var(--r-sm)] px-1.5 py-0.5 text-[13px] font-medium text-[var(--accent)]","transition-colors duration-[180ms] ease-[var(--ease-out)] hover:bg-[var(--accent-soft)] active:translate-y-px","outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus-ring)]"),children:[v.label,(0,t.jsx)(s.ArrowUpRight,{className:"size-3.5","aria-hidden":!0})]})]})]})]})},"MatchReviewBlockView",0,function({block:e,envelopeId:r=null}){var s;let i=(0,c.useTranslations)("AppChat"),o=(0,l.useLocale)(),{orgId:d,replaceDraftBlock:p}=(0,x.useChatActions)(),[h,b]=a.useState(e.selectedProductId),y=a.useMemo(()=>(function(e){let t=new Map;for(let a of e)for(let e of a.fitBreakdown){let a=t.get(e.field)??new Set;a.add(`${e.state}|${e.detail}`),t.set(e.field,a)}for(let a of e){let e=new Set(a.fitBreakdown.map(e=>e.field));for(let[a,r]of t)e.has(a)||r.add("absent")}let a=new Set([...t].filter(([,e])=>e.size>1).map(([e])=>e)),r=(e[0]?.fitBreakdown??[]).filter(e=>!a.has(e.field));return{distinct:a,shared:r}})(e.candidates),[e.candidates]),[w,C]=a.useState(null),[M,A]=a.useState(null);return(0,t.jsxs)(f.BlockCard,{"aria-label":i("blocks.match.review.aria",{name:e.lineRef}),children:[(0,t.jsxs)(f.BlockKicker,{icon:n.PackageSearch,children:[i("blocks.match.review.title")," · ",e.lineRef]}),(0,t.jsxs)("p",{className:"mb-3 text-[13px] text-[var(--text-2)]",children:[i("blocks.match.review.intro"),y.distinct.size>0&&y.shared.length>0&&(0,t.jsxs)(t.Fragment,{children:[" ",i("blocks.match.review.shared",{list:(s=y.shared.map(e=>`${e.field.replace(/_/g," ").toLowerCase()} ${g(e.field,e.detail)}`)).length<=1?s.join(""):`${s.slice(0,-1).join(", ")} and ${s[s.length-1]}`})]})]}),(0,t.jsxs)("fieldset",{className:"grid gap-2 sm:grid-cols-3",children:[(0,t.jsx)("legend",{className:"sr-only",children:i("blocks.match.review.legend",{name:e.lineRef})}),e.candidates.map(a=>{let s=h===a.productId;return(0,t.jsxs)("label",{className:(0,m.cn)("flex cursor-pointer flex-col gap-1.5 rounded-[var(--r-md)] border p-3","transition-[border-color,background-color,box-shadow] duration-[180ms] ease-[var(--ease-out)]","has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-[var(--focus-ring)]",s?"border-[var(--accent)] bg-[var(--accent-soft)] shadow-[var(--shadow-1)]":"border-[var(--line-1)] bg-[var(--surface-1)] hover:border-[var(--line-2)] hover:bg-[var(--surface-2)]"),children:[(0,t.jsx)("input",{type:"radio",name:`match-review-${e.lineRef}`,value:a.productId,checked:s,onChange:()=>{var t;(t=a.productId)===h||w||((b(t),A(null),r)?(C(t),(async()=>{try{let a=await fetch("/api/aei/select-match",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:d,envelopeId:r,lineRef:e.lineRef,productId:t})}),s=await a.json().catch(()=>null);a.ok?s?.draft&&p?.(s.draft):(b(h),A(s?.error??i("blocks.match.review.saveFailed")))}catch{b(h),A(i("blocks.common.connectionDropped"))}finally{C(null)}})()):A(i("blocks.match.review.notSaved")))},disabled:null!==w,className:"sr-only"}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-[var(--text-3)]",children:a.sku}),(0,t.jsx)("span",{className:"text-[15px] font-semibold tabular-nums",style:{color:j(a.fit)},children:a.fit})]}),(0,t.jsx)("span",{className:"text-[13px] font-medium leading-snug text-[var(--text-1)]",children:a.title}),(0,t.jsx)("span",{className:"text-[13px] font-semibold tabular-nums text-[var(--text-1)]",children:null!==a.priceMinor?(0,u.formatMoney)(a.priceMinor,a.currency,o):i("blocks.match.noPrice")}),(0,t.jsx)(k,{items:y.distinct.size>0?a.fitBreakdown.filter(e=>
1y.distinct.has(e.field)):a.fitBreakdown.slice(0,3)}),a.applicationAdjustments&&a.applicationAdjustments.length>0&&(0,t.jsx)(v,{adjustments:a.applicationAdjustments}),s&&(0,t.jsx)("span",{className:"text-[11px] font-medium text-[var(--accent-strong)]",children:w===a.productId?i("blocks.match.review.saving"):i("blocks.match.review.selected")}),(0,t.jsx)(N,{candidate:a})]},a.productId)})]}),M&&(0,t.jsx)("p",{role:"status",className:"mt-2 text-[12px] text-[var(--danger)]",children:M})]})}])},670277,e=>{"use strict";var t=e.i(717841),a=e.i(215535),r=e.i(919774),s=e.i(975157);let n=/(\*\*[^*]+\*\*|`[^`]+`|\[s\d+\]|\[[^\]\n]{1,80}\]\(\/[A-Za-z0-9_\-/?=&.%]*\))/g,i=/^\[(s\d+)\]$/,l=/^\[([^\]\n]{1,80})\]\((\/app(?:\/[A-Za-z0-9_\-/?=&.%]*)?)\)$/,c=/^\[([^\]\n]{1,80})\]\((\/[A-Za-z0-9_\-/?=&.%]*)\)$/,o=/^(#{1,4})[ \t]+(.+)$/,d=/^ {0,3}[-*+][ \t]+(.+)$/,u=/^ {0,3}(\d{1,3})[.)][ \t]+(.+)$/;function m(e,s,o){return e.split(n).filter(e=>""!==e).map((e,n)=>{let d=`${s}-${n}`;if(e.startsWith("**")&&e.endsWith("**")&&e.length>4)return(0,t.jsx)("strong",{className:"font-semibold text-[var(--text-1)]",children:e.slice(2,-2)},d);if(e.startsWith("`")&&e.endsWith("`")&&e.length>2)return(0,t.jsx)("code",{className:"rounded-[4px] bg-[var(--surface-2)] px-1 py-px font-mono text-[0.85em] text-[var(--text-1)]",children:e.slice(1,-1)},d);let u=function(e,t){let a=l.exec(e);if(a)return{label:a[1],href:a[2]};if(!t)return null;let r=c.exec(e);return r&&t.has(r[2])?{label:r[1],href:r[2]}:null}(e,o);if(u)return(0,t.jsx)(r.default,{href:u.href,className:"font-medium text-[var(--accent)] underline-offset-2 outline-none hover:underline focus-visible:underline",children:u.label},d);let m=i.exec(e);return m?(0,t.jsx)("sup",{className:"ml-0.5 align-super",children:(0,t.jsx)("span",{className:"inline-flex rounded-full bg-[var(--surface-2)] px-1 text-[10px] font-medium leading-[14px] text-[var(--text-3)]",children:m[1]})},d):(0,t.jsx)(a.Fragment,{children:e},d)})}let x=["h4","h5","h6","h6"];function f({md:e,className:r,linkPaths:n}){let i=n&&n.length>0?new Set(n):null,l=e.split(/\n{2,}/).filter(e=>""!==e.trim());return(0,t.jsx)("div",{className:(0,s.cn)("space-y-2",r),children:l.map((e,r)=>(0,t.jsx)(a.Fragment,{children:(function(e){let t=[];for(let a of e){let e=t[t.length-1];if(""===a.trim()){e?.kind==="para"&&e.lines.push(a);continue}let r=o.exec(a);if(r){t.push({kind:"heading",level:(r[1]??"#").length,text:r[2]??""});continue}let s=d.exec(a),n=s?null:u.exec(a);if(s||n){let a=null!=n,r=(s?s[1]:n?.[2])??"";e?.kind==="list"&&e.ordered===a?e.items.push(r):t.push({kind:"list",ordered:a,start:a?Number(n?.[1]??"1"):1,items:[r]});continue}e?.kind==="para"?e.lines.push(a):t.push({kind:"para",lines:[a]})}return t})(e.split("\n")).map((e,n)=>(function(e,r,n){if("heading"===e.kind){let a=x[e.level-1]??"h4";return(0,t.jsx)(a,{className:(0,s.cn)("font-semibold text-[var(--text-1)]",1===e.level?"text-[15px]":"text-[14px]"),children:m(e.text,r,n)},r)}if("list"===e.kind){let a=e.items.map((e,a)=>(0,t.jsx)("li",{className:"text-[14px] leading-relaxed",children:m(e,`${r}-${a}`,n)},a));return e.ordered?(0,t.jsx)("ol",{start:e.start,className:"ml-5 list-decimal space-y-1 marker:text-[var(--text-3)]",children:a},r):(0,t.jsx)("ul",{className:"ml-5 list-disc space-y-1 marker:text-[var(--text-3)]",children:a},r)}return(0,t.jsx)("p",{className:"text-[14px] leading-relaxed",children:e.lines.map((e,s)=>(0,t.jsxs)(a.Fragment,{children:[s>0&&(0,t.jsx)("br",{}),m(e,`${r}-${s}`,n)]},s))},r)})(e,`${r}-${n}`,i))},r))})}e.s(["MarkdownLite",0,f,"TextBlockView",0,function({block:e,linkPaths:a}){return(0,t.jsx)(f,{md:e.md,className:"text-[var(--text-1)]",linkPaths:a})}])},516696,e=>{"use strict";var t=e.i(215535),a=e.i(788513),r=e.i(788637);e.s(["useEnvelopeAction",0,function(e,s){let n=(0,a.useTranslations)("AppChat"),{orgId:i,requestId:l,appendAssistantBlocks:c}=(0,r.useChatActions)(),[o,d]=t.useState(!1),[u,m]=t.useState(!1),[x,f]=t.useState(!1),[p,h]=t.useState(null),v=t.useRef(null);return t.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]),{run:()=>{o||x||(d(!0),h(null),m(!1),v.current&&clearTimeout(v.current),(async()=>{try{let t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:i,requestId:l,...s})});if(501===t.status){let e=await t.json().catch(()=>null);h(e?.error??n("blocks.common.notAvailableYet")),m(!0),v.current=setTimeout(()=>{m(!1),h(null)},6e4);return}let a=await t.json().catch(()=>null);if(!t.ok)return void h(a?.error??n("blocks.common.didNotGoThrough"));a?.blocks?.length&&c(a.blocks),f(!0)}catch{h(n("blocks.common.connectionDropped"))}finally{d(!1)}})())},pending:o,unavailable:u,done:x,note:p}}])},788637,e=>{"use strict";var t=e.i(215535);let a=t.createContext({orgId:"",requestId:null,currency:"GBP",appendAssistantBlocks:()=>void 0,openDesignLane:null});e.s(["ChatContext",0,a,"useChatActions",0,function(){return t.useContext(a)},"withReplacedDraft",0,function(e,t){return e.map(e=>e.blocks.some(e=>e.type===t.type&&e.envelopeId===t.envelopeId)?{...e,blocks:e.blocks.map(e=>e.type===t.type&&e.envelopeId===t.envelopeId?t:e)}:e)}])},880911,e=>{"use strict";var t=e.i(717841),a=e.i(294237),r=e.i(975157);let s=(0,a.cva)("inline-flex items-center gap-1.5 rounded-[var(--r-sm)] border px-2 py-0.5 text-[12px] font-medium",{variants:{fit:{exact:"border-transparent bg-[var(--accent-soft)] text-[var(--accent-strong)]",strong:"border-transparent bg-[color-mix(in_srgb,var(--ok)_14%,transparent)] text-[var(--ok)]",partial:"border-transparent bg-[color-mix(in_srgb,var(--accent)_12%,transparent)] text-[var(--accent)]",weak:"border-transparent bg-[color-mix(in_srgb,var(--warn)_16%,transparent)] text-[var(--warn)]",none:"border-[var(--line-2)] bg-transparent text-[var(--text-3)]"}},defaultVariants:{fit:"partial"}}),n={exact:"var(--accent)",strong:"var(--ok)",partial:"var(--accent)",weak:"var(--warn)",none:"var(--text-3)"};e.s(["Chip",0,function({className:e,fit:a="partial",dot:i=!1,children:l,...c}){return(0,t.jsxs)("span",{className:(0,r.cn)(s({fit:a}
1),e),...c,children:[i&&(0,t.jsx)("span",{"aria-hidden":!0,className:"size-1.5 rounded-full",style:{background:n[a??"partial"]}}),l]})}])},185482,e=>{"use strict";let t=new Set(["od","id","cnc","pcd","tct","hss","cbn","hsk","bt","sk","iso","din","bs","en","ptfe","epdm","nbr","fkm","pvc","uv","mig","tig","pdf","vat","uk","eu","rpm"]);function a(e){return/^[a-z0-9]+(_[a-z0-9]+)+$/.test(e.trim())}function r(e,{capitalise:a=!0}={}){let s=e.trim().split(/[_\s]+/).filter(Boolean).map(e=>t.has(e.toLowerCase())?e.toUpperCase():e),n=s.join(" ");return n?!a||t.has(s[0].toLowerCase())?n:n.charAt(0).toUpperCase()+n.slice(1):e}let s={m2:"m²",mm2:"mm²",cm2:"cm²",m3:"m³",mm3:"mm³",cm3:"cm³",um:"µm",deg:"°",degc:"°C"};function n(e){return e?e.split(/(\s+|\/)/).map(e=>s[e.toLowerCase()]??e).join(""):""}function i(e,t){let a=n(t);return a?"°"===a||"°C"===a||"%"===a?`${e}${a}`:`${e} ${a}`:e}e.s(["isCodeShaped",0,a,"readableUnit",0,n,"readableValue",0,function(e,t={}){if(null==e)return"";if(!0===e||"true"===e)return t.yes??"yes";if(!1===e||"false"===e)return t.no??"no";let s=String(e);for(let e of t.options??[]){if("string"==typeof e){if(e.toLowerCase()===s.toLowerCase())return a(e)?r(e,{capitalise:!1}):e;continue}if(e.value.toLowerCase()===s.toLowerCase()){let t=e.label?.trim();if(t)return t;return a(e.value)?r(e.value,{capitalise:!1}):e.value}}if("number"==typeof e||/^-?\d+(\.\d+)?$/.test(s))return i(s,t.unit);let l=n(t.unit);return l&&/\d/.test(s)&&!s.toLowerCase().endsWith(l.toLowerCase())&&!s.toLowerCase().endsWith(String(t.unit).toLowerCase())?i(s,t.unit):a(s)?r(s,{capitalise:!1}):s},"readableWords",0,r,"withUnit",0,i])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.