1import{c as G,u as H,g as a,r as R,t as U,w as $,j as e,B as k,L as y,k as S,S as q,A as X}from"./app-mqWwS7qW.js";import{a as n,S as h}from"./scan_session-DMBsdhju.js";import{M as E,F as J}from"./index-DYEf5q8V.js";import{T as K,a as Q,b as W}from"./tabs-CHQk3xKC.js";import{T as Y,a as c}from"./toggle-group-DHemjQr7.js";import{ProductResultCard as Z}from"./product-result-card-D9ux-7-4.js";import{C as T,a as A}from"./card-BGOiKGWT.js";import{B as F}from"./badge-DPRcOU6B.js";import{R as x}from"./profitability-section-CYBQqSTZ.js";import{H as ee}from"./history-BIJQ8y-W.js";import{L as se}from"./loader-circle-BaJZwGsD.js";import{C as f}from"./circle-x-Cu4F7yA0.js";import{T as te}from"./trending-up-Bxpqr8YE.js";import{T as ae}from"./trending-down-CeXzfkVR.js";import"./MatchedProductsTable-Bk-OMCbc.js";import"./index-B2OK6Yca.js";import"./Pagination-C5Bx7Mk8.js";import"./index-BdQq_4o_.js";import"./table-BmCNivzv.js";import"./empty-DpxBc0ki.js";import"./select-BOxVSCct.js";import"./product-header-section-DgUnrEl7.js";import"./ListingRestrictionBadge-CVprWKbd.js";import"./circle-help-Bs5lVmMs.js";import"./shield-check-BX7F8lNL.js";import"./image-off-CyJJScHG.js";import"./zoom-in-C51jG0fS.js";import"./profit_calculations-D3U5QcP5.js";import"./separator-BsVZ8JuX.js";import"./truncated-badge-U3Sf3v_E.js";import"./copyable-badge-C5L2vwl-.js";import"./copy-CxuRwO66.js";import"./stat-card-CPQcFdM8.js";import"./collapsible-BLqZTBJD.js";import"./index-CR1HGKg2.js";import"./package-Clj1O6j5.js";import"./chart-no-axes-column-D3CymIo7.js";import"./input-B5T_uS3Q.js";import"./textarea-1lzBptRH.js";import"./chart-v7hq3g8t.js";import"./product-detail-drawer-DdGNHbgm.js";import"./history-chart-section-dvA3k1Ns.js";import"./keepa_history_parser-DeWbzpwW.js";import"./header-badge-DTYxvLzy.js";import"./chart-line-zTMMEYJo.js";import"./euro-kkHscRM8.js";import"./hash-CPLZAxSL.js";import"./users-bmgbpkk9.js";import"./LineChart-CiCg2EGD.js";import"./CartesianGrid-DYLEEEVn.js";import"./buybox-section-B5b5OVcD.js";import"./build_buybox_chart_data-B6ntQHxD.js";import"./seller_name_resolver-DKeLRePk.js";import"./trophy-qkqXKbva.js";import"./BarChart-DBc5QQJa.js";import"./offers-section-D4D1yZi7.js";import"./sort_offers-bqlB2E4x.js";import"./skeleton-BsiuRJaK.js";import"./shopping-cart-C9Mrqduu.js";import"./drawer-DnnIgIPX.js";import"./external-link-Ccw88bNm.js";import"./input-group-DyvIp-cr.js";import"./profit_calculator-Da-GhKsw.js";import"./calculator-jJidFwUw.js";import"./circle-alert-CjX6x-T0.js";const re=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ne=G("ArrowLeft",re);function ie(){const{scanSession:t,batchSessions:g,sellerNames:L,hasAmazonConnected:I,listingRestriction:m}=H().props,N=a.useMemo(()=>[...g].sort((s,u)=>s.marketplace.code===E.FR?-1:u.marketplace.code===E.FR?1:0),[g]),[r,M]=a.useState("all"),[D,j]=a.useState({}),[_,b]=a.useState(null),i=a.useRef(null),z=t.marketplace?.domain??"";a.useEffect(()=>{if(m&&i.current){const s=i.current;i.current=null,j(u=>({...u,[s]:m}))}},[m]);const O=a.useCallback(s=>{b(s),i.current=s,R.reload({only:["listingRestriction"],data:{checkRestrictionAsin:s},onFinish:()=>b(null),onError:()=>{U.error("Erreur lors de la vérification",{description:"Impossible de vérifier les restrictions de vente. Veuillez réessayer."}),i.current=null}})},[]),d=t.status===n.PENDING||t.status===n.PROCESSING,V=t.status===n.FAILED,{start:v,stop:C}=$(3e3,{only:["scanSession"]},{autoStart:!1});a.useEffect(()=>{d?v():C()},[d,v,C]);const l=t.scannedProducts.filter(s=>s.status==="found").length,o=t.scannedProducts.filter(s=>s.status==="not_found").length,w=a.useMemo(()=>t.scannedProducts.filter(s=>r==="all"?!0:r==="not_found"?s.status===h.NOT_FOUND:s.status!==h.FOUND?!1:r==="profitable"?s.metrics&&s.metrics.roi>=x:r==="not_profitable"?!s.metrics||s.metrics.roi<x:!0),[t.scannedProducts,r]),p=a.useMemo(()=>t.scannedProducts.filter(s=>s.status!==h.FOUND||!s.metrics?!1:s.metrics.roi>=x).length,[t.scannedProducts]),P=l-p,B=a.useMemo(()=>({purchaseVatRate:t.purchaseVatRate,saleVatRate:t.marketplace?.vatRate??20,isMicroEntreprise:t.isMicroEntreprise}),[t.purchaseVatRate,t.marketplace?.vatRate,t.isMicroEntreprise]);return e.jsxs("main",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(k,{variant:"ghost",size:"icon",className:"shrink-0",asChild:!0,children:e.jsx(y,{href:"/app/scanner",children:e.jsx(ne,{className:"h-5 w-5"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-lg font-bold",children:"Résultats de l'analyse"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Rentabilité et métriques de vos produits scannés"})]})]}
1),e.jsx(k,{size:"sm",className:"w-full gap-2 sm:w-auto sm:shrink-0",asChild:!0,children:e.jsxs(y,{href:"/app/scanner/history",children:[e.jsx(ee,{className:"h-4 w-4"}),"Historique"]})})]}),N.length>1&&e.jsx(K,{value:t.id,onValueChange:s=>{j({}),R.get(`/app/scanner/${s}`,{},{preserveState:!0})},className:"w-full",children:e.jsx(Q,{className:"w-full",children:N.map(s=>e.jsxs(W,{value:s.id,className:"flex flex-1 items-center justify-center gap-2","aria-label":`Marketplace ${s.marketplace.name}`,children:[e.jsxs("span",{className:"relative overflow-hidden rounded-sm",children:[e.jsx(J,{countryCode:s.marketplace.code}),s.status===n.PROCESSING||s.status===n.PENDING?e.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-2 w-2 animate-pulse rounded-full bg-orange-500"}):s.status===n.FAILED?e.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-red-500"}):null]}),e.jsx("span",{className:"hidden sm:inline",children:s.marketplace.name.replace("Amazon ","")}),e.jsx("span",{className:"sm:hidden",children:s.marketplace.countryCode})]},s.id))})}),d?e.jsx(T,{children:e.jsxs(A,{className:"flex flex-col items-center gap-4 py-8",children:[e.jsx(se,{className:"h-10 w-10 animate-spin text-orange-600"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium",children:"Analyse en cours..."}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[l+o," / ",t.scannedProducts.length," produits traités"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[l>0&&e.jsxs(F,{variant:"default",className:"gap-1",children:[e.jsx(S,{className:"h-3 w-3"}),l," trouvés"]}),o>0&&e.jsxs(F,{variant:"secondary",className:"gap-1",children:[e.jsx(f,{className:"h-3 w-3"}),o," non trouvés"]})]})]})}):V?e.jsx(T,{className:"border-red-200 bg-red-50",children:e.jsxs(A,{className:"flex flex-col items-center gap-4 py-8",children:[e.jsx(f,{className:"h-10 w-10 text-red-600"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium text-red-800",children:"Ãchec de l'analyse"}),e.jsx("p",{className:"text-sm text-red-600",children:"Une erreur est survenue pendant le traitement"})]})]})}):e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(Y,{type:"single",value:r,onValueChange:s=>s&&M(s),className:"grid flex-1 grid-cols-4 gap-2",children:[e.jsxs(c,{value:"all","aria-label":`Tous les produits (${t.scannedProducts.length})`,className:"h-10 gap-1.5 rounded-lg bg-secondary text-sm text-secondary-foreground data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:[e.jsx(S,{className:"h-4 w-4"}),t.scannedProducts.length]}),e.jsxs(c,{value:"profitable","aria-label":`Produits rentables (${p})`,className:"h-10 gap-1.5 rounded-lg bg-green-100 text-sm text-green-700 data-[state=on]:bg-green-600 data-[state=on]:text-white",children:[e.jsx(te,{className:"h-4 w-4"}),p]}),e.jsxs(c,{value:"not_profitable","aria-label":`Produits non rentables (${P})`,className:"h-10 gap-1.5 rounded-lg bg-red-100 text-sm text-red-700 data-[state=on]:bg-red-600 data-[state=on]:text-white",children:[e.jsx(ae,{className:"h-4 w-4"}),P]}),e.jsxs(c,{value:"not_found","aria-label":`Produits non trouvés (${o})`,className:"h-10 gap-1.5 rounded-lg bg-amber-100 text-sm text-amber-700 data-[state=on]:bg-amber-600 data-[state=on]:text-white",children:[e.jsx(f,{className:"h-4 w-4"}),o]})]})}),w.length>0?e.jsx("div",{className:"space-y-2",children:w.map(s=>e.jsx(Z,{product:s,vatContext:B,sellerNames:L,hasAmazonConnected:I,marketplaceDomain:z,listingRestriction:s.amazonProduct?.asin?D[s.amazonProduct.asin]:void 0,isCheckingRestriction:s.amazonProduct?.asin===_,onCheckRestriction:O},s.id))}):t.scannedProducts.length>0?e.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground",children:[e.jsx(q,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm",children:"Aucun produit pour ce filtre"})]}):null]})}ie.layout=t=>e.jsx(X,{children:t});export{ie as default};
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.