bitsnap-react 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/CartProvider-QY2DMNCC.js +2 -0
  2. package/dist/{CartProvider-Q3CIVK5K.js.map → CartProvider-QY2DMNCC.js.map} +1 -1
  3. package/dist/CartProvider-XMHPQRWC.mjs +2 -0
  4. package/dist/analytics.js +1 -1
  5. package/dist/analytics.mjs +1 -1
  6. package/dist/catalog.js +1 -1
  7. package/dist/catalog.mjs +1 -1
  8. package/dist/{chunk-HG4YOJWE.mjs → chunk-2PK36NGB.mjs} +2 -2
  9. package/dist/{chunk-GPNALARZ.mjs → chunk-2X32DDUM.mjs} +2 -2
  10. package/dist/{chunk-VQQBBSK2.js → chunk-3IVLQILF.js} +2 -2
  11. package/dist/{chunk-VQQBBSK2.js.map → chunk-3IVLQILF.js.map} +1 -1
  12. package/dist/{chunk-C5Q7DGCD.mjs → chunk-DWRBPP32.mjs} +2 -2
  13. package/dist/{chunk-C5RMHUOG.mjs → chunk-ETGHIHWR.mjs} +2 -2
  14. package/dist/{chunk-CUQ2PNCJ.js → chunk-FBTYZHXM.js} +3 -3
  15. package/dist/{chunk-CUQ2PNCJ.js.map → chunk-FBTYZHXM.js.map} +1 -1
  16. package/dist/{chunk-EZWH6BB2.mjs → chunk-G2UOTVS5.mjs} +2 -2
  17. package/dist/{chunk-H3YP2QPV.mjs → chunk-HWQNT6XU.mjs} +2 -2
  18. package/dist/{chunk-T57337WD.mjs → chunk-IJLHU2MA.mjs} +2 -2
  19. package/dist/{chunk-T57337WD.mjs.map → chunk-IJLHU2MA.mjs.map} +1 -1
  20. package/dist/{chunk-XQ43IC4M.mjs → chunk-JUDR4EZA.mjs} +2 -2
  21. package/dist/{chunk-7RGH57QG.js → chunk-Q25D7OAO.js} +2 -2
  22. package/dist/{chunk-7RGH57QG.js.map → chunk-Q25D7OAO.js.map} +1 -1
  23. package/dist/{chunk-YFETPEI6.js → chunk-UCL4Y7L3.js} +2 -2
  24. package/dist/{chunk-YFETPEI6.js.map → chunk-UCL4Y7L3.js.map} +1 -1
  25. package/dist/{chunk-ASNUY3EU.js → chunk-UFIOJGJZ.js} +2 -2
  26. package/dist/{chunk-ASNUY3EU.js.map → chunk-UFIOJGJZ.js.map} +1 -1
  27. package/dist/{chunk-ELGNOAH4.js → chunk-VPBFEAFQ.js} +2 -2
  28. package/dist/{chunk-ELGNOAH4.js.map → chunk-VPBFEAFQ.js.map} +1 -1
  29. package/dist/{chunk-GT3OH55Y.js → chunk-WGJTXDIS.js} +2 -2
  30. package/dist/{chunk-GT3OH55Y.js.map → chunk-WGJTXDIS.js.map} +1 -1
  31. package/dist/{chunk-PUYK4YHE.js → chunk-YBGAYEJQ.js} +2 -2
  32. package/dist/{chunk-PUYK4YHE.js.map → chunk-YBGAYEJQ.js.map} +1 -1
  33. package/dist/consent.js +15 -14
  34. package/dist/consent.js.map +1 -1
  35. package/dist/consent.mjs +15 -14
  36. package/dist/consent.mjs.map +1 -1
  37. package/dist/course.js +1 -1
  38. package/dist/course.mjs +1 -1
  39. package/dist/embed/analytics.js +1 -1
  40. package/dist/embed/consent.js +11 -10
  41. package/dist/index.js +1 -1
  42. package/dist/index.mjs +1 -1
  43. package/dist/methods-ALO22YWQ.mjs +2 -0
  44. package/dist/methods-ZBX4BTDE.js +2 -0
  45. package/dist/{methods-CHNMFVFV.js.map → methods-ZBX4BTDE.js.map} +1 -1
  46. package/dist/returns.js +1 -1
  47. package/dist/returns.mjs +1 -1
  48. package/package.json +1 -1
  49. package/dist/CartProvider-ONIOELW5.mjs +0 -2
  50. package/dist/CartProvider-Q3CIVK5K.js +0 -2
  51. package/dist/methods-C5HWYPPN.mjs +0 -2
  52. package/dist/methods-CHNMFVFV.js +0 -2
  53. /package/dist/{CartProvider-ONIOELW5.mjs.map → CartProvider-XMHPQRWC.mjs.map} +0 -0
  54. /package/dist/{chunk-HG4YOJWE.mjs.map → chunk-2PK36NGB.mjs.map} +0 -0
  55. /package/dist/{chunk-GPNALARZ.mjs.map → chunk-2X32DDUM.mjs.map} +0 -0
  56. /package/dist/{chunk-C5Q7DGCD.mjs.map → chunk-DWRBPP32.mjs.map} +0 -0
  57. /package/dist/{chunk-C5RMHUOG.mjs.map → chunk-ETGHIHWR.mjs.map} +0 -0
  58. /package/dist/{chunk-EZWH6BB2.mjs.map → chunk-G2UOTVS5.mjs.map} +0 -0
  59. /package/dist/{chunk-H3YP2QPV.mjs.map → chunk-HWQNT6XU.mjs.map} +0 -0
  60. /package/dist/{chunk-XQ43IC4M.mjs.map → chunk-JUDR4EZA.mjs.map} +0 -0
  61. /package/dist/{methods-C5HWYPPN.mjs.map → methods-ALO22YWQ.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkKOYBZORLjs = require('./chunk-KOYBZORL.js');var _chunkASNUY3EUjs = require('./chunk-ASNUY3EU.js');var _chunk7RGH57QGjs = require('./chunk-7RGH57QG.js');var _chunkGT3OH55Yjs = require('./chunk-GT3OH55Y.js');var vr=["root","header","title","description","backButton","stepIndicator","error","emptyState","skeleton","emailForm","emailInput","codeForm","codeInput","resendButton","logoutButton","orderList","orderCard","orderReference","orderDate","orderTotal","pagination","lineList","line","lineName","linePrice","lineQuantityControl","quantityButton","quantityInput","lineIneligibleReason","noteInput","summary","submitButton","secondaryButton","successState","returnReference","returnInstructions","returnList","returnCard","statusBadge","history","historyEntry"],zt={fontFamily:"--bitsnap-returns-font-family",fontSize:"--bitsnap-returns-font-size",background:"--bitsnap-returns-background",surface:"--bitsnap-returns-surface",foreground:"--bitsnap-returns-foreground",mutedForeground:"--bitsnap-returns-muted-foreground",border:"--bitsnap-returns-border",buttonBackground:"--bitsnap-returns-button-background",buttonForeground:"--bitsnap-returns-button-foreground",buttonHoverBackground:"--bitsnap-returns-button-hover-background",hoverSurface:"--bitsnap-returns-hover-surface",focusRing:"--bitsnap-returns-focus-ring",error:"--bitsnap-returns-error",success:"--bitsnap-returns-success",warning:"--bitsnap-returns-warning",badgeBackground:"--bitsnap-returns-badge-background",badgeForeground:"--bitsnap-returns-badge-foreground",inputBackground:"--bitsnap-returns-input-background",radius:"--bitsnap-returns-radius"},Dt={light:{background:"#ffffff",surface:"#f9fafb",foreground:"#18181b",mutedForeground:"#71717a",border:"#e4e4e7",buttonBackground:"#18181b",buttonForeground:"#fafafa",buttonHoverBackground:"#000000",hoverSurface:"#f4f4f5",focusRing:"#71717a",error:"#dc2626",success:"#16a34a",warning:"#d97706",badgeBackground:"#f4f4f5",badgeForeground:"#3f3f46",inputBackground:"#ffffff",radius:"8px"},dark:{background:"#18181b",surface:"#27272a",foreground:"#fafafa",mutedForeground:"#a1a1aa",border:"#3f3f46",buttonBackground:"#fafafa",buttonForeground:"#18181b",buttonHoverBackground:"#e4e4e7",hoverSurface:"#3f3f46",focusRing:"#a1a1aa",error:"#f87171",success:"#4ade80",warning:"#fbbf24",badgeBackground:"#3f3f46",badgeForeground:"#e4e4e7",inputBackground:"#27272a",radius:"8px"}},Ot=[{token:"background",variable:"--background"},{token:"foreground",variable:"--foreground"},{token:"surface",variable:"--card"},{token:"foreground",variable:"--card-foreground"},{token:"surface",variable:"--popover"},{token:"foreground",variable:"--popover-foreground"},{token:"buttonBackground",variable:"--primary"},{token:"buttonForeground",variable:"--primary-foreground"},{token:"surface",variable:"--secondary"},{token:"foreground",variable:"--secondary-foreground"},{token:"hoverSurface",variable:"--accent"},{token:"foreground",variable:"--accent-foreground"},{token:"mutedForeground",variable:"--muted-foreground"},{token:"border",variable:"--border"},{token:"border",variable:"--input"},{token:"focusRing",variable:"--ring"},{token:"error",variable:"--destructive"},{token:"radius",variable:"--radius"}];function ve(e){let r=_chunkKOYBZORLjs.a.call(void 0, e,{defaultTheme:"light",presets:Dt,variables:zt,shadcnVariables:Ot});return{theme:r.theme,tokens:r.tokens,elements:r.elements,boundaryClassName:r.theme,boundaryStyle:r.boundaryStyle}}function tt(e,r){return _chunkKOYBZORLjs.b.call(void 0, e.elements,r)}var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var rt=_react.createContext.call(void 0, ve());function nt({appearance:e,children:r}){let t=_react.useMemo.call(void 0, ()=>ve(e),[e]);return _jsxruntime.jsx.call(void 0, rt.Provider,{value:t,children:r})}function Ne(){return _react.useContext.call(void 0, rt)}function l(e){let r=Ne();return _nullishCoalesce(tt(r,e), () => ({}))}function ot(e){return e==="test"||e===1?1:0}var st={title:["emailStepTitle"],email:["emailLabel"],sendCode:["emailSubmit"],code:["codeLabel"],verify:["codeSubmit"],orders:["ordersTitle"],submit:["confirmationSubmit"],note:["noteLabel"],history:["myReturnsTitle","myReturnsLink"]};function at(e){if(e==null)return;let r={};for(let[t,n]of Object.entries(st)){let o=e[t];if(typeof o=="string")for(let u of n)r[u]=o}for(let t of Object.keys(e)){if(t in st)continue;let n=e[t];typeof n=="string"&&(r[t]=n)}return r}function it(e,r){let t=_optionalChain([r, 'optionalAccess', _2 => _2.brandColor, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]);return t==null||t===""?e:{...e,tokens:{..._chunkASNUY3EUjs.t.call(void 0, t),..._optionalChain([e, 'optionalAccess', _5 => _5.tokens])}}}function he(e,r){return typeof e=="object"&&e!=null?{pageSize:_nullishCoalesce(e.pageSize, () => (20)),explicitPageToken:void 0}:typeof e=="number"||r!==void 0?{pageSize:_nullishCoalesce(e, () => (20)),explicitPageToken:_nullishCoalesce(r, () => (""))}:{pageSize:20,explicitPageToken:void 0}}var _t={en:{back:"Back",stepIndicator:"Step {current} of {total}",loading:"Loading",myReturnsLink:"My returns",emailStepTitle:"Return a product",emailStepDescription:"Enter the email address you used for the order. We will send you a verification code.",emailLabel:"Email address",emailPlaceholder:"name@example.com",emailSubmit:"Send code",codeStepTitle:"Enter the code",codeStepDescription:"We sent a verification code to {email}.",codeLabel:"Verification code",codeSubmit:"Verify",resend:"Send the code again",resendIn:"Send again in {seconds} s",logout:"Sign out",ordersTitle:"Your orders",ordersDescription:"Choose the order that contains the product to return.",ordersEmpty:"There are no orders eligible for return.",orderTitle:"Order {reference}",orderReturnableLines:"Products available to return: {count}",orderSelect:"Choose",paginationPrevious:"Previous",paginationNext:"Next",paginationInfo:"Page {page}, {total} orders",orderDetailTitle:"Order {reference}",orderDetailDescription:"Select the products and quantities to return.",quantityLabel:"Quantity to return: {name}",quantityDecrease:"Decrease quantity: {name}",quantityIncrease:"Increase quantity: {name}",quantityOfAvailable:"of {available}",lineIneligibleFallback:"This product cannot be returned.",noteLabel:"Note (optional)",notePlaceholder:"Tell us why you are returning the product",selectionContinue:"Continue",selectionEmpty:"Select at least one item to return.",previousReturnsTitle:"Earlier returns for this order",confirmationTitle:"Confirm the return",confirmationDescription:"Check the products before you submit the request.",confirmationSummary:"Products to return",confirmationQuantity:"Quantity: {quantity}",confirmationNote:"Your note",confirmationSubmit:"Submit return request",successTitle:"Return request submitted",successDescription:"We received your request and will keep you posted.",successReference:"Request number",successInstructions:"What to do next",successDone:"Back to orders",myReturnsTitle:"My returns",myReturnsDescription:"Track the status of your return requests.",myReturnsEmpty:"You have not submitted any return requests yet.",myReturnOpen:"Details",myReturnDetailTitle:"Return details",myReturnTitle:"Return {reference}",myReturnCreatedAt:"Submitted",myReturnRefund:"Refund",myReturnLines:"Products",myReturnLineQuantities:"Requested: {requested}, approved: {approved}, received: {received}",myReturnNote:"Your note",myReturnHistory:"History",statusSubmitted:"Submitted",statusApproved:"Approved",statusRejected:"Rejected",statusAwaitingReceipt:"Awaiting the package",statusReceived:"Package received",statusCompleted:"Completed",statusCancelled:"Cancelled",statusRefunded:"Refunded",statusFallback:"In progress",refundStatusNotStarted:"Not started",refundStatusPending:"Refund in progress",refundStatusSucceeded:"Refunded",refundStatusFailed:"Refund failed",refundStatusFallback:"Unknown",errorGeneric:"Something went wrong. Please try again.",errorInvalidEmail:"Enter a valid email address.",errorInvalidCode:"The code is invalid or has expired.",errorSessionExpired:"Your session has expired. Verify your email again.",errorOrderNotFound:"We could not find this order.",errorReturnNotFound:"We could not find this return request.",errorQuantityUnavailable:"The selected quantity is no longer available for return.",errorItemNotReturnable:"One of the selected products cannot be returned.",errorReturnsDisabled:"Returns are not available in this shop.",errorRateLimited:"Too many attempts. Please try again later.",errorIdempotencyConflict:"This request was already submitted with different contents. Reload and try again.",errorDeliveryFailed:"We could not send the code. Please try again.",errorRetry:"Try again"},pl:{back:"Wstecz",stepIndicator:"Krok {current} z {total}",loading:"\u0141adowanie",myReturnsLink:"Moje zwroty",emailStepTitle:"Zwr\xF3\u0107 produkt",emailStepDescription:"Podaj adres e-mail u\u017Cyty w zam\xF3wieniu. Wy\u015Blemy na niego kod weryfikacyjny.",emailLabel:"Adres e-mail",emailPlaceholder:"jan@example.com",emailSubmit:"Wy\u015Blij kod",codeStepTitle:"Wpisz kod",codeStepDescription:"Wys\u0142ali\u015Bmy kod weryfikacyjny na adres {email}.",codeLabel:"Kod weryfikacyjny",codeSubmit:"Zweryfikuj",resend:"Wy\u015Blij kod ponownie",resendIn:"Wy\u015Blij ponownie za {seconds} s",logout:"Wyloguj si\u0119",ordersTitle:"Twoje zam\xF3wienia",ordersDescription:"Wybierz zam\xF3wienie z produktem do zwrotu.",ordersEmpty:"Brak zam\xF3wie\u0144, kt\xF3re mo\u017Cna zwr\xF3ci\u0107.",orderTitle:"Zam\xF3wienie {reference}",orderReturnableLines:"Produkty do zwrotu: {count}",orderSelect:"Wybierz",paginationPrevious:"Poprzednia",paginationNext:"Nast\u0119pna",paginationInfo:"Strona {page}, zam\xF3wie\u0144: {total}",orderDetailTitle:"Zam\xF3wienie {reference}",orderDetailDescription:"Wybierz produkty i ilo\u015Bci do zwrotu.",quantityLabel:"Ilo\u015B\u0107 do zwrotu: {name}",quantityDecrease:"Zmniejsz ilo\u015B\u0107: {name}",quantityIncrease:"Zwi\u0119ksz ilo\u015B\u0107: {name}",quantityOfAvailable:"z {available}",lineIneligibleFallback:"Ten produkt nie podlega zwrotowi.",noteLabel:"Uwagi (opcjonalnie)",notePlaceholder:"Napisz, dlaczego zwracasz produkt",selectionContinue:"Dalej",selectionEmpty:"Wybierz co najmniej jedn\u0105 sztuk\u0119 do zwrotu.",previousReturnsTitle:"Wcze\u015Bniejsze zwroty tego zam\xF3wienia",confirmationTitle:"Potwierd\u017A zwrot",confirmationDescription:"Sprawd\u017A produkty przed wys\u0142aniem zg\u0142oszenia.",confirmationSummary:"Produkty do zwrotu",confirmationQuantity:"Ilo\u015B\u0107: {quantity}",confirmationNote:"Twoje uwagi",confirmationSubmit:"Wy\u015Blij zg\u0142oszenie zwrotu",successTitle:"Zg\u0142oszenie zwrotu zosta\u0142o wys\u0142ane",successDescription:"Otrzymali\u015Bmy zg\u0142oszenie i b\u0119dziemy informowa\u0107 o jego statusie.",successReference:"Numer zg\u0142oszenia",successInstructions:"Co dalej",successDone:"Wr\xF3\u0107 do zam\xF3wie\u0144",myReturnsTitle:"Moje zwroty",myReturnsDescription:"Sprawd\u017A status swoich zg\u0142osze\u0144 zwrotu.",myReturnsEmpty:"Nie masz jeszcze \u017Cadnych zg\u0142osze\u0144 zwrotu.",myReturnOpen:"Szczeg\xF3\u0142y",myReturnDetailTitle:"Szczeg\xF3\u0142y zwrotu",myReturnTitle:"Zwrot {reference}",myReturnCreatedAt:"Zg\u0142oszono",myReturnRefund:"Zwrot \u015Brodk\xF3w",myReturnLines:"Produkty",myReturnLineQuantities:"Zg\u0142oszono: {requested}, zaakceptowano: {approved}, odebrano: {received}",myReturnNote:"Twoje uwagi",myReturnHistory:"Historia",statusSubmitted:"Zg\u0142oszony",statusApproved:"Zaakceptowany",statusRejected:"Odrzucony",statusAwaitingReceipt:"Oczekiwanie na paczk\u0119",statusReceived:"Paczka odebrana",statusCompleted:"Zako\u0144czony",statusCancelled:"Anulowany",statusRefunded:"\u015Arodki zwr\xF3cone",statusFallback:"W trakcie",refundStatusNotStarted:"Nie rozpocz\u0119to",refundStatusPending:"Zwrot \u015Brodk\xF3w w toku",refundStatusSucceeded:"\u015Arodki zwr\xF3cone",refundStatusFailed:"Zwrot \u015Brodk\xF3w nie powi\xF3d\u0142 si\u0119",refundStatusFallback:"Nieznany",errorGeneric:"Co\u015B posz\u0142o nie tak. Spr\xF3buj ponownie.",errorInvalidEmail:"Podaj poprawny adres e-mail.",errorInvalidCode:"Kod jest nieprawid\u0142owy lub wygas\u0142.",errorSessionExpired:"Sesja wygas\u0142a. Zweryfikuj adres e-mail ponownie.",errorOrderNotFound:"Nie znaleziono tego zam\xF3wienia.",errorReturnNotFound:"Nie znaleziono tego zg\u0142oszenia zwrotu.",errorQuantityUnavailable:"Wybrana ilo\u015B\u0107 nie jest ju\u017C dost\u0119pna do zwrotu.",errorItemNotReturnable:"Jeden z wybranych produkt\xF3w nie podlega zwrotowi.",errorReturnsDisabled:"Zwroty nie s\u0105 dost\u0119pne w tym sklepie.",errorRateLimited:"Zbyt wiele pr\xF3b. Spr\xF3buj ponownie p\xF3\u017Aniej.",errorIdempotencyConflict:"To zg\u0142oszenie zosta\u0142o ju\u017C wys\u0142ane z inn\u0105 zawarto\u015Bci\u0105. Od\u015Bwie\u017C stron\u0119 i spr\xF3buj ponownie.",errorDeliveryFailed:"Nie uda\u0142o si\u0119 wys\u0142a\u0107 kodu. Spr\xF3buj ponownie.",errorRetry:"Spr\xF3buj ponownie"}};function ke(e,r){return _chunk7RGH57QGjs.i.call(void 0, _t,e,r)}function ut(e,r){return e.replace(/\{(\w+)\}/g,(t,n)=>Object.prototype.hasOwnProperty.call(r,n)?String(r[n]):t)}var jt={submitted:"statusSubmitted",approved:"statusApproved",rejected:"statusRejected",awaiting_receipt:"statusAwaitingReceipt",received:"statusReceived",completed:"statusCompleted",cancelled:"statusCancelled",refunded:"statusRefunded"},Ut={not_started:"refundStatusNotStarted",pending:"refundStatusPending",succeeded:"refundStatusSucceeded",failed:"refundStatusFailed"};function lt(e){return _nullishCoalesce(jt[e], () => ("statusFallback"))}function ct(e){return _nullishCoalesce(Ut[e], () => ("refundStatusFallback"))}var Te=_react.createContext.call(void 0, {locale:"pl-PL",texts:ke("pl-PL")});function pt({texts:e,locale:r,children:t}){let n=_nullishCoalesce(r, () => (_chunk7RGH57QGjs.m.call(void 0, ))),o=_react.useMemo.call(void 0, ()=>({locale:n,texts:ke(n,e)}),[n,e]);return _jsxruntime.jsx.call(void 0, Te.Provider,{value:o,children:t})}function h(){let{texts:e}=_react.useContext.call(void 0, Te);return _react.useCallback.call(void 0, (r,t)=>t==null?e[r]:ut(e[r],t),[e])}function Y(){return _react.useContext.call(void 0, Te).locale}var _connect = require('@connectrpc/connect');var _connectquery = require('@connectrpc/connect-query');var _reactquery = require('@tanstack/react-query');var _wkt = require('@bufbuild/protobuf/wkt');var Zt="bitsnap-returns-session:";function we(e){return`${Zt}${e}`}function oe(){try{return typeof window<"u"?window.sessionStorage:void 0}catch (e2){return}}function mt(e,r,t=Date.now()){if(e==null)return;let n=we(r);try{let o=e.getItem(n);if(o==null)return;let u=JSON.parse(o);if(u!=null&&typeof u=="object"&&typeof u.token=="string"&&u.token.length>0&&typeof u.expiresAt=="number"&&u.expiresAt>t){let{token:s,expiresAt:a}=u;return{token:s,expiresAt:a}}e.removeItem(n)}catch (e3){try{e.removeItem(n)}catch (e4){}}}function yt(e,r,t){try{_optionalChain([e, 'optionalAccess', _6 => _6.setItem, 'call', _7 => _7(we(r),JSON.stringify(t))])}catch (e5){}}function Ie(e,r){try{_optionalChain([e, 'optionalAccess', _8 => _8.removeItem, 'call', _9 => _9(we(r))])}catch (e6){}}function ae(e){return e==null?void 0:_wkt.timestampMs.call(void 0, e)}var Rt=_react.createContext.call(void 0, void 0);function T(e){let r=_react.useContext.call(void 0, Rt);if(r==null)throw new Error(`${e} must be rendered inside <ReturnsProvider>`);return r}function Ce(){return _connectquery.createConnectQueryKey.call(void 0, {schema:_chunkASNUY3EUjs.i,cardinality:void 0})}var or=2**31-1;function ar({projectID:e,environment:r,transport:t,panelAccessToken:n,className:o,children:u}){let s=_reactquery.useQueryClient.call(void 0, ),{boundaryClassName:a,boundaryStyle:y}=Ne(),m=l("root"),[p,f]=_react.useState.call(void 0, {status:"hydrating"}),[c,b]=_react.useState.call(void 0, ),[g,C]=_react.useState.call(void 0, ),I=_react.useRef.call(void 0, void 0),N=_react.useCallback.call(void 0, ()=>{s.removeQueries({queryKey:Ce()})},[s]),B=_react.useCallback.call(void 0, ()=>{Ie(oe(),e),C(void 0),f({status:"anonymous"}),N()},[e,N]),w=_react.useCallback.call(void 0, k=>{yt(oe(),e,k),b(void 0),C(void 0),f({status:"authenticated",token:k.token,expiresAt:k.expiresAt})},[e]);_react.useEffect.call(void 0, ()=>{let k=!1,Q=oe();if(n==null||n===""){let O=I.current!=null;if(I.current=void 0,O){B();return}let q=mt(Q,e);f(q!=null?{status:"authenticated",token:q.token,expiresAt:q.expiresAt}:{status:"anonymous"});return}return I.current=n,Ie(Q,e),N(),b(void 0),f({status:"exchanging"}),_connect.createClient.call(void 0, _chunkASNUY3EUjs.i,t).exchangePanelSession({projectId:e,accessToken:n,environment:r}).then(O=>{if(k)return;let q=ae(O.expiresAt);if(O.sessionToken===""||q==null)throw new Error("EMPTY_SESSION");w({token:O.sessionToken,expiresAt:q})}).catch(O=>{k||(b(O),f({status:"anonymous"}))}),()=>{k=!0}},[n,e,r,t]),_react.useEffect.call(void 0, ()=>{if(p.status!=="authenticated"||p.expiresAt==null)return;let k=p.expiresAt-Date.now();if(k<=0){B();return}let Q=setTimeout(B,Math.min(k,or));return()=>clearTimeout(Q)},[p.status,p.expiresAt,B]);let P=_react.useMemo.call(void 0, ()=>({projectID:e,environment:r,status:p.status,token:p.token,exchangeError:c,challenge:g,setChallenge:C,authenticate:w,clearSession:B}),[e,r,p.status,p.token,c,g,w,B]);return _jsxruntime.jsx.call(void 0, Rt.Provider,{value:P,children:_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-returns":"root","data-bitsnap-returns-slot":"root",className:_chunk7RGH57QGjs.d.call(void 0, "bitsnap-react",a,o,m.className),style:{...y,...m.style},children:u})})}function ir({projectID:e,host:r,environment:t,appearance:n,texts:o,theme:u,locale:s,panelAccessToken:a,className:y,analytics:m,children:p}){let f=_chunkGT3OH55Yjs.n.call(void 0, e,m,"returns"),c=_react.useContext.call(void 0, _reactquery.QueryClientContext),[b]=_react.useState.call(void 0, ()=>c==null?new (0, _reactquery.QueryClient)({defaultOptions:{queries:{staleTime:5e3}}}):void 0),g=_nullishCoalesce(r, () => (_chunkASNUY3EUjs.m.call(void 0, ))),C=_react.useMemo.call(void 0, ()=>_chunkASNUY3EUjs.n.call(void 0, g),[g]),I=_optionalChain([u, 'optionalAccess', _10 => _10.brandColor]),N=_react.useMemo.call(void 0, ()=>it(n,{brandColor:I}),[n,I]),B=_react.useMemo.call(void 0, ()=>at(o),[o]),w=_jsxruntime.jsx.call(void 0, _chunkGT3OH55Yjs.l,{value:f,children:_jsxruntime.jsx.call(void 0, _connectquery.TransportProvider,{transport:C,children:_jsxruntime.jsx.call(void 0, nt,{appearance:N,children:_jsxruntime.jsx.call(void 0, pt,{texts:B,locale:s,children:_jsxruntime.jsx.call(void 0, ar,{projectID:e,environment:ot(t),transport:C,panelAccessToken:a,className:y,children:p})})})})});return c==null&&b!=null?_jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider,{client:b,children:w}):w}var Xr=ir;var ur="SESSION_EXPIRED",bt={INVALID_EMAIL:"errorInvalidEmail",INVALID_OR_EXPIRED_CODE:"errorInvalidCode",SESSION_EXPIRED:"errorSessionExpired",ORDER_NOT_FOUND:"errorOrderNotFound",RETURN_NOT_FOUND:"errorReturnNotFound",QUANTITY_UNAVAILABLE:"errorQuantityUnavailable",ITEM_NOT_RETURNABLE:"errorItemNotReturnable",INVALID_RETURN_ITEMS:"errorItemNotReturnable",RETURNS_DISABLED:"errorReturnsDisabled",SUBMISSION_RATE_LIMITED:"errorRateLimited",IDEMPOTENCY_CONFLICT:"errorIdempotencyConflict",VERIFICATION_DELIVERY_FAILED:"errorDeliveryFailed"};function xt(e){if(e==null||typeof e!="object")return;let{rawMessage:r,message:t}=e;if(typeof r=="string"&&r.length>0)return r;if(typeof t=="string")return Object.keys(bt).find(n=>t.includes(n))}function Pe(e){return xt(e)===ur}function St(e){let r=xt(e);return_nullishCoalesce((r!=null?bt[r]:void 0), () => ("errorGeneric"))}function Le(){let e=typeof globalThis<"u"?globalThis.crypto:void 0;if(typeof _optionalChain([e, 'optionalAccess', _11 => _11.randomUUID])=="function")return e.randomUUID();let r=new Uint8Array(16);if(typeof _optionalChain([e, 'optionalAccess', _12 => _12.getRandomValues])=="function")e.getRandomValues(r);else for(let t=0;t<r.length;t++)r[t]=Math.floor(Math.random()*256);return Array.from(r,t=>t.toString(16).padStart(2,"0")).join("")}function $(e){return e==null?null:e instanceof Error?e:new Error(String(e))}function X(e){return e==null?void 0:St(e)}function ce(e,r){_react.useEffect.call(void 0, ()=>{Pe(e)&&r()},[e,r])}function Nt(e){let[r,t]=_react.useState.call(void 0, [""]);return _react.useEffect.call(void 0, ()=>{t([""])},[e]),{pageToken:_nullishCoalesce(r[r.length-1], () => ("")),page:r.length,push:n=>t(o=>[...o,n]),pop:()=>t(n=>n.length>1?n.slice(0,-1):n)}}function de(){let e=T("useReturnSession"),r=_connectquery.useMutation.call(void 0, _chunkASNUY3EUjs.j.returns.startReturnSession),t=_connectquery.useMutation.call(void 0, _chunkASNUY3EUjs.j.returns.verifyReturnSession),{setChallenge:n,authenticate:o,clearSession:u}=e,s=_react.useCallback.call(void 0, async c=>{t.reset();let b=c.trim(),g=await r.mutateAsync({projectId:e.projectID,email:b,environment:e.environment});return n({challengeId:g.challengeId,email:b,resendAvailableAt:Date.now()+Math.max(0,g.resendAfterSeconds)*1e3}),g},[e.projectID,e.environment,n,r,t]),a=_react.useCallback.call(void 0, async c=>{let b=await t.mutateAsync({projectId:e.projectID,challengeId:c.challengeId,code:c.code,environment:e.environment}),g=ae(b.expiresAt);if(b.sessionToken===""||g==null)throw new Error("EMPTY_SESSION");return o({token:b.sessionToken,expiresAt:g}),b},[e.projectID,e.environment,o,t]),y=_react.useCallback.call(void 0, async c=>{try{return await s(c),!0}catch (e7){return!1}},[s]),m=_react.useCallback.call(void 0, async c=>{if(e.challenge==null)return!1;try{return await a({challengeId:e.challenge.challengeId,code:c.trim()}),!0}catch (e8){return!1}},[e.challenge,a]),p=_react.useCallback.call(void 0, ()=>e.challenge!=null?y(e.challenge.email):Promise.resolve(!1),[e.challenge,y]),f=$(_nullishCoalesce(_nullishCoalesce(r.error, () => (t.error)), () => (e.exchangeError)));return{status:e.status,isAuthenticated:e.status==="authenticated",challenge:e.challenge,isStarting:r.isPending,isVerifying:t.isPending,starting:r.isPending,verifying:t.isPending,error:f,errorKey:X(f),start:y,startSession:s,verifySession:a,verify:m,resend:p,logout:u}}function pe(e){return e.status==="hydrating"||e.status==="exchanging"}function ht(e,r){let t=T("useReturnOrders"),{pageSize:n,explicitPageToken:o}=he(e,r),u=Nt(t.token),s=_connectquery.useQuery.call(void 0, _chunkASNUY3EUjs.j.returns.listReturnOrders,{projectId:t.projectID,sessionToken:_nullishCoalesce(t.token, () => ("")),pageSize:n,pageToken:_nullishCoalesce(o, () => (u.pageToken))},{enabled:t.token!=null});ce(s.error,t.clearSession);let a=_nullishCoalesce(_optionalChain([s, 'access', _13 => _13.data, 'optionalAccess', _14 => _14.nextPageToken]), () => (""));return{orders:_nullishCoalesce(_optionalChain([s, 'access', _15 => _15.data, 'optionalAccess', _16 => _16.orders]), () => ([])),total:_nullishCoalesce(_optionalChain([s, 'access', _17 => _17.data, 'optionalAccess', _18 => _18.total]), () => (0)),data:s.data,isLoading:pe(t)||s.isLoading,isFetching:s.isFetching,error:$(s.error),errorKey:X(s.error),status:s.status,isError:s.isError,isSuccess:s.isSuccess,page:u.page,hasNext:a!=="",hasPrevious:u.page>1,next:()=>{a!==""&&u.push(a)},previous:u.pop,refetch:()=>s.refetch()}}function Be(e){let r=T("useReturnableOrder"),t=_connectquery.useQuery.call(void 0, _chunkASNUY3EUjs.j.returns.getReturnableOrder,{projectId:r.projectID,sessionToken:_nullishCoalesce(r.token, () => ("")),canonicalOrderId:_nullishCoalesce(e, () => (""))},{enabled:r.token!=null&&e!=null&&e!==""});return ce(t.error,r.clearSession),{order:_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.order]),returnHistory:_nullishCoalesce(_optionalChain([t, 'access', _21 => _21.data, 'optionalAccess', _22 => _22.returnHistory]), () => ([])),data:t.data,isLoading:e!=null&&e!==""&&(pe(r)||t.isLoading),error:$(t.error),errorKey:X(t.error),status:t.status,isError:t.isError,isSuccess:t.isSuccess,refetch:()=>t.refetch()}}function kt(){let e=T("useCreateReturn"),r=_reactquery.useQueryClient.call(void 0, ),t=_connectquery.useMutation.call(void 0, _chunkASNUY3EUjs.j.returns.createReturnRequest),n=_chunkGT3OH55Yjs.m.call(void 0, ),o=_react.useRef.call(void 0, void 0),{clearSession:u}=e,s=_react.useCallback.call(void 0, async(p,f)=>{try{let c=await t.mutateAsync({projectId:e.projectID,sessionToken:_nullishCoalesce(e.token, () => ("")),canonicalOrderId:p.orderId,items:p.items,note:_nullishCoalesce(p.note, () => ("")),idempotencyKey:f});return r.invalidateQueries({queryKey:Ce()}),n.track("return_submitted",{reason_code:"unspecified",item_count:p.items.length},{order_ref:null}),c}catch(c){throw Pe(c)&&u(),c}},[e.projectID,e.token,t,r,u,n]),a=_react.useCallback.call(void 0, async p=>{o.current??=Le();try{let f=await s(p,o.current);return o.current=void 0,f.request}catch (e9){return}},[s]),y=_react.useCallback.call(void 0, async p=>{if(e.token==null)throw new Error("Verify your email to continue.");return s({orderId:p.canonicalOrderID,items:p.items,note:p.note},_nullishCoalesce(p.idempotencyKey, () => (Le())))},[e.token,s]),m=_react.useCallback.call(void 0, (p,f)=>{y(p).then(c=>_optionalChain([f, 'optionalAccess', _23 => _23.onSuccess, 'optionalCall', _24 => _24(c)]),c=>_optionalChain([f, 'optionalAccess', _25 => _25.onError, 'optionalCall', _26 => _26($(c))]))},[y]);return{submit:a,isPending:t.isPending,error:$(t.error),errorKey:X(t.error),mutateAsync:y,mutate:m,data:t.data,reset:t.reset,status:t.status,isError:t.isError,isSuccess:t.isSuccess}}function Tt(e,r){let t=T("useMyReturns"),{pageSize:n,explicitPageToken:o}=he(e,r),u=Nt(t.token),s=_connectquery.useQuery.call(void 0, _chunkASNUY3EUjs.j.returns.listMyReturns,{projectId:t.projectID,sessionToken:_nullishCoalesce(t.token, () => ("")),pageSize:n,pageToken:_nullishCoalesce(o, () => (u.pageToken))},{enabled:t.token!=null});ce(s.error,t.clearSession);let a=_nullishCoalesce(_optionalChain([s, 'access', _27 => _27.data, 'optionalAccess', _28 => _28.nextPageToken]), () => (""));return{returns:_nullishCoalesce(_optionalChain([s, 'access', _29 => _29.data, 'optionalAccess', _30 => _30.returns]), () => ([])),total:_nullishCoalesce(_optionalChain([s, 'access', _31 => _31.data, 'optionalAccess', _32 => _32.total]), () => (0)),data:s.data,isLoading:pe(t)||s.isLoading,isFetching:s.isFetching,error:$(s.error),errorKey:X(s.error),status:s.status,isError:s.isError,isSuccess:s.isSuccess,page:u.page,hasNext:a!=="",hasPrevious:u.page>1,next:()=>{a!==""&&u.push(a)},previous:u.pop,refetch:()=>s.refetch()}}function me(e){let r=T("useMyReturn"),t=_connectquery.useQuery.call(void 0, _chunkASNUY3EUjs.j.returns.getMyReturn,{projectId:r.projectID,sessionToken:_nullishCoalesce(r.token, () => ("")),returnId:e},{enabled:r.token!=null});return ce(t.error,r.clearSession),{request:_optionalChain([t, 'access', _33 => _33.data, 'optionalAccess', _34 => _34.request]),isLoading:pe(r)||t.isLoading,error:t.error,errorKey:X(t.error),refetch:()=>t.refetch()}}var _reactlabel = require('@radix-ui/react-label'); var wt = _interopRequireWildcard(_reactlabel);function te({className:e,...r}){return _jsxruntime.jsx.call(void 0, wt.Root,{"data-slot":"label",className:_chunk7RGH57QGjs.d.call(void 0, "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...r})}var _lucidereact = require('lucide-react');function re({className:e,...r}){return _jsxruntime.jsx.call(void 0, _lucidereact.Loader2Icon,{role:"status","aria-label":"Loading",className:_chunk7RGH57QGjs.d.call(void 0, "size-4 animate-spin",e),...r})}var H="bg-[var(--bitsnap-returns-button-background,#18181b)] text-[color:var(--bitsnap-returns-button-foreground,#fafafa)] hover:bg-[var(--bitsnap-returns-button-hover-background,#000000)] focus-visible:ring-[color:var(--bitsnap-returns-focus-ring,#71717a)]/50",L="border border-[color:var(--bitsnap-returns-border,#e4e4e7)] bg-transparent text-[color:var(--bitsnap-returns-foreground,#18181b)] hover:bg-[var(--bitsnap-returns-hover-surface,#f4f4f5)] focus-visible:ring-[color:var(--bitsnap-returns-focus-ring,#71717a)]/50",G="bg-[var(--bitsnap-returns-input-background,#ffffff)] dark:bg-[var(--bitsnap-returns-input-background,#ffffff)] border-[color:var(--bitsnap-returns-border,#e4e4e7)] text-[color:var(--bitsnap-returns-foreground,#18181b)] placeholder:text-[color:var(--bitsnap-returns-muted-foreground,#71717a)] focus-visible:border-[color:var(--bitsnap-returns-focus-ring,#71717a)] focus-visible:ring-[color:var(--bitsnap-returns-focus-ring,#71717a)]/50";function M({title:e,description:r,onBack:t,className:n,children:o}){let u=h(),s=l("header"),a=l("title"),y=l("description"),m=l("backButton");return _jsxruntime.jsxs.call(void 0, "section",{className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-5",n),children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-returns-slot":"header",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-2",s.className),style:s.style,children:[t!=null&&_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"ghost",size:"sm","data-bitsnap-returns-slot":"backButton",className:_chunk7RGH57QGjs.d.call(void 0, "self-start -ml-3 text-[color:var(--bitsnap-returns-muted-foreground,#71717a)] hover:bg-[var(--bitsnap-returns-hover-surface,#f4f4f5)]",m.className),style:m.style,onClick:t,children:u("back")}),_jsxruntime.jsx.call(void 0, "h2",{"data-bitsnap-returns-slot":"title",className:_chunk7RGH57QGjs.d.call(void 0, "text-2xl font-semibold",a.className),style:a.style,children:e}),r!=null&&_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"description",className:_chunk7RGH57QGjs.d.call(void 0, "text-sm",y.className),style:y.style,children:r})]}),o]})}function A({errorKey:e,onRetry:r}){let t=h(),n=l("error"),o=l("secondaryButton");return _jsxruntime.jsxs.call(void 0, "div",{role:"alert","data-bitsnap-returns-slot":"error",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col items-start gap-2 text-sm",n.className),style:n.style,children:[_jsxruntime.jsx.call(void 0, "p",{children:t(e)}),r!=null&&_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary",size:"sm","data-bitsnap-returns-slot":"secondaryButton",className:_chunk7RGH57QGjs.d.call(void 0, L,o.className),style:o.style,onClick:r,children:t("errorRetry")})]})}function fe({children:e}){let r=l("emptyState");return _jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"emptyState",className:_chunk7RGH57QGjs.d.call(void 0, "py-6 text-center text-sm",r.className),style:r.style,children:e})}function U({rows:e=3}){let r=h(),t=l("skeleton");return _jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true","aria-label":r("loading"),className:"flex flex-col gap-3",children:Array.from({length:e},(n,o)=>_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.u,{"data-bitsnap-returns-slot":"skeleton",className:_chunk7RGH57QGjs.d.call(void 0, "h-16 w-full bg-[var(--bitsnap-returns-hover-surface,#f4f4f5)]",t.className),style:t.style},o))})}function J({status:e}){let r=h(),t=l("statusBadge");return _jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"statusBadge","data-status":e,className:_chunk7RGH57QGjs.d.call(void 0, "inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",t.className),style:t.style,children:r(lt(e))})}function ze(){let e=h();return r=>e(ct(r))}function ge({page:e,total:r,hasNext:t,hasPrevious:n,isFetching:o,onNext:u,onPrevious:s}){let a=h(),y=l("pagination"),m=l("secondaryButton");return!t&&!n?null:_jsxruntime.jsxs.call(void 0, "nav",{"data-bitsnap-returns-slot":"pagination",className:_chunk7RGH57QGjs.d.call(void 0, "flex items-center justify-between gap-3 text-sm",y.className),style:y.style,children:[_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary",size:"sm","data-bitsnap-returns-slot":"secondaryButton",className:_chunk7RGH57QGjs.d.call(void 0, L,m.className),style:m.style,disabled:!n||o,onClick:s,children:a("paginationPrevious")}),_jsxruntime.jsx.call(void 0, "span",{"aria-live":"polite",children:a("paginationInfo",{page:e,total:r})}),_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary",size:"sm","data-bitsnap-returns-slot":"secondaryButton",className:_chunk7RGH57QGjs.d.call(void 0, L,m.className),style:m.style,disabled:!t||o,onClick:u,children:a("paginationNext")})]})}function Kn({onSubmitted:e,className:r}){T("ReturnsEmailStep");let t=h(),n=de(),[o,u]=_react.useState.call(void 0, ""),s=l("emailForm"),a=l("emailInput"),y=l("submitButton");async function m(p){p.preventDefault(),!n.isStarting&&await n.start(o)&&_optionalChain([e, 'optionalCall', _35 => _35(o.trim())])}return _jsxruntime.jsx.call(void 0, M,{className:r,title:t("emailStepTitle"),description:t("emailStepDescription"),children:_jsxruntime.jsxs.call(void 0, "form",{"data-bitsnap-returns-slot":"emailForm",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-4",s.className),style:s.style,onSubmit:m,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, te,{htmlFor:"bitsnap-returns-email",children:t("emailLabel")}),_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.r,{id:"bitsnap-returns-email",type:"email",name:"email",autoComplete:"email",required:!0,value:o,placeholder:t("emailPlaceholder"),disabled:n.isStarting,"data-bitsnap-returns-slot":"emailInput",className:_chunk7RGH57QGjs.d.call(void 0, G,a.className),style:a.style,onChange:p=>u(p.target.value)})]}),n.errorKey!=null&&_jsxruntime.jsx.call(void 0, A,{errorKey:n.errorKey}),_jsxruntime.jsxs.call(void 0, _chunkASNUY3EUjs.q,{type:"submit",disabled:n.isStarting,"data-bitsnap-returns-slot":"submitButton",className:_chunk7RGH57QGjs.d.call(void 0, H,y.className),style:y.style,children:[n.isStarting&&_jsxruntime.jsx.call(void 0, re,{}),t("emailSubmit")]})]})})}function gr(e){let[r,t]=_react.useState.call(void 0, );return _react.useEffect.call(void 0, ()=>{if(e==null)return;t(Date.now());let n=setInterval(()=>{let o=Date.now();t(o),o>=e&&clearInterval(n)},1e3);return()=>clearInterval(n)},[e]),e!=null&&r!=null?Math.max(0,Math.ceil((e-r)/1e3)):0}function _n({onVerified:e,onBack:r,className:t}){T("ReturnsCodeStep");let n=h(),o=de(),[u,s]=_react.useState.call(void 0, ""),a=gr(_optionalChain([o, 'access', _36 => _36.challenge, 'optionalAccess', _37 => _37.resendAvailableAt])),y=l("codeForm"),m=l("codeInput"),p=l("submitButton"),f=l("resendButton"),c=o.isVerifying||o.isStarting;async function b(g){g.preventDefault(),!c&&await o.verify(u)&&_optionalChain([e, 'optionalCall', _38 => _38()])}return _jsxruntime.jsx.call(void 0, M,{className:t,onBack:r,title:n("codeStepTitle"),description:n("codeStepDescription",{email:_nullishCoalesce(_optionalChain([o, 'access', _39 => _39.challenge, 'optionalAccess', _40 => _40.email]), () => (""))}),children:_jsxruntime.jsxs.call(void 0, "form",{"data-bitsnap-returns-slot":"codeForm",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-4",y.className),style:y.style,onSubmit:b,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, te,{htmlFor:"bitsnap-returns-code",children:n("codeLabel")}),_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.r,{id:"bitsnap-returns-code",name:"code",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:u,disabled:c,"data-bitsnap-returns-slot":"codeInput",className:_chunk7RGH57QGjs.d.call(void 0, G,m.className),style:m.style,onChange:g=>s(g.target.value)})]}),o.errorKey!=null&&_jsxruntime.jsx.call(void 0, A,{errorKey:o.errorKey}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap items-center gap-3",children:[_jsxruntime.jsxs.call(void 0, _chunkASNUY3EUjs.q,{type:"submit",disabled:c||o.challenge==null,"data-bitsnap-returns-slot":"submitButton",className:_chunk7RGH57QGjs.d.call(void 0, H,p.className),style:p.style,children:[o.isVerifying&&_jsxruntime.jsx.call(void 0, re,{}),n("codeSubmit")]}),_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary",disabled:c||a>0||o.challenge==null,"data-bitsnap-returns-slot":"resendButton",className:_chunk7RGH57QGjs.d.call(void 0, L,f.className),style:f.style,onClick:()=>void o.resend(),children:a>0?n("resendIn",{seconds:a}):n("resend")})]})]})})}function It(){let e=h(),r=de(),t=l("logoutButton");return _jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"ghost",size:"sm","data-bitsnap-returns-slot":"logoutButton",className:_chunk7RGH57QGjs.d.call(void 0, "text-[color:var(--bitsnap-returns-muted-foreground,#71717a)] hover:bg-[var(--bitsnap-returns-hover-surface,#f4f4f5)]",t.className),style:t.style,onClick:r.logout,children:e("logout")})}function Z(e,r){if(e==null)return"";let t=_wkt.timestampDate.call(void 0, e);try{return new Intl.DateTimeFormat(r,{dateStyle:"medium"}).format(t)}catch (e10){return t.toISOString().slice(0,10)}}function ee(e,r,t){let n=typeof e=="bigint"?e:BigInt(Math.trunc(e));try{let o=new Intl.NumberFormat(t,{style:"currency",currency:r}),u=_nullishCoalesce(o.resolvedOptions().maximumFractionDigits, () => (2));return o.format(Et(n,u))}catch (e11){return`${Et(n,2)} ${r}`}}function Et(e,r){let t=e<BigInt(0),n=t?-e:e;if(r<=0)return`${t?"-":""}${n}`;let o=BigInt(10)**BigInt(r),u=n/o,s=(n%o).toString().padStart(r,"0");return`${t?"-":""}${u}.${s}`}function Ct(e,r){return Number.isFinite(e)?Math.min(Math.max(0,Math.trunc(e)),Math.max(0,r)):0}function Oe(e){return e.eligible&&e.availableQuantity>0}function Pt(e,r){return e.map(t=>({lineId:t,quantity:_nullishCoalesce(r[t], () => (0))})).filter(t=>t.quantity>0)}function cs({onSelectOrder:e,onOpenMyReturns:r,showLogout:t=!0,pageSize:n,className:o}){T("ReturnsOrderList");let u=h(),s=Y(),a=ht({pageSize:n}),y=l("orderList"),m=l("orderCard"),p=l("orderReference"),f=l("orderDate"),c=l("orderTotal"),b=l("secondaryButton");return _jsxruntime.jsxs.call(void 0, M,{className:o,title:u("ordersTitle"),description:u("ordersDescription"),children:[(t||r!=null)&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r!=null?_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary",size:"sm","data-bitsnap-returns-slot":"secondaryButton",className:_chunk7RGH57QGjs.d.call(void 0, L,b.className),style:b.style,onClick:r,children:u("myReturnsLink")}):_jsxruntime.jsx.call(void 0, "span",{}),t&&_jsxruntime.jsx.call(void 0, It,{})]}),a.isLoading?_jsxruntime.jsx.call(void 0, U,{}):a.errorKey!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:a.errorKey,onRetry:a.refetch}):a.orders.length===0?_jsxruntime.jsx.call(void 0, fe,{children:u("ordersEmpty")}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"orderList",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-3",y.className),style:y.style,children:a.orders.map(g=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"orderCard",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-wrap items-center justify-between gap-3 border p-4",m.className),style:m.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"orderReference",className:_chunk7RGH57QGjs.d.call(void 0, "font-medium",p.className),style:p.style,children:u("orderTitle",{reference:g.displayReference})}),_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"orderDate",className:_chunk7RGH57QGjs.d.call(void 0, "text-sm",f.className),style:f.style,children:Z(g.purchasedAt,s)}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:u("orderReturnableLines",{count:g.returnableLineCount})})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-4",children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"orderTotal",className:_chunk7RGH57QGjs.d.call(void 0, "font-medium",c.className),style:c.style,children:ee(g.totalMinor,g.currency,s)}),_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary",size:"sm","aria-label":`${u("orderSelect")}: ${u("orderTitle",{reference:g.displayReference})}`,"data-bitsnap-returns-slot":"secondaryButton",className:_chunk7RGH57QGjs.d.call(void 0, L,b.className),style:b.style,onClick:()=>_optionalChain([e, 'optionalCall', _41 => _41(g.canonicalOrderId)]),children:u("orderSelect")})]})]},g.canonicalOrderId))}),_jsxruntime.jsx.call(void 0, ge,{page:a.page,total:a.total,hasNext:a.hasNext,hasPrevious:a.hasPrevious,isFetching:a.isFetching,onNext:a.next,onPrevious:a.previous})]})]})}function ds({orderId:e,onContinue:r,onBack:t,initialItems:n,initialNote:o,className:u}){T("ReturnsOrderDetail");let s=_chunkGT3OH55Yjs.m.call(void 0, );_react.useEffect.call(void 0, ()=>{s.track("return_started",{},{order_ref:null})},[s]);let a=h(),y=Y(),{order:m,returnHistory:p,isLoading:f,errorKey:c,refetch:b}=Be(e),[g,C]=_react.useState.call(void 0, ()=>Object.fromEntries((_nullishCoalesce(n, () => ([]))).map(R=>[R.lineId,R.quantity]))),[I,N]=_react.useState.call(void 0, _nullishCoalesce(o, () => (""))),[B,w]=_react.useState.call(void 0, !1),P=l("lineList"),k=l("line"),Q=l("lineName"),O=l("linePrice"),q=l("lineQuantityControl"),ne=l("quantityButton"),Me=l("quantityInput"),qe=l("lineIneligibleReason"),Ke=l("noteInput"),_e=l("submitButton"),je=l("history"),Ue=l("historyEntry");function Re(R,V){w(!1),C(F=>({...F,[R.lineId]:Ct(V,R.availableQuantity)}))}function At(R){if(R.preventDefault(),m==null)return;let V=Pt(m.lines.filter(Oe).map(F=>F.lineId),g);if(V.length===0){w(!0);return}_optionalChain([r, 'optionalCall', _42 => _42({items:V,note:I.trim()})])}return _jsxruntime.jsx.call(void 0, M,{className:u,onBack:t,title:a("orderDetailTitle",{reference:_nullishCoalesce(_optionalChain([m, 'optionalAccess', _43 => _43.displayReference]), () => (""))}),description:a("orderDetailDescription"),children:f?_jsxruntime.jsx.call(void 0, U,{}):c!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:c,onRetry:b}):m==null?null:_jsxruntime.jsxs.call(void 0, "form",{className:"flex flex-col gap-5",onSubmit:At,children:[_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"lineList",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-3",P.className),style:P.style,children:m.lines.map(R=>{let V=Oe(R),F=_nullishCoalesce(g[R.lineId], () => (0)),be=`bitsnap-returns-quantity-${R.lineId}`;return _jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"line","data-selected":F>0?"":void 0,"data-ineligible":V?void 0:"",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-3 border p-4",k.className),style:k.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"lineName",className:_chunk7RGH57QGjs.d.call(void 0, "font-medium",Q.className),style:Q.style,children:R.name}),_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"linePrice",className:_chunk7RGH57QGjs.d.call(void 0, "text-sm",O.className),style:O.style,children:ee(R.paidUnitMinor,R.currency,y)})]}),V?_jsxruntime.jsxs.call(void 0, "div",{role:"group","aria-label":a("quantityLabel",{name:R.name}),"data-bitsnap-returns-slot":"lineQuantityControl",className:_chunk7RGH57QGjs.d.call(void 0, "flex items-center gap-2",q.className),style:q.style,children:[_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary",size:"icon-sm","aria-label":a("quantityDecrease",{name:R.name}),"aria-controls":be,disabled:F<=0,"data-bitsnap-returns-slot":"quantityButton",className:_chunk7RGH57QGjs.d.call(void 0, L,ne.className),style:ne.style,onClick:()=>Re(R,F-1),children:_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":"true",children:"-"})}),_jsxruntime.jsx.call(void 0, "input",{id:be,type:"number",inputMode:"numeric",min:0,max:R.availableQuantity,step:1,value:F,"aria-label":a("quantityLabel",{name:R.name}),"data-bitsnap-returns-slot":"quantityInput",className:_chunk7RGH57QGjs.d.call(void 0, "h-8 w-16 rounded-md border px-2 text-center text-sm outline-none focus-visible:ring-[3px]",G,Me.className),style:Me.style,onChange:Bt=>Re(R,Bt.target.valueAsNumber)}),_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary",size:"icon-sm","aria-label":a("quantityIncrease",{name:R.name}),"aria-controls":be,disabled:F>=R.availableQuantity,"data-bitsnap-returns-slot":"quantityButton",className:_chunk7RGH57QGjs.d.call(void 0, L,ne.className),style:ne.style,onClick:()=>Re(R,F+1),children:_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":"true",children:"+"})}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:a("quantityOfAvailable",{available:R.availableQuantity})})]}):_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"lineIneligibleReason",className:_chunk7RGH57QGjs.d.call(void 0, "text-sm",qe.className),style:qe.style,children:R.exclusionReason!==""?R.exclusionReason:a("lineIneligibleFallback")})]},R.lineId)})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, te,{htmlFor:"bitsnap-returns-note",children:a("noteLabel")}),_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.v,{id:"bitsnap-returns-note",name:"note",rows:3,maxLength:1e3,value:I,placeholder:a("notePlaceholder"),"data-bitsnap-returns-slot":"noteInput",className:_chunk7RGH57QGjs.d.call(void 0, G,"dark:border-[color:var(--bitsnap-returns-border,#e4e4e7)] dark:placeholder:text-[color:var(--bitsnap-returns-muted-foreground,#71717a)] dark:focus-visible:ring-[color:var(--bitsnap-returns-focus-ring,#71717a)]",Ke.className),style:Ke.style,onChange:R=>N(R.target.value)})]}),B&&_jsxruntime.jsx.call(void 0, A,{errorKey:"selectionEmpty"}),_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"submit","data-bitsnap-returns-slot":"submitButton",className:_chunk7RGH57QGjs.d.call(void 0, H,_e.className),style:_e.style,children:a("selectionContinue")}),p.length>0&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-sm font-medium",children:a("previousReturnsTitle")}),_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"history",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-2",je.className),style:je.style,children:p.map(R=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"historyEntry",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-wrap items-center justify-between gap-2 text-sm",Ue.className),style:Ue.style,children:[_jsxruntime.jsx.call(void 0, "span",{children:R.reference}),_jsxruntime.jsx.call(void 0, "span",{children:Z(R.createdAt,y)}),_jsxruntime.jsx.call(void 0, J,{status:R.status})]},R.id))})]})]})})}function ps({orderId:e,items:r,note:t,onSubmitted:n,onBack:o,className:u}){T("ReturnsConfirmation");let s=h(),a=Y(),{order:y,isLoading:m,errorKey:p,refetch:f}=Be(e),c=kt(),b=l("summary"),g=l("line"),C=l("lineName"),I=l("linePrice"),N=l("submitButton");async function B(w){if(w.preventDefault(),c.isPending)return;let P=await c.submit({orderId:e,items:r.map(k=>({lineId:k.lineId,quantity:k.quantity})),note:t});P!=null&&_optionalChain([n, 'optionalCall', _44 => _44(P.id,P)])}return _jsxruntime.jsx.call(void 0, M,{className:u,onBack:o,title:s("confirmationTitle"),description:s("confirmationDescription"),children:m?_jsxruntime.jsx.call(void 0, U,{rows:2}):p!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:p,onRetry:f}):_jsxruntime.jsxs.call(void 0, "form",{className:"flex flex-col gap-5",onSubmit:B,children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-returns-slot":"summary",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-3 border p-4",b.className),style:b.style,children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-sm font-medium",children:s("confirmationSummary")}),_jsxruntime.jsx.call(void 0, "ul",{className:"flex flex-col gap-3",children:r.map(w=>{let P=_optionalChain([y, 'optionalAccess', _45 => _45.lines, 'access', _46 => _46.find, 'call', _47 => _47(k=>k.lineId===w.lineId)]);return _jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"line",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-wrap items-baseline justify-between gap-2",g.className),style:g.style,children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"lineName",className:_chunk7RGH57QGjs.d.call(void 0, "font-medium",C.className),style:C.style,children:_nullishCoalesce(_optionalChain([P, 'optionalAccess', _48 => _48.name]), () => (w.lineId))}),_jsxruntime.jsxs.call(void 0, "span",{"data-bitsnap-returns-slot":"linePrice",className:_chunk7RGH57QGjs.d.call(void 0, "text-sm",I.className),style:I.style,children:[s("confirmationQuantity",{quantity:w.quantity}),P!=null&&` \xB7 ${ee(P.paidUnitMinor*BigInt(w.quantity),P.currency,a)}`]})]},w.lineId)})}),t!=null&&t!==""&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 text-sm",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:s("confirmationNote")}),_jsxruntime.jsx.call(void 0, "span",{className:"whitespace-pre-wrap",children:t})]})]}),c.errorKey!=null&&_jsxruntime.jsx.call(void 0, A,{errorKey:c.errorKey}),_jsxruntime.jsxs.call(void 0, _chunkASNUY3EUjs.q,{type:"submit",disabled:c.isPending||r.length===0,"data-bitsnap-returns-slot":"submitButton",className:_chunk7RGH57QGjs.d.call(void 0, H,N.className),style:N.style,children:[c.isPending&&_jsxruntime.jsx.call(void 0, re,{}),s("confirmationSubmit")]})]})})}function ms({returnId:e,onContinue:r,onOpenMyReturns:t,className:n}){T("ReturnsResult");let o=h(),{request:u,isLoading:s,errorKey:a,refetch:y}=me(e),m=l("successState"),p=l("returnReference"),f=l("returnInstructions"),c=l("submitButton"),b=l("secondaryButton");return _jsxruntime.jsxs.call(void 0, "section",{className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-5",n),children:[_jsxruntime.jsxs.call(void 0, "div",{role:"status","data-bitsnap-returns-slot":"successState",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-4 border p-5",m.className),style:m.style,children:[_jsxruntime.jsx.call(void 0, "h2",{className:"text-2xl font-semibold",children:o("successTitle")}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",children:o("successDescription")}),s?_jsxruntime.jsx.call(void 0, U,{rows:2}):a!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:a,onRetry:y}):u!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:o("successReference")}),_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"returnReference",className:_chunk7RGH57QGjs.d.call(void 0, "text-lg font-semibold",p.className),style:p.style,children:u.reference})]}),u.returnInstructions!==""&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-medium",children:o("successInstructions")}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"returnInstructions",className:_chunk7RGH57QGjs.d.call(void 0, "whitespace-pre-wrap border p-3 text-sm",f.className),style:f.style,children:u.returnInstructions})]})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap gap-3",children:[_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button","data-bitsnap-returns-slot":"submitButton",className:_chunk7RGH57QGjs.d.call(void 0, H,c.className),style:c.style,onClick:r,children:o("successDone")}),t!=null&&_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary","data-bitsnap-returns-slot":"secondaryButton",className:_chunk7RGH57QGjs.d.call(void 0, L,b.className),style:b.style,onClick:t,children:o("myReturnsLink")})]})]})}function Ts({onSelectReturn:e,onBack:r,pageSize:t,className:n}){T("ReturnsMyReturnsList");let o=h(),u=Y(),s=ze(),a=Tt({pageSize:t}),y=l("returnList"),m=l("returnCard"),p=l("returnReference"),f=l("secondaryButton");return _jsxruntime.jsx.call(void 0, M,{className:n,onBack:r,title:o("myReturnsTitle"),description:o("myReturnsDescription"),children:a.isLoading?_jsxruntime.jsx.call(void 0, U,{}):a.errorKey!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:a.errorKey,onRetry:a.refetch}):a.returns.length===0?_jsxruntime.jsx.call(void 0, fe,{children:o("myReturnsEmpty")}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"returnList",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-3",y.className),style:y.style,children:a.returns.map(c=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"returnCard",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-wrap items-center justify-between gap-3 border p-4",m.className),style:m.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"returnReference",className:_chunk7RGH57QGjs.d.call(void 0, "font-medium",p.className),style:p.style,children:c.reference}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:Z(c.createdAt,u)}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-sm",children:[o("myReturnRefund"),": ",s(c.refundStatus)]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, J,{status:c.status}),_jsxruntime.jsx.call(void 0, _chunkASNUY3EUjs.q,{type:"button",variant:"secondary",size:"sm","aria-label":`${o("myReturnOpen")}: ${c.reference}`,"data-bitsnap-returns-slot":"secondaryButton",className:_chunk7RGH57QGjs.d.call(void 0, L,f.className),style:f.style,onClick:()=>_optionalChain([e, 'optionalCall', _49 => _49(c.id)]),children:o("myReturnOpen")})]})]},c.id))}),_jsxruntime.jsx.call(void 0, ge,{page:a.page,total:a.total,hasNext:a.hasNext,hasPrevious:a.hasPrevious,isFetching:a.isFetching,onNext:a.next,onPrevious:a.previous})]})})}function ws({returnId:e,onBack:r,className:t}){T("ReturnsMyReturnDetail");let n=h(),o=Y(),u=ze(),{request:s,isLoading:a,errorKey:y,refetch:m}=me(e),p=l("summary"),f=l("lineList"),c=l("line"),b=l("lineName"),g=l("returnInstructions"),C=l("history"),I=l("historyEntry");return _jsxruntime.jsx.call(void 0, M,{className:t,onBack:r,title:s!=null?n("myReturnTitle",{reference:s.reference}):n("myReturnDetailTitle"),children:a?_jsxruntime.jsx.call(void 0, U,{}):y!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:y,onRetry:m}):s!=null&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-5",children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-returns-slot":"summary",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-2 border p-4 text-sm",p.className),style:p.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between gap-2",children:[_jsxruntime.jsx.call(void 0, J,{status:s.status}),_jsxruntime.jsxs.call(void 0, "span",{children:[n("myReturnCreatedAt"),":"," ",Z(s.createdAt,o)]})]}),_jsxruntime.jsxs.call(void 0, "span",{children:[n("myReturnRefund"),": ",u(s.refundStatus),s.refundAmountMinor>BigInt(0)&&` \xB7 ${ee(s.refundAmountMinor,s.currency,o)}`]}),s.customerNote!==""&&_jsxruntime.jsxs.call(void 0, "span",{className:"whitespace-pre-wrap",children:[n("myReturnNote"),": ",s.customerNote]})]}),s.returnInstructions!==""&&_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"returnInstructions",className:_chunk7RGH57QGjs.d.call(void 0, "whitespace-pre-wrap border p-3 text-sm",g.className),style:g.style,children:s.returnInstructions}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-sm font-medium",children:n("myReturnLines")}),_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"lineList",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-3",f.className),style:f.style,children:s.lines.map(N=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"line",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-wrap items-baseline justify-between gap-2 border p-4",c.className),style:c.style,children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"lineName",className:_chunk7RGH57QGjs.d.call(void 0, "font-medium",b.className),style:b.style,children:N.name}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:n("myReturnLineQuantities",{requested:N.requestedQuantity,approved:N.approvedQuantity,received:N.receivedQuantity})})]},N.lineId))})]}),s.history.length>0&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-sm font-medium",children:n("myReturnHistory")}),_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"history",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-col gap-2",C.className),style:C.style,children:s.history.map(N=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"historyEntry",className:_chunk7RGH57QGjs.d.call(void 0, "flex flex-wrap items-center justify-between gap-2 text-sm",I.className),style:I.style,children:[_jsxruntime.jsx.call(void 0, J,{status:N.status}),_jsxruntime.jsx.call(void 0, "span",{children:Z(N.createdAt,o)})]},N.id))})]})]})})}exports.a = te; exports.b = re; exports.c = vr; exports.d = nt; exports.e = Ne; exports.f = l; exports.g = Pe; exports.h = St; exports.i = h; exports.j = T; exports.k = ir; exports.l = Xr; exports.m = de; exports.n = ht; exports.o = Be; exports.p = kt; exports.q = Tt; exports.r = me; exports.s = U; exports.t = Kn; exports.u = _n; exports.v = cs; exports.w = ds; exports.x = ps; exports.y = ms; exports.z = Ts; exports.A = ws;
2
- //# sourceMappingURL=chunk-YFETPEI6.js.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkKOYBZORLjs = require('./chunk-KOYBZORL.js');var _chunkUFIOJGJZjs = require('./chunk-UFIOJGJZ.js');var _chunkQ25D7OAOjs = require('./chunk-Q25D7OAO.js');var _chunkWGJTXDISjs = require('./chunk-WGJTXDIS.js');var vr=["root","header","title","description","backButton","stepIndicator","error","emptyState","skeleton","emailForm","emailInput","codeForm","codeInput","resendButton","logoutButton","orderList","orderCard","orderReference","orderDate","orderTotal","pagination","lineList","line","lineName","linePrice","lineQuantityControl","quantityButton","quantityInput","lineIneligibleReason","noteInput","summary","submitButton","secondaryButton","successState","returnReference","returnInstructions","returnList","returnCard","statusBadge","history","historyEntry"],zt={fontFamily:"--bitsnap-returns-font-family",fontSize:"--bitsnap-returns-font-size",background:"--bitsnap-returns-background",surface:"--bitsnap-returns-surface",foreground:"--bitsnap-returns-foreground",mutedForeground:"--bitsnap-returns-muted-foreground",border:"--bitsnap-returns-border",buttonBackground:"--bitsnap-returns-button-background",buttonForeground:"--bitsnap-returns-button-foreground",buttonHoverBackground:"--bitsnap-returns-button-hover-background",hoverSurface:"--bitsnap-returns-hover-surface",focusRing:"--bitsnap-returns-focus-ring",error:"--bitsnap-returns-error",success:"--bitsnap-returns-success",warning:"--bitsnap-returns-warning",badgeBackground:"--bitsnap-returns-badge-background",badgeForeground:"--bitsnap-returns-badge-foreground",inputBackground:"--bitsnap-returns-input-background",radius:"--bitsnap-returns-radius"},Dt={light:{background:"#ffffff",surface:"#f9fafb",foreground:"#18181b",mutedForeground:"#71717a",border:"#e4e4e7",buttonBackground:"#18181b",buttonForeground:"#fafafa",buttonHoverBackground:"#000000",hoverSurface:"#f4f4f5",focusRing:"#71717a",error:"#dc2626",success:"#16a34a",warning:"#d97706",badgeBackground:"#f4f4f5",badgeForeground:"#3f3f46",inputBackground:"#ffffff",radius:"8px"},dark:{background:"#18181b",surface:"#27272a",foreground:"#fafafa",mutedForeground:"#a1a1aa",border:"#3f3f46",buttonBackground:"#fafafa",buttonForeground:"#18181b",buttonHoverBackground:"#e4e4e7",hoverSurface:"#3f3f46",focusRing:"#a1a1aa",error:"#f87171",success:"#4ade80",warning:"#fbbf24",badgeBackground:"#3f3f46",badgeForeground:"#e4e4e7",inputBackground:"#27272a",radius:"8px"}},Ot=[{token:"background",variable:"--background"},{token:"foreground",variable:"--foreground"},{token:"surface",variable:"--card"},{token:"foreground",variable:"--card-foreground"},{token:"surface",variable:"--popover"},{token:"foreground",variable:"--popover-foreground"},{token:"buttonBackground",variable:"--primary"},{token:"buttonForeground",variable:"--primary-foreground"},{token:"surface",variable:"--secondary"},{token:"foreground",variable:"--secondary-foreground"},{token:"hoverSurface",variable:"--accent"},{token:"foreground",variable:"--accent-foreground"},{token:"mutedForeground",variable:"--muted-foreground"},{token:"border",variable:"--border"},{token:"border",variable:"--input"},{token:"focusRing",variable:"--ring"},{token:"error",variable:"--destructive"},{token:"radius",variable:"--radius"}];function ve(e){let r=_chunkKOYBZORLjs.a.call(void 0, e,{defaultTheme:"light",presets:Dt,variables:zt,shadcnVariables:Ot});return{theme:r.theme,tokens:r.tokens,elements:r.elements,boundaryClassName:r.theme,boundaryStyle:r.boundaryStyle}}function tt(e,r){return _chunkKOYBZORLjs.b.call(void 0, e.elements,r)}var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var rt=_react.createContext.call(void 0, ve());function nt({appearance:e,children:r}){let t=_react.useMemo.call(void 0, ()=>ve(e),[e]);return _jsxruntime.jsx.call(void 0, rt.Provider,{value:t,children:r})}function Ne(){return _react.useContext.call(void 0, rt)}function l(e){let r=Ne();return _nullishCoalesce(tt(r,e), () => ({}))}function ot(e){return e==="test"||e===1?1:0}var st={title:["emailStepTitle"],email:["emailLabel"],sendCode:["emailSubmit"],code:["codeLabel"],verify:["codeSubmit"],orders:["ordersTitle"],submit:["confirmationSubmit"],note:["noteLabel"],history:["myReturnsTitle","myReturnsLink"]};function at(e){if(e==null)return;let r={};for(let[t,n]of Object.entries(st)){let o=e[t];if(typeof o=="string")for(let u of n)r[u]=o}for(let t of Object.keys(e)){if(t in st)continue;let n=e[t];typeof n=="string"&&(r[t]=n)}return r}function it(e,r){let t=_optionalChain([r, 'optionalAccess', _2 => _2.brandColor, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]);return t==null||t===""?e:{...e,tokens:{..._chunkUFIOJGJZjs.t.call(void 0, t),..._optionalChain([e, 'optionalAccess', _5 => _5.tokens])}}}function he(e,r){return typeof e=="object"&&e!=null?{pageSize:_nullishCoalesce(e.pageSize, () => (20)),explicitPageToken:void 0}:typeof e=="number"||r!==void 0?{pageSize:_nullishCoalesce(e, () => (20)),explicitPageToken:_nullishCoalesce(r, () => (""))}:{pageSize:20,explicitPageToken:void 0}}var _t={en:{back:"Back",stepIndicator:"Step {current} of {total}",loading:"Loading",myReturnsLink:"My returns",emailStepTitle:"Return a product",emailStepDescription:"Enter the email address you used for the order. We will send you a verification code.",emailLabel:"Email address",emailPlaceholder:"name@example.com",emailSubmit:"Send code",codeStepTitle:"Enter the code",codeStepDescription:"We sent a verification code to {email}.",codeLabel:"Verification code",codeSubmit:"Verify",resend:"Send the code again",resendIn:"Send again in {seconds} s",logout:"Sign out",ordersTitle:"Your orders",ordersDescription:"Choose the order that contains the product to return.",ordersEmpty:"There are no orders eligible for return.",orderTitle:"Order {reference}",orderReturnableLines:"Products available to return: {count}",orderSelect:"Choose",paginationPrevious:"Previous",paginationNext:"Next",paginationInfo:"Page {page}, {total} orders",orderDetailTitle:"Order {reference}",orderDetailDescription:"Select the products and quantities to return.",quantityLabel:"Quantity to return: {name}",quantityDecrease:"Decrease quantity: {name}",quantityIncrease:"Increase quantity: {name}",quantityOfAvailable:"of {available}",lineIneligibleFallback:"This product cannot be returned.",noteLabel:"Note (optional)",notePlaceholder:"Tell us why you are returning the product",selectionContinue:"Continue",selectionEmpty:"Select at least one item to return.",previousReturnsTitle:"Earlier returns for this order",confirmationTitle:"Confirm the return",confirmationDescription:"Check the products before you submit the request.",confirmationSummary:"Products to return",confirmationQuantity:"Quantity: {quantity}",confirmationNote:"Your note",confirmationSubmit:"Submit return request",successTitle:"Return request submitted",successDescription:"We received your request and will keep you posted.",successReference:"Request number",successInstructions:"What to do next",successDone:"Back to orders",myReturnsTitle:"My returns",myReturnsDescription:"Track the status of your return requests.",myReturnsEmpty:"You have not submitted any return requests yet.",myReturnOpen:"Details",myReturnDetailTitle:"Return details",myReturnTitle:"Return {reference}",myReturnCreatedAt:"Submitted",myReturnRefund:"Refund",myReturnLines:"Products",myReturnLineQuantities:"Requested: {requested}, approved: {approved}, received: {received}",myReturnNote:"Your note",myReturnHistory:"History",statusSubmitted:"Submitted",statusApproved:"Approved",statusRejected:"Rejected",statusAwaitingReceipt:"Awaiting the package",statusReceived:"Package received",statusCompleted:"Completed",statusCancelled:"Cancelled",statusRefunded:"Refunded",statusFallback:"In progress",refundStatusNotStarted:"Not started",refundStatusPending:"Refund in progress",refundStatusSucceeded:"Refunded",refundStatusFailed:"Refund failed",refundStatusFallback:"Unknown",errorGeneric:"Something went wrong. Please try again.",errorInvalidEmail:"Enter a valid email address.",errorInvalidCode:"The code is invalid or has expired.",errorSessionExpired:"Your session has expired. Verify your email again.",errorOrderNotFound:"We could not find this order.",errorReturnNotFound:"We could not find this return request.",errorQuantityUnavailable:"The selected quantity is no longer available for return.",errorItemNotReturnable:"One of the selected products cannot be returned.",errorReturnsDisabled:"Returns are not available in this shop.",errorRateLimited:"Too many attempts. Please try again later.",errorIdempotencyConflict:"This request was already submitted with different contents. Reload and try again.",errorDeliveryFailed:"We could not send the code. Please try again.",errorRetry:"Try again"},pl:{back:"Wstecz",stepIndicator:"Krok {current} z {total}",loading:"\u0141adowanie",myReturnsLink:"Moje zwroty",emailStepTitle:"Zwr\xF3\u0107 produkt",emailStepDescription:"Podaj adres e-mail u\u017Cyty w zam\xF3wieniu. Wy\u015Blemy na niego kod weryfikacyjny.",emailLabel:"Adres e-mail",emailPlaceholder:"jan@example.com",emailSubmit:"Wy\u015Blij kod",codeStepTitle:"Wpisz kod",codeStepDescription:"Wys\u0142ali\u015Bmy kod weryfikacyjny na adres {email}.",codeLabel:"Kod weryfikacyjny",codeSubmit:"Zweryfikuj",resend:"Wy\u015Blij kod ponownie",resendIn:"Wy\u015Blij ponownie za {seconds} s",logout:"Wyloguj si\u0119",ordersTitle:"Twoje zam\xF3wienia",ordersDescription:"Wybierz zam\xF3wienie z produktem do zwrotu.",ordersEmpty:"Brak zam\xF3wie\u0144, kt\xF3re mo\u017Cna zwr\xF3ci\u0107.",orderTitle:"Zam\xF3wienie {reference}",orderReturnableLines:"Produkty do zwrotu: {count}",orderSelect:"Wybierz",paginationPrevious:"Poprzednia",paginationNext:"Nast\u0119pna",paginationInfo:"Strona {page}, zam\xF3wie\u0144: {total}",orderDetailTitle:"Zam\xF3wienie {reference}",orderDetailDescription:"Wybierz produkty i ilo\u015Bci do zwrotu.",quantityLabel:"Ilo\u015B\u0107 do zwrotu: {name}",quantityDecrease:"Zmniejsz ilo\u015B\u0107: {name}",quantityIncrease:"Zwi\u0119ksz ilo\u015B\u0107: {name}",quantityOfAvailable:"z {available}",lineIneligibleFallback:"Ten produkt nie podlega zwrotowi.",noteLabel:"Uwagi (opcjonalnie)",notePlaceholder:"Napisz, dlaczego zwracasz produkt",selectionContinue:"Dalej",selectionEmpty:"Wybierz co najmniej jedn\u0105 sztuk\u0119 do zwrotu.",previousReturnsTitle:"Wcze\u015Bniejsze zwroty tego zam\xF3wienia",confirmationTitle:"Potwierd\u017A zwrot",confirmationDescription:"Sprawd\u017A produkty przed wys\u0142aniem zg\u0142oszenia.",confirmationSummary:"Produkty do zwrotu",confirmationQuantity:"Ilo\u015B\u0107: {quantity}",confirmationNote:"Twoje uwagi",confirmationSubmit:"Wy\u015Blij zg\u0142oszenie zwrotu",successTitle:"Zg\u0142oszenie zwrotu zosta\u0142o wys\u0142ane",successDescription:"Otrzymali\u015Bmy zg\u0142oszenie i b\u0119dziemy informowa\u0107 o jego statusie.",successReference:"Numer zg\u0142oszenia",successInstructions:"Co dalej",successDone:"Wr\xF3\u0107 do zam\xF3wie\u0144",myReturnsTitle:"Moje zwroty",myReturnsDescription:"Sprawd\u017A status swoich zg\u0142osze\u0144 zwrotu.",myReturnsEmpty:"Nie masz jeszcze \u017Cadnych zg\u0142osze\u0144 zwrotu.",myReturnOpen:"Szczeg\xF3\u0142y",myReturnDetailTitle:"Szczeg\xF3\u0142y zwrotu",myReturnTitle:"Zwrot {reference}",myReturnCreatedAt:"Zg\u0142oszono",myReturnRefund:"Zwrot \u015Brodk\xF3w",myReturnLines:"Produkty",myReturnLineQuantities:"Zg\u0142oszono: {requested}, zaakceptowano: {approved}, odebrano: {received}",myReturnNote:"Twoje uwagi",myReturnHistory:"Historia",statusSubmitted:"Zg\u0142oszony",statusApproved:"Zaakceptowany",statusRejected:"Odrzucony",statusAwaitingReceipt:"Oczekiwanie na paczk\u0119",statusReceived:"Paczka odebrana",statusCompleted:"Zako\u0144czony",statusCancelled:"Anulowany",statusRefunded:"\u015Arodki zwr\xF3cone",statusFallback:"W trakcie",refundStatusNotStarted:"Nie rozpocz\u0119to",refundStatusPending:"Zwrot \u015Brodk\xF3w w toku",refundStatusSucceeded:"\u015Arodki zwr\xF3cone",refundStatusFailed:"Zwrot \u015Brodk\xF3w nie powi\xF3d\u0142 si\u0119",refundStatusFallback:"Nieznany",errorGeneric:"Co\u015B posz\u0142o nie tak. Spr\xF3buj ponownie.",errorInvalidEmail:"Podaj poprawny adres e-mail.",errorInvalidCode:"Kod jest nieprawid\u0142owy lub wygas\u0142.",errorSessionExpired:"Sesja wygas\u0142a. Zweryfikuj adres e-mail ponownie.",errorOrderNotFound:"Nie znaleziono tego zam\xF3wienia.",errorReturnNotFound:"Nie znaleziono tego zg\u0142oszenia zwrotu.",errorQuantityUnavailable:"Wybrana ilo\u015B\u0107 nie jest ju\u017C dost\u0119pna do zwrotu.",errorItemNotReturnable:"Jeden z wybranych produkt\xF3w nie podlega zwrotowi.",errorReturnsDisabled:"Zwroty nie s\u0105 dost\u0119pne w tym sklepie.",errorRateLimited:"Zbyt wiele pr\xF3b. Spr\xF3buj ponownie p\xF3\u017Aniej.",errorIdempotencyConflict:"To zg\u0142oszenie zosta\u0142o ju\u017C wys\u0142ane z inn\u0105 zawarto\u015Bci\u0105. Od\u015Bwie\u017C stron\u0119 i spr\xF3buj ponownie.",errorDeliveryFailed:"Nie uda\u0142o si\u0119 wys\u0142a\u0107 kodu. Spr\xF3buj ponownie.",errorRetry:"Spr\xF3buj ponownie"}};function ke(e,r){return _chunkQ25D7OAOjs.i.call(void 0, _t,e,r)}function ut(e,r){return e.replace(/\{(\w+)\}/g,(t,n)=>Object.prototype.hasOwnProperty.call(r,n)?String(r[n]):t)}var jt={submitted:"statusSubmitted",approved:"statusApproved",rejected:"statusRejected",awaiting_receipt:"statusAwaitingReceipt",received:"statusReceived",completed:"statusCompleted",cancelled:"statusCancelled",refunded:"statusRefunded"},Ut={not_started:"refundStatusNotStarted",pending:"refundStatusPending",succeeded:"refundStatusSucceeded",failed:"refundStatusFailed"};function lt(e){return _nullishCoalesce(jt[e], () => ("statusFallback"))}function ct(e){return _nullishCoalesce(Ut[e], () => ("refundStatusFallback"))}var Te=_react.createContext.call(void 0, {locale:"pl-PL",texts:ke("pl-PL")});function pt({texts:e,locale:r,children:t}){let n=_nullishCoalesce(r, () => (_chunkQ25D7OAOjs.m.call(void 0, ))),o=_react.useMemo.call(void 0, ()=>({locale:n,texts:ke(n,e)}),[n,e]);return _jsxruntime.jsx.call(void 0, Te.Provider,{value:o,children:t})}function h(){let{texts:e}=_react.useContext.call(void 0, Te);return _react.useCallback.call(void 0, (r,t)=>t==null?e[r]:ut(e[r],t),[e])}function Y(){return _react.useContext.call(void 0, Te).locale}var _connect = require('@connectrpc/connect');var _connectquery = require('@connectrpc/connect-query');var _reactquery = require('@tanstack/react-query');var _wkt = require('@bufbuild/protobuf/wkt');var Zt="bitsnap-returns-session:";function we(e){return`${Zt}${e}`}function oe(){try{return typeof window<"u"?window.sessionStorage:void 0}catch (e2){return}}function mt(e,r,t=Date.now()){if(e==null)return;let n=we(r);try{let o=e.getItem(n);if(o==null)return;let u=JSON.parse(o);if(u!=null&&typeof u=="object"&&typeof u.token=="string"&&u.token.length>0&&typeof u.expiresAt=="number"&&u.expiresAt>t){let{token:s,expiresAt:a}=u;return{token:s,expiresAt:a}}e.removeItem(n)}catch (e3){try{e.removeItem(n)}catch (e4){}}}function yt(e,r,t){try{_optionalChain([e, 'optionalAccess', _6 => _6.setItem, 'call', _7 => _7(we(r),JSON.stringify(t))])}catch (e5){}}function Ie(e,r){try{_optionalChain([e, 'optionalAccess', _8 => _8.removeItem, 'call', _9 => _9(we(r))])}catch (e6){}}function ae(e){return e==null?void 0:_wkt.timestampMs.call(void 0, e)}var Rt=_react.createContext.call(void 0, void 0);function T(e){let r=_react.useContext.call(void 0, Rt);if(r==null)throw new Error(`${e} must be rendered inside <ReturnsProvider>`);return r}function Ce(){return _connectquery.createConnectQueryKey.call(void 0, {schema:_chunkUFIOJGJZjs.i,cardinality:void 0})}var or=2**31-1;function ar({projectID:e,environment:r,transport:t,panelAccessToken:n,className:o,children:u}){let s=_reactquery.useQueryClient.call(void 0, ),{boundaryClassName:a,boundaryStyle:y}=Ne(),m=l("root"),[p,f]=_react.useState.call(void 0, {status:"hydrating"}),[c,b]=_react.useState.call(void 0, ),[g,C]=_react.useState.call(void 0, ),I=_react.useRef.call(void 0, void 0),N=_react.useCallback.call(void 0, ()=>{s.removeQueries({queryKey:Ce()})},[s]),B=_react.useCallback.call(void 0, ()=>{Ie(oe(),e),C(void 0),f({status:"anonymous"}),N()},[e,N]),w=_react.useCallback.call(void 0, k=>{yt(oe(),e,k),b(void 0),C(void 0),f({status:"authenticated",token:k.token,expiresAt:k.expiresAt})},[e]);_react.useEffect.call(void 0, ()=>{let k=!1,Q=oe();if(n==null||n===""){let O=I.current!=null;if(I.current=void 0,O){B();return}let q=mt(Q,e);f(q!=null?{status:"authenticated",token:q.token,expiresAt:q.expiresAt}:{status:"anonymous"});return}return I.current=n,Ie(Q,e),N(),b(void 0),f({status:"exchanging"}),_connect.createClient.call(void 0, _chunkUFIOJGJZjs.i,t).exchangePanelSession({projectId:e,accessToken:n,environment:r}).then(O=>{if(k)return;let q=ae(O.expiresAt);if(O.sessionToken===""||q==null)throw new Error("EMPTY_SESSION");w({token:O.sessionToken,expiresAt:q})}).catch(O=>{k||(b(O),f({status:"anonymous"}))}),()=>{k=!0}},[n,e,r,t]),_react.useEffect.call(void 0, ()=>{if(p.status!=="authenticated"||p.expiresAt==null)return;let k=p.expiresAt-Date.now();if(k<=0){B();return}let Q=setTimeout(B,Math.min(k,or));return()=>clearTimeout(Q)},[p.status,p.expiresAt,B]);let P=_react.useMemo.call(void 0, ()=>({projectID:e,environment:r,status:p.status,token:p.token,exchangeError:c,challenge:g,setChallenge:C,authenticate:w,clearSession:B}),[e,r,p.status,p.token,c,g,w,B]);return _jsxruntime.jsx.call(void 0, Rt.Provider,{value:P,children:_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-returns":"root","data-bitsnap-returns-slot":"root",className:_chunkQ25D7OAOjs.d.call(void 0, "bitsnap-react",a,o,m.className),style:{...y,...m.style},children:u})})}function ir({projectID:e,host:r,environment:t,appearance:n,texts:o,theme:u,locale:s,panelAccessToken:a,className:y,analytics:m,children:p}){let f=_chunkWGJTXDISjs.n.call(void 0, e,m,"returns"),c=_react.useContext.call(void 0, _reactquery.QueryClientContext),[b]=_react.useState.call(void 0, ()=>c==null?new (0, _reactquery.QueryClient)({defaultOptions:{queries:{staleTime:5e3}}}):void 0),g=_nullishCoalesce(r, () => (_chunkUFIOJGJZjs.m.call(void 0, ))),C=_react.useMemo.call(void 0, ()=>_chunkUFIOJGJZjs.n.call(void 0, g),[g]),I=_optionalChain([u, 'optionalAccess', _10 => _10.brandColor]),N=_react.useMemo.call(void 0, ()=>it(n,{brandColor:I}),[n,I]),B=_react.useMemo.call(void 0, ()=>at(o),[o]),w=_jsxruntime.jsx.call(void 0, _chunkWGJTXDISjs.l,{value:f,children:_jsxruntime.jsx.call(void 0, _connectquery.TransportProvider,{transport:C,children:_jsxruntime.jsx.call(void 0, nt,{appearance:N,children:_jsxruntime.jsx.call(void 0, pt,{texts:B,locale:s,children:_jsxruntime.jsx.call(void 0, ar,{projectID:e,environment:ot(t),transport:C,panelAccessToken:a,className:y,children:p})})})})});return c==null&&b!=null?_jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider,{client:b,children:w}):w}var Xr=ir;var ur="SESSION_EXPIRED",bt={INVALID_EMAIL:"errorInvalidEmail",INVALID_OR_EXPIRED_CODE:"errorInvalidCode",SESSION_EXPIRED:"errorSessionExpired",ORDER_NOT_FOUND:"errorOrderNotFound",RETURN_NOT_FOUND:"errorReturnNotFound",QUANTITY_UNAVAILABLE:"errorQuantityUnavailable",ITEM_NOT_RETURNABLE:"errorItemNotReturnable",INVALID_RETURN_ITEMS:"errorItemNotReturnable",RETURNS_DISABLED:"errorReturnsDisabled",SUBMISSION_RATE_LIMITED:"errorRateLimited",IDEMPOTENCY_CONFLICT:"errorIdempotencyConflict",VERIFICATION_DELIVERY_FAILED:"errorDeliveryFailed"};function xt(e){if(e==null||typeof e!="object")return;let{rawMessage:r,message:t}=e;if(typeof r=="string"&&r.length>0)return r;if(typeof t=="string")return Object.keys(bt).find(n=>t.includes(n))}function Pe(e){return xt(e)===ur}function St(e){let r=xt(e);return_nullishCoalesce((r!=null?bt[r]:void 0), () => ("errorGeneric"))}function Le(){let e=typeof globalThis<"u"?globalThis.crypto:void 0;if(typeof _optionalChain([e, 'optionalAccess', _11 => _11.randomUUID])=="function")return e.randomUUID();let r=new Uint8Array(16);if(typeof _optionalChain([e, 'optionalAccess', _12 => _12.getRandomValues])=="function")e.getRandomValues(r);else for(let t=0;t<r.length;t++)r[t]=Math.floor(Math.random()*256);return Array.from(r,t=>t.toString(16).padStart(2,"0")).join("")}function $(e){return e==null?null:e instanceof Error?e:new Error(String(e))}function X(e){return e==null?void 0:St(e)}function ce(e,r){_react.useEffect.call(void 0, ()=>{Pe(e)&&r()},[e,r])}function Nt(e){let[r,t]=_react.useState.call(void 0, [""]);return _react.useEffect.call(void 0, ()=>{t([""])},[e]),{pageToken:_nullishCoalesce(r[r.length-1], () => ("")),page:r.length,push:n=>t(o=>[...o,n]),pop:()=>t(n=>n.length>1?n.slice(0,-1):n)}}function de(){let e=T("useReturnSession"),r=_connectquery.useMutation.call(void 0, _chunkUFIOJGJZjs.j.returns.startReturnSession),t=_connectquery.useMutation.call(void 0, _chunkUFIOJGJZjs.j.returns.verifyReturnSession),{setChallenge:n,authenticate:o,clearSession:u}=e,s=_react.useCallback.call(void 0, async c=>{t.reset();let b=c.trim(),g=await r.mutateAsync({projectId:e.projectID,email:b,environment:e.environment});return n({challengeId:g.challengeId,email:b,resendAvailableAt:Date.now()+Math.max(0,g.resendAfterSeconds)*1e3}),g},[e.projectID,e.environment,n,r,t]),a=_react.useCallback.call(void 0, async c=>{let b=await t.mutateAsync({projectId:e.projectID,challengeId:c.challengeId,code:c.code,environment:e.environment}),g=ae(b.expiresAt);if(b.sessionToken===""||g==null)throw new Error("EMPTY_SESSION");return o({token:b.sessionToken,expiresAt:g}),b},[e.projectID,e.environment,o,t]),y=_react.useCallback.call(void 0, async c=>{try{return await s(c),!0}catch (e7){return!1}},[s]),m=_react.useCallback.call(void 0, async c=>{if(e.challenge==null)return!1;try{return await a({challengeId:e.challenge.challengeId,code:c.trim()}),!0}catch (e8){return!1}},[e.challenge,a]),p=_react.useCallback.call(void 0, ()=>e.challenge!=null?y(e.challenge.email):Promise.resolve(!1),[e.challenge,y]),f=$(_nullishCoalesce(_nullishCoalesce(r.error, () => (t.error)), () => (e.exchangeError)));return{status:e.status,isAuthenticated:e.status==="authenticated",challenge:e.challenge,isStarting:r.isPending,isVerifying:t.isPending,starting:r.isPending,verifying:t.isPending,error:f,errorKey:X(f),start:y,startSession:s,verifySession:a,verify:m,resend:p,logout:u}}function pe(e){return e.status==="hydrating"||e.status==="exchanging"}function ht(e,r){let t=T("useReturnOrders"),{pageSize:n,explicitPageToken:o}=he(e,r),u=Nt(t.token),s=_connectquery.useQuery.call(void 0, _chunkUFIOJGJZjs.j.returns.listReturnOrders,{projectId:t.projectID,sessionToken:_nullishCoalesce(t.token, () => ("")),pageSize:n,pageToken:_nullishCoalesce(o, () => (u.pageToken))},{enabled:t.token!=null});ce(s.error,t.clearSession);let a=_nullishCoalesce(_optionalChain([s, 'access', _13 => _13.data, 'optionalAccess', _14 => _14.nextPageToken]), () => (""));return{orders:_nullishCoalesce(_optionalChain([s, 'access', _15 => _15.data, 'optionalAccess', _16 => _16.orders]), () => ([])),total:_nullishCoalesce(_optionalChain([s, 'access', _17 => _17.data, 'optionalAccess', _18 => _18.total]), () => (0)),data:s.data,isLoading:pe(t)||s.isLoading,isFetching:s.isFetching,error:$(s.error),errorKey:X(s.error),status:s.status,isError:s.isError,isSuccess:s.isSuccess,page:u.page,hasNext:a!=="",hasPrevious:u.page>1,next:()=>{a!==""&&u.push(a)},previous:u.pop,refetch:()=>s.refetch()}}function Be(e){let r=T("useReturnableOrder"),t=_connectquery.useQuery.call(void 0, _chunkUFIOJGJZjs.j.returns.getReturnableOrder,{projectId:r.projectID,sessionToken:_nullishCoalesce(r.token, () => ("")),canonicalOrderId:_nullishCoalesce(e, () => (""))},{enabled:r.token!=null&&e!=null&&e!==""});return ce(t.error,r.clearSession),{order:_optionalChain([t, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.order]),returnHistory:_nullishCoalesce(_optionalChain([t, 'access', _21 => _21.data, 'optionalAccess', _22 => _22.returnHistory]), () => ([])),data:t.data,isLoading:e!=null&&e!==""&&(pe(r)||t.isLoading),error:$(t.error),errorKey:X(t.error),status:t.status,isError:t.isError,isSuccess:t.isSuccess,refetch:()=>t.refetch()}}function kt(){let e=T("useCreateReturn"),r=_reactquery.useQueryClient.call(void 0, ),t=_connectquery.useMutation.call(void 0, _chunkUFIOJGJZjs.j.returns.createReturnRequest),n=_chunkWGJTXDISjs.m.call(void 0, ),o=_react.useRef.call(void 0, void 0),{clearSession:u}=e,s=_react.useCallback.call(void 0, async(p,f)=>{try{let c=await t.mutateAsync({projectId:e.projectID,sessionToken:_nullishCoalesce(e.token, () => ("")),canonicalOrderId:p.orderId,items:p.items,note:_nullishCoalesce(p.note, () => ("")),idempotencyKey:f});return r.invalidateQueries({queryKey:Ce()}),n.track("return_submitted",{reason_code:"unspecified",item_count:p.items.length},{order_ref:null}),c}catch(c){throw Pe(c)&&u(),c}},[e.projectID,e.token,t,r,u,n]),a=_react.useCallback.call(void 0, async p=>{o.current??=Le();try{let f=await s(p,o.current);return o.current=void 0,f.request}catch (e9){return}},[s]),y=_react.useCallback.call(void 0, async p=>{if(e.token==null)throw new Error("Verify your email to continue.");return s({orderId:p.canonicalOrderID,items:p.items,note:p.note},_nullishCoalesce(p.idempotencyKey, () => (Le())))},[e.token,s]),m=_react.useCallback.call(void 0, (p,f)=>{y(p).then(c=>_optionalChain([f, 'optionalAccess', _23 => _23.onSuccess, 'optionalCall', _24 => _24(c)]),c=>_optionalChain([f, 'optionalAccess', _25 => _25.onError, 'optionalCall', _26 => _26($(c))]))},[y]);return{submit:a,isPending:t.isPending,error:$(t.error),errorKey:X(t.error),mutateAsync:y,mutate:m,data:t.data,reset:t.reset,status:t.status,isError:t.isError,isSuccess:t.isSuccess}}function Tt(e,r){let t=T("useMyReturns"),{pageSize:n,explicitPageToken:o}=he(e,r),u=Nt(t.token),s=_connectquery.useQuery.call(void 0, _chunkUFIOJGJZjs.j.returns.listMyReturns,{projectId:t.projectID,sessionToken:_nullishCoalesce(t.token, () => ("")),pageSize:n,pageToken:_nullishCoalesce(o, () => (u.pageToken))},{enabled:t.token!=null});ce(s.error,t.clearSession);let a=_nullishCoalesce(_optionalChain([s, 'access', _27 => _27.data, 'optionalAccess', _28 => _28.nextPageToken]), () => (""));return{returns:_nullishCoalesce(_optionalChain([s, 'access', _29 => _29.data, 'optionalAccess', _30 => _30.returns]), () => ([])),total:_nullishCoalesce(_optionalChain([s, 'access', _31 => _31.data, 'optionalAccess', _32 => _32.total]), () => (0)),data:s.data,isLoading:pe(t)||s.isLoading,isFetching:s.isFetching,error:$(s.error),errorKey:X(s.error),status:s.status,isError:s.isError,isSuccess:s.isSuccess,page:u.page,hasNext:a!=="",hasPrevious:u.page>1,next:()=>{a!==""&&u.push(a)},previous:u.pop,refetch:()=>s.refetch()}}function me(e){let r=T("useMyReturn"),t=_connectquery.useQuery.call(void 0, _chunkUFIOJGJZjs.j.returns.getMyReturn,{projectId:r.projectID,sessionToken:_nullishCoalesce(r.token, () => ("")),returnId:e},{enabled:r.token!=null});return ce(t.error,r.clearSession),{request:_optionalChain([t, 'access', _33 => _33.data, 'optionalAccess', _34 => _34.request]),isLoading:pe(r)||t.isLoading,error:t.error,errorKey:X(t.error),refetch:()=>t.refetch()}}var _reactlabel = require('@radix-ui/react-label'); var wt = _interopRequireWildcard(_reactlabel);function te({className:e,...r}){return _jsxruntime.jsx.call(void 0, wt.Root,{"data-slot":"label",className:_chunkQ25D7OAOjs.d.call(void 0, "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...r})}var _lucidereact = require('lucide-react');function re({className:e,...r}){return _jsxruntime.jsx.call(void 0, _lucidereact.Loader2Icon,{role:"status","aria-label":"Loading",className:_chunkQ25D7OAOjs.d.call(void 0, "size-4 animate-spin",e),...r})}var H="bg-[var(--bitsnap-returns-button-background,#18181b)] text-[color:var(--bitsnap-returns-button-foreground,#fafafa)] hover:bg-[var(--bitsnap-returns-button-hover-background,#000000)] focus-visible:ring-[color:var(--bitsnap-returns-focus-ring,#71717a)]/50",L="border border-[color:var(--bitsnap-returns-border,#e4e4e7)] bg-transparent text-[color:var(--bitsnap-returns-foreground,#18181b)] hover:bg-[var(--bitsnap-returns-hover-surface,#f4f4f5)] focus-visible:ring-[color:var(--bitsnap-returns-focus-ring,#71717a)]/50",G="bg-[var(--bitsnap-returns-input-background,#ffffff)] dark:bg-[var(--bitsnap-returns-input-background,#ffffff)] border-[color:var(--bitsnap-returns-border,#e4e4e7)] text-[color:var(--bitsnap-returns-foreground,#18181b)] placeholder:text-[color:var(--bitsnap-returns-muted-foreground,#71717a)] focus-visible:border-[color:var(--bitsnap-returns-focus-ring,#71717a)] focus-visible:ring-[color:var(--bitsnap-returns-focus-ring,#71717a)]/50";function M({title:e,description:r,onBack:t,className:n,children:o}){let u=h(),s=l("header"),a=l("title"),y=l("description"),m=l("backButton");return _jsxruntime.jsxs.call(void 0, "section",{className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-5",n),children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-returns-slot":"header",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-2",s.className),style:s.style,children:[t!=null&&_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"ghost",size:"sm","data-bitsnap-returns-slot":"backButton",className:_chunkQ25D7OAOjs.d.call(void 0, "self-start -ml-3 text-[color:var(--bitsnap-returns-muted-foreground,#71717a)] hover:bg-[var(--bitsnap-returns-hover-surface,#f4f4f5)]",m.className),style:m.style,onClick:t,children:u("back")}),_jsxruntime.jsx.call(void 0, "h2",{"data-bitsnap-returns-slot":"title",className:_chunkQ25D7OAOjs.d.call(void 0, "text-2xl font-semibold",a.className),style:a.style,children:e}),r!=null&&_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"description",className:_chunkQ25D7OAOjs.d.call(void 0, "text-sm",y.className),style:y.style,children:r})]}),o]})}function A({errorKey:e,onRetry:r}){let t=h(),n=l("error"),o=l("secondaryButton");return _jsxruntime.jsxs.call(void 0, "div",{role:"alert","data-bitsnap-returns-slot":"error",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col items-start gap-2 text-sm",n.className),style:n.style,children:[_jsxruntime.jsx.call(void 0, "p",{children:t(e)}),r!=null&&_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary",size:"sm","data-bitsnap-returns-slot":"secondaryButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,o.className),style:o.style,onClick:r,children:t("errorRetry")})]})}function fe({children:e}){let r=l("emptyState");return _jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"emptyState",className:_chunkQ25D7OAOjs.d.call(void 0, "py-6 text-center text-sm",r.className),style:r.style,children:e})}function U({rows:e=3}){let r=h(),t=l("skeleton");return _jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true","aria-label":r("loading"),className:"flex flex-col gap-3",children:Array.from({length:e},(n,o)=>_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.u,{"data-bitsnap-returns-slot":"skeleton",className:_chunkQ25D7OAOjs.d.call(void 0, "h-16 w-full bg-[var(--bitsnap-returns-hover-surface,#f4f4f5)]",t.className),style:t.style},o))})}function J({status:e}){let r=h(),t=l("statusBadge");return _jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"statusBadge","data-status":e,className:_chunkQ25D7OAOjs.d.call(void 0, "inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",t.className),style:t.style,children:r(lt(e))})}function ze(){let e=h();return r=>e(ct(r))}function ge({page:e,total:r,hasNext:t,hasPrevious:n,isFetching:o,onNext:u,onPrevious:s}){let a=h(),y=l("pagination"),m=l("secondaryButton");return!t&&!n?null:_jsxruntime.jsxs.call(void 0, "nav",{"data-bitsnap-returns-slot":"pagination",className:_chunkQ25D7OAOjs.d.call(void 0, "flex items-center justify-between gap-3 text-sm",y.className),style:y.style,children:[_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary",size:"sm","data-bitsnap-returns-slot":"secondaryButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,m.className),style:m.style,disabled:!n||o,onClick:s,children:a("paginationPrevious")}),_jsxruntime.jsx.call(void 0, "span",{"aria-live":"polite",children:a("paginationInfo",{page:e,total:r})}),_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary",size:"sm","data-bitsnap-returns-slot":"secondaryButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,m.className),style:m.style,disabled:!t||o,onClick:u,children:a("paginationNext")})]})}function Kn({onSubmitted:e,className:r}){T("ReturnsEmailStep");let t=h(),n=de(),[o,u]=_react.useState.call(void 0, ""),s=l("emailForm"),a=l("emailInput"),y=l("submitButton");async function m(p){p.preventDefault(),!n.isStarting&&await n.start(o)&&_optionalChain([e, 'optionalCall', _35 => _35(o.trim())])}return _jsxruntime.jsx.call(void 0, M,{className:r,title:t("emailStepTitle"),description:t("emailStepDescription"),children:_jsxruntime.jsxs.call(void 0, "form",{"data-bitsnap-returns-slot":"emailForm",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-4",s.className),style:s.style,onSubmit:m,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, te,{htmlFor:"bitsnap-returns-email",children:t("emailLabel")}),_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.r,{id:"bitsnap-returns-email",type:"email",name:"email",autoComplete:"email",required:!0,value:o,placeholder:t("emailPlaceholder"),disabled:n.isStarting,"data-bitsnap-returns-slot":"emailInput",className:_chunkQ25D7OAOjs.d.call(void 0, G,a.className),style:a.style,onChange:p=>u(p.target.value)})]}),n.errorKey!=null&&_jsxruntime.jsx.call(void 0, A,{errorKey:n.errorKey}),_jsxruntime.jsxs.call(void 0, _chunkUFIOJGJZjs.q,{type:"submit",disabled:n.isStarting,"data-bitsnap-returns-slot":"submitButton",className:_chunkQ25D7OAOjs.d.call(void 0, H,y.className),style:y.style,children:[n.isStarting&&_jsxruntime.jsx.call(void 0, re,{}),t("emailSubmit")]})]})})}function gr(e){let[r,t]=_react.useState.call(void 0, );return _react.useEffect.call(void 0, ()=>{if(e==null)return;t(Date.now());let n=setInterval(()=>{let o=Date.now();t(o),o>=e&&clearInterval(n)},1e3);return()=>clearInterval(n)},[e]),e!=null&&r!=null?Math.max(0,Math.ceil((e-r)/1e3)):0}function _n({onVerified:e,onBack:r,className:t}){T("ReturnsCodeStep");let n=h(),o=de(),[u,s]=_react.useState.call(void 0, ""),a=gr(_optionalChain([o, 'access', _36 => _36.challenge, 'optionalAccess', _37 => _37.resendAvailableAt])),y=l("codeForm"),m=l("codeInput"),p=l("submitButton"),f=l("resendButton"),c=o.isVerifying||o.isStarting;async function b(g){g.preventDefault(),!c&&await o.verify(u)&&_optionalChain([e, 'optionalCall', _38 => _38()])}return _jsxruntime.jsx.call(void 0, M,{className:t,onBack:r,title:n("codeStepTitle"),description:n("codeStepDescription",{email:_nullishCoalesce(_optionalChain([o, 'access', _39 => _39.challenge, 'optionalAccess', _40 => _40.email]), () => (""))}),children:_jsxruntime.jsxs.call(void 0, "form",{"data-bitsnap-returns-slot":"codeForm",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-4",y.className),style:y.style,onSubmit:b,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, te,{htmlFor:"bitsnap-returns-code",children:n("codeLabel")}),_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.r,{id:"bitsnap-returns-code",name:"code",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:u,disabled:c,"data-bitsnap-returns-slot":"codeInput",className:_chunkQ25D7OAOjs.d.call(void 0, G,m.className),style:m.style,onChange:g=>s(g.target.value)})]}),o.errorKey!=null&&_jsxruntime.jsx.call(void 0, A,{errorKey:o.errorKey}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap items-center gap-3",children:[_jsxruntime.jsxs.call(void 0, _chunkUFIOJGJZjs.q,{type:"submit",disabled:c||o.challenge==null,"data-bitsnap-returns-slot":"submitButton",className:_chunkQ25D7OAOjs.d.call(void 0, H,p.className),style:p.style,children:[o.isVerifying&&_jsxruntime.jsx.call(void 0, re,{}),n("codeSubmit")]}),_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary",disabled:c||a>0||o.challenge==null,"data-bitsnap-returns-slot":"resendButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,f.className),style:f.style,onClick:()=>void o.resend(),children:a>0?n("resendIn",{seconds:a}):n("resend")})]})]})})}function It(){let e=h(),r=de(),t=l("logoutButton");return _jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"ghost",size:"sm","data-bitsnap-returns-slot":"logoutButton",className:_chunkQ25D7OAOjs.d.call(void 0, "text-[color:var(--bitsnap-returns-muted-foreground,#71717a)] hover:bg-[var(--bitsnap-returns-hover-surface,#f4f4f5)]",t.className),style:t.style,onClick:r.logout,children:e("logout")})}function Z(e,r){if(e==null)return"";let t=_wkt.timestampDate.call(void 0, e);try{return new Intl.DateTimeFormat(r,{dateStyle:"medium"}).format(t)}catch (e10){return t.toISOString().slice(0,10)}}function ee(e,r,t){let n=typeof e=="bigint"?e:BigInt(Math.trunc(e));try{let o=new Intl.NumberFormat(t,{style:"currency",currency:r}),u=_nullishCoalesce(o.resolvedOptions().maximumFractionDigits, () => (2));return o.format(Et(n,u))}catch (e11){return`${Et(n,2)} ${r}`}}function Et(e,r){let t=e<BigInt(0),n=t?-e:e;if(r<=0)return`${t?"-":""}${n}`;let o=BigInt(10)**BigInt(r),u=n/o,s=(n%o).toString().padStart(r,"0");return`${t?"-":""}${u}.${s}`}function Ct(e,r){return Number.isFinite(e)?Math.min(Math.max(0,Math.trunc(e)),Math.max(0,r)):0}function Oe(e){return e.eligible&&e.availableQuantity>0}function Pt(e,r){return e.map(t=>({lineId:t,quantity:_nullishCoalesce(r[t], () => (0))})).filter(t=>t.quantity>0)}function cs({onSelectOrder:e,onOpenMyReturns:r,showLogout:t=!0,pageSize:n,className:o}){T("ReturnsOrderList");let u=h(),s=Y(),a=ht({pageSize:n}),y=l("orderList"),m=l("orderCard"),p=l("orderReference"),f=l("orderDate"),c=l("orderTotal"),b=l("secondaryButton");return _jsxruntime.jsxs.call(void 0, M,{className:o,title:u("ordersTitle"),description:u("ordersDescription"),children:[(t||r!=null)&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r!=null?_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary",size:"sm","data-bitsnap-returns-slot":"secondaryButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,b.className),style:b.style,onClick:r,children:u("myReturnsLink")}):_jsxruntime.jsx.call(void 0, "span",{}),t&&_jsxruntime.jsx.call(void 0, It,{})]}),a.isLoading?_jsxruntime.jsx.call(void 0, U,{}):a.errorKey!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:a.errorKey,onRetry:a.refetch}):a.orders.length===0?_jsxruntime.jsx.call(void 0, fe,{children:u("ordersEmpty")}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"orderList",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-3",y.className),style:y.style,children:a.orders.map(g=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"orderCard",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-wrap items-center justify-between gap-3 border p-4",m.className),style:m.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"orderReference",className:_chunkQ25D7OAOjs.d.call(void 0, "font-medium",p.className),style:p.style,children:u("orderTitle",{reference:g.displayReference})}),_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"orderDate",className:_chunkQ25D7OAOjs.d.call(void 0, "text-sm",f.className),style:f.style,children:Z(g.purchasedAt,s)}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:u("orderReturnableLines",{count:g.returnableLineCount})})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-4",children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"orderTotal",className:_chunkQ25D7OAOjs.d.call(void 0, "font-medium",c.className),style:c.style,children:ee(g.totalMinor,g.currency,s)}),_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary",size:"sm","aria-label":`${u("orderSelect")}: ${u("orderTitle",{reference:g.displayReference})}`,"data-bitsnap-returns-slot":"secondaryButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,b.className),style:b.style,onClick:()=>_optionalChain([e, 'optionalCall', _41 => _41(g.canonicalOrderId)]),children:u("orderSelect")})]})]},g.canonicalOrderId))}),_jsxruntime.jsx.call(void 0, ge,{page:a.page,total:a.total,hasNext:a.hasNext,hasPrevious:a.hasPrevious,isFetching:a.isFetching,onNext:a.next,onPrevious:a.previous})]})]})}function ds({orderId:e,onContinue:r,onBack:t,initialItems:n,initialNote:o,className:u}){T("ReturnsOrderDetail");let s=_chunkWGJTXDISjs.m.call(void 0, );_react.useEffect.call(void 0, ()=>{s.track("return_started",{},{order_ref:null})},[s]);let a=h(),y=Y(),{order:m,returnHistory:p,isLoading:f,errorKey:c,refetch:b}=Be(e),[g,C]=_react.useState.call(void 0, ()=>Object.fromEntries((_nullishCoalesce(n, () => ([]))).map(R=>[R.lineId,R.quantity]))),[I,N]=_react.useState.call(void 0, _nullishCoalesce(o, () => (""))),[B,w]=_react.useState.call(void 0, !1),P=l("lineList"),k=l("line"),Q=l("lineName"),O=l("linePrice"),q=l("lineQuantityControl"),ne=l("quantityButton"),Me=l("quantityInput"),qe=l("lineIneligibleReason"),Ke=l("noteInput"),_e=l("submitButton"),je=l("history"),Ue=l("historyEntry");function Re(R,V){w(!1),C(F=>({...F,[R.lineId]:Ct(V,R.availableQuantity)}))}function At(R){if(R.preventDefault(),m==null)return;let V=Pt(m.lines.filter(Oe).map(F=>F.lineId),g);if(V.length===0){w(!0);return}_optionalChain([r, 'optionalCall', _42 => _42({items:V,note:I.trim()})])}return _jsxruntime.jsx.call(void 0, M,{className:u,onBack:t,title:a("orderDetailTitle",{reference:_nullishCoalesce(_optionalChain([m, 'optionalAccess', _43 => _43.displayReference]), () => (""))}),description:a("orderDetailDescription"),children:f?_jsxruntime.jsx.call(void 0, U,{}):c!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:c,onRetry:b}):m==null?null:_jsxruntime.jsxs.call(void 0, "form",{className:"flex flex-col gap-5",onSubmit:At,children:[_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"lineList",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-3",P.className),style:P.style,children:m.lines.map(R=>{let V=Oe(R),F=_nullishCoalesce(g[R.lineId], () => (0)),be=`bitsnap-returns-quantity-${R.lineId}`;return _jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"line","data-selected":F>0?"":void 0,"data-ineligible":V?void 0:"",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-3 border p-4",k.className),style:k.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"lineName",className:_chunkQ25D7OAOjs.d.call(void 0, "font-medium",Q.className),style:Q.style,children:R.name}),_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"linePrice",className:_chunkQ25D7OAOjs.d.call(void 0, "text-sm",O.className),style:O.style,children:ee(R.paidUnitMinor,R.currency,y)})]}),V?_jsxruntime.jsxs.call(void 0, "div",{role:"group","aria-label":a("quantityLabel",{name:R.name}),"data-bitsnap-returns-slot":"lineQuantityControl",className:_chunkQ25D7OAOjs.d.call(void 0, "flex items-center gap-2",q.className),style:q.style,children:[_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary",size:"icon-sm","aria-label":a("quantityDecrease",{name:R.name}),"aria-controls":be,disabled:F<=0,"data-bitsnap-returns-slot":"quantityButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,ne.className),style:ne.style,onClick:()=>Re(R,F-1),children:_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":"true",children:"-"})}),_jsxruntime.jsx.call(void 0, "input",{id:be,type:"number",inputMode:"numeric",min:0,max:R.availableQuantity,step:1,value:F,"aria-label":a("quantityLabel",{name:R.name}),"data-bitsnap-returns-slot":"quantityInput",className:_chunkQ25D7OAOjs.d.call(void 0, "h-8 w-16 rounded-md border px-2 text-center text-sm outline-none focus-visible:ring-[3px]",G,Me.className),style:Me.style,onChange:Bt=>Re(R,Bt.target.valueAsNumber)}),_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary",size:"icon-sm","aria-label":a("quantityIncrease",{name:R.name}),"aria-controls":be,disabled:F>=R.availableQuantity,"data-bitsnap-returns-slot":"quantityButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,ne.className),style:ne.style,onClick:()=>Re(R,F+1),children:_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":"true",children:"+"})}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:a("quantityOfAvailable",{available:R.availableQuantity})})]}):_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"lineIneligibleReason",className:_chunkQ25D7OAOjs.d.call(void 0, "text-sm",qe.className),style:qe.style,children:R.exclusionReason!==""?R.exclusionReason:a("lineIneligibleFallback")})]},R.lineId)})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, te,{htmlFor:"bitsnap-returns-note",children:a("noteLabel")}),_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.v,{id:"bitsnap-returns-note",name:"note",rows:3,maxLength:1e3,value:I,placeholder:a("notePlaceholder"),"data-bitsnap-returns-slot":"noteInput",className:_chunkQ25D7OAOjs.d.call(void 0, G,"dark:border-[color:var(--bitsnap-returns-border,#e4e4e7)] dark:placeholder:text-[color:var(--bitsnap-returns-muted-foreground,#71717a)] dark:focus-visible:ring-[color:var(--bitsnap-returns-focus-ring,#71717a)]",Ke.className),style:Ke.style,onChange:R=>N(R.target.value)})]}),B&&_jsxruntime.jsx.call(void 0, A,{errorKey:"selectionEmpty"}),_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"submit","data-bitsnap-returns-slot":"submitButton",className:_chunkQ25D7OAOjs.d.call(void 0, H,_e.className),style:_e.style,children:a("selectionContinue")}),p.length>0&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-sm font-medium",children:a("previousReturnsTitle")}),_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"history",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-2",je.className),style:je.style,children:p.map(R=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"historyEntry",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-wrap items-center justify-between gap-2 text-sm",Ue.className),style:Ue.style,children:[_jsxruntime.jsx.call(void 0, "span",{children:R.reference}),_jsxruntime.jsx.call(void 0, "span",{children:Z(R.createdAt,y)}),_jsxruntime.jsx.call(void 0, J,{status:R.status})]},R.id))})]})]})})}function ps({orderId:e,items:r,note:t,onSubmitted:n,onBack:o,className:u}){T("ReturnsConfirmation");let s=h(),a=Y(),{order:y,isLoading:m,errorKey:p,refetch:f}=Be(e),c=kt(),b=l("summary"),g=l("line"),C=l("lineName"),I=l("linePrice"),N=l("submitButton");async function B(w){if(w.preventDefault(),c.isPending)return;let P=await c.submit({orderId:e,items:r.map(k=>({lineId:k.lineId,quantity:k.quantity})),note:t});P!=null&&_optionalChain([n, 'optionalCall', _44 => _44(P.id,P)])}return _jsxruntime.jsx.call(void 0, M,{className:u,onBack:o,title:s("confirmationTitle"),description:s("confirmationDescription"),children:m?_jsxruntime.jsx.call(void 0, U,{rows:2}):p!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:p,onRetry:f}):_jsxruntime.jsxs.call(void 0, "form",{className:"flex flex-col gap-5",onSubmit:B,children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-returns-slot":"summary",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-3 border p-4",b.className),style:b.style,children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-sm font-medium",children:s("confirmationSummary")}),_jsxruntime.jsx.call(void 0, "ul",{className:"flex flex-col gap-3",children:r.map(w=>{let P=_optionalChain([y, 'optionalAccess', _45 => _45.lines, 'access', _46 => _46.find, 'call', _47 => _47(k=>k.lineId===w.lineId)]);return _jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"line",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-wrap items-baseline justify-between gap-2",g.className),style:g.style,children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"lineName",className:_chunkQ25D7OAOjs.d.call(void 0, "font-medium",C.className),style:C.style,children:_nullishCoalesce(_optionalChain([P, 'optionalAccess', _48 => _48.name]), () => (w.lineId))}),_jsxruntime.jsxs.call(void 0, "span",{"data-bitsnap-returns-slot":"linePrice",className:_chunkQ25D7OAOjs.d.call(void 0, "text-sm",I.className),style:I.style,children:[s("confirmationQuantity",{quantity:w.quantity}),P!=null&&` \xB7 ${ee(P.paidUnitMinor*BigInt(w.quantity),P.currency,a)}`]})]},w.lineId)})}),t!=null&&t!==""&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 text-sm",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:s("confirmationNote")}),_jsxruntime.jsx.call(void 0, "span",{className:"whitespace-pre-wrap",children:t})]})]}),c.errorKey!=null&&_jsxruntime.jsx.call(void 0, A,{errorKey:c.errorKey}),_jsxruntime.jsxs.call(void 0, _chunkUFIOJGJZjs.q,{type:"submit",disabled:c.isPending||r.length===0,"data-bitsnap-returns-slot":"submitButton",className:_chunkQ25D7OAOjs.d.call(void 0, H,N.className),style:N.style,children:[c.isPending&&_jsxruntime.jsx.call(void 0, re,{}),s("confirmationSubmit")]})]})})}function ms({returnId:e,onContinue:r,onOpenMyReturns:t,className:n}){T("ReturnsResult");let o=h(),{request:u,isLoading:s,errorKey:a,refetch:y}=me(e),m=l("successState"),p=l("returnReference"),f=l("returnInstructions"),c=l("submitButton"),b=l("secondaryButton");return _jsxruntime.jsxs.call(void 0, "section",{className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-5",n),children:[_jsxruntime.jsxs.call(void 0, "div",{role:"status","data-bitsnap-returns-slot":"successState",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-4 border p-5",m.className),style:m.style,children:[_jsxruntime.jsx.call(void 0, "h2",{className:"text-2xl font-semibold",children:o("successTitle")}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",children:o("successDescription")}),s?_jsxruntime.jsx.call(void 0, U,{rows:2}):a!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:a,onRetry:y}):u!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:o("successReference")}),_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"returnReference",className:_chunkQ25D7OAOjs.d.call(void 0, "text-lg font-semibold",p.className),style:p.style,children:u.reference})]}),u.returnInstructions!==""&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-medium",children:o("successInstructions")}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"returnInstructions",className:_chunkQ25D7OAOjs.d.call(void 0, "whitespace-pre-wrap border p-3 text-sm",f.className),style:f.style,children:u.returnInstructions})]})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap gap-3",children:[_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button","data-bitsnap-returns-slot":"submitButton",className:_chunkQ25D7OAOjs.d.call(void 0, H,c.className),style:c.style,onClick:r,children:o("successDone")}),t!=null&&_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary","data-bitsnap-returns-slot":"secondaryButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,b.className),style:b.style,onClick:t,children:o("myReturnsLink")})]})]})}function Ts({onSelectReturn:e,onBack:r,pageSize:t,className:n}){T("ReturnsMyReturnsList");let o=h(),u=Y(),s=ze(),a=Tt({pageSize:t}),y=l("returnList"),m=l("returnCard"),p=l("returnReference"),f=l("secondaryButton");return _jsxruntime.jsx.call(void 0, M,{className:n,onBack:r,title:o("myReturnsTitle"),description:o("myReturnsDescription"),children:a.isLoading?_jsxruntime.jsx.call(void 0, U,{}):a.errorKey!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:a.errorKey,onRetry:a.refetch}):a.returns.length===0?_jsxruntime.jsx.call(void 0, fe,{children:o("myReturnsEmpty")}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"returnList",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-3",y.className),style:y.style,children:a.returns.map(c=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"returnCard",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-wrap items-center justify-between gap-3 border p-4",m.className),style:m.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"returnReference",className:_chunkQ25D7OAOjs.d.call(void 0, "font-medium",p.className),style:p.style,children:c.reference}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:Z(c.createdAt,u)}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-sm",children:[o("myReturnRefund"),": ",s(c.refundStatus)]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, J,{status:c.status}),_jsxruntime.jsx.call(void 0, _chunkUFIOJGJZjs.q,{type:"button",variant:"secondary",size:"sm","aria-label":`${o("myReturnOpen")}: ${c.reference}`,"data-bitsnap-returns-slot":"secondaryButton",className:_chunkQ25D7OAOjs.d.call(void 0, L,f.className),style:f.style,onClick:()=>_optionalChain([e, 'optionalCall', _49 => _49(c.id)]),children:o("myReturnOpen")})]})]},c.id))}),_jsxruntime.jsx.call(void 0, ge,{page:a.page,total:a.total,hasNext:a.hasNext,hasPrevious:a.hasPrevious,isFetching:a.isFetching,onNext:a.next,onPrevious:a.previous})]})})}function ws({returnId:e,onBack:r,className:t}){T("ReturnsMyReturnDetail");let n=h(),o=Y(),u=ze(),{request:s,isLoading:a,errorKey:y,refetch:m}=me(e),p=l("summary"),f=l("lineList"),c=l("line"),b=l("lineName"),g=l("returnInstructions"),C=l("history"),I=l("historyEntry");return _jsxruntime.jsx.call(void 0, M,{className:t,onBack:r,title:s!=null?n("myReturnTitle",{reference:s.reference}):n("myReturnDetailTitle"),children:a?_jsxruntime.jsx.call(void 0, U,{}):y!=null?_jsxruntime.jsx.call(void 0, A,{errorKey:y,onRetry:m}):s!=null&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-5",children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-returns-slot":"summary",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-2 border p-4 text-sm",p.className),style:p.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between gap-2",children:[_jsxruntime.jsx.call(void 0, J,{status:s.status}),_jsxruntime.jsxs.call(void 0, "span",{children:[n("myReturnCreatedAt"),":"," ",Z(s.createdAt,o)]})]}),_jsxruntime.jsxs.call(void 0, "span",{children:[n("myReturnRefund"),": ",u(s.refundStatus),s.refundAmountMinor>BigInt(0)&&` \xB7 ${ee(s.refundAmountMinor,s.currency,o)}`]}),s.customerNote!==""&&_jsxruntime.jsxs.call(void 0, "span",{className:"whitespace-pre-wrap",children:[n("myReturnNote"),": ",s.customerNote]})]}),s.returnInstructions!==""&&_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-returns-slot":"returnInstructions",className:_chunkQ25D7OAOjs.d.call(void 0, "whitespace-pre-wrap border p-3 text-sm",g.className),style:g.style,children:s.returnInstructions}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-sm font-medium",children:n("myReturnLines")}),_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"lineList",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-3",f.className),style:f.style,children:s.lines.map(N=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"line",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-wrap items-baseline justify-between gap-2 border p-4",c.className),style:c.style,children:[_jsxruntime.jsx.call(void 0, "span",{"data-bitsnap-returns-slot":"lineName",className:_chunkQ25D7OAOjs.d.call(void 0, "font-medium",b.className),style:b.style,children:N.name}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:n("myReturnLineQuantities",{requested:N.requestedQuantity,approved:N.approvedQuantity,received:N.receivedQuantity})})]},N.lineId))})]}),s.history.length>0&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-sm font-medium",children:n("myReturnHistory")}),_jsxruntime.jsx.call(void 0, "ul",{"data-bitsnap-returns-slot":"history",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-col gap-2",C.className),style:C.style,children:s.history.map(N=>_jsxruntime.jsxs.call(void 0, "li",{"data-bitsnap-returns-slot":"historyEntry",className:_chunkQ25D7OAOjs.d.call(void 0, "flex flex-wrap items-center justify-between gap-2 text-sm",I.className),style:I.style,children:[_jsxruntime.jsx.call(void 0, J,{status:N.status}),_jsxruntime.jsx.call(void 0, "span",{children:Z(N.createdAt,o)})]},N.id))})]})]})})}exports.a = te; exports.b = re; exports.c = vr; exports.d = nt; exports.e = Ne; exports.f = l; exports.g = Pe; exports.h = St; exports.i = h; exports.j = T; exports.k = ir; exports.l = Xr; exports.m = de; exports.n = ht; exports.o = Be; exports.p = kt; exports.q = Tt; exports.r = me; exports.s = U; exports.t = Kn; exports.u = _n; exports.v = cs; exports.w = ds; exports.x = ps; exports.y = ms; exports.z = Ts; exports.A = ws;
2
+ //# sourceMappingURL=chunk-UCL4Y7L3.js.map