1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6814],{53341:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/management/pricing-workbench",function(){return r(32317)}])},89934:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},35131:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},14132:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},9464:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},94364:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var a=r(85893),s=r(67294),l=r(22972);let i={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"};function n(e){let{open:t,onClose:r,title:n,children:c,footer:o,size:d="lg",submitting:m}=e,u=(0,s.useId)();return((0,s.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"!==e.key||m||r()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,r,m]),(0,s.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t)?(0,a.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":u,className:"fixed inset-0 z-50 flex items-start justify-center pt-[5vh] sm:pt-[10vh]",children:[(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50",onClick:m?void 0:r}),(0,a.jsxs)("div",{className:"relative w-full ".concat(i[d]," mx-4 bg-white dark:bg-gray-800 rounded-xl shadow-xl max-h-[85vh] flex flex-col"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[(0,a.jsx)("h2",{id:u,className:"text-lg font-semibold text-gray-900 dark:text-gray-100 font-heading",children:n}),(0,a.jsx)("button",{onClick:r,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-gray-500 dark:hover:text-gray-300 dark:hover:bg-gray-700 transition-colors","aria-label":"Close",children:(0,a.jsx)(l.Z,{className:"h-5 w-5"})})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:c}),o&&(0,a.jsx)("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900 rounded-b-xl",children:o})]})]}):null}},40730:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var a=r(85893);function s(e){let{title:t,description:r,actions:s}=e;return(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-gray-900 font-heading",children:t}),r&&(0,a.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:r})]}),s&&(0,a.jsx)("div",{className:"flex items-center gap-2 flex-shrink-0",children:s})]})}},69324:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var a=r(85893),s=r(67294),l=r(21770),i=r(97909),n=r(30334),c=r(80906);function o(e){let{models:t,value:r,onChange:o,filterByBrand:d,filterByDeviceType:m,required:u,disabled:p}=e,[x,g]=(0,s.useState)(""),h=(0,s.useRef)(null),b=(0,s.useMemo)(()=>{let e=t;return m&&(e=e.filter(e=>e.type_id===m)),d&&(e=e.filter(e=>e.brand_id===d)),e},[t,d,m]),y=(0,s.useMemo)(()=>{if(""===x)return b;let e=x.toLowerCase().replace(/[^a-z0-9\s]/g," ").split(/\s+/).filter(Boolean);return b.filter(t=>{let r="".concat(t.brand_name," ").concat(t.name).toLowerCase().replace(/[^a-z0-9\s]/g," ");return e.every(e=>r.includes(e))})},[b,x]),f=(0,s.useMemo)(()=>t.find(e=>e.id===r)||null,[t,r]);return(0,a.jsx)(l.h,{value:f,onChange:e=>{o((null==e?void 0:e.id)||"",e),g("")},disabled:p,nullable:!0,children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(l.h.Input,{ref:h,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-primary-500 pr-10 dark:bg-gray-700 dark:text-gray-100",displayValue:e=>
1e?d?e.name:"".concat(e.brand_name," ").concat(e.name):"",onChange:e=>g(e.target.value),placeholder:p?"Select brand first":d?"Type to search models...":"Type to search all models...",required:u}),(0,a.jsx)(l.h.Button,{className:"absolute inset-y-0 right-0 flex items-center pr-2",children:(0,a.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"})})]}),(0,a.jsx)(i.u,{leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>g(""),children:(0,a.jsx)(l.h.Options,{className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white dark:bg-gray-800 py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none text-sm",children:0===y.length&&""!==x?(0,a.jsx)("div",{className:"px-4 py-2 text-gray-500 dark:text-gray-400",children:"No models found"}):y.map(e=>(0,a.jsx)(l.h.Option,{value:e,className:e=>{let{active:t}=e;return"relative cursor-pointer select-none py-2 pl-10 pr-4 ".concat(t?"bg-primary-50 dark:bg-gray-700 text-primary-900 dark:text-gray-100":"text-gray-900 dark:text-gray-100")},children:t=>{let{selected:r,active:s}=t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{className:"block truncate ".concat(r?"font-medium":"font-normal"),children:[d?e.name:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:e.brand_name})," ",e.name]}),e.staged&&(0,a.jsx)("span",{className:"ml-2 inline-block align-middle text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded bg-amber-100 text-amber-800 dark:bg-amber-900/50 dark:text-amber-300",children:"staged"})]}),r&&(0,a.jsx)("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-primary-600",children:(0,a.jsx)(c.Z,{className:"h-4 w-4"})})]})}},e.id))})})]})})}},18189:function(e,t,r){"use strict";r.d(t,{F:function(){return i}});var a=r(67294);function s(){let e=new Date().getHours();return e>=19||e<6?"dark":"light"}function l(e){return"auto"===e?s():e}function i(){let[e,t]=(0,a.useState)("auto"),[r,i]=(0,a.useState)("light"),n=(0,a.useCallback)(e=>{i(e),document.documentElement.classList.toggle("dark","dark"===e)},[]);return(0,a.useEffect)(()=>{let e;let r=localStorage.getItem("theme");t(e="dark"===r||"light"===r||"auto"===r?r:"auto"),n(l(e));let a=window.matchMedia("(prefers-color-scheme: dark)"),s=e=>{localStorage.getItem("theme")||n(e.matches?"dark":"light")};return a.addEventListener("change",s),()=>a.removeEventListener("change",s)},[n]),(0,a.useEffect)(()=>{if("auto"!==e)return;let t=setInterval(()=>{n(s())},6e4);return()=>clearInterval(t)},[e,n]),{theme:e,resolvedTheme:r,toggleTheme:(0,a.useCallback)(()=>{t(e=>{let t="light"===e?"dark":"dark"===e?"auto":"light";return localStorage.setItem("theme",t),n(l(t)),t})},[n])}}},15592:function(e,t,r){"use strict";function a(e){return"enforce"===e}function s(e){return"inquiry"===e}r.d(t,{$U:function(){return n},H$:function(){return a},QL:function(){return s}});let l={ceilingGap:10,minMargin:60,raiseGap:15,maxRaiseStep:30};function i(e){return Math.round((e+Number.EPSILON)*100)/100}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l,{autoPrice:r,wholesaleCost:a,minRetailPrice:s,oem:n}=e;if("priced"===e.modeOverride||"inquiry"===e.modeOverride)return{price:i(r),mode:e.modeOverride,reason:"manual_override",ceiling:n?i(n.price-t.ceilingGap):null,needsReview:!1};if(!n||!Number.isFinite(n.price)||n.price<=0)return{price:i(r),mode:"priced",reason:"no_reference",ceiling:null,needsReview:!1};let c=i(n.price-t.ceilingGap),o=r,d=!1;if(n.isHard&&"battery"===e.serviceCategory&&"mobile"===e.deviceCategory&&"recommended"===e.pricingTier){let e=Math.min(n.price-t.raiseGap,r+t.maxRaiseStep);e>o&&(o=e,d=!0)}return a>0&&a>=c?n.isHard?{price:i(r),mode:"inquiry",reason:"part_cost_over_ceiling",ceiling:c,needsReview:!1}:{price:i(r),mode:"priced",reason:"soft_ceiling_conflict",ceiling:c,needsReview:!0}:o>c?c-a<t.minMargin||c<s?n.isHard?{price:i(r),mode:"inquiry",reason:"ceiling_collision",ceiling:c,needsReview:!1}:{price:i(r),mode:"priced",reason:"soft_ceiling_conflict",ceiling:c,needsReview:!0}:{price:i(c),mode:"priced",reason:"capped_to_ceiling",ceiling:c,needsReview:!1}:{price:i(o),mode:"priced",reason:d?"raised_toward_ceiling":"under_ceiling",ceiling:c,needsReview:!1}}},32317:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return ei}});var a=r(85893),s=r(84340),l=r(40730),i=r(67294),n=r(11163),c=r(41664),o=r.n(c),d=r(64712),m=r(33592);let u=(0,m.Z)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),p=(0,m.Z)("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}
1],["path",{d:"M21 15H3",key:"9uk58r"}]]);var x=r(2461);let g=(0,m.Z)("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);var h=r(80261),b=r(114),y=r(69324),f=r(34539);let v=["screen-replacement-mobile","screen-replacement-cover-mobile","screen-replacement-both-mobile","battery-replacement-mobile","screen-replacement-laptop","battery-replacement-laptop"],k=(0,m.Z)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var j=r(14132),_=r(13427),N=r(9464);let w=(0,m.Z)("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"}]]);var S=r(91254),C=r(80906),M=r(22972),A=r(15592);function P(e){return Math.round((e+Number.EPSILON)*100)/100}function Z(e){var t;let{wholesaleCost:r,tier:a,markup:s,oem:l,ceiling:i,serviceCategory:n,deviceCategory:c,modeOverride:o,priceOverride:d}=e,m=(0,A.H$)(i.mode),u=null!==(t=null==s?void 0:s.min_retail_price)&&void 0!==t?t:0,p=s?Math.max(Math.round(r*s.markup_multiplier)+s.labor_fee,u):null,x=null!=d&&Number.isFinite(d),g=x?d:p;if(null==g)return{autoPrice:null,price:null,margin:null,marginPct:null,verdict:null,enforced:m,canAutoPrice:!1};let h=l?{price:l.oem_price,isHard:l.is_hard}:null,b=h&&("log"===i.mode||"enforce"===i.mode)?(0,A.$U)({autoPrice:g,wholesaleCost:r,minRetailPrice:u,oem:h,serviceCategory:x?null:n,deviceCategory:c,pricingTier:a,modeOverride:null!=o?o:null},i):null,y=b&&m?b.price:P(g),f=P(y-r);return{autoPrice:p,price:y,margin:f,marginPct:y>0?Math.round(f/y*1e3)/10:null,verdict:b,enforced:m,canAutoPrice:null!=s}}function E(e){return null!=e&&Number.isFinite(e)?"$".concat(e.toFixed(2)):"â"}function q(e){if(!e)return null;let t=new Date(e).getTime();return Number.isFinite(t)?Math.floor((Date.now()-t)/864e5):null}function O(e){let t=q(e);return null!==t&&t>7}function L(e){let t=q(e);return null===t?"never":0===t?"today":1===t?"yesterday":"".concat(t,"d ago")}function R(e){return(e||"").replace(/^Quality\s*-\s*/i,"").replace(/^Batteries\s*-?\s*/i,"").trim()}let T=["value","recommended","premium"];function U(e){return[...e].sort((e,t)=>T.indexOf(e.pricing_tier)-T.indexOf(t.pricing_tier))}
1let z={value:"bg-slate-100 text-slate-700 border-slate-300",recommended:"bg-blue-100 text-blue-800 border-blue-300",premium:"bg-amber-100 text-amber-800 border-amber-300"},I={in_stock:"In stock",local_supplier:"Local supplier",msx_order:"MSX order"},H={msx:"MobileSentrix",ma:"MobileActive",manual:"Entered by hand"};function F(e){let{price:t,ctx:r}=e;if(!r.oem)return null;let s=r.oem.oem_price,l=Math.max(0,s-r.ceiling.ceilingGap),i=1.08*Math.max(s,t),n=e=>"".concat(Math.min(100,Math.max(0,e/i*100)),"%"),c=t>l;return(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsxs)("div",{className:"relative h-2 rounded-full bg-gray-200 dark:bg-gray-700",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 rounded-full ".concat(c?"bg-red-500":"bg-emerald-500"),style:{width:n(t)}}),(0,a.jsx)("div",{className:"absolute inset-y-[-3px] w-0.5 bg-amber-500",style:{left:n(l)},title:"Ceiling ".concat(E(l)," (OEM â $").concat(r.ceiling.ceilingGap,")")}),(0,a.jsx)("div",{className:"absolute inset-y-[-3px] w-0.5 bg-gray-800 dark:bg-gray-200",style:{left:n(s)},title:"".concat(r.oem.is_hard?"Published":"Converted"," OEM rate ").concat(E(s))})]}),(0,a.jsxs)("div",{className:"flex justify-between mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:[(0,a.jsxs)("span",{className:c?"text-red-600 font-semibold":"",children:["Us ",E(t)]}),(0,a.jsxs)("span",{children:["Ceiling ",E(l)," \xb7 ",r.oem.is_hard?"OEM":"OEM (converted)"," ",E(s)]})]})]})}function D(e){var t,r,s,l,n,c;let{row:d,ctx:m,compact:u,selected:p,maMatch:x,history:g,busy:b,onAssignHere:y,onManualSave:f,onUnlock:v}=e,[A,P]=(0,i.useState)(!1),[q,R]=(0,i.useState)(!1),[T,U]=(0,i.useState)(()=>{var e,t,r,a,s;return{wholesale_cost:null!=d.wholesale_cost?String(d.wholesale_cost):"",wholesale_sku:null!==(e=d.wholesale_sku)&&void 0!==e?e:"",wholesale_part_name:null!==(t=d.wholesale_part_name)&&void 0!==t?t:"",base_price:String(null!==(r=d.base_price)&&void 0!==r?r:""),part_quality:null!==(a=d.part_quality)&&void 0!==a?a:"",part_source:null!==(s=d.part_source)&&void 0!==s?s:"local_supplier"}}),D=m.markup.find(e=>e.tier===d.pricing_tier);d.wholesale_cost;let G=null!=d.wholesale_cost?d.base_price-d.wholesale_cost:null,Q=null!=G&&d.base_price>0?Math.round(G/d.base_price*1e3)/10:null,W="msx"!==d.cost_source,$=!!d.preferred_msx_sku,K="inquiry"===d.pricing_mode,V=O(d.cost_last_synced_at),B=Number(T.wholesale_cost),X=A?Z({wholesaleCost:Number.isFinite(B)?B:0,tier:d.pricing_tier,markup:D,oem:m.oem,ceiling:m.ceiling,serviceCategory:m.service.category,deviceCategory:m.model.device_category,modeOverride:d.pricing_mode_override}):null,J=g.filter(e=>e.pricing_id===d.id);return(0,a.jsxs)("div",{className:"rounded-xl border bg-white dark:bg-gray-800 dark:border-gray-700 shadow-sm ".concat(K?"border-amber-300":"border-gray-200"," ").concat(u?"p-3":"p-4"),children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-xs font-semibold border capitalize ".concat(null!==(t=z[d.pricing_tier])&&void 0!==t?t:z.value),children:d.pricing_tier}),(0,a.jsxs)("div",{className:"flex items-center gap-1 flex-wrap justify-end",children:[K&&(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-semibold bg-amber-100 text-amber-800",title:null!==(r=d.pricing_mode_reason)&&void 0!==r?r:"Quote by phone",children:"Call for quote"}),d.pricing_mode_override&&(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-semibold bg-purple-100 text-purple-800",children:"Mode pinned"}),$&&(0,a.jsxs)("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-semibold bg-indigo-100 text-indigo-800 inline-flex items-center gap-1",title:"Sync will always use SKU ".concat(d.preferred_msx_sku),children:[(0,a.jsx)(k,{className:"h-3 w-3"})," SKU pinned"]}),W&&(0,a.jsxs)("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-semibold bg-cyan-100 text-cyan-800 inline-flex items-center gap-1",title:"Cost came from ".concat(null!==(s=H[d.cost_source])&&void 0!==s?s:d.cost_source,". The MobileSentrix price push leaves this row alone."),children:[(0,a.jsx)(j.Z,{className:"h-3 w-3"})," ",null!==(l=H[d.cost_source])&&void 0!==l?l:d.cost_source]}),!d.is_active&&(0,a.jsx)("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-semibold bg-gray-200 text-gray-700",children:"Inactive"})]})]}),(0,a.jsxs)("div",{className:"mt-2 flex items-end gap-3 flex-wrap",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 leading-none",children:E(d.base_price)}),(0,a.jsx)("p",{className:"text-[11px] text-gray-500 dark:text-gray-400 mt-0.5",children:"published price"})]}),(0,a.jsxs)("div",{className:"text-right ml-auto",children:[(0,a.jsxs)("p",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:["cost ",E(d.wholesale_cost)]}),(0,a.jsxs)("p",{className:"text-[11px] ".concat(null!=G&&G<m.ceiling.minMargin?"text-red-600":"text-gray-500"),children:["margin ",E(G),null!=Q&&" \xb7 ".concat(Q,"%")]})]})]}),(0,a.jsx)(F,{price:d.base_price,ctx:m}),K&&d.pricing_mode_reason&&(0,a.jsx)("p",{className:"mt-2 text-[11px] text-amber-700 bg-amber-50 dark:bg-amber-900/20 rounded px-2 py-1",children:d.pricing_mode_reason.replace(/_/g," ")}),(0,a.jsxs)("div",{className:"mt-3 text-xs text-gray-600 dark:text-gray-300 space-y-1",children:[(0,a.jsx)("p",{className:"line-clamp-2",title:null!==(n=d.wholesale_part_name)&&void 0!==n?n:"",children:d.wholesale_part_name||(0,a.jsx)("span",{className:"italic text-gray-400",children:"no part recorded"})}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-gray-500 dark:text-gray-400",children:[d.wholesale_sku&&(0,a.jsx)("span",{className:"font-mono",children:d.wholesale_sku}),d.part_quality&&(0,a.jsx)("span",{children:d.part_quality}),null!=d.part_warranty_months&&(0,a.jsxs)("span",{children:[d.part_warranty_months,"mo warranty"]}),(0,a.jsx)("span",{children:null!==(c=I[d.part_source])&&void 0!==c?c:d.part_source}),(0,a.jsxs)("span",{className:V?"text-amber-600 font-medium":"",children:["cost ",L(d.cost_last_synced_at)]})]})]}),(null==x?void 0:x.ma_handle)&&(0,a.jsxs)("a",{href:"https://mobileactive.ca/products/".concat(x.ma_handle),target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-[11px] text-teal-700 hover:text-teal-900 hover:underline",children:[(0,a.jsx)(_.Z,{className:"h-3 w-3"}),"MobileActive suggests ",E(x.ma_price),x.ma_grade?" \xb7 ".concat(x.ma_grade):"",!1===x.ma_available?" \xb7 out of stock":""]}),(0,a.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,a.jsx)("button",{type:"button",disabled:!p||b,onClick:()=>y(d),className:"px-2.5 py-1.5 rounded-md text-xs font-semibold bg-primary-600 text-white hover:bg-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",title:p?"Use the selected listing for this tier":"Pick a supplier listing first",children:"Assign here"}),(0,a.jsxs)("button",{type:"button",disabled:b,onClick:()=>P(e=>!e),className:"px-2.5 py-1.5 rounded-md text-xs font-medium border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 inline-flex items-center gap-1",children:[(0,a.jsx)(N.Z,{className:"h-3 w-3"})," ",A?"Cancel":"Enter by hand"]}),W&&(0,a.jsxs)("button",{type:"button",disabled:b,onClick:()=>v(d),className:"px-2.5 py-1.5 rounded-md text-xs font-medium border border-cyan-300 text-cyan-700 hover:bg-cyan-50 inline-flex items-center gap-1",title:"Hand this row back to the weekly MobileSentrix price push",children:[(0,a.jsx)(w,{className:"h-3 w-3"})," Unlock"]}),J.length>0&&(0,a.jsxs)("button",{type:"button",onClick:()=>R(e=>!e),className:"ml-auto text-[11px] text-gray-500 hover:text-gray-700 inline-flex items-center gap-1",children:[(0,a.jsx)(S.Z,{className:"h-3 w-3"})," ",J.length]})]}),A&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 space-y-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-gray-500",children:"Part cost"}),(0,a.jsx)("input",{type:"number",step:"0.01",inputMode:"decimal",value:T.wholesale_cost,onChange:e=>U({...T,wholesale_cost:e.target.value}),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded dark:bg-gray-700"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsxs)("span",{className:"text-[10px] uppercase tracking-wide text-gray-500",children:["Sell price"," ",(null==X?void 0:X.canAutoPrice)&&(0,a.jsxs)("button",{type:"button",className:"text-primary-600 normal-case tracking-normal hover:underline",onClick:()=>U({...T,base_price:null!=X.price?String(X.price):""}),children:["use ",E(X.price)]})]}),(0,a.jsx)("input",{type:"number",step:"0.01",inputMode:"decimal",value:T.base_price,onChange:e=>U({...T,base_price:e.target.value}),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded dark:bg-gray-700"})]})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-gray-500",children:"Part name"}),(0,a.jsx)("input",{value:T.wholesale_part_name,onChange:e=>U({...T,wholesale_part_name:e.target.value}),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded dark:bg-gray-700"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-gray-500",children:"SKU / ref"}),(0,a.jsx)("input",{value:T.wholesale_sku,onChange:e=>U({...T,wholesale_sku:e.target.value}),className:"w-full px-2 py-1 text-sm font-mono border border-gray-300 dark:border-gray-600 rounded dark:bg-gray-700"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-gray-500",children:"Quality (shown to customers)"}),(0,a.jsx)("input",{value:T.part_quality,onChange:e=>U({...T,part_quality:e.target.value}),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded dark:bg-gray-700"})]})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-gray-500",children:"Sourcing (drives bookable dates)"}
1),(0,a.jsxs)("select",{value:T.part_source,onChange:e=>U({...T,part_source:e.target.value}),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded dark:bg-gray-700",children:[(0,a.jsx)("option",{value:"in_stock",children:"In stock â same day"}),(0,a.jsx)("option",{value:"local_supplier",children:"Local supplier â pickup"}),(0,a.jsx)("option",{value:"msx_order",children:"MobileSentrix order â shipped"})]})]}),X&&!X.canAutoPrice&&(0,a.jsxs)("p",{className:"text-[11px] text-amber-700 bg-amber-50 rounded px-2 py-1 flex items-start gap-1",children:[(0,a.jsx)(h.Z,{className:"h-3 w-3 mt-0.5 shrink-0"}),"No markup rule for ",m.model.brand," / ",m.service.category," / ",m.model.device_category," /"," ",d.pricing_tier," â type the sell price yourself, or"," ",(0,a.jsx)(o(),{href:"/management/markup-config",className:"underline",children:"add the rule"}),"."]}),(null==X?void 0:X.verdict)&&"inquiry"===X.verdict.mode&&(0,a.jsxs)("p",{className:"text-[11px] text-amber-700 bg-amber-50 rounded px-2 py-1",children:["At this cost the row becomes call-for-quote (",X.verdict.reason.replace(/_/g," "),")."]}),(0,a.jsx)("p",{className:"text-[11px] text-cyan-700",children:"Saving by hand locks this row â the weekly MobileSentrix push will stop overwriting it."}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsxs)("button",{type:"button",disabled:b,onClick:async()=>{await f(d,T),P(!1)},className:"px-3 py-1.5 rounded-md text-xs font-semibold bg-emerald-600 text-white hover:bg-emerald-700 disabled:opacity-50 inline-flex items-center gap-1",children:[(0,a.jsx)(C.Z,{className:"h-3 w-3"})," Save"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>P(!1),className:"px-3 py-1.5 rounded-md text-xs font-medium border border-gray-300 dark:border-gray-600 inline-flex items-center gap-1",children:[(0,a.jsx)(M.Z,{className:"h-3 w-3"})," Cancel"]})]})]}),q&&J.length>0&&(0,a.jsx)("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 space-y-1.5 max-h-48 overflow-y-auto",children:J.map(e=>{var t,r;return(0,a.jsxs)("div",{className:"text-[11px] text-gray-600 dark:text-gray-300",children:[(0,a.jsx)("span",{className:"text-gray-400",children:new Date(e.changed_at).toLocaleString()})," ",(0,a.jsx)("span",{className:"font-medium",children:e.changed_by||"system"})," ",(0,a.jsxs)("span",{className:"text-gray-400",children:["via ",e.source||"unknown"]}),"number"==typeof(null===(t=e.old_values)||void 0===t?void 0:t.base_price)&&"number"==typeof(null===(r=e.new_values)||void 0===r?void 0:r.base_price)&&(0,a.jsxs)("span",{children:[" ","â ",E(e.old_values.base_price)," â"," ",E(e.new_values.base_price)]}),e.reason&&(0,a.jsxs)("span",{className:"italic text-gray-500",children:[" â",e.reason,"â"]})]},e.id)})})]})}var G=r(11773),Q=r(53487),W=r(89934),$=r(47782),K=r(35131);function V(e){let{tone:t,children:r,title:s}=e;return(0,a.jsx)("span",{title:s,className:"px-1.5 py-0.5 rounded text-[10px] font-semibold whitespace-nowrap ".concat({green:"bg-emerald-100 text-emerald-800",red:"bg-red-100 text-red-800",amber:"bg-amber-100 text-amber-800",gray:"bg-gray-100 text-gray-600",blue:"bg-blue-100 text-blue-800",purple:"bg-purple-100 text-purple-800"}[t]),children:r})}function B(e){let{active:t,onClick:r,children:s}=e;return(0,a.jsx)("button",{type:"button",onClick:r,className:"w-full text-left px-2.5 py-2 rounded-lg border transition-colors ".concat(t?"border-primary-500 bg-primary-50 dark:bg-primary-900/20 ring-1 ring-primary-500":"border-gray-200 dark:border-gray-700 hover:border-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700/50"),children:s})}function X(e){let{part:t,active:r,onSelect:s}=e,l=R(t.quality_tier);return(0,a.jsxs)(B,{active:r,onClick:s,children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsx)("p",{className:"text-xs text-gray-800 dark:text-gray-100 line-clamp-2 flex-1",title:t.name,children:t.name}),(0,a.jsx)("span",{className:"text-sm font-bold text-gray-900 dark:text-gray-100 whitespace-nowrap",children:E(t.price)})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-1 flex-wrap",children:[l&&(0,a.jsx)(V,{tone:"blue",children:l}),t.is_in_stock?(0,a.jsxs)(V,{tone:"green",children:["in stock",t.in_stock_qty?" \xd7".concat(t.in_stock_qty):""]}):(0,a.jsx)(V,{tone:"red",children:"out of stock"}),t.end_of_life&&(0,a.jsx)(V,{tone:"red",children:"end of life"}),!t.assembly_ok&&(0,a.jsx)(V,{tone:"amber",title:"Not a complete assembly â panel or digitizer only",children:"partial part"}),!t.model_match&&(0,a.jsx)(V,{tone:"amber",title:"Title mentions this model but failed the variant check (Pro / Plus / Max)",children:"variant mismatch"}),O(t.last_synced_at)&&(0,a.jsx)(V,{tone:"amber",title:"Last synced ".concat(L(t.last_synced_at)),children:"stale"}),(0,a.jsx)("span",{className:"ml-auto font-mono text-[10px] text-gray-400",children:t.sku}),t.product_url&&(0,a.jsx)("a",{href:t.product_url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"text-gray-400 hover:text-primary-600","aria-label":"Open on MobileSentrix",children:(0,a.jsx)(_.Z,{className:"h-3 w-3"})})]})]})}function J(e){let{part:t,active:r,suggested:s,discountPct:l,untagged:i,onSelect:n}=e;return(0,a.jsxs)(B,{active:r,onClick:n,children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("p",{className:"text-xs text-gray-800 dark:text-gray-100 line-clamp-2 flex-1",title:t.title,children:[s&&(0,a.jsx)(G.Z,{className:"inline h-3 w-3 text-amber-500 mr-1 -mt-0.5","aria-label":"Picked by the weekly sync"}),t.title]}),(0,a.jsxs)("span",{className:"text-right whitespace-nowrap",children:[(0,a.jsx)("span",{className:"text-sm font-bold text-gray-900 dark:text-gray-100",children:E(t.effective_cost)}),l>0&&(0,a.jsx)("span",{className:"block text-[10px] text-gray-400 line-through",children:E(t.price)})]})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-1 flex-wrap",children:[i&&(0,a.jsx)(V,{tone:"amber",title:"Not matched to this model by the weekly sync â check the title yourself",children:"not tagged to this model"}),t.grade&&(0,a.jsx)(V,{tone:"purple",children:t.grade}),t.screen_tech&&(0,a.jsx)(V,{tone:"blue",children:t.screen_tech.toUpperCase()}),t.available?(0,a.jsx)(V,{tone:"green",children:"in stock"}):(0,a.jsx)(V,{tone:"red",children:"out of stock"}),!t.is_listed&&(0,a.jsx)(V,{tone:"red",children:"delisted"}),null!=t.previous_price&&null!=t.price&&t.previous_price!==t.price&&(0,a.jsxs)(V,{tone:t.price>t.previous_price?"amber":"green",title:"Was ".concat(E(t.previous_price)," until ").concat(L(t.price_changed_at)),children:[t.price>t.previous_price?"â":"â"," ",E(t.previous_price)]}),O(t.last_seen_at)&&(0,a.jsx)(V,{tone:"amber",title:"Last seen ".concat(L(t.last_seen_at)),children:"stale"}),(0,a.jsx)("a",{href:t.product_url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"ml-auto text-gray-400 hover:text-teal-600","aria-label":"Open on MobileActive",children:(0,a.jsx)(_.Z,{className:"h-3 w-3"})})]})]})}function Y(e){let{title:t,accent:r,count:s,query:l,onQuery:i,onQuerySubmit:n,belowSearch:c,children:o,footer:d}=e;return(0,a.jsxs)("div",{className:"flex flex-col min-h-0",children:[(0,a.jsx)("div",{className:"flex items-center justify-between gap-2 mb-2",children:(0,a.jsxs)("h3",{className:"text-sm font-semibold ".concat(r),children:[t," ",(0,a.jsxs)("span",{className:"text-gray-400 font-normal",children:["(",s,")"]})]})}),(0,a.jsxs)("div",{className:"relative mb-2",children:[(0,a.jsx)(Q.Z,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-400"}
1),(0,a.jsx)("input",{value:l,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"===e.key&&n&&(e.preventDefault(),n())},placeholder:"Filter listingsâ¦",className:"w-full pl-7 pr-2 py-1.5 text-xs border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-700"})]}),c,(0,a.jsx)("div",{className:"space-y-1.5 overflow-y-auto pr-1 flex-1 min-h-0",children:o}),d]})}function ee(e){let{label:t,count:r,children:s}=e,[l,n]=(0,i.useState)(!1);return 0===r?null:(0,a.jsxs)("div",{className:"pt-1",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),className:"w-full flex items-center gap-1 text-[11px] text-gray-500 hover:text-gray-700 py-1",children:[l?(0,a.jsx)(W.Z,{className:"h-3 w-3"}):(0,a.jsx)($.Z,{className:"h-3 w-3"}),t," (",r,")"]}),l&&(0,a.jsx)("div",{className:"space-y-1.5 mt-1 opacity-80",children:s})]})}function et(e){let{msx:t,ma:r,maDiscountPct:s,suggestedHandles:l,selected:n,onSelect:c,compact:o,category:d}=e,[m,u]=(0,i.useState)("msx"),[p,x]=(0,i.useState)(""),[g,h]=(0,i.useState)(""),[y,v]=(0,i.useState)(null),[k,j]=(0,i.useState)(""),[_,N]=(0,i.useState)(!1),[w,S]=(0,i.useState)(null),[C,M]=(0,i.useState)(!1),A=(0,i.useCallback)(async()=>{let e=g.trim();if(e.length<2){S("Type at least 2 characters to search the whole catalogue.");return}N(!0),S(null);try{let t=await (0,f.AC)("/api/management/ma-search?q=".concat(encodeURIComponent(e),"&category=").concat(encodeURIComponent(d)));if(!(null==t?void 0:t.success)){v(null),S((null==t?void 0:t.error)||"Search failed.");return}v(t.data.products),M(!!t.data.truncated),j(e)}catch(e){v(null),S((null==e?void 0:e.message)||String(e))}finally{N(!1)}},[g,d]),P=(0,i.useCallback)(()=>{v(null),S(null),j("")},[]),Z=(0,i.useMemo)(()=>{let e=p.trim().toLowerCase(),r=e?t.filter(t=>"".concat(t.name," ").concat(t.sku).toLowerCase().includes(e)):t;return{primary:r.filter(e=>e.assembly_ok&&e.model_match&&e.is_in_stock&&!e.end_of_life),other:r.filter(e=>!(e.assembly_ok&&e.model_match&&e.is_in_stock&&!e.end_of_life))}},[t,p]),E=(0,i.useMemo)(()=>{let e=g.trim().toLowerCase(),t=e?r.filter(t=>{var r;return"".concat(t.title," ").concat(null!==(r=t.sku)&&void 0!==r?r:"").toLowerCase().includes(e)}):r;return{primary:t.filter(e=>e.available&&e.is_listed),other:t.filter(e=>!(e.available&&e.is_listed))}},[r,g]),q=e=>(null==n?void 0:n.source)==="msx"&&n.part.part_id===e.part_id,O=e=>(null==n?void 0:n.source)==="ma"&&n.part.id===e.id,L=e=>c(q(e)?null:{source:"msx",part:e}),R=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return c(O(e)?null:{source:"ma",part:e,untagged:t})},T=(0,i.useMemo)(()=>new Set(r.map(e=>e.id)),[r]),U=(0,a.jsxs)(Y,{title:"MobileSentrix",accent:"text-blue-700 dark:text-blue-400",count:t.length,query:p,onQuery:x,children:[0===Z.primary.length&&0===Z.other.length&&(0,a.jsx)("p",{className:"text-xs text-gray-400 italic py-4 text-center",children:"No MobileSentrix listings matched this model."}),Z.primary.map(e=>(0,a.jsx)(X,{part:e,active:q(e),onSelect:()=>L(e)},e.part_id)),(0,a.jsx)(ee,{label:"Not orderable / near misses",count:Z.other.length,children:Z.other.map(e=>(0,a.jsx)(X,{part:e,active:q(e),onSelect:()=>L(e)},e.part_id))})]}),z=(0,a.jsxs)(Y,{title:"MobileActive",accent:"text-teal-700 dark:text-teal-400",count:r.length,query:g,onQuery:h,onQuerySubmit:A,belowSearch:(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:A,disabled:_,className:"flex items-center gap-1 px-2 py-1 rounded-md text-[11px] font-semibold text-teal-700 dark:text-teal-300 bg-teal-50 dark:bg-teal-900/30 hover:bg-teal-100 disabled:opacity-50",children:[_?(0,a.jsx)(b.Z,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(K.Z,{className:"h-3 w-3"}),"Search all MobileActive"]}),y&&(0,a.jsx)("button",{type:"button",onClick:P,className:"text-[11px] text-gray-500 hover:text-gray-700 underline",children:"clear"})]}),(0,a.jsx)("p",{className:"mt-1 text-[10px] text-gray-400 leading-snug",children:"Looks through every listing, not just the ones matched to this model."}),w&&(0,a.jsx)("p",{className:"mt-1 text-[11px] text-red-600",children:w})]}),footer:(0,a.jsx)("p",{className:"mt-2 text-[10px] text-gray-400 leading-snug",children:s>0?"Prices shown are counter price less your ".concat(s,"% account discount."):"Counter prices â no account discount configured in Site Settings."}),children:[0===E.primary.length&&0===E.other.length&&(0,a.jsx)("p",{className:"text-xs text-gray-400 italic py-4 text-center",children:"No MobileActive listings matched this model."}),E.primary.map(e=>(0,a.jsx)(J,{part:e,active:O(e),suggested:l.has(e.handle),discountPct:s,onSelect:()=>R(e)},e.id)),(0,a.jsx)(ee,{label:"Out of stock / delisted",count:E.other.length,children:E.other.map(e=>(0,a.jsx)(J,{part:e,active:O(e),suggested:l.has(e.handle),discountPct:s,onSelect:()=>R(e)},e.id))}),y&&(0,a.jsxs)("div",{className:"pt-3 mt-2 border-t border-dashed border-gray-300 dark:border-gray-600",children:[(0,a.jsxs)("p",{className:"text-[11px] font-semibold text-gray-600 dark:text-gray-300 mb-1.5",children:["Catalogue search â â",k,"â (",y.length,C?"+":"",")"]}),0===y.length?(0,a.jsx)("p",{className:"text-xs text-gray-400 italic py-2",children:"Nothing in the MobileActive catalogue matches that."}
1):(0,a.jsxs)("div",{className:"space-y-1.5",children:[C&&(0,a.jsxs)("p",{className:"text-[10px] text-amber-600",children:["Showing the first ",y.length," â narrow the text to see the rest."]}),y.map(e=>(0,a.jsx)(J,{part:e,active:O(e),suggested:l.has(e.handle),discountPct:s,untagged:!T.has(e.id),onSelect:()=>R(e,!T.has(e.id))},"search-".concat(e.id)))]})]})]});return o?(0,a.jsxs)("div",{className:"flex flex-col min-h-0 h-full",children:[(0,a.jsx)("div",{className:"flex gap-1 mb-2",children:["msx","ma"].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>u(e),className:"flex-1 px-3 py-1.5 rounded-md text-xs font-semibold transition-colors ".concat(m===e?"msx"===e?"bg-blue-600 text-white":"bg-teal-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300"),children:"msx"===e?"MobileSentrix (".concat(t.length,")"):"MobileActive (".concat(r.length,")")},e))}),(0,a.jsx)("div",{className:"flex-1 min-h-0",children:"msx"===m?U:z})]}):(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 min-h-0 h-full",children:[U,z]})}var er=r(94364);function ea(e){var t;let{open:r,onClose:s,ctx:l,selected:n,initialTiers:c,submitting:d,onConfirm:m}=e,u="msx"===n.source,p=u?n.part.price:null!==(t=n.part.effective_cost)&&void 0!==t?t:0,x=u?n.part.name:n.part.title,g=u?n.part.sku:n.part.sku||n.part.handle,b=n.part.product_url,y=u?R(n.part.quality_tier):function(e){switch((e||"").toLowerCase()){case"genuine":case"service-pack":return"Genuine OEM";case"oem-pull":return"OEM Pull";case"refurb":return"Refurbished";case"soft-oled":return"Premium Soft OLED";case"hard-oled":return"Premium Hard OLED";case"premium":return"Premium";case"incell":return"Aftermarket Incell";case"am-battery-plus":return"Aftermarket Plus";case"aftermarket":return"Aftermarket";default:return""}}(n.part.grade),[f,v]=(0,i.useState)(c),[k,j]=(0,i.useState)(y),[N,w]=(0,i.useState)(u?"msx_order":"local_supplier"),[S,C]=(0,i.useState)(u),[M,A]=(0,i.useState)(""),[P,q]=(0,i.useState)("");(0,i.useEffect)(()=>{v(c),j(y),w(u?"msx_order":"local_supplier"),C(u),A(""),q("")},[c,y,u,n]);let T=(0,i.useMemo)(()=>U(l.rows),[l.rows]),z=1===f.length,I=""===M.trim()?null:Number(M),H=null===I||Number.isFinite(I)&&I>0,F=e=>Z({wholesaleCost:p,tier:e.pricing_tier,markup:l.markup.find(t=>t.tier===e.pricing_tier),oem:l.oem,ceiling:l.ceiling,serviceCategory:l.service.category,deviceCategory:l.model.device_category,modeOverride:e.pricing_mode_override,priceOverride:z&&f[0]===e.pricing_tier?I:null}),D=[];u?(n.part.is_in_stock||D.push("This part is out of stock at MobileSentrix."),n.part.end_of_life&&D.push("MobileSentrix has marked this part end-of-life."),n.part.assembly_ok||D.push("This looks like a panel/digitizer only, not a complete assembly."),n.part.model_match||D.push("This listing mentions the model but failed the variant check â confirm it is not the Pro / Plus / Max part."),O(n.part.last_synced_at)&&D.push("MobileSentrix data for this part is ".concat(L(n.part.last_synced_at),"."))):(n.untagged&&D.push("This came from a catalogue-wide search, not ".concat(l.model.name,"'s matched listings â read the title and confirm it is the right model and variant.")),n.part.available||D.push("This part is out of stock at MobileActive."),n.part.is_listed||D.push("This product is no longer listed on MobileActive."),O(n.part.last_seen_at)&&D.push("MobileActive last saw this listing ".concat(L(n.part.last_seen_at),".")),0===l.ma.discount_pct&&D.push("No MobileActive account discount is configured, so the counter price is being used as your cost."));let G=f.length>0&&p>0&&H&&!d&&!!x,Q=async()=>{let e=T.filter(e=>f.includes(e.pricing_tier)).map(e=>e.id);0!==e.length&&await m({pricing_ids:e,supplier:n.source,wholesale_cost:p,wholesale_sku:u?n.part.sku:"MA:".concat(g),wholesale_part_name:x,part_quality:k.trim()||null,part_source:N,base_price_override:z&&null!=I?I:void 0,pin_sku:u?S:void 0,reason:P.trim()||void 0,supplier_ref:u?{msx_product_id:n.part.part_id}:{ma_product_id:n.part.id,ma_handle:n.part.handle}})};return(0,a.jsxs)(er.Z,{open:r,onClose:s,submitting:d,size:"lg",title:"Use this ".concat(u?"MobileSentrix":"MobileActive"," part"),footer:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsx)("p",{className:"text-[11px] text-gray-500",children:0===f.length?"Pick at least one tier.":"Updates ".concat(f.length," tier").concat(f.length>
11?"s":""," for ").concat(l.model.name," â ").concat(l.service.name,".")}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:s,disabled:d,className:"px-4 py-2 rounded-md text-sm font-medium border border-gray-300 dark:border-gray-600 disabled:opacity-50",children:"Cancel"}),(0,a.jsx)("button",{type:"button",onClick:Q,disabled:!G,className:"px-4 py-2 rounded-md text-sm font-semibold bg-primary-600 text-white hover:bg-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",children:d?"Savingâ¦":"Save prices"})]})]}),children:[(0,a.jsxs)("div",{className:"rounded-lg border border-gray-200 dark:border-gray-700 p-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:x}),(0,a.jsxs)("div",{className:"text-right whitespace-nowrap",children:[(0,a.jsx)("p",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:E(p)}),!u&&l.ma.discount_pct>0&&(0,a.jsxs)("p",{className:"text-[11px] text-gray-400",children:[E(n.part.price)," counter â ",l.ma.discount_pct,"%"]})]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 flex-wrap text-[11px] text-gray-500",children:[(0,a.jsx)("span",{className:"font-mono",children:g}),y&&(0,a.jsxs)("span",{children:["\xb7 ",y]}),!u&&n.part.screen_tech&&(0,a.jsxs)("span",{children:["\xb7 ",n.part.screen_tech.toUpperCase()]}),b&&(0,a.jsxs)("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-primary-600 hover:underline",children:["open listing ",(0,a.jsx)(_.Z,{className:"h-3 w-3"})]})]})]}),D.length>0&&(0,a.jsxs)("div",{className:"mt-3 rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 p-3",children:[(0,a.jsxs)("p",{className:"text-xs font-semibold text-amber-900 dark:text-amber-200 flex items-center gap-1.5",children:[(0,a.jsx)(h.Z,{className:"h-3.5 w-3.5"})," Worth a second look"]}),(0,a.jsx)("ul",{className:"mt-1.5 space-y-1 text-[11px] text-amber-800 dark:text-amber-300 list-disc list-inside",children:D.map(e=>(0,a.jsx)("li",{children:e},e))})]}),(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-200 mb-2",children:"Apply to"}),(0,a.jsx)("div",{className:"space-y-2",children:T.map(e=>{let t=F(e),r=f.includes(e.pricing_tier),s=!t.canAutoPrice,i=null!=t.price?t.price-e.base_price:null;return(0,a.jsxs)("label",{className:"flex items-start gap-3 p-2.5 rounded-lg border cursor-pointer ".concat(r?"border-primary-400 bg-primary-50 dark:bg-primary-900/20":"border-gray-200 dark:border-gray-700"," ").concat(s?"opacity-60 cursor-not-allowed":""),children:[(0,a.jsx)("input",{type:"checkbox",checked:r,disabled:s,onChange:t=>v(r=>t.target.checked?[...r,e.pricing_tier]:r.filter(t=>t!==e.pricing_tier)),className:"mt-1"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"text-sm font-medium capitalize text-gray-900 dark:text-gray-100",children:e.pricing_tier}),s?(0,a.jsx)("span",{className:"text-[11px] text-amber-700",children:"no markup rule â set this price on the tier card"}):(0,a.jsxs)("span",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-400 line-through mr-1.5",children:E(e.base_price)}),(0,a.jsx)("span",{className:"font-bold text-gray-900 dark:text-gray-100",children:E(t.price)}),null!=i&&0!==i&&(0,a.jsxs)("span",{className:"ml-1.5 text-[11px] ".concat(i>0?"text-emerald-600":"text-red-600"),children:[i>0?"+":"",E(i)]})]})]}),!s&&(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-2 flex-wrap text-[11px]",children:[(0,a.jsxs)("span",{className:null!=t.margin&&t.margin<l.ceiling.minMargin?"text-red-600 font-medium":"text-gray-500",children:["margin ",E(t.margin),null!=t.marginPct&&" \xb7 ".concat(t.marginPct,"%")]}),t.verdict&&"no_reference"!==t.verdict.reason&&(0,a.jsxs)("span",{className:"px-1.5 py-0.5 rounded ".concat("inquiry"===t.verdict.mode?"bg-amber-100 text-amber-800":"bg-gray-100 text-gray-600"),children:[t.verdict.reason.replace(/_/g," "),!t.enforced&&" (would)"]})]})]})]},e.id)})})]}),(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold text-gray-700 dark:text-gray-200",children:"Quality label (customers see this)"}),(0,a.jsx)("input",{value:k,onChange:e=>j(e.target.value),className:"mt-1 w-full px-2.5 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-700"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold text-gray-700 dark:text-gray-200",children:"Sourcing (drives bookable dates)"}),(0,a.jsxs)("select",{value:N,onChange:e=>w(e.target.value),className:"mt-1 w-full px-2.5 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-700",children:[(0,a.jsx)("option",{value:"in_stock",children:"In stock â same day"}),(0,a.jsx)("option",{value:"local_supplier",children:"Local supplier â pickup"}),(0,a.jsx)("option",{value:"msx_order",children:"MobileSentrix order â shipped"})]})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsxs)("span",{className:"text-[11px] font-semibold text-gray-700 dark:text-gray-200",children:["Sell price override ",!z&&(0,a.jsx)("span",{className:"text-gray-400",children:"(one tier only)"})]}),(0,a.jsx)("input",{type:"number",step:"0.01",inputMode:"decimal",value:M,disabled:!z,placeholder:z?"leave blank to use the calculated price":"â",onChange:e=>A(e.target.value),className:"mt-1 w-full px-2.5 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-700 disabled:bg-gray-100 dark:disabled:bg-gray-800"}),!H&&(0,a.jsx)("span",{className:"text-[11px] text-red-600",children:"Enter a positive number."})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold text-gray-700 dark:text-gray-200",children:"Note for the audit log"}),(0,a.jsx)("input",{value:P,onChange:e=>q(e.target.value),placeholder:"why this part?",className:"mt-1 w-full px-2.5 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md dark:bg-gray-700"})]})]}),(0,a.jsx)("div",{className:"mt-4 rounded-lg bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 p-3",children:u?(0,a.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:S,onChange:e=>C(e.target.checked),className:"mt-0.5"}),(0,a.jsxs)("span",{className:"text-[11px] text-gray-600 dark:text-gray-300",children:[(0,a.jsx)("strong",{className:"text-gray-800 dark:text-gray-100",children:"Pin this SKU."})," The weekly price push keeps refreshing its cost but never swaps the part. Untick to let the sync choose again â that clears any existing pin on these tiers."]})]}):(0,a.jsxs)("p",{className:"text-[11px] text-gray-600 dark:text-gray-300",children:[(0,a.jsx)("strong",{className:"text-cyan-700",children:"This locks the tier to MobileActive."}
1)," The weekly MobileSentrix push cannot see this part, so it will skip these rows instead of overwriting your cost. Use ",(0,a.jsx)("em",{children:"Unlock"})," on the tier card to hand it back."," ",0===l.ma.discount_pct&&(0,a.jsxs)(a.Fragment,{children:["Set your account discount in"," ",(0,a.jsx)(o(),{href:"/management/site-settings",className:"underline",children:"Site Settings"})," ","so costs reflect what you actually pay."]})]})})]})}let es="workbench_layout";function el(){let e=(0,n.useRouter)(),t=(0,i.useRef)(null),[r,s]=(0,i.useState)([]),[l,c]=(0,i.useState)([]),[m,k]=(0,i.useState)(""),[j,_]=(0,i.useState)(""),[N,w]=(0,i.useState)(null),[S,C]=(0,i.useState)(!1),[M,A]=(0,i.useState)(null),[P,Z]=(0,i.useState)("auto"),[q,O]=(0,i.useState)(!1),[L,R]=(0,i.useState)(null),[T,z]=(0,i.useState)([]),[I,H]=(0,i.useState)(!1),[F,G]=(0,i.useState)(!1),Q="compact"===P||"auto"===P&&q;(0,i.useEffect)(()=>{let e=t.current;if(!e||"undefined"==typeof ResizeObserver)return;let r=new ResizeObserver(e=>{let[t]=e;O(t.contentRect.width<900)});return r.observe(e),()=>r.disconnect()},[]),(0,i.useEffect)(()=>{let e=window.localStorage.getItem(es);("full"===e||"compact"===e||"auto"===e)&&Z(e)},[]);let W=e=>{Z(e);try{window.localStorage.setItem(es,e)}catch(e){}};(0,i.useEffect)(()=>{(async()=>{try{var e,t;let[r,a]=await Promise.all([(0,f.AC)("/api/management/models"),(0,f.AC)("/api/management/services")]);(null==r?void 0:r.success)&&Array.isArray(r.models)&&s(r.models.map(e=>{var t,r;return{id:e.id,name:e.name,brand_id:e.brand_id||"",brand_name:(null===(t=e.brand)||void 0===t?void 0:t.name)||"",type_id:e.type_id||"",type_name:(null===(r=e.device_type)||void 0===r?void 0:r.name)||"",staged:!1===e.is_active}}).sort((e,t)=>Number(e.staged)-Number(t.staged)));let l=null!==(t=null!==(e=null==a?void 0:a.services)&&void 0!==e?e:null==a?void 0:a.data)&&void 0!==t?t:[];Array.isArray(l)&&c(l.filter(e=>v.includes(e.slug)).map(e=>({id:e.id,name:e.name,slug:e.slug})))}catch(e){d.Am.error("Could not load the device catalogue")}})()},[]),(0,i.useEffect)(()=>{if(!e.isReady)return;let t="string"==typeof e.query.model?e.query.model:"",r="string"==typeof e.query.service?e.query.service:"";k(e=>e===t?e:t),_(e=>e===r?e:r)},[e.isReady,e.query.model,e.query.service]);let $=(0,i.useCallback)((t,r)=>{let a={};t&&(a.model=t),r&&(a.service=r),e.replace({pathname:"/management/pricing-workbench",query:a},void 0,{shallow:!0})},[e]),K=(0,i.useMemo)(()=>r.find(e=>e.id===m),[r,m]),V=(0,i.useMemo)(()=>{let e=((null==K?void 0:K.type_name)||"").toLowerCase();if(!e)return l;let t=e.includes("laptop")?"-laptop":"-mobile",r=l.filter(e=>e.slug.endsWith(t));return r.length>0?r:l},[l,K]);(0,i.useEffect)(()=>{var e;if(!m||0===V.length||j&&V.some(e=>e.id===j))return;let t=null!==(e=V.find(e=>e.slug.startsWith("screen")))&&void 0!==e?e:V[0];t&&(_(t.id),$(m,t.id))},[m,j,V,$]);let B=(0,i.useCallback)(async()=>{if(!m||!j){w(null);return}C(!0),A(null);try{let e=await (0,f.AC)("/api/management/workbench-context?model_id=".concat(encodeURIComponent(m),"&service_id=").concat(encodeURIComponent(j)));if(!(null==e?void 0:e.success)){w(null),A((null==e?void 0:e.message)||(null==e?void 0:e.error)||"Could not load this model.");return}w(e.data)}catch(e){w(null),A((null==e?void 0:e.message)||String(e))}finally{C(!1)}},[m,j]);(0,i.useEffect)(()=>{B()},[B]),(0,i.useEffect)(()=>{R(null)},[m,j]);let X=(0,i.useCallback)(async(e,t)=>{G(!0);try{let r=await (0,f.AC)("/api/management/workbench-apply",{method:"POST",body:JSON.stringify(e)});if(!(null==r?void 0:r.success))return d.Am.error((null==r?void 0:r.error)||"Update failed"),!1;return d.Am.success(t),await B(),!0}catch(e){return d.Am.error((null==e?void 0:e.message)||String(e)),!1}finally{G(!1)}},[B]),J=e=>{L&&(z(e),H(!0))},Y=async e=>{await X(e,"Updated ".concat(e.pricing_ids.length," tier").concat(e.pricing_ids.length>1?"s":""))&&(H(!1),R(null))},ee=async(e,t)=>{let r=Number(t.wholesale_cost);if(!Number.isFinite(r)||r<=0){d.Am.error("Enter a part cost greater than zero.");return}let a=""===t.base_price.trim()?void 0:Number(t.base_price);if(void 0!==a&&(!Number.isFinite(a)||a<=0)){d.Am.error("Sell price must be a positive number.");return}await X({pricing_ids:[e.id],supplier:"manual",wholesale_cost:r,wholesale_sku:t.wholesale_sku.trim()||void 0,wholesale_part_name:t.wholesale_part_name.trim()||"Entered by hand",part_quality:t.part_quality.trim()||null,part_source:t.part_source,base_price_override:a,reason:"Entered by hand in the workbench"},"".concat(e.pricing_tier," tier updated"))},er=async e=>{G(!0);try{let t=await (0,f.AC)("/api/management/dynamic-pricing",{method:"PATCH",body:JSON.stringify({id:e.id,cost_source:"msx"})});if(!(null==t?void 0:t.success)){d.Am.error((null==t?void 0:t.error)||"Could not unlock this row");return}d.Am.success("Handed back to the MobileSentrix sync"),await B()}catch(e){d.Am.error((null==e?void 0:e.message)||String(e))}finally{G(!1)}},el=(0,i.useMemo)(()=>{var e;return new Set((null!==(e=null==N?void 0:N.ma.matches)&&void 0!==e?e:[]).map(e=>e.ma_handle).filter(e=>"string"==typeof e))},[N]),ei=(0,i.useMemo)(()=>N?U(N.rows):[],[N]),en=(null==L?void 0:L.source)==="msx"?L.part.price:(null==L?void 0:L.source)==="ma"?L.part.effective_cost:null;return(0,a.jsxs)("div",{ref:t,className:"space-y-4",children:[(0,a.jsxs)("div",{className:"sticky top-0 z-20 -mx-4 sm:-mx-6 lg:-mx-8 px-4 sm:px-6 lg:px-8 py-3 bg-gray-50/95 dark:bg-gray-900/95 backdrop-blur border-b border-gray-200 dark:border-gray-700",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,a.jsxs)("div",{className:"min-w-[240px] flex-1 max-w-md",children:[(0,a.jsx)("label",{className:"block text-[11px] font-semibold text-gray-600 dark:text-gray-300 mb-1",children:"Device"}),(0,a.jsx)(y.Z,{models:r,value:m,onChange:e=>{k(e),$(e,""),_("")}})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:V.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>{_(e.id),$(m,e.id)},disabled:!m,className:"px-3 py-2 rounded-md text-xs font-semibold transition-colors disabled:opacity-40 ".concat(j===e.id?"bg-primary-600 text-white":"bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-200 hover:bg-gray-50"),children:e.name},e.id))}),(0,a.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>W(Q?"full":"compact"),title:Q?"Switch to the wide layout":"Switch to the split-screen layout",className:"p-2 rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:Q?(0,a.jsx)(u,{className:"h-4 w-4"}):(0,a.jsx)(p,{className:"h-4 w-4"})}),(0,a.jsx)("button",{type:"button",onClick:()=>void B(),disabled:S||!m,className:"p-2 rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-40",title:"Reload",children:(0,a.jsx)(x.Z,{className:"h-4 w-4 ".concat(S?"animate-spin":"")})})]})]}),L&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-2 flex-wrap rounded-lg bg-primary-50 dark:bg-primary-900/20 border border-primary-200 px-3 py-2",children:[(0,a.jsx)(g,{className:"h-3.5 w-3.5 text-primary-600 shrink-0"}),(0,a.jsx)("span",{className:"text-xs text-gray-800 dark:text-gray-100 truncate flex-1 min-w-[120px]",children:"msx"===L.source?L.part.name:L.part.title}),(0,a.jsx)("span",{className:"text-xs font-bold",children:E(en)}),(0,a.jsx)("button",{type:"button",disabled:F||0===ei.length,onClick:()=>J(ei.map(e=>e.pricing_tier)),className:"px-2.5 py-1 rounded-md text-xs font-semibold bg-primary-600 text-white hover:bg-primary-700 disabled:opacity-40",children:"Assign to tiersâ¦"}),(0,a.jsx)("button",{type:"button",onClick:()=>R(null),className:"text-xs text-gray-500 hover:text-gray-700",children:"clear"})]})]}),!m&&(0,a.jsxs)("div",{className:"text-center py-16 text-gray-500 dark:text-gray-400",children:[(0,a.jsx)("p",{className:"text-sm",children:"Pick a device to see both suppliers side by side."}),(0,a.jsxs)("p",{className:"text-xs mt-1",children:["Or open one straight from the"," ",(0,a.jsx)(o(),{href:"/management/pricing",className:"text-primary-600 underline",children:"pricing grid"}),"."]})]}),M&&(0,a.jsxs)("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 p-4 text-sm text-red-800 dark:text-red-300 flex items-start gap-2",children:[(0,a.jsx)(h.Z,{className:"h-4 w-4 mt-0.5 shrink-0"}),(0,a.jsx)("span",{children:M})]}),S&&!N&&(0,a.jsxs)("div",{className:"flex items-center justify-center py-16 text-gray-400",children:[(0,a.jsx)(b.Z,{className:"h-5 w-5 animate-spin mr-2"})," Loadingâ¦"]}),N&&(0,a.jsxs)(a.Fragment,{children:[N.coverage.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:N.coverage.map(e=>{let t=e.service_id===j,r=["value","recommended","premium"].map(t=>
1e.tiers[t]).filter(Boolean);return(0,a.jsxs)("button",{type:"button",disabled:!e.workbenchable,onClick:()=>{_(e.service_id),$(m,e.service_id)},title:e.workbenchable?void 0:"".concat(e.name," is quoted case-by-case â it has no published price."),className:"px-2.5 py-1.5 rounded-lg border text-xs transition-colors ".concat(t?"border-primary-500 bg-primary-50 dark:bg-primary-900/20":"border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"," ").concat(e.workbenchable?"hover:border-gray-400":"opacity-50 cursor-not-allowed"),children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 dark:text-gray-200",children:e.name}),(0,a.jsx)("span",{className:"ml-1.5 text-gray-400",children:0===r.length?"â":r.map(e=>"inquiry"===e.pricing_mode?"quote":E(e.base_price)).join(" / ")})]},e.service_id)})}),N.warnings.length>0&&(0,a.jsx)("div",{className:"rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 px-3 py-2 space-y-1",children:N.warnings.map(e=>(0,a.jsx)("p",{className:"text-[11px] text-amber-800 dark:text-amber-300",children:e},e))}),(0,a.jsxs)("div",{className:Q?"flex flex-col gap-4":"grid grid-cols-[minmax(320px,2fr)_3fr] gap-4 items-start",children:[(0,a.jsx)("div",{className:Q?"grid grid-cols-1 sm:grid-cols-2 gap-3":"space-y-3",children:0===ei.length?(0,a.jsxs)("div",{className:"rounded-xl border border-dashed border-gray-300 dark:border-gray-600 p-6 text-center text-sm text-gray-500",children:["No price rows exist for ",N.model.name," â ",N.service.name,". Create them in the"," ",(0,a.jsx)(o(),{href:"/management/pricing",className:"text-primary-600 underline",children:"pricing grid"})," ","first."]}):ei.map(e=>(0,a.jsx)(D,{row:e,ctx:N,compact:Q,selected:L,maMatch:N.ma.matches.find(t=>t.pricing_id===e.id),history:N.history,busy:F,onAssignHere:e=>J([e.pricing_tier]),onManualSave:ee,onUnlock:er},e.id))}),(0,a.jsx)("div",{className:Q?"min-h-[420px]":"sticky top-[104px] h-[calc(100vh-160px)] rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 p-3",children:(0,a.jsx)(et,{msx:N.msx,ma:N.ma.products,maDiscountPct:N.ma.discount_pct,suggestedHandles:el,selected:L,onSelect:R,compact:Q,category:N.service.category})})]})]}),N&&L&&I&&(0,a.jsx)(ea,{open:I,onClose:()=>H(!1),ctx:N,selected:L,initialTiers:T,submitting:F,onConfirm:Y})]})}function ei(){return(0,a.jsxs)(s.Z,{title:"Pricing Workbench",children:[(0,a.jsx)(l.Z,{title:"Pricing Workbench",description:"Compare MobileSentrix and MobileActive listings for one device, then set the price for each tier."}),(0,a.jsx)(el,{})]})}}},function(e){e.O(0,[2840,6444,5622,92,4340,2888,9774,179],function(){return e(e.s=53341)}),_N_E=e.O()}]);
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.