bitsnap-react 1.16.0 → 1.18.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.
- package/AGENTS.md +5 -0
- package/README.md +87 -0
- package/dist/CartProvider-ECQQH3PS.css +2 -0
- package/dist/CartProvider-ECQQH3PS.css.map +1 -0
- package/dist/CartProvider-OEI526IN.js +2 -0
- package/dist/{CartProvider-VGZMDVFJ.js.map → CartProvider-OEI526IN.js.map} +1 -1
- package/dist/CartProvider-RYAA3JDA.mjs +2 -0
- package/dist/{PanelModelFiles-NYCOFPLY.js → PanelModelFiles-7HPXWONN.js} +2 -2
- package/dist/{PanelModelFiles-NYCOFPLY.js.map → PanelModelFiles-7HPXWONN.js.map} +1 -1
- package/dist/PanelModelFiles-JZFSF7BF.mjs +2 -0
- package/dist/PanelModelFiles-JZFSF7BF.mjs.map +1 -0
- package/dist/analytics.d.mts +2 -2
- package/dist/analytics.d.ts +2 -2
- package/dist/analytics.js +1 -1
- package/dist/analytics.mjs +1 -1
- package/dist/catalog.css +1 -1
- package/dist/catalog.css.map +1 -1
- package/dist/catalog.d.mts +3 -1
- package/dist/catalog.d.ts +3 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/{chunk-GXUNRJ5S.js → chunk-4HGZZJEL.js} +2 -2
- package/dist/{chunk-GXUNRJ5S.js.map → chunk-4HGZZJEL.js.map} +1 -1
- package/dist/chunk-4OVOKGGS.mjs +2 -0
- package/dist/chunk-4OVOKGGS.mjs.map +1 -0
- package/dist/chunk-5X7TP3TQ.mjs +2 -0
- package/dist/{chunk-SULHGFYN.mjs.map → chunk-5X7TP3TQ.mjs.map} +1 -1
- package/dist/{chunk-QQQ2JSPQ.mjs → chunk-CF45RDMD.mjs} +2 -2
- package/dist/{chunk-QQQ2JSPQ.mjs.map → chunk-CF45RDMD.mjs.map} +1 -1
- package/dist/{chunk-GQJDFLSL.js → chunk-DP2NOHCI.js} +2 -2
- package/dist/{chunk-GQJDFLSL.js.map → chunk-DP2NOHCI.js.map} +1 -1
- package/dist/chunk-EVIDNS22.mjs +2 -0
- package/dist/chunk-EVIDNS22.mjs.map +1 -0
- package/dist/chunk-G4V2KWTV.js +2 -0
- package/dist/chunk-G4V2KWTV.js.map +1 -0
- package/dist/{chunk-SXKJ26OA.mjs → chunk-GEBRXFT3.mjs} +2 -2
- package/dist/chunk-GWF3MRUP.js +2 -0
- package/dist/chunk-GWF3MRUP.js.map +1 -0
- package/dist/chunk-JA62KNAQ.js +2 -0
- package/dist/chunk-JA62KNAQ.js.map +1 -0
- package/dist/chunk-JHJ3ZZF4.mjs +2 -0
- package/dist/chunk-JHJ3ZZF4.mjs.map +1 -0
- package/dist/{chunk-WKE6ECID.mjs → chunk-UPAOIY4R.mjs} +2 -2
- package/dist/chunk-V5ECGBFW.js +5 -0
- package/dist/chunk-V5ECGBFW.js.map +1 -0
- package/dist/{chunk-SRQOFCMO.js → chunk-VNV5BD4X.js} +2 -2
- package/dist/{chunk-SRQOFCMO.js.map → chunk-VNV5BD4X.js.map} +1 -1
- package/dist/chunk-WJO5GSY3.mjs +5 -0
- package/dist/chunk-WJO5GSY3.mjs.map +1 -0
- package/dist/chunk-ZATPBYOA.js +2 -0
- package/dist/chunk-ZATPBYOA.js.map +1 -0
- package/dist/chunk-ZHTMK5TA.mjs +2 -0
- package/dist/chunk-ZHTMK5TA.mjs.map +1 -0
- package/dist/course.d.mts +13 -3
- package/dist/course.d.ts +13 -3
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +1 -1
- package/dist/course.mjs.map +1 -1
- package/dist/embed/analytics.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +41 -12
- package/dist/index.d.ts +41 -12
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{instrument-BE8ktMUv.d.mts → instrument-eXaC8hc2.d.mts} +1 -1
- package/dist/{instrument-BE8ktMUv.d.ts → instrument-eXaC8hc2.d.ts} +1 -1
- package/dist/methods-AULQDKVS.mjs +2 -0
- package/dist/methods-OJEZREBK.css +2 -0
- package/dist/methods-OJEZREBK.css.map +1 -0
- package/dist/methods-PMH5VQ25.js +2 -0
- package/dist/{methods-WRONKK3D.js.map → methods-PMH5VQ25.js.map} +1 -1
- package/dist/returns.d.mts +19 -10
- package/dist/returns.d.ts +19 -10
- package/dist/returns.js +1 -1
- package/dist/returns.js.map +1 -1
- package/dist/returns.mjs +1 -1
- package/dist/{texts-tQtAGJCT.d.mts → texts-LGhuQfA9.d.mts} +28 -3
- package/dist/{texts-CIEFbJTN.d.ts → texts-m6XQGZ6w.d.ts} +28 -3
- package/dist/types-ClFCVzk_.d.ts +121 -0
- package/dist/types-D6LsoycW.d.mts +121 -0
- package/dist/viewer3d.css +1 -1
- package/dist/viewer3d.css.map +1 -1
- package/dist/viewer3d.mjs +1 -1
- package/package.json +2 -2
- package/dist/CartProvider-PDEV6GCV.css +0 -2
- package/dist/CartProvider-PDEV6GCV.css.map +0 -1
- package/dist/CartProvider-VGZMDVFJ.js +0 -2
- package/dist/CartProvider-ZY5OLTAF.mjs +0 -2
- package/dist/PanelModelFiles-RV7OHUUZ.mjs +0 -2
- package/dist/PanelModelFiles-RV7OHUUZ.mjs.map +0 -1
- package/dist/chunk-5AYH23UJ.mjs +0 -4
- package/dist/chunk-5AYH23UJ.mjs.map +0 -1
- package/dist/chunk-AGYS7Z6G.mjs +0 -2
- package/dist/chunk-AGYS7Z6G.mjs.map +0 -1
- package/dist/chunk-DPKWYLN7.mjs +0 -2
- package/dist/chunk-DPKWYLN7.mjs.map +0 -1
- package/dist/chunk-I3QXJJ7U.mjs +0 -2
- package/dist/chunk-I3QXJJ7U.mjs.map +0 -1
- package/dist/chunk-LL7ASBGY.js +0 -2
- package/dist/chunk-LL7ASBGY.js.map +0 -1
- package/dist/chunk-OZHXRKMX.js +0 -2
- package/dist/chunk-OZHXRKMX.js.map +0 -1
- package/dist/chunk-QERYM7RC.js +0 -2
- package/dist/chunk-QERYM7RC.js.map +0 -1
- package/dist/chunk-QXGK337V.mjs +0 -2
- package/dist/chunk-QXGK337V.mjs.map +0 -1
- package/dist/chunk-SULHGFYN.mjs +0 -2
- package/dist/chunk-WPOXLITY.js +0 -2
- package/dist/chunk-WPOXLITY.js.map +0 -1
- package/dist/chunk-Y5KWVTXT.js +0 -4
- package/dist/chunk-Y5KWVTXT.js.map +0 -1
- package/dist/methods-NJEP64AG.mjs +0 -2
- package/dist/methods-QAZED7TJ.css +0 -2
- package/dist/methods-QAZED7TJ.css.map +0 -1
- package/dist/methods-WRONKK3D.js +0 -2
- package/dist/types-DP1vxo5E.d.mts +0 -53
- package/dist/types-u8VwmC3j.d.ts +0 -53
- /package/dist/{CartProvider-ZY5OLTAF.mjs.map → CartProvider-RYAA3JDA.mjs.map} +0 -0
- /package/dist/{chunk-SXKJ26OA.mjs.map → chunk-GEBRXFT3.mjs.map} +0 -0
- /package/dist/{chunk-WKE6ECID.mjs.map → chunk-UPAOIY4R.mjs.map} +0 -0
- /package/dist/{methods-NJEP64AG.mjs.map → methods-AULQDKVS.mjs.map} +0 -0
package/dist/chunk-Y5KWVTXT.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkQERYM7RCjs = require('./chunk-QERYM7RC.js');var _chunkSRQOFCMOjs = require('./chunk-SRQOFCMO.js');var _chunkWPOXLITYjs = require('./chunk-WPOXLITY.js');var _chunkGXUNRJ5Sjs = require('./chunk-GXUNRJ5S.js');var _chunkGQJDFLSLjs = require('./chunk-GQJDFLSL.js');var _chunk7RXW6XFYjs = require('./chunk-7RXW6XFY.js');var _react = require('@formkit/auto-animate/react');var _react3 = require('react'); var En = _interopRequireWildcard(_react3); var ft = _interopRequireWildcard(_react3);var _jsxruntime = require('react/jsx-runtime');function me({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card",className:_chunkGXUNRJ5Sjs.d.call(void 0, "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function be({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-header",className:_chunkGXUNRJ5Sjs.d.call(void 0, "@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 ve({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-title",className:_chunkGXUNRJ5Sjs.d.call(void 0, "leading-none font-semibold",e),...t})}function Mt({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-description",className:_chunkGXUNRJ5Sjs.d.call(void 0, "text-muted-foreground text-sm",e),...t})}function pe({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-content",className:_chunkGXUNRJ5Sjs.d.call(void 0, "px-6",e),...t})}var _inputotp = require('input-otp');var _lucidereact = require('lucide-react');function On({className:e,containerClassName:t,...n}){return _jsxruntime.jsx.call(void 0, _inputotp.OTPInput,{"data-slot":"input-otp",containerClassName:_chunkGXUNRJ5Sjs.d.call(void 0, "flex items-center gap-2 has-disabled:opacity-50",t),className:_chunkGXUNRJ5Sjs.d.call(void 0, "disabled:cursor-not-allowed",e),...n})}function Ut({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"input-otp-group",className:_chunkGXUNRJ5Sjs.d.call(void 0, "flex items-center",e),...t})}function Re({index:e,className:t,...n}){let o=En.useContext(_inputotp.OTPInputContext),{char:r,hasFakeCaret:a,isActive:i}=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _2 => _2.slots, 'access', _3 => _3[e]]), () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{"data-slot":"input-otp-slot","data-active":i,className:_chunkGXUNRJ5Sjs.d.call(void 0, "data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",t),...n,children:[r,a&&_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:_jsxruntime.jsx.call(void 0, "div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function Mn({...e}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"input-otp-separator",role:"separator",...e,children:_jsxruntime.jsx.call(void 0, _lucidereact.MinusIcon,{})})}function da(){return _jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.3s]"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.15s]"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-3 animate-bounce rounded-full bg-current"})]})}var Z=da;var la="return_url",_t="__return_url",ua="accessToken";function Xe(e){let t=new URLSearchParams(e).get(la);return t?Un(t):null}function et(e){typeof window>"u"||(e?window.sessionStorage.setItem(_t,e):window.sessionStorage.removeItem(_t))}function Ue(){if(typeof window>"u")return null;let e=window.sessionStorage.getItem(_t);return e?Un(e):null}function ma(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 Un(e){try{let t=new URL(e);return t.protocol!=="https:"&&t.protocol!=="http:"||!ma(t.origin,_chunkSRQOFCMOjs.h.call(void 0, ))?null:t.toString()}catch (e2){return null}}function je(e,t){let n=new URL(e);return n.searchParams.set(ua,t),n.toString()}if(typeof window<"u"){let t=[window.location.origin,"https://bitsnap.pl","https://kursy.bitsnap.pl"];_chunkSRQOFCMOjs.h.call(void 0, ).length===0&&_chunkSRQOFCMOjs.g.call(void 0, Array.from(new Set(t)))}var ga=({projectID:e,host:t,reveal:n,email:o,setEmail:r,loginUser:a,isLoginLoading:i,errMsg:d})=>{let{projectID:c,host:l}=_chunkSRQOFCMOjs.j.call(void 0, );if(typeof window<"u"&&_chunkSRQOFCMOjs.k.call(void 0, _nullishCoalesce(e, () => (c)),_nullishCoalesce(t, () => (l)))!=null)return window.location.href=window.location.href.replaceAll("login",""),null;let[m,g]=_react3.useState.call(void 0, !1),k=s=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(s.trim())?g(!0):g(!1),u=s=>{let{value:P}=s.target;k(P),r(P)};function y(){n()}function C(s){s.preventDefault(),a()}return _jsxruntime.jsx.call(void 0, "main",{className:"mx-auto flex max-w-sm flex-1 flex-col justify-center space-y-12",children:_jsxruntime.jsx.call(void 0, "div",{className:_chunkGXUNRJ5Sjs.d.call(void 0, "flex min-w-sm flex-col gap-6"),children:_jsxruntime.jsxs.call(void 0, me,{children:[_jsxruntime.jsxs.call(void 0, be,{children:[_jsxruntime.jsx.call(void 0, ve,{className:"text-2xl",children:"Zaloguj si\u0119"}),_jsxruntime.jsx.call(void 0, Mt,{children:"Wy\u015Blemy do Ciebie kod na maila, dzi\u0119ki kt\xF3remu si\u0119 zalogujesz."})]}),_jsxruntime.jsx.call(void 0, pe,{children:_jsxruntime.jsxs.call(void 0, "form",{onSubmit:C,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-6",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"grid gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.a,{htmlFor:"email",children:"Email"}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.r,{id:"email",onChange:u,type:"email",placeholder:"m@example.com",required:!0}),_jsxruntime.jsx.call(void 0, "span",{className:_chunkGXUNRJ5Sjs.d.call(void 0, !m&&o.length>0?"font-bold text-red-500":"text-neutral-700 dark:text-neutral-400","text-xs"),children:!m&&o.length>0?"Nieprawid\u0142owy adres email":"Wpisz sw\xF3j adres email"})]}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{type:"submit",disabled:i,className:"relative w-full",onClick:a,children:[i&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, Z,{})}),"Zaloguj si\u0119"]}),d.length>0&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs font-medium text-red-500",children:d})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mt-4 text-center text-sm",children:["Masz ju\u017C kod?"," ",_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:y,className:"underline underline-offset-4",children:"Mam ju\u017C kod"})]})]})})]})})})},ya=({projectID:e,host:t,email:n,reveal:o,setEmail:r,isLoginLoading:a,loginUserResponse:i,setLoginUserResponse:d,setResponseStatus:c,errMsg:l})=>{let m=_chunkGQJDFLSLjs.m.call(void 0, ),{mutateAsync:g,isPending:k}=_chunkWPOXLITYjs.l.call(void 0, _chunkWPOXLITYjs.j.publicApi.userPanelLoginWithCode),[u,y]=_react3.useState.call(void 0, ""),[C,s]=_react3.useState.call(void 0, !1),[P,R]=_react3.useState.call(void 0, !1),[B,H]=_react3.useState.call(void 0, 0),A=U=>/^\d+$/.test(U.trim())?s(!0):s(!1),O=U=>{A(U),y(U)};async function q(){if(R(!0),u.length==0){s(!1);return}let U=parseInt(u),X=await g({code:U}),he,Ne,re;if(X.result.case==="accessToken"?(s(!0),he="ok",Ne=void 0,re=X.result.value):(s(!1),he="error",Ne=X.result.value,re=void 0),he==="error"&&(s(!1),console.warn("error:",`Kod b\u0142\u0119du: ${Ne}`),console.warn("Nieprawid\u0142owy kod, spr\xF3buj ponownie.")),he==="ok"){m.track("panel_login",{}),re&&_chunkSRQOFCMOjs.l.call(void 0, e,re,n,t);let b=typeof window<"u"?Ue():null;setTimeout(()=>{if(re&&b){window.location.href=je(b,re);return}window.location.reload()},100)}}function L(){let U=setInterval(()=>{H(X=>X>0?X-1:(clearInterval(U),0))},1e3);return()=>{clearInterval(U)}}_react3.useEffect.call(void 0, ()=>{_optionalChain([i, 'optionalAccess', _4 => _4.status])==="ok"&&_optionalChain([i, 'optionalAccess', _5 => _5.retryIn])>0&&(H(i.retryIn),L())},[i]);function V(){r(""),d(null),c("default"),o()}function ye(U){U.preventDefault(),q()}return _jsxruntime.jsx.call(void 0, "main",{className:"mx-auto flex max-w-md flex-1 flex-col justify-center space-y-8",children:_jsxruntime.jsx.call(void 0, "div",{className:_chunkGXUNRJ5Sjs.d.call(void 0, "flex min-w-sm flex-col gap-6"),children:_jsxruntime.jsxs.call(void 0, me,{children:[_jsxruntime.jsxs.call(void 0, be,{children:[_jsxruntime.jsx.call(void 0, ve,{className:"text-2xl",children:"Wpisz kod z maila"}),_jsxruntime.jsx.call(void 0, Mt,{children:"Sprawd\u017A czy przypadkiem nie wyl\u0105dowa\u0142 w spamie."})]}),_jsxruntime.jsxs.call(void 0, pe,{children:[_jsxruntime.jsxs.call(void 0, "form",{onSubmit:ye,className:"flex flex-col gap-6",children:[_jsxruntime.jsx.call(void 0, "div",{className:"grid gap-2",children:_jsxruntime.jsx.call(void 0, "div",{className:"my-5 flex w-full items-center justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsxs.call(void 0, On,{id:"verify-code",maxLength:6,pattern:_inputotp.REGEXP_ONLY_DIGITS,onChange:U=>{O(U)},children:[_jsxruntime.jsxs.call(void 0, Ut,{children:[_jsxruntime.jsx.call(void 0, Re,{index:0}),_jsxruntime.jsx.call(void 0, Re,{index:1}),_jsxruntime.jsx.call(void 0, Re,{index:2})]}),_jsxruntime.jsx.call(void 0, Mn,{}),_jsxruntime.jsxs.call(void 0, Ut,{children:[_jsxruntime.jsx.call(void 0, Re,{index:3}),_jsxruntime.jsx.call(void 0, Re,{index:4}),_jsxruntime.jsx.call(void 0, Re,{index:5})]})]}),_jsxruntime.jsx.call(void 0, "span",{className:_chunkGXUNRJ5Sjs.d.call(void 0, !C&&P?"text-red-500":"text-neutral-700 dark:text-neutral-400","text-xs"),children:!C&&P?u.length==0?"Kod nie mo\u017Ce by\u0107 pusty":"Kod musi sk\u0142ada\u0107 si\u0119 z cyfr":"Wpisz kod z maila"})]})})}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{type:"submit",disabled:a||k,className:"relative w-full",children:[(a||k)&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, Z,{})}),"Zaloguj si\u0119"]}),l.length>0&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs font-medium text-red-500",children:l})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mt-4 text-center text-sm",children:["Nie masz kodu?"," ",_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:V,className:"underline underline-offset-4",children:"Wr\xF3\u0107"})]})]})]})})})},ha=({analytics:e})=>{let{theme:t,allowedReturnOrigins:n,projectID:o,host:r}=_chunkSRQOFCMOjs.j.call(void 0, ),a=_chunkGQJDFLSLjs.n.call(void 0, o,e,"panel"),i={"--button-background-color":_nullishCoalesce(_optionalChain([t, 'optionalAccess', _6 => _6.colors, 'optionalAccess', _7 => _7.brand]), () => ("#FFFFFF")),"--button-background-color-dark":_nullishCoalesce(_optionalChain([t, 'optionalAccess', _8 => _8.colors, 'optionalAccess', _9 => _9.brandDark]), () => ("#000000")),"--button-text-color":_nullishCoalesce(_optionalChain([t, 'optionalAccess', _10 => _10.colors, 'optionalAccess', _11 => _11.brandDark]), () => ("#000000")),"--button-text-color-dark":_nullishCoalesce(_optionalChain([t, 'optionalAccess', _12 => _12.colors, 'optionalAccess', _13 => _13.brand]), () => ("#FFFFFF"))},[d,c]=_react3.useState.call(void 0, "login"),[l]=_react.useAutoAnimate.call(void 0, {duration:300,easing:"ease-in-out",disrespectUserMotionPreference:!1}),m=()=>c(O=>O==="login"?"verifyCode":"login"),[g,k]=_react3.useState.call(void 0, ""),[u,y]=_react3.useState.call(void 0, "default"),[C,s]=_react3.useState.call(void 0, null),{mutateAsync:P,isPending:R}=_chunkWPOXLITYjs.l.call(void 0, _chunkWPOXLITYjs.j.publicApi.userPanelLogin),[B,H]=_react3.useState.call(void 0, "");_react3.useEffect.call(void 0, ()=>{if(typeof window>"u"||window.parent!==window)return;let O=Xe(window.location.search);O&&et(O);let q=_nullishCoalesce(O, () => (Ue()));if(!q)return;let L=_chunkSRQOFCMOjs.k.call(void 0, o,r);L&&(window.location.href=je(q,L))},[n,o,r]);async function A(){H(""),y("default");let O=await P({email:g}),q=O.result.case==="success"?"ok":"error",L=0,V;O.result.case==="success"&&(L=O.result.value.retryIn),q==="error"&&(V="Nieprawid\u0142owy adres email, spr\xF3buj ponownie."),s({status:q,retryIn:L,message:V}),q==="ok"&&d==="login"?m():q==="ok"&&d==="verifyCode"?y("success"):q==="error"&&H(_nullishCoalesce(V, () => ("Nieprawid\u0142owy adres email, spr\xF3buj ponownie.")))}return _jsxruntime.jsx.call(void 0, _chunkGQJDFLSLjs.l,{value:a,children:_jsxruntime.jsx.call(void 0, "div",{className:"bg-white text-black dark:bg-black dark:text-white",children:_jsxruntime.jsxs.call(void 0, "div",{className:"font-inter flex h-screen w-screen flex-col p-4",style:i,ref:l,children:[_jsxruntime.jsxs.call(void 0, "header",{children:[_optionalChain([t, 'optionalAccess', _14 => _14.logoDarkURL])&&_jsxruntime.jsx.call(void 0, "img",{src:_optionalChain([t, 'optionalAccess', _15 => _15.logoDarkURL]),className:"hidden dark:inline",alt:"Company Logo",draggable:!1}),_optionalChain([t, 'optionalAccess', _16 => _16.logoURL])&&_jsxruntime.jsx.call(void 0, "img",{src:_optionalChain([t, 'optionalAccess', _17 => _17.logoURL]),className:"dark:hidden",alt:"Company Logo",draggable:!1})]}),d==="login"&&_jsxruntime.jsx.call(void 0, ga,{projectID:o,host:r,reveal:m,email:g,setEmail:k,loginUser:A,isLoginLoading:R,errMsg:B}),d==="verifyCode"&&_jsxruntime.jsx.call(void 0, ya,{projectID:o,host:r,email:g,reveal:m,setEmail:k,loginUser:A,isLoginLoading:R,loginUserResponse:C,setLoginUserResponse:s,responseStatus:u,setResponseStatus:y,errMsg:B})]})})})},Pa= exports.n =({analytics:e}={})=>_jsxruntime.jsx.call(void 0, ha,{analytics:e});function _n(e){let[t,n]=_react3.useState.call(void 0, ()=>{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 (e3){a[i]=d}}),{...e,...a}}),o=_react3.useCallback.call(void 0, r=>{n(a=>{let i={...a,...r};if(typeof window<"u"){let d=new URLSearchParams;Object.keys(i).forEach(l=>{let m=i[l];m!=null&&d.set(l,JSON.stringify(m))});let c=`${window.location.pathname}?${d.toString()}`;window.history.pushState({},"",c)}return i})},[]);return _react3.useEffect.call(void 0, ()=>{let r=()=>{let a=new URLSearchParams(window.location.search),i={};Object.keys(e).forEach(d=>{let c=a.get(d);if(c!==null)try{i[d]=JSON.parse(c)}catch (e4){i[d]=c}}),n({...e,...i})};return window.addEventListener("popstate",r),()=>window.removeEventListener("popstate",r)},[e]),[t,o]}function zn(e,t){if(e!=null)return e;let n=_optionalChain([t, 'optionalAccess', _18 => _18.trim, 'call', _19 => _19()]);if(!(n==null||n===""))return{tokens:_chunkWPOXLITYjs.t.call(void 0, n)}}var _reactswitch = require('@radix-ui/react-switch'); var ut = _interopRequireWildcard(_reactswitch);function qn({className:e,...t}){return _jsxruntime.jsx.call(void 0, ut.Root,{"data-slot":"switch",className:_chunkGXUNRJ5Sjs.d.call(void 0, "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:_jsxruntime.jsx.call(void 0, ut.Thumb,{"data-slot":"switch-thumb",className:_chunkGXUNRJ5Sjs.d.call(void 0, "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function ka({}){let[e,t]=_react3.useState.call(void 0, {disableAll:!1});return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:"Powiadomienia"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500",children:"Zarz\u0105dzaj swoimi powiadomieniami"}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-6",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-2",children:[_jsxruntime.jsx.call(void 0, qn,{id:"disable-all-notifications",checked:e.disableAll,onCheckedChange:n=>t(o=>({...o,disableAll:n}))}),_jsxruntime.jsxs.call(void 0, _chunkQERYM7RCjs.a,{htmlFor:"disable-all-notifications",className:"flex flex-col gap-1 text-base",children:["Wszystkie powiadomienia",_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-normal text-neutral-500 md:text-sm",children:"Ten przycisk mo\u017Ce wy\u0142\u0105czy\u0107 wszystkie powiadomienia"})]})]})})]})}var Bn=ka;function Hn({className:e,...t}){return _jsxruntime.jsx.call(void 0, "nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:_chunkGXUNRJ5Sjs.d.call(void 0, "mx-auto flex w-full justify-center",e),...t})}function Gn({className:e,...t}){return _jsxruntime.jsx.call(void 0, "ul",{"data-slot":"pagination-content",className:_chunkGXUNRJ5Sjs.d.call(void 0, "flex flex-row items-center gap-1",e),...t})}function we({...e}){return _jsxruntime.jsx.call(void 0, "li",{"data-slot":"pagination-item",...e})}function _e({className:e,isActive:t,size:n="icon",...o}){return _jsxruntime.jsx.call(void 0, "a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:_chunkGXUNRJ5Sjs.d.call(void 0, _chunkWPOXLITYjs.p.call(void 0, {variant:t?"outline":"ghost",size:n}),e),...o})}function $n({className:e,...t}){return _jsxruntime.jsxs.call(void 0, _e,{"aria-label":"Go to previous page",size:"default",className:_chunkGXUNRJ5Sjs.d.call(void 0, "gap-1 px-2.5 sm:pl-2.5",e),...t,children:[_jsxruntime.jsx.call(void 0, _lucidereact.ChevronLeftIcon,{}),_jsxruntime.jsx.call(void 0, "span",{className:"hidden sm:block",children:"Previous"})]})}function Vn({className:e,...t}){return _jsxruntime.jsxs.call(void 0, _e,{"aria-label":"Go to next page",size:"default",className:_chunkGXUNRJ5Sjs.d.call(void 0, "gap-1 px-2.5 sm:pr-2.5",e),...t,children:[_jsxruntime.jsx.call(void 0, "span",{className:"hidden sm:block",children:"Next"}),_jsxruntime.jsx.call(void 0, _lucidereact.ChevronRightIcon,{})]})}function Ft({className:e,...t}){return _jsxruntime.jsxs.call(void 0, "span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:_chunkGXUNRJ5Sjs.d.call(void 0, "flex size-9 items-center justify-center",e),...t,children:[_jsxruntime.jsx.call(void 0, _lucidereact.MoreHorizontalIcon,{className:"size-4"}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"More pages"})]})}var Aa=e=>new Date(e*1e3).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),Ta=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase()}).format(e/100),La={draft:"Szkic",unpaid:"Nieop\u0142acona",paid:"Op\u0142acona",overdue:"Zaleg\u0142a",cancelled:"Anulowana",completed:"Zako\u0144czone",processing:"Przetwarzane",refunded:"Zwr\xF3cone"},Da={draft:"text-neutral-400",unpaid:"text-yellow-500",paid:"text-green-600",overdue:"text-red-500",cancelled:"text-neutral-400 line-through",completed:"text-green-600",processing:"text-blue-500",refunded:"text-purple-500"};function Ea({openOrderDetails:e,projectID:t,accessToken:n}){let[o,r]=_react3.useState.call(void 0, 0),a=20,{data:i,isFetching:d}=_chunkWPOXLITYjs.k.call(void 0, _chunkWPOXLITYjs.j.publicApi.getOrders,{projectId:t,accessToken:n,offset:o,limit:a}),c=_nullishCoalesce(_optionalChain([i, 'optionalAccess', _20 => _20.orders]), () => ([])),l=_nullishCoalesce(_optionalChain([i, 'optionalAccess', _21 => _21.totalCount]), () => (0)),m=Math.floor(o/a)+1,g=Math.ceil(l/a),k=u=>{r(u)};return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:"Historia zam\xF3wie\u0144"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"Twoje zam\xF3wienia"}),d?_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 flex w-full flex-col gap-3",children:[...Array(5)].map((u,y)=>_jsxruntime.jsxs.call(void 0, "div",{className:"rounded-xl bg-white p-4 shadow-sm dark:bg-neutral-800",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.u,{className:"h-4 w-24"}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.u,{className:"h-3 w-32"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2 text-right",children:[_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.u,{className:"ml-auto h-4 w-16"}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.u,{className:"ml-auto h-3 w-12"})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-3",children:_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.u,{className:"h-3 w-40"})})]},y))}):c.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 text-sm text-neutral-400",children:"Brak zam\xF3wie\u0144."}):_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 flex w-full flex-col gap-3",children:c.map(u=>_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>e(u.id),className:"block 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:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, "p",{className:"font-medium",children:["Zam\xF3wienie #",u.id]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:u.customerName||"Klient"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-semibold",children:Ta(u.totalAmount,u.currency)}),_jsxruntime.jsx.call(void 0, "p",{className:`text-xs font-medium ${_nullishCoalesce(Da[u.status], () => ("text-neutral-400"))}`,children:_nullishCoalesce(La[u.status], () => (u.status))})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 flex items-center justify-between text-xs text-neutral-500 dark:text-neutral-400",children:_jsxruntime.jsxs.call(void 0, "span",{children:["Data:"," ",u.createdAt?Aa(Number(u.createdAt.seconds)):"-"]})})]},u.id))}),g>1&&!d&&_jsxruntime.jsx.call(void 0, "div",{className:"mt-4 flex justify-center",children:_jsxruntime.jsx.call(void 0, Hn,{children:_jsxruntime.jsxs.call(void 0, Gn,{children:[m>1&&_jsxruntime.jsx.call(void 0, we,{children:_jsxruntime.jsx.call(void 0, $n,{onClick:()=>k(o-a)})}),m>2&&_jsxruntime.jsx.call(void 0, we,{children:_jsxruntime.jsx.call(void 0, _e,{onClick:()=>k(0),children:"1"})}),m>3&&_jsxruntime.jsx.call(void 0, we,{children:_jsxruntime.jsx.call(void 0, Ft,{})}),[m-1,m,m+1].filter(u=>u>0&&u<=g).map(u=>_jsxruntime.jsx.call(void 0, we,{children:_jsxruntime.jsx.call(void 0, _e,{onClick:()=>k((u-1)*a),isActive:m===u,children:u})},u)),m<g-2&&_jsxruntime.jsx.call(void 0, we,{children:_jsxruntime.jsx.call(void 0, Ft,{})}),m<g&&_jsxruntime.jsx.call(void 0, we,{children:_jsxruntime.jsx.call(void 0, _e,{onClick:()=>k((g-1)*a),children:g})}),m<g&&_jsxruntime.jsx.call(void 0, we,{children:_jsxruntime.jsx.call(void 0, Vn,{onClick:()=>k(o+a)})})]})})})]})]})}var Wn=Ea;var Zn=e=>new Date(e*1e3).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),Ma={active:"Aktywny",cancelled:"Anulowany",paused:"Wstrzymany"},Ua={active:"text-green-600",cancelled:"text-red-500",paused:"text-yellow-500"};function ja({projectID:e}){let[t,n]=_react3.useState.call(void 0, []),[o,r]=_react3.useState.call(void 0, !0);return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:"Plany"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500",children:"Twoje aktywne subskrypcje"}),o?_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 text-sm text-neutral-400",children:"\u0141adowanie..."}):t.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 text-sm text-neutral-400",children:"Brak aktywnych plan\xF3w."}):_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 flex flex-col gap-4",children:t.map(a=>_jsxruntime.jsxs.call(void 0, "div",{className:"rounded-xl bg-white p-5 shadow-sm dark:bg-neutral-800",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-semibold",children:a.tierName}),a.configName&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500",children:a.configName})]}),_jsxruntime.jsx.call(void 0, "span",{className:`text-sm font-medium ${_nullishCoalesce(Ua[a.status], () => ("text-neutral-500"))}`,children:_nullishCoalesce(Ma[a.status], () => (a.status))})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mt-3 grid grid-cols-2 gap-2 text-sm text-neutral-600 dark:text-neutral-400",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Dzie\u0144 rozliczenia:"})," ",a.billingDay]}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Data startu:"})," ",Zn(a.startDate)]}),a.endDate&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Data zako\u0144czenia:"})," ",Zn(a.endDate)]})]})]},a.id))})]})}var Jn=ja;function Fa(e,t,n,o){typeof window>"u"||(t&&_chunkSRQOFCMOjs.n.call(void 0, n,o),window.location.href=e)}function qa({projectID:e,host:t,loginURL:n,screen:o,params:r,setParams:a,setActiveScreen:i}){let{status:d,exchangeError:c}=_chunkQERYM7RCjs.j.call(void 0, "PanelReturns"),l=_chunkQERYM7RCjs.i.call(void 0, ),m=d==="anonymous"&&(c==null||_chunkQERYM7RCjs.g.call(void 0, c));_react3.useEffect.call(void 0, ()=>{m&&Fa(n,c!=null,e,t)},[m,n,c,e,t]);let[g,k]=_react3.useState.call(void 0, "orders"),[u,y]=_react3.useState.call(void 0, {items:[],note:""}),[C,s]=_react3.useState.call(void 0, );if(d==="anonymous"&&!m)return _jsxruntime.jsxs.call(void 0, "div",{role:"alert",className:"flex flex-col items-start gap-3",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",children:l(_chunkQERYM7RCjs.h.call(void 0, c))}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{type:"button",onClick:()=>window.location.reload(),children:l("errorRetry")})]});if(d!=="authenticated")return _jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.s,{});let P=R=>{k(R),a({state:"returns",orderId:void 0,returnId:void 0}),i("returns")};if(o==="return-details"&&r.returnId)return _jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.A,{returnId:r.returnId,onBack:()=>P("myReturns")});if(g==="myReturns")return _jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.z,{onBack:()=>P("orders"),onSelectReturn:R=>{a({state:"return-details",returnId:R,orderId:void 0}),i("return-details")}});if(g==="result"&&C!=null)return _jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.y,{returnId:C,onContinue:()=>P("orders"),onOpenMyReturns:()=>P("myReturns")});if(r.orderId){let R=r.orderId;return g==="confirmation"?_jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.x,{orderId:R,items:u.items,note:u.note,onBack:()=>k("orders"),onSubmitted:B=>{s(B),y({items:[],note:""}),k("result"),a({orderId:void 0})}}):_jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.w,{orderId:R,initialItems:u.items.length>0?u.items:void 0,initialNote:u.note,onBack:()=>{y({items:[],note:""}),a({orderId:void 0})},onContinue:B=>{y(B),k("confirmation")}})}return _jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.v,{showLogout:!1,onSelectOrder:R=>{y({items:[],note:""}),k("orders"),a({orderId:R})},onOpenMyReturns:()=>P("myReturns")})}function Ht({accessToken:e,appearance:t,texts:n,...o}){return _jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.k,{projectID:o.projectID,host:o.host,appearance:t,texts:n,panelAccessToken:e,children:_jsxruntime.jsx.call(void 0, qa,{...o})})}var Ha=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g,Ga=e=>[...e.matchAll(Ha)].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},Yn=e=>{let t=Ga(e);return _jsxruntime.jsx.call(void 0, "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)))}})};var _protobuf = require('@bufbuild/protobuf');var _hlsjs = require('hls.js'); var _hlsjs2 = _interopRequireDefault(_hlsjs);function Qn(){typeof navigator>"u"||typeof navigator.mediaSession>"u"||(navigator.mediaSession.playbackState="playing")}function Xn(){typeof navigator>"u"||typeof navigator.mediaSession>"u"||(navigator.mediaSession.playbackState="paused")}function er(e,t){typeof navigator>"u"||typeof navigator.mediaSession>"u"||e!=null&&isNaN(e)||t!=null&&isNaN(t)||navigator.mediaSession.setPositionState({playbackRate:1,duration:e,position:t})}function tr(e){typeof navigator>"u"||typeof navigator.mediaSession>"u"||(navigator.mediaSession.metadata=new MediaMetadata({title:e.title,artwork:e.artwork?[{type:"image/png",src:e.artwork}]:void 0}),navigator.mediaSession.setActionHandler("play",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("pause",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("stop",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("seekbackward",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("seekforward",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("seekto",t=>{e.action(t)}))}function nr(){navigator.mediaSession.metadata=null}var Ya=_react3.forwardRef.call(void 0, ({chapters:e,styles:t,updateCurrentTime:n,setCurrentTimeHandler:o,title:r,imageURL:a,uniqueProductID:i,onChapterChange:d},c)=>{let l;(W=>(W[W.Playing=0]="Playing",W[W.Paused=1]="Paused"))(l||={});let[m,g]=_react3.useState.call(void 0, 1);_react3.useEffect.call(void 0, ()=>{switch(m){case 0:Qn();break;case 1:Xn();break}},[m]),_react3.useImperativeHandle.call(void 0, c,()=>({selectChapter:f=>{Ke(f)}}));let[k,u]=_react3.useState.call(void 0, void 0),[y,C]=_react3.useState.call(void 0, void 0),s=_react3.useRef.call(void 0, null),P=_react3.useRef.call(void 0, void 0),R=_react3.useRef.call(void 0, void 0),B=_react3.useRef.call(void 0, null),H=_react3.useRef.call(void 0, null),[A,O]=_react3.useState.call(void 0, !0),[q,L]=_react3.useState.call(void 0, !1),[V,ye]=_react3.useState.call(void 0, !Qa());function U(f){f<10||localStorage.setItem(`__player__${i}_${_optionalChain([H, 'access', _22 => _22.current, 'optionalAccess', _23 => _23.id])}`,`${f}`)}function X(){let f=localStorage.getItem(`__player__${i}_${_optionalChain([H, 'access', _24 => _24.current, 'optionalAccess', _25 => _25.id])}`);if(f!=null)try{let j=parseInt(f);return isNaN(j)||j<0?void 0:j}catch (e5){return}}function he(){let f=localStorage.getItem(`__player__${i}_last_chapter`);if(f!=null)return f}function Ne(f){localStorage.setItem(`__player__${i}_last_chapter`,f)}function re(f){localStorage.removeItem(`__player__${i}_${f}`)}function b(){s.current!=null&&(s.current.onloadeddata=()=>{if(s.current!=null){if(s.current.readyState<2&&ye(!0),s.current.readyState>=2&&ye(!1),!q){let f=X();f!=null&&it(f),L(!0)}if(A){O(!1);try{Nt()}catch(f){console.log("play error",f)}}}},s.current.onplay=()=>{},s.current.onseeked=()=>{},s.current.onseeking=()=>{},s.current.onpause=()=>{},s.current.onended=()=>{ae()},tr({title:_nullishCoalesce(r, () => ("")),artwork:a,action:f=>{switch(f.action){case"play":Nt();break;case"pause":St();break;case"seekbackward":ot(-15);break;case"seekforward":ot(15);break;case"seekto":f.seekTime&&it(f.seekTime);break;case"stop":St();break;default:break}}}),Se())}function ae(){if(e==null||e.length==0)return;let f=e.findIndex(W=>W.id==_optionalChain([H, 'access', _26 => _26.current, 'optionalAccess', _27 => _27.id]));f==-1||(re(e[f].id),f+1>=e.length)||Ke(e[f+1])}function Se(){Ae(),R.current==null&&(R.current=setTimeout(()=>{Ae(),R.current=void 0,Se()},500))}function We(){R.current!=null&&clearTimeout(R.current)}function Ae(){s.current!=null&&(g(s.current.paused?1:0),C(s.current.duration),u(s.current.currentTime),U(s.current.currentTime),er(s.current.duration,s.current.currentTime),s.current.networkState===s.current.NETWORK_LOADING&&s.current.readyState<=s.current.HAVE_FUTURE_DATA?ye(!0):ye(!1),n&&n(s.current.currentTime))}function Nt(){_optionalChain([s, 'access', _28 => _28.current, 'optionalAccess', _29 => _29.play, 'call', _30 => _30(), 'access', _31 => _31.then, 'call', _32 => _32(), 'access', _33 => _33.catch, 'call', _34 => _34()]),Ae()}function St(){_optionalChain([s, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.pause, 'call', _37 => _37()]),Ae()}function Qr(){if(m===0){St();return}Nt()}function ot(f){if(s.current==null)return;let j=s.current.currentTime+f;if(j<0){s.current.currentTime=0;return}if(j>s.current.duration){s.current.currentTime=s.current.duration;return}s.current.currentTime+=f}function it(f){if(s.current!=null){if(u(f),f<0){s.current.currentTime=0;return}if(f>s.current.duration){s.current.currentTime=s.current.duration;return}s.current.currentTime=f}}function Xr(){s.current!=null&&(s.current.onplay=null,s.current.onseeked=null,s.current.onseeking=null,s.current.onpause=null,s.current.onended=null,s.current.src="",_optionalChain([P, 'access', _38 => _38.current, 'optionalAccess', _39 => _39.destroy, 'call', _40 => _40()]))}function cn(f){if(f.length==0)return;let j=he();if(j==null){Ke(f[0]);return}let W=f.find(Te=>Te.id==j);if(W==null){Ke(f[0]);return}Ke(W)}function Ke(f){L(!1),O(!0),H.current=f,ea(f.publicUrl),_optionalChain([d, 'optionalCall', _41 => _41(f)]),Ne(f.id)}function ea(f){s.current!=null&&(s.current.canPlayType("application/vnd.apple.mpegurl")?s.current.src=f:_hlsjs2.default.isSupported()&&(P.current==null&&(P.current=new _hlsjs2.default,_optionalChain([P, 'access', _42 => _42.current, 'optionalAccess', _43 => _43.attachMedia, 'call', _44 => _44(s.current)])),_optionalChain([P, 'access', _45 => _45.current, 'optionalAccess', _46 => _46.loadSource, 'call', _47 => _47(f)])))}_react3.useEffect.call(void 0, ()=>{s.current!=null&&(b(),cn(e))},[s.current]),_react3.useEffect.call(void 0, ()=>{cn(e)},[e]),_react3.useEffect.call(void 0, ()=>(_optionalChain([o, 'optionalCall', _48 => _48(it)]),()=>{u(void 0),_optionalChain([s, 'access', _49 => _49.current, 'optionalAccess', _50 => _50.pause, 'call', _51 => _51()]),Xr(),nr()}),[]);let ln=f=>{let j=Math.floor(f/3600),W=Math.floor(f/60)%60,Te=Math.floor(f%60),na=j>0?j<10?`0${j}:`:`${j}:`:"",ra=Te<10?`0${Te}`:`${Te}`;return isNaN(Te)||isNaN(W)||isNaN(j)?"":`${na}${W}:${ra}`},ta=f=>{let j=parseFloat(f.value)/parseFloat(f.max)*100;B.current.style.setProperty("--seek-before-width",j+"%");let W=y*j/100;it(W)};return _jsxruntime.jsxs.call(void 0, "div",{id:"audio-player-container",className:"flex flex-col",style:t,ref:B,children:[_jsxruntime.jsx.call(void 0, "video",{ref:s,className:"hidden",poster:a,title:r}),_jsxruntime.jsx.call(void 0, "input",{type:"range",min:"0",max:y!=null?Math.floor(y).toString():100,value:_nullishCoalesce(k, () => (0)),onChange:f=>ta(f.target),className:"w-full"}),_jsxruntime.jsxs.call(void 0, "section",{className:"flex w-full items-center justify-between text-sm font-medium",children:[_jsxruntime.jsx.call(void 0, "span",{id:"current-time",children:ln(k)}),_jsxruntime.jsx.call(void 0, "span",{id:"duration",children:ln(y)})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mt-6 flex items-center justify-center gap-x-12",children:[_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{variant:"outline",onClick:()=>ot(-10),"aria-label":"Rewind 10 Seconds",children:"-10"}),_jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{variant:"outline",onClick:Qr,"aria-label":"Play Or Pause",children:[m===1&&_jsxruntime.jsx.call(void 0, _lucidereact.Play,{className:"h-5 w-5"}),m===0&&_jsxruntime.jsx.call(void 0, _lucidereact.Pause,{className:"h-5 w-5"})]}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{variant:"outline",onClick:()=>ot(10),"aria-label":"Fast Forward 10 Seconds",children:"+10"})]}),V&&_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 flex w-full justify-center",children:_jsxruntime.jsx.call(void 0, Z,{})})]})});function Qa(){return navigator.userAgent.toLowerCase().indexOf("safari/")>-1}var ar=Ya;var Xa={pl:{returnsNavLabel:"Zwroty",openCourse:"Otw\xF3rz kurs"},en:{returnsNavLabel:"Returns",openCourse:"Open the course"}};function rt(e=_chunk7RXW6XFYjs.f.call(void 0, )){return _chunk7RXW6XFYjs.a.call(void 0, Xa,e)}function ir(){let[e,t]=ft.useState(13);return ft.useEffect(()=>{let n=setTimeout(()=>t(66),500);return()=>clearTimeout(n)},[]),_jsxruntime.jsx.call(void 0, "div",{className:"w-[60%] h-2 bg-gray-200 rounded-full overflow-hidden",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-full bg-blue-600 transition-all duration-300",style:{width:`${e}%`}})})}function fe(e,...t){console.warn(e,...t)}function Gt(e){console.error(e)}var no=({accessToken:e,product:t,styles:n,reveal:o,onOpenCourse:r})=>{let a=t.productType,i=_chunkGQJDFLSLjs.m.call(void 0, ),d=()=>i.track("panel_download",{},{product_id:t.productId.length<=64?t.productId:null}),c=_react3.useRef.call(void 0, null),[l]=_react.useAutoAnimate.call(void 0, ),[m,g]=_react3.useState.call(void 0, null),{mutateAsync:k,isPending:u}=_chunkWPOXLITYjs.l.call(void 0, _chunkWPOXLITYjs.j.publicApi.userPanelGetFileDetails),y=_react3.useRef.call(void 0, void 0),[C,s]=_react3.useState.call(void 0, null),[P,R]=_react3.useState.call(void 0, null),[B,H]=_react3.useState.call(void 0, !1),{mutateAsync:A,isPending:O}=_chunkWPOXLITYjs.l.call(void 0, _chunkWPOXLITYjs.j.publicApi.userPanelGetAudiobookDetails),{mutateAsync:q,isPending:L}=_chunkWPOXLITYjs.l.call(void 0, _chunkWPOXLITYjs.j.publicApi.userPanelGetAudiobookDetailsDownloadURLs),[V,ye]=_react3.useState.call(void 0, null),[U,X]=_react3.useState.call(void 0, null);async function he(){try{let b=await k({accessId:t.accessId,accessToken:e});if(b.result.case==="success"){g(b.result.value.files);return}else fe("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),fe("Kod b\u0142\u0119du: ",b.result.value)}catch(b){fe("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),Gt("B\u0142\u0105d podczas pobierania danych:"+b)}}async function Ne(){try{let b=await A({accessId:t.accessId,accessToken:e});if(b.result.case==="audiobook"){s(b.result.value);return}else fe("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),fe("Kod b\u0142\u0119du: ",b.result.value)}catch(b){fe("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),Gt("B\u0142\u0105d podczas pobierania danych:"+b)}}async function re(){try{let b=await q({accessId:t.accessId,accessToken:e,isBrowser:!0});if(b.result.case==="success"){R(b.result.value.audiobookDownloadDetails),H(b.result.value.isAvailableToDownloadInMobileApp===!0);return}else fe("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),fe("Kod b\u0142\u0119du: ",b.result.value)}catch(b){fe("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),Gt("B\u0142\u0105d podczas pobierania danych:"+b)}}return _react3.useEffect.call(void 0, ()=>{a===1&&(Ne().then().catch(),re().then().catch())},[]),_react3.useEffect.call(void 0, ()=>{if(C!=null&&P!=null){let b=C.chapters;if(!b)return;let ae=b.map(Se=>{let We=_optionalChain([P, 'optionalAccess', _52 => _52.find, 'call', _53 => _53(Ae=>Ae.chapterId===Se.id)]);if(We!=null)return{...Se,publicUrl:We.publicUrl,downloadableUrl:We.downloadableUrl,duration:We.duration}}).filter(Se=>Se!=null);ae!=null&&ae.length>0&&X(ae)}},[C,P]),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "div",{className:"mb-3 space-y-4 rounded bg-white p-4 dark:bg-black",children:_jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{onClick:()=>o(),variant:"ghost",className:"w-fit",children:[_jsxruntime.jsx.call(void 0, _lucidereact.ChevronLeft,{className:"h-6 w-6"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-inter text-sm font-medium",children:"Wr\xF3\u0107"})]})}),_jsxruntime.jsxs.call(void 0, "main",{className:"grid grid-cols-1 justify-center gap-6 sm:justify-start lg:grid-cols-2",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full max-w-xl flex-col gap-6",children:[a===2&&_jsxruntime.jsxs.call(void 0, "div",{ref:l,className:"flex flex-col space-y-4 rounded bg-white p-6 drop-shadow-xl dark:border dark:border-neutral-700 dark:bg-neutral-800 dark:drop-shadow-none",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between gap-x-4",children:[_jsxruntime.jsx.call(void 0, "h4",{className:"text-xl font-semibold",children:"Twoje pliki"}),(m==null||m.length==0)&&_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{onClick:he,"aria-label":"Download Product",className:"text-sm font-medium transition-opacity duration-300 ease-in-out hover:opacity-80 active:opacity-80",style:n,children:u?_jsxruntime.jsx.call(void 0, Z,{}):"Wy\u015Bwietl"})]}),u&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-2",children:[_jsxruntime.jsx.call(void 0, ir,{}),_jsxruntime.jsx.call(void 0, "p",{className:"font-bold transition hover:text-blue-600",children:"Trwa przygotowanie plik\xF3w..."})]}),m!=null&&m.length>0&&_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-start justify-start gap-2",children:m.map((b,ae)=>_jsxruntime.jsxs.call(void 0, "a",{target:"_blank",className:"flex w-fit items-center gap-2 rounded-md bg-neutral-800 px-3 py-2 text-neutral-200 dark:bg-neutral-200 dark:text-neutral-800",href:b,download:!0,onClick:d,children:[`Plik numer ${ae+1}`,_jsxruntime.jsx.call(void 0, _lucidereact.Download,{width:14,height:14})]},ae))})]}),a===4&&_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center justify-center rounded-xl bg-white p-6 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{onClick:()=>r(t.accessId),className:"text-sm font-medium transition-opacity duration-300 ease-in-out hover:opacity-80 active:opacity-80",style:n,children:rt().openCourse})}),a===1&&_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:_jsxruntime.jsxs.call(void 0, "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:[_jsxruntime.jsx.call(void 0, "h4",{className:"text-xl font-semibold",children:_nullishCoalesce(_optionalChain([V, 'optionalAccess', _54 => _54.name]), () => ("Odtwarzacz"))}),_optionalChain([V, 'optionalAccess', _55 => _55.description])&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",children:_optionalChain([V, 'optionalAccess', _56 => _56.description])}),_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:O?_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, Z,{}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xl font-semibold",children:"Trwa pobierania audiobooka..."})]}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:U!=null?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:_jsxruntime.jsx.call(void 0, ar,{ref:c,chapters:U,title:_nullishCoalesce(_nullishCoalesce(_optionalChain([C, 'optionalAccess', _57 => _57.name]), () => (t.productName)), () => (void 0)),imageURL:_nullishCoalesce(_nullishCoalesce(_optionalChain([C, 'optionalAccess', _58 => _58.coverImage]), () => (t.productImageUrl)), () => (void 0)),styles:n,setCurrentTimeHandler:b=>{y.current=b},uniqueProductID:t.productId,onChapterChange:b=>{ye(b)}})}):_jsxruntime.jsx.call(void 0, "p",{className:"mt-2",children:"Wybierz rozdzia\u0142, kt\xF3ry ci\u0119 interesuje."})})}),_jsxruntime.jsxs.call(void 0, "div",{className:"rounded-xl bg-neutral-100 p-3 dark:bg-neutral-800",children:[_jsxruntime.jsx.call(void 0, "p",{className:"mt-3 mb-3 text-xs",children:B?"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."}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-3",children:[_jsxruntime.jsx.call(void 0, "a",{href:"https://apps.apple.com/us/app/bitsnap/id6741902807",children:_jsxruntime.jsx.call(void 0, "img",{width:"100",src:"https://bitsnap.pl/appstore.svg",alt:"Pobierz aplikacje z AppStore"})}),_jsxruntime.jsx.call(void 0, "a",{href:"https://docs.bitsnap.pl/guides/audiobook",children:_jsxruntime.jsx.call(void 0, "img",{width:"100",src:"https://bitsnap.pl/playstore.svg",alt:"Pobierz aplikacj\u0119 z GooglePlay"})})]})]})]})}),_jsxruntime.jsx.call(void 0, "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&&_jsxruntime.jsx.call(void 0, "div",{className:"max-h-96 w-full overflow-y-auto",children:O?_jsxruntime.jsxs.call(void 0, "div",{className:"jusitfy-center flex flex-col items-center gap-2",children:[_jsxruntime.jsx.call(void 0, Z,{}),_jsxruntime.jsx.call(void 0, "p",{children:"\u0141adowanie rozdzia\u0142\xF3w..."})]}):_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "h2",{className:"mb-3 text-xl font-semibold",children:"Rozdzia\u0142y"}),U==null?_jsxruntime.jsx.call(void 0, "p",{children:"Brak rozdzia\u0142\xF3w do wy\u015Bwietlenia."}):_jsxruntime.jsx.call(void 0, "ul",{className:"flex w-full flex-col gap-2",children:U.map((b,ae)=>_jsxruntime.jsxs.call(void 0, "li",{className:"flex items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "button",{className:_chunkGXUNRJ5Sjs.d.call(void 0, "w-full rounded-lg p-2 text-left transition hover:bg-neutral-200 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-700",_optionalChain([V, 'optionalAccess', _59 => _59.id])==b.id?"bg-neutral-200 dark:bg-neutral-700":"bg-neutral-100 dark:bg-neutral-800 dark:text-neutral-300"),onClick:()=>{c.current.selectChapter(b)},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium",children:b.name}),b.duration&&_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs text-neutral-500",children:[Math.floor(b.duration/60),":",String(Math.floor(b.duration%60)).padStart(2,"0")]})]}),b.description&&_jsxruntime.jsx.call(void 0, "p",{className:"mt-3 text-xs",children:b.description})]}),C&&C.isDownloadable&&b.downloadableUrl&&_jsxruntime.jsx.call(void 0, "a",{href:b.downloadableUrl,onClick:d,children:_jsxruntime.jsx.call(void 0, _lucidereact.Download,{width:14,height:14})})]},ae))})]})})})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"w-full max-w-3xl space-y-6 rounded-xl bg-white p-6 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:[_jsxruntime.jsx.call(void 0, "h2",{className:"text-3xl font-semibold",children:t.productName}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-normal text-neutral-600 dark:text-neutral-300",children:t.productDescription}),_jsxruntime.jsx.call(void 0, "img",{src:t.productImageUrl,alt:"Product Photo",width:384,height:384,className:"max-h-sm max-w-sm",draggable:!1})]})]})]})},lr=no;var _connectquery = require('@connectrpc/connect-query');function ur(e,t){let n=_connectquery.useTransport.call(void 0, ),[o,r]=_react3.useState.call(void 0, {status:"loading"});return _react3.useEffect.call(void 0, ()=>{if(!e){r({status:"hidden"});return}let a=!1;return r({status:"loading"}),Promise.resolve().then(() => _interopRequireWildcard(require("./model-files-client-P4PORZJ6.js"))).then(({listModelFiles:i})=>i(n,e,t)).catch(()=>({status:"hidden"})).then(i=>{a||r(i)}),()=>{a=!0}},[n,e,t]),o}var po=_react3.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./PanelModelFiles-NYCOFPLY.js")))),fo=({accessToken:e,projectID:t,loginURL:n,styles:o,activeScreen:r,params:a,setParams:i,openCourse:d})=>{let{host:c}=_chunkSRQOFCMOjs.j.call(void 0, ),{data:l,isLoading:m,error:g,refetch:k}=_chunkWPOXLITYjs.k.call(void 0, _chunkWPOXLITYjs.j.publicApi.userPanelGetProducts,{accessToken:e}),u=ur(e,t),y=go({products:m?{status:"loading"}:g!=null?{status:"error"}:_optionalChain([l, 'optionalAccess', _60 => _60.result, 'access', _61 => _61.case])==="success"?{status:"ok",count:l.result.value.products.length}:_optionalChain([l, 'optionalAccess', _62 => _62.result, 'access', _63 => _63.case])==="failure"?{status:"failure",unauthorized:l.result.value===9}:{status:"error"},modelFiles:u});if(_react3.useEffect.call(void 0, ()=>{y.kind==="signed-out"&&(_chunkSRQOFCMOjs.n.call(void 0, t,c),window.location.href=n)},[y.kind,t,c,n]),y.kind==="loading"||y.kind==="signed-out")return _jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2 bg-white p-2 dark:bg-black",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-dark font-inter font-medium dark:text-white",children:_chunk7RXW6XFYjs.f.call(void 0, ).toLowerCase().startsWith("en")?"Loading...":"\u0141adowanie..."}),_jsxruntime.jsx.call(void 0, Z,{})]});let C=l&&l.result.case==="success"?l.result.value.products:[],s=u.status==="ready"?u.models:[],P=s.length>0?_jsxruntime.jsx.call(void 0, _react3.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, po,{accessToken:e,models:s,buttonStyle:o})}):null;return y.kind==="error"?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, ho,{onRetry:()=>void k()}),P]}):y.kind==="empty"?_jsxruntime.jsx.call(void 0, yo,{}):_jsxruntime.jsx.call(void 0, Po,{accessToken:e,products:C,styles:o,activeScreen:r,params:a,setParams:i,openCourse:d,filesSection:P})};function go({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 yo(){let e=_chunk7RXW6XFYjs.f.call(void 0, ).toLowerCase().startsWith("en");return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-1","data-testid":"panel-empty",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:e?"Hi \u{1F44B}":"Hej \u{1F44B}"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500",children:e?"You have no products in this shop yet. Your purchases will show up here.":"Nie masz jeszcze produkt\xF3w w tym sklepie. Twoje zakupy pojawi\u0105 si\u0119 tutaj."})]})}function ho({onRetry:e}){let t=_chunk7RXW6XFYjs.f.call(void 0, ).toLowerCase().startsWith("en");return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-3",role:"alert","data-testid":"panel-error",children:[_jsxruntime.jsx.call(void 0, "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."}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{type:"button",onClick:e,className:"text-sm",children:t?"Try again":"Spr\xF3buj ponownie"})]})}var mr=fo,Po=({accessToken:e,products:t,styles:n,filesSection:o,activeScreen:r,params:a,setParams:i,openCourse:d})=>{let[c,l]=_react3.useState.call(void 0, a.product?_protobuf.fromJsonString.call(void 0, _chunkWPOXLITYjs.e,a.product):void 0),m=u=>{u==null?(l(void 0),i({product:void 0,state:"products"})):i({product:_protobuf.toJsonString.call(void 0, _chunkWPOXLITYjs.e,u),state:"products"})};function g(u){switch(u){case 1:return"Audio";case 2:return"Plik";case 3:return"Bilet";case 4:return"Kurs";default:return}}function k(u){if(u.productType===4){d(u.accessId);return}l(u),m(u)}return r==="products"&&c!=null?_jsxruntime.jsx.call(void 0, lr,{accessToken:e,product:c,styles:n,reveal:m,onOpenCourse:d}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:"Hej \u{1F44B}"}),t.length>0&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500",children:"Poni\u017Cej znajdziesz swoje produkty"}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 flex flex-wrap items-center justify-center gap-9 sm:justify-start",children:_optionalChain([t, 'optionalAccess', _64 => _64.map, 'call', _65 => _65((u,y)=>_jsxruntime.jsxs.call(void 0, "section",{onClick:()=>k(u),className:"w-full max-w-xs cursor-pointer rounded drop-shadow-xl dark:border dark:border-slate-600 dark:drop-shadow-none",children:[_jsxruntime.jsxs.call(void 0, "section",{className:"flex flex-col items-center space-y-2 rounded bg-slate-100 p-4 dark:bg-neutral-900",children:[u.productType&&_jsxruntime.jsx.call(void 0, "div",{className:"w-fit self-end rounded bg-red-900 px-4 py-1",children:_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-medium text-white dark:text-slate-100",children:g(u.productType)})}),_jsxruntime.jsx.call(void 0, "div",{className:"jusitfy-center flex max-h-40 items-center",children:_jsxruntime.jsx.call(void 0, "img",{src:u.productImageUrl,alt:`Product ${y} Photo`,draggable:!1,className:"aspect-auto max-h-40"})})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-4 rounded bg-white p-4 dark:bg-black",children:[_jsxruntime.jsx.call(void 0, "h2",{className:"text-xl font-semibold",children:u.productName}),_jsxruntime.jsx.call(void 0, "p",{title:u.productDescription,className:"line-clamp-3 text-sm font-normal text-neutral-600 dark:text-neutral-300",children:Yn(u.productDescription)}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{onClick:C=>{C.stopPropagation(),k(u)},className:"w-full text-sm font-medium transition-opacity duration-300 ease-in-out hover:opacity-80 active:opacity-80",style:n,children:"Zobacz"})]})]},y))])}),o]})};function xo({activeScreen:e,setActiveScreen:t,setParams:n,styles:o,theme:r,logout:a}){return _jsxruntime.jsxs.call(void 0, "header",{className:"md:border-r-neutral-150 md:bg-beige-50 fixed right-0 bottom-0 left-0 z-10 flex h-12 w-full items-center bg-neutral-800 md:static md:z-0 md:min-h-screen md:w-auto md:border-r dark:md:border-r-neutral-900",children:[_jsxruntime.jsx.call(void 0, ko,{activeScreen:e,setActiveScreen:t,setParams:n}),_jsxruntime.jsx.call(void 0, Co,{activeScreen:e,setActiveScreen:t,setParams:n,theme:r,logout:a})]})}var yr=xo;function ko({activeScreen:e,setActiveScreen:t,setParams:n}){let{returnsNavLabel:o}=rt();return _jsxruntime.jsxs.call(void 0, "nav",{className:"flex w-full items-center justify-evenly gap-4 md:hidden",children:[_jsxruntime.jsx.call(void 0, yt,{panelScreen:"products",label:"Produkty",imageURL:"/icons/bitsnap-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:n}),_jsxruntime.jsx.call(void 0, yt,{panelScreen:"orders",label:"Faktury",imageURL:"/icons/category-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:n}),_jsxruntime.jsx.call(void 0, yt,{panelScreen:"returns",label:o,icon:_jsxruntime.jsx.call(void 0, _lucidereact.Undo2,{className:"h-5 w-5 text-white","aria-hidden":!0}),activeScreen:e,setActiveScreen:t,setParams:n}),_jsxruntime.jsx.call(void 0, yt,{panelScreen:"profile",label:"Profil",imageURL:"/icons/profile-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:n})]})}function yt({panelScreen:e,label:t,imageURL:n,icon:o,activeScreen:r,setActiveScreen:a,setParams:i}){return _jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{onClick:()=>{a(e),i({product:void 0,state:e})},"aria-label":t,variant:null,className:_chunkGXUNRJ5Sjs.d.call(void 0, "flex flex-col gap-0",r===e?"opacity-100":"opacity-50"),children:[_nullishCoalesce(o, () => (_jsxruntime.jsx.call(void 0, "img",{src:n,alt:t,className:"scale-75"}))),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-normal text-white",children:t})]})}function ht({panelScreen:e,label:t,imageURL:n,darkImageURL:o,icon:r,activeScreen:a,setActiveScreen:i,setParams:d,isExpanded:c}){return _jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{onClick:()=>{i(e),d({product:void 0,state:e})},variant:a===e?"secondary":"ghost",className:"justify-start",children:[r!=null?_jsxruntime.jsx.call(void 0, "span",{className:_chunkGXUNRJ5Sjs.d.call(void 0, "inline-flex h-5 w-5 items-center justify-center",c?"mr-4":"mr-2"),children:r}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "img",{src:n,alt:t,className:_chunkGXUNRJ5Sjs.d.call(void 0, "aspect-auto h-5 w-5 dark:hidden",c?"mr-4":"mr-2")}),_jsxruntime.jsx.call(void 0, "img",{src:o,alt:t,className:_chunkGXUNRJ5Sjs.d.call(void 0, "hidden aspect-auto h-5 w-5 dark:inline",c?"mr-4":"mr-2")})]}),c&&_jsxruntime.jsx.call(void 0, "span",{className:"md:text-medium hidden md:inline",children:t})]})}function Co({activeScreen:e,setActiveScreen:t,setParams:n,theme:o,logout:r}){let[a]=_react.useAutoAnimate.call(void 0, ),[i,d]=_react3.useState.call(void 0, !0),{returnsNavLabel:c}=rt();return _jsxruntime.jsxs.call(void 0, "div",{ref:a,className:_chunkGXUNRJ5Sjs.d.call(void 0, "hidden px-4 pt-4 pb-12 md:flex md:h-full md:flex-col dark:bg-neutral-900",i?"md:w-52":"md:w-16"),children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-between",children:_jsxruntime.jsx.call(void 0, No,{theme:o,isExpanded:i})}),_jsxruntime.jsx.call(void 0, fr,{className:"my-6"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-1 flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, ht,{panelScreen:"products",label:"Produkty",imageURL:"/icons/bitsnap-dark-24x24.svg",darkImageURL:"/icons/bitsnap-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:n,isExpanded:i}),_jsxruntime.jsx.call(void 0, ht,{panelScreen:"orders",label:"Zam\xF3wienia",imageURL:"/icons/category-dark-24x24.svg",darkImageURL:"/icons/category-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:n,isExpanded:i}),_jsxruntime.jsx.call(void 0, ht,{panelScreen:"returns",label:c,icon:_jsxruntime.jsx.call(void 0, _lucidereact.Undo2,{className:"h-5 w-5","aria-hidden":!0}),activeScreen:e,setActiveScreen:t,setParams:n,isExpanded:i}),_jsxruntime.jsx.call(void 0, ht,{panelScreen:"profile",label:"Profil",imageURL:"/icons/profile-dark-24x24.svg",darkImageURL:"/icons/profile-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:n,isExpanded:i})]}),_jsxruntime.jsx.call(void 0, fr,{className:"mb-6"}),_jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{onClick:r,children:[_jsxruntime.jsx.call(void 0, _lucidereact.LogOut,{className:"mr-2",width:16,height:16}),i&&_jsxruntime.jsx.call(void 0, "p",{className:"md:text-medium hidden md:inline md:text-center",children:"Wyloguj si\u0119"})]})]})}function fr({className:e}){return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkGXUNRJ5Sjs.d.call(void 0, "relative h-px w-full bg-neutral-300",e),children:[_jsxruntime.jsx.call(void 0, "div",{className:"absolute -top-px left-0 h-1 w-1 rounded-full bg-neutral-500"}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute -top-px right-0 h-1 w-1 rounded-full bg-neutral-500"})]})}function No({theme:e,isExpanded:t}){return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[e==null&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xl tracking-wider md:inline dark:text-neutral-200",children:"bitsnap."}),(_optionalChain([e, 'optionalAccess', _66 => _66.logoDarkURL])||_optionalChain([e, 'optionalAccess', _67 => _67.logoURL]))&&_jsxruntime.jsx.call(void 0, "img",{src:_nullishCoalesce(e.logoDarkURL, () => (e.logoURL)),alt:"Company Logo",className:"hidden h-6 w-6 dark:inline",draggable:!1}),_optionalChain([e, 'optionalAccess', _68 => _68.logoURL])&&_jsxruntime.jsx.call(void 0, "img",{src:e.logoURL,alt:"Company Logo",className:"h-6 w-6 dark:hidden",draggable:!1})]})}function Io({email:e,logout:t}){return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:"Profil"}),_jsxruntime.jsxs.call(void 0, "div",{className:"mt-6 flex-1 md:flex-none",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm text-neutral-500",children:"Email"}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-2 text-base",children:e||"Brak danych"})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex w-full flex-col items-center space-y-2",children:_jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{onClick:t,className:"max-w-64 md:hidden",children:[_jsxruntime.jsx.call(void 0, _lucidereact.LogOut,{className:"mr-2",width:16,height:16}),_jsxruntime.jsx.call(void 0, "p",{className:"text-medium inline text-center",children:"Wyloguj si\u0119"})]})})]})}var Pr=Io;var Lo=_react3.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./course.js"))).then(e=>({default:e.PanelCourse})));function Vt(e){return _jsxruntime.jsx.call(void 0, _react3.Suspense,{fallback:_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-2 p-2",role:"status",children:_jsxruntime.jsx.call(void 0, Z,{})}),children:_jsxruntime.jsx.call(void 0, Lo,{...e})})}function Mo({status:e}){let t={created:{color:"bg-neutral-100 text-neutral-700",icon:null},paid:{color:"bg-green-100 text-green-700",icon:_lucidereact.CheckCircle2},completed:{color:"bg-blue-100 text-blue-700",icon:_lucidereact.CheckCircle2},canceled:{color:"bg-red-100 text-red-700",icon:_lucidereact.AlertCircle},sent:{color:"bg-purple-100 text-purple-700",icon:_lucidereact.Truck},processing:{color:"bg-yellow-100 text-yellow-700",icon:_lucidereact.Loader2}},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 _jsxruntime.jsxs.call(void 0, "span",{className:`inline-flex items-center gap-1 rounded-full px-3 py-1 text-sm font-medium ${n.color}`,children:[o&&_jsxruntime.jsx.call(void 0, o,{className:"h-4 w-4"}),r[e]||e]})}function Uo({orderID:e,email:t}){let[n,o]=_react3.useState.call(void 0, ""),r=_chunkWPOXLITYjs.l.call(void 0, _chunkWPOXLITYjs.j.publicApi.addPublicOrderComment);return _jsxruntime.jsxs.call(void 0, "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:[_jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.a,{htmlFor:"comment",children:"Dodaj komentarz"}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.v,{id:"comment",value:n,onChange:i=>o(i.target.value),placeholder:"Wpisz komentarz...",rows:3,disabled:r.isPending}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{type:"submit",disabled:!n.trim()||r.isPending,children:r.isPending?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _lucidereact.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Wysy\u0142anie..."]}):"Dodaj komentarz"})]})}function wr(e){return e?new Date(Number(e.seconds)*1e3).toLocaleDateString("pl-PL",{year:"numeric",month:"long",day:"numeric"}):"N/A"}function xr(e,t){return new Intl.NumberFormat("pl-PL",{style:"currency",currency:t.toUpperCase()}).format(e/100)}function jo({orderID:e,initialEmail:t,onBack:n,accessToken:o,analytics:r}){let{theme:a,projectID:i}=_chunkSRQOFCMOjs.j.call(void 0, ),d=_chunkGQJDFLSLjs.n.call(void 0, i,r,"order"),[c,l]=_react3.useState.call(void 0, t||""),[m,g]=_react3.useState.call(void 0, !1),{data:k,isLoading:u,error:y,refetch:C}=_chunkWPOXLITYjs.k.call(void 0, _chunkWPOXLITYjs.j.publicApi.getPublicOrderDetails,{projectId:_nullishCoalesce(i, () => ("")),orderId:e,email:c||void 0,accessToken:o},{enabled:!!e}),s=_optionalChain([k, 'optionalAccess', _69 => _69.result, 'access', _70 => _70.case])==="order"?k.result.value:null,P=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _71 => _71.isVerified]), () => (!1)),R=s!=null;_react3.useEffect.call(void 0, ()=>{R&&d.track("panel_order_viewed",{},{order_ref:null})},[d,R]);let B=()=>{C(),g(!1)},H={"--button-background-color":_nullishCoalesce(_optionalChain([a, 'optionalAccess', _72 => _72.colors, 'optionalAccess', _73 => _73.brand]), () => ("#000000")),"--button-background-color-dark":_nullishCoalesce(_optionalChain([a, 'optionalAccess', _74 => _74.colors, 'optionalAccess', _75 => _75.brandDark]), () => ("#ffffff")),"--button-text-color":_nullishCoalesce(_optionalChain([a, 'optionalAccess', _76 => _76.colors, 'optionalAccess', _77 => _77.brandDark]), () => ("#000000")),"--button-text-color-dark":_nullishCoalesce(_optionalChain([a, 'optionalAccess', _78 => _78.colors, 'optionalAccess', _79 => _79.brand]), () => ("#000000"))};return u?_jsxruntime.jsx.call(void 0, "div",{className:"flex min-h-screen items-center justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:"text-center",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Loader2,{className:"mx-auto h-8 w-8 animate-spin text-neutral-400"}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-2 text-neutral-600 dark:text-neutral-400",children:"\u0141adowanie zam\xF3wienia..."})]})}):y||!s?_jsxruntime.jsx.call(void 0, "div",{className:"flex min-h-screen items-center justify-center",children:_jsxruntime.jsx.call(void 0, me,{className:"w-full max-w-md",children:_jsxruntime.jsx.call(void 0, pe,{className:"pt-6",children:_jsxruntime.jsxs.call(void 0, "div",{className:"text-center",children:[_jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle,{className:"mx-auto h-12 w-12 text-red-500"}),_jsxruntime.jsx.call(void 0, "h2",{className:"mt-4 text-xl font-semibold",children:"Zam\xF3wienie nie znalezione"}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-2 text-neutral-600 dark:text-neutral-400",children:"Nie znaleziono zam\xF3wienia o podanym numerze."})]})})})}):_jsxruntime.jsx.call(void 0, "div",{className:"w-full bg-white py-8 dark:bg-black",style:H,children:_jsxruntime.jsxs.call(void 0, "div",{className:"w-full px-4",children:[n&&_jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{onClick:n,variant:"ghost",className:"mb-4 w-fit",children:[_jsxruntime.jsx.call(void 0, _lucidereact.ChevronLeft,{className:"h-4 w-4"}),"Wr\xF3\u0107 do historii zam\xF3wie\u0144"]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-6 flex items-center gap-4",children:[_optionalChain([a, 'optionalAccess', _80 => _80.logoURL])&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "img",{src:a.logoURL,alt:"Project logo",className:`h-12 w-auto ${a.logoDarkURL?"dark:hidden":""}`}),a.logoDarkURL&&_jsxruntime.jsx.call(void 0, "img",{src:a.logoDarkURL,alt:"Project logo",className:"hidden h-12 w-auto dark:block"})]}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "h1",{className:"text-3xl font-bold",children:"Zam\xF3wienie"}),_jsxruntime.jsxs.call(void 0, "p",{className:"text-neutral-600 dark:text-neutral-400",children:["Numer zam\xF3wienia: #",s.orderId]})]})]}),_jsxruntime.jsxs.call(void 0, me,{className:"mb-6",children:[_jsxruntime.jsx.call(void 0, be,{children:_jsxruntime.jsxs.call(void 0, ve,{className:"flex items-center",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Package,{className:"mr-2 h-5 w-5"}),"Status zam\xF3wienia"]})}),_jsxruntime.jsxs.call(void 0, pe,{className:"space-y-6",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, Mo,{status:s.status}),s.processingStatus&&_jsxruntime.jsxs.call(void 0, "span",{className:"text-sm text-neutral-600",children:["\xB7 ",s.processingStatus]})]}),_jsxruntime.jsxs.call(void 0, "p",{className:"mt-2 text-sm text-neutral-600",children:["Zam\xF3wienie z\u0142o\u017Cone ",wr(s.createdAt)]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"border-t pt-4",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"mb-3 font-semibold",children:"Dane klienta"}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Imi\u0119 i nazwisko:"})," ",_jsxruntime.jsx.call(void 0, "span",{className:P?"":"text-neutral-500",children:s.customerName})]}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Email:"})," ",_jsxruntime.jsx.call(void 0, "span",{className:P?"":"text-neutral-500",children:s.customerEmail})]}),s.customerPhone&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Telefon:"})," ",_jsxruntime.jsx.call(void 0, "span",{className:P?"":"text-neutral-500",children:s.customerPhone})]})]})]}),!P&&_jsxruntime.jsx.call(void 0, "div",{className:"border-t pt-4",children:_jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{onClick:()=>g(!0),variant:"outline",className:"w-full",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Lock,{className:"mr-2 h-4 w-4"}),"Zweryfikuj sw\xF3j email"]})})]})]}),_jsxruntime.jsxs.call(void 0, me,{className:"mb-6",children:[_jsxruntime.jsx.call(void 0, be,{children:_jsxruntime.jsx.call(void 0, ve,{children:"Produkty"})}),_jsxruntime.jsxs.call(void 0, pe,{className:"space-y-6",children:[_jsxruntime.jsx.call(void 0, "div",{className:"space-y-4",children:s.items.map((A,O)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-4",children:[A.imageUrl&&_jsxruntime.jsx.call(void 0, "img",{src:A.imageUrl,alt:A.name,className:"h-16 w-16 rounded object-cover"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-medium",children:A.name}),_jsxruntime.jsxs.call(void 0, "p",{className:"text-sm text-neutral-600",children:["Ilo\u015B\u0107: ",A.quantity]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"text-right",children:_jsxruntime.jsx.call(void 0, "p",{className:"font-medium",children:xr(Number(A.price),A.currency)})})]},O))}),(s.deliveryAddress||s.deliveryMethod)&&_jsxruntime.jsxs.call(void 0, "div",{className:"border-t pt-4",children:[_jsxruntime.jsxs.call(void 0, "h3",{className:"mb-3 flex items-center font-semibold",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Truck,{className:"mr-2 h-5 w-5"}),"Informacje o dostawie"]}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[s.deliveryAddress&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Adres:"})," ",_jsxruntime.jsx.call(void 0, "span",{className:P?"":"text-neutral-500",children:s.deliveryAddress})]}),s.deliveryMethod&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Metoda:"})," ",s.deliveryMethod]}),s.trackingNumber&&P&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Tracking:"})," ",s.trackingNumber]})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"border-t pt-4",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-lg font-bold",children:[_jsxruntime.jsx.call(void 0, "span",{children:"Suma:"}),_jsxruntime.jsx.call(void 0, "span",{children:xr(Number(s.totalAmount),s.currency)})]})})]})]}),_jsxruntime.jsxs.call(void 0, me,{children:[_jsxruntime.jsx.call(void 0, be,{children:_jsxruntime.jsxs.call(void 0, ve,{children:["Komentarze ",s.commentCount>0&&`(${s.commentCount})`]})}),_jsxruntime.jsxs.call(void 0, pe,{children:[s.comments.length>0?_jsxruntime.jsx.call(void 0, "div",{className:"space-y-4",children:s.comments.map(A=>_jsxruntime.jsxs.call(void 0, "div",{className:"border-b pb-4 last:border-b-0",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"mb-1 flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:A.authorName||"System"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs text-neutral-500",children:wr(A.createdAt)}),A.authorType==="admin"&&_jsxruntime.jsx.call(void 0, "span",{className:"rounded bg-blue-100 px-2 py-0.5 text-xs text-blue-700",children:"Admin"})]}),_jsxruntime.jsx.call(void 0, "p",{className:P?"":"text-neutral-500",children:A.message})]},A.id))}):_jsxruntime.jsx.call(void 0, "p",{className:"text-neutral-600",children:"Brak komentarzy."}),P?_jsxruntime.jsx.call(void 0, Uo,{orderID:s.orderId,email:c}):_jsxruntime.jsx.call(void 0, "div",{className:"mt-4",children:_jsxruntime.jsxs.call(void 0, _chunkWPOXLITYjs.q,{onClick:()=>g(!0),variant:"outline",className:"w-full",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Lock,{className:"mr-2 h-4 w-4"}),"Zweryfikuj sw\xF3j email"]})})]})]}),m&&_jsxruntime.jsx.call(void 0, "div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:_jsxruntime.jsxs.call(void 0, me,{className:"w-full max-w-md",children:[_jsxruntime.jsx.call(void 0, be,{children:_jsxruntime.jsx.call(void 0, ve,{children:"Zweryfikuj sw\xF3j email"})}),_jsxruntime.jsxs.call(void 0, pe,{className:"space-y-4",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-700",children:"Podaj adres email u\u017Cyty przy sk\u0142adaniu zam\xF3wienia."}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[_jsxruntime.jsx.call(void 0, _chunkQERYM7RCjs.a,{htmlFor:"verify-email",children:"Adres email"}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.r,{id:"verify-email",type:"email",placeholder:"twoj@email.com",value:c,onChange:A=>l(A.target.value)})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{variant:"outline",onClick:()=>g(!1),className:"flex-1",children:"Anuluj"}),_jsxruntime.jsx.call(void 0, _chunkWPOXLITYjs.q,{onClick:B,className:"flex-1",children:"Zweryfikuj"})]})]})]})})]})})}function _o(e){return _jsxruntime.jsx.call(void 0, jo,{...e})}var Zt=_o;var qo=({returnsAppearance:e,returnsTexts:t,analytics:n}={})=>{let{projectID:o,theme:r,loginURL:a,host:i}=_chunkSRQOFCMOjs.j.call(void 0, ),d=_chunkGQJDFLSLjs.n.call(void 0, o,n,"panel"),c=_chunkSRQOFCMOjs.k.call(void 0, o,i),l=_chunkSRQOFCMOjs.m.call(void 0, o,i),{mutateAsync:m}=_chunkWPOXLITYjs.l.call(void 0, _chunkWPOXLITYjs.j.publicApi.userPanelLogout);async function g(){c&&await m({accessToken:c}),typeof window<"u"&&(_chunkSRQOFCMOjs.n.call(void 0, o,i),window.location.reload())}let[k]=_react.useAutoAnimate.call(void 0, ),u=L=>["products","notifications","profile","plans","orders","order-details","returns","return-details","course"].includes(L),[y,C]=_n({product:void 0,state:"products",orderId:void 0,returnId:void 0,course:void 0,item:void 0}),[s,P]=_react3.useState.call(void 0, u(y.state)?y.state:"products"),R=L=>{C({state:"order-details",orderId:L}),P("order-details")},B=()=>{C({state:"orders",orderId:void 0}),P("orders")},H=L=>C({orderId:void 0,returnId:void 0,course:void 0,item:void 0,...L}),A=L=>{C({state:"course",course:L,item:void 0,product:void 0}),P("course")},O=()=>{C({state:"products",course:void 0,item:void 0,product:void 0}),P("products")};_react3.useEffect.call(void 0, ()=>{u(y.state)&&(y.state==="course"||s==="course")&&P(y.state)},[y.state]);let q={"--button-background-color":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _81 => _81.colors, 'optionalAccess', _82 => _82.brand]), () => ("#000000")),"--button-background-color-dark":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _83 => _83.colors, 'optionalAccess', _84 => _84.brandDark]), () => ("#ffffff")),"--button-text-color":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _85 => _85.colors, 'optionalAccess', _86 => _86.brandDark]), () => ("#000000")),"--button-text-color-dark":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _87 => _87.colors, 'optionalAccess', _88 => _88.brand]), () => ("#000000"))};return _react3.useEffect.call(void 0, ()=>{if(c==null||c.length===0){window.location.href=_nullishCoalesce(a, () => ("/panel/login"));return}},[]),_react3.useEffect.call(void 0, ()=>{if(c==null||c.length===0){window.location.href=_nullishCoalesce(a, () => ("/panel/login"));return}},[s]),_react3.useEffect.call(void 0, ()=>{if(typeof window>"u"||window.parent!==window||!c)return;let L=Xe(window.location.search);L&&et(L);let V=_nullishCoalesce(L, () => (Ue()));V&&(window.location.href=je(V,c))},[c]),_jsxruntime.jsx.call(void 0, _chunkGQJDFLSLjs.l,{value:d,children:_jsxruntime.jsxs.call(void 0, "div",{ref:k,className:"font-inter relative min-h-screen w-screen bg-beige-100 text-black dark:bg-black dark:text-white md:flex",children:[_jsxruntime.jsx.call(void 0, yr,{activeScreen:s,setActiveScreen:P,setParams:H,styles:q,theme:r,logout:g}),_jsxruntime.jsxs.call(void 0, "main",{className:"flex h-[calc(100vh-80px)] flex-col overflow-y-auto w-full p-5 md:h-screen",children:[s==="products"&&_jsxruntime.jsx.call(void 0, mr,{projectID:_nullishCoalesce(o, () => ("")),accessToken:c,loginURL:_nullishCoalesce(a, () => ("/panel/login")),styles:q,activeScreen:s,params:y,setParams:C,openCourse:A}),s==="course"&&y.course&&c&&_jsxruntime.jsx.call(void 0, Vt,{accessId:y.course,accessToken:c,theme:r,itemId:y.item,onItemChange:L=>C({item:L}),onBack:O}),s==="notifications"&&_jsxruntime.jsx.call(void 0, Bn,{}),s==="plans"&&_jsxruntime.jsx.call(void 0, Jn,{projectID:_nullishCoalesce(o, () => (""))}),s==="orders"&&_jsxruntime.jsx.call(void 0, Wn,{projectID:_nullishCoalesce(o, () => ("")),accessToken:_nullishCoalesce(c, () => ("")),openOrderDetails:R}),s==="order-details"&&y.orderId&&_jsxruntime.jsx.call(void 0, Zt,{orderID:y.orderId,onBack:B}),(s==="returns"||s==="return-details")&&c&&_jsxruntime.jsx.call(void 0, Ht,{projectID:_nullishCoalesce(o, () => ("")),host:i,accessToken:c,loginURL:_nullishCoalesce(a, () => ("/panel/login")),appearance:zn(e,_optionalChain([r, 'optionalAccess', _89 => _89.colors, 'optionalAccess', _90 => _90.brand])),texts:t,screen:s,params:y,setParams:C,setActiveScreen:P}),s==="profile"&&_jsxruntime.jsx.call(void 0, Pr,{email:l,logout:g})]})]})})},Bo= exports.q =qo;var _reactquery = require('@tanstack/react-query');var _connect = require('@connectrpc/connect');var _connectweb = require('@connectrpc/connect-web');var ue;(o=>{function e(r){return _connect.createClient.call(void 0, _chunkWPOXLITYjs.f,n(r))}o.get=e;let t=new Map;function n(r){let a=t.get(r);return a==null&&(a=_connectweb.createConnectTransport.call(void 0, {useBinaryFormat:!0,baseUrl:r+"/api/rpc",interceptors:[_chunkGXUNRJ5Sjs.b]}),t.set(r,a)),a}})(ue = exports.a||={});var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);function z(e,t=2){return+(Math.round(+(e+"e+"+t))+"e-"+t)}function Ir(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 ll=_zod2.default.object({event:_zod2.default.enum(["purchase","addToCart","customizeProduct","viewCart","removeFromCart","initiateCheckout","lead"]),step:_zod2.default.string().optional(),value:_zod2.default.number().optional(),currency:_zod2.default.string().optional(),content_name:_zod2.default.string().optional(),items:_zod2.default.array(_zod2.default.object({id:_zod2.default.string(),name:_zod2.default.string(),price:_zod2.default.number().default(0),currency:_zod2.default.string().default("PLN"),quantity:_zod2.default.number().default(1)})).optional()});function Jt(e){typeof window>"u"||($o(e),Wo(e),Ko(e))}function $o(e){try{typeof window.dataLayer>"u"&&(window.dataLayer=[]);let t=Vo(e);window.dataLayer.push(t)}catch(t){console.warn("cannot send google analytics event",t)}}function Vo(e){let t=_nullishCoalesce(_nullishCoalesce(e.value, () => (_optionalChain([e, 'access', _91 => _91.items, 'optionalAccess', _92 => _92.reduce, 'call', _93 => _93((a,i)=>a+(i.price||0)*(i.quantity||1),0)]))), () => (0)),n=_optionalChain([e, 'access', _94 => _94.items, 'optionalAccess', _95 => _95.map, 'call', _96 => _96(a=>({item_id:a.id,item_name:a.name||a.id,price:z((a.price||0)/100,2),quantity:a.quantity||1}))]),o={currency:e.currency||"PLN",value:z(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 Wo(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 Ko(e){try{if(typeof window.ttq>"u")return;let t=Zo(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 Zo(e){let t=_nullishCoalesce(_nullishCoalesce(e.value, () => (_optionalChain([e, 'access', _97 => _97.items, 'optionalAccess', _98 => _98.reduce, 'call', _99 => _99((a,i)=>a+(i.price||0)*(i.quantity||1),0)]))), () => (0)),n=_optionalChain([e, 'access', _100 => _100.items, 'optionalAccess', _101 => _101.map, 'call', _102 => _102(a=>({content_id:a.id,content_type:"product",content_name:a.name||a.id,quantity:a.quantity||1,price:z((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:z(t/100,2)});let o={currency:e.currency||"PLN",value:z(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 Rr(e){let{items:t,googlePayConfig:n,checkout:o,result:r,cartRequiresShipping:a}=e,i=_nullishCoalesce(e.locale, () => (_chunk7RXW6XFYjs.f.call(void 0, )));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+` - ${Ir(l.amount,r.currency)}`,description:_nullishCoalesce(l.description, () => (""))})),defaultSelectedOptionId:r.selectedDeliveryMethod}:void 0,merchantInfo:{merchantId:n.merchantId+"",merchantName:n.merchantName},transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:_chunk7RXW6XFYjs.c.call(void 0, "paymentForCart",i,e.texts),totalPrice:`${z(r.totalAmount/100,2)}`,currencyCode:r.currency,countryCode:r.country,checkoutOption:"COMPLETE_IMMEDIATE_PURCHASE",displayItems:Jo(t,r.methods,_nullishCoalesce(r.selectedDeliveryMethod, () => ((r.methods.length>0?r.methods[0].id:void 0))),o.couponCode,r.couponValue,_chunk7RXW6XFYjs.c.call(void 0, "coupon",i,e.texts))}}}function Jo(e,t,n,o,r,a="Coupon"){let i=[],d=0;for(let l of e){if(l.details==null)continue;let m=_nullishCoalesce(_optionalChain([l, 'access', _103 => _103.details, 'access', _104 => _104.pricing, 'optionalAccess', _105 => _105.effectivePrice]), () => (l.details.price));d+=m*l.quantity,i.push({label:l.details.name+" x "+l.quantity,price:`${z(m/100,2)}`,type:"LINE_ITEM",status:"FINAL"})}let c=t.find(l=>l.id===n);return c!=null&&i.push({label:c.name,price:`${z(c.amount/100,2)}`,type:"SHIPPING_OPTION",status:"FINAL"}),o!=null&&r!=null&&i.push({label:`${a} ${o}`,price:`${z(r/100,2)}`,type:"DISCOUNT",status:"FINAL"}),d>0&&i.push({label:"Subtotal",price:`${z(d/100,2)}`,type:"SUBTOTAL",status:"FINAL"}),i}function Be(e,t){return`${_chunkGXUNRJ5Sjs.f}/api/integrations/${e}/public-commerce${t}`}function Ce(e){return typeof e=="object"&&e!=null&&"ERR"in e}function $(e,t,n){return{ERR:!0,error:e,type:t,data:n}}function Ar(e,t){return _optionalChain([t, 'optionalAccess', _106 => _106.find, 'call', _107 => _107(n=>n.id===e||(_nullishCoalesce(_optionalChain([n, 'access', _108 => _108.variants, 'optionalAccess', _109 => _109.some, 'call', _110 => _110(o=>o.id===e)]), () => (!1))))])}function Tr(e,t){let n=new Set(t.map(o=>o.productID));return Array.from(new Set(e.filter(o=>!n.has(o))))}function Lr(e,t){let n=_optionalChain([e, 'optionalAccess', _111 => _111.trim, 'call', _112 => _112()]);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 (e6){return}}var _zustand = require('zustand');var He=_zustand.create.call(void 0, 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}))}));var vt=_react3.createContext.call(void 0, {});function Nl({texts:e,locale:t,children:n}){let o=_react3.useMemo.call(void 0, ()=>({texts:e,locale:t}),[e,t]);return _jsxruntime.jsx.call(void 0, vt.Provider,{value:o,children:n})}function Er(){return _react3.useContext.call(void 0, vt)}function Sl(e){let{texts:t,locale:n}=_react3.useContext.call(void 0, vt);return _chunk7RXW6XFYjs.c.call(void 0, e,_nullishCoalesce(n, () => (_chunk7RXW6XFYjs.f.call(void 0, ))),t)}function Il(){let{texts:e,locale:t}=_react3.useContext.call(void 0, vt),n=_nullishCoalesce(t, () => (_chunk7RXW6XFYjs.f.call(void 0, )));return _react3.useMemo.call(void 0, ()=>o=>_chunk7RXW6XFYjs.c.call(void 0, o,n,e),[n,e])}var Xt="bitsnap-pending-order";function Ur(e,t){let n=new Map;for(let r of t)n.set(r.id,(_nullishCoalesce(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 ei=60*1e3;function jr(e,t=Date.now,n=ei){let o;return r=>{let a=`${r.orderId}:${r.ts}`,i=t();return _optionalChain([o, 'optionalAccess', _113 => _113.key])===a&&i-o.at<n?Promise.reject(new Error("pending order was asked about recently")):(o={key:a,at:i},e(r))}}function ti(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 (e7){return}}function ni(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 (e8){return!1}}function ri(e,t=Date.now(),n={}){if(ni(e.url))return;let o=ti(e.url),r=_nullishCoalesce(Or(e.orderId), () => (_optionalChain([o, 'optionalAccess', _114 => _114.orderId]))),a=_nullishCoalesce(Or(e.projectId), () => (_optionalChain([o, 'optionalAccess', _115 => _115.projectId])));if(!(r==null||a==null))return{orderId:r,projectId:a,...n.cartProjectId!=null?{cartProjectId:n.cartProjectId}:{},lines:_nullishCoalesce(n.lines, () => ([])),ts:t}}function Tl(e,t={}){let n=ri(e,t.now,t);return n!=null&&ai(n,t.storage)}function Or(e){return e!=null&&e.length>0?e:void 0}function wt(){try{return typeof localStorage>"u"?void 0:localStorage}catch (e9){return}}function ai(e,t=wt()){try{return _optionalChain([t, 'optionalAccess', _116 => _116.setItem, 'call', _117 => _117(Xt,JSON.stringify(e))]),t!=null}catch (e10){return!1}}function Mr(e=wt()){try{let t=_optionalChain([e, 'optionalAccess', _118 => _118.getItem, 'call', _119 => _119(Xt)]);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(c=>typeof _optionalChain([c, 'optionalAccess', _120 => _120.id])=="string"&&typeof c.quantity=="number"):[],ts:i}}}catch (e11){}Qt(e)}function Qt(e=wt()){try{_optionalChain([e, 'optionalAccess', _121 => _121.removeItem, 'call', _122 => _122(Xt)])}catch (e12){}}function _r(e){let t=_nullishCoalesce(_optionalChain([e, 'access', _123 => _123.details, 'optionalAccess', _124 => _124.status]), () => (oi(_optionalChain([e, 'access', _125 => _125.details, 'optionalAccess', _126 => _126.$unknown]))));return t==="created"||t==="placed"||t==="paid"||t==="canceled"?t:"unknown"}function oi(e){if(Array.isArray(e)){for(let t of e)if(_optionalChain([t, 'optionalAccess', _127 => _127.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 (e13){return}}}}async function zr(e){let t=_nullishCoalesce(e.storage, () => (wt())),n=Mr(t);if(n==null)return"none";if((_nullishCoalesce(e.now, () => (Date.now)))()-n.ts>864e5)return Qt(t),"expired";if(e.projectId!=null&&n.cartProjectId!=null&&n.cartProjectId!==e.projectId)return"pending";let r;try{r=await e.fetchStatus(n)}catch (e14){return"pending"}let a=Mr(t);if(_optionalChain([a, 'optionalAccess', _128 => _128.orderId])!==n.orderId||a.ts!==n.ts)return"pending";if(r==="paid"||r==="placed"){try{await e.removeLines(n.lines)}catch (e15){return"pending"}return Qt(t),"paid"}return"pending"}var ui="__m_a",$r=_react3.createContext.call(void 0, void 0),rn= exports.M =void 0;function ru(e){_chunkSRQOFCMOjs.a.call(void 0, {projectID:e}),rn= exports.M =e,typeof window<"u"&&_chunkSRQOFCMOjs.g.call(void 0, [window.location.origin])}function Ve(){return _nullishCoalesce(_nullishCoalesce(rn, () => (_optionalChain([document, 'access', _129 => _129.querySelector, 'call', _130 => _130('script[data-id][data-name="internal-cart"]'), 'optionalAccess', _131 => _131.getAttribute, 'call', _132 => _132("data-id")]))), () => (void 0))}function mi(){return _nullishCoalesce(_optionalChain([document, 'access', _133 => _133.querySelector, 'call', _134 => _134('script[data-id][data-name="internal-cart"]'), 'optionalAccess', _135 => _135.getAttribute, 'call', _136 => _136("data-custom-host")]), () => (void 0))}var pi=({children:e,locale:t})=>{let[n]=_react3.useState.call(void 0, ()=>new _reactquery.QueryClient),o=Er();_react3.useEffect.call(void 0, ()=>{$e()},[]);let r=Ve();if(_react3.useEffect.call(void 0, ()=>{if(r==null)return;let i=()=>{yi(r).then(c=>{c==="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 _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{});let a=on(r,_nullishCoalesce(t, () => (o.locale)),o.texts);return _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider,{client:n,children:_jsxruntime.jsx.call(void 0, $r.Provider,{value:a,children:e})})},en,fi=jr(async e=>_r(await ue.get(_chunkGXUNRJ5Sjs.f).getOrder({id:e.orderId,projectId:e.projectId})));function au(){let{country:e,couponCode:t,selectedDeliveryMethod:n,postalCode:o}=_nullishCoalesce(D(), () => (kt));return{country:e,couponCode:t,selectedDeliveryMethod:n,postalCode:o}}function ou(){return(_nullishCoalesce(_optionalChain([D, 'call', _137 => _137(), 'optionalAccess', _138 => _138.products]), () => ([]))).map(e=>({id:e.id,quantity:e.quantity}))}function gi(e){let t=D();Q({...t,products:Ur(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _139 => _139.products]), () => ([])),e)}),$e()}function yi(e){return en??=zr({projectId:e,fetchStatus:fi,removeLines:gi}).catch(t=>{console.warn("cannot check the pending order",t)}).finally(()=>{en=void 0}),en}var Ge=async(e,t)=>{let n=[];_optionalChain([t, 'optionalAccess', _140 => _140.items])!=null&&t.items.length>0?n=t.items:n=_nullishCoalesce(_optionalChain([D, 'call', _141 => _141(), 'optionalAccess', _142 => _142.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",_nullishCoalesce(_optionalChain([t, 'optionalAccess', _143 => _143.locale]), () => (_chunk7RXW6XFYjs.f.call(void 0, ))));let a;try{let i=await fetch(_chunkGXUNRJ5Sjs.c.call(void 0, Be(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=Ar(i.productID,a.result);return d==null?[]:[{...i,details:xi(i.productID,d),catalogProductID:d.id}]})},iu= exports.S =()=>{let e=_react3.useContext.call(void 0, $r);if(e===void 0)throw new Error("useCartProvider must be used within a CartProvider");return e},su= exports.T =pi,hi=_zod2.default.object({isAvailable:_zod2.default.boolean(),merchantId:_zod2.default.string(),merchantName:_zod2.default.string(),gateway:_zod2.default.string(),gatewayId:_zod2.default.string()}),Pi=_zod2.default.object({id:_zod2.default.string(),productID:_zod2.default.string(),quantity:_zod2.default.number(),priceVersion:_zod2.default.string().optional(),metadata:_zod2.default.record(_zod2.default.string(),_zod2.default.string().optional()).optional(),url:_zod2.default.string().optional()}),bi=_zod2.default.object({country:_zod2.default.string().optional(),couponCode:_zod2.default.string().optional(),selectedDeliveryMethod:_zod2.default.string().optional(),postalCode:_zod2.default.string().optional(),email:_zod2.default.string().optional(),products:_zod2.default.array(Pi).optional(),googlePayConfig:hi.optional()}),kt={country:void 0,couponCode:void 0,email:void 0,selectedDeliveryMethod:void 0,postalCode:void 0,products:[],googlePayConfig:void 0},Vr="checkout";function D(){try{let e=localStorage.getItem(Vr);return e==null?kt:bi.parse(JSON.parse(e))}catch (e16){return kt}}async function qr(e,t){let n=await Ge(e,{items:t.map((a,i)=>({...a,id:`price-check-${i}`}))});if(Ce(n))return n;let o=Tr(t.map(a=>a.productID),n);if(o.length>0)return $("item-ids-not-found","notFound",o);let r=D();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:_optionalChain([n, 'access', _144 => _144.find, 'call', _145 => _145(i=>i.productID===a.productID), 'optionalAccess', _146 => _146.details, 'optionalAccess', _147 => _147.pricing, 'optionalAccess', _148 => _148.priceVersion]),metadata:a.metadata,url:Lr(a.url,typeof window<"u"?window.location.href:void 0)}))),vi(t,n),Jt({event:"addToCart",currency:"PLN",items:t.map(a=>({id:a.productID,name:_nullishCoalesce(a.name, () => ("")),price:_nullishCoalesce(a.price, () => (0)),quantity:a.quantity,currency:_nullishCoalesce(a.currency, () => ("PLN"))}))}),Q(r),$e()}function vi(e,t){for(let n of e)try{let o=t.find(d=>d.productID===n.productID),r=_nullishCoalesce(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _149 => _149.details, 'optionalAccess', _150 => _150.pricing, 'optionalAccess', _151 => _151.effectivePrice]), () => (_optionalChain([o, 'optionalAccess', _152 => _152.details, 'optionalAccess', _153 => _153.price]))), () => (n.price)),a=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _154 => _154.details, 'optionalAccess', _155 => _155.currency]), () => (n.currency));if(r==null||a==null)continue;let i=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _156 => _156.catalogProductID]), () => (n.productID));(_nullishCoalesce(n.analytics, () => (_chunkGQJDFLSLjs.o.call(void 0, )))).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 (e17){}}function Br(e){let t=D(),n={...t,products:_optionalChain([t, 'optionalAccess', _157 => _157.products, 'optionalAccess', _158 => _158.filter, 'call', _159 => _159(o=>!e.includes(o.productID)&&!e.includes(o.id))])};Jt({event:"removeFromCart",items:e.map(o=>({id:o,name:"",price:0,quantity:1,currency:"PLN"}))}),Q(n),$e()}function Q(e){localStorage.setItem(Vr,JSON.stringify(e))}function Hr(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=_optionalChain([r, 'access', _160 => _160.metadata, 'optionalAccess', _161 => _161[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 on=(e,t=_chunk7RXW6XFYjs.f.call(void 0, ),n)=>{let o=mi();return o!=null&&_chunkGXUNRJ5Sjs.g.call(void 0, o),{async checkIfApplePayIsAvailable(){if(typeof window>"u"||typeof document>"u"||!("ApplePaySession"in window))return!1;try{return(await ue.get(_chunkGXUNRJ5Sjs.f).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 wi(e);if(_optionalChain([a, 'optionalAccess', _162 => _162.isAvailable])!=!0)return{isAvailable:!1};let i=D();if(i==null)return console.log("checkout is null"),{isAvailable:!1};let d=await Ge(e,{locale:t,items:r.items.map(g=>({id:Math.random().toString(36).substring(7),quantity:g.quantity,metadata:g.metadata,productID:g.productID}))});if(Ce(d))return{isAvailable:!1};let c=await ue.get(_chunkGXUNRJ5Sjs.f).getPreOrderDetails({items:d.map(g=>_protobuf.create.call(void 0, _chunkWPOXLITYjs.c,{id:g.productID,quantity:g.quantity})),projectId:e,postCode:i.postalCode,couponCode:i.couponCode,countryCode:i.country,selectedDeliveryMethod:i.selectedDeliveryMethod});if(c.totalAmount==null)return{isAvailable:!1};let l=d.find(g=>_optionalChain([g, 'access', _163 => _163.details, 'optionalAccess', _164 => _164.isDeliverable])==!0)!=null,m=await Rr({items:d,googlePayConfig:a,checkout:i,cartRequiresShipping:l,result:c,locale:t,texts:n});return m==null?{isAvailable:!1}:{isAvailable:!0,config:m}}catch(a){return console.error("Error resolving Google Pay configuration",a),{isAvailable:!1}}},async clearCart(){let r=structuredClone(kt);r.country=_optionalChain([D, 'call', _165 => _165(), 'optionalAccess', _166 => _166.country]),Q(r),$e()},async getAvailableCountries(){let r=await fetch(_chunkGXUNRJ5Sjs.c.call(void 0, Be(e,"/countries")),{method:"GET"});if(r.status!=200)return[];try{return _zod2.default.array(_zod2.default.object({name:_zod2.default.string(),code:_zod2.default.string()})).parse(await r.json())}catch(a){return $(a.toString(),"internal")}},async getCountry(){let r=_optionalChain([D, 'call', _167 => _167(), 'optionalAccess', _168 => _168.country]);if(r==null){r="PL";let a=D();a.country=r,Q(a)}return r},async getNumberOfElementsInCart(){return _nullishCoalesce(_optionalChain([D, 'call', _169 => _169(), 'optionalAccess', _170 => _170.products, 'optionalAccess', _171 => _171.reduce, 'call', _172 => _172((r,a)=>r+a.quantity,0)]), () => (0))},async getProducts(){return await Ge(e,{locale:t})},async removeProductFromCart(r){return Br([r.id])},async setCountry(r){let a=D();a.country=r,Q(a)},async setCouponCodeIfPossible(r){let a=D();a.couponCode=r,Q(a)},async setPostalCode(r){let a=D();a.postalCode=r,Q(a)},async setDeliveryMethod(r){let a=D();a.selectedDeliveryMethod=r,Q(a)},async setEmail(r){let a=D();a.email=r,Q(a)},async addProduct(r){return await qr(e,[r])},async updateQuantity(r){let a=D();a.products=_optionalChain([a, 'access', _173 => _173.products, 'optionalAccess', _174 => _174.map, 'call', _175 => _175(i=>(i.id===r.id&&(i.quantity=r.quantity),i))]),Q(a),$e()},async getPaymentMethodChoice(){let r=Hr(D(),t);return r==null?null:Gr(r)},async redirectToNextStep(r){let a=Hr(D(),t);if(a==null)return $("cart-is-empty","badInput");_optionalChain([r, 'optionalAccess', _176 => _176.paymentMethod])!=null&&(a.paymentMethod=r.paymentMethod);let i=await nn(a);return Ce(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:_nullishCoalesce(r.locale, () => (t))};a=an(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:ui,name:"",required:!0,answer:!0}]);let i=await nn(a);return Ce(i)?i:{url:i.url}},async getApplePayPreview(r){let a=D();try{let i=await ue.get(_chunkGXUNRJ5Sjs.f).getPreOrderDetails({items:r.items.map(d=>_protobuf.create.call(void 0, _chunkWPOXLITYjs.c,{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:`${z(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=D();if(a==null)return $("Checkout not found");let i=await Ge(e,{locale:t});if(Ce(i))return i;try{let d=_optionalChain([r, 'access', _177 => _177.shippingContact, 'optionalAccess', _178 => _178.givenName]);_optionalChain([r, 'access', _179 => _179.shippingContact, 'optionalAccess', _180 => _180.familyName])!=null?d+=" "+_optionalChain([r, 'access', _181 => _181.shippingContact, 'optionalAccess', _182 => _182.familyName]):_optionalChain([r, 'access', _183 => _183.billingContact, 'optionalAccess', _184 => _184.familyName])!=null&&(d+=" "+_optionalChain([r, 'access', _185 => _185.billingContact, 'optionalAccess', _186 => _186.familyName]));let c={},l=xt();l!=null&&(c.ref=l);let m=await ue.get(_chunkGXUNRJ5Sjs.f).authorizeOneClickPayment({gateway:0,paymentData:JSON.stringify(r.token.paymentData),paymentMethod:JSON.stringify(r.token.paymentMethod),transactionIdentifier:r.token.transactionIdentifier,order:_protobuf.create.call(void 0, _chunkWPOXLITYjs.d,{items:i.map(g=>({id:g.productID,quantity:g.quantity})),couponCode:a.couponCode,email:_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([r, 'access', _187 => _187.shippingContact, 'optionalAccess', _188 => _188.emailAddress]), () => (_optionalChain([r, 'access', _189 => _189.billingContact, 'optionalAccess', _190 => _190.emailAddress]))), () => (a.email)), () => (void 0)),phone:_nullishCoalesce(_nullishCoalesce(_optionalChain([r, 'access', _191 => _191.shippingContact, 'optionalAccess', _192 => _192.phoneNumber]), () => (_optionalChain([r, 'access', _193 => _193.billingContact, 'optionalAccess', _194 => _194.phoneNumber]))), () => (void 0)),selectedDeliveryMethod:a.selectedDeliveryMethod,postCode:a.postalCode,projectId:e}),shippingAddress:_protobuf.create.call(void 0, _chunkWPOXLITYjs.a,{line1:_nullishCoalesce(_optionalChain([r, 'access', _195 => _195.shippingContact, 'optionalAccess', _196 => _196.addressLines, 'optionalAccess', _197 => _197[0]]), () => ("")),city:_nullishCoalesce(_optionalChain([r, 'access', _198 => _198.shippingContact, 'optionalAccess', _199 => _199.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([r, 'access', _200 => _200.shippingContact, 'optionalAccess', _201 => _201.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([r, 'access', _202 => _202.shippingContact, 'optionalAccess', _203 => _203.postalCode]), () => ("")),name:d}),billingAddress:_protobuf.create.call(void 0, _chunkWPOXLITYjs.b,{name:_nullishCoalesce(_optionalChain([r, 'access', _204 => _204.billingContact, 'optionalAccess', _205 => _205.givenName]), () => (" "+(_nullishCoalesce(_optionalChain([r, 'access', _206 => _206.billingContact, 'optionalAccess', _207 => _207.familyName]), () => (""))))),line1:_nullishCoalesce(_optionalChain([r, 'access', _208 => _208.billingContact, 'optionalAccess', _209 => _209.addressLines, 'optionalAccess', _210 => _210[0]]), () => ("")),city:_nullishCoalesce(_optionalChain([r, 'access', _211 => _211.billingContact, 'optionalAccess', _212 => _212.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([r, 'access', _213 => _213.billingContact, 'optionalAccess', _214 => _214.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([r, 'access', _215 => _215.billingContact, 'optionalAccess', _216 => _216.postalCode]), () => (""))}),metadata:Object.keys(c).length>0?JSON.stringify(c):void 0});return{isSuccess:m.isSuccess,redirectURL:m.redirectUrl}}catch(d){return console.error(d),$("Failed to authorize payment")}},async completeGooglePayPayment(r){let a=D();if(a==null)return $("Checkout not found");let i=await Ge(e,{locale:t});if(Ce(i))return i;try{let d=_optionalChain([r, 'access', _217 => _217.paymentData, 'access', _218 => _218.shippingAddress, 'optionalAccess', _219 => _219.name]),c={},l=xt();l!=null&&(c.ref=l);let m=await ue.get(_chunkGXUNRJ5Sjs.f).authorizeOneClickPayment({gateway:1,paymentData:r.paymentData.paymentMethodData.tokenizationData.token,paymentMethod:r.paymentData.paymentMethodData.type,transactionIdentifier:"",order:_protobuf.create.call(void 0, _chunkWPOXLITYjs.d,{items:i.map(g=>({id:g.productID,quantity:g.quantity})),couponCode:a.couponCode,email:_nullishCoalesce(r.paymentData.email, () => (void 0)),phone:_nullishCoalesce(_optionalChain([r, 'access', _220 => _220.paymentData, 'access', _221 => _221.shippingAddress, 'optionalAccess', _222 => _222.phoneNumber]), () => (void 0)),selectedDeliveryMethod:_nullishCoalesce(_optionalChain([r, 'access', _223 => _223.paymentData, 'access', _224 => _224.shippingOptionData, 'optionalAccess', _225 => _225.id]), () => (a.selectedDeliveryMethod)),postCode:_optionalChain([r, 'access', _226 => _226.paymentData, 'access', _227 => _227.shippingAddress, 'optionalAccess', _228 => _228.postalCode]),projectId:e}),shippingAddress:_protobuf.create.call(void 0, _chunkWPOXLITYjs.a,{line1:_nullishCoalesce(_optionalChain([r, 'access', _229 => _229.paymentData, 'access', _230 => _230.shippingAddress, 'optionalAccess', _231 => _231.address1]), () => ("")),city:_nullishCoalesce(_optionalChain([r, 'access', _232 => _232.paymentData, 'access', _233 => _233.shippingAddress, 'optionalAccess', _234 => _234.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([r, 'access', _235 => _235.paymentData, 'access', _236 => _236.shippingAddress, 'optionalAccess', _237 => _237.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([r, 'access', _238 => _238.paymentData, 'access', _239 => _239.shippingAddress, 'optionalAccess', _240 => _240.postalCode]), () => ("")),name:d}),billingAddress:_protobuf.create.call(void 0, _chunkWPOXLITYjs.b,{name:_optionalChain([r, 'access', _241 => _241.paymentData, 'access', _242 => _242.paymentMethodData, 'access', _243 => _243.info, 'optionalAccess', _244 => _244.billingAddress, 'optionalAccess', _245 => _245.name]),line1:_nullishCoalesce(_optionalChain([r, 'access', _246 => _246.paymentData, 'access', _247 => _247.paymentMethodData, 'access', _248 => _248.info, 'optionalAccess', _249 => _249.billingAddress, 'optionalAccess', _250 => _250.address1]), () => ("")),city:_nullishCoalesce(_optionalChain([r, 'access', _251 => _251.paymentData, 'access', _252 => _252.paymentMethodData, 'access', _253 => _253.info, 'optionalAccess', _254 => _254.billingAddress, 'optionalAccess', _255 => _255.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([r, 'access', _256 => _256.paymentData, 'access', _257 => _257.paymentMethodData, 'access', _258 => _258.info, 'optionalAccess', _259 => _259.billingAddress, 'optionalAccess', _260 => _260.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([r, 'access', _261 => _261.paymentData, 'access', _262 => _262.paymentMethodData, 'access', _263 => _263.info, 'optionalAccess', _264 => _264.billingAddress, 'optionalAccess', _265 => _265.postalCode]), () => (""))}),metadata:Object.keys(c).length>0?JSON.stringify(c):void 0});return{isSuccess:m.isSuccess,redirectURL:m.redirectUrl}}catch(d){return console.error(d),$("Failed to authorize payment")}return{isSuccess:!0}},async getApplePayPaymentRequest(r){let a=D();if(a==null)return $("Checkout not found");r&&r.expectedItems!=null&&r.expectedItems.length>0&&(a.products&&Br(a.products.map(l=>l.productID)),await qr(e,r.expectedItems));let i=await Ge(e,{locale:t});if(Ce(i))return i;let d=await ue.get(_chunkGXUNRJ5Sjs.f).getPreOrderDetails({items:i.map(l=>_protobuf.create.call(void 0, _chunkWPOXLITYjs.c,{id:l.productID,quantity:l.quantity})),projectId:e,postCode:a.postalCode,couponCode:a.couponCode,countryCode:a.country,selectedDeliveryMethod:a.selectedDeliveryMethod}),c=i.map(l=>({amount:`${z(l.quantity*(_nullishCoalesce(_nullishCoalesce(_optionalChain([l, 'access', _266 => _266.details, 'optionalAccess', _267 => _267.pricing, 'optionalAccess', _268 => _268.effectivePrice]), () => (_optionalChain([l, 'access', _269 => _269.details, 'optionalAccess', _270 => _270.price]))), () => (0)))/100,2)}`,label:_optionalChain([l, 'access', _271 => _271.details, 'optionalAccess', _272 => _272.name])+" - "+l.quantity,type:"final"}));if(d.selectedDeliveryMethod!=null){let l=d.methods.find(m=>m.id==d.selectedDeliveryMethod);l!=null&&c.push({amount:`${z(l.amount/100,2)}`,label:l.name,type:"final"})}return d.couponCode!=null&&d.couponValue!=null&&c.push({amount:`-${z(d.couponValue/100,2)}`,label:d.couponCode,type:"final"}),{countryCode:d.country||a.country||"PL",merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard"],total:{amount:`${z((_nullishCoalesce(d.totalAmount, () => (0)))/100,2)}`,label:_chunk7RXW6XFYjs.c.call(void 0, "paymentForCart",t,n),type:"final"},shippingMethods:d.methods.map(l=>({amount:`${z(l.amount/100,2)}`,detail:_nullishCoalesce(l.description, () => ("")),identifier:l.id,label:l.name,dateComponentsRange:{startDateComponents:{days:_nullishCoalesce(l.minDays, () => (1)),hours:0,months:0,years:0},endDateComponents:{days:_nullishCoalesce(l.maxDays, () => (14)),hours:0,months:0,years:0}}})),lineItems:c,currencyCode:d.currency||_optionalChain([i, 'access', _273 => _273[0], 'optionalAccess', _274 => _274.details, 'optionalAccess', _275 => _275.currency])||"PLN"}}}};async function wi(e){let t=D();if(_optionalChain([t, 'access', _276 => _276.googlePayConfig, 'optionalAccess', _277 => _277.isAvailable])!=!0){let n=await ue.get(_chunkGXUNRJ5Sjs.f).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 Q(t),t.googlePayConfig}function xi(e,t){if(e==t.id){let o=_optionalChain([t, 'access', _278 => _278.variants, 'optionalAccess', _279 => _279.findIndex, 'call', _280 => _280(r=>r.id===e)]);if(o!=null&&o!=-1){let r=t.variants[o];return{...t,availableQuantity:r.availableQuantity,isDeliverable:r.isDeliverable,images:_nullishCoalesce(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=_optionalChain([t, 'access', _281 => _281.variants, 'optionalAccess', _282 => _282.find, 'call', _283 => _283(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:_nullishCoalesce(n.images, () => (t.images))}}function $e(){let e=D(),t=0;if(e==null){He.setState(n=>({...n,numberOfProductsInCart:t}));return}t=_nullishCoalesce(_optionalChain([e, 'access', _284 => _284.products, 'optionalAccess', _285 => _285.reduce, 'call', _286 => _286((n,o)=>n+o.quantity,0)]), () => (0)),He.setState(n=>({...n,numberOfProductsInCart:t}))}var Ci=200,Ni= exports.v ="item-ids-not-found",at="internal-error",Wr={"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"},Si=new Set(["internal","invalid-request"]),Ii=new Set(["product-not-available","product-not-found"]);function Ri(e){return typeof e=="string"&&Object.hasOwn(Wr,e)?Wr[e]:void 0}function Ai(e){return/<\/?[a-z!?][^>]*>/i.test(e)}function Ti(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 Li(e){return/Error:/.test(e)||/\n\s+at /.test(e)}function sn(e){let t=e.trim();if(!(t.length===0||t.length>Ci||/[\r\n]/.test(t)||Ai(t)||Ti(t)||Li(t)))return t}var Di=3;function Ct(e,t=0){if(typeof e=="object"&&e!=null){if(Array.isArray(e)||t>=Di)return{};let n=e,o=Ct(n.error,t+1);if(o.message==null&&n.message!=null){let r=Ct(n.message,t+1);o={...r,code:_nullishCoalesce(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?Ct(n,t+1):{}}catch (e18){}return{message:sn(e)}}function Ei(e){let t;try{t=JSON.parse(e)}catch (e19){return{code:at,message:sn(e)}}if(typeof t=="string")return{code:at,message:sn(t)};if(typeof t!="object"||t==null)return{code:at};let n=t,{message:o,code:r}=Ct(n.error),a={code:typeof n.code=="string"&&n.code.length>0?n.code:_nullishCoalesce(r, () => (at)),message:o};return Array.isArray(n.itemIds)&&(a.itemIds=n.itemIds.filter(i=>typeof i=="string")),a}function dn(e,t){let{code:n,message:o,itemIds:r}=Ei(t),a=r!=null&&r.length>0;if(a&&(n===at||Ii.has(n)))return $(Ni,"badInput",r);let i={message:o};return a&&(i.itemIds=r),$(n,e>=500?"internal":"badInput",i)}function mu(e,t){let n=Ri(e.error);if(n!=null)return t(n);if(e.type==="internal"||typeof e.error=="string"&&Si.has(e.error))return t("checkoutFailed");let o=_optionalChain([e, 'access', _287 => _287.data, 'optionalAccess', _288 => _288.message]);return typeof o=="string"&&o.length>0?o:t("checkoutFailed")}var Oi=["online","manual","cod"],Mi=["bankTransfer","blik"];function Kr(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 Ui(e){if(typeof e!="object"||e==null)return null;let t=e.choice;if(typeof t!="object"||t==null)return null;let n=Kr(t.methods,Oi);return n.length<2?null:{methods:n,manualAccountTypes:Kr(t.manualAccountTypes,Mi)}}function fu(e){if(e==null)return null;let t=e.methods.filter(n=>n!=="cod");return t.length<2?null:{...e,methods:t}}function gu(e,t){return t!=null&&e.methods.includes(t)?t:e.methods[0]}function yu(e){let t=e.includes("bankTransfer"),n=e.includes("blik");return n&&!t?"paymentMethodManualBlik":t&&!n?"paymentMethodManualTransfer":"paymentMethodManualBoth"}async function Zr(e,t,n=5e3){let o=typeof AbortController>"u"?void 0:new AbortController,r=setTimeout(()=>_optionalChain([o, 'optionalAccess', _289 => _289.abort, 'call', _290 => _290()]),n);try{let a=await fetch(e,{method:"POST",headers:t.headers,body:t.body,signal:_optionalChain([o, 'optionalAccess', _291 => _291.signal])});return a.ok?Ui(await a.json()):null}catch (e20){return null}finally{clearTimeout(r)}}var ji;(o=>{async function e(r,a=1,i,d){let c=Ve();if(c==null)throw new Error("No project ID found");let m=await on(c).addProduct({productID:r,quantity:a,metadata:i,...d});if(m!=null)return m}o.addProductToCart=e;function t(){He.setState({isCartVisible:!0})}o.showCart=t;function n(){He.setState({isCartVisible:!1})}o.hideCart=n})(ji = exports.B||={});async function Jr(e){try{return await e.text()}catch (e21){return""}}function Yr(e,t){return t=an(t),t.locale??=_chunk7RXW6XFYjs.f.call(void 0, ),{headers:{..._chunkGXUNRJ5Sjs.a,..._chunkGQJDFLSLjs.h.call(void 0, e),"Content-Type":"application/json"},body:JSON.stringify(t)}}async function Gr(e){let t=Ve();return t==null?null:Zr(Be(t,"/payment-methods"),Yr(t,e))}async function nn(e){let t=Ve();if(t==null)throw new Error("No project ID found");let n=await fetch(Be(t,"/buy"),{method:"POST",...Yr(t,e)});if(n.status!=200){let r=dn(n.status,await Jr(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 Su(e){let t=Ve();if(t==null)throw new Error("No project ID found");let n={..._chunkGXUNRJ5Sjs.a,..._chunkGQJDFLSLjs.h.call(void 0, 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??=_chunk7RXW6XFYjs.f.call(void 0, );let r=await fetch(_chunkGXUNRJ5Sjs.f+o,{method:"POST",headers:n,body:JSON.stringify(e)});return r.ok?{status:"ok",redirectURL:(await r.json()).url}:{...dn(r.status,await Jr(r)),status:"error"}}function xt(){if(typeof localStorage>"u")return;let e=localStorage.getItem("bitsnap-ref");if(e!=null)return e}function an(e){let t=xt();return t==null||(e.metadata==null&&(e.metadata={}),e.metadata.ref=t),e}exports.a = ue; exports.b = me; exports.c = be; exports.d = ve; exports.e = Mt; exports.f = pe; exports.g = On; exports.h = Ut; exports.i = Re; exports.j = Xe; exports.k = et; exports.l = Ue; exports.m = je; exports.n = Pa; exports.o = qn; exports.p = Zt; exports.q = Bo; exports.r = z; exports.s = Ir; exports.t = Jt; exports.u = Ce; exports.v = Ni; exports.w = mu; exports.x = fu; exports.y = gu; exports.z = yu; exports.A = He; exports.B = ji; exports.C = Gr; exports.D = nn; exports.E = Su; exports.F = xt; exports.G = an; exports.H = Nl; exports.I = Sl; exports.J = Il; exports.K = Tl; exports.L = ui; exports.M = rn; exports.N = ru; exports.O = Ve; exports.P = au; exports.Q = ou; exports.R = yi; exports.S = iu; exports.T = su; exports.U = on;
|
|
4
|
-
//# sourceMappingURL=chunk-Y5KWVTXT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-Y5KWVTXT.js","../src/panel/components/PanelLogin.tsx","../src/ui/card.tsx","../src/ui/input-otp.tsx","../src/panel/LoadingIndicator.tsx","../src/panel/return-url.ts","../src/lib/render.text.tsx","../src/panel/audio-player/AudioPlayer.tsx"],"names":["Card","className","props","jsx","cn","CardHeader","CardTitle","CardDescription","CardContent","InputOTP","containerClassName","OTPInput","InputOTPGroup","InputOTPSlot","index","inputOTPContext","OTPInputContext","char","hasFakeCaret","isActive","jsxs","InputOTPSeparator","MinusIcon","LoadingIndicator","LoadingIndicator_default","RETURN_URL_PARAM","RETURN_URL_STORAGE_KEY","ACCESS_TOKEN_PARAM","getReturnURLFromSearch","search","raw","validateReturnURL","persistReturnURL","returnURL","readPersistedReturnURL","stored","isOriginAllowed","origin","allowedOrigins","allowed","allowedHost","originHost","newTime"],"mappings":"AAAA,ylCAAwI,sDAAiG,sDAAuJ,sDAA+E,sDAAyE,sDAAwD,oDCAjjB,qHAOxB,+CCDH,SAFKA,EAAAA,CAAK,CAAE,SAAA,CAAAC,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAgC,CAClE,OACEC,6BAAAA,KAAC,CAAA,CACC,WAAA,CAAU,MAAA,CACV,SAAA,CAAWC,gCAAAA,mFACT,CACAH,CACF,CAAA,CACC,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASG,EAAAA,CAAW,CAAE,SAAA,CAAAJ,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAgC,CACxE,OACEC,6BAAAA,KAAC,CAAA,CACC,WAAA,CAAU,aAAA,CACV,SAAA,CAAWC,gCAAAA,0JACT,CACAH,CACF,CAAA,CACC,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASI,EAAAA,CAAU,CAAE,SAAA,CAAAL,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAgC,CACvE,OACEC,6BAAAA,KAAC,CAAA,CACC,WAAA,CAAU,YAAA,CACV,SAAA,CAAWC,gCAAAA,4BAAG,CAA8BH,CAAS,CAAA,CACpD,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASK,EAAAA,CAAgB,CAAE,SAAA,CAAAN,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAgC,CAC7E,OACEC,6BAAAA,KAAC,CAAA,CACC,WAAA,CAAU,kBAAA,CACV,SAAA,CAAWC,gCAAAA,+BAAG,CAAiCH,CAAS,CAAA,CACvD,GAAGC,CAAAA,CACN,CAEJ,CAeA,SAASM,EAAAA,CAAY,CAAE,SAAA,CAAAP,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAgC,CACzE,OACEC,6BAAAA,KAAC,CAAA,CACC,WAAA,CAAU,cAAA,CACV,SAAA,CAAWC,gCAAAA,MAAG,CAAQH,CAAS,CAAA,CAC9B,GAAGC,CAAAA,CACN,CAEJ,CCvEA,qCAC0C,2CAChB,SAIjBO,EAAAA,CAAS,CAChB,SAAA,CAAAR,CAAAA,CACA,kBAAA,CAAAS,CAAAA,CACA,GAAGR,CACL,CAAA,CAEG,CACD,OACEC,6BAAAA,kBAACQ,CAAA,CACC,WAAA,CAAU,WAAA,CACV,kBAAA,CAAoBP,gCAAAA,iDAClB,CACAM,CACF,CAAA,CACA,SAAA,CAAWN,gCAAAA,6BAAG,CAA+BH,CAAS,CAAA,CACrD,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASU,EAAAA,CAAc,CAAE,SAAA,CAAAX,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAgC,CAC3E,OACEC,6BAAAA,KAAC,CAAA,CACC,WAAA,CAAU,iBAAA,CACV,SAAA,CAAWC,gCAAAA,mBAAG,CAAqBH,CAAS,CAAA,CAC3C,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASW,EAAAA,CAAa,CACpB,KAAA,CAAAC,CAAAA,CACA,SAAA,CAAAb,CAAAA,CACA,GAAGC,CACL,CAAA,CAEG,CACD,IAAMa,CAAAA,CAAwB,EAAA,CAAA,UAAA,CAAWC,yBAAe,CAAA,CAClD,CAAE,IAAA,CAAAC,CAAAA,CAAM,YAAA,CAAAC,CAAAA,CAAc,QAAA,CAAAC,CAAS,CAAA,kCAAIJ,CAAAA,6BAAiB,KAAA,qBAAMD,CAAK,GAAA,SAAK,CAAC,GAAA,CAE3E,OACEM,8BAAAA,KAAC,CAAA,CACC,WAAA,CAAU,gBAAA,CACV,aAAA,CAAaD,CAAAA,CACb,SAAA,CAAWf,gCAAAA,0fACT,CACAH,CACF,CAAA,CACC,GAAGC,CAAAA,CAEH,QAAA,CAAA,CAAAe,CAAAA,CACAC,CAAAA,EACCf,6BAAAA,KAAC,CAAA,CAAI,SAAA,CAAU,uEAAA,CACb,QAAA,CAAAA,6BAAAA,KAAC,CAAA,CAAI,SAAA,CAAU,0DAAA,CAA2D,CAAA,CAC5E,CAAA,CAAA,CAEJ,CAEJ,CAEA,SAASkB,EAAAA,CAAkB,CAAE,GAAGnB,CAAM,CAAA,CAAgC,CACpE,OACEC,6BAAAA,KAAC,CAAA,CAAI,WAAA,CAAU,qBAAA,CAAsB,IAAA,CAAK,WAAA,CAAa,GAAGD,CAAAA,CACxD,QAAA,CAAAC,6BAAAA,sBAACmB,CAAA,CAAA,CAAU,CAAA,CACb,CAEJ,CFzCA,SG/BgBC,EAAAA,CAAAA,CAAmB,CACjC,OACEH,8BAAAA,KAAC,CAAA,CAAI,SAAA,CAAU,yBAAA,CACb,QAAA,CAAA,CAAAjB,6BAAAA,KAAC,CAAA,CAAI,SAAA,CAAU,wEAAA,CAAyE,CAAA,CACxFA,6BAAAA,KAAC,CAAA,CAAI,SAAA,CAAU,yEAAA,CAA0E,CAAA,CACzFA,6BAAAA,KAAC,CAAA,CAAI,SAAA,CAAU,gDAAA,CAAiD,CAAA,CAAA,CAClE,CAEJ,CAEA,IAAOqB,CAAAA,CAAQD,EAAAA,CCRf,IAAME,EAAAA,CAAmB,YAAA,CACnBC,EAAAA,CAAyB,cAAA,CACzBC,EAAAA,CAAqB,aAAA,CAEpB,SAASC,EAAAA,CAAuBC,CAAAA,CAA+B,CACpE,IAAMC,CAAAA,CAAM,IAAI,eAAA,CAAgBD,CAAM,CAAA,CAAE,GAAA,CAAIJ,EAAgB,CAAA,CAC5D,OAAKK,CAAAA,CACEC,EAAAA,CAAkBD,CAAG,CAAA,CADX,IAEnB,CAEO,SAASE,EAAAA,CAAiBC,CAAAA,CAAgC,CAC3D,OAAO,MAAA,CAAW,GAAA,EAAA,CAClBA,CAAAA,CACF,MAAA,CAAO,cAAA,CAAe,OAAA,CAAQP,EAAAA,CAAwBO,CAAS,CAAA,CAE/D,MAAA,CAAO,cAAA,CAAe,UAAA,CAAWP,EAAsB,CAAA,CAE3D,CAEO,SAASQ,EAAAA,CAAAA,CAAwC,CACtD,EAAA,CAAI,OAAO,MAAA,CAAW,GAAA,CAAa,OAAO,IAAA,CAC1C,IAAMC,CAAAA,CAAS,MAAA,CAAO,cAAA,CAAe,OAAA,CAAQT,EAAsB,CAAA,CACnE,OAAKS,CAAAA,CACEJ,EAAAA,CAAkBI,CAAM,CAAA,CADX,IAEtB,CAEA,SAASC,EAAAA,CAAgBC,CAAAA,CAAgBC,CAAAA,CAAmC,CAC1E,OAAOA,CAAAA,CAAe,IAAA,CAAMC,CAAAA,EAAY,CACtC,EAAA,CAAIF,CAAAA,GAAWE,CAAAA,CAAS,MAAO,CAAA,CAAA,CAC/B,IAAMC,CAAAA,CAAc,IAAI,GAAA,CAAID,CAAO,CAAA,CAAE,QAAA,CAC/BE,CAAAA,CAAa,IAAI,GAAA,CAAIJ,CAAM,CAAA,CAAE,QAAA,CACnC,OAAOI,CAAAA,CAAW,QAAA,CAAS,CAAA,CAAA,EAAID,CAAW,CAAA,CAAA;ACyB9B,QAAA;ACyQNE,YAAAA","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-Y5KWVTXT.js","sourcesContent":[null,"import { useAutoAnimate } from \"@formkit/auto-animate/react\";\nimport {\n useEffect,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type FormEvent,\n} from \"react\";\nimport {\n InstrumentProvider,\n useInstrument,\n useInstrumentContext,\n type AnalyticsOption,\n} from \"../../analytics/instrument\";\nimport { cn } from \"../../lib/utils\";\nimport { rpcProvider, useMutation } from \"../../rpc-provider\";\nimport { Button } from \"../../ui/button\";\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from \"../../ui/card\";\nimport { Input } from \"../../ui/input\";\nimport {\n InputOTP,\n InputOTPGroup,\n InputOTPSeparator,\n InputOTPSlot,\n} from \"../../ui/input-otp\";\nimport { REGEXP_ONLY_DIGITS } from \"input-otp\";\nimport { Label } from \"../../ui/label\";\nimport LoadingIndicator from \"../LoadingIndicator\";\nimport {\n getAllowedReturnOrigins,\n setAllowedReturnOrigins,\n} from \"../config\";\nimport { usePanelConfig } from \"../PanelProvider\";\nimport {\n buildAccessTokenRedirect,\n getReturnURLFromSearch,\n persistReturnURL,\n readPersistedReturnURL,\n} from \"../return-url\";\nimport { getPanelSession, savePanelSession } from \"../session-storage\";\n\ntype LoginResponseStatus = \"success\" | \"error\" | \"default\";\n\nif (typeof window !== \"undefined\") {\n const currentOrigin = window.location.origin;\n const knownSiblings = [\n currentOrigin,\n \"https://bitsnap.pl\",\n \"https://kursy.bitsnap.pl\",\n ];\n if (getAllowedReturnOrigins().length === 0) {\n setAllowedReturnOrigins(Array.from(new Set(knownSiblings)));\n }\n}\n\ninterface LoginUserPanelProps {\n projectID?: string;\n host?: string;\n reveal: () => void;\n email: string;\n setEmail: (input: string) => void;\n loginUser: () => void;\n isLoginLoading: boolean;\n errMsg: string;\n}\n\ninterface VerifyCodePanelProps {\n projectID?: string;\n host?: string;\n email: string;\n reveal: () => void;\n setEmail: (input: string) => void;\n loginUser: () => void;\n isLoginLoading: boolean;\n loginUserResponse: {\n status: \"error\" | \"ok\";\n retryIn: number;\n message?: string | undefined;\n } | null;\n setLoginUserResponse: (\n response: {\n status: \"error\" | \"ok\";\n retryIn: number;\n message?: string | undefined;\n } | null,\n ) => void;\n responseStatus: LoginResponseStatus;\n setResponseStatus: (status: LoginResponseStatus) => void;\n errMsg: string;\n}\n\nconst LoginUserPanel = ({\n projectID,\n host,\n reveal,\n email,\n setEmail,\n loginUser,\n isLoginLoading,\n errMsg,\n}: LoginUserPanelProps) => {\n const { projectID: configuredProjectID, host: configuredHost } = usePanelConfig();\n if (\n typeof window !== \"undefined\" &&\n getPanelSession(projectID ?? configuredProjectID, host ?? configuredHost) != null\n ) {\n // @ts-ignore\n window.location.href = window.location.href.replaceAll(\"login\", \"\");\n return null;\n }\n\n const [isValidEmail, setIsValidEmail] = useState<boolean>(false);\n\n const emailValidation = (input: string) => {\n const emailPattern =\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n\n if (emailPattern.test(input.trim())) {\n return setIsValidEmail(true);\n }\n\n return setIsValidEmail(false);\n };\n\n const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const { value } = e.target;\n emailValidation(value);\n setEmail(value);\n };\n\n function goToVerifyCode() {\n reveal();\n }\n\n function onSubmit(e: FormEvent<HTMLFormElement>) {\n e.preventDefault();\n void loginUser();\n }\n\n return (\n <main className=\"mx-auto flex max-w-sm flex-1 flex-col justify-center space-y-12\">\n <div className={cn(\"flex min-w-sm flex-col gap-6\")}>\n <Card>\n <CardHeader>\n <CardTitle className=\"text-2xl\">Zaloguj się</CardTitle>\n <CardDescription>\n Wyślemy do Ciebie kod na maila, dzięki któremu się zalogujesz.\n </CardDescription>\n </CardHeader>\n <CardContent>\n <form onSubmit={onSubmit}>\n <div className=\"flex flex-col gap-6\">\n <div className=\"grid gap-2\">\n <Label htmlFor=\"email\">Email</Label>\n <Input\n id=\"email\"\n onChange={handleInputChange}\n type=\"email\"\n placeholder=\"m@example.com\"\n required\n />\n <span\n className={cn(\n !isValidEmail && email.length > 0\n ? \"font-bold text-red-500\"\n : \"text-neutral-700 dark:text-neutral-400\",\n \"text-xs\",\n )}\n >\n {!isValidEmail && email.length > 0\n ? \"Nieprawidłowy adres email\"\n : \"Wpisz swój adres email\"}\n </span>\n </div>\n\n <div>\n <Button\n type=\"submit\"\n disabled={isLoginLoading}\n className=\"relative w-full\"\n onClick={loginUser}\n >\n {isLoginLoading && (\n <div className=\"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2\">\n <LoadingIndicator />\n </div>\n )}\n Zaloguj się\n </Button>\n {errMsg.length > 0 && (\n <p className=\"text-xs font-medium text-red-500\">{errMsg}</p>\n )}\n </div>\n </div>\n <div className=\"mt-4 text-center text-sm\">\n Masz już kod?{\" \"}\n <button\n type=\"button\"\n onClick={goToVerifyCode}\n className=\"underline underline-offset-4\"\n >\n Mam już kod\n </button>\n </div>\n </form>\n </CardContent>\n </Card>\n </div>\n </main>\n );\n};\n\nconst VerifyCodePanel = ({\n projectID,\n host,\n email,\n reveal,\n setEmail,\n isLoginLoading,\n loginUserResponse,\n setLoginUserResponse,\n setResponseStatus,\n errMsg,\n}: VerifyCodePanelProps) => {\n const instrument = useInstrumentContext();\n const { mutateAsync: verifyCodeAsync, isPending: isVerifyLoading } =\n useMutation(rpcProvider.publicApi.userPanelLoginWithCode);\n\n const [code, setCode] = useState<string>(\"\");\n const [isValidCode, setIsValidCode] = useState<boolean>(false);\n const [isSubmitted, setIsSubmitted] = useState<boolean>(false);\n const [retryIn, setRetryIn] = useState(0);\n\n const codeValidation = (input: string) => {\n const codePattern = /^\\d+$/;\n\n if (codePattern.test(input.trim())) {\n return setIsValidCode(true);\n }\n\n return setIsValidCode(false);\n };\n\n const handleInputChange = (value: string) => {\n codeValidation(value);\n setCode(value);\n };\n\n async function login() {\n setIsSubmitted(true);\n if (code.length == 0) {\n setIsValidCode(false);\n return;\n }\n const codeValue = parseInt(code);\n\n const verifyCodeResult = await verifyCodeAsync({\n code: codeValue,\n });\n\n let status, message, accessToken;\n\n if (verifyCodeResult.result.case === \"accessToken\") {\n setIsValidCode(true);\n status = \"ok\";\n message = undefined;\n accessToken = verifyCodeResult.result.value;\n } else {\n setIsValidCode(false);\n status = \"error\";\n message = verifyCodeResult.result.value;\n accessToken = undefined;\n }\n\n if (status === \"error\") {\n setIsValidCode(false);\n console.warn(\"error:\", `Kod błędu: ${message}`);\n console.warn(\"Nieprawidłowy kod, spróbuj ponownie.\");\n }\n\n if (status === \"ok\") {\n instrument.track(\"panel_login\", {});\n if (accessToken) {\n savePanelSession(projectID, accessToken, email, host);\n }\n const returnURL = typeof window !== \"undefined\"\n ? readPersistedReturnURL()\n : null;\n setTimeout(() => {\n if (accessToken && returnURL) {\n window.location.href = buildAccessTokenRedirect(returnURL, accessToken);\n return;\n }\n window.location.reload();\n }, 100);\n }\n }\n\n function handleRetryInTime() {\n const intervalId = setInterval(() => {\n setRetryIn((prevRetryIn) => {\n if (prevRetryIn > 0) {\n return prevRetryIn - 1;\n } else {\n clearInterval(intervalId);\n return 0;\n }\n });\n }, 1000);\n\n return () => {\n clearInterval(intervalId);\n };\n }\n\n useEffect(() => {\n if (loginUserResponse?.status === \"ok\" && loginUserResponse?.retryIn > 0) {\n setRetryIn(loginUserResponse.retryIn);\n handleRetryInTime();\n }\n }, [loginUserResponse]);\n\n function backToLoginComponent() {\n setEmail(\"\");\n setLoginUserResponse(null);\n setResponseStatus(\"default\");\n reveal();\n }\n\n function onCodeSubmit(e: FormEvent<HTMLFormElement>) {\n e.preventDefault();\n void login();\n }\n\n return (\n <main className=\"mx-auto flex max-w-md flex-1 flex-col justify-center space-y-8\">\n <div className={cn(\"flex min-w-sm flex-col gap-6\")}>\n <Card>\n <CardHeader>\n <CardTitle className=\"text-2xl\">Wpisz kod z maila</CardTitle>\n <CardDescription>\n Sprawdź czy przypadkiem nie wylądował w spamie.\n </CardDescription>\n </CardHeader>\n <CardContent>\n <form onSubmit={onCodeSubmit} className=\"flex flex-col gap-6\">\n <div className=\"grid gap-2\">\n <div className=\"my-5 flex w-full items-center justify-center\">\n <div className=\"flex flex-col gap-2\">\n <InputOTP\n id=\"verify-code\"\n maxLength={6}\n pattern={REGEXP_ONLY_DIGITS}\n onChange={(newValue) => {\n handleInputChange(newValue);\n }}\n >\n <InputOTPGroup>\n <InputOTPSlot index={0} />\n <InputOTPSlot index={1} />\n <InputOTPSlot index={2} />\n </InputOTPGroup>\n <InputOTPSeparator />\n <InputOTPGroup>\n <InputOTPSlot index={3} />\n <InputOTPSlot index={4} />\n <InputOTPSlot index={5} />\n </InputOTPGroup>\n </InputOTP>\n <span\n className={cn(\n !isValidCode && isSubmitted\n ? \"text-red-500\"\n : \"text-neutral-700 dark:text-neutral-400\",\n \"text-xs\",\n )}\n >\n {!isValidCode && isSubmitted\n ? code.length == 0\n ? \"Kod nie może być pusty\"\n : \"Kod musi składać się z cyfr\"\n : \"Wpisz kod z maila\"}\n </span>\n </div>\n </div>\n </div>\n\n <div>\n <Button\n type=\"submit\"\n disabled={isLoginLoading || isVerifyLoading}\n className=\"relative w-full\"\n >\n {(isLoginLoading || isVerifyLoading) && (\n <div className=\"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2\">\n <LoadingIndicator />\n </div>\n )}\n Zaloguj się\n </Button>\n {errMsg.length > 0 && (\n <p className=\"text-xs font-medium text-red-500\">{errMsg}</p>\n )}\n </div>\n </form>\n <div className=\"mt-4 text-center text-sm\">\n Nie masz kodu?{\" \"}\n <button\n type=\"button\"\n onClick={backToLoginComponent}\n className=\"underline underline-offset-4\"\n >\n Wróć\n </button>\n </div>\n </CardContent>\n </Card>\n </div>\n </main>\n );\n};\n\nconst PanelLoginComponentWrapper = ({\n analytics,\n}: {\n analytics?: AnalyticsOption;\n}) => {\n const { theme, allowedReturnOrigins, projectID, host } = usePanelConfig();\n const instrument = useInstrument(projectID, analytics, \"panel\");\n\n const styles = {\n \"--button-background-color\": theme?.colors?.brand ?? \"#FFFFFF\",\n \"--button-background-color-dark\": theme?.colors?.brandDark ?? \"#000000\",\n \"--button-text-color\": theme?.colors?.brandDark ?? \"#000000\",\n \"--button-text-color-dark\": theme?.colors?.brand ?? \"#FFFFFF\",\n } as CSSProperties;\n\n type Screen = \"login\" | \"verifyCode\";\n\n const [activeScreen, setActiveScreen] = useState<Screen>(\"login\");\n const [parent] = useAutoAnimate({\n duration: 300,\n easing: \"ease-in-out\",\n disrespectUserMotionPreference: false,\n });\n\n const reveal = () =>\n setActiveScreen((prevScreen) =>\n prevScreen === \"login\" ? \"verifyCode\" : \"login\",\n );\n\n const [email, setEmail] = useState<string>(\"\");\n const [responseStatus, setResponseStatus] =\n useState<LoginResponseStatus>(\"default\");\n const [loginUserResponse, setLoginUserResponse] = useState<{\n status: \"error\" | \"ok\";\n retryIn: number;\n message?: string | undefined;\n } | null>(null);\n const { mutateAsync: loginUserAsync, isPending: isLoginLoading } =\n useMutation(rpcProvider.publicApi.userPanelLogin);\n\n const [errMsg, setErrMsg] = useState(\"\");\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n if (window.parent !== window) return;\n\n const queryReturnURL = getReturnURLFromSearch(window.location.search);\n if (queryReturnURL) {\n persistReturnURL(queryReturnURL);\n }\n\n const returnURL = queryReturnURL ?? readPersistedReturnURL();\n if (!returnURL) return;\n\n const existingToken = getPanelSession(projectID, host);\n if (!existingToken) return;\n\n window.location.href = buildAccessTokenRedirect(returnURL, existingToken);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allowedReturnOrigins, projectID, host]);\n\n async function loginUser() {\n setErrMsg(\"\");\n setResponseStatus(\"default\");\n const loginUserResult = await loginUserAsync({\n email: email,\n });\n\n const status = loginUserResult.result.case === \"success\" ? \"ok\" : \"error\";\n let retryIn = 0;\n let message = undefined;\n\n if (loginUserResult.result.case === \"success\") {\n retryIn = loginUserResult.result.value.retryIn;\n }\n\n if (status === \"error\") {\n message = \"Nieprawidłowy adres email, spróbuj ponownie.\";\n }\n\n setLoginUserResponse({\n status: status,\n retryIn: retryIn,\n message: message,\n });\n\n if (status === \"ok\" && activeScreen === \"login\") {\n reveal();\n } else if (status === \"ok\" && activeScreen === \"verifyCode\") {\n setResponseStatus(\"success\");\n } else if (status === \"error\") {\n setErrMsg(message ?? \"Nieprawidłowy adres email, spróbuj ponownie.\");\n }\n }\n\n return (\n <InstrumentProvider value={instrument}>\n <div className=\"bg-white text-black dark:bg-black dark:text-white\">\n <div\n className=\"font-inter flex h-screen w-screen flex-col p-4\"\n style={styles}\n ref={parent}\n >\n <header>\n {theme?.logoDarkURL && (\n <img\n src={theme?.logoDarkURL}\n className=\"hidden dark:inline\"\n alt=\"Company Logo\"\n draggable={false}\n />\n )}\n {theme?.logoURL && (\n <img\n src={theme?.logoURL}\n className=\"dark:hidden\"\n alt=\"Company Logo\"\n draggable={false}\n />\n )}\n </header>\n {activeScreen === \"login\" && (\n <LoginUserPanel\n projectID={projectID}\n host={host}\n reveal={reveal}\n email={email}\n setEmail={setEmail}\n loginUser={loginUser}\n isLoginLoading={isLoginLoading}\n errMsg={errMsg}\n />\n )}\n {activeScreen === \"verifyCode\" && (\n <VerifyCodePanel\n projectID={projectID}\n host={host}\n email={email}\n reveal={reveal}\n setEmail={setEmail}\n loginUser={loginUser}\n isLoginLoading={isLoginLoading}\n loginUserResponse={loginUserResponse}\n setLoginUserResponse={setLoginUserResponse}\n responseStatus={responseStatus}\n setResponseStatus={setResponseStatus}\n errMsg={errMsg}\n />\n )}\n </div>\n </div>\n </InstrumentProvider>\n );\n};\n\nexport const PanelLogin = ({\n analytics,\n}: { analytics?: AnalyticsOption } = {}) => {\n return <PanelLoginComponentWrapper analytics={analytics} />;\n};\n","import * as React from \"react\"\n\nimport { cn } from \"@/src/lib/utils\"\n\nfunction Card({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card\"\n className={cn(\n \"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n \"@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\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\"leading-none font-semibold\", className)}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn(\"px-6\", className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\"flex items-center px-6 [.border-t]:pt-6\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n}\n","import * as React from \"react\"\nimport { OTPInput, OTPInputContext } from \"input-otp\"\nimport { MinusIcon } from \"lucide-react\"\n\nimport { cn } from \"@/src/lib/utils\"\n\nfunction InputOTP({\n className,\n containerClassName,\n ...props\n}: React.ComponentProps<typeof OTPInput> & {\n containerClassName?: string\n}) {\n return (\n <OTPInput\n data-slot=\"input-otp\"\n containerClassName={cn(\n \"flex items-center gap-2 has-disabled:opacity-50\",\n containerClassName\n )}\n className={cn(\"disabled:cursor-not-allowed\", className)}\n {...props}\n />\n )\n}\n\nfunction InputOTPGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"input-otp-group\"\n className={cn(\"flex items-center\", className)}\n {...props}\n />\n )\n}\n\nfunction InputOTPSlot({\n index,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n index: number\n}) {\n const inputOTPContext = React.useContext(OTPInputContext)\n const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}\n\n return (\n <div\n data-slot=\"input-otp-slot\"\n data-active={isActive}\n className={cn(\n \"data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]\",\n className\n )}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"animate-caret-blink bg-foreground h-4 w-px duration-1000\" />\n </div>\n )}\n </div>\n )\n}\n\nfunction InputOTPSeparator({ ...props }: React.ComponentProps<\"div\">) {\n return (\n <div data-slot=\"input-otp-separator\" role=\"separator\" {...props}>\n <MinusIcon />\n </div>\n )\n}\n\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }\n","export function LoadingIndicator() {\n return (\n <div className=\"flex items-center gap-2\">\n <div className=\"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.3s]\" />\n <div className=\"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.15s]\" />\n <div className=\"h-3 w-3 animate-bounce rounded-full bg-current\" />\n </div>\n );\n}\n\nexport default LoadingIndicator;\n","import { getAllowedReturnOrigins } from \"./config\";\n\nconst RETURN_URL_PARAM = \"return_url\";\nconst RETURN_URL_STORAGE_KEY = \"__return_url\";\nconst ACCESS_TOKEN_PARAM = \"accessToken\";\n\nexport function getReturnURLFromSearch(search: string): string | null {\n const raw = new URLSearchParams(search).get(RETURN_URL_PARAM);\n if (!raw) return null;\n return validateReturnURL(raw);\n}\n\nexport function persistReturnURL(returnURL: string | null): void {\n if (typeof window === \"undefined\") return;\n if (returnURL) {\n window.sessionStorage.setItem(RETURN_URL_STORAGE_KEY, returnURL);\n } else {\n window.sessionStorage.removeItem(RETURN_URL_STORAGE_KEY);\n }\n}\n\nexport function readPersistedReturnURL(): string | null {\n if (typeof window === \"undefined\") return null;\n const stored = window.sessionStorage.getItem(RETURN_URL_STORAGE_KEY);\n if (!stored) return null;\n return validateReturnURL(stored);\n}\n\nfunction isOriginAllowed(origin: string, allowedOrigins: string[]): boolean {\n return allowedOrigins.some((allowed) => {\n if (origin === allowed) return true;\n const allowedHost = new URL(allowed).hostname;\n const originHost = new URL(origin).hostname;\n return originHost.endsWith(`.${allowedHost}`) || originHost === allowedHost;\n });\n}\n\nfunction validateReturnURL(raw: string): string | null {\n try {\n const u = new URL(raw);\n if (u.protocol !== \"https:\" && u.protocol !== \"http:\") return null;\n if (!isOriginAllowed(u.origin, getAllowedReturnOrigins())) return null;\n return u.toString();\n } catch {\n return null;\n }\n}\n\nexport function buildAccessTokenRedirect(\n returnURL: string,\n accessToken: string,\n): string {\n const u = new URL(returnURL);\n u.searchParams.set(ACCESS_TOKEN_PARAM, accessToken);\n return u.toString();\n}\n","const URL_REGEX =\n /https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)/g;\n\ntype Replacements = {\n url: string;\n startIndex: number;\n endIndex: number;\n replacementText?: string;\n};\n\nconst findURLIndices = (text: string) => {\n const matches = [...text.matchAll(URL_REGEX)];\n return matches.map(\n (match) =>\n ({\n url: match[0],\n startIndex: match.index,\n endIndex: match.index + match[0].length - 1,\n }) as Replacements,\n );\n};\n\nconst replaceTextByIndices = (\n originalText: string,\n replacements: Replacements[],\n) => {\n let result = \"\";\n let lastIndex = 0;\n\n // Sort replacements by startIndex to handle them in order\n replacements.sort((a, b) => a.startIndex - b.startIndex);\n\n for (const { startIndex, endIndex, replacementText } of replacements) {\n // Append text before the current replacement\n result += originalText.slice(lastIndex, startIndex);\n // Append the replacement text\n result += replacementText;\n // Update lastIndex to after the replaced segment\n lastIndex = endIndex + 1;\n }\n\n // Append any remaining text after the last replacement\n result += originalText.slice(lastIndex);\n\n return result;\n};\n\nexport const renderText = (txt: string) => {\n const urlIndices = findURLIndices(txt);\n\n return (\n <p\n dangerouslySetInnerHTML={{\n __html: replaceTextByIndices(\n txt,\n urlIndices.map((el) => {\n el[\"replacementText\"] =\n `<a key=${el.url} href=${el.url} style=\"text-decoration: underline;\" target=\"_blank\">\n ${el.url}\n </a>`;\n return el;\n }),\n ),\n }}\n ></p>\n );\n};\n","import Hls from \"hls.js\";\nimport { Pause, Play } from \"lucide-react\";\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n type CSSProperties,\n} from \"react\";\nimport { Button } from \"../../ui/button\";\nimport LoadingIndicator from \"../LoadingIndicator\";\nimport {\n mediaSessionPause,\n mediaSessionPlay,\n mediaSessionUpdateDurationAndPosition,\n startMediaSessionCoordinator,\n stopMediaSessionCoordinator,\n} from \"./media.session.coordinator\";\n\nimport \"./audio-player.css\";\n\ntype ChapterWithPublicUrl = {\n id: string;\n multimediaId?: string;\n name: string;\n description?: string;\n publicUrl: string;\n downloadableUrl?: string;\n duration?: number;\n};\n\nexport type AudioPlayerMethods = {\n selectChapter: (chapter: ChapterWithPublicUrl) => void;\n};\n\ntype AudioPlayerProps = {\n chapters: ChapterWithPublicUrl[];\n styles: CSSProperties;\n updateCurrentTime?: (currentTime: number) => void;\n\n title?: string;\n imageURL?: string;\n\n setCurrentTimeHandler?: (seekTo: (second: number) => void) => void;\n uniqueProductID: string;\n\n onChapterChange?: (chapter: ChapterWithPublicUrl) => void;\n};\n\nconst AudioPlayer = forwardRef<AudioPlayerMethods, AudioPlayerProps>(\n (\n {\n chapters,\n styles,\n updateCurrentTime,\n setCurrentTimeHandler,\n title,\n imageURL,\n uniqueProductID,\n onChapterChange,\n },\n ref,\n ) => {\n enum PlayState {\n Playing,\n Paused,\n }\n\n const [playState, setPlayState] = useState<PlayState>(PlayState.Paused);\n\n useEffect(() => {\n switch (playState) {\n case PlayState.Playing:\n mediaSessionPlay();\n break;\n case PlayState.Paused:\n mediaSessionPause();\n break;\n }\n }, [playState]);\n\n useImperativeHandle(ref, () => {\n return {\n selectChapter: (chapter: ChapterWithPublicUrl) => {\n playChapter(chapter);\n },\n };\n });\n\n const [currentTime, setCurrentTime] = useState<number | undefined>(\n undefined,\n );\n const [duration, setDuration] = useState<number | undefined>(undefined);\n\n const videoRef = useRef<HTMLVideoElement | null>(null);\n const hlsRef = useRef<Hls | undefined>(undefined);\n const timerRef = useRef<number | undefined>(undefined);\n\n const audioPlayerContainerRef = useRef<HTMLDivElement>(null!);\n\n const currentChapterRef = useRef<ChapterWithPublicUrl | null>(null);\n\n const [playWhenReady, setPlayWhenReady] = useState(true);\n const [isStarted, setIsStarted] = useState(false);\n const [isLoading, setIsLoading] = useState(!isSafari());\n\n function saveLastPlayedTime(timeInSeconds: number) {\n if (timeInSeconds < 10) {\n return;\n }\n localStorage.setItem(\n `__player__${uniqueProductID}_${currentChapterRef.current?.id}`,\n `${timeInSeconds}`,\n );\n }\n\n function getLastPlayedTime(): number | undefined {\n const time = localStorage.getItem(\n `__player__${uniqueProductID}_${currentChapterRef.current?.id}`,\n );\n\n if (time == null) {\n return undefined;\n }\n try {\n const result = parseInt(time);\n\n if (isNaN(result) || result < 0) {\n return undefined;\n }\n\n return result;\n } catch (e) {\n return undefined;\n }\n }\n\n function getLastSelectedChapterID(): string | undefined {\n const lastSelectedChapterID = localStorage.getItem(\n `__player__${uniqueProductID}_last_chapter`,\n );\n if (lastSelectedChapterID == null) {\n return undefined;\n }\n return lastSelectedChapterID;\n }\n\n function setLastSelectedChapterID(chapterID: string) {\n localStorage.setItem(\n `__player__${uniqueProductID}_last_chapter`,\n chapterID,\n );\n }\n\n function deleteMemoryChapter(chapterID: string) {\n localStorage.removeItem(`__player__${uniqueProductID}_${chapterID}`);\n }\n\n function setupObservers() {\n if (videoRef.current == null) {\n return;\n }\n videoRef.current.onloadeddata = () => {\n if (videoRef.current == null) {\n return;\n }\n if (videoRef.current.readyState < 2) {\n setIsLoading(true);\n }\n if (videoRef.current.readyState >= 2) {\n setIsLoading(false);\n }\n\n if (!isStarted) {\n const lastPlayedTime = getLastPlayedTime();\n if (lastPlayedTime != undefined) {\n seekTo(lastPlayedTime);\n }\n setIsStarted(true);\n }\n if (playWhenReady) {\n setPlayWhenReady(false);\n try {\n play();\n } catch (e) {\n console.log(\"play error\", e);\n }\n }\n };\n videoRef.current.onplay = () => {};\n\n videoRef.current.onseeked = () => {};\n videoRef.current.onseeking = () => {};\n\n videoRef.current.onpause = () => {};\n\n videoRef.current.onended = () => {\n playNextChapter();\n };\n\n startMediaSessionCoordinator({\n title: title ?? \"\",\n artwork: imageURL,\n action: (details) => {\n switch (details.action) {\n case \"play\":\n play();\n break;\n case \"pause\":\n pause();\n break;\n case \"seekbackward\":\n seekBy(-15);\n break;\n case \"seekforward\":\n seekBy(15);\n break;\n case \"seekto\":\n if (details.seekTime) {\n seekTo(details.seekTime);\n }\n break;\n case \"stop\":\n pause();\n break;\n default:\n break;\n }\n },\n });\n\n startTimer();\n }\n\n function playNextChapter() {\n if (chapters == null || chapters.length == 0) {\n return;\n }\n const currentChapterIndex = chapters.findIndex(\n (chapter) => chapter.id == currentChapterRef.current?.id,\n );\n if (currentChapterIndex == -1) {\n return;\n }\n deleteMemoryChapter(chapters[currentChapterIndex].id);\n const nextChapterIndex = currentChapterIndex + 1;\n if (nextChapterIndex >= chapters.length) {\n return;\n }\n playChapter(chapters[currentChapterIndex + 1]);\n }\n\n function startTimer() {\n updatePlayerDetails();\n if (timerRef.current != null) return;\n\n timerRef.current = setTimeout(() => {\n updatePlayerDetails();\n timerRef.current = undefined;\n startTimer();\n }, 500) as unknown as number;\n }\n\n function stopTimer() {\n if (timerRef.current == null) return;\n clearTimeout(timerRef.current as unknown as number);\n }\n\n function updatePlayerDetails() {\n if (videoRef.current == null) {\n return;\n }\n setPlayState(\n videoRef.current.paused ? PlayState.Paused : PlayState.Playing,\n );\n setDuration(videoRef.current.duration);\n setCurrentTime(videoRef.current.currentTime);\n saveLastPlayedTime(videoRef.current.currentTime);\n mediaSessionUpdateDurationAndPosition(\n videoRef.current.duration,\n videoRef.current.currentTime,\n );\n if (\n videoRef.current.networkState === videoRef.current.NETWORK_LOADING &&\n videoRef.current.readyState <= videoRef.current.HAVE_FUTURE_DATA\n ) {\n setIsLoading(true);\n } else {\n setIsLoading(false);\n }\n if (updateCurrentTime) {\n updateCurrentTime(videoRef.current.currentTime);\n }\n }\n\n function play() {\n videoRef.current?.play().then().catch();\n updatePlayerDetails();\n }\n\n function pause() {\n videoRef.current?.pause();\n updatePlayerDetails();\n }\n\n function togglePlayState() {\n if (playState === PlayState.Playing) {\n pause();\n return;\n }\n play();\n }\n\n function seekBy(seconds: number) {\n if (videoRef.current == null) {\n return;\n }\n const newTime = videoRef.current.currentTime + seconds;\n if (newTime < 0) {\n videoRef.current.currentTime = 0;\n return;\n }\n if (newTime > videoRef.current.duration) {\n videoRef.current.currentTime = videoRef.current.duration;\n return;\n }\n videoRef.current.currentTime += seconds;\n }\n\n function seekTo(toSecond: number) {\n if (videoRef.current == null) {\n return;\n }\n setCurrentTime(toSecond);\n if (toSecond < 0) {\n videoRef.current.currentTime = 0;\n return;\n }\n if (toSecond > videoRef.current.duration) {\n videoRef.current.currentTime = videoRef.current.duration;\n return;\n }\n videoRef.current.currentTime = toSecond;\n }\n\n function destroyPlayer() {\n if (videoRef.current == null) {\n return;\n }\n videoRef.current.onplay = null;\n videoRef.current.onseeked = null;\n videoRef.current.onseeking = null;\n videoRef.current.onpause = null;\n videoRef.current.onended = null;\n videoRef.current.src = \"\";\n hlsRef.current?.destroy();\n }\n\n function loadChapters(chapters: ChapterWithPublicUrl[]) {\n if (chapters.length == 0) {\n return;\n }\n\n const chapterID = getLastSelectedChapterID();\n if (chapterID == null) {\n playChapter(chapters[0]);\n return;\n }\n\n const chapter = chapters.find((chapter) => chapter.id == chapterID);\n if (chapter == null) {\n playChapter(chapters[0]);\n return;\n }\n\n playChapter(chapter);\n }\n\n function playChapter(chapter: ChapterWithPublicUrl) {\n setIsStarted(false);\n setPlayWhenReady(true);\n currentChapterRef.current = chapter;\n playURL(chapter.publicUrl);\n onChapterChange?.(chapter);\n setLastSelectedChapterID(chapter.id);\n }\n\n function playURL(src: string) {\n if (videoRef.current == null) {\n return;\n }\n if (videoRef.current.canPlayType(\"application/vnd.apple.mpegurl\")) {\n videoRef.current.src = src;\n } else if (Hls.isSupported()) {\n if (hlsRef.current == null) {\n hlsRef.current = new Hls();\n hlsRef.current?.attachMedia(videoRef.current);\n }\n hlsRef.current?.loadSource(src);\n }\n }\n\n useEffect(() => {\n if (videoRef.current == null) {\n return;\n }\n setupObservers();\n loadChapters(chapters);\n }, [videoRef.current]);\n\n useEffect(() => {\n loadChapters(chapters);\n }, [chapters]);\n\n useEffect(() => {\n if (setCurrentTimeHandler != null) {\n setCurrentTimeHandler(seekTo);\n }\n\n return () => {\n setCurrentTime(undefined);\n videoRef.current?.pause();\n destroyPlayer();\n stopMediaSessionCoordinator();\n };\n }, []);\n\n const calculateTime = (secs: number) => {\n const hours = Math.floor(secs / 3600);\n const minutes = Math.floor(secs / 60) % 60;\n const seconds = Math.floor(secs % 60);\n const returnedHours =\n hours > 0 ? (hours < 10 ? `0${hours}:` : `${hours}:`) : \"\";\n const returnedSeconds = seconds < 10 ? `0${seconds}` : `${seconds}`;\n if (isNaN(seconds) || isNaN(minutes) || isNaN(hours)) {\n return \"\";\n }\n return `${returnedHours}${minutes}:${returnedSeconds}`;\n };\n\n const showRangeProgress = (rangeInput: HTMLInputElement) => {\n const barProgress =\n (parseFloat(rangeInput.value) / parseFloat(rangeInput.max)) * 100;\n audioPlayerContainerRef.current.style.setProperty(\n \"--seek-before-width\",\n barProgress + \"%\",\n );\n\n const selectedTime = (duration! * barProgress) / 100;\n seekTo(selectedTime);\n };\n\n return (\n <div\n id=\"audio-player-container\"\n className=\"flex flex-col\"\n style={styles}\n ref={audioPlayerContainerRef}\n >\n <video\n ref={videoRef}\n className=\"hidden\"\n poster={imageURL}\n title={title}\n ></video>\n\n <input\n type=\"range\"\n min=\"0\"\n max={duration != undefined ? Math.floor(duration).toString() : 100}\n value={currentTime ?? 0}\n onChange={(e) => showRangeProgress(e.target as HTMLInputElement)}\n className=\"w-full\"\n />\n\n <section className=\"flex w-full items-center justify-between text-sm font-medium\">\n <span id=\"current-time\">{calculateTime(currentTime!)}</span>\n <span id=\"duration\">{calculateTime(duration!)}</span>\n </section>\n <div className=\"mt-6 flex items-center justify-center gap-x-12\">\n <Button\n variant=\"outline\"\n onClick={() => seekBy(-10)}\n aria-label=\"Rewind 10 Seconds\"\n >\n -10\n </Button>\n <Button\n variant=\"outline\"\n onClick={togglePlayState}\n aria-label=\"Play Or Pause\"\n >\n {playState === PlayState.Paused && <Play className=\"h-5 w-5\" />}\n {playState === PlayState.Playing && <Pause className=\"h-5 w-5\" />}\n </Button>\n <Button\n variant=\"outline\"\n onClick={() => seekBy(10)}\n aria-label=\"Fast Forward 10 Seconds\"\n >\n +10\n </Button>\n </div>\n {isLoading && (\n <div className=\"mt-2 flex w-full justify-center\">\n <LoadingIndicator />\n </div>\n )}\n </div>\n );\n },\n);\n\nfunction isSafari() {\n return navigator.userAgent.toLowerCase().indexOf(\"safari/\") > -1;\n}\n\nexport default AudioPlayer;\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{B as a,C as b,D as c,E as d,F as e,G as f}from"./chunk-5AYH23UJ.mjs";import"./chunk-QXGK337V.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-SULHGFYN.mjs";import"./chunk-CUPG4B5W.mjs";import"./chunk-AGYS7Z6G.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-SXKJ26OA.mjs";import"./chunk-QQQ2JSPQ.mjs";import"./chunk-VNYHJT6V.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-U6FLIRIV.mjs";export{a as Bitsnap,d as createCheckout,c as createPaymentURL,b as getPaymentMethodChoice,e as getReferenceIfPossible,f as injectReferenceToRequestIfNeeded};
|
|
2
|
-
//# sourceMappingURL=methods-NJEP64AG.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.bitsnap-react #audio-player-container{--seek-before-width: 0%;--buffered-width: 0%}.bitsnap-react input[type=range]{position:relative;-webkit-appearance:none;width:100%;margin:0;padding:0;height:19px;float:left;outline:none;background:transparent}.bitsnap-react input[type=range]::-webkit-slider-runnable-track{width:100%;height:3px;cursor:pointer;background:#d9d9d9}.bitsnap-react input[type=range]:before{position:absolute;content:"";top:8px;left:0;width:var(--seek-before-width);height:3px;background-color:#8c8c8c;cursor:pointer}.bitsnap-react input[type=range]::-webkit-slider-thumb{position:relative;-webkit-appearance:none;box-sizing:content-box;border:1px solid #d9d9d9;height:15px;width:15px;border-radius:50%;background-color:#8c8c8c;cursor:pointer;margin:-7px 0 0}.bitsnap-react input[type=range]:active::-webkit-slider-thumb{transform:scale(1.2);background:#e2e8f0}.bitsnap-react input[type=range]::-moz-range-track{width:100%;height:3px;cursor:pointer;background:linear-gradient(to right,rgba(0,125,181,.6) var(--buffered-width),rgba(0,125,181,.2) var(--buffered-width))}.bitsnap-react input[type=range]::-moz-range-progress{background-color:#007db5}.bitsnap-react input[type=range]::-moz-focus-outer{border:0}.bitsnap-react input[type=range]::-moz-range-thumb{box-sizing:content-box;border:1px solid #007db5;height:15px;width:15px;border-radius:50%;background-color:#fff;cursor:pointer}.bitsnap-react input[type=range]:active::-moz-range-thumb{transform:scale(1.2);background:#007db5}.bitsnap-react input[type=range]::-ms-track{width:100%;height:3px;cursor:pointer;background:transparent;border:solid transparent;color:transparent}.bitsnap-react input[type=range]::-ms-fill-lower{background-color:#007db5}.bitsnap-react input[type=range]::-ms-fill-upper{background:linear-gradient(to right,rgba(0,125,181,.6) var(--buffered-width),rgba(0,125,181,.2) var(--buffered-width))}.bitsnap-react input[type=range]::-ms-thumb{box-sizing:content-box;border:1px solid #007db5;height:15px;width:15px;border-radius:50%;background-color:#fff;cursor:pointer}.bitsnap-react input[type=range]:active::-ms-thumb{transform:scale(1.2);background:#007db5}.bitsnap-react .SliderRoot{position:relative;display:flex;align-items:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;touch-action:none;width:200px;height:20px}.bitsnap-react .SliderTrack{background-color:var(--black-a10);position:relative;flex-grow:1;border-radius:9999px;height:3px}.bitsnap-react .SliderRange{position:absolute;background-color:#fff;border-radius:9999px;height:100%}.bitsnap-react .SliderThumb{display:block;width:20px;height:20px;background-color:#fff;box-shadow:0 2px 10px var(--black-a7);border-radius:10px}.bitsnap-react .SliderThumb:hover{background-color:var(--violet-3)}.bitsnap-react .SliderThumb:focus{outline:none;box-shadow:0 0 0 5px var(--black-a8)}
|
|
2
|
-
/*# sourceMappingURL=methods-QAZED7TJ.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/panel/audio-player/audio-player.css"],"sourcesContent":[".bitsnap-react #audio-player-container {\n --seek-before-width: 0%;\n --buffered-width: 0%;\n}\n\n.bitsnap-react input[type=\"range\"] {\n position: relative;\n -webkit-appearance: none;\n width: 100%;\n margin: 0;\n padding: 0;\n height: 19px;\n float: left;\n outline: none;\n background: transparent;\n}\n.bitsnap-react input[type=\"range\"]::-webkit-slider-runnable-track {\n width: 100%;\n height: 3px;\n cursor: pointer;\n /*background: linear-gradient(to right, rgba(0, 125, 181, 0.6) var(--buffered-width), rgba(0, 125, 181, 0.2) var(--buffered-width));*/\n background: #d9d9d9;\n}\n.bitsnap-react input[type=\"range\"]::before {\n position: absolute;\n content: \"\";\n top: 8px;\n left: 0;\n width: var(--seek-before-width);\n height: 3px;\n background-color: #8c8c8c;\n cursor: pointer;\n}\n.bitsnap-react input[type=\"range\"]::-webkit-slider-thumb {\n position: relative;\n -webkit-appearance: none;\n box-sizing: content-box;\n border: 1px solid #d9d9d9;\n height: 15px;\n width: 15px;\n border-radius: 50%;\n background-color: #8c8c8c;\n cursor: pointer;\n margin: -7px 0 0 0;\n}\n.bitsnap-react input[type=\"range\"]:active::-webkit-slider-thumb {\n transform: scale(1.2);\n background: #e2e8f0;\n}\n.bitsnap-react input[type=\"range\"]::-moz-range-track {\n width: 100%;\n height: 3px;\n cursor: pointer;\n background: linear-gradient(\n to right,\n rgba(0, 125, 181, 0.6) var(--buffered-width),\n rgba(0, 125, 181, 0.2) var(--buffered-width)\n );\n}\n.bitsnap-react input[type=\"range\"]::-moz-range-progress {\n background-color: #007db5;\n}\n.bitsnap-react input[type=\"range\"]::-moz-focus-outer {\n border: 0;\n}\n.bitsnap-react input[type=\"range\"]::-moz-range-thumb {\n box-sizing: content-box;\n border: 1px solid #007db5;\n height: 15px;\n width: 15px;\n border-radius: 50%;\n background-color: #fff;\n cursor: pointer;\n}\n.bitsnap-react input[type=\"range\"]:active::-moz-range-thumb {\n transform: scale(1.2);\n background: #007db5;\n}\n.bitsnap-react input[type=\"range\"]::-ms-track {\n width: 100%;\n height: 3px;\n cursor: pointer;\n background: transparent;\n border: solid transparent;\n color: transparent;\n}\n.bitsnap-react input[type=\"range\"]::-ms-fill-lower {\n background-color: #007db5;\n}\n.bitsnap-react input[type=\"range\"]::-ms-fill-upper {\n background: linear-gradient(\n to right,\n rgba(0, 125, 181, 0.6) var(--buffered-width),\n rgba(0, 125, 181, 0.2) var(--buffered-width)\n );\n}\n.bitsnap-react input[type=\"range\"]::-ms-thumb {\n box-sizing: content-box;\n border: 1px solid #007db5;\n height: 15px;\n width: 15px;\n border-radius: 50%;\n background-color: #fff;\n cursor: pointer;\n}\n.bitsnap-react input[type=\"range\"]:active::-ms-thumb {\n transform: scale(1.2);\n background: #007db5;\n}\n\n.bitsnap-react .SliderRoot {\n position: relative;\n display: flex;\n align-items: center;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n touch-action: none;\n width: 200px;\n height: 20px;\n}\n\n.bitsnap-react .SliderTrack {\n background-color: var(--black-a10);\n position: relative;\n flex-grow: 1;\n border-radius: 9999px;\n height: 3px;\n}\n\n.bitsnap-react .SliderRange {\n position: absolute;\n background-color: white;\n border-radius: 9999px;\n height: 100%;\n}\n\n.bitsnap-react .SliderThumb {\n display: block;\n width: 20px;\n height: 20px;\n background-color: white;\n box-shadow: 0 2px 10px var(--black-a7);\n border-radius: 10px;\n}\n.bitsnap-react .SliderThumb:hover {\n background-color: var(--violet-3);\n}\n.bitsnap-react .SliderThumb:focus {\n outline: none;\n box-shadow: 0 0 0 5px var(--black-a8);\n}\n"],"mappings":"AAAA,CAAC,cAAc,CAAC,uBACd,qBAAqB,GACrB,kBAAkB,EACpB,CAEA,CALC,cAKc,KAAK,CAAC,YACnB,SAAU,SACV,mBAAoB,KACpB,MAAO,KART,OASU,EATV,QAUW,EACT,OAAQ,KACR,MAAO,KACP,QAAS,KACT,WAAY,WACd,CACA,CAhBC,cAgBc,KAAK,CAAC,WAAa,gCAChC,MAAO,KACP,OAAQ,IACR,OAAQ,QAER,WAAY,OACd,CACA,CAvBC,cAuBc,KAAK,CAAC,WAAa,QAChC,SAAU,SACV,QAAS,GACT,IAAK,IACL,KAAM,EACN,MAAO,IAAI,qBACX,OAAQ,IACR,iBAAkB,QAClB,OAAQ,OACV,CACA,CAjCC,cAiCc,KAAK,CAAC,WAAa,uBAChC,SAAU,SACV,mBAAoB,KACpB,WAAY,YACZ,OAAQ,IAAI,MAAM,QAClB,OAAQ,KACR,MAAO,KAvCT,cAwCiB,IACf,iBAAkB,QAClB,OAAQ,QA1CV,OA2CU,KAAK,EAAE,CACjB,CACA,CA7CC,cA6Cc,KAAK,CAAC,WAAa,OAAO,uBACvC,UAAW,MAAM,KACjB,WAAY,OACd,CACA,CAjDC,cAiDc,KAAK,CAAC,WAAa,mBAChC,MAAO,KACP,OAAQ,IACR,OAAQ,QACR,WAAY,gBACV,GAAG,KAAK,CACR,KAAK,CAAC,CAAE,GAAG,CAAE,GAAG,CAAE,IAAK,IAAI,iBAAiB,CAC5C,KAAK,CAAC,CAAE,GAAG,CAAE,GAAG,CAAE,IAAK,IAAI,kBAE/B,CACA,CA3DC,cA2Dc,KAAK,CAAC,WAAa,sBAChC,iBAAkB,OACpB,CACA,CA9DC,cA8Dc,KAAK,CAAC,WAAa,mBAChC,OAAQ,CACV,CACA,CAjEC,cAiEc,KAAK,CAAC,WAAa,mBAChC,WAAY,YACZ,OAAQ,IAAI,MAAM,QAClB,OAAQ,KACR,MAAO,KArET,cAsEiB,IACf,iBAAkB,KAClB,OAAQ,OACV,CACA,CA1EC,cA0Ec,KAAK,CAAC,WAAa,OAAO,mBACvC,UAAW,MAAM,KACjB,WAAY,OACd,CACA,CA9EC,cA8Ec,KAAK,CAAC,WAAa,YAChC,MAAO,KACP,OAAQ,IACR,OAAQ,QACR,WAAY,YACZ,OAAQ,MAAM,YACd,MAAO,WACT,CACA,CAtFC,cAsFc,KAAK,CAAC,WAAa,iBAChC,iBAAkB,OACpB,CACA,CAzFC,cAyFc,KAAK,CAAC,WAAa,iBAChC,WAAY,gBACV,GAAG,KAAK,CACR,KAAK,CAAC,CAAE,GAAG,CAAE,GAAG,CAAE,IAAK,IAAI,iBAAiB,CAC5C,KAAK,CAAC,CAAE,GAAG,CAAE,GAAG,CAAE,IAAK,IAAI,kBAE/B,CACA,CAhGC,cAgGc,KAAK,CAAC,WAAa,YAChC,WAAY,YACZ,OAAQ,IAAI,MAAM,QAClB,OAAQ,KACR,MAAO,KApGT,cAqGiB,IACf,iBAAkB,KAClB,OAAQ,OACV,CACA,CAzGC,cAyGc,KAAK,CAAC,WAAa,OAAO,YACvC,UAAW,MAAM,KACjB,WAAY,OACd,CAEA,CA9GC,cA8Gc,CAAC,WACd,SAAU,SACV,QAAS,KACT,YAAa,OACb,oBAAqB,KAClB,iBAAkB,KACb,YAAa,KACrB,aAAc,KACd,MAAO,MACP,OAAQ,IACV,CAEA,CA1HC,cA0Hc,CAAC,YACd,iBAAkB,IAAI,aACtB,SAAU,SACV,UAAW,EA7Hb,cA8HiB,OACf,OAAQ,GACV,CAEA,CAlIC,cAkIc,CAAC,YACd,SAAU,SACV,iBAAkB,KApIpB,cAqIiB,OACf,OAAQ,IACV,CAEA,CAzIC,cAyIc,CAAC,YACd,QAAS,MACT,MAAO,KACP,OAAQ,KACR,iBAAkB,KAClB,WAAY,EAAE,IAAI,KAAK,IAAI,YA9I7B,cA+IiB,IACjB,CACA,CAjJC,cAiJc,CARC,WAQW,OACzB,iBAAkB,IAAI,WACxB,CACA,CApJC,cAoJc,CAXC,WAWW,OACzB,QAAS,KACT,WAAY,EAAE,EAAE,EAAE,IAAI,IAAI,WAC5B","names":[]}
|
package/dist/methods-WRONKK3D.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkY5KWVTXTjs = require('./chunk-Y5KWVTXT.js');require('./chunk-QERYM7RC.js');require('./chunk-KOYBZORL.js');require('./chunk-SRQOFCMO.js');require('./chunk-WPOXLITY.js');require('./chunk-GXUNRJ5S.js');require('./chunk-GQJDFLSL.js');require('./chunk-7RXW6XFY.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.Bitsnap = _chunkY5KWVTXTjs.B; exports.createCheckout = _chunkY5KWVTXTjs.E; exports.createPaymentURL = _chunkY5KWVTXTjs.D; exports.getPaymentMethodChoice = _chunkY5KWVTXTjs.C; exports.getReferenceIfPossible = _chunkY5KWVTXTjs.F; exports.injectReferenceToRequestIfNeeded = _chunkY5KWVTXTjs.G;
|
|
2
|
-
//# sourceMappingURL=methods-WRONKK3D.js.map
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { A as AnalyticsOption } from './instrument-BE8ktMUv.mjs';
|
|
2
|
-
import { R as ReturnsAppearance, a as ReturnsTexts } from './texts-tQtAGJCT.mjs';
|
|
3
|
-
|
|
4
|
-
interface GetThemeOutput {
|
|
5
|
-
logoURL?: string;
|
|
6
|
-
logoDarkURL?: string;
|
|
7
|
-
colors?: {
|
|
8
|
-
brand?: string;
|
|
9
|
-
brandDark?: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
type PanelScreen = "products" | "notifications" | "profile" | "plans" | "orders" | "order-details" | "returns" | "return-details" | "course";
|
|
13
|
-
type PanelSearchParamsType = {
|
|
14
|
-
product?: string;
|
|
15
|
-
state: PanelScreen;
|
|
16
|
-
orderId?: string;
|
|
17
|
-
returnId?: string;
|
|
18
|
-
/** `state: "course"`: `UserProduct.accessId` of the open course. */
|
|
19
|
-
course?: string;
|
|
20
|
-
/** `state: "course"`: id of the open lesson or test. */
|
|
21
|
-
item?: string;
|
|
22
|
-
};
|
|
23
|
-
interface PanelProps {
|
|
24
|
-
projectID: string;
|
|
25
|
-
theme?: GetThemeOutput;
|
|
26
|
-
loginURL: string;
|
|
27
|
-
/**
|
|
28
|
-
* Appearance of the Returns screen. When omitted, `buttonBackground`,
|
|
29
|
-
* `focusRing` and a readable `buttonForeground` are derived from
|
|
30
|
-
* `theme.colors.brand`.
|
|
31
|
-
*/
|
|
32
|
-
returnsAppearance?: ReturnsAppearance;
|
|
33
|
-
/** Text overrides of the Returns screen. */
|
|
34
|
-
returnsTexts?: Partial<ReturnsTexts>;
|
|
35
|
-
/**
|
|
36
|
-
* Usage statistics for your Bitsnap dashboard (panel logins, orders viewed, downloads). On by default;
|
|
37
|
-
* `false` turns it off. An object lets you forward every event:
|
|
38
|
-
* `{ onEvent }`. Nothing is stored on the visitor's device.
|
|
39
|
-
*/
|
|
40
|
-
analytics?: AnalyticsOption;
|
|
41
|
-
}
|
|
42
|
-
interface PanelLoginProps {
|
|
43
|
-
projectID: string;
|
|
44
|
-
theme?: GetThemeOutput;
|
|
45
|
-
/**
|
|
46
|
-
* Usage statistics for your Bitsnap dashboard (panel logins). On by default;
|
|
47
|
-
* `false` turns it off. An object lets you forward every event:
|
|
48
|
-
* `{ onEvent }`. Nothing is stored on the visitor's device.
|
|
49
|
-
*/
|
|
50
|
-
analytics?: AnalyticsOption;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type { GetThemeOutput as G, PanelProps as P, PanelLoginProps as a, PanelScreen as b, PanelSearchParamsType as c };
|
package/dist/types-u8VwmC3j.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { A as AnalyticsOption } from './instrument-BE8ktMUv.js';
|
|
2
|
-
import { R as ReturnsAppearance, a as ReturnsTexts } from './texts-CIEFbJTN.js';
|
|
3
|
-
|
|
4
|
-
interface GetThemeOutput {
|
|
5
|
-
logoURL?: string;
|
|
6
|
-
logoDarkURL?: string;
|
|
7
|
-
colors?: {
|
|
8
|
-
brand?: string;
|
|
9
|
-
brandDark?: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
type PanelScreen = "products" | "notifications" | "profile" | "plans" | "orders" | "order-details" | "returns" | "return-details" | "course";
|
|
13
|
-
type PanelSearchParamsType = {
|
|
14
|
-
product?: string;
|
|
15
|
-
state: PanelScreen;
|
|
16
|
-
orderId?: string;
|
|
17
|
-
returnId?: string;
|
|
18
|
-
/** `state: "course"`: `UserProduct.accessId` of the open course. */
|
|
19
|
-
course?: string;
|
|
20
|
-
/** `state: "course"`: id of the open lesson or test. */
|
|
21
|
-
item?: string;
|
|
22
|
-
};
|
|
23
|
-
interface PanelProps {
|
|
24
|
-
projectID: string;
|
|
25
|
-
theme?: GetThemeOutput;
|
|
26
|
-
loginURL: string;
|
|
27
|
-
/**
|
|
28
|
-
* Appearance of the Returns screen. When omitted, `buttonBackground`,
|
|
29
|
-
* `focusRing` and a readable `buttonForeground` are derived from
|
|
30
|
-
* `theme.colors.brand`.
|
|
31
|
-
*/
|
|
32
|
-
returnsAppearance?: ReturnsAppearance;
|
|
33
|
-
/** Text overrides of the Returns screen. */
|
|
34
|
-
returnsTexts?: Partial<ReturnsTexts>;
|
|
35
|
-
/**
|
|
36
|
-
* Usage statistics for your Bitsnap dashboard (panel logins, orders viewed, downloads). On by default;
|
|
37
|
-
* `false` turns it off. An object lets you forward every event:
|
|
38
|
-
* `{ onEvent }`. Nothing is stored on the visitor's device.
|
|
39
|
-
*/
|
|
40
|
-
analytics?: AnalyticsOption;
|
|
41
|
-
}
|
|
42
|
-
interface PanelLoginProps {
|
|
43
|
-
projectID: string;
|
|
44
|
-
theme?: GetThemeOutput;
|
|
45
|
-
/**
|
|
46
|
-
* Usage statistics for your Bitsnap dashboard (panel logins). On by default;
|
|
47
|
-
* `false` turns it off. An object lets you forward every event:
|
|
48
|
-
* `{ onEvent }`. Nothing is stored on the visitor's device.
|
|
49
|
-
*/
|
|
50
|
-
analytics?: AnalyticsOption;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type { GetThemeOutput as G, PanelProps as P, PanelLoginProps as a, PanelScreen as b, PanelSearchParamsType as c };
|
|
File without changes
|
|
File without changes
|