PageSourceSearch

https://landedglobal.ai/assets/ShipmentsPage-BvD32v8g.js

js landedglobal.ai collected 2026-10-05 16:12:03 UTC 26,465 bytes, 2 lines download raw bytes

1import{u as Ce,a as je,k as ve,r as d,j as e,S as Re,L as j,d as v}from"./index-CHhzuL3B.js";import{x as ae,e as G,A as q,B as te,l as Be,m as se,d as Se,s as le,C as De}from"./firebase-lib-CWUo0RKC.js";import{S as oe,g as ue,b as Ae}from"./dutyRates-DrjA-qqK.js";import{f as Y,c as Ie}from"./costCalculation-JhiLFEam.js";import{B as Te}from"./Breadcrumb-FQjPNLIr.js";import"./react-vendor-CCXFnprz.js";import"./pdf-lib-DPbQAZCF.js";const Le="_root_1lhk1_1",Oe="_content_1lhk1_20",Me="_pageHeader_1lhk1_28",Pe="_pageTitle_1lhk1_36",Ee="_pageSubtitle_1lhk1_42",$e="_headerButtons_1lhk1_48",He="_demoButton_1lhk1_55",Fe="_cardDemo_1lhk1_79",We="_newButton_1lhk1_83",Ue="_statsRow_1lhk1_102",Ve="_statCard_1lhk1_109",Ge="_statValue_1lhk1_119",qe="_statLabel_1lhk1_127",Ye="_toolbar_1lhk1_135",Je="_searchWrap_1lhk1_142",Qe="_searchIcon_1lhk1_149",ze="_searchInput_1lhk1_158",Ke="_searchClear_1lhk1_179",Xe="_sortSelect_1lhk1_195",Ze="_cardGrid_1lhk1_215",ea="_card_1lhk1_79",aa="_cardExpanded_1lhk1_237",ta="_cardSelected_1lhk1_241",sa="_cardRow_1lhk1_246",la="_cardCheckbox_1lhk1_255",oa="_cardCheckboxChecked_1lhk1_274",na="_cardDemoBadge_1lhk1_285",ca="_cardRoute_1lhk1_299",ra="_cardOrigin_1lhk1_307",ia="_cardArrow_1lhk1_313",da="_cardDest_1lhk1_318",ua="_cardRowProduct_1lhk1_324",ma="_cardStatus_1lhk1_333",_a="_cardRowDate_1lhk1_345",ha="_cardChevron_1lhk1_352",pa="_cardChevronOpen_1lhk1_362",ka="_cardBody_1lhk1_366",ba="_cardBodyOpen_1lhk1_372",fa="_cardBodyInner_1lhk1_376",ya="_cardProduct_1lhk1_384",xa="_cardCost_1lhk1_390",ga="_cardMeta_1lhk1_398",wa="_cardMetaItem_1lhk1_404",Na="_cardMetaDot_1lhk1_409",Ca="_cardActions_1lhk1_414",ja="_cardViewBtn_1lhk1_421",va="_cardNewTabBtn_1lhk1_437",Ra="_loadMoreRow_1lhk1_457",Ba="_loadMoreBtn_1lhk1_463",Sa="_skeletonGrid_1lhk1_481",Da="_skeletonCard_1lhk1_487",Aa="_skeletonLine_1lhk1_499",Ia="_center_1lhk1_518",Ta="_errorMsg_1lhk1_525",La="_noResults_1lhk1_530",Oa="_empty_1lhk1_536",Ma="_emptyIcon_1lhk1_541",Pa="_emptyTitle_1lhk1_546",Ea="_emptyDesc_1lhk1_552",$a="_emptyActions_1lhk1_560",Ha="_compareBar_1lhk1_594",Fa="_compareBarCount_1lhk1_604",Wa="_compareBarActions_1lhk1_606",Ua="_compareBarCompare_1lhk1_608",Va="_compareBarClear_1lhk1_616",Ga="_compareOverlay_1lhk1_626",qa="_compareHeader_1lhk1_632",Ya="_compareTitle_1lhk1_640",Ja="_compareHeaderActions_1lhk1_642",Qa="_compareEditBtn_1lhk1_644",za="_compareCloseBtn_1lhk1_644",Ka="_compareTableWrap_1lhk1_653",Xa="_compareTable_1lhk1_653",Za="_compareRowLabel_1lhk1_662",et="_compareColHeader_1lhk1_664",at="_compareColRoute_1lhk1_665",tt="_compareColProduct_1lhk1_666",st="_compareCell_1lhk1_668",lt="_compareTotalRow_1lhk1_669",ot="_compareCellBest_1lhk1_673",nt="_compareCellWorst_1lhk1_675",ct="_fabBackdrop_1lhk1_680",rt="_fab_1lhk1_680",it="_fabBtn_1lhk1_688",dt="_fabBtnOpen_1lhk1_697",ut="_fabMenu_1lhk1_699",mt="_fabItem_1lhk1_705",_t="_fabItemDisabled_1lhk1_714",ht="_fabItemIcon_1lhk1_715",pt="_fabItemLabel_1lhk1_716",kt="_fabComingSoon_1lhk1_717",bt="_staleIndicator_1lhk1_759",ft="_bulkRecalcBtn_1lhk1_775",yt="_bulkOverlay_1lhk1_799",xt="_bulkPanel_1lhk1_811",gt="_bulkPanelHeader_1lhk1_823",wt="_bulkPanelTitle_1lhk1_830",Nt="_bulkPanelClose_1lhk1_837",Ct="_bulkScanning_1lhk1_852",jt="_bulkSummary_1lhk1_859",vt="_bulkList_1lhk1_865",Rt="_bulkRow_1lhk1_873",Bt="_bulkRowSelected_1lhk1_887",St="_bulkCheckbox_1lhk1_892",Dt="_bulkRowTitle_1lhk1_900",At="_bulkRowValues_1lhk1_910",It="_bulkRowOrig_1lhk1_918",Tt="_bulkRowArrow_1lhk1_922",Lt="_bulkRowNew_1lhk1_925",Ot="_bulkDiff_1lhk1_930",Mt="_bulkDiffUp_1lhk1_937",Pt="_bulkDiffDown_1lhk1_941",Et="_bulkDiffFlat_1lhk1_945",$t="_bulkEmpty_1lhk1_950",Ht="_bulkWarning_1lhk1_957",Ft="_bulkActions_1lhk1_967",Wt="_bulkApplyBtn_1lhk1_973",Ut="_bulkCancelBtn_1lhk1_992",a={root:Le,content:Oe,pageHeader:Me,pageTitle:Pe,pageSubtitle:Ee,headerButtons:$e,demoButton:He,cardDemo:Fe,newButton:We,statsRow:Ue,statCard:Ve,statValue:Ge,statLabel:qe,toolbar:Ye,searchWrap:Je,searchIcon:Qe,searchInput:ze,searchClear:Ke,sortSelect:Xe,cardGrid:Ze,card:ea,cardExpanded:aa,cardSelected:ta,cardRow:sa,cardCheckbox:la,cardCheckboxChecked:oa,cardDemoBadge:na,cardRoute:ca,cardOrigin:ra,cardArrow:ia,cardDest:da,cardRowProduct:ua,cardStatus:ma,cardRowDate:_a,cardChevron:ha,cardChevronOpen:pa,cardBody:ka,cardBodyOpen:ba,cardBodyInner:fa,cardProduct:ya,cardCost:xa,cardMeta:ga,cardMetaItem:wa,cardMetaDot:Na,cardActions:Ca,cardViewBtn:ja,cardNewTabBtn:va,loadMoreRow:Ra,loadMoreBtn:Ba,skeletonGrid:Sa,skeletonCard:Da,skeletonLine:Aa,center:Ia,errorMsg:Ta,noResults:La,empty:Oa,emptyIcon:Ma,emptyTitle:Pa,empty
1Desc:Ea,emptyActions:$a,compareBar:Ha,compareBarCount:Fa,compareBarActions:Wa,compareBarCompare:Ua,compareBarClear:Va,compareOverlay:Ga,compareHeader:qa,compareTitle:Ya,compareHeaderActions:Ja,compareEditBtn:Qa,compareCloseBtn:za,compareTableWrap:Ka,compareTable:Xa,compareRowLabel:Za,compareColHeader:et,compareColRoute:at,compareColProduct:tt,compareCell:st,compareTotalRow:lt,compareCellBest:ot,compareCellWorst:nt,fabBackdrop:ct,fab:rt,fabBtn:it,fabBtnOpen:dt,fabMenu:ut,fabItem:mt,fabItemDisabled:_t,fabItemIcon:ht,fabItemLabel:pt,fabComingSoon:kt,staleIndicator:bt,bulkRecalcBtn:ft,bulkOverlay:yt,bulkPanel:xt,bulkPanelHeader:gt,bulkPanelTitle:wt,bulkPanelClose:Nt,bulkScanning:Ct,bulkSummary:jt,bulkList:vt,bulkRow:Rt,bulkRowSelected:Bt,bulkCheckbox:St,bulkRowTitle:Dt,bulkRowValues:At,bulkRowOrig:It,bulkRowArrow:Tt,bulkRowNew:Lt,bulkDiff:Ot,bulkDiffUp:Mt,bulkDiffDown:Pt,bulkDiffFlat:Et,bulkEmpty:$t,bulkWarning:Ht,bulkActions:Ft,bulkApplyBtn:Wt,bulkCancelBtn:Ut},ne=["2026-02-01","2026-02-24","2026-07-01"],ce=new Date(ne[ne.length-1]+"T00:00:00Z");function Vt(s,o){var k;if(!s||s.isDemo||s.recalculatedAt||s.rateVerifiedAt||!s.createdAt)return!1;const p=(k=s.createdAt)!=null&&k.toDate?s.createdAt.toDate():new Date(s.createdAt),u=o?new Date(Math.max(ce.getTime(),o.getTime())):ce;return p<u||new Date>=oe&&p<oe}function re(s){if(!s||s.isDemo)return!1;const o=ue(s.commodity_type,s.origin_country);return!!(o!=null&&o.section122ReplacementWarning)}function Gt(s){try{const o=ue(s.commodity_type,s.origin_country,"US",{woodContent:s.wood_content,usmcaQualified:s.usmca_qualified==="yes"?!0:s.usmca_qualified==="no"?!1:void 0,htsCode:s.hts_code||void 0}),p=Ie(s,Ae(o),"landed_table",o.section301Rate,o.section232Rate,o.section122Rate,"US",o.flipRate);p.flipUnverified=o.flipUnverified||!1;const k=(s.cost_breakdown||{}).total_landed_cost??parseFloat(s.cargo_value)??0,f=p.total,L=f-k;return{origTotal:k,newTotal:f,diff:L,newCb:p,error:null}}catch(o){return{error:o.message||"Recalculation failed"}}}const qt={isDemo:!0,status:"Ocean Transit",origin_country:"Italy",factory_address:"Via della Concordia 6, 61122 Pesaro PU Italy",product_type:"Wooden kitchen cabinets and cabinetry hardware",commodity_type:"kitchen_cabinets",container_type:"40HC",cargo_value:"127500",incoterm:"FOB",port_of_entry:"New York/NJ",importer_of_record:"Saxton Logistics LLC",delivery_address:"340 W 28th St, New York NY 10001",destination_city:"New York",destination_state:"NY",ship_date:"2026-07-21",wood_content:"product_and_packaging",hts_code:"9403.40.9060",hts_description:"Wooden furniture of a kind used in the bedroom or dining room",duty_rate:0,duty_rate_source:"usitc",usmca_qualified:"no",cost_breakdown:{cargo_value:127500,import_duty:0,duty:0,section_301:0,mpf:441.66,hmf:159.38,customs_bond:750,insurance:382.5,ocean_freight:4800,last_mile:1850,total_landed_cost:135883.54,duty_rate_source:"usitc"}},Yt={"In Transit":"var(--color-teal)","At Origin":"var(--color-gold)",Delivered:"#4ade80","On Hold":"#f87171"};function b(s){return!s&&s!==0?"—":"$"+Number(s).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}function ie(s){return s?(s.toDate?s.toDate():new Date(s)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"}const de=[{key:"route",label:"Route",fn:s=>`${s.origin_country||"—"} → ${s.port_of_entry?s.port_of_entry.split(",")[0]:s.destination||"—"}`},{key:"commodity",label:"Commodity",fn:s=>s.product_type||"—"},{key:"container",label:"Container type",fn:s=>s.container_type||"—"},{key:"cargo_value",label:"Cargo value",fn:s=>b(parseFloat(s.cargo_value)),num:s=>parseFloat(s.cargo_value)||0},{key:"freight",label:"Ocean freight",fn:s=>{var o;return b((o=s.cost_breakdown)==null?void 0:o.ocean_freight)},num:s=>{var o;return((o=s.cost_breakdown)==null?void 0:o.ocean_freight)||0}},{key:"duties",label:"Duties & tariffs",fn:s=>{var o;return b((o=s.cost_breakdown)==null?void 0:o.duties)},num:s=>{var o;return((o=s.cost_breakdown)==null?void 0:o.duties)||0}},{key:"insurance",label:"Insurance",fn:s=>{var o;return b((o=s.cost_breakdown)==null?void 0:o.insurance)},num:s=>{var o;return((o=s.cost_breakdown)==null?void 0:o.insurance)||0}},{key:"last_mile",label:"Last-mile delivery",fn:s=>{var o;return b((o=s.cost_breakdown)==null?void 0:o.last_mile)}
1,num:s=>{var o;return((o=s.cost_breakdown)==null?void 0:o.last_mile)||0}},{key:"total",label:"Total landed cost",fn:s=>{var o;return b(((o=s.cost_breakdown)==null?void 0:o.total_landed_cost)??parseFloat(s.cargo_value))},num:s=>{var o;return(((o=s.cost_breakdown)==null?void 0:o.total_landed_cost)??parseFloat(s.cargo_value))||0},isTotal:!0}];function as(){const{user:s}=Ce(),o=je(),{isAdmin:p}=ve(),[u,k]=d.useState([]),[f,L]=d.useState(!0),[R,me]=d.useState(""),[y,J]=d.useState(""),[g,_e]=d.useState("newest"),[_,O]=d.useState([]),[Q,M]=d.useState(!1),[w,z]=d.useState(!1),[B,S]=d.useState(!1),[P,he]=d.useState(20),[pe,ke]=d.useState(null),[be,D]=d.useState(!1),[h,N]=d.useState([]),[E,K]=d.useState(!1),[$,X]=d.useState(!1),[A,C]=d.useState([]),[fe,ye]=d.useState(null);d.useEffect(()=>(document.title="Shipment Analyses — Landed",()=>{document.title="Landed"}),[]),d.useEffect(()=>{async function t(){try{const l=ae(G(v,"shipments"),q("userId","==",s.uid)),r=(await te(l)).docs.map(c=>({id:c.id,...c.data()}));k(r)}catch(l){console.error("Firestore getDocs failed:",l==null?void 0:l.code,l==null?void 0:l.message,l),me(`Failed to load shipments. (${(l==null?void 0:l.code)??"unknown"})`)}finally{L(!1)}}t()},[s.uid]),d.useEffect(()=>{async function t(){try{const l=await Be(se(v,"system_config","rate_monitor"));if(l.exists()){const n=l.data().lastRateChangeAt;if(n){const r=n.toDate?n.toDate():new Date(n);ye(r)}}}catch{}}t()},[]);const I=d.useMemo(()=>{const t=u.length,l=u.reduce((c,i)=>{var x;const m=((x=i.cost_breakdown)==null?void 0:x.total_landed_cost)??parseFloat(i.cargo_value)??0;return c+m},0),n=u.filter(c=>c.duty_rate!=null).map(c=>c.duty_rate),r=n.length>0?n.reduce((c,i)=>c+i,0)/n.length:null;return{total:t,totalValue:l,avgDuty:r}},[u]),T=d.useMemo(()=>{let t=[...u];if(y.trim()){const l=y.toLowerCase();t=t.filter(n=>(n.origin_country||"").toLowerCase().includes(l)||(n.port_of_entry||"").toLowerCase().includes(l)||(n.product_type||"").toLowerCase().includes(l)||(n.delivery_address||"").toLowerCase().includes(l))}return g==="newest"?t.sort((l,n)=>{var r,c,i,m;return(((c=(r=n.createdAt)==null?void 0:r.toMillis)==null?void 0:c.call(r))??0)-(((m=(i=l.createdAt)==null?void 0:i.toMillis)==null?void 0:m.call(i))??0)}):g==="value"?t.sort((l,n)=>{var i,m;const r=((i=l.cost_breakdown)==null?void 0:i.total_landed_cost)??parseFloat(l.cargo_value)??0;return(((m=n.cost_breakdown)==null?void 0:m.total_landed_cost)??parseFloat(n.cargo_value)??0)-r}):g==="country"&&t.sort((l,n)=>(l.origin_country||"").localeCompare(n.origin_country||"")),t},[u,y,g]),xe=d.useMemo(()=>T.slice(0,P),[T,P]);async function Z(){if(!w){z(!0);try{const t=ae(G(v,"shipments"),q("userId","==",s.uid),q("isDemo","==",!0)),l=await te(t);if(!l.empty){o("/shipment/"+l.docs[0].id);return}const n=await Se(G(v,"shipments"),{...qt,userId:s.uid,createdAt:le()});o("/shipment/"+n.id)}catch{}finally{z(!1)}}}async function ge(){K(!0),D(!0),C([]);const t=u.filter(l=>!l.isDemo).map(l=>{const n=Gt(l),r=[l.origin_country,l.port_of_entry].filter(Boolean).join(" → ")||`Analysis ${l.id.slice(0,6)}`;return{id:l.id,title:r,...n,selected:!n.error&&Math.abs(n.diff)>1,replacementRisk:!n.error&&re(l)}});N(t),K(!1)}async function we(){const t=h.filter(r=>r.selected);if(!t.length)return;X(!0),C([]);const l=[],n=[];for(const r of t){const{newCb:c}=r;try{await De(se(v,"shipments",r.id),{cost_breakdown:{duty:c.duty,mpf:c.mpf,hmf:c.hmf,customs_bond:c.customsBond,insurance:c.insurance,ocean_freight:c.oceanFreight,last_mile:c.drayage,section_301:c.section301,section_232:c.section232||0,section_122:c.section122||0,flip_duty:c.flipDuty||0,flip_rate:c.flipRate||0,flip_unverified:c.flipUnverified||!1,isf_fee:c.isfFee,entry_fee:c.entryFee,port_fees:c.portFees||0,total_landed_cost:c.total},duty_rate:c.dutyRate,duty_rate_source:c.dutyRateSource,recalculatedAt:le()}),n.push(r)}catch(i){l.push({id:r.id,title:r.title,message:i.message||"Update failed"})}}k(r=>r.map(c=>{const i=n.find(m=>m.id===c.id);return i?{...c,cost_breakdown:{...c.cost_breakdown||{},total_landed_cost:i.newTotal},recalculatedAt:new Date().toISOString()}:c}
1)),X(!1),C(l),l.length===0&&(D(!1),N([]))}const Ne=d.useCallback((t,l)=>{l.preventDefault(),l.stopPropagation(),O(n=>n.includes(t)?n.filter(r=>r!==t):n.length>=4?n:[...n,t])},[]),H=d.useMemo(()=>_.map(t=>u.find(l=>l.id===t)).filter(Boolean),[_,u]),F=de.find(t=>t.isTotal),ee=H.map(t=>(F==null?void 0:F.num(t))||0),W=Math.min(...ee),U=Math.max(...ee);return e.jsxs("div",{className:a.root,children:[e.jsx(Re,{}),e.jsxs("div",{className:a.content,children:[e.jsx(Te,{crumbs:[{label:"Home",to:"/dashboard"},{label:"Shipment Analyses"}]}),e.jsxs("div",{className:a.pageHeader,children:[e.jsxs("div",{children:[e.jsx("h1",{className:a.pageTitle,children:"Shipment Analyses"}),e.jsx("p",{className:a.pageSubtitle,children:"Your saved landed cost calculations"})]}),e.jsxs("div",{className:a.headerButtons,children:[p&&u.filter(t=>!t.isDemo).length>0&&e.jsx("button",{className:a.bulkRecalcBtn,onClick:ge,disabled:E,children:E?"Scanning…":"↻ Recalculate All"}),e.jsx("button",{className:a.demoButton,onClick:Z,disabled:w,children:w?"Loading…":"Load demo shipment"}),e.jsx(j,{to:"/intake",className:a.newButton,children:"+ New Shipment"})]})]}),!f&&!R&&u.length>0&&e.jsxs("div",{className:a.statsRow,children:[e.jsxs("div",{className:a.statCard,children:[e.jsx("span",{className:a.statValue,children:I.total}),e.jsx("span",{className:a.statLabel,children:"Shipments"})]}),e.jsxs("div",{className:a.statCard,children:[e.jsx("span",{className:a.statValue,children:b(I.totalValue)}),e.jsx("span",{className:a.statLabel,children:"Total cargo value analyzed"})]}),e.jsxs("div",{className:a.statCard,children:[e.jsx("span",{className:a.statValue,children:I.avgDuty!=null?(I.avgDuty*100).toFixed(1)+"%":"—"}),e.jsx("span",{className:a.statLabel,children:"Avg duty rate"})]})]}),!f&&!R&&u.length>0&&e.jsxs("div",{className:a.toolbar,children:[e.jsxs("div",{className:a.searchWrap,children:[e.jsx("span",{className:a.searchIcon,children:"⌕"}),e.jsx("input",{className:a.searchInput,type:"text",placeholder:"Search by route, commodity, or country…",value:y,onChange:t=>J(t.target.value)}),y&&e.jsx("button",{className:a.searchClear,onClick:()=>J(""),children:"×"})]}),e.jsxs("select",{className:a.sortSelect,value:g,onChange:t=>_e(t.target.value),children:[e.jsx("option",{value:"newest",children:"Newest first"}),e.jsx("option",{value:"value",children:"Highest value"}),e.jsx("option",{value:"country",children:"By country"})]})]}),f?e.jsx("div",{className:a.skeletonGrid,children:[1,2,3,4].map(t=>e.jsxs("div",{className:a.skeletonCard,children:[e.jsx("div",{className:a.skeletonLine,style:{width:20,flexShrink:0}}),e.jsx("div",{className:a.skeletonLine,style:{width:140,flexShrink:0}}),e.jsx("div",{className:a.skeletonLine,style:{flex:1}}),e.jsx("div",{className:a.skeletonLine,style:{width:70,flexShrink:0}}),e.jsx("div",{className:a.skeletonLine,style:{width:80,flexShrink:0}})]},t))}):R?e.jsx("div",{className:a.center,children:e.jsx("p",{className:a.errorMsg,children:R})}):u.length===0?e.jsxs("div",{className:a.empty,children:[e.jsx("div",{className:a.emptyIcon,children:"📦"}),e.jsx("h2",{className:a.emptyTitle,children:"No shipments yet"}),e.jsx("p",{className:a.emptyDesc,children:"Run your first landed cost analysis to see your shipments here — or load the demo to explore the full platform."}),e.jsxs("div",{className:a.emptyActions,children:[e.jsx(j,{to:"/intake",className:a.newButton,children:"Start your first analysis"}),e.jsx("button",{className:a.demoButton,onClick:Z,disabled:w,children:w?"Loading…":"Load demo shipment"})]})]}):T.length===0?e.jsx("div",{className:a.center,children:e.jsxs("p",{className:a.noResults,children:['No shipments match "',y,'"']})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:a.cardGrid,children:xe.map(t=>{var c;const l=((c=t.cost_breakdown)==null?void 0:c.total_landed_cost)??parseFloat(t.cargo_value)??0,n=Yt[t.status]||"var(--color-fog)",r=pe===t.id;return e.jsxs("div",{className:`${a.card} ${r?a.cardExpanded:""} ${_.includes(t.id)?a.cardSelected:""} ${t.isDemo?a.cardDemo:""}`,onClick:()=>ke(i=>i===t.id?null:t.id),children:[e.jsxs("div",{className:a.cardRow,children:[e.jsx("button",{className:`${a.cardCheckbox} ${_.includes(t.id)?a.cardCheckboxChecked:""}`,onClick:i=>Ne(t.id,i),"aria-label":_.includes(t.id)?"Remove from comparison":"Add to comparison",title:_.includes(t.id)?"Remove from comparison":"Add to comparison (max 4)",children:_.includes(t.id)?"✓":""}),t.isDemo&&e.jsx("span",{className:a.cardDemoBadge,children:"Demo"}),e.jsxs("div",{className:a.cardRoute,children:[e.jsx("span",{className:a.cardOrigin,children:t.origin_country||"—"}),e.jsx("span",{className:a.cardArrow,children:"→"}),e.jsx("span",{className:a.cardDest,children:t.port_of_entry?t.port_of_entry.split(",")[0]:t.destination||"—"})]}),e.jsx("span",{className:a.cardRowProduct,children:t.product_type||"Unknown goods"}),e.jsx("span",{className:a.cardStatus,style:{color:n,borderColor:n},children:t.status||"—"}),e.jsx("span",{className:a.cardRowDate,children:ie(t.createdAt)}),Vt(t,fe)&&(re(t)?e.jsx("span",{className:a.staleIndicator,title:"Section 122 expires July 24, 2026 but is widely expected to be replaced by new Section 301 tariffs, not simply removed — this analysis's total may not reflect the final rate. Recalculate after July 24 once confirmed.",children:"🟡 Section 122 rate unconfirmed"}):e.jsx("span",{className:a.staleIndicator,title:"Duty rates may have changed since this analysis was run",children:"🟡 Rates may have changed"})),e.jsx("span",{className:`${a.cardChevron} ${r?a.cardChevronOpen:""}`,children:"›"})]}),e.jsx("div",{className:`${a.cardBody} ${r?a.cardBodyOpen:""}`,children:e.jsxs("div",{className:a.cardBodyInner,children:[e.jsx("p",{className:a.cardProduct,children:t.product_type||"Unknown goods"}),e.jsx("div",{className:a.cardCost,children:b(l)}),e.jsxs("div",{className:a.cardMeta,children:[e.jsx("span",{className:a.cardMetaItem,children:t.container_type||"—"}),e.jsx("span",{className:a.cardMetaDot,children:"·"}),e.jsx("span",{className:a.cardMetaItem,children:ie(t.createdAt)}),e.jsx("span",{className:a.cardMetaDot,children:"·"}),(()=>{const i=t.accuracy_level||"estimate",m={high:"var(--color-teal)",medium:"#EAB308",limited:"#F97316",estimate:"var(--color-fog)"},x={high:"High",medium:"Medium",limited:"Low",estimate:"Est."};return e.jsxs("span",{style:{color:m[i],fontSize:"0.72rem",fontWeight:600},children:[x[i]," accuracy"]})})()]}),e.jsxs("div",{className:a.cardActions,children:[e.jsx(j,{to:`/shipment/${t.id}`,className:a.cardViewBtn,onClick:i=>i.stopPropagation(),children:"View details →"}),e.jsx("button",{className:a.cardNewTabBtn,onClick:i=>{i.stopPropagation(),window.open("/shipment/"+t.id,"_blank")},title:"Open in new tab","aria-label":"Open shipment in new tab",children:"↗"})]})]})})]},t.id)})}
1),P<T.length&&e.jsx("div",{className:a.loadMoreRow,children:e.jsx("button",{className:a.loadMoreBtn,onClick:()=>he(t=>t+20),children:"Load more shipments"})})]})]}),_.length>=1&&!Q&&e.jsxs("div",{className:a.compareBar,children:[e.jsxs("span",{className:a.compareBarCount,children:[_.length," shipment",_.length!==1?"s":""," selected",_.length<2&&" — select at least 2 to compare"]}),e.jsxs("div",{className:a.compareBarActions,children:[e.jsx("button",{className:a.compareBarCompare,onClick:()=>M(!0),disabled:_.length<2,children:"Compare →"}),e.jsx("button",{className:a.compareBarClear,onClick:()=>O([]),children:"Clear"})]})]}),B&&e.jsx("div",{className:a.fabBackdrop,onClick:()=>S(!1)}),e.jsxs("div",{className:a.fab,children:[B&&e.jsxs("div",{className:a.fabMenu,children:[e.jsxs(j,{to:"/intake",className:a.fabItem,onClick:()=>S(!1),children:[e.jsx("span",{className:a.fabItemIcon,children:"📦"}),e.jsx("span",{className:a.fabItemLabel,children:"New shipment analysis"})]}),e.jsxs(j,{to:"/intake?quick=1",className:a.fabItem,onClick:()=>S(!1),children:[e.jsx("span",{className:a.fabItemIcon,children:"⚡"}),e.jsx("span",{className:a.fabItemLabel,children:"Quick estimate"})]}),e.jsxs("button",{className:`${a.fabItem} ${a.fabItemDisabled}`,disabled:!0,children:[e.jsx("span",{className:a.fabItemIcon,children:"📄"}),e.jsxs("span",{className:a.fabItemLabel,children:["Import from document ",e.jsx("span",{className:a.fabComingSoon,children:"Soon"})]})]})]}),e.jsx("button",{className:`${a.fabBtn} ${B?a.fabBtnOpen:""}`,onClick:()=>S(t=>!t),"aria-label":"Quick actions",children:B?"✕":"+"})]}),be&&e.jsx("div",{className:a.bulkOverlay,children:e.jsxs("div",{className:a.bulkPanel,children:[e.jsxs("div",{className:a.bulkPanelHeader,children:[e.jsx("h2",{className:a.bulkPanelTitle,children:"Recalculate All Analyses"}),e.jsx("button",{className:a.bulkPanelClose,onClick:()=>{D(!1),N([]),C([])},"aria-label":"Close",children:"✕"})]}),E?e.jsx("p",{className:a.bulkScanning,children:"Scanning analyses…"}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:a.bulkSummary,children:h.length===0?"No real analyses found.":`${h.filter(t=>t.selected).length} of ${h.length} analyses have rate changes — review and select which to update.`}),h.some(t=>t.error)&&e.jsxs("p",{className:a.bulkSummary,style:{color:"var(--color-error, #dc2626)"},children:["⚠ ",h.filter(t=>t.error).length," analysis/analyses could not be checked (calculation error) — see flagged rows below. These are excluded from the count above and cannot be selected."]}),A.length>0&&e.jsxs("p",{className:a.bulkSummary,style:{color:"var(--color-error, #dc2626)"},children:["⚠ ",A.length," update",A.length===1?"":"s"," failed to save: ",A.map(t=>t.title).join(", "),". Nothing was silently skipped — try again or review manually."]}),h.some(t=>t.replacementRisk)&&e.jsx("p",{className:a.bulkSummary,style:{color:"var(--color-warning)"},children:"⚠ Section 122 (10% global tariff) expires July 24, 2026 but is widely expected to be replaced by new Section 301 tariffs rather than simply removed — USTR's final determination is still pending. Recalculating now will not yet reflect the replacement rate for the flagged analyses below."}),e.jsxs("div",{className:a.bulkList,children:[h.map(t=>{if(t.error)return e.jsxs("label",{className:a.bulkRow,style:{opacity:.75},children:[e.jsx("input",{type:"checkbox",className:a.bulkCheckbox,checked:!1,disabled:!0}),e.jsx("span",{className:a.bulkRowTitle,children:t.title}),e.jsxs("span",{className:a.bulkRowValues,style:{color:"var(--color-error, #dc2626)"},children:["⚠ Could not check: ",t.error]})]},t.id);const l=t.origTotal>0?t.diff/t.origTotal*100:0,n=t.diff>1,r=t.diff<-1,c=n?a.bulkDiffUp:r?a.bulkDiffDown:a.bulkDiffFlat,i=n?"+":"";return e.jsxs("label",{className:`${a.bulkRow} ${t.selected?a.bulkRowSelected:""}`,children:[e.jsx("input",{type:"checkbox",className:a.bulkCheckbox,checked:t.selected,onChange:m=>N(x=>x.map(V=>V.id===t.id?{...V,selected:m.target.checked}:V))}),e.jsxs("span",{className:a.bulkRowTitle,children:[t.title,t.replacementRisk&&e.jsx("span",{title:"Section 122 rate unconfirmed — expected Section 301 replacement not yet reflected",children:" 🟡"})]}),e.jsxs("span",{className:a.bulkRowValues,children:[e.jsx("span",{className:a.bulkRowOrig,children:Y(t.origTotal)}),e.jsx("span",{className:a.bulkRowArrow,children:"→"}),e.jsx("span",{className:a.bulkRowNew,children:Y(t.newTotal)})]}),e.jsx("span",{className:`${a.bulkDiff} ${c}`,children:Math.abs(t.diff)<1?"No change":`${i}${Y(t.diff)} (${i}${l.toFixed(1)}%)`})]},t.id)}),h.length===0&&e.jsx("p",{className:a.bulkEmpty,children:"All analyses are already current — no updates needed."})]}),e.jsx("p",{className:a.bulkWarning,children:"Updating will over
1write saved figures. Quotes already sent to clients should be reviewed before applying."}),e.jsxs("div",{className:a.bulkActions,children:[e.jsx("button",{className:a.bulkApplyBtn,onClick:we,disabled:$||h.filter(t=>t.selected).length===0,children:$?"Updating…":`Update ${h.filter(t=>t.selected).length} selected`}),e.jsx("button",{className:a.bulkCancelBtn,onClick:()=>{D(!1),N([]),C([])},disabled:$,children:"Cancel"})]})]})]})}),Q&&e.jsxs("div",{className:a.compareOverlay,children:[e.jsxs("div",{className:a.compareHeader,children:[e.jsx("h2",{className:a.compareTitle,children:"Shipment Comparison"}),e.jsxs("div",{className:a.compareHeaderActions,children:[e.jsx("button",{className:a.compareEditBtn,onClick:()=>M(!1),children:"← Edit selection"}),e.jsx("button",{className:a.compareCloseBtn,onClick:()=>{M(!1),O([])},children:"✕ Close"})]})]}),e.jsx("div",{className:a.compareTableWrap,children:e.jsxs("table",{className:a.compareTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:a.compareRowLabel}),H.map(t=>e.jsxs("th",{className:a.compareColHeader,children:[e.jsxs("div",{className:a.compareColRoute,children:[t.origin_country||"—"," → ",t.port_of_entry?t.port_of_entry.split(",")[0]:t.destination||"—"]}),e.jsx("div",{className:a.compareColProduct,children:t.product_type||"—"})]},t.id))]})}),e.jsx("tbody",{children:de.map(t=>e.jsxs("tr",{className:t.isTotal?a.compareTotalRow:"",children:[e.jsx("td",{className:a.compareRowLabel,children:t.label}),H.map(l=>{const n=t.num?t.num(l):null,r=t.isTotal&&n===W&&W!==U,c=t.isTotal&&n===U&&W!==U;return e.jsx("td",{className:`${a.compareCell} ${r?a.compareCellBest:""} ${c?a.compareCellWorst:""}`,children:t.fn(l)},l.id)})]},t.key))})]})})]})]})}export{as as default,Gt as recalcShipment};
2//# sourceMappingURL=ShipmentsPage-BvD32v8g.js.map

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.