bitsnap-react 1.18.1 → 1.19.0

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 (146) hide show
  1. package/AGENTS.md +21 -0
  2. package/README.md +45 -0
  3. package/dist/BitsnapCart-E72W5RRZ.mjs +2 -0
  4. package/dist/BitsnapCart-LHJ6KOTV.css +2 -0
  5. package/dist/BitsnapCart-LHJ6KOTV.css.map +1 -0
  6. package/dist/BitsnapCart-Q2HER6GU.js +2 -0
  7. package/dist/BitsnapCart-Q2HER6GU.js.map +1 -0
  8. package/dist/CartProvider-677CE2FI.js +2 -0
  9. package/dist/CartProvider-677CE2FI.js.map +1 -0
  10. package/dist/CartProvider-YPDOFSYC.mjs +2 -0
  11. package/dist/PanelModelFiles-EKQRLF46.js.map +1 -1
  12. package/dist/analytics.js +1 -1
  13. package/dist/analytics.js.map +1 -1
  14. package/dist/analytics.mjs +1 -1
  15. package/dist/catalog.js +1 -1
  16. package/dist/catalog.js.map +1 -1
  17. package/dist/catalog.mjs +1 -1
  18. package/dist/chat.css +2 -0
  19. package/dist/chat.css.map +1 -0
  20. package/dist/chat.d.mts +172 -0
  21. package/dist/chat.d.ts +172 -0
  22. package/dist/chat.js +2 -0
  23. package/dist/chat.js.map +1 -0
  24. package/dist/chat.mjs +2 -0
  25. package/dist/chat.mjs.map +1 -0
  26. package/dist/chunk-2FD2QP4Y.js +2 -0
  27. package/dist/chunk-2FD2QP4Y.js.map +1 -0
  28. package/dist/chunk-5JRUPLXY.mjs +2 -0
  29. package/dist/chunk-5JRUPLXY.mjs.map +1 -0
  30. package/dist/chunk-5M6M7FAR.mjs +2 -0
  31. package/dist/chunk-5M6M7FAR.mjs.map +1 -0
  32. package/dist/chunk-6Q3VGPSF.js.map +1 -1
  33. package/dist/chunk-AAC576BC.mjs +5 -0
  34. package/dist/chunk-AAC576BC.mjs.map +1 -0
  35. package/dist/{chunk-ZKT4N553.mjs → chunk-AB37DWOK.mjs} +2 -2
  36. package/dist/{chunk-AHISXVEE.js → chunk-BUYTK7KM.js} +2 -2
  37. package/dist/chunk-BUYTK7KM.js.map +1 -0
  38. package/dist/{chunk-G4SEOVLD.js → chunk-D2ASWUXM.js} +2 -2
  39. package/dist/chunk-D2ASWUXM.js.map +1 -0
  40. package/dist/chunk-DDIEFKNP.mjs +2 -0
  41. package/dist/{chunk-ZM5T4TQW.mjs.map → chunk-DDIEFKNP.mjs.map} +1 -1
  42. package/dist/{chunk-N3B25GTY.js → chunk-DOJICJCQ.js} +2 -2
  43. package/dist/chunk-DOJICJCQ.js.map +1 -0
  44. package/dist/chunk-EMR4YXNY.mjs +2 -0
  45. package/dist/chunk-EMR4YXNY.mjs.map +1 -0
  46. package/dist/{chunk-DR7WYI37.js → chunk-GJOGATP6.js} +2 -2
  47. package/dist/chunk-GJOGATP6.js.map +1 -0
  48. package/dist/chunk-GQ5OKU74.js +2 -0
  49. package/dist/chunk-GQ5OKU74.js.map +1 -0
  50. package/dist/chunk-JSDGZ4NY.js.map +1 -1
  51. package/dist/chunk-KHQEDQYF.js +5 -0
  52. package/dist/chunk-KHQEDQYF.js.map +1 -0
  53. package/dist/chunk-KOYBZORL.js.map +1 -1
  54. package/dist/chunk-LGPNJ5XE.js +2 -0
  55. package/dist/chunk-LGPNJ5XE.js.map +1 -0
  56. package/dist/chunk-MDAFPGPA.js +2 -0
  57. package/dist/chunk-MDAFPGPA.js.map +1 -0
  58. package/dist/{chunk-UTUPPMLK.mjs → chunk-MMLBQHBM.mjs} +2 -2
  59. package/dist/chunk-MWWEPEU2.js +2 -0
  60. package/dist/chunk-MWWEPEU2.js.map +1 -0
  61. package/dist/{chunk-62WDFH7K.mjs → chunk-N523LFAM.mjs} +2 -2
  62. package/dist/chunk-NWXZ45TV.js +2 -0
  63. package/dist/chunk-NWXZ45TV.js.map +1 -0
  64. package/dist/chunk-OR566YJI.mjs +2 -0
  65. package/dist/chunk-OR566YJI.mjs.map +1 -0
  66. package/dist/chunk-Q337IQNA.js.map +1 -1
  67. package/dist/chunk-SCEWYZUZ.mjs +2 -0
  68. package/dist/chunk-SCEWYZUZ.mjs.map +1 -0
  69. package/dist/{chunk-GKJURMDO.mjs → chunk-SSSF64M7.mjs} +2 -2
  70. package/dist/{chunk-GKJURMDO.mjs.map → chunk-SSSF64M7.mjs.map} +1 -1
  71. package/dist/chunk-W3RGQYPD.js.map +1 -1
  72. package/dist/chunk-WG54EHST.mjs +2 -0
  73. package/dist/chunk-WG54EHST.mjs.map +1 -0
  74. package/dist/chunk-XEXPQFKN.mjs +2 -0
  75. package/dist/chunk-XEXPQFKN.mjs.map +1 -0
  76. package/dist/chunk-YV2C276H.js +2 -0
  77. package/dist/chunk-YV2C276H.js.map +1 -0
  78. package/dist/consent.js.map +1 -1
  79. package/dist/course.d.mts +2 -14
  80. package/dist/course.d.ts +2 -14
  81. package/dist/course.js +1 -1
  82. package/dist/course.js.map +1 -1
  83. package/dist/course.mjs +1 -1
  84. package/dist/course.mjs.map +1 -1
  85. package/dist/embed/analytics.js +1 -1
  86. package/dist/errors.js.map +1 -1
  87. package/dist/index.css +1 -1
  88. package/dist/index.css.map +1 -1
  89. package/dist/index.d.mts +17 -3
  90. package/dist/index.d.ts +17 -3
  91. package/dist/index.js +1 -1
  92. package/dist/index.js.map +1 -1
  93. package/dist/index.mjs +1 -1
  94. package/dist/index.mjs.map +1 -1
  95. package/dist/internal.js.map +1 -1
  96. package/dist/methods-64D5DD6K.js +2 -0
  97. package/dist/methods-64D5DD6K.js.map +1 -0
  98. package/dist/methods-NQA3DFLE.mjs +2 -0
  99. package/dist/methods-NQA3DFLE.mjs.map +1 -0
  100. package/dist/model-files-client-P4PORZJ6.js.map +1 -1
  101. package/dist/models.js.map +1 -1
  102. package/dist/returns.js +1 -1
  103. package/dist/returns.js.map +1 -1
  104. package/dist/returns.mjs +1 -1
  105. package/dist/texts-9kfgClsA.d.mts +14 -0
  106. package/dist/texts-9kfgClsA.d.ts +14 -0
  107. package/dist/{types-D6LsoycW.d.mts → types-B-sjyZQs.d.mts} +7 -1
  108. package/dist/{types-ClFCVzk_.d.ts → types-iRe6ix2y.d.ts} +7 -1
  109. package/dist/viewer3d.js.map +1 -1
  110. package/dist/viewer3d.mjs +1 -1
  111. package/dist/viewer3d.mjs.map +1 -1
  112. package/dist/widgets-BT2LN2Nq.d.mts +547 -0
  113. package/dist/widgets-BVOSj9fU.d.ts +547 -0
  114. package/package.json +16 -2
  115. package/dist/CartProvider-CC6YIZVS.js +0 -2
  116. package/dist/CartProvider-CC6YIZVS.js.map +0 -1
  117. package/dist/CartProvider-ZL65WZN6.mjs +0 -2
  118. package/dist/chunk-2XSLIZ27.js +0 -2
  119. package/dist/chunk-2XSLIZ27.js.map +0 -1
  120. package/dist/chunk-5OCGXVLC.js +0 -2
  121. package/dist/chunk-5OCGXVLC.js.map +0 -1
  122. package/dist/chunk-5YN752OV.mjs +0 -2
  123. package/dist/chunk-5YN752OV.mjs.map +0 -1
  124. package/dist/chunk-7BG22YBF.js +0 -5
  125. package/dist/chunk-7BG22YBF.js.map +0 -1
  126. package/dist/chunk-AHISXVEE.js.map +0 -1
  127. package/dist/chunk-DR7WYI37.js.map +0 -1
  128. package/dist/chunk-EOFJAQPT.js +0 -2
  129. package/dist/chunk-EOFJAQPT.js.map +0 -1
  130. package/dist/chunk-G4SEOVLD.js.map +0 -1
  131. package/dist/chunk-IGQZP4YR.mjs +0 -2
  132. package/dist/chunk-IGQZP4YR.mjs.map +0 -1
  133. package/dist/chunk-N3B25GTY.js.map +0 -1
  134. package/dist/chunk-VWA3ZCNI.mjs +0 -2
  135. package/dist/chunk-VWA3ZCNI.mjs.map +0 -1
  136. package/dist/chunk-YGE2223J.mjs +0 -5
  137. package/dist/chunk-YGE2223J.mjs.map +0 -1
  138. package/dist/chunk-ZM5T4TQW.mjs +0 -2
  139. package/dist/methods-7DWKFCPK.js +0 -2
  140. package/dist/methods-7DWKFCPK.js.map +0 -1
  141. package/dist/methods-DQTADIN4.mjs +0 -2
  142. /package/dist/{CartProvider-ZL65WZN6.mjs.map → BitsnapCart-E72W5RRZ.mjs.map} +0 -0
  143. /package/dist/{methods-DQTADIN4.mjs.map → CartProvider-YPDOFSYC.mjs.map} +0 -0
  144. /package/dist/{chunk-ZKT4N553.mjs.map → chunk-AB37DWOK.mjs.map} +0 -0
  145. /package/dist/{chunk-UTUPPMLK.mjs.map → chunk-MMLBQHBM.mjs.map} +0 -0
  146. /package/dist/{chunk-62WDFH7K.mjs.map → chunk-N523LFAM.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/gen/proto/public/v1/model_delivery_pb.ts"],"names":["file_public_v1_model_delivery","fileDesc","ModelFileState","ModelDeliveryService","serviceDesc"],"mappings":"AAMA,kIAA6D,IAMhDA,CAAAA,CACXC,iCAAAA,4iFAAqjF,CAAA,CAwYhjF,IAAKC,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAIVA,CAAAA,CAAAA,CAAAA,CAAA,WAAA,CAAc,CAAA,CAAA,CAAd,aAAA,CAKAA,CAAAA,CAAAA,CAAAA,CAAA,SAAA,CAAY,CAAA,CAAA,CAAZ,WAAA,CAOAA,CAAAA,CAAAA,CAAAA,CAAA,OAAA,CAAU,CAAA,CAAA,CAAV,SAAA,CAOAA,CAAAA,CAAAA,CAAAA,CAAA,OAAA,CAAU,CAAA,CAAA,CAAV,SAAA,CAvBUA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CA4CL,IAAMC,CAAAA,CAsBXC,oCAAAA,CAAYJ,CAA+B,CAAC,CAAA,CAAA,6BAAA","file":"/home/user/bitsnap-react-payment-release/dist/chunk-6Q3VGPSF.js","sourcesContent":["// @generated by protoc-gen-es v2.10.0 with parameter \"target=ts,ts_nocheck=true\"\n// @generated from file public/v1/model_delivery.proto (package public.v1, syntax proto3)\n/* eslint-disable */\n// @ts-nocheck\n\nimport type { GenEnum, GenFile, GenMessage, GenService } from \"@bufbuild/protobuf/codegenv2\";\nimport { enumDesc, fileDesc, messageDesc, serviceDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file public/v1/model_delivery.proto.\n */\nexport const file_public_v1_model_delivery: GenFile = /*@__PURE__*/\n fileDesc(\"Ch5wdWJsaWMvdjEvbW9kZWxfZGVsaXZlcnkucHJvdG8SCXB1YmxpYy52MSJBChVMaXN0TW9kZWxGaWxlc1JlcXVlc3QSFAoMYWNjZXNzX3Rva2VuGAEgASgJEhIKCnByb2plY3RfaWQYAiABKAkiQQoQTW9kZWxGaWxlTGljZW5jZRIMCgRuYW1lGAEgASgJEgsKA3VybBgCIAEoCRISCgppc19kZWZhdWx0GAMgASgIIjEKEk1vZGVsU2VsbGVyQ29udGFjdBIMCgRuYW1lGAEgASgJEg0KBWVtYWlsGAIgASgJIlkKElB1cmNoYXNlZE1vZGVsRmlsZRINCgVpbmRleBgBIAEoBRIRCglmaWxlX25hbWUYAiABKAkSEQoJZmlsZV9zaXplGAMgASgDEg4KBmZvcm1hdBgEIAEoCSKeAwoOUHVyY2hhc2VkTW9kZWwSEAoIb3JkZXJfaWQYASABKAkSDwoHbGluZV9pZBgCIAEoCRISCgpwcm9qZWN0X2lkGAMgASgJEhEKCXNob3BfbmFtZRgEIAEoCRIUCgxwcm9kdWN0X25hbWUYBSABKAkSFAoMdmFyaWFudF9uYW1lGAYgASgJEhQKDHB1cmNoYXNlZF9hdBgHIAEoAxIoCgVzdGF0ZRgIIAEoDjIZLnB1YmxpYy52MS5Nb2RlbEZpbGVTdGF0ZRIsCgVmaWxlcxgJIAMoCzIdLnB1YmxpYy52MS5QdXJjaGFzZWRNb2RlbEZpbGUSLAoHbGljZW5jZRgKIAEoCzIbLnB1YmxpYy52MS5Nb2RlbEZpbGVMaWNlbmNlEi0KBnNlbGxlchgLIAEoCzIdLnB1YmxpYy52MS5Nb2RlbFNlbGxlckNvbnRhY3QSHgoRYWNjZXNzX2V4cGlyZXNfYXQYDCABKANIAIgBARIVCg10aHVtYm5haWxfdXJsGA0gASgJQhQKEl9hY2Nlc3NfZXhwaXJlc19hdCLKAQoWTGlzdE1vZGVsRmlsZXNSZXNwb25zZRI8CgdzdWNjZXNzGAEgASgLMikucHVibGljLnYxLkxpc3RNb2RlbEZpbGVzUmVzcG9uc2UuU3VjY2Vzc0gAEjIKB2ZhaWx1cmUYAiABKA4yHy5wdWJsaWMudjEuTW9kZWxEZWxpdmVyeUZhaWx1cmVIABo0CgdTdWNjZXNzEikKBm1vZGVscxgBIAMoCzIZLnB1YmxpYy52MS5QdXJjaGFzZWRNb2RlbEIICgZyZXN1bHQibQoeR2V0TW9kZWxGaWxlRG93bmxvYWRVcmxSZXF1ZXN0EhQKDGFjY2Vzc190b2tlbhgBIAEoCRIQCghvcmRlcl9pZBgCIAEoCRIPCgdsaW5lX2lkGAMgASgJEhIKCmZpbGVfaW5kZXgYBCABKAUi5QEKH0dldE1vZGVsRmlsZURvd25sb2FkVXJsUmVzcG9uc2USRQoHc3VjY2VzcxgBIAEoCzIyLnB1YmxpYy52MS5HZXRNb2RlbEZpbGVEb3dubG9hZFVybFJlc3BvbnNlLlN1Y2Nlc3NIABIyCgdmYWlsdXJlGAIgASgOMh8ucHVibGljLnYxLk1vZGVsRGVsaXZlcnlGYWlsdXJlSAAaPQoHU3VjY2VzcxILCgN1cmwYASABKAkSEQoJZmlsZV9uYW1lGAIgASgJEhIKCmV4cGlyZXNfYXQYAyABKANCCAoGcmVzdWx0Kp0CChRNb2RlbERlbGl2ZXJ5RmFpbHVyZRImCiJNT0RFTF9ERUxJVkVSWV9GQUlMVVJFX1VOU1BFQ0lGSUVEEAASJwojTU9ERUxfREVMSVZFUllfRkFJTFVSRV9VTkFVVEhPUklaRUQQARIkCiBNT0RFTF9ERUxJVkVSWV9GQUlMVVJFX05PVF9GT1VORBACEiMKH01PREVMX0RFTElWRVJZX0ZBSUxVUkVfUkVGVU5ERUQQAxIiCh5NT0RFTF9ERUxJVkVSWV9GQUlMVVJFX0VYUElSRUQQBBIiCh5NT0RFTF9ERUxJVkVSWV9GQUlMVVJFX1JFTU9WRUQQBRIhCh1NT0RFTF9ERUxJVkVSWV9GQUlMVVJFX1VOUEFJRBAGKo4BCg5Nb2RlbEZpbGVTdGF0ZRIgChxNT0RFTF9GSUxFX1NUQVRFX1VOU1BFQ0lGSUVEEAASHgoaTU9ERUxfRklMRV9TVEFURV9BVkFJTEFCTEUQARIcChhNT0RFTF9GSUxFX1NUQVRFX1JFTU9WRUQQAhIcChhNT0RFTF9GSUxFX1NUQVRFX0VYUElSRUQQAzLfAQoUTW9kZWxEZWxpdmVyeVNlcnZpY2USVQoOTGlzdE1vZGVsRmlsZXMSIC5wdWJsaWMudjEuTGlzdE1vZGVsRmlsZXNSZXF1ZXN0GiEucHVibGljLnYxLkxpc3RNb2RlbEZpbGVzUmVzcG9uc2UScAoXR2V0TW9kZWxGaWxlRG93bmxvYWRVcmwSKS5wdWJsaWMudjEuR2V0TW9kZWxGaWxlRG93bmxvYWRVcmxSZXF1ZXN0GioucHVibGljLnYxLkdldE1vZGVsRmlsZURvd25sb2FkVXJsUmVzcG9uc2ViBnByb3RvMw\");\n\n/**\n * @generated from message public.v1.ListModelFilesRequest\n */\nexport type ListModelFilesRequest = Message<\"public.v1.ListModelFilesRequest\"> & {\n /**\n * @generated from field: string access_token = 1;\n */\n accessToken: string;\n\n /**\n * Hashed project id of the panel; empty = every shop.\n *\n * @generated from field: string project_id = 2;\n */\n projectId: string;\n};\n\n/**\n * Describes the message public.v1.ListModelFilesRequest.\n * Use `create(ListModelFilesRequestSchema)` to create a new message.\n */\nexport const ListModelFilesRequestSchema: GenMessage<ListModelFilesRequest> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 0);\n\n/**\n * @generated from message public.v1.ModelFileLicence\n */\nexport type ModelFileLicence = Message<\"public.v1.ModelFileLicence\"> & {\n /**\n * @generated from field: string name = 1;\n */\n name: string;\n\n /**\n * Where the licence text is: the seller's URL, the licence page of the\n * order line, or the buyer regulations for the default licence.\n *\n * @generated from field: string url = 2;\n */\n url: string;\n\n /**\n * The default personal-use licence of the buyer regulations (D15).\n *\n * @generated from field: bool is_default = 3;\n */\n isDefault: boolean;\n};\n\n/**\n * Describes the message public.v1.ModelFileLicence.\n * Use `create(ModelFileLicenceSchema)` to create a new message.\n */\nexport const ModelFileLicenceSchema: GenMessage<ModelFileLicence> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 1);\n\n/**\n * @generated from message public.v1.ModelSellerContact\n */\nexport type ModelSellerContact = Message<\"public.v1.ModelSellerContact\"> & {\n /**\n * @generated from field: string name = 1;\n */\n name: string;\n\n /**\n * @generated from field: string email = 2;\n */\n email: string;\n};\n\n/**\n * Describes the message public.v1.ModelSellerContact.\n * Use `create(ModelSellerContactSchema)` to create a new message.\n */\nexport const ModelSellerContactSchema: GenMessage<ModelSellerContact> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 2);\n\n/**\n * @generated from message public.v1.PurchasedModelFile\n */\nexport type PurchasedModelFile = Message<\"public.v1.PurchasedModelFile\"> & {\n /**\n * Position in the files of the line (v1: always 0, the GLB).\n *\n * @generated from field: int32 index = 1;\n */\n index: number;\n\n /**\n * @generated from field: string file_name = 2;\n */\n fileName: string;\n\n /**\n * @generated from field: int64 file_size = 3;\n */\n fileSize: bigint;\n\n /**\n * \"glb\" in v1.\n *\n * @generated from field: string format = 4;\n */\n format: string;\n};\n\n/**\n * Describes the message public.v1.PurchasedModelFile.\n * Use `create(PurchasedModelFileSchema)` to create a new message.\n */\nexport const PurchasedModelFileSchema: GenMessage<PurchasedModelFile> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 3);\n\n/**\n * @generated from message public.v1.PurchasedModel\n */\nexport type PurchasedModel = Message<\"public.v1.PurchasedModel\"> & {\n /**\n * Hashed id of the order.\n *\n * @generated from field: string order_id = 1;\n */\n orderId: string;\n\n /**\n * The product id of the order line, as the order stores it.\n *\n * @generated from field: string line_id = 2;\n */\n lineId: string;\n\n /**\n * @generated from field: string project_id = 3;\n */\n projectId: string;\n\n /**\n * @generated from field: string shop_name = 4;\n */\n shopName: string;\n\n /**\n * @generated from field: string product_name = 5;\n */\n productName: string;\n\n /**\n * @generated from field: string variant_name = 6;\n */\n variantName: string;\n\n /**\n * @generated from field: int64 purchased_at = 7;\n */\n purchasedAt: bigint;\n\n /**\n * @generated from field: public.v1.ModelFileState state = 8;\n */\n state: ModelFileState;\n\n /**\n * @generated from field: repeated public.v1.PurchasedModelFile files = 9;\n */\n files: PurchasedModelFile[];\n\n /**\n * @generated from field: public.v1.ModelFileLicence licence = 10;\n */\n licence?: ModelFileLicence;\n\n /**\n * @generated from field: public.v1.ModelSellerContact seller = 11;\n */\n seller?: ModelSellerContact;\n\n /**\n * @generated from field: optional int64 access_expires_at = 12;\n */\n accessExpiresAt?: bigint;\n\n /**\n * @generated from field: string thumbnail_url = 13;\n */\n thumbnailUrl: string;\n};\n\n/**\n * Describes the message public.v1.PurchasedModel.\n * Use `create(PurchasedModelSchema)` to create a new message.\n */\nexport const PurchasedModelSchema: GenMessage<PurchasedModel> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 4);\n\n/**\n * @generated from message public.v1.ListModelFilesResponse\n */\nexport type ListModelFilesResponse = Message<\"public.v1.ListModelFilesResponse\"> & {\n /**\n * @generated from oneof public.v1.ListModelFilesResponse.result\n */\n result: {\n /**\n * @generated from field: public.v1.ListModelFilesResponse.Success success = 1;\n */\n value: ListModelFilesResponse_Success;\n case: \"success\";\n } | {\n /**\n * @generated from field: public.v1.ModelDeliveryFailure failure = 2;\n */\n value: ModelDeliveryFailure;\n case: \"failure\";\n } | { case: undefined; value?: undefined };\n};\n\n/**\n * Describes the message public.v1.ListModelFilesResponse.\n * Use `create(ListModelFilesResponseSchema)` to create a new message.\n */\nexport const ListModelFilesResponseSchema: GenMessage<ListModelFilesResponse> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 5);\n\n/**\n * @generated from message public.v1.ListModelFilesResponse.Success\n */\nexport type ListModelFilesResponse_Success = Message<\"public.v1.ListModelFilesResponse.Success\"> & {\n /**\n * @generated from field: repeated public.v1.PurchasedModel models = 1;\n */\n models: PurchasedModel[];\n};\n\n/**\n * Describes the message public.v1.ListModelFilesResponse.Success.\n * Use `create(ListModelFilesResponse_SuccessSchema)` to create a new message.\n */\nexport const ListModelFilesResponse_SuccessSchema: GenMessage<ListModelFilesResponse_Success> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 5, 0);\n\n/**\n * @generated from message public.v1.GetModelFileDownloadUrlRequest\n */\nexport type GetModelFileDownloadUrlRequest = Message<\"public.v1.GetModelFileDownloadUrlRequest\"> & {\n /**\n * @generated from field: string access_token = 1;\n */\n accessToken: string;\n\n /**\n * @generated from field: string order_id = 2;\n */\n orderId: string;\n\n /**\n * @generated from field: string line_id = 3;\n */\n lineId: string;\n\n /**\n * @generated from field: int32 file_index = 4;\n */\n fileIndex: number;\n};\n\n/**\n * Describes the message public.v1.GetModelFileDownloadUrlRequest.\n * Use `create(GetModelFileDownloadUrlRequestSchema)` to create a new message.\n */\nexport const GetModelFileDownloadUrlRequestSchema: GenMessage<GetModelFileDownloadUrlRequest> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 6);\n\n/**\n * @generated from message public.v1.GetModelFileDownloadUrlResponse\n */\nexport type GetModelFileDownloadUrlResponse = Message<\"public.v1.GetModelFileDownloadUrlResponse\"> & {\n /**\n * @generated from oneof public.v1.GetModelFileDownloadUrlResponse.result\n */\n result: {\n /**\n * @generated from field: public.v1.GetModelFileDownloadUrlResponse.Success success = 1;\n */\n value: GetModelFileDownloadUrlResponse_Success;\n case: \"success\";\n } | {\n /**\n * @generated from field: public.v1.ModelDeliveryFailure failure = 2;\n */\n value: ModelDeliveryFailure;\n case: \"failure\";\n } | { case: undefined; value?: undefined };\n};\n\n/**\n * Describes the message public.v1.GetModelFileDownloadUrlResponse.\n * Use `create(GetModelFileDownloadUrlResponseSchema)` to create a new message.\n */\nexport const GetModelFileDownloadUrlResponseSchema: GenMessage<GetModelFileDownloadUrlResponse> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 7);\n\n/**\n * @generated from message public.v1.GetModelFileDownloadUrlResponse.Success\n */\nexport type GetModelFileDownloadUrlResponse_Success = Message<\"public.v1.GetModelFileDownloadUrlResponse.Success\"> & {\n /**\n * @generated from field: string url = 1;\n */\n url: string;\n\n /**\n * @generated from field: string file_name = 2;\n */\n fileName: string;\n\n /**\n * @generated from field: int64 expires_at = 3;\n */\n expiresAt: bigint;\n};\n\n/**\n * Describes the message public.v1.GetModelFileDownloadUrlResponse.Success.\n * Use `create(GetModelFileDownloadUrlResponse_SuccessSchema)` to create a new message.\n */\nexport const GetModelFileDownloadUrlResponse_SuccessSchema: GenMessage<GetModelFileDownloadUrlResponse_Success> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 7, 0);\n\n/**\n * @generated from enum public.v1.ModelDeliveryFailure\n */\nexport enum ModelDeliveryFailure {\n /**\n * @generated from enum value: MODEL_DELIVERY_FAILURE_UNSPECIFIED = 0;\n */\n UNSPECIFIED = 0,\n\n /**\n * No or an expired panel session.\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_UNAUTHORIZED = 1;\n */\n UNAUTHORIZED = 1,\n\n /**\n * No such order line for this buyer (or it holds no 3D file).\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_NOT_FOUND = 2;\n */\n NOT_FOUND = 2,\n\n /**\n * The order was refunded or canceled.\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_REFUNDED = 3;\n */\n REFUNDED = 3,\n\n /**\n * The access of the order line ended (access expiry of the variant).\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_EXPIRED = 4;\n */\n EXPIRED = 4,\n\n /**\n * The seller removed the file (no model on the variant or the product).\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_REMOVED = 5;\n */\n REMOVED = 5,\n\n /**\n * The order is not paid.\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_UNPAID = 6;\n */\n UNPAID = 6,\n}\n\n/**\n * Describes the enum public.v1.ModelDeliveryFailure.\n */\nexport const ModelDeliveryFailureSchema: GenEnum<ModelDeliveryFailure> = /*@__PURE__*/\n enumDesc(file_public_v1_model_delivery, 0);\n\n/**\n * @generated from enum public.v1.ModelFileState\n */\nexport enum ModelFileState {\n /**\n * @generated from enum value: MODEL_FILE_STATE_UNSPECIFIED = 0;\n */\n UNSPECIFIED = 0,\n\n /**\n * @generated from enum value: MODEL_FILE_STATE_AVAILABLE = 1;\n */\n AVAILABLE = 1,\n\n /**\n * The seller removed the file: `seller` says how to reach them.\n *\n * @generated from enum value: MODEL_FILE_STATE_REMOVED = 2;\n */\n REMOVED = 2,\n\n /**\n * The access ended: `access_expires_at` says when.\n *\n * @generated from enum value: MODEL_FILE_STATE_EXPIRED = 3;\n */\n EXPIRED = 3,\n}\n\n/**\n * Describes the enum public.v1.ModelFileState.\n */\nexport const ModelFileStateSchema: GenEnum<ModelFileState> = /*@__PURE__*/\n enumDesc(file_public_v1_model_delivery, 1);\n\n/**\n * Delivery of purchased 3D model files to the buyer (docs/3d-products-plan.md,\n * \"Delivery after purchase (D7)\").\n *\n * Every call is authenticated as the buyer with the customer panel session\n * (`access_token`, the same token as `PublicApiService.UserPanel*`). It is not\n * a merchant RPC: there is no project permission, the buyer sees the files of\n * their own paid, not refunded orders only. The entitlement is re-checked on\n * every call; a download URL is short-lived and signed on request.\n *\n * @generated from service public.v1.ModelDeliveryService\n */\nexport const ModelDeliveryService: GenService<{\n /**\n * The 3D files of the buyer's orders (optionally of one shop).\n *\n * @generated from rpc public.v1.ModelDeliveryService.ListModelFiles\n */\n listModelFiles: {\n methodKind: \"unary\";\n input: typeof ListModelFilesRequestSchema;\n output: typeof ListModelFilesResponseSchema;\n },\n /**\n * A short-lived signed download URL of one file of one order line.\n *\n * @generated from rpc public.v1.ModelDeliveryService.GetModelFileDownloadUrl\n */\n getModelFileDownloadUrl: {\n methodKind: \"unary\";\n input: typeof GetModelFileDownloadUrlRequestSchema;\n output: typeof GetModelFileDownloadUrlResponseSchema;\n },\n}> = /*@__PURE__*/\n serviceDesc(file_public_v1_model_delivery, 0);\n\n"]}
1
+ {"version":3,"sources":["../src/gen/proto/public/v1/model_delivery_pb.ts"],"names":["file_public_v1_model_delivery","fileDesc","ModelFileState","ModelDeliveryService","serviceDesc"],"mappings":"AAMA,kIAA6D,IAMhDA,CAAAA,CACXC,iCAAAA,4iFAAqjF,CAAA,CAwYhjF,IAAKC,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAIVA,CAAAA,CAAAA,CAAAA,CAAA,WAAA,CAAc,CAAA,CAAA,CAAd,aAAA,CAKAA,CAAAA,CAAAA,CAAAA,CAAA,SAAA,CAAY,CAAA,CAAA,CAAZ,WAAA,CAOAA,CAAAA,CAAAA,CAAAA,CAAA,OAAA,CAAU,CAAA,CAAA,CAAV,SAAA,CAOAA,CAAAA,CAAAA,CAAAA,CAAA,OAAA,CAAU,CAAA,CAAA,CAAV,SAAA,CAvBUA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CA4CL,IAAMC,CAAAA,CAsBXC,oCAAAA,CAAYJ,CAA+B,CAAC,CAAA,CAAA,6BAAA","file":"/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/chunk-6Q3VGPSF.js","sourcesContent":["// @generated by protoc-gen-es v2.10.0 with parameter \"target=ts,ts_nocheck=true\"\n// @generated from file public/v1/model_delivery.proto (package public.v1, syntax proto3)\n/* eslint-disable */\n// @ts-nocheck\n\nimport type { GenEnum, GenFile, GenMessage, GenService } from \"@bufbuild/protobuf/codegenv2\";\nimport { enumDesc, fileDesc, messageDesc, serviceDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file public/v1/model_delivery.proto.\n */\nexport const file_public_v1_model_delivery: GenFile = /*@__PURE__*/\n fileDesc(\"Ch5wdWJsaWMvdjEvbW9kZWxfZGVsaXZlcnkucHJvdG8SCXB1YmxpYy52MSJBChVMaXN0TW9kZWxGaWxlc1JlcXVlc3QSFAoMYWNjZXNzX3Rva2VuGAEgASgJEhIKCnByb2plY3RfaWQYAiABKAkiQQoQTW9kZWxGaWxlTGljZW5jZRIMCgRuYW1lGAEgASgJEgsKA3VybBgCIAEoCRISCgppc19kZWZhdWx0GAMgASgIIjEKEk1vZGVsU2VsbGVyQ29udGFjdBIMCgRuYW1lGAEgASgJEg0KBWVtYWlsGAIgASgJIlkKElB1cmNoYXNlZE1vZGVsRmlsZRINCgVpbmRleBgBIAEoBRIRCglmaWxlX25hbWUYAiABKAkSEQoJZmlsZV9zaXplGAMgASgDEg4KBmZvcm1hdBgEIAEoCSKeAwoOUHVyY2hhc2VkTW9kZWwSEAoIb3JkZXJfaWQYASABKAkSDwoHbGluZV9pZBgCIAEoCRISCgpwcm9qZWN0X2lkGAMgASgJEhEKCXNob3BfbmFtZRgEIAEoCRIUCgxwcm9kdWN0X25hbWUYBSABKAkSFAoMdmFyaWFudF9uYW1lGAYgASgJEhQKDHB1cmNoYXNlZF9hdBgHIAEoAxIoCgVzdGF0ZRgIIAEoDjIZLnB1YmxpYy52MS5Nb2RlbEZpbGVTdGF0ZRIsCgVmaWxlcxgJIAMoCzIdLnB1YmxpYy52MS5QdXJjaGFzZWRNb2RlbEZpbGUSLAoHbGljZW5jZRgKIAEoCzIbLnB1YmxpYy52MS5Nb2RlbEZpbGVMaWNlbmNlEi0KBnNlbGxlchgLIAEoCzIdLnB1YmxpYy52MS5Nb2RlbFNlbGxlckNvbnRhY3QSHgoRYWNjZXNzX2V4cGlyZXNfYXQYDCABKANIAIgBARIVCg10aHVtYm5haWxfdXJsGA0gASgJQhQKEl9hY2Nlc3NfZXhwaXJlc19hdCLKAQoWTGlzdE1vZGVsRmlsZXNSZXNwb25zZRI8CgdzdWNjZXNzGAEgASgLMikucHVibGljLnYxLkxpc3RNb2RlbEZpbGVzUmVzcG9uc2UuU3VjY2Vzc0gAEjIKB2ZhaWx1cmUYAiABKA4yHy5wdWJsaWMudjEuTW9kZWxEZWxpdmVyeUZhaWx1cmVIABo0CgdTdWNjZXNzEikKBm1vZGVscxgBIAMoCzIZLnB1YmxpYy52MS5QdXJjaGFzZWRNb2RlbEIICgZyZXN1bHQibQoeR2V0TW9kZWxGaWxlRG93bmxvYWRVcmxSZXF1ZXN0EhQKDGFjY2Vzc190b2tlbhgBIAEoCRIQCghvcmRlcl9pZBgCIAEoCRIPCgdsaW5lX2lkGAMgASgJEhIKCmZpbGVfaW5kZXgYBCABKAUi5QEKH0dldE1vZGVsRmlsZURvd25sb2FkVXJsUmVzcG9uc2USRQoHc3VjY2VzcxgBIAEoCzIyLnB1YmxpYy52MS5HZXRNb2RlbEZpbGVEb3dubG9hZFVybFJlc3BvbnNlLlN1Y2Nlc3NIABIyCgdmYWlsdXJlGAIgASgOMh8ucHVibGljLnYxLk1vZGVsRGVsaXZlcnlGYWlsdXJlSAAaPQoHU3VjY2VzcxILCgN1cmwYASABKAkSEQoJZmlsZV9uYW1lGAIgASgJEhIKCmV4cGlyZXNfYXQYAyABKANCCAoGcmVzdWx0Kp0CChRNb2RlbERlbGl2ZXJ5RmFpbHVyZRImCiJNT0RFTF9ERUxJVkVSWV9GQUlMVVJFX1VOU1BFQ0lGSUVEEAASJwojTU9ERUxfREVMSVZFUllfRkFJTFVSRV9VTkFVVEhPUklaRUQQARIkCiBNT0RFTF9ERUxJVkVSWV9GQUlMVVJFX05PVF9GT1VORBACEiMKH01PREVMX0RFTElWRVJZX0ZBSUxVUkVfUkVGVU5ERUQQAxIiCh5NT0RFTF9ERUxJVkVSWV9GQUlMVVJFX0VYUElSRUQQBBIiCh5NT0RFTF9ERUxJVkVSWV9GQUlMVVJFX1JFTU9WRUQQBRIhCh1NT0RFTF9ERUxJVkVSWV9GQUlMVVJFX1VOUEFJRBAGKo4BCg5Nb2RlbEZpbGVTdGF0ZRIgChxNT0RFTF9GSUxFX1NUQVRFX1VOU1BFQ0lGSUVEEAASHgoaTU9ERUxfRklMRV9TVEFURV9BVkFJTEFCTEUQARIcChhNT0RFTF9GSUxFX1NUQVRFX1JFTU9WRUQQAhIcChhNT0RFTF9GSUxFX1NUQVRFX0VYUElSRUQQAzLfAQoUTW9kZWxEZWxpdmVyeVNlcnZpY2USVQoOTGlzdE1vZGVsRmlsZXMSIC5wdWJsaWMudjEuTGlzdE1vZGVsRmlsZXNSZXF1ZXN0GiEucHVibGljLnYxLkxpc3RNb2RlbEZpbGVzUmVzcG9uc2UScAoXR2V0TW9kZWxGaWxlRG93bmxvYWRVcmwSKS5wdWJsaWMudjEuR2V0TW9kZWxGaWxlRG93bmxvYWRVcmxSZXF1ZXN0GioucHVibGljLnYxLkdldE1vZGVsRmlsZURvd25sb2FkVXJsUmVzcG9uc2ViBnByb3RvMw\");\n\n/**\n * @generated from message public.v1.ListModelFilesRequest\n */\nexport type ListModelFilesRequest = Message<\"public.v1.ListModelFilesRequest\"> & {\n /**\n * @generated from field: string access_token = 1;\n */\n accessToken: string;\n\n /**\n * Hashed project id of the panel; empty = every shop.\n *\n * @generated from field: string project_id = 2;\n */\n projectId: string;\n};\n\n/**\n * Describes the message public.v1.ListModelFilesRequest.\n * Use `create(ListModelFilesRequestSchema)` to create a new message.\n */\nexport const ListModelFilesRequestSchema: GenMessage<ListModelFilesRequest> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 0);\n\n/**\n * @generated from message public.v1.ModelFileLicence\n */\nexport type ModelFileLicence = Message<\"public.v1.ModelFileLicence\"> & {\n /**\n * @generated from field: string name = 1;\n */\n name: string;\n\n /**\n * Where the licence text is: the seller's URL, the licence page of the\n * order line, or the buyer regulations for the default licence.\n *\n * @generated from field: string url = 2;\n */\n url: string;\n\n /**\n * The default personal-use licence of the buyer regulations (D15).\n *\n * @generated from field: bool is_default = 3;\n */\n isDefault: boolean;\n};\n\n/**\n * Describes the message public.v1.ModelFileLicence.\n * Use `create(ModelFileLicenceSchema)` to create a new message.\n */\nexport const ModelFileLicenceSchema: GenMessage<ModelFileLicence> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 1);\n\n/**\n * @generated from message public.v1.ModelSellerContact\n */\nexport type ModelSellerContact = Message<\"public.v1.ModelSellerContact\"> & {\n /**\n * @generated from field: string name = 1;\n */\n name: string;\n\n /**\n * @generated from field: string email = 2;\n */\n email: string;\n};\n\n/**\n * Describes the message public.v1.ModelSellerContact.\n * Use `create(ModelSellerContactSchema)` to create a new message.\n */\nexport const ModelSellerContactSchema: GenMessage<ModelSellerContact> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 2);\n\n/**\n * @generated from message public.v1.PurchasedModelFile\n */\nexport type PurchasedModelFile = Message<\"public.v1.PurchasedModelFile\"> & {\n /**\n * Position in the files of the line (v1: always 0, the GLB).\n *\n * @generated from field: int32 index = 1;\n */\n index: number;\n\n /**\n * @generated from field: string file_name = 2;\n */\n fileName: string;\n\n /**\n * @generated from field: int64 file_size = 3;\n */\n fileSize: bigint;\n\n /**\n * \"glb\" in v1.\n *\n * @generated from field: string format = 4;\n */\n format: string;\n};\n\n/**\n * Describes the message public.v1.PurchasedModelFile.\n * Use `create(PurchasedModelFileSchema)` to create a new message.\n */\nexport const PurchasedModelFileSchema: GenMessage<PurchasedModelFile> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 3);\n\n/**\n * @generated from message public.v1.PurchasedModel\n */\nexport type PurchasedModel = Message<\"public.v1.PurchasedModel\"> & {\n /**\n * Hashed id of the order.\n *\n * @generated from field: string order_id = 1;\n */\n orderId: string;\n\n /**\n * The product id of the order line, as the order stores it.\n *\n * @generated from field: string line_id = 2;\n */\n lineId: string;\n\n /**\n * @generated from field: string project_id = 3;\n */\n projectId: string;\n\n /**\n * @generated from field: string shop_name = 4;\n */\n shopName: string;\n\n /**\n * @generated from field: string product_name = 5;\n */\n productName: string;\n\n /**\n * @generated from field: string variant_name = 6;\n */\n variantName: string;\n\n /**\n * @generated from field: int64 purchased_at = 7;\n */\n purchasedAt: bigint;\n\n /**\n * @generated from field: public.v1.ModelFileState state = 8;\n */\n state: ModelFileState;\n\n /**\n * @generated from field: repeated public.v1.PurchasedModelFile files = 9;\n */\n files: PurchasedModelFile[];\n\n /**\n * @generated from field: public.v1.ModelFileLicence licence = 10;\n */\n licence?: ModelFileLicence;\n\n /**\n * @generated from field: public.v1.ModelSellerContact seller = 11;\n */\n seller?: ModelSellerContact;\n\n /**\n * @generated from field: optional int64 access_expires_at = 12;\n */\n accessExpiresAt?: bigint;\n\n /**\n * @generated from field: string thumbnail_url = 13;\n */\n thumbnailUrl: string;\n};\n\n/**\n * Describes the message public.v1.PurchasedModel.\n * Use `create(PurchasedModelSchema)` to create a new message.\n */\nexport const PurchasedModelSchema: GenMessage<PurchasedModel> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 4);\n\n/**\n * @generated from message public.v1.ListModelFilesResponse\n */\nexport type ListModelFilesResponse = Message<\"public.v1.ListModelFilesResponse\"> & {\n /**\n * @generated from oneof public.v1.ListModelFilesResponse.result\n */\n result: {\n /**\n * @generated from field: public.v1.ListModelFilesResponse.Success success = 1;\n */\n value: ListModelFilesResponse_Success;\n case: \"success\";\n } | {\n /**\n * @generated from field: public.v1.ModelDeliveryFailure failure = 2;\n */\n value: ModelDeliveryFailure;\n case: \"failure\";\n } | { case: undefined; value?: undefined };\n};\n\n/**\n * Describes the message public.v1.ListModelFilesResponse.\n * Use `create(ListModelFilesResponseSchema)` to create a new message.\n */\nexport const ListModelFilesResponseSchema: GenMessage<ListModelFilesResponse> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 5);\n\n/**\n * @generated from message public.v1.ListModelFilesResponse.Success\n */\nexport type ListModelFilesResponse_Success = Message<\"public.v1.ListModelFilesResponse.Success\"> & {\n /**\n * @generated from field: repeated public.v1.PurchasedModel models = 1;\n */\n models: PurchasedModel[];\n};\n\n/**\n * Describes the message public.v1.ListModelFilesResponse.Success.\n * Use `create(ListModelFilesResponse_SuccessSchema)` to create a new message.\n */\nexport const ListModelFilesResponse_SuccessSchema: GenMessage<ListModelFilesResponse_Success> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 5, 0);\n\n/**\n * @generated from message public.v1.GetModelFileDownloadUrlRequest\n */\nexport type GetModelFileDownloadUrlRequest = Message<\"public.v1.GetModelFileDownloadUrlRequest\"> & {\n /**\n * @generated from field: string access_token = 1;\n */\n accessToken: string;\n\n /**\n * @generated from field: string order_id = 2;\n */\n orderId: string;\n\n /**\n * @generated from field: string line_id = 3;\n */\n lineId: string;\n\n /**\n * @generated from field: int32 file_index = 4;\n */\n fileIndex: number;\n};\n\n/**\n * Describes the message public.v1.GetModelFileDownloadUrlRequest.\n * Use `create(GetModelFileDownloadUrlRequestSchema)` to create a new message.\n */\nexport const GetModelFileDownloadUrlRequestSchema: GenMessage<GetModelFileDownloadUrlRequest> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 6);\n\n/**\n * @generated from message public.v1.GetModelFileDownloadUrlResponse\n */\nexport type GetModelFileDownloadUrlResponse = Message<\"public.v1.GetModelFileDownloadUrlResponse\"> & {\n /**\n * @generated from oneof public.v1.GetModelFileDownloadUrlResponse.result\n */\n result: {\n /**\n * @generated from field: public.v1.GetModelFileDownloadUrlResponse.Success success = 1;\n */\n value: GetModelFileDownloadUrlResponse_Success;\n case: \"success\";\n } | {\n /**\n * @generated from field: public.v1.ModelDeliveryFailure failure = 2;\n */\n value: ModelDeliveryFailure;\n case: \"failure\";\n } | { case: undefined; value?: undefined };\n};\n\n/**\n * Describes the message public.v1.GetModelFileDownloadUrlResponse.\n * Use `create(GetModelFileDownloadUrlResponseSchema)` to create a new message.\n */\nexport const GetModelFileDownloadUrlResponseSchema: GenMessage<GetModelFileDownloadUrlResponse> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 7);\n\n/**\n * @generated from message public.v1.GetModelFileDownloadUrlResponse.Success\n */\nexport type GetModelFileDownloadUrlResponse_Success = Message<\"public.v1.GetModelFileDownloadUrlResponse.Success\"> & {\n /**\n * @generated from field: string url = 1;\n */\n url: string;\n\n /**\n * @generated from field: string file_name = 2;\n */\n fileName: string;\n\n /**\n * @generated from field: int64 expires_at = 3;\n */\n expiresAt: bigint;\n};\n\n/**\n * Describes the message public.v1.GetModelFileDownloadUrlResponse.Success.\n * Use `create(GetModelFileDownloadUrlResponse_SuccessSchema)` to create a new message.\n */\nexport const GetModelFileDownloadUrlResponse_SuccessSchema: GenMessage<GetModelFileDownloadUrlResponse_Success> = /*@__PURE__*/\n messageDesc(file_public_v1_model_delivery, 7, 0);\n\n/**\n * @generated from enum public.v1.ModelDeliveryFailure\n */\nexport enum ModelDeliveryFailure {\n /**\n * @generated from enum value: MODEL_DELIVERY_FAILURE_UNSPECIFIED = 0;\n */\n UNSPECIFIED = 0,\n\n /**\n * No or an expired panel session.\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_UNAUTHORIZED = 1;\n */\n UNAUTHORIZED = 1,\n\n /**\n * No such order line for this buyer (or it holds no 3D file).\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_NOT_FOUND = 2;\n */\n NOT_FOUND = 2,\n\n /**\n * The order was refunded or canceled.\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_REFUNDED = 3;\n */\n REFUNDED = 3,\n\n /**\n * The access of the order line ended (access expiry of the variant).\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_EXPIRED = 4;\n */\n EXPIRED = 4,\n\n /**\n * The seller removed the file (no model on the variant or the product).\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_REMOVED = 5;\n */\n REMOVED = 5,\n\n /**\n * The order is not paid.\n *\n * @generated from enum value: MODEL_DELIVERY_FAILURE_UNPAID = 6;\n */\n UNPAID = 6,\n}\n\n/**\n * Describes the enum public.v1.ModelDeliveryFailure.\n */\nexport const ModelDeliveryFailureSchema: GenEnum<ModelDeliveryFailure> = /*@__PURE__*/\n enumDesc(file_public_v1_model_delivery, 0);\n\n/**\n * @generated from enum public.v1.ModelFileState\n */\nexport enum ModelFileState {\n /**\n * @generated from enum value: MODEL_FILE_STATE_UNSPECIFIED = 0;\n */\n UNSPECIFIED = 0,\n\n /**\n * @generated from enum value: MODEL_FILE_STATE_AVAILABLE = 1;\n */\n AVAILABLE = 1,\n\n /**\n * The seller removed the file: `seller` says how to reach them.\n *\n * @generated from enum value: MODEL_FILE_STATE_REMOVED = 2;\n */\n REMOVED = 2,\n\n /**\n * The access ended: `access_expires_at` says when.\n *\n * @generated from enum value: MODEL_FILE_STATE_EXPIRED = 3;\n */\n EXPIRED = 3,\n}\n\n/**\n * Describes the enum public.v1.ModelFileState.\n */\nexport const ModelFileStateSchema: GenEnum<ModelFileState> = /*@__PURE__*/\n enumDesc(file_public_v1_model_delivery, 1);\n\n/**\n * Delivery of purchased 3D model files to the buyer (docs/3d-products-plan.md,\n * \"Delivery after purchase (D7)\").\n *\n * Every call is authenticated as the buyer with the customer panel session\n * (`access_token`, the same token as `PublicApiService.UserPanel*`). It is not\n * a merchant RPC: there is no project permission, the buyer sees the files of\n * their own paid, not refunded orders only. The entitlement is re-checked on\n * every call; a download URL is short-lived and signed on request.\n *\n * @generated from service public.v1.ModelDeliveryService\n */\nexport const ModelDeliveryService: GenService<{\n /**\n * The 3D files of the buyer's orders (optionally of one shop).\n *\n * @generated from rpc public.v1.ModelDeliveryService.ListModelFiles\n */\n listModelFiles: {\n methodKind: \"unary\";\n input: typeof ListModelFilesRequestSchema;\n output: typeof ListModelFilesResponseSchema;\n },\n /**\n * A short-lived signed download URL of one file of one order line.\n *\n * @generated from rpc public.v1.ModelDeliveryService.GetModelFileDownloadUrl\n */\n getModelFileDownloadUrl: {\n methodKind: \"unary\";\n input: typeof GetModelFileDownloadUrlRequestSchema;\n output: typeof GetModelFileDownloadUrlResponseSchema;\n },\n}> = /*@__PURE__*/\n serviceDesc(file_public_v1_model_delivery, 0);\n\n"]}
@@ -0,0 +1,5 @@
1
+ import{C as Sn,F as En,G as Ln,H as Tn,I as An,J as Rn,K as Dn,a as dr,b as pn,c as Lt,d as We,e as At,f as mn,h as fn,i as gn,j as yn,k as hn,p as xn,q as wn,r as Cn,t as Nn,u as In}from"./chunk-AB37DWOK.mjs";import{b as ve}from"./chunk-5JRUPLXY.mjs";import{e as j,f as Ae,g as ae,k as S,l as Tt,n as vn,o as Je,p as kn}from"./chunk-SCEWYZUZ.mjs";import{a as mt,b as bn,c as Pn,d as Ye}from"./chunk-XEXPQFKN.mjs";import{a as cr,g as ut,h as pt}from"./chunk-CUPG4B5W.mjs";import{a as or,b as ar,d as Nt,e as ir,f as ln,g as dn}from"./chunk-WG54EHST.mjs";import{a as F}from"./chunk-5R6AGO3Z.mjs";import{a as rr,b as sn,c as nr,e as Z,f as un}from"./chunk-N523LFAM.mjs";import{h as sr,l as It,m as St,n as Ve,o as cn}from"./chunk-SSSF64M7.mjs";import{a as Et,c as Te,e as lr,f as L}from"./chunk-OFPRIENJ.mjs";import{useAutoAnimate as Pa}from"@formkit/auto-animate/react";import{useEffect as zn,useMemo as Fn}from"react";import{jsx as ft}from"react/jsx-runtime";function Re({className:e,...t}){return ft("div",{"data-slot":"card",className:F("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function je({className:e,...t}){return ft("div",{"data-slot":"card-header",className:F("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function Fe({className:e,...t}){return ft("div",{"data-slot":"card-title",className:F("leading-none font-semibold",e),...t})}function Mn({className:e,...t}){return ft("div",{"data-slot":"card-description",className:F("text-muted-foreground text-sm",e),...t})}function De({className:e,...t}){return ft("div",{"data-slot":"card-content",className:F("px-6",e),...t})}import{CircleCheck as da}from"lucide-react";import{useId as ca}from"react";import{jsx as q,jsxs as Q}from"react/jsx-runtime";var ua="text-muted-foreground text-xs leading-5",pa="dark:border-foreground/30 dark:focus-visible:border-foreground/70 dark:focus-visible:ring-foreground/25 dark:aria-invalid:border-destructive-foreground dark:aria-invalid:ring-destructive-foreground/30",ma=new Set(["invalidEmail","emailNotFound","deliveryUnavailable"]),ur="inline-flex min-h-11 items-center px-1 text-sm underline underline-offset-4 hover:no-underline focus-visible:ring-[3px] focus-visible:ring-ring/50 rounded-sm outline-none disabled:opacity-50 disabled:no-underline";function On({login:e,texts:t,allowHaveCode:n=!0,emailPlaceholder:o,emailInputId:r,codeInputId:a,className:i,buttonClassName:d,children:u}){let l=ca(),g=r??`${l}-email`,b=a??`${l}-code`,w=`${l}-notice`,x=`${l}-hint`,{notice:f}=e,c=f?.kind==="error",m=e.busy==="send",p=e.busy==="verify",v=e.busy==="resend",z=F("h-11 w-full",d),ee=f?.kind==="success",T=Q("div",{id:w,className:"min-h-10 text-sm leading-5",children:[q("p",{role:"alert",className:"font-medium text-red-700 dark:text-red-400",children:c?f.text:null}),Q("p",{role:"status",className:F("flex items-start gap-1.5",ee?"font-medium text-emerald-700 dark:text-emerald-400":"text-foreground"),children:[ee&&q(da,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0"}),q("span",{children:f!=null&&!c?f.text:null})]})]}),ce=c&&e.step==="email"&&(f.failure==null||ma.has(f.failure)),Se=q("p",{className:"sr-only",role:"status","aria-live":"polite",children:e.announcement}),oe=Q("div",{className:"grid gap-2",children:[q(We,{htmlFor:g,children:t.emailLabel}),q(Tt,{id:g,ref:e.emailRef,name:"email",type:"email",autoComplete:"email",inputMode:"email",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoFocus:!0,required:!0,className:F("h-11 text-base disabled:opacity-100 disabled:text-foreground/70",pa),placeholder:o??t.emailPlaceholder,value:e.email,disabled:e.isBusy,"aria-invalid":ce?!0:void 0,"aria-describedby":w,onChange:J=>e.setEmail(J.target.value)})]});if(e.step==="email")return Q("form",{noValidate:!0,className:F("flex flex-col gap-4",i),onSubmit:J=>{J.preventDefault(),e.sendCode()},children:[Se,oe,T,Q(S,{type:"submit",disabled:e.isBusy,"aria-busy":m,className:z,children:[m&&q(At,{"aria-hidden":!0}),m?t.sending:t.sendCode]}),n&&Q("p",{className:"flex flex-wrap items-center justify-center text-center text-sm",children:[t.haveCodePrompt!==""&&q("span",{children:t.haveCodePrompt}),q("button",{type:"button",className:ur,disabled:e.isBusy,onClick:e.haveCode,children:t.haveCode})]})]});let[te,fe]=t.codeSentTo.split("{email}"),I=e.dead!=null,ge=I?t.resendNew:e.secondsLeft>0?gn(t.resendIn,{seconds:e.secondsLeft}):t.resend;return Q("form",{noValidate:!0,className:F("flex flex-col gap-4",i),onSubmit:J=>{J.preventDefault(),e.submitCode()},children:[Se,e.needsEmail?oe:Q("div",{className:"flex flex-wrap items-center justify-between gap-x-2",children:[Q("p",{className:"min-w-0 flex-[1_1_14rem] text-sm leading-5 break-words",children:[te,q("strong",{className:"font-semibold",children:e.email}),"\u2060",fe]}),q("button",{type:"button",className:F(ur,"-ml-1 shrink-0"),disabled:e.isBusy,onClick:e.changeEmail,children:t.changeEmail})]}),u,Q("div",{className:"grid gap-2",children:[q(We,{htmlFor:b,children:t.codeLabel}),q(hn,{id:b,name:"code",inputRef:e.codeRef,value:e.code,onChange:e.setCode,onComplete:J=>void e.submitCode(J),disabled:e.isBusy||I,invalid:c&&!e.needsEmail,"aria-describedby":`${w} ${x}`}),Q("p",{id:x,className:ua,children:[t.validity," ",t.spamHint]})]}),T,Q(S,{type:"submit",disabled:e.isBusy||I,"aria-busy":p,className:z,children:[p&&q(At,{"aria-hidden":!0}),p?t.verifying:t.verify]}),e.needsEmail?q("div",{className:"flex justify-center",children:q("button",{type:"button",className:ur,disabled:e.isBusy,onClick:e.changeEmail,children:t.noCode})}):Q(S,{type:"button",variant:I?"default":"outline",disabled:e.isBusy||!I&&e.secondsLeft>0,"aria-busy":v,className:I?z:"h-11 w-full",onClick:()=>void e.resend(),children:[v&&q(At,{"aria-hidden":!0}),ge]})]})}function pr(e){switch(e){case 1:return"emailNotFound";case 2:return"invalidEmail";case 3:return"wrongCode";case 14:return"expired";case 15:return"tooManyAttempts";case 13:return"rateLimited";case 12:return"deliveryFailed";case 11:return"deliveryUnavailable";default:return"unknown"}}var fa={pl:{title:"Zaloguj si\u0119",description:"Wy\u015Blemy do Ciebie kod na maila, dzi\u0119ki kt\xF3remu si\u0119 zalogujesz.",codeTitle:"Wpisz kod z maila",codeDescription:"Kod ma 6 cyfr."},en:{title:"Sign in",description:"We will email you a code that signs you in.",codeTitle:"Enter the code from the email",codeDescription:"The code has 6 digits."}};function Un(e=L(),t){return{...fn(e,t),...Et(fa,e),...ga(t,["title","description","codeTitle","codeDescription"])}}function ga(e,t){let n={};for(let o of t){let r=e?.[o];r!=null&&(n[o]=r)}return n}var ya="return_url",mr="__return_url",ha="accessToken";function gt(e){let t=new URLSearchParams(e).get(ya);return t?_n(t):null}function yt(e){typeof window>"u"||(e?window.sessionStorage.setItem(mr,e):window.sessionStorage.removeItem(mr))}function Ze(){if(typeof window>"u")return null;let e=window.sessionStorage.getItem(mr);return e?_n(e):null}function ba(e,t){return t.some(n=>{if(e===n)return!0;let o=new URL(n).hostname,r=new URL(e).hostname;return r.endsWith(`.${o}`)||r===o})}function _n(e){try{let t=new URL(e);return t.protocol!=="https:"&&t.protocol!=="http:"||!ba(t.origin,pt())?null:t.toString()}catch{return null}}function Qe(e,t){let n=new URL(e);return n.searchParams.set(ha,t),n.toString()}import{jsx as ie,jsxs as jn}from"react/jsx-runtime";if(typeof window<"u"){let t=[window.location.origin,"https://bitsnap.pl","https://kursy.bitsnap.pl"];pt().length===0&&ut(Array.from(new Set(t)))}var va=({texts:e,projectID:t,host:n,locale:o,logo:r})=>{let a=St(),{mutateAsync:i}=ae(j.publicApi.userPanelLogin),{mutateAsync:d}=ae(j.publicApi.userPanelLoginWithCode),u=Fn(()=>({async send(x){try{let f=await i({email:x});return f.result.case==="success"?{ok:!0,retryIn:f.result.value.retryIn||void 0,challengeId:f.result.value.challengeId||void 0}:{ok:!1,kind:pr(f.result.case==="failure"?f.result.value:0)}}catch(f){return{ok:!1,kind:dr(f),cause:f}}},async verify({email:x,code:f,challengeId:c}){try{let m=await d({code:parseInt(f,10),email:x,challengeId:c});return m.result.case==="accessToken"&&m.result.value?{ok:!0,value:{accessToken:m.result.value}}:{ok:!1,kind:pr(m.result.case==="failure"?m.result.value:0)}}catch(m){return{ok:!1,kind:dr(m),cause:m}}}}),[i,d]),l=yn({adapter:u,texts:e,storageKey:mn("panel",t,n),onVerified:({accessToken:x},f)=>{a.track("panel_login",{}),bn(t,x,f,n);let c=typeof window<"u"?Ze():null;setTimeout(()=>{if(c){window.location.href=Qe(c,x);return}window.location.reload()},100)}}),g=l.step==="code",b=g&&!l.needsEmail?e.codeTitle:e.title,w=g&&!l.needsEmail?e.codeDescription:e.description;return ie("main",{className:"mx-auto flex w-full max-w-sm flex-1 flex-col justify-start pt-4 sm:pt-[12vh]",children:jn(Re,{children:[ie(Lt,{projectId:t,locale:o,className:"px-4 sm:px-6",...r}),jn(je,{className:"px-4 sm:px-6",children:[ie(Fe,{role:"heading","aria-level":1,className:"text-2xl",children:b}),ie(Mn,{children:w})]}),ie(De,{className:"px-4 sm:px-6",children:ie(On,{login:l,texts:e,emailInputId:"email",codeInputId:"verify-code"})})]})})},ka=({analytics:e,texts:t,locale:n,showLogo:o,logoUrl:r,logoDarkUrl:a})=>{let{theme:i,allowedReturnOrigins:d,projectID:u,host:l}=ve(),g=Ve(u,e,"panel"),b=Fn(()=>Un(n??L(),t),[n,t]),w={"--button-background-color":i?.colors?.brand??"#FFFFFF","--button-background-color-dark":i?.colors?.brandDark??"#000000","--button-text-color":i?.colors?.brandDark??"#000000","--button-text-color-dark":i?.colors?.brand??"#FFFFFF"},[x]=Pa({duration:300,easing:"ease-in-out",disrespectUserMotionPreference:!1});return zn(()=>{typeof window>"u"||mt(u,l)!=null&&(window.location.href=window.location.href.replaceAll("login",""))},[u,l]),zn(()=>{if(typeof window>"u"||window.parent!==window)return;let f=gt(window.location.search);f&&yt(f);let c=f??Ze();if(!c)return;let m=mt(u,l);m&&(window.location.href=Qe(c,m))},[d,u,l]),ie(It,{value:g,children:ie("div",{className:"bg-white text-black dark:bg-black dark:text-white",children:ie("div",{className:"font-inter flex min-h-screen w-full flex-col p-4",style:w,ref:x,children:ie(va,{texts:b,projectID:u,host:l,locale:n,logo:{showLogo:o,logoUrl:r??i?.logoURL,logoDarkUrl:a??i?.logoDarkURL}})})})})},xa=(e={})=>ie(ka,{...e});import{useAutoAnimate as ls}from"@formkit/auto-animate/react";import{useEffect as Ut,useState as Io}from"react";import{useState as wa,useCallback as Ca,useEffect as Na}from"react";function qn(e){let[t,n]=wa(()=>{if(typeof window>"u")return e;let r=new URLSearchParams(window.location.search),a={};return Object.keys(e).forEach(i=>{let d=r.get(i);if(d!==null)try{a[i]=JSON.parse(d)}catch{a[i]=d}}),{...e,...a}}),o=Ca(r=>{n(a=>{let i={...a,...r};if(typeof window<"u"){let d=new URLSearchParams;Object.keys(i).forEach(l=>{let g=i[l];g!=null&&d.set(l,JSON.stringify(g))});let u=`${window.location.pathname}?${d.toString()}`;window.history.pushState({},"",u)}return i})},[]);return Na(()=>{let r=()=>{let a=new URLSearchParams(window.location.search),i={};Object.keys(e).forEach(d=>{let u=a.get(d);if(u!==null)try{i[d]=JSON.parse(u)}catch{i[d]=u}}),n({...e,...i})};return window.addEventListener("popstate",r),()=>window.removeEventListener("popstate",r)},[e]),[t,o]}function Hn(e,t){if(e!=null)return e;let n=t?.trim();if(!(n==null||n===""))return{tokens:vn(n)}}var Ia={pl:{returnsNavLabel:"Zwroty",openCourse:"Otw\xF3rz kurs",libraryNavLabel:"Biblioteka",messagesNavLabel:"Wiadomo\u015Bci",ordersNavLabel:"Zam\xF3wienia",accountNavLabel:"Konto",navigationLabel:"Panel klienta",logout:"Wyloguj si\u0119",profileHeading:"Profil",emailLabel:"E-mail",noData:"Brak danych",languageLabel:"J\u0119zyk",polishLanguage:"Polski",englishLanguage:"English",plansHeading:"Plany",plansUnavailable:"Plany nie s\u0105 obecnie dost\u0119pne w panelu.",notificationsHeading:"Powiadomienia",notificationsUnavailable:"Ustawienia powiadomie\u0144 nie s\u0105 obecnie dost\u0119pne w panelu.",ordersHeading:"Historia zam\xF3wie\u0144",ordersDescription:"Twoje zam\xF3wienia",ordersEmpty:"Brak zam\xF3wie\u0144.",ordersError:"Nie uda\u0142o si\u0119 pobra\u0107 zam\xF3wie\u0144.",retry:"Spr\xF3buj ponownie",orderLabel:"Zam\xF3wienie",customerLabel:"Klient",dateLabel:"Data",ordersEnd:"To ju\u017C wszystkie Twoje zam\xF3wienia.",previousPage:"Poprzednia strona",nextPage:"Nast\u0119pna strona",paginationLabel:"Strony zam\xF3wie\u0144",statusDraft:"Szkic",statusUnpaid:"Nieop\u0142acone",statusPaid:"Op\u0142acone",statusOverdue:"Zaleg\u0142e",statusCancelled:"Anulowane",statusCompleted:"Zako\u0144czone",statusProcessing:"Przetwarzane",statusRefunded:"Zwr\xF3cone"},en:{returnsNavLabel:"Returns",openCourse:"Open the course",libraryNavLabel:"Library",messagesNavLabel:"Messages",ordersNavLabel:"Orders",accountNavLabel:"Account",navigationLabel:"Customer panel",logout:"Log out",profileHeading:"Profile",emailLabel:"Email",noData:"No data",languageLabel:"Language",polishLanguage:"Polski",englishLanguage:"English",plansHeading:"Plans",plansUnavailable:"Plans are currently unavailable in the panel.",notificationsHeading:"Notifications",notificationsUnavailable:"Notification settings are currently unavailable in the panel.",ordersHeading:"Order history",ordersDescription:"Your orders",ordersEmpty:"No orders yet.",ordersError:"Could not load your orders.",retry:"Try again",orderLabel:"Order",customerLabel:"Customer",dateLabel:"Date",ordersEnd:"You\u2019ve reached the end of your orders.",previousPage:"Previous page",nextPage:"Next page",paginationLabel:"Order pages",statusDraft:"Draft",statusUnpaid:"Unpaid",statusPaid:"Paid",statusOverdue:"Overdue",statusCancelled:"Cancelled",statusCompleted:"Completed",statusProcessing:"Processing",statusRefunded:"Refunded"}};function pe(e=L()){return Et(Ia,e)}import{jsx as $n,jsxs as Sa}from"react/jsx-runtime";function fr({}){let e=pe();return Sa("section",{children:[$n("h3",{className:"text-2xl",children:e.notificationsHeading}),$n("p",{className:"mt-6 text-sm text-neutral-600 dark:text-neutral-400",children:e.notificationsUnavailable})]})}import{useState as Ea}from"react";import{Fragment as Da,jsx as M,jsxs as V}from"react/jsx-runtime";var La=e=>new Date(e*1e3).toLocaleDateString(L(),{year:"numeric",month:"short",day:"numeric"}),Ta=(e,t)=>new Intl.NumberFormat(L(),{style:"currency",currency:t.toUpperCase()}).format(e/100),Aa={draft:"text-neutral-600 dark:text-neutral-400",unpaid:"text-amber-700 dark:text-amber-300",paid:"text-green-700 dark:text-green-400",overdue:"text-red-700 dark:text-red-400",cancelled:"text-neutral-600 line-through dark:text-neutral-400",completed:"text-green-700 dark:text-green-400",processing:"text-blue-700 dark:text-blue-400",refunded:"text-purple-700 dark:text-purple-400"};function Ra({openOrderDetails:e,projectID:t,accessToken:n}){let o=pe(),r={draft:o.statusDraft,unpaid:o.statusUnpaid,paid:o.statusPaid,overdue:o.statusOverdue,cancelled:o.statusCancelled,completed:o.statusCompleted,processing:o.statusProcessing,refunded:o.statusRefunded},[a,i]=Ea(0),d=20,{data:u,isFetching:l,isError:g,refetch:b}=Ae(j.publicApi.getOrders,{projectId:t,accessToken:n,offset:a,limit:d}),w=u?.orders??[],x=u?.totalCount??0,f=Math.floor(a/d)+1,c=Math.ceil(x/d),m=p=>{i(p)};return V(Da,{children:[M("h3",{className:"text-2xl",children:o.ordersHeading}),M("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:o.ordersDescription}),l?M("div",{className:"mt-6 flex w-full flex-col gap-3",children:[...Array(5)].map((p,v)=>V("div",{className:"rounded-xl bg-white p-4 shadow-sm dark:bg-neutral-800",children:[V("div",{className:"flex items-center justify-between gap-3",children:[V("div",{className:"space-y-2",children:[M(Je,{className:"h-4 w-24"}),M(Je,{className:"h-3 w-32"})]}),V("div",{className:"space-y-2 text-right",children:[M(Je,{className:"ml-auto h-4 w-16"}),M(Je,{className:"ml-auto h-3 w-12"})]})]}),M("div",{className:"mt-3",children:M(Je,{className:"h-3 w-40"})})]},v))}):g?V("div",{role:"alert",className:"mt-6 space-y-3",children:[M("p",{children:o.ordersError}),M(S,{onClick:()=>void b(),className:"min-h-11 focus-visible:outline-2 focus-visible:outline-current",children:o.retry})]}):w.length===0?M("div",{className:"mt-6 text-sm text-neutral-600 dark:text-neutral-400",children:o.ordersEmpty}):V("div",{children:[M("div",{className:"mt-6 flex w-full flex-col gap-3",children:w.map(p=>V("button",{onClick:()=>e(p.id),className:"block min-h-11 focus-visible:outline-2 focus-visible:outline-current rounded-xl bg-white p-4 text-left shadow-sm transition-colors hover:bg-neutral-50 dark:bg-neutral-800 dark:hover:bg-neutral-700",children:[V("div",{className:"flex items-center justify-between gap-3",children:[V("div",{className:"min-w-0 break-words",children:[V("p",{className:"font-medium",children:[o.orderLabel," #",p.id]}),M("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:p.customerName||o.customerLabel})]}),V("div",{className:"shrink-0 text-right",children:[M("p",{className:"font-semibold",children:Ta(p.totalAmount,p.currency)}),M("p",{className:`text-xs font-medium ${Aa[p.status]??"text-neutral-400"}`,children:r[p.status]??p.status})]})]}),M("div",{className:"mt-2 flex items-center justify-between gap-3 text-xs text-neutral-500 dark:text-neutral-400",children:V("span",{children:[o.dateLabel,":"," ",p.createdAt?La(Number(p.createdAt.seconds)):"-"]})})]},p.id))}),f>=c&&M("p",{className:"mt-6 text-center text-sm text-neutral-600 dark:text-neutral-400",children:o.ordersEnd}),c>1&&V("nav",{"aria-label":o.paginationLabel,className:"mt-4 flex flex-wrap items-center justify-center gap-2",children:[f>1&&M(S,{variant:"outline",className:"min-h-11",onClick:()=>m(a-d),children:o.previousPage}),Array.from(new Set([1,f-1,f,f+1,c])).filter(p=>p>0&&p<=c).sort((p,v)=>p-v).map(p=>M(S,{variant:p===f?"secondary":"ghost",className:"min-h-11 min-w-11","aria-current":p===f?"page":void 0,onClick:()=>m((p-1)*d),children:p},p)),f<c&&M(S,{variant:"outline",className:"min-h-11",onClick:()=>m(a+d),children:o.nextPage})]})]})]})}var Bn=Ra;import{jsx as Kn,jsxs as Ma}from"react/jsx-runtime";function gr({projectID:e}){let t=pe();return Ma("section",{children:[Kn("h3",{className:"text-2xl",children:t.plansHeading}),Kn("p",{className:"mt-6 text-sm text-neutral-600 dark:text-neutral-400",children:t.plansUnavailable})]})}import{useEffect as Oa,useState as yr}from"react";import{jsx as se,jsxs as za}from"react/jsx-runtime";function Ua(e,t,n,o){typeof window>"u"||(t&&Ye(n,o),window.location.href=e)}function _a({projectID:e,host:t,loginURL:n,screen:o,params:r,setParams:a,setActiveScreen:i}){let{status:d,exchangeError:u}=Nn("PanelReturns"),l=Cn(),g=d==="anonymous"&&(u==null||xn(u));Oa(()=>{g&&Ua(n,u!=null,e,t)},[g,n,u,e,t]);let[b,w]=yr("orders"),[x,f]=yr({items:[],note:""}),[c,m]=yr();if(d==="anonymous"&&!g)return za("div",{role:"alert",className:"flex flex-col items-start gap-3",children:[se("p",{className:"text-sm",children:l(wn(u))}),se(S,{type:"button",onClick:()=>window.location.reload(),children:l("errorRetry")})]});if(d!=="authenticated")return se(Sn,{});let p=v=>{w(v),a({state:"returns",orderId:void 0,returnId:void 0}),i("returns")};if(o==="return-details"&&r.returnId)return se(Dn,{returnId:r.returnId,onBack:()=>p("myReturns")});if(b==="myReturns")return se(Rn,{onBack:()=>p("orders"),onSelectReturn:v=>{a({state:"return-details",returnId:v,orderId:void 0}),i("return-details")}});if(b==="result"&&c!=null)return se(An,{returnId:c,onContinue:()=>p("orders"),onOpenMyReturns:()=>p("myReturns")});if(r.orderId){let v=r.orderId;return b==="confirmation"?se(Tn,{orderId:v,items:x.items,note:x.note,onBack:()=>w("orders"),onSubmitted:z=>{m(z),f({items:[],note:""}),w("result"),a({orderId:void 0})}}):se(Ln,{orderId:v,initialItems:x.items.length>0?x.items:void 0,initialNote:x.note,onBack:()=>{f({items:[],note:""}),a({orderId:void 0})},onContinue:z=>{f(z),w("confirmation")}})}return se(En,{showLogout:!1,onSelectOrder:v=>{f({items:[],note:""}),w("orders"),a({orderId:v})},onOpenMyReturns:()=>p("myReturns")})}function hr({accessToken:e,appearance:t,texts:n,...o}){return se(In,{projectID:o.projectID,host:o.host,appearance:t,texts:n,panelAccessToken:e,children:se(_a,{...o})})}import{lazy as Ci,Suspense as Ni,useEffect as Cr,useState as Ii}from"react";import{BookOpen as Si,Files as Ei,Headphones as Li,MessageCircle as Ti,Ticket as Ai,Users as Ri}from"lucide-react";var ja={hello:"Hej \u{1F44B}",intro:"Poni\u017Cej znajdziesz swoje produkty",loading:"\u0141adowanie produkt\xF3w\u2026",empty:"Nie masz jeszcze produkt\xF3w w tym sklepie. Twoje zakupy pojawi\u0105 si\u0119 tutaj.",audio:"Audio",files:"Pliki",course:"Kurs",ticket:"Bilet",chat:"Czat",community:"Spo\u0142eczno\u015B\u0107",openMessages:"Otw\xF3rz wiadomo\u015Bci",listen:"S\u0142uchaj",openCourse:"Otw\xF3rz kurs",downloadFiles:"Pobierz pliki",showTicket:"Poka\u017C bilet",back:"Wr\xF3\u0107",yourFiles:"Twoje pliki",download:"Pobierz",retry:"Spr\xF3buj ponownie",fileError:"Nie uda\u0142o si\u0119 wczyta\u0107 plik\xF3w.",noFiles:"Brak plik\xF3w do pobrania.",ticketInfo:"Tw\xF3j zakupiony bilet",file:"Plik"},Fa={hello:"Hi \u{1F44B}",intro:"Your products are below",loading:"Loading products\u2026",empty:"You have no products in this shop yet. Your purchases will show up here.",audio:"Audio",files:"Files",course:"Course",ticket:"Ticket",chat:"Chat",community:"Community",openMessages:"Open messages",listen:"Listen",openCourse:"Open course",downloadFiles:"Download files",showTicket:"Show ticket",back:"Back",yourFiles:"Your files",download:"Download",retry:"Try again",fileError:"Your files could not be loaded.",noFiles:"No files to download.",ticketInfo:"Your purchased ticket",file:"File"};function Xe(){return L().toLowerCase().startsWith("en")?Fa:ja}import{jsx as Ba}from"react/jsx-runtime";var qa=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g,Ha=e=>[...e.matchAll(qa)].map(n=>({url:n[0],startIndex:n.index,endIndex:n.index+n[0].length-1})),$a=(e,t)=>{let n="",o=0;t.sort((r,a)=>r.startIndex-a.startIndex);for(let{startIndex:r,endIndex:a,replacementText:i}of t)n+=e.slice(o,r),n+=i,o=a+1;return n+=e.slice(o),n},Gn=e=>{let t=Ha(e);return Ba("p",{dangerouslySetInnerHTML:{__html:$a(e,t.map(n=>(n.replacementText=`<a key=${n.url} href=${n.url} style="text-decoration: underline;" target="_blank">
2
+ ${n.url}
3
+ </a>`,n)))}})};import{fromJsonString as Di}from"@bufbuild/protobuf";import{useAutoAnimate as hi}from"@formkit/auto-animate/react";import{ChevronLeft as bi,Download as Pi}from"lucide-react";import{useEffect as io,useRef as so,useState as He}from"react";import oi from"hls.js";import{Pause as ai,Play as ii,SkipBack as si,SkipForward as li}from"lucide-react";import{forwardRef as di,useEffect as qe,useImperativeHandle as ci,useRef as K,useState as we}from"react";import{jsx as br,jsxs as Ga}from"react/jsx-runtime";function Ka(){return Ga("div",{className:"flex items-center gap-2",children:[br("div",{className:"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.3s]"}),br("div",{className:"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.15s]"}),br("div",{className:"h-3 w-3 animate-bounce rounded-full bg-current"})]})}var ke=Ka;import Va from"hls.js";var Wa=[401,403],Vn="networkError",Wn="mediaError";function Ya(e,t){if(e==null||e.fatal!==!0)return{action:"ignore"};let n=e.response?.code,o=e.type===Vn?"network":e.type===Wn?"media":"unknown",r=n==null?{kind:o}:{kind:o,status:n};return n!=null&&Wa.includes(n)?{action:"expired",error:{kind:"network",status:n}}:e.type===Vn&&!t.network?{action:"restart-load"}:e.type===Wn&&!t.media?{action:"recover-media"}:{action:"fail",error:r}}function Yn(e){let t=e.HlsCtor??Va,n=new t,o,r=!1,a=!1;return n.attachMedia(e.media),n.on(t.Events.ERROR,(i,d)=>{let u=Ya(d,{network:r,media:a});switch(u.action){case"expired":e.handlers?.onExpiredUrl?.(),e.handlers?.onError?.(u.error);break;case"restart-load":r=!0,n.startLoad();break;case"recover-media":a=!0,n.recoverMediaError();break;case"fail":e.handlers?.onError?.(u.error);break;case"ignore":break}}),{load(i){o=i,r=!1,a=!1,n.loadSource(i)},retry(){o!=null&&(r=!1,a=!1,n.loadSource(o))},destroy(){n.destroy()},get src(){return o}}}function Jn(e){try{return e.canPlayType("application/vnd.apple.mpegurl")!==""}catch{return!1}}function Zn(e){switch(e?.code){case 2:return{kind:"network"};case 3:case 4:return{kind:"media"};default:return{kind:"unknown"}}}var Ja={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",avif:"image/avif",svg:"image/svg+xml"},Pr="512x512";function et(){return typeof navigator<"u"&&typeof navigator.mediaSession<"u"}function Za(e){if(typeof e!="string"||e.length===0)return{src:e,sizes:Pr};let t=e.split(/[?#]/)[0],n=t.includes(".")?t.slice(t.lastIndexOf(".")+1).toLowerCase():"",o=Ja[n],r={src:e,sizes:Pr};return o!=null&&(r.type=o),r}function Qa(e){if(e==null)return;let t=Array.isArray(e)?e:[e],n=[];for(let o of t){if(typeof o=="string"){o.length>0&&n.push(Za(o));continue}o!=null&&o.src.length>0&&n.push({src:o.src,sizes:o.sizes??Pr,...o.type!=null?{type:o.type}:{}})}return n.length>0?n:void 0}function vr(e){!et()||typeof MediaMetadata>"u"||(navigator.mediaSession.metadata=new MediaMetadata({title:e.title,album:e.album,artist:e.artist,artwork:Qa(e.artwork)}))}function Qn(){et()&&(navigator.mediaSession.playbackState="playing")}function Xn(){et()&&(navigator.mediaSession.playbackState="paused")}function eo(e,t,n=1){if(!et()||e==null||!Number.isFinite(e)||e<=0||t!=null&&isNaN(t))return;let o=Math.min(Math.max(t??0,0),e),r=Number.isFinite(n)&&n>0?n:1;try{navigator.mediaSession.setPositionState({playbackRate:r,duration:e,position:o})}catch{}}var to=["play","pause","stop","seekbackward","seekforward","seekto","previoustrack","nexttrack"];function ro(e){if(et()){vr({title:e.title,album:e.album,artist:e.artist,artwork:e.artwork});for(let t of to)try{navigator.mediaSession.setActionHandler(t,n=>{e.action(n)})}catch{}}}function no(){if(et()){navigator.mediaSession.metadata=null;for(let e of to)try{navigator.mediaSession.setActionHandler(e,null)}catch{}}}import{useEffect as Xa,useState as ei}from"react";var ti={play:"Odtw\xF3rz",pause:"Wstrzymaj",previous:"Poprzedni rozdzia\u0142",next:"Nast\u0119pny rozdzia\u0142",rewind:"Cofnij o 10 sekund",forward:"Przewi\u0144 o 10 sekund",progress:"Post\u0119p odtwarzania",of:"z",speed:"Pr\u0119dko\u015B\u0107",sleep:"Wy\u0142\u0105cznik czasowy",off:"Wy\u0142\u0105czony",end:"Koniec rozdzia\u0142u",cancel:"Anuluj wy\u0142\u0105cznik",error:"Nie uda\u0142o si\u0119 odtworzy\u0107 nagrania.",retry:"Spr\xF3buj ponownie",left:"zosta\u0142o",book:"ca\u0142a ksi\u0105\u017Cka",chapter:"rozdzia\u0142",chapters:"Rozdzia\u0142y",loading:"\u0141adowanie rozdzia\u0142\xF3w\u2026",empty:"Brak rozdzia\u0142\xF3w do wy\u015Bwietlenia.",resume:"Kontynuuj",chapterName:"Rozdzia\u0142",download:"Pobierz rozdzia\u0142",playing:"Teraz odtwarzane",played:"Ods\u0142uchane"},ri={play:"Play",pause:"Pause",previous:"Previous chapter",next:"Next chapter",rewind:"Rewind 10 seconds",forward:"Forward 10 seconds",progress:"Playback progress",of:"of",speed:"Speed",sleep:"Sleep timer",off:"Off",end:"End of chapter",cancel:"Cancel timer",error:"The recording could not be played.",retry:"Try again",left:"left",book:"whole book",chapter:"chapter",chapters:"Chapters",loading:"Loading chapters\u2026",empty:"No chapters to display.",resume:"Continue",chapterName:"Chapter",download:"Download chapter",playing:"Now playing",played:"Played"};function Rt(e){let[t,n]=ei("pl");return Xa(()=>{try{n(L())}catch{}},[]),(e??t).toLowerCase().startsWith("en")?ri:ti}function xe(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return`${t>=3600?`${Math.floor(t/3600)}:`:""}${String(Math.floor(t/60)%60).padStart(2,"0")}:${String(t%60).padStart(2,"0")}`}var W={get(e){try{return localStorage.getItem(e)}catch{return null}},set(e,t){try{localStorage.setItem(e,t)}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}},kr="__player__speed",Dt=[.75,1,1.25,1.5,1.75,2];import{jsx as D,jsxs as H}from"react/jsx-runtime";var ui=di(({chapters:e,locale:t,styles:n,updateCurrentTime:o,setCurrentTimeHandler:r,title:a,imageURL:i,coverShownBeside:d,author:u,uniqueProductID:l,onChapterChange:g,onError:b,onExpiredUrl:w,onFinished:x},f)=>{let c=Rt(t),[m,p]=we(1),v=K(1),[z,ee]=we(),[T,ce]=we("off"),[Se,oe]=we(0),te=K({mode:"off",deadline:0});function fe(){te.current={mode:"off",deadline:0},ce("off"),oe(0)}function I(s){let h=Number(s)*60;te.current={mode:s,deadline:Number.isFinite(h)?Date.now()+h*1e3:0},ce(s),oe(Number.isFinite(h)?h:0)}function ge(s){Dt.includes(s)&&(p(s),v.current=s,W.set(kr,String(s)),U.current&&(U.current.playbackRate=s),B())}qe(()=>{let s=Number(W.get(kr));Dt.includes(s)&&ge(s);let h=setInterval(()=>{let{mode:k,deadline:A}=te.current;if(k==="off"||k==="chapter")return;let Pe=Math.max(0,Math.ceil((A-Date.now())/1e3));oe(Pe),Pe===0&&(ze.current=!1,xt(),fe())},1e3);return()=>clearInterval(h)},[]);let J;(k=>(k[k.Playing=0]="Playing",k[k.Paused=1]="Paused"))(J||={});let[_e,lt]=we(1),[Bt,Ee]=we(void 0),[C,ye]=we(void 0),[Be,ue]=we(!1),[vt,Kr]=we(null),U=K(null),he=K(null),kt=K(void 0),ta=K(null),re=K(null),Kt=K(null),ze=K(!1),Ke=K(!1),dt=K(null),Gt=K(null),Vt=K(e),Gr=K(null),ne=K({onChapterChange:g,onError:b,onExpiredUrl:w,onFinished:x,updateCurrentTime:o,title:a,imageURL:i,author:u});ne.current={onChapterChange:g,onError:b,onExpiredUrl:w,onFinished:x,updateCurrentTime:o,title:a,imageURL:i,author:u};function Wt(s){!Ke.current||!Number.isFinite(s)||s<0||W.set(`__player__${l}_${re.current?.id}`,`${Math.floor(s)}`)}function ra(){let s=W.get(`__player__${l}_${re.current?.id}`);if(s!=null)try{let h=parseInt(s);return isNaN(h)||h<0?void 0:h}catch{return}}function na(){let s=W.get(`__player__${l}_last_chapter`);if(s!=null)return s}function Vr(s){W.set(`__player__${l}_last_chapter`,s)}function Wr(s){W.remove(`__player__${l}_${s}`)}function Yt(s){vr({title:s?.name??ne.current.title??"",album:ne.current.title,artist:ne.current.author,artwork:ne.current.imageURL})}function Yr(s){Kt.current=s,Kr(s),ue(!1),ne.current.onError?.(s)}function Jr(){Kt.current=null,Kr(null)}function Zr(){let s=U.current;if(s==null)return;let h=s.play();h!=null&&typeof h.catch=="function"&&h.catch(()=>{}),B()}function Qr(){Zr()}function xt(){U.current?.pause(),B()}function oa(){if(_e===0){xt();return}Qr()}function Le(s){let h=U.current;if(h==null||!Number.isFinite(s))return;let k=Number.isFinite(h.duration)?h.duration:0,A=k>0?Math.min(Math.max(s,0),k):Math.max(s,0);Ee(A),h.currentTime=A,B()}function wt(s){let h=U.current;if(h==null)return;let k=Number.isFinite(h.duration)?h.duration:void 0,A=Math.max(h.currentTime+s,0);k!=null&&A>k&&(A=k),Le(A)}function Jt(s){let h=U.current;if(h!=null){if(Jr(),ue(!0),Jn(h)){Zt(),h.src=s,h.load();return}if(oi.isSupported()){he.current==null&&(he.current=Yn({media:h,handlers:{onError:k=>{Yr(k)},onExpiredUrl:()=>{ne.current.onExpiredUrl?.()}}})),he.current.load(s);return}Zt(),h.src=s,h.load()}}function Zt(){he.current?.destroy(),he.current=null}function Ct(s,h){let k=h?.play===!0;re.current&&U.current&&!U.current.ended&&Wt(U.current.currentTime),Ke.current=!1,dt.current=null,ze.current=k,re.current=s,ee(s.id),Ee(0),ye(s.duration),Jt(s.publicUrl),Yt(s),ne.current.onChapterChange?.(s),Vr(s.id)}function Qt(s){if(s.length===0)return;let h=na(),k=(h!=null?s.find(A=>A.id===h):void 0)??s[0];Ct(k,{play:!1})}function Xt(){let s=Vt.current,h=re.current;if(s==null||s.length===0||h==null)return;let k=s.findIndex(Pe=>Pe.id===h.id);if(k===-1)return;let A=k+1;if(A>=s.length){aa(h);return}Ct(s[A],{play:!0})}function Xr(){let s=Vt.current,h=re.current;if(h==null)return;let k=U.current;if(k!=null&&k.currentTime>3){Le(0);return}let A=s==null?-1:s.findIndex(Pe=>Pe.id===h.id);if(A>0){Ct(s[A-1],{play:!0});return}Le(0)}function aa(s){Wr(s.id),ze.current=!1,U.current?.pause(),lt(1),ne.current.onFinished?.()}function en(){let s=re.current;if(s!=null){if(W.set(`__player__${l}_${s.id}_completed`,"true"),Wr(s.id),te.current.mode==="chapter"){ze.current=!1,xt(),fe();return}Xt(),B()}}function tn(){let s=U.current;if(s!=null){if(ue(!1),s.playbackRate=v.current,Gt.current=null,!Ke.current){Ke.current=!0;let h=dt.current;if(dt.current=null,h!=null)Le(h);else{let k=ra();k!=null&&Le(k)}}ze.current&&(ze.current=!1,Zr())}}function rn(){let s=U.current?.error,h=re.current?.publicUrl;(s?.code===2||s?.code===4)&&he.current==null&&h!=null&&Gt.current!==h&&(Gt.current=h,ne.current.onExpiredUrl?.()),Yr(Zn(s))}function nn(){let h=re.current?.publicUrl??he.current?.src;if(h==null)return;let A=U.current?.currentTime??0;Jr(),Ke.current=!1,dt.current=A>0?A:null,Ee(A),he.current!=null?he.current.retry():Jt(h)}function ia(s){switch(s.action){case"play":Qr();break;case"pause":case"stop":xt();break;case"seekbackward":wt(-(s.seekOffset??10));break;case"seekforward":wt(s.seekOffset??10);break;case"seekto":s.seekTime!=null&&Le(s.seekTime);break;case"previoustrack":Xr();break;case"nexttrack":Xt();break;default:break}}ci(f,()=>({selectChapter:s=>{Ct(s,{play:!0})},retry:nn,getError:()=>Kt.current}));function B(){let s=U.current;s!=null&&(lt(s.paused?1:0),ye(s.duration),Ee(s.currentTime),s.ended||Wt(s.currentTime),eo(s.duration,s.currentTime,s.playbackRate),s.networkState===s.NETWORK_LOADING&&s.readyState<=s.HAVE_FUTURE_DATA?ue(!0):ue(!1),ne.current.updateCurrentTime?.(s.currentTime))}qe(()=>(ro({title:a??"",album:a,artist:u,artwork:i,action:ia}),()=>{no()}),[]),qe(()=>{Yt(re.current)},[a,u,i]),qe(()=>{let s=U.current;if(s!=null)return s.addEventListener("loadeddata",tn),s.addEventListener("ended",en),s.addEventListener("error",rn),s.addEventListener("timeupdate",B),s.addEventListener("play",B),s.addEventListener("pause",B),s.addEventListener("ratechange",B),B(),kt.current=setInterval(B,500),()=>{s.removeEventListener("loadeddata",tn),s.removeEventListener("ended",en),s.removeEventListener("error",rn),s.removeEventListener("timeupdate",B),s.removeEventListener("play",B),s.removeEventListener("pause",B),s.removeEventListener("ratechange",B),kt.current!=null&&(clearInterval(kt.current),kt.current=void 0),s.ended||Wt(s.currentTime),Ee(void 0),s.pause(),Zt(),s.removeAttribute("src"),s.load()}},[]),qe(()=>{r?.(Le)},[]);let er=e.map(s=>`${s.id}|${s.publicUrl??""}`).join(`
4
+ `);qe(()=>{Vt.current=e;let s=Gr.current;if(s===er)return;if(Gr.current=er,s==null){Qt(e);return}let h=re.current;if(h==null){Qt(e);return}let k=e.find(A=>A.id===h.id);if(!(k!=null&&k.publicUrl===h.publicUrl)){if(k!=null){let A=U.current,Pe=A?.currentTime??0,la=A!=null&&!A.paused;re.current=k,Ke.current=!1,dt.current=Pe>0?Pe:null,ze.current=la,Jt(k.publicUrl),Yt(k),ne.current.onChapterChange?.(k),Vr(k.id);return}Qt(e)}},[er]),qe(()=>{switch(_e){case 0:Qn();break;case 1:Xn();break}},[_e]);let Ge=e.findIndex(s=>s.id===z),be=Number.isFinite(C)&&C>0?C:e[Ge]?.duration??0,ct=Math.min(Math.max(Bt??0,0),be||1/0),on=e.length>0&&e.every(s=>Number.isFinite(s.duration)&&s.duration>0),sa=Math.max(0,be-ct+(on?e.slice(Ge+1).reduce((s,h)=>s+h.duration,0):0))/m,tr=Math.ceil(sa/60),an=`${Math.floor(tr/60)>0?`${Math.floor(tr/60)} h `:""}${tr%60} min`;return H("div",{id:"audio-player-container",className:"bitsnap-audio-player flex min-w-0 flex-col gap-3 text-neutral-900 dark:text-neutral-100",style:{...n,"--seek-before-width":`${be>0?ct/be*100:0}%`},ref:ta,"data-player-error":vt?.kind,children:[D("video",{ref:U,className:"hidden",poster:i,title:a}),H("div",{className:F("flex min-w-0 items-center gap-3",d&&"lg:hidden"),children:[i&&D("img",{src:i,alt:"",className:"h-16 w-16 shrink-0 rounded object-contain"}),H("div",{className:"min-w-0 break-words",children:[D("p",{className:"font-semibold",children:e[Ge]?.name??a}),u&&D("p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:u})]})]}),vt&&H("div",{role:"alert",className:"rounded-lg bg-red-50 p-3 text-red-800 dark:bg-red-950 dark:text-red-200",children:[D("p",{children:c.error}),D(S,{variant:"outline",onClick:nn,children:c.retry})]}),D("input",{type:"range",min:"0",max:be||100,value:ct,disabled:!be,"aria-label":c.progress,"aria-valuetext":`${xe(ct)} ${c.of} ${xe(be)}`,onChange:s=>Le(Number(s.target.value))}),H("section",{className:"flex w-full justify-between text-sm tabular-nums",children:[D("span",{id:"current-time",children:xe(ct)}),D("span",{id:"duration",children:xe(be)})]}),be>0&&H("p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:[c.left==="left"?`${an} ${c.left}`:`${c.left} ${an}`," ","\xB7 ",on?c.book:c.chapter," (",m,"\xD7)"]}),H("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[D(S,{variant:"outline",onClick:Xr,disabled:Ge<0,"aria-label":c.previous,children:D(si,{className:"h-5 w-5"})}),H(S,{variant:"outline",onClick:()=>wt(-10),"aria-label":c.rewind,children:["\u2212",10]}),D(S,{variant:"outline",onClick:oa,"aria-label":_e===1?c.play:c.pause,children:_e===1?D(ii,{className:"h-5 w-5"}):D(ai,{className:"h-5 w-5"})}),H(S,{variant:"outline",onClick:()=>wt(10),"aria-label":c.forward,children:["+",10]}),D(S,{variant:"outline",onClick:Xt,disabled:Ge<0||Ge>=e.length-1,"aria-label":c.next,children:D(li,{className:"h-5 w-5"})})]}),H("div",{className:"flex flex-wrap gap-3 md:grid md:grid-cols-2",children:[H("label",{className:"flex flex-1 items-center gap-2 text-sm md:flex-col md:items-start md:whitespace-nowrap",children:[c.speed,D("select",{"aria-label":c.speed,value:m,onChange:s=>ge(Number(s.target.value)),children:Dt.map(s=>H("option",{value:s,children:[s,"\xD7"]},s))})]}),H("label",{className:"flex flex-1 items-center gap-2 text-sm md:flex-col md:items-start md:whitespace-nowrap",children:[c.sleep,H("select",{"aria-label":c.sleep,value:T,onChange:s=>I(s.target.value),children:[D("option",{value:"off",children:c.off}),[15,30,45,60].map(s=>H("option",{value:s,children:[s," min"]},s)),D("option",{value:"chapter",children:c.end})]})]})]}),T!=="off"&&H("div",{className:"flex items-center justify-between gap-2 text-sm",children:[D("span",{role:"timer",children:T==="chapter"?c.end:xe(Se)}),D(S,{variant:"outline",onClick:fe,children:c.cancel})]}),Be&&D("div",{role:"status",className:"flex justify-center",children:D(ke,{})})]})}),oo=ui;import{Check as pi,Download as mi,Play as fi}from"lucide-react";import{useEffect as gi,useState as ao}from"react";import{Fragment as yi,jsx as le,jsxs as rt}from"react/jsx-runtime";function xr({chapters:e,currentID:t,productID:n,onSelect:o,downloadable:r,onDownload:a,loading:i,locale:d}){let u=Rt(d),[l,g]=ao(null),[b,w]=ao([]);gi(()=>{let c=`__player__${n}_`,m=W.get(`${c}last_chapter`),p=Number(m&&W.get(`${c}${m}`));g(m&&p>0&&Number.isFinite(p)?{id:m,time:p}:null),w((e??[]).filter(v=>W.get(`${c}${v.id}_completed`)==="true"||Number(W.get(`${c}${v.id}`))>0).map(v=>v.id))},[e,n,t]);let x=e?.findIndex(c=>c.id===l?.id)??-1,f=e?.findIndex(c=>c.id===t)??-1;return rt("div",{className:"max-h-96 w-full overflow-y-auto",children:[le("h2",{className:"mb-3 text-xl font-semibold",children:u.chapters}),i?le("p",{role:"status",children:u.loading}):e?.length?rt(yi,{children:[l&&x>=0&&rt("button",{type:"button",className:"mb-3 min-h-11 rounded-lg border border-neutral-300 px-3 py-2 text-left dark:border-neutral-600",onClick:()=>o(e[x]),children:[u.resume,": ",u.chapterName," ",x+1,","," ",xe(l.time)]}),le("ul",{className:"flex w-full flex-col gap-2",children:e.map((c,m)=>{let p=c.id===t,v=m<f||b.includes(c.id);return rt("li",{className:"flex min-w-0 items-center gap-2",children:[rt("button",{type:"button","aria-current":p?"true":void 0,className:`min-h-11 min-w-0 flex-1 rounded-lg p-3 text-left hover:bg-neutral-200 dark:hover:bg-neutral-700 ${p?"bg-neutral-200 dark:bg-neutral-700":"bg-neutral-100 dark:bg-neutral-800"}`,onClick:()=>o(c),children:[rt("span",{className:"flex items-center gap-2",children:[p?le(fi,{className:"size-4 shrink-0","aria-label":u.playing}):v?le(pi,{className:"size-4 shrink-0","aria-label":u.played}):null,le("span",{className:"min-w-0 flex-1 break-words text-sm font-medium",children:c.name}),!!c.duration&&le("span",{className:"shrink-0 text-xs tabular-nums text-neutral-600 dark:text-neutral-300",children:xe(c.duration)})]}),c.description&&le("span",{className:"mt-2 block text-xs",children:c.description})]}),r&&c.downloadableUrl&&le("a",{href:c.downloadableUrl,onClick:a,"aria-label":`${u.download} ${m+1}`,className:"inline-flex min-h-11 min-w-11 items-center justify-center rounded focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",children:le(mi,{className:"size-4","aria-hidden":"true"})})]},c.id)})})]}):le("p",{children:u.empty})]})}import{Fragment as Mt,jsx as N,jsxs as Y}from"react/jsx-runtime";function Ce(e,...t){console.warn(e,...t)}function wr(e){console.error(e)}var vi=({accessToken:e,product:t,styles:n,reveal:o})=>{let r=Xe(),a=t.productType,i=St(),d=()=>i.track("panel_download",{},{product_id:t.productId.length<=64?t.productId:null}),u=so(null),[l]=hi(),[g,b]=He(!1),[w,x]=He(null),{mutateAsync:f,isPending:c}=ae(j.publicApi.userPanelGetFileDetails),m=so(void 0),[p,v]=He(null),[z,ee]=He(null),[T,ce]=He(!1),{mutateAsync:Se,isPending:oe}=ae(j.publicApi.userPanelGetAudiobookDetails),{mutateAsync:te,isPending:fe}=ae(j.publicApi.userPanelGetAudiobookDetailsDownloadURLs),[I,ge]=He(null),[J,_e]=He(null);async function lt(){b(!1);try{let C=await f({accessId:t.accessId,accessToken:e});if(C.result.case==="success"){x(C.result.value.files);return}else b(!0),Ce("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),Ce("Kod b\u0142\u0119du: ",C.result.value)}catch(C){b(!0),Ce("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),wr("B\u0142\u0105d podczas pobierania danych:"+C)}}async function Bt(){try{let C=await Se({accessId:t.accessId,accessToken:e});if(C.result.case==="audiobook"){v(C.result.value);return}else Ce("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),Ce("Kod b\u0142\u0119du: ",C.result.value)}catch(C){Ce("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),wr("B\u0142\u0105d podczas pobierania danych:"+C)}}async function Ee(){try{let C=await te({accessId:t.accessId,accessToken:e,isBrowser:!0});if(C.result.case==="success"){ee(C.result.value.audiobookDownloadDetails),ce(C.result.value.isAvailableToDownloadInMobileApp===!0);return}else Ce("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),Ce("Kod b\u0142\u0119du: ",C.result.value)}catch(C){Ce("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),wr("B\u0142\u0105d podczas pobierania danych:"+C)}}return io(()=>{a===2&&lt(),a===1&&(Bt().then().catch(),Ee().then().catch())},[]),io(()=>{if(p!=null&&z!=null){let C=p.chapters;if(!C)return;let ye=C.map(Be=>{let ue=z?.find(vt=>vt.chapterId===Be.id);if(ue!=null)return{...Be,publicUrl:ue.publicUrl,downloadableUrl:ue.downloadableUrl,duration:ue.duration}}).filter(Be=>Be!=null);ye!=null&&ye.length>0&&_e(ye)}},[p,z]),Y("div",{children:[N("div",{className:"mb-3 space-y-4 rounded bg-white p-4 dark:bg-black",children:Y(S,{onClick:()=>o(),variant:"ghost",className:"min-h-11 w-fit",children:[N(bi,{className:"h-6 w-6"}),N("span",{className:"font-inter text-sm font-medium",children:r.back})]})}),Y("main",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[Y("header",{className:"flex min-w-0 flex-col gap-4 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900 lg:row-span-2 lg:self-start",children:[N("img",{src:t.productImageUrl,alt:t.productName,width:384,height:384,draggable:!1,className:"aspect-square max-h-72 w-full object-contain"}),N("h2",{className:"text-2xl font-semibold",children:t.productName})]}),Y("div",{className:"flex min-w-0 flex-col gap-6",children:[a===2&&Y("section",{ref:l,className:"flex flex-col gap-4 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[N("h3",{className:"text-xl font-semibold",children:r.yourFiles}),c&&N("div",{role:"status","aria-label":r.loading,children:N(ke,{})}),g&&Y("div",{role:"alert",children:[N("p",{children:r.fileError}),N(S,{className:"min-h-11",onClick:lt,children:r.retry})]}),w?.length===0&&N("p",{children:r.noFiles}),w&&N("ul",{className:"flex flex-col gap-3",children:w.map((C,ye)=>Y("li",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[N("span",{className:"min-w-0 break-all text-sm",children:lo(C)||`${r.file} ${ye+1}`}),Y("a",{target:"_blank",rel:"noopener noreferrer",href:C,download:!0,onClick:d,className:"inline-flex min-h-11 items-center gap-2 rounded-md bg-neutral-900 px-3 py-2 text-sm text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 dark:bg-neutral-100 dark:text-neutral-900","aria-label":`${r.download}: ${lo(C)||`${r.file} ${ye+1}`}`,children:[r.download,N(Pi,{className:"size-4","aria-hidden":"true"})]})]},C))})]}),a===3&&Y("section",{className:"rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[N("h3",{className:"text-lg font-semibold",children:r.ticket}),N("p",{className:"mt-2 font-medium",children:t.productName}),N("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-300",children:r.ticketInfo})]}),a===1&&N(Mt,{children:Y("div",{className:"flex flex-col space-y-6 rounded-xl bg-white p-3 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:[N("h4",{className:"text-xl font-semibold",children:I?.name??"Odtwarzacz"}),I?.description&&N("p",{className:"text-sm",children:I?.description}),N(Mt,{children:oe?Y("div",{className:"flex gap-2",children:[N(ke,{}),N("p",{className:"text-xl font-semibold",children:"Trwa pobierania audiobooka..."})]}):N(Mt,{children:J!=null?N(Mt,{children:N(oo,{ref:u,coverShownBeside:!0,chapters:J,author:typeof p?.author=="string"?p.author:void 0,onExpiredUrl:()=>{Ee()},title:p?.name??t.productName??void 0,imageURL:p?.coverImage??t.productImageUrl??void 0,styles:n,setCurrentTimeHandler:C=>{m.current=C},uniqueProductID:t.productId,onChapterChange:C=>{ge(C)}})}):N("p",{className:"mt-2",children:"Wybierz rozdzia\u0142, kt\xF3ry ci\u0119 interesuje."})})}),Y("div",{className:"rounded-xl bg-neutral-100 p-3 dark:bg-neutral-800",children:[N("p",{className:"mt-3 mb-3 text-xs",children:T?"Mo\u017Cesz s\u0142ucha\u0107 tego audiobooka w aplikacji r\xF3wnie\u017C bez dost\u0119pu do internetu.":"Mo\u017Cesz s\u0142ucha\u0107 tego audiobooka w aplikacji."}),Y("div",{className:"flex gap-3",children:[N("a",{href:"https://apps.apple.com/us/app/bitsnap/id6741902807",children:N("img",{width:"100",src:"https://bitsnap.pl/appstore.svg",alt:"Pobierz aplikacje z AppStore"})}),N("a",{href:"https://play.google.com/store/apps/details?id=com.bitsnap.Bitsnap",children:N("img",{width:"100",src:"https://bitsnap.pl/playstore.svg",alt:"Pobierz aplikacj\u0119 z GooglePlay"})})]})]})]})}),N("div",{className:"flex items-center justify-center rounded-xl bg-white p-3 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:a===1&&N(xr,{chapters:J,currentID:I?.id,productID:t.productId,loading:oe,downloadable:p?.isDownloadable===!0,onDownload:d,onSelect:C=>u.current?.selectChapter(C)})})]}),N("section",{className:"rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:N("p",{className:"whitespace-pre-wrap text-sm text-neutral-600 dark:text-neutral-300",children:t.productDescription})})]})]})},co=vi;function lo(e){try{return decodeURIComponent(new URL(e,"https://bitsnap.pl").pathname.split("/").pop()||"")}catch{return""}}import{useTransport as ki}from"@connectrpc/connect-query";import{useEffect as xi,useState as wi}from"react";function uo(e,t){let n=ki(),[o,r]=wi({status:"loading"});return xi(()=>{if(!e){r({status:"hidden"});return}let a=!1;return r({status:"loading"}),import("./model-files-client-HHDXJDTS.mjs").then(({listModelFiles:i})=>i(n,e,t)).catch(()=>({status:"hidden"})).then(i=>{a||r(i)}),()=>{a=!0}},[n,e,t]),o}import{Fragment as go,jsx as O,jsxs as Me}from"react/jsx-runtime";var Mi=Ci(()=>import("./PanelModelFiles-4B2HYGIE.mjs")),Oi=({accessToken:e,projectID:t,loginURL:n,styles:o,activeScreen:r,params:a,setParams:i,openCourse:d,openMessages:u})=>{let{host:l}=ve(),{data:g,isLoading:b,error:w,refetch:x}=Ae(j.publicApi.userPanelGetProducts,{accessToken:e}),f=uo(e,t),c=Ui({products:b?{status:"loading"}:w!=null?{status:"error"}:g?.result.case==="success"?{status:"ok",count:g.result.value.products.length}:g?.result.case==="failure"?{status:"failure",unauthorized:g.result.value===9}:{status:"error"},modelFiles:f});if(Cr(()=>{c.kind==="signed-out"&&(Ye(t,l),window.location.href=n)},[c.kind,t,l,n]),c.kind==="loading"||c.kind==="signed-out")return O("div",{role:"status","aria-label":Xe().loading,"aria-busy":"true",className:"grid grid-cols-2 gap-4 sm:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5",children:Array.from({length:6},(z,ee)=>O("div",{"aria-hidden":"true",className:"h-72 rounded-xl bg-neutral-100 motion-safe:animate-pulse dark:bg-neutral-800"},ee))});let m=g&&g.result.case==="success"?g.result.value.products:[],p=f.status==="ready"?f.models:[],v=p.length>0?O(Ni,{fallback:null,children:O(Mi,{accessToken:e,models:p,buttonStyle:o})}):null;return c.kind==="error"?Me(go,{children:[O(zi,{onRetry:()=>void x()}),v]}):c.kind==="empty"?O(_i,{}):O(ji,{accessToken:e,products:m,styles:o,activeScreen:r,params:a,setParams:i,openCourse:d,openMessages:u,filesSection:v})};function Ui({products:e,modelFiles:t}){if(e.status==="failure"&&e.unauthorized)return{kind:"signed-out"};if(e.status==="loading")return{kind:"loading"};if(e.status==="ok"&&e.count>0)return{kind:"list"};if(t.status==="loading")return{kind:"loading"};if(e.status==="failure"||e.status==="error")return t.status==="unauthorized"?{kind:"signed-out"}:{kind:"error"};let n=t.status==="ready"?t.models.length:0;return e.count===0&&n===0?{kind:"empty"}:{kind:"list"}}function _i(){let e=Xe();return Me("div",{className:"flex flex-col items-start gap-1","data-testid":"panel-empty",children:[O("h3",{className:"text-2xl",children:e.hello}),O("p",{className:"text-sm text-neutral-500",children:e.empty})]})}function zi({onRetry:e}){let t=L().toLowerCase().startsWith("en");return Me("div",{className:"flex flex-col items-start gap-3",role:"alert","data-testid":"panel-error",children:[O("p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:t?"Your products could not be loaded.":"Nie uda\u0142o si\u0119 wczyta\u0107 Twoich produkt\xF3w."}),O(S,{type:"button",onClick:e,className:"text-sm",children:t?"Try again":"Spr\xF3buj ponownie"})]})}var fo=Oi;function po(e){return e.productType===5||e.productType===6}var ji=({accessToken:e,products:t,styles:n,filesSection:o,activeScreen:r,params:a,setParams:i,openCourse:d,openMessages:u})=>{let l=Xe(),[g,b]=Ii(()=>mo(a.product,t));Cr(()=>{b(mo(a.product,t))},[a.product,t]);let w=f=>{b(f),i({product:f?f.accessId||f.productId:void 0,state:"products"})};Cr(()=>{r==="products"&&g?.productType===4?d(g.accessId):r==="products"&&g&&po(g)&&u&&u()},[r,g,d,u]);function x(f){if(po(f)&&u){u();return}if(f.productType===4){d(f.accessId);return}w(f)}return r==="products"&&g?.productType===4?null:r==="products"&&g!=null?O(co,{accessToken:e,product:g,styles:n,reveal:w,onOpenCourse:d}):Me(go,{children:[O("h3",{className:"text-2xl",children:l.hello}),t.length>0&&O("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:l.intro}),O("div",{className:"mt-6 grid grid-cols-2 gap-4 sm:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5",children:t.map(f=>{let[c,m,p]=f.productType===1?[l.audio,l.listen,Li]:f.productType===4?[l.course,l.openCourse,Si]:f.productType===5?[l.chat,l.openMessages,Ti]:f.productType===6?[l.community,l.openMessages,Ri]:f.productType===3?[l.ticket,l.showTicket,Ai]:[l.files,l.downloadFiles,Ei];return Me("button",{type:"button",onClick:()=>x(f),className:"flex min-h-11 min-w-0 flex-col overflow-hidden rounded-xl border border-neutral-200 bg-white text-left text-neutral-900 transition-colors hover:border-neutral-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-neutral-500 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-50 dark:hover:border-neutral-500",children:[Me("span",{className:"flex w-full flex-col gap-3 bg-neutral-100 p-3 dark:bg-neutral-800",children:[Me("span",{className:"flex w-fit items-center gap-1.5 rounded-md bg-white px-2 py-1 text-xs font-medium dark:bg-neutral-900",children:[O(p,{className:"size-4","aria-hidden":"true"}),c]}),O("img",{src:f.productImageUrl,alt:f.productName,draggable:!1,className:"aspect-square w-full object-contain"})]}),Me("span",{className:"flex flex-1 flex-col gap-3 p-3",children:[O("span",{className:"line-clamp-2 font-semibold",children:f.productName}),O("span",{className:"line-clamp-2 text-sm text-neutral-600 dark:text-neutral-300",children:Gn(f.productDescription)}),O("span",{className:"mt-auto pt-2 text-sm font-medium underline underline-offset-4",children:m})]})]},f.accessId||f.productId)})}),o]})};function mo(e,t){if(!e)return;let n=t.find(o=>(o.accessId||o.productId)===e||o.productId===e);if(n)return n;try{let o=Di(ln,e);return t.find(r=>o.accessId?r.accessId===o.accessId:r.productId===o.productId)}catch{return}}import{LogOut as Ki}from"lucide-react";import{Library as Fi,MessageCircle as qi,Receipt as Hi,Undo2 as $i,User as Bi}from"lucide-react";var yo=[{screen:"products",label:"libraryNavLabel",icon:Fi},{screen:"messages",label:"messagesNavLabel",icon:qi},{screen:"orders",label:"ordersNavLabel",icon:Hi},{screen:"returns",label:"returnsNavLabel",icon:$i},{screen:"profile",label:"accountNavLabel",icon:Bi}];function ho(e){return e==="course"?"products":e==="order-details"?"orders":e==="return-details"?"returns":e}import{jsx as $e,jsxs as ht}from"react/jsx-runtime";function Nr({activeScreen:e,setActiveScreen:t,setParams:n,theme:o,logout:r,email:a,projectID:i,showMessages:d=!1}){let u=pe(),{data:l}=pn(i??"",!!i);return ht("header",{className:"flex h-14 shrink-0 items-center border-b border-neutral-200 bg-white px-4 md:h-dvh md:w-56 md:flex-col md:items-stretch md:border-r md:border-b-0 md:py-5 dark:border-neutral-800 dark:bg-neutral-900",children:[ht("div",{className:"flex min-w-0 items-center gap-3 md:mb-6 md:flex-col md:items-start",children:[$e(Lt,{projectId:i,logoUrl:o?.logoURL,logoDarkUrl:o?.logoDarkURL,name:l?.name,className:"shrink-0"}),l?.name&&$e("span",{title:l.name,className:"truncate text-sm font-medium md:line-clamp-2 md:whitespace-normal",children:l.name})]}),$e("nav",{"aria-label":u.navigationLabel,className:"fixed inset-x-0 bottom-0 z-10 flex h-[calc(56px+env(safe-area-inset-bottom))] items-start justify-around border-t border-neutral-200 bg-white pb-[env(safe-area-inset-bottom)] md:static md:h-auto md:flex-1 md:flex-col md:justify-start md:gap-2 md:border-0 md:bg-transparent md:pb-0 dark:border-neutral-800 dark:bg-neutral-900",children:yo.filter(({screen:g})=>g!=="messages"||d).map(({screen:g,label:b,icon:w})=>{let x=ho(e)===g;return ht("button",{type:"button","aria-current":x?"page":void 0,onClick:()=>{t(g),n({product:void 0,state:g})},className:F("flex h-14 min-h-11 min-w-0 flex-1 flex-col items-center justify-center gap-1 px-1 text-[11px] focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-current md:h-11 md:w-full md:flex-none md:flex-row md:justify-start md:gap-3 md:rounded-md md:px-3 md:text-sm",x?"bg-neutral-100 font-semibold text-black dark:bg-neutral-800 dark:text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:bg-neutral-800"),children:[$e(w,{className:"h-5 w-5 shrink-0","aria-hidden":"true"}),$e("span",{children:u[b]})]},g)})}),ht("div",{className:"hidden border-t border-neutral-200 pt-4 md:block dark:border-neutral-800",children:[a&&$e("p",{title:a,className:"mb-3 truncate text-sm text-neutral-600 dark:text-neutral-400",children:a}),ht("button",{type:"button",onClick:r,className:"flex min-h-11 w-full items-center gap-3 rounded-md px-3 text-sm text-red-700 hover:bg-red-50 focus-visible:outline-2 focus-visible:outline-current dark:text-red-400 dark:hover:bg-neutral-800",children:[$e(Ki,{className:"h-4 w-4","aria-hidden":"true"}),u.logout]})]})]})}import{useState as Gi}from"react";import{LogOut as Vi}from"lucide-react";import{jsx as Oe,jsxs as nt}from"react/jsx-runtime";function Ir({email:e,logout:t,onLocaleChange:n}){let[o,r]=Gi(L),a=pe(o);return nt("section",{className:"w-full max-w-xl",children:[Oe("h3",{className:"text-2xl",children:a.accountNavLabel}),Oe("h4",{className:"mt-6 mb-2 text-sm font-medium text-neutral-600 dark:text-neutral-400",children:a.profileHeading}),nt("div",{className:"divide-y divide-neutral-200 rounded-lg border border-neutral-200 bg-white dark:divide-neutral-800 dark:border-neutral-800 dark:bg-neutral-900",children:[nt("div",{className:"p-4",children:[Oe("p",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:a.emailLabel}),Oe("p",{className:"mt-1 break-words",children:e||a.noData})]}),nt("label",{className:"flex min-h-11 flex-wrap items-center justify-between gap-3 p-4",children:[Oe("span",{children:a.languageLabel}),nt("select",{value:o.toLowerCase().startsWith("en")?"en-US":"pl-PL",onChange:i=>{lr(i.target.value),r(i.target.value),n?.()},className:"min-h-11 rounded-md border border-neutral-300 bg-white px-3 focus-visible:outline-2 focus-visible:outline-current dark:border-neutral-700 dark:bg-neutral-900",children:[Oe("option",{value:"pl-PL",children:a.polishLanguage}),Oe("option",{value:"en-US",children:a.englishLanguage})]})]})]}),nt("button",{type:"button",onClick:t,className:"mt-6 flex min-h-11 w-full items-center gap-3 rounded-lg border border-neutral-200 bg-white px-4 py-3 text-red-700 hover:bg-red-50 focus-visible:outline-2 focus-visible:outline-current dark:border-neutral-800 dark:bg-neutral-900 dark:text-red-400 dark:hover:bg-neutral-800",children:[Oe(Vi,{className:"h-5 w-5","aria-hidden":"true"}),a.logout]})]})}import{lazy as Wi,Suspense as Yi}from"react";import{jsx as bt}from"react/jsx-runtime";var Ji=Wi(()=>import("./course.mjs").then(e=>({default:e.PanelCourse})));function Sr(e){return bt(Yi,{fallback:bt("div",{className:"flex items-center gap-2 p-2",role:"status",children:bt(ke,{})}),children:bt("div",{className:"[--course-mobile-bottom:calc(56px+env(safe-area-inset-bottom))] md:[--course-mobile-bottom:0px]",children:bt(Ji,{...e})})})}import{lazy as Zi,Suspense as Qi}from"react";import{jsx as Ot}from"react/jsx-runtime";var Xi=Zi(()=>import("./chat.mjs").then(e=>({default:e.PanelMessages})));function Er(e){return Ot(Qi,{fallback:Ot("div",{className:"flex items-center gap-2 p-2",role:"status",children:Ot(ke,{})}),children:Ot(Xi,{...e})})}function es(e,t){return!!t||e.some(n=>n.productType===5||n.productType===6)}function bo(e){let{data:t}=Ae(j.publicApi.userPanelGetProducts,{accessToken:e??""},{enabled:!!e}),n=t?.result.case==="success"?t.result.value:void 0,o=n?.products??[],r=n?.chatApiUrl||void 0;return{visible:es(o,r),products:o,chatApiUrl:r}}import{AlertCircle as wo,CheckCircle2 as Po,ChevronLeft as ts,Loader2 as Tr,Lock as vo,Package as rs,Truck as Co}from"lucide-react";import{useEffect as ns,useState as Lr}from"react";import{Fragment as No,jsx as y,jsxs as P}from"react/jsx-runtime";function os({status:e}){let t={created:{color:"bg-neutral-100 text-neutral-700",icon:null},paid:{color:"bg-green-100 text-green-700",icon:Po},completed:{color:"bg-blue-100 text-blue-700",icon:Po},canceled:{color:"bg-red-100 text-red-700",icon:wo},sent:{color:"bg-purple-100 text-purple-700",icon:Co},processing:{color:"bg-yellow-100 text-yellow-700",icon:Tr}},n=t[e]||t.created,o=n.icon,r={created:"Utworzone",paid:"Op\u0142acone",completed:"Zako\u0144czone",canceled:"Anulowane",sent:"Wys\u0142ane",processing:"Przetwarzane"};return P("span",{className:`inline-flex items-center gap-1 rounded-full px-3 py-1 text-sm font-medium ${n.color}`,children:[o&&y(o,{className:"h-4 w-4"}),r[e]||e]})}function as({orderID:e,email:t}){let[n,o]=Lr(""),r=ae(j.publicApi.addPublicOrderComment);return P("form",{onSubmit:async i=>{if(i.preventDefault(),!!n.trim())try{await r.mutateAsync({projectId:"",orderId:e,message:n.trim(),accessToken:t}),o("")}catch(d){console.error("Failed to add comment:",d)}},className:"mt-4 space-y-2",children:[y(We,{htmlFor:"comment",children:"Dodaj komentarz"}),y(kn,{id:"comment",value:n,onChange:i=>o(i.target.value),placeholder:"Wpisz komentarz...",rows:3,disabled:r.isPending}),y(S,{type:"submit",disabled:!n.trim()||r.isPending,children:r.isPending?P(No,{children:[y(Tr,{className:"mr-2 h-4 w-4 animate-spin"}),"Wysy\u0142anie..."]}):"Dodaj komentarz"})]})}function ko(e){return e?new Date(Number(e.seconds)*1e3).toLocaleDateString("pl-PL",{year:"numeric",month:"long",day:"numeric"}):"N/A"}function xo(e,t){return new Intl.NumberFormat("pl-PL",{style:"currency",currency:t.toUpperCase()}).format(e/100)}function is({orderID:e,initialEmail:t,onBack:n,accessToken:o,analytics:r}){let{theme:a,projectID:i}=ve(),d=Ve(i,r,"order"),[u,l]=Lr(t||""),[g,b]=Lr(!1),{data:w,isLoading:x,error:f,refetch:c}=Ae(j.publicApi.getPublicOrderDetails,{projectId:i??"",orderId:e,email:u||void 0,accessToken:o},{enabled:!!e}),m=w?.result.case==="order"?w.result.value:null,p=m?.isVerified??!1,v=m!=null;ns(()=>{v&&d.track("panel_order_viewed",{},{order_ref:null})},[d,v]);let z=()=>{c(),b(!1)},ee={"--button-background-color":a?.colors?.brand??"#000000","--button-background-color-dark":a?.colors?.brandDark??"#ffffff","--button-text-color":a?.colors?.brandDark??"#000000","--button-text-color-dark":a?.colors?.brand??"#000000"};return x?y("div",{className:"flex min-h-screen items-center justify-center",children:P("div",{className:"text-center",children:[y(Tr,{className:"mx-auto h-8 w-8 animate-spin text-neutral-400"}),y("p",{className:"mt-2 text-neutral-600 dark:text-neutral-400",children:"\u0141adowanie zam\xF3wienia..."})]})}):f||!m?y("div",{className:"flex min-h-screen items-center justify-center",children:y(Re,{className:"w-full max-w-md",children:y(De,{className:"pt-6",children:P("div",{className:"text-center",children:[y(wo,{className:"mx-auto h-12 w-12 text-red-500"}),y("h2",{className:"mt-4 text-xl font-semibold",children:"Zam\xF3wienie nie znalezione"}),y("p",{className:"mt-2 text-neutral-600 dark:text-neutral-400",children:"Nie znaleziono zam\xF3wienia o podanym numerze."})]})})})}):y("div",{className:"w-full bg-white py-8 dark:bg-black",style:ee,children:P("div",{className:"w-full px-4",children:[n&&P(S,{onClick:n,variant:"ghost",className:"mb-4 w-fit",children:[y(ts,{className:"h-4 w-4"}),"Wr\xF3\u0107 do historii zam\xF3wie\u0144"]}),P("div",{className:"mb-6 flex items-center gap-4",children:[a?.logoURL&&P(No,{children:[y("img",{src:a.logoURL,alt:"Project logo",className:`h-12 w-auto ${a.logoDarkURL?"dark:hidden":""}`}),a.logoDarkURL&&y("img",{src:a.logoDarkURL,alt:"Project logo",className:"hidden h-12 w-auto dark:block"})]}),P("div",{children:[y("h1",{className:"text-3xl font-bold",children:"Zam\xF3wienie"}),P("p",{className:"text-neutral-600 dark:text-neutral-400",children:["Numer zam\xF3wienia: #",m.orderId]})]})]}),P(Re,{className:"mb-6",children:[y(je,{children:P(Fe,{className:"flex items-center",children:[y(rs,{className:"mr-2 h-5 w-5"}),"Status zam\xF3wienia"]})}),P(De,{className:"space-y-6",children:[P("div",{children:[P("div",{className:"flex items-center gap-2",children:[y(os,{status:m.status}),m.processingStatus&&P("span",{className:"text-sm text-neutral-600",children:["\xB7 ",m.processingStatus]})]}),P("p",{className:"mt-2 text-sm text-neutral-600",children:["Zam\xF3wienie z\u0142o\u017Cone ",ko(m.createdAt)]})]}),P("div",{className:"border-t pt-4",children:[y("h3",{className:"mb-3 font-semibold",children:"Dane klienta"}),P("div",{className:"space-y-2",children:[P("div",{children:[y("span",{className:"font-medium",children:"Imi\u0119 i nazwisko:"})," ",y("span",{className:p?"":"text-neutral-500",children:m.customerName})]}),P("div",{children:[y("span",{className:"font-medium",children:"Email:"})," ",y("span",{className:p?"":"text-neutral-500",children:m.customerEmail})]}),m.customerPhone&&P("div",{children:[y("span",{className:"font-medium",children:"Telefon:"})," ",y("span",{className:p?"":"text-neutral-500",children:m.customerPhone})]})]})]}),!p&&y("div",{className:"border-t pt-4",children:P(S,{onClick:()=>b(!0),variant:"outline",className:"w-full",children:[y(vo,{className:"mr-2 h-4 w-4"}),"Zweryfikuj sw\xF3j email"]})})]})]}),P(Re,{className:"mb-6",children:[y(je,{children:y(Fe,{children:"Produkty"})}),P(De,{className:"space-y-6",children:[y("div",{className:"space-y-4",children:m.items.map((T,ce)=>P("div",{className:"flex items-center gap-4",children:[T.imageUrl&&y("img",{src:T.imageUrl,alt:T.name,className:"h-16 w-16 rounded object-cover"}),P("div",{className:"flex-1",children:[y("p",{className:"font-medium",children:T.name}),P("p",{className:"text-sm text-neutral-600",children:["Ilo\u015B\u0107: ",T.quantity]})]}),y("div",{className:"text-right",children:y("p",{className:"font-medium",children:xo(Number(T.price),T.currency)})})]},ce))}),(m.deliveryAddress||m.deliveryMethod)&&P("div",{className:"border-t pt-4",children:[P("h3",{className:"mb-3 flex items-center font-semibold",children:[y(Co,{className:"mr-2 h-5 w-5"}),"Informacje o dostawie"]}),P("div",{className:"space-y-2",children:[m.deliveryAddress&&P("div",{children:[y("span",{className:"font-medium",children:"Adres:"})," ",y("span",{className:p?"":"text-neutral-500",children:m.deliveryAddress})]}),m.deliveryMethod&&P("div",{children:[y("span",{className:"font-medium",children:"Metoda:"})," ",m.deliveryMethod]}),m.trackingNumber&&p&&P("div",{children:[y("span",{className:"font-medium",children:"Tracking:"})," ",m.trackingNumber]})]})]}),y("div",{className:"border-t pt-4",children:P("div",{className:"flex justify-between text-lg font-bold",children:[y("span",{children:"Suma:"}),y("span",{children:xo(Number(m.totalAmount),m.currency)})]})})]})]}),P(Re,{children:[y(je,{children:P(Fe,{children:["Komentarze ",m.commentCount>0&&`(${m.commentCount})`]})}),P(De,{children:[m.comments.length>0?y("div",{className:"space-y-4",children:m.comments.map(T=>P("div",{className:"border-b pb-4 last:border-b-0",children:[P("div",{className:"mb-1 flex items-center gap-2",children:[y("span",{className:"font-medium",children:T.authorName||"System"}),y("span",{className:"text-xs text-neutral-500",children:ko(T.createdAt)}),T.authorType==="admin"&&y("span",{className:"rounded bg-blue-100 px-2 py-0.5 text-xs text-blue-700",children:"Admin"})]}),y("p",{className:p?"":"text-neutral-500",children:T.message})]},T.id))}):y("p",{className:"text-neutral-600",children:"Brak komentarzy."}),p?y(as,{orderID:m.orderId,email:u}):y("div",{className:"mt-4",children:P(S,{onClick:()=>b(!0),variant:"outline",className:"w-full",children:[y(vo,{className:"mr-2 h-4 w-4"}),"Zweryfikuj sw\xF3j email"]})})]})]}),g&&y("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:P(Re,{className:"w-full max-w-md",children:[y(je,{children:y(Fe,{children:"Zweryfikuj sw\xF3j email"})}),P(De,{className:"space-y-4",children:[y("p",{className:"text-sm text-neutral-700",children:"Podaj adres email u\u017Cyty przy sk\u0142adaniu zam\xF3wienia."}),P("div",{className:"space-y-2",children:[y(We,{htmlFor:"verify-email",children:"Adres email"}),y(Tt,{id:"verify-email",type:"email",placeholder:"twoj@email.com",value:u,onChange:T=>l(T.target.value)})]}),P("div",{className:"flex gap-2",children:[y(S,{variant:"outline",onClick:()=>b(!1),className:"flex-1",children:"Anuluj"}),y(S,{onClick:z,className:"flex-1",children:"Zweryfikuj"})]})]})]})})]})})}function ss(e){return y(is,{...e})}var Ar=ss;import{jsx as de,jsxs as So}from"react/jsx-runtime";var ds=({returnsAppearance:e,returnsTexts:t,analytics:n}={})=>{let{projectID:o,theme:r,loginURL:a,host:i}=ve(),[,d]=Io(0),u=Ve(o,n,"panel"),l=mt(o,i),g=Pn(o,i),{mutateAsync:b}=ae(j.publicApi.userPanelLogout);async function w(){l&&await b({accessToken:l}),typeof window<"u"&&(Ye(o,i),window.location.reload())}let[x]=ls(),f=I=>["products","notifications","profile","plans","orders","order-details","returns","return-details","course","messages"].includes(I),[c,m]=qn({product:void 0,state:"products",orderId:void 0,returnId:void 0,course:void 0,item:void 0,chatProject:void 0,thread:void 0,channel:void 0}),[p,v]=Io(f(c.state)?c.state:"products"),z=I=>{m({state:"order-details",orderId:I}),v("order-details")},ee=()=>{m({state:"orders",orderId:void 0}),v("orders")},T=I=>m({orderId:void 0,returnId:void 0,course:void 0,item:void 0,chatProject:void 0,thread:void 0,channel:void 0,...I}),ce=I=>{m({state:"course",course:I,item:void 0,product:void 0}),v("course")},Se=()=>{m({state:"products",course:void 0,item:void 0,product:void 0}),v("products")},oe=()=>{m({state:"messages",product:void 0,chatProject:void 0,thread:void 0,channel:void 0}),v("messages")},te=bo(l);Ut(()=>{f(c.state)&&(c.state==="course"||p==="course"||c.state==="messages"||p==="messages")&&v(c.state)},[c.state]);let fe={"--button-background-color":r?.colors?.brand??"#000000","--button-background-color-dark":r?.colors?.brandDark??"#ffffff","--button-text-color":r?.colors?.brandDark??"#000000","--button-text-color-dark":r?.colors?.brand??"#000000"};return Ut(()=>{if(l==null||l.length===0){window.location.href=a??"/panel/login";return}},[]),Ut(()=>{if(l==null||l.length===0){window.location.href=a??"/panel/login";return}},[p]),Ut(()=>{if(typeof window>"u"||window.parent!==window||!l)return;let I=gt(window.location.search);I&&yt(I);let ge=I??Ze();ge&&(window.location.href=Qe(ge,l))},[l]),de(It,{value:u,children:So("div",{ref:x,className:"font-inter relative flex h-dvh w-full flex-col bg-beige-100 text-black dark:bg-black dark:text-white md:flex-row",children:[de(Nr,{activeScreen:p,setActiveScreen:v,setParams:T,styles:fe,theme:r,logout:w,email:g,projectID:o,showMessages:te.visible||p==="messages"}),So("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto w-full p-5 pb-[calc(76px+env(safe-area-inset-bottom))] md:pb-5",children:[p==="products"&&de(fo,{projectID:o??"",accessToken:l,loginURL:a??"/panel/login",styles:fe,activeScreen:p,params:c,setParams:m,openCourse:ce,openMessages:oe}),p==="messages"&&l&&de(Er,{accessToken:l,products:te.products,chatApiUrl:te.chatApiUrl,projectID:o,host:i,selection:{chatProject:c.chatProject,thread:c.thread,channel:c.channel},onSelect:I=>m({chatProject:I.chatProject,thread:I.thread,channel:I.channel})}),p==="course"&&c.course&&l&&de(Sr,{accessId:c.course,accessToken:l,theme:r,itemId:c.item,onItemChange:I=>m({item:I}),onBack:Se}),p==="notifications"&&de(fr,{}),p==="plans"&&de(gr,{projectID:o??""}),p==="orders"&&de(Bn,{projectID:o??"",accessToken:l??"",openOrderDetails:z}),p==="order-details"&&c.orderId&&de(Ar,{orderID:c.orderId,onBack:ee}),(p==="returns"||p==="return-details")&&l&&de(hr,{projectID:o??"",host:i,accessToken:l,loginURL:a??"/panel/login",appearance:Hn(e,r?.colors?.brand),texts:t,screen:p,params:c,setParams:m,setActiveScreen:v}),p==="profile"&&de(Ir,{email:g,logout:w,onLocaleChange:()=>d(I=>I+1)})]})]})})},cs=ds;import{create as Ne}from"@bufbuild/protobuf";import{QueryClient as Es,QueryClientProvider as Ls}from"@tanstack/react-query";import{createContext as Ts,useContext as As,useEffect as qo,useState as Rs}from"react";import{createClient as us}from"@connectrpc/connect";import{createConnectTransport as ps}from"@connectrpc/connect-web";var me;(o=>{function e(r){return us(dn,n(r))}o.get=e;let t=new Map;function n(r){let a=t.get(r);return a==null&&(a=ps({useBinaryFormat:!0,baseUrl:r+"/api/rpc",interceptors:[sn]}),t.set(r,a)),a}})(me||={});import R from"zod";import X from"zod";function _(e,t=2){return+(Math.round(+(e+"e+"+t))+"e-"+t)}function Eo(e,t){let n=typeof navigator>"u"?"pl-PL":navigator.language;return Intl.NumberFormat(n,{style:"currency",currency:t,currencyDisplay:"symbol"}).format(e/100)}var cp=X.object({event:X.enum(["purchase","addToCart","customizeProduct","viewCart","removeFromCart","initiateCheckout","lead"]),step:X.string().optional(),value:X.number().optional(),currency:X.string().optional(),content_name:X.string().optional(),items:X.array(X.object({id:X.string(),name:X.string(),price:X.number().default(0),currency:X.string().default("PLN"),quantity:X.number().default(1)})).optional()});function Rr(e){typeof window>"u"||(ms(e),gs(e),ys(e))}function ms(e){try{typeof window.dataLayer>"u"&&(window.dataLayer=[]);let t=fs(e);window.dataLayer.push(t)}catch(t){console.warn("cannot send google analytics event",t)}}function fs(e){let t=e.value??e.items?.reduce((a,i)=>a+(i.price||0)*(i.quantity||1),0)??0,n=e.items?.map(a=>({item_id:a.id,item_name:a.name||a.id,price:_((a.price||0)/100,2),quantity:a.quantity||1})),o={currency:e.currency||"PLN",value:_(t/100,2)};n&&n.length>0&&(o.items=n);let r;switch(e.event){case"purchase":r="purchase",o.transaction_id=e.step||`txn_${Date.now()}`;break;case"addToCart":r="add_to_cart";break;case"viewCart":r="view_cart";break;case"removeFromCart":r="remove_from_cart";break;case"initiateCheckout":r="begin_checkout";break;case"customizeProduct":r="customize_product";break;default:r=e.event}return{event:r,ecommerce:o,...e.step&&{step:e.step},...e.content_name&&{content_name:e.content_name}}}function gs(e){if(typeof window.fbq>"u")return;let t="",n="",o={};switch(e.event){case"purchase":t="track",n="Purchase",o={category_name:e.step,...e};break;case"lead":t="track",n="Lead",o={category_name:e.step,...e};break;case"addToCart":t="track",n="Add to Cart",o={category_name:e.step,...e};break;case"customizeProduct":t="track",n="Customize Product",o={category_name:e.step,...e};break;case"viewCart":t="track",n="View Cart",o={category_name:e.step,...e};break;case"removeFromCart":t="track",n="Remove from Cart",o={category_name:e.step,...e};break;case"initiateCheckout":t="track",n="Initiate Checkout",o={category_name:e.step,...e};break;default:break}window.location.search.includes("analytics")&&console.log("Pushing FB event",t,n,o),window.fbq(t,n,o)}function ys(e){try{if(typeof window.ttq>"u")return;let t=hs(e);if(!t)return;window.location.search.includes("analytics")&&console.log("Pushing TikTok event",t.eventName,t.eventPayload),window.ttq.track(t.eventName,t.eventPayload)}catch(t){console.warn("cannot send tiktok analytics event",t)}}function hs(e){let t=e.value??e.items?.reduce((a,i)=>a+(i.price||0)*(i.quantity||1),0)??0,n=e.items?.map(a=>({content_id:a.id,content_type:"product",content_name:a.name||a.id,quantity:a.quantity||1,price:_((a.price||0)/100,2)}))||[];n.length===0&&e.content_name&&n.push({content_id:e.step||"unknown",content_type:"product",content_name:e.content_name,quantity:1,price:_(t/100,2)});let o={currency:e.currency||"PLN",value:_(t/100,2)};n.length>0&&(o.contents=n);let r=null;switch(e.event){case"purchase":r="Purchase";break;case"addToCart":r="AddToCart";break;case"initiateCheckout":r="InitiateCheckout";break;case"customizeProduct":r="CustomizeProduct";break;case"viewCart":return;case"removeFromCart":return;case"lead":return;default:return null}return{eventName:r,eventPayload:o}}function Lo(e){let{items:t,googlePayConfig:n,checkout:o,result:r,cartRequiresShipping:a}=e,i=e.locale??L();if(r.totalAmount==null)return;let d=[];return a&&(d.push("SHIPPING_ADDRESS"),d.push("SHIPPING_OPTION")),{apiVersion:2,apiVersionMinor:0,callbackIntents:d,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["MASTERCARD","VISA"]},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:n.gateway,gatewayMerchantId:n.gatewayId}}}],emailRequired:!0,shippingAddressParameters:{phoneNumberRequired:a},shippingAddressRequired:a,shippingOptionRequired:a,shippingOptionParameters:a?{shippingOptions:r.methods.slice(0,5).map(l=>({id:l.id,label:l.name+` - ${Eo(l.amount,r.currency)}`,description:l.description??""})),defaultSelectedOptionId:r.selectedDeliveryMethod}:void 0,merchantInfo:{merchantId:n.merchantId+"",merchantName:n.merchantName},transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:Te("paymentForCart",i,e.texts),totalPrice:`${_(r.totalAmount/100,2)}`,currencyCode:r.currency,countryCode:r.country,checkoutOption:"COMPLETE_IMMEDIATE_PURCHASE",displayItems:bs(t,r.methods,r.selectedDeliveryMethod??(r.methods.length>0?r.methods[0].id:void 0),o.couponCode,r.couponValue,Te("coupon",i,e.texts))}}}function bs(e,t,n,o,r,a="Coupon"){let i=[],d=0;for(let l of e){if(l.details==null)continue;let g=l.details.pricing?.effectivePrice??l.details.price;d+=g*l.quantity,i.push({label:l.details.name+" x "+l.quantity,price:`${_(g/100,2)}`,type:"LINE_ITEM",status:"FINAL"})}let u=t.find(l=>l.id===n);return u!=null&&i.push({label:u.name,price:`${_(u.amount/100,2)}`,type:"SHIPPING_OPTION",status:"FINAL"}),o!=null&&r!=null&&i.push({label:`${a} ${o}`,price:`${_(r/100,2)}`,type:"DISCOUNT",status:"FINAL"}),d>0&&i.push({label:"Subtotal",price:`${_(d/100,2)}`,type:"SUBTOTAL",status:"FINAL"}),i}function ot(e,t){return`${Z}/api/integrations/${e}/public-commerce${t}`}function Ue(e){return typeof e=="object"&&e!=null&&"ERR"in e}function $(e,t,n){return{ERR:!0,error:e,type:t,data:n}}function To(e,t){return t?.find(n=>n.id===e||(n.variants?.some(o=>o.id===e)??!1))}function Ao(e,t){let n=new Set(t.map(o=>o.productID));return Array.from(new Set(e.filter(o=>!n.has(o))))}function Ro(e,t){let n=e?.trim();if(!(n==null||n.length===0))try{let o=new URL(n,t);return o.protocol!=="http:"&&o.protocol!=="https:"?void 0:o.href}catch{return}}import{create as Ps}from"zustand";var at=Ps(e=>({isCartVisible:!1,notice:void 0,setNotice:t=>e(n=>({...n,notice:t})),numberOfProductsInCart:0,showCart:()=>e(t=>({...t,isCartVisible:!0})),hideCart:()=>e(t=>({...t,isCartVisible:!1})),setNumberOfProductsInCart:t=>e(n=>({...n,numberOfProductsInCart:t}))}));import{createContext as vs,useContext as Dr,useMemo as Do}from"react";import{jsx as ks}from"react/jsx-runtime";var _t=vs({});function Np({texts:e,locale:t,children:n}){let o=Do(()=>({texts:e,locale:t}),[e,t]);return ks(_t.Provider,{value:o,children:n})}function Mo(){return Dr(_t)}function Ip(e){let{texts:t,locale:n}=Dr(_t);return Te(e,n??L(),t)}function Sp(){let{texts:e,locale:t}=Dr(_t),n=t??L();return Do(()=>o=>Te(o,n,e),[n,e])}var Or="bitsnap-pending-order";function _o(e,t){let n=new Map;for(let r of t)n.set(r.id,(n.get(r.id)??0)+r.quantity);let o=[];for(let r of e){let a=n.get(r.id);a==null?o.push(r):r.quantity>a&&o.push({...r,quantity:r.quantity-a})}return o}var xs=60*1e3;function zo(e,t=Date.now,n=xs){let o;return r=>{let a=`${r.orderId}:${r.ts}`,i=t();return o?.key===a&&i-o.at<n?Promise.reject(new Error("pending order was asked about recently")):(o={key:a,at:i},e(r))}}function ws(e){if(!(e==null||e.length===0))try{let t=new URL(e,"https://bitsnap.invalid").pathname,n=/\/payment\/common\/([^/]+)\/([^/]+)\/?$/.exec(t);return n==null?void 0:{projectId:decodeURIComponent(n[1]),orderId:decodeURIComponent(n[2])}}catch{return}}function Cs(e){if(e==null||e.length===0)return!1;try{let t=new URL(e,"https://bitsnap.invalid").pathname;return/\/payment\/manualPayment\/[^/]+\/[^/]+\/?$/.test(t)}catch{return!1}}function Ns(e,t=Date.now(),n={}){if(Cs(e.url))return;let o=ws(e.url),r=Oo(e.orderId)??o?.orderId,a=Oo(e.projectId)??o?.projectId;if(!(r==null||a==null))return{orderId:r,projectId:a,...n.cartProjectId!=null?{cartProjectId:n.cartProjectId}:{},lines:n.lines??[],ts:t}}function Tp(e,t={}){let n=Ns(e,t.now,t);return n!=null&&Is(n,t.storage)}function Oo(e){return e!=null&&e.length>0?e:void 0}function zt(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}function Is(e,t=zt()){try{return t?.setItem(Or,JSON.stringify(e)),t!=null}catch{return!1}}function Uo(e=zt()){try{let t=e?.getItem(Or);if(t==null)return;let n=JSON.parse(t);if(typeof n=="object"&&n!=null&&typeof n.orderId=="string"&&typeof n.projectId=="string"&&typeof n.ts=="number"&&n.orderId.length>0){let{orderId:o,projectId:r,cartProjectId:a,ts:i,lines:d}=n;return{orderId:o,projectId:r,...typeof a=="string"?{cartProjectId:a}:{},lines:Array.isArray(d)?d.filter(u=>typeof u?.id=="string"&&typeof u.quantity=="number"):[],ts:i}}}catch{}Mr(e)}function Mr(e=zt()){try{e?.removeItem(Or)}catch{}}function jo(e){let t=e.details?.status??Ss(e.details?.$unknown);return t==="created"||t==="placed"||t==="paid"||t==="canceled"?t:"unknown"}function Ss(e){if(Array.isArray(e)){for(let t of e)if(t?.no===3&&t.wireType===2&&t.data instanceof Uint8Array){let n=0,o=0;for(let r=0;o<t.data.length&&r<35;r+=7){let a=t.data[o++];if(n|=(a&127)<<r,!(a&128))break}if(o+n!==t.data.length)return;try{return new TextDecoder().decode(t.data.subarray(o))}catch{return}}}}async function Fo(e){let t=e.storage??zt(),n=Uo(t);if(n==null)return"none";if((e.now??Date.now)()-n.ts>864e5)return Mr(t),"expired";if(e.projectId!=null&&n.cartProjectId!=null&&n.cartProjectId!==e.projectId)return"pending";let r;try{r=await e.fetchStatus(n)}catch{return"pending"}let a=Uo(t);if(a?.orderId!==n.orderId||a.ts!==n.ts)return"pending";if(r==="paid"||r==="placed"){try{await e.removeLines(n.lines)}catch{return"pending"}return Mr(t),"paid"}return"pending"}import{Fragment as Gs,jsx as _r}from"react/jsx-runtime";var Ds="__m_a",Vo=Ts(void 0),jr=void 0;function rm(e){cr({projectID:e}),jr=e,typeof window<"u"&&ut([window.location.origin])}function st(){return jr??document.querySelector('script[data-id][data-name="internal-cart"]')?.getAttribute("data-id")??void 0}function Ms(){return document.querySelector('script[data-id][data-name="internal-cart"]')?.getAttribute("data-custom-host")??void 0}var Os=({children:e,locale:t})=>{let[n]=Rs(()=>new Es),o=Mo();qo(()=>{Ie()},[]);let r=st();if(qo(()=>{if(r==null)return;let i=()=>{zs(r).then(u=>{u==="paid"&&n.invalidateQueries({queryKey:["cart"]})})},d=()=>{document.visibilityState==="visible"&&i()};return i(),window.addEventListener("pageshow",i),document.addEventListener("visibilitychange",d),()=>{window.removeEventListener("pageshow",i),document.removeEventListener("visibilitychange",d)}},[r,n]),r==null)return _r(Gs,{});let a=Hr(r,t??o.locale,o.texts);return _r(Ls,{client:n,children:_r(Vo.Provider,{value:a,children:e})})},Ur,Us=zo(async e=>jo(await me.get(Z).getOrder({id:e.orderId,projectId:e.projectId})));function nm(){let{country:e,couponCode:t,selectedDeliveryMethod:n,postalCode:o}=E()??Ht;return{country:e,couponCode:t,selectedDeliveryMethod:n,postalCode:o}}function om(){return(E()?.products??[]).map(e=>({id:e.id,quantity:e.quantity}))}function _s(e){let t=E();G({...t,products:_o(t?.products??[],e)}),Ie()}function zs(e){return Ur??=Fo({projectId:e,fetchStatus:Us,removeLines:_s}).catch(t=>{console.warn("cannot check the pending order",t)}).finally(()=>{Ur=void 0}),Ur}var it=async(e,t)=>{let n=[];t?.items!=null&&t.items.length>0?n=t.items:n=E()?.products??[];let o=Array.from(new Set(n.map(i=>i.productID)));if(o.length===0)return[];let r=new URLSearchParams;r.set("ids",o.join(",")),r.set("locale",t?.locale??L());let a;try{let i=await fetch(nr(ot(e,`/products?${r.toString()}`)),{method:"GET"});if(i.status!=200)return $("products-load-failed","internal");a=await i.json()}catch(i){return console.warn("cannot load the products of the cart",i),$("products-load-failed","internal")}return n.flatMap(i=>{let d=To(i.productID,a.result);return d==null?[]:[{...i,details:Ks(i.productID,d),catalogProductID:d.id}]})},am=()=>{let e=As(Vo);if(e===void 0)throw new Error("useCartProvider must be used within a CartProvider");return e},im=Os,js=R.object({isAvailable:R.boolean(),merchantId:R.string(),merchantName:R.string(),gateway:R.string(),gatewayId:R.string()}),Fs=R.object({id:R.string(),productID:R.string(),quantity:R.number(),priceVersion:R.string().optional(),metadata:R.record(R.string(),R.string().optional()).optional(),url:R.string().optional()}),qs=R.object({country:R.string().optional(),couponCode:R.string().optional(),selectedDeliveryMethod:R.string().optional(),postalCode:R.string().optional(),email:R.string().optional(),products:R.array(Fs).optional(),googlePayConfig:js.optional()}),Ht={country:void 0,couponCode:void 0,email:void 0,selectedDeliveryMethod:void 0,postalCode:void 0,products:[],googlePayConfig:void 0},qr="checkout";function Hs(){return typeof localStorage>"u"?[]:(E().products??[]).map(e=>({...e}))}function sm(){return Hs().map(e=>`${e.productID}:${e.quantity}`).sort().join(",")}function lm(e){let t=E();if(!(t.products==null||t.products.length===0))return{items:t.products.map(n=>({id:n.productID,quantity:n.quantity,...n.priceVersion!=null?{priceVersion:n.priceVersion}:{}})),...t.country!=null?{countries:[t.country]}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},...t.selectedDeliveryMethod!=null?{deliveryMethod:t.selectedDeliveryMethod}:{},locale:e}}function dm(e){let t=E(),n=new Map;for(let o of t.products??[]){let r=n.get(o.productID)??[];r.push(o),n.set(o.productID,r)}t.products=e.map(o=>{let r=n.get(o.productId)?.shift();return{id:Math.random().toString(36).substring(7),productID:o.productId,quantity:o.quantity,...r?.priceVersion!=null?{priceVersion:r.priceVersion}:{},...r?.metadata!=null?{metadata:r.metadata}:{},...r?.url!=null?{url:r.url}:{}}}),G(t),Ie()}function cm(e){let t=new Map;for(let r of e)t.set(r.id,(t.get(r.id)??0)+r.quantity);let n=E(),o=(n.products??[]).flatMap(r=>{let a=t.get(r.productID);return a==null?[r]:r.quantity<=a?[]:[{...r,quantity:r.quantity-a}]});G({...n,products:o}),Ie()}function um(e){let t=E();t.products=t.products??[];for(let n of e)t.products.push({id:Math.random().toString(36).substring(7),productID:n.id,quantity:n.quantity});G(t),Ie()}function E(){try{let e=localStorage.getItem(qr);return e==null?Ht:qs.parse(JSON.parse(e))}catch{return Ht}}async function Ho(e,t){let n=await it(e,{items:t.map((a,i)=>({...a,id:`price-check-${i}`}))});if(Ue(n))return n;let o=Ao(t.map(a=>a.productID),n);if(o.length>0)return $("item-ids-not-found","notFound",o);let r=E();r.products==null&&(r.products=[]),r.products.push(...t.map(a=>({id:Math.random().toString(36).substring(7),productID:a.productID,quantity:a.quantity,priceVersion:n.find(i=>i.productID===a.productID)?.details?.pricing?.priceVersion,metadata:a.metadata,url:Ro(a.url,typeof window<"u"?window.location.href:void 0)}))),$s(t,n),Rr({event:"addToCart",currency:"PLN",items:t.map(a=>({id:a.productID,name:a.name??"",price:a.price??0,quantity:a.quantity,currency:a.currency??"PLN"}))}),G(r),Ie()}function $s(e,t){for(let n of e)try{let o=t.find(d=>d.productID===n.productID),r=o?.details?.pricing?.effectivePrice??o?.details?.price??n.price,a=o?.details?.currency??n.currency;if(r==null||a==null)continue;let i=o?.catalogProductID??n.productID;(n.analytics??cn()).track("add_to_cart",{qty:n.quantity,value_minor:Math.round(r*n.quantity),currency:a},{product_id:i,variant_id:i!==n.productID?n.productID:null})}catch{}}function $o(e){let t=E(),n={...t,products:t?.products?.filter(o=>!e.includes(o.productID)&&!e.includes(o.id))};Rr({event:"removeFromCart",items:e.map(o=>({id:o,name:"",price:0,quantity:1,currency:"PLN"}))}),G(n),Ie()}function G(e){localStorage.setItem(qr,JSON.stringify(e)),Yo()}var Ft=new Set,Wo=0,jt=!1;function Bo(e){e.key===qr&&Yo()}function pm(e){return Ft.add(e),!jt&&typeof window<"u"&&(window.addEventListener("storage",Bo),jt=!0),()=>{Ft.delete(e),Ft.size===0&&jt&&(window.removeEventListener("storage",Bo),jt=!1)}}function mm(){return Wo}function Yo(){Wo+=1;for(let e of Ft)try{e()}catch{}}function Ko(e,t){if(e.products==null||e.products.length==0)return;let n=e.products.reduce((o,r)=>(r.metadata!=null&&Object.keys(r.metadata).forEach(a=>{let i=r.metadata?.[a];i!=null&&(o[a]=i)}),o),{});return{items:e.products.map(o=>({id:o.productID,quantity:o.quantity,priceVersion:o.priceVersion})),askForNote:!0,countries:e.country?[e.country]:void 0,metadata:n,locale:t}}var Hr=(e,t=L(),n)=>{let o=Ms();return o!=null&&un(o),{async checkIfApplePayIsAvailable(){if(typeof window>"u"||typeof document>"u"||!("ApplePaySession"in window))return!1;try{return(await me.get(Z).isOneClickPaymentAvailable({projectId:e})).applePay}catch(r){return console.error("Error checking if Apple Pay is available",r),!1}},async getGooglePayConfiguration(r){if(typeof window>"u"||typeof document>"u")return{isAvailable:!1};try{let a=await Bs(e);if(a?.isAvailable!=!0)return{isAvailable:!1};let i=E();if(i==null)return console.log("checkout is null"),{isAvailable:!1};let d=await it(e,{locale:t,items:r.items.map(b=>({id:Math.random().toString(36).substring(7),quantity:b.quantity,metadata:b.metadata,productID:b.productID}))});if(Ue(d))return{isAvailable:!1};let u=await me.get(Z).getPreOrderDetails({items:d.map(b=>Ne(Nt,{id:b.productID,quantity:b.quantity})),projectId:e,postCode:i.postalCode,couponCode:i.couponCode,countryCode:i.country,selectedDeliveryMethod:i.selectedDeliveryMethod});if(u.totalAmount==null)return{isAvailable:!1};let l=d.find(b=>b.details?.isDeliverable==!0)!=null,g=await Lo({items:d,googlePayConfig:a,checkout:i,cartRequiresShipping:l,result:u,locale:t,texts:n});return g==null?{isAvailable:!1}:{isAvailable:!0,config:g}}catch(a){return console.error("Error resolving Google Pay configuration",a),{isAvailable:!1}}},async clearCart(){let r=structuredClone(Ht);r.country=E()?.country,G(r),Ie()},async getAvailableCountries(){let r=await fetch(nr(ot(e,"/countries")),{method:"GET"});if(r.status!=200)return[];try{return R.array(R.object({name:R.string(),code:R.string()})).parse(await r.json())}catch(a){return $(a.toString(),"internal")}},async getCountry(){let r=E()?.country;if(r==null){r="PL";let a=E();a.country=r,G(a)}return r},async getNumberOfElementsInCart(){return E()?.products?.reduce((r,a)=>r+a.quantity,0)??0},async getProducts(){return await it(e,{locale:t})},async removeProductFromCart(r){return $o([r.id])},async setCountry(r){let a=E();a.country=r,G(a)},async setCouponCodeIfPossible(r){let a=E();a.couponCode=r,G(a)},async setPostalCode(r){let a=E();a.postalCode=r,G(a)},async setDeliveryMethod(r){let a=E();a.selectedDeliveryMethod=r,G(a)},async setEmail(r){let a=E();a.email=r,G(a)},async addProduct(r){return await Ho(e,[r])},async updateQuantity(r){let a=E();a.products=a.products?.map(i=>(i.id===r.id&&(i.quantity=r.quantity),i)),G(a),Ie()},async getPaymentMethodChoice(){let r=Ko(E(),t);return r==null?null:Go(r)},async redirectToNextStep(r){let a=Ko(E(),t);if(a==null)return $("cart-is-empty","badInput");r?.paymentMethod!=null&&(a.paymentMethod=r.paymentMethod);let i=await zr(a);return Ue(i)?(console.warn("cannot create payment URL",i.error),i):{url:i.url,...i.orderId!=null?{orderId:i.orderId}:{},...i.projectId!=null?{projectId:i.projectId}:{}}},async justRedirectToPayment(r){let a={items:[{id:r.productID,quantity:1}],askForNote:!1,details:r.email||r.name?{name:r.name,email:r.email}:void 0,locale:r.locale??t};a=Fr(a),r.country==null&&(r.country="pl"),a.details==null&&(a.details={}),a.details.address==null&&(a.details.address={}),a.details.address.country=r.country,r.marketingAgreement===!0&&(a.additionalAgreements=[{id:Ds,name:"",required:!0,answer:!0}]);let i=await zr(a);return Ue(i)?i:{url:i.url}},async getApplePayPreview(r){let a=E();try{let i=await me.get(Z).getPreOrderDetails({items:r.items.map(d=>Ne(Nt,{id:d.productID,quantity:d.quantity})),projectId:e,postCode:a.postalCode,couponCode:a.couponCode,countryCode:a.country,selectedDeliveryMethod:a.selectedDeliveryMethod});return i.totalAmount==null||i.currency.length===0?$("pre-order-unavailable","internal"):{countryCode:i.country||a.country||"PL",currencyCode:i.currency,totalAmount:`${_(i.totalAmount/100,2)}`}}catch(i){return console.warn("cannot load the Apple Pay preview",i),$("pre-order-unavailable","internal")}},async completeApplePayPayment(r){let a=E();if(a==null)return $("Checkout not found");let i=await it(e,{locale:t});if(Ue(i))return i;try{let d=r.shippingContact?.givenName;r.shippingContact?.familyName!=null?d+=" "+r.shippingContact?.familyName:r.billingContact?.familyName!=null&&(d+=" "+r.billingContact?.familyName);let u={},l=qt();l!=null&&(u.ref=l);let g=await me.get(Z).authorizeOneClickPayment({gateway:0,paymentData:JSON.stringify(r.token.paymentData),paymentMethod:JSON.stringify(r.token.paymentMethod),transactionIdentifier:r.token.transactionIdentifier,order:Ne(ir,{items:i.map(b=>({id:b.productID,quantity:b.quantity})),couponCode:a.couponCode,email:r.shippingContact?.emailAddress??r.billingContact?.emailAddress??a.email??void 0,phone:r.shippingContact?.phoneNumber??r.billingContact?.phoneNumber??void 0,selectedDeliveryMethod:a.selectedDeliveryMethod,postCode:a.postalCode,projectId:e}),shippingAddress:Ne(or,{line1:r.shippingContact?.addressLines?.[0]??"",city:r.shippingContact?.locality??"",country:r.shippingContact?.countryCode??"",zipCode:r.shippingContact?.postalCode??"",name:d}),billingAddress:Ne(ar,{name:r.billingContact?.givenName??" "+(r.billingContact?.familyName??""),line1:r.billingContact?.addressLines?.[0]??"",city:r.billingContact?.locality??"",country:r.billingContact?.countryCode??"",zipCode:r.billingContact?.postalCode??""}),metadata:Object.keys(u).length>0?JSON.stringify(u):void 0});return{isSuccess:g.isSuccess,redirectURL:g.redirectUrl}}catch(d){return console.error(d),$("Failed to authorize payment")}},async completeGooglePayPayment(r){let a=E();if(a==null)return $("Checkout not found");let i=await it(e,{locale:t});if(Ue(i))return i;try{let d=r.paymentData.shippingAddress?.name,u={},l=qt();l!=null&&(u.ref=l);let g=await me.get(Z).authorizeOneClickPayment({gateway:1,paymentData:r.paymentData.paymentMethodData.tokenizationData.token,paymentMethod:r.paymentData.paymentMethodData.type,transactionIdentifier:"",order:Ne(ir,{items:i.map(b=>({id:b.productID,quantity:b.quantity})),couponCode:a.couponCode,email:r.paymentData.email??void 0,phone:r.paymentData.shippingAddress?.phoneNumber??void 0,selectedDeliveryMethod:r.paymentData.shippingOptionData?.id??a.selectedDeliveryMethod,postCode:r.paymentData.shippingAddress?.postalCode,projectId:e}),shippingAddress:Ne(or,{line1:r.paymentData.shippingAddress?.address1??"",city:r.paymentData.shippingAddress?.locality??"",country:r.paymentData.shippingAddress?.countryCode??"",zipCode:r.paymentData.shippingAddress?.postalCode??"",name:d}),billingAddress:Ne(ar,{name:r.paymentData.paymentMethodData.info?.billingAddress?.name,line1:r.paymentData.paymentMethodData.info?.billingAddress?.address1??"",city:r.paymentData.paymentMethodData.info?.billingAddress?.locality??"",country:r.paymentData.paymentMethodData.info?.billingAddress?.countryCode??"",zipCode:r.paymentData.paymentMethodData.info?.billingAddress?.postalCode??""}),metadata:Object.keys(u).length>0?JSON.stringify(u):void 0});return{isSuccess:g.isSuccess,redirectURL:g.redirectUrl}}catch(d){return console.error(d),$("Failed to authorize payment")}return{isSuccess:!0}},async getApplePayPaymentRequest(r){let a=E();if(a==null)return $("Checkout not found");r&&r.expectedItems!=null&&r.expectedItems.length>0&&(a.products&&$o(a.products.map(l=>l.productID)),await Ho(e,r.expectedItems));let i=await it(e,{locale:t});if(Ue(i))return i;let d=await me.get(Z).getPreOrderDetails({items:i.map(l=>Ne(Nt,{id:l.productID,quantity:l.quantity})),projectId:e,postCode:a.postalCode,couponCode:a.couponCode,countryCode:a.country,selectedDeliveryMethod:a.selectedDeliveryMethod}),u=i.map(l=>({amount:`${_(l.quantity*(l.details?.pricing?.effectivePrice??l.details?.price??0)/100,2)}`,label:l.details?.name+" - "+l.quantity,type:"final"}));if(d.selectedDeliveryMethod!=null){let l=d.methods.find(g=>g.id==d.selectedDeliveryMethod);l!=null&&u.push({amount:`${_(l.amount/100,2)}`,label:l.name,type:"final"})}return d.couponCode!=null&&d.couponValue!=null&&u.push({amount:`-${_(d.couponValue/100,2)}`,label:d.couponCode,type:"final"}),{countryCode:d.country||a.country||"PL",merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard"],total:{amount:`${_((d.totalAmount??0)/100,2)}`,label:Te("paymentForCart",t,n),type:"final"},shippingMethods:d.methods.map(l=>({amount:`${_(l.amount/100,2)}`,detail:l.description??"",identifier:l.id,label:l.name,dateComponentsRange:{startDateComponents:{days:l.minDays??1,hours:0,months:0,years:0},endDateComponents:{days:l.maxDays??14,hours:0,months:0,years:0}}})),lineItems:u,currencyCode:d.currency||i[0]?.details?.currency||"PLN"}}}};async function Bs(e){let t=E();if(t.googlePayConfig?.isAvailable!=!0){let n=await me.get(Z).isOneClickPaymentAvailable({projectId:e});n.googlePay==!0&&n.googlePayConfig!=null?t.googlePayConfig={isAvailable:!0,gateway:n.googlePayConfig.gateway,gatewayId:n.googlePayConfig.gatewayMerchantId,merchantName:n.googlePayConfig.merchantName,merchantId:n.googlePayConfig.merchantId}:t.googlePayConfig={isAvailable:!1,gateway:"",gatewayId:"",merchantName:"",merchantId:""}}return G(t),t.googlePayConfig}function Ks(e,t){if(e==t.id){let o=t.variants?.findIndex(r=>r.id===e);if(o!=null&&o!=-1){let r=t.variants[o];return{...t,availableQuantity:r.availableQuantity,isDeliverable:r.isDeliverable,images:r.images??t.images,name:t.name+" "+r.name,baseName:t.name,variantName:r.name,price:r.price,currency:r.currency,pricing:r.pricing}}return t}let n=t.variants?.find(o=>o.id===e);return n==null?t:{...t,id:n.id,name:t.name+" "+n.name,baseName:t.name,variantName:n.name,price:n.price,currency:n.currency,pricing:n.pricing,metadata:t.metadata,availableQuantity:n.availableQuantity,isDeliverable:n.isDeliverable,images:n.images??t.images}}function Ie(){let e=E(),t=0;if(e==null){at.setState(n=>({...n,numberOfProductsInCart:t}));return}t=e.products?.reduce((n,o)=>n+o.quantity,0)??0,at.setState(n=>({...n,numberOfProductsInCart:t}))}var Vs=200,Ws="item-ids-not-found",Pt="internal-error",Jo={"no-payment-gateway":"noPaymentGateway","gateway-not-configured":"gatewayNotConfigured","shipping-not-configured":"shippingNotConfigured","mixed-recurring":"mixedRecurring","currency-unsupported":"currencyUnsupported","price-changed":"priceChanged","product-not-found":"unavailableProducts","product-not-available":"unavailableProducts"},Ys=new Set(["internal","invalid-request"]),Js=new Set(["product-not-available","product-not-found"]);function Zs(e){return typeof e=="string"&&Object.hasOwn(Jo,e)?Jo[e]:void 0}function Qs(e){return/<\/?[a-z!?][^>]*>/i.test(e)}function Xs(e){return/^[A-Za-z][A-Za-z0-9]*(?:[-_.:][A-Za-z0-9]+)*$/.test(e)&&!/^[A-Z][a-z]+$/.test(e)||/^\[object \w+\]$|^(?:undefined|null)$/.test(e)}function el(e){return/Error:/.test(e)||/\n\s+at /.test(e)}function $r(e){let t=e.trim();if(!(t.length===0||t.length>Vs||/[\r\n]/.test(t)||Qs(t)||Xs(t)||el(t)))return t}var tl=3;function $t(e,t=0){if(typeof e=="object"&&e!=null){if(Array.isArray(e)||t>=tl)return{};let n=e,o=$t(n.error,t+1);if(o.message==null&&n.message!=null){let r=$t(n.message,t+1);o={...r,code:o.code??r.code}}return typeof n.code=="string"&&n.code.length>0&&(o.code=n.code),o}if(typeof e!="string")return{};try{let n=JSON.parse(e);return typeof n=="object"&&n!=null?$t(n,t+1):{}}catch{}return{message:$r(e)}}function rl(e){let t;try{t=JSON.parse(e)}catch{return{code:Pt,message:$r(e)}}if(typeof t=="string")return{code:Pt,message:$r(t)};if(typeof t!="object"||t==null)return{code:Pt};let n=t,{message:o,code:r}=$t(n.error),a={code:typeof n.code=="string"&&n.code.length>0?n.code:r??Pt,message:o};return Array.isArray(n.itemIds)&&(a.itemIds=n.itemIds.filter(i=>typeof i=="string")),a}function Br(e,t){let{code:n,message:o,itemIds:r}=rl(t),a=r!=null&&r.length>0;if(a&&(n===Pt||Js.has(n)))return $(Ws,"badInput",r);let i={message:o};return a&&(i.itemIds=r),$(n,e>=500?"internal":"badInput",i)}function bm(e,t){let n=Zs(e.error);if(n!=null)return t(n);if(e.type==="internal"||typeof e.error=="string"&&Ys.has(e.error))return t("checkoutFailed");let o=e.data?.message;return typeof o=="string"&&o.length>0?o:t("checkoutFailed")}var nl=["online","manual","cod"],ol=["bankTransfer","blik"];function Zo(e,t){if(!Array.isArray(e))return[];let n=[];for(let o of e)t.includes(o)&&!n.includes(o)&&n.push(o);return n}function al(e){if(typeof e!="object"||e==null)return null;let t=e.choice;if(typeof t!="object"||t==null)return null;let n=Zo(t.methods,nl);return n.length<2?null:{methods:n,manualAccountTypes:Zo(t.manualAccountTypes,ol)}}function vm(e){if(e==null)return null;let t=e.methods.filter(n=>n!=="cod");return t.length<2?null:{...e,methods:t}}function km(e,t){return t!=null&&e.methods.includes(t)?t:e.methods[0]}function xm(e){let t=e.includes("bankTransfer"),n=e.includes("blik");return n&&!t?"paymentMethodManualBlik":t&&!n?"paymentMethodManualTransfer":"paymentMethodManualBoth"}async function Qo(e,t,n=5e3){let o=typeof AbortController>"u"?void 0:new AbortController,r=setTimeout(()=>o?.abort(),n);try{let a=await fetch(e,{method:"POST",headers:t.headers,body:t.body,signal:o?.signal});return a.ok?al(await a.json()):null}catch{return null}finally{clearTimeout(r)}}var il;(o=>{async function e(r,a=1,i,d){let u=st();if(u==null)throw new Error("No project ID found");let g=await Hr(u).addProduct({productID:r,quantity:a,metadata:i,...d});if(g!=null)return g}o.addProductToCart=e;function t(){at.setState({isCartVisible:!0})}o.showCart=t;function n(){at.setState({isCartVisible:!1})}o.hideCart=n})(il||={});async function Xo(e){try{return await e.text()}catch{return""}}function ea(e,t){return t=Fr(t),t.locale??=L(),{headers:{...rr,...sr(e),"Content-Type":"application/json"},body:JSON.stringify(t)}}async function Go(e){let t=st();return t==null?null:Qo(ot(t,"/payment-methods"),ea(t,e))}async function zr(e){let t=st();if(t==null)throw new Error("No project ID found");let n=await fetch(ot(t,"/buy"),{method:"POST",...ea(t,e)});if(n.status!=200){let r=Br(n.status,await Xo(n));return console.warn("cannot create payment URL",n.status,r.error),r}let o=await n.json();return{url:o.url,...o.orderId!=null?{orderId:o.orderId}:{},...o.projectId!=null?{projectId:o.projectId}:{}}}async function Rm(e){let t=st();if(t==null)throw new Error("No project ID found");let n={...rr,...sr(t),"Content-Type":"application/json",...e.apiKey!=null?{Authorization:`Bearer ${e.apiKey}`}:{}},o=e.testMode?`/api/payment/link/auto/${t}/test`:`/api/payment/link/auto/${t}`;delete e.apiKey,delete e.testMode,e.locale??=L();let r=await fetch(Z+o,{method:"POST",headers:n,body:JSON.stringify(e)});return r.ok?{status:"ok",redirectURL:(await r.json()).url}:{...Br(r.status,await Xo(r)),status:"error"}}function qt(){if(typeof localStorage>"u")return;let e=localStorage.getItem("bitsnap-ref");if(e!=null)return e}function Fr(e){let t=qt();return t==null||(e.metadata==null&&(e.metadata={}),e.metadata.ref=t),e}export{me as a,Re as b,je as c,Fe as d,De as e,On as f,gt as g,yt as h,Ze as i,Qe as j,xa as k,Ue as l,Ws as m,bm as n,vm as o,km as p,xm as q,at as r,il as s,Go as t,zr as u,Rm as v,qt as w,Fr as x,Np as y,Ip as z,Sp as A,_ as B,Eo as C,Rr as D,Tp as E,Ar as F,cs as G,Ds as H,jr as I,rm as J,st as K,nm as L,om as M,zs as N,am as O,im as P,Hs as Q,sm as R,lm as S,dm as T,cm as U,um as V,pm as W,mm as X,Hr as Y};
5
+ //# sourceMappingURL=chunk-AAC576BC.mjs.map