bitsnap-react 1.8.0 → 1.10.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/README.md +162 -0
- package/dist/CartProvider-HXLGQ4EX.mjs +2 -0
- package/dist/CartProvider-OHHYOMSG.js +2 -0
- package/dist/CartProvider-OHHYOMSG.js.map +1 -0
- package/dist/analytics.d.mts +45 -0
- package/dist/analytics.d.ts +45 -0
- package/dist/analytics.js +2 -0
- package/dist/analytics.js.map +1 -0
- package/dist/analytics.mjs +2 -0
- package/dist/catalog.d.mts +14 -1
- package/dist/catalog.d.ts +14 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/chunk-3Z6VNXBP.js +2 -0
- package/dist/chunk-3Z6VNXBP.js.map +1 -0
- package/dist/chunk-43IIYJ6J.mjs +2 -0
- package/dist/chunk-43IIYJ6J.mjs.map +1 -0
- package/dist/chunk-6D3OORMK.mjs +2 -0
- package/dist/chunk-6D3OORMK.mjs.map +1 -0
- package/dist/chunk-ADYVTMGH.mjs +2 -0
- package/dist/chunk-ADYVTMGH.mjs.map +1 -0
- package/dist/{chunk-WRCXZMKK.js → chunk-AJNULBC3.js} +2 -2
- package/dist/chunk-AJNULBC3.js.map +1 -0
- package/dist/chunk-B32ACCW2.js +2 -0
- package/dist/chunk-B32ACCW2.js.map +1 -0
- package/dist/chunk-DDY7IBMG.mjs +2 -0
- package/dist/chunk-DDY7IBMG.mjs.map +1 -0
- package/dist/chunk-DPKT6ITB.js +4 -0
- package/dist/chunk-DPKT6ITB.js.map +1 -0
- package/dist/{chunk-T2POA6RW.js → chunk-F46RJVWC.js} +2 -2
- package/dist/chunk-F46RJVWC.js.map +1 -0
- package/dist/chunk-F6GQLKA6.js +2 -0
- package/dist/chunk-F6GQLKA6.js.map +1 -0
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-JXCHRSPW.mjs +4 -0
- package/dist/chunk-JXCHRSPW.mjs.map +1 -0
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/chunk-RLEC25JI.mjs +2 -0
- package/dist/chunk-RLEC25JI.mjs.map +1 -0
- package/dist/chunk-RVILRUW3.js +2 -0
- package/dist/chunk-RVILRUW3.js.map +1 -0
- package/dist/chunk-T2OUOO4X.mjs +2 -0
- package/dist/chunk-T2OUOO4X.mjs.map +1 -0
- package/dist/chunk-VIII45AC.js +2 -0
- package/dist/chunk-VIII45AC.js.map +1 -0
- package/dist/chunk-XIHGWNTS.js +2 -0
- package/dist/chunk-XIHGWNTS.js.map +1 -0
- package/dist/chunk-YXFJG4MF.mjs +2 -0
- package/dist/chunk-YXFJG4MF.mjs.map +1 -0
- package/dist/chunk-ZPTHK4OX.mjs +2 -0
- package/dist/{chunk-OJT3YO2R.mjs.map → chunk-ZPTHK4OX.mjs.map} +1 -1
- package/dist/consent.d.mts +165 -0
- package/dist/consent.d.ts +165 -0
- package/dist/consent.js +75 -0
- package/dist/consent.js.map +1 -0
- package/dist/consent.mjs +75 -0
- package/dist/consent.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 -0
- package/dist/embed/consent.js +74 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +54 -7
- package/dist/index.d.ts +54 -7
- 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-CmxK7S4T.d.mts +929 -0
- package/dist/instrument-CmxK7S4T.d.ts +929 -0
- package/dist/internal.js.map +1 -1
- package/dist/methods-A5KGZBAM.js +2 -0
- package/dist/methods-A5KGZBAM.js.map +1 -0
- package/dist/methods-AOHKV7IN.mjs +2 -0
- package/dist/methods-AOHKV7IN.mjs.map +1 -0
- package/dist/models.js.map +1 -1
- package/dist/returns.d.mts +9 -1
- package/dist/returns.d.ts +9 -1
- package/dist/returns.js +1 -1
- package/dist/returns.js.map +1 -1
- package/dist/returns.mjs +1 -1
- package/dist/{types-PSBBDdQm.d.mts → types-BnVWLcoB.d.mts} +13 -0
- package/dist/{types-BTm_ZolC.d.ts → types-i-IuN4Im.d.ts} +13 -0
- package/package.json +46 -45
- package/dist/CartProvider-5KAG5QGA.mjs +0 -2
- package/dist/CartProvider-7GJXW2IP.js +0 -2
- package/dist/CartProvider-7GJXW2IP.js.map +0 -1
- package/dist/chunk-45AP7UZE.mjs +0 -2
- package/dist/chunk-45AP7UZE.mjs.map +0 -1
- package/dist/chunk-7XTDFTQU.js +0 -4
- package/dist/chunk-7XTDFTQU.js.map +0 -1
- package/dist/chunk-C6Z7LOHB.mjs +0 -2
- package/dist/chunk-C6Z7LOHB.mjs.map +0 -1
- package/dist/chunk-HB6KQT26.mjs +0 -4
- package/dist/chunk-HB6KQT26.mjs.map +0 -1
- package/dist/chunk-LWK4E5G5.js +0 -2
- package/dist/chunk-LWK4E5G5.js.map +0 -1
- package/dist/chunk-OJT3YO2R.mjs +0 -2
- package/dist/chunk-OUYRKNZJ.mjs +0 -2
- package/dist/chunk-OUYRKNZJ.mjs.map +0 -1
- package/dist/chunk-P2YB25KZ.js +0 -2
- package/dist/chunk-P2YB25KZ.js.map +0 -1
- package/dist/chunk-T2POA6RW.js.map +0 -1
- package/dist/chunk-VPKE2ZOR.mjs +0 -2
- package/dist/chunk-VPKE2ZOR.mjs.map +0 -1
- package/dist/chunk-WRCXZMKK.js.map +0 -1
- package/dist/chunk-WSM4OM72.mjs +0 -2
- package/dist/chunk-WSM4OM72.mjs.map +0 -1
- package/dist/chunk-XRNTUSBH.js +0 -2
- package/dist/chunk-XRNTUSBH.js.map +0 -1
- package/dist/chunk-Z2BKIX6F.js +0 -2
- package/dist/chunk-Z2BKIX6F.js.map +0 -1
- package/dist/methods-ITD6WFIY.mjs +0 -2
- package/dist/methods-JENIGNF7.js +0 -2
- package/dist/methods-JENIGNF7.js.map +0 -1
- /package/dist/{CartProvider-5KAG5QGA.mjs.map → CartProvider-HXLGQ4EX.mjs.map} +0 -0
- /package/dist/{methods-ITD6WFIY.mjs.map → analytics.mjs.map} +0 -0
package/dist/chunk-7XTDFTQU.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 _chunkLWK4E5G5js = require('./chunk-LWK4E5G5.js');var _chunkXRNTUSBHjs = require('./chunk-XRNTUSBH.js');var _chunkWRCXZMKKjs = require('./chunk-WRCXZMKK.js');var _chunkZ2BKIX6Fjs = require('./chunk-Z2BKIX6F.js');var _react = require('@formkit/auto-animate/react');var _react3 = require('react'); var pn = _interopRequireWildcard(_react3); var st = _interopRequireWildcard(_react3);var _jsxruntime = require('react/jsx-runtime');function ie({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card",className:_chunkZ2BKIX6Fjs.a.call(void 0, "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function pe({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-header",className:_chunkZ2BKIX6Fjs.a.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 fe({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-title",className:_chunkZ2BKIX6Fjs.a.call(void 0, "leading-none font-semibold",e),...t})}function xt({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-description",className:_chunkZ2BKIX6Fjs.a.call(void 0, "text-muted-foreground text-sm",e),...t})}function se({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-content",className:_chunkZ2BKIX6Fjs.a.call(void 0, "px-6",e),...t})}var _inputotp = require('input-otp');var _lucidereact = require('lucide-react');function fn({className:e,containerClassName:t,...a}){return _jsxruntime.jsx.call(void 0, _inputotp.OTPInput,{"data-slot":"input-otp",containerClassName:_chunkZ2BKIX6Fjs.a.call(void 0, "flex items-center gap-2 has-disabled:opacity-50",t),className:_chunkZ2BKIX6Fjs.a.call(void 0, "disabled:cursor-not-allowed",e),...a})}function kt({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"input-otp-group",className:_chunkZ2BKIX6Fjs.a.call(void 0, "flex items-center",e),...t})}function xe({index:e,className:t,...a}){let n=pn.useContext(_inputotp.OTPInputContext),{char:r,hasFakeCaret:o,isActive:i}=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _2 => _2.slots, 'access', _3 => _3[e]]), () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{"data-slot":"input-otp-slot","data-active":i,className:_chunkZ2BKIX6Fjs.a.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),...a,children:[r,o&&_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 gn({...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 kr(){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 $=kr;var Nr="return_url",Nt="__return_url",Sr="accessToken";function Ge(e){let t=new URLSearchParams(e).get(Nr);return t?yn(t):null}function $e(e){typeof window>"u"||(e?window.sessionStorage.setItem(Nt,e):window.sessionStorage.removeItem(Nt))}function De(){if(typeof window>"u")return null;let e=window.sessionStorage.getItem(Nt);return e?yn(e):null}function Rr(e,t){return t.some(a=>{if(e===a)return!0;let n=new URL(a).hostname,r=new URL(e).hostname;return r.endsWith(`.${n}`)||r===n})}function yn(e){try{let t=new URL(e);return t.protocol!=="https:"&&t.protocol!=="http:"||!Rr(t.origin,_chunkXRNTUSBHjs.h.call(void 0, ))?null:t.toString()}catch (e2){return null}}function Le(e,t){let a=new URL(e);return a.searchParams.set(Sr,t),a.toString()}if(typeof window<"u"){let t=[window.location.origin,"https://bitsnap.pl","https://kursy.bitsnap.pl"];_chunkXRNTUSBHjs.h.call(void 0, ).length===0&&_chunkXRNTUSBHjs.g.call(void 0, Array.from(new Set(t)))}var Tr=({projectID:e,host:t,reveal:a,email:n,setEmail:r,loginUser:o,isLoginLoading:i,errMsg:l})=>{let{projectID:s,host:g}=_chunkXRNTUSBHjs.j.call(void 0, );if(typeof window<"u"&&_chunkXRNTUSBHjs.k.call(void 0, _nullishCoalesce(e, () => (s)),_nullishCoalesce(t, () => (g)))!=null)return window.location.href=window.location.href.replaceAll("login",""),null;let[m,C]=_react3.useState.call(void 0, !1),h=d=>/^(([^<>()\[\]\\.,;:\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(d.trim())?C(!0):C(!1),c=d=>{let{value:I}=d.target;h(I),r(I)};function u(){a()}function v(d){d.preventDefault(),o()}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:_chunkZ2BKIX6Fjs.a.call(void 0, "flex min-w-sm flex-col gap-6"),children:_jsxruntime.jsxs.call(void 0, ie,{children:[_jsxruntime.jsxs.call(void 0, pe,{children:[_jsxruntime.jsx.call(void 0, fe,{className:"text-2xl",children:"Zaloguj si\u0119"}),_jsxruntime.jsx.call(void 0, xt,{children:"Wy\u015Blemy do Ciebie kod na maila, dzi\u0119ki kt\xF3remu si\u0119 zalogujesz."})]}),_jsxruntime.jsx.call(void 0, se,{children:_jsxruntime.jsxs.call(void 0, "form",{onSubmit:v,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, _chunkLWK4E5G5js.a,{htmlFor:"email",children:"Email"}),_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.r,{id:"email",onChange:c,type:"email",placeholder:"m@example.com",required:!0}),_jsxruntime.jsx.call(void 0, "span",{className:_chunkZ2BKIX6Fjs.a.call(void 0, !m&&n.length>0?"font-bold text-red-500":"text-neutral-700 dark:text-neutral-400","text-xs"),children:!m&&n.length>0?"Nieprawid\u0142owy adres email":"Wpisz sw\xF3j adres email"})]}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, _chunkWRCXZMKKjs.q,{type:"submit",disabled:i,className:"relative w-full",onClick:o,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, $,{})}),"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:["Masz ju\u017C kod?"," ",_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:u,className:"underline underline-offset-4",children:"Mam ju\u017C kod"})]})]})})]})})})},Dr=({projectID:e,host:t,email:a,reveal:n,setEmail:r,isLoginLoading:o,loginUserResponse:i,setLoginUserResponse:l,setResponseStatus:s,errMsg:g})=>{let{mutateAsync:m,isPending:C}=_chunkWRCXZMKKjs.l.call(void 0, _chunkWRCXZMKKjs.j.publicApi.userPanelLoginWithCode),[h,c]=_react3.useState.call(void 0, ""),[u,v]=_react3.useState.call(void 0, !1),[d,I]=_react3.useState.call(void 0, !1),[w,M]=_react3.useState.call(void 0, 0),D=E=>/^\d+$/.test(E.trim())?v(!0):v(!1),_=E=>{D(E),c(E)};async function A(){if(I(!0),h.length==0){v(!1);return}let E=parseInt(h),J=await m({code:E}),ue,ve,y;if(J.result.case==="accessToken"?(v(!0),ue="ok",ve=void 0,y=J.result.value):(v(!1),ue="error",ve=J.result.value,y=void 0),ue==="error"&&(v(!1),console.warn("error:",`Kod b\u0142\u0119du: ${ve}`),console.warn("Nieprawid\u0142owy kod, spr\xF3buj ponownie.")),ue==="ok"){y&&_chunkXRNTUSBHjs.l.call(void 0, e,y,a,t);let G=typeof window<"u"?De():null;setTimeout(()=>{if(y&&G){window.location.href=Le(G,y);return}window.location.reload()},100)}}function q(){let E=setInterval(()=>{M(J=>J>0?J-1:(clearInterval(E),0))},1e3);return()=>{clearInterval(E)}}_react3.useEffect.call(void 0, ()=>{_optionalChain([i, 'optionalAccess', _4 => _4.status])==="ok"&&_optionalChain([i, 'optionalAccess', _5 => _5.retryIn])>0&&(M(i.retryIn),q())},[i]);function ke(){r(""),l(null),s("default"),n()}function de(E){E.preventDefault(),A()}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:_chunkZ2BKIX6Fjs.a.call(void 0, "flex min-w-sm flex-col gap-6"),children:_jsxruntime.jsxs.call(void 0, ie,{children:[_jsxruntime.jsxs.call(void 0, pe,{children:[_jsxruntime.jsx.call(void 0, fe,{className:"text-2xl",children:"Wpisz kod z maila"}),_jsxruntime.jsx.call(void 0, xt,{children:"Sprawd\u017A czy przypadkiem nie wyl\u0105dowa\u0142 w spamie."})]}),_jsxruntime.jsxs.call(void 0, se,{children:[_jsxruntime.jsxs.call(void 0, "form",{onSubmit:de,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, fn,{id:"verify-code",maxLength:6,pattern:_inputotp.REGEXP_ONLY_DIGITS,onChange:E=>{_(E)},children:[_jsxruntime.jsxs.call(void 0, kt,{children:[_jsxruntime.jsx.call(void 0, xe,{index:0}),_jsxruntime.jsx.call(void 0, xe,{index:1}),_jsxruntime.jsx.call(void 0, xe,{index:2})]}),_jsxruntime.jsx.call(void 0, gn,{}),_jsxruntime.jsxs.call(void 0, kt,{children:[_jsxruntime.jsx.call(void 0, xe,{index:3}),_jsxruntime.jsx.call(void 0, xe,{index:4}),_jsxruntime.jsx.call(void 0, xe,{index:5})]})]}),_jsxruntime.jsx.call(void 0, "span",{className:_chunkZ2BKIX6Fjs.a.call(void 0, !u&&d?"text-red-500":"text-neutral-700 dark:text-neutral-400","text-xs"),children:!u&&d?h.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, _chunkWRCXZMKKjs.q,{type:"submit",disabled:o||C,className:"relative w-full",children:[(o||C)&&_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, $,{})}),"Zaloguj si\u0119"]}),g.length>0&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs font-medium text-red-500",children:g})]})]}),_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:ke,className:"underline underline-offset-4",children:"Wr\xF3\u0107"})]})]})]})})})},Lr=()=>{let{theme:e,allowedReturnOrigins:t,projectID:a,host:n}=_chunkXRNTUSBHjs.j.call(void 0, ),r={"--button-background-color":_nullishCoalesce(_optionalChain([e, 'optionalAccess', _6 => _6.colors, 'optionalAccess', _7 => _7.brand]), () => ("#FFFFFF")),"--button-background-color-dark":_nullishCoalesce(_optionalChain([e, 'optionalAccess', _8 => _8.colors, 'optionalAccess', _9 => _9.brandDark]), () => ("#000000")),"--button-text-color":_nullishCoalesce(_optionalChain([e, 'optionalAccess', _10 => _10.colors, 'optionalAccess', _11 => _11.brandDark]), () => ("#000000")),"--button-text-color-dark":_nullishCoalesce(_optionalChain([e, 'optionalAccess', _12 => _12.colors, 'optionalAccess', _13 => _13.brand]), () => ("#FFFFFF"))},[o,i]=_react3.useState.call(void 0, "login"),[l]=_react.useAutoAnimate.call(void 0, {duration:300,easing:"ease-in-out",disrespectUserMotionPreference:!1}),s=()=>i(D=>D==="login"?"verifyCode":"login"),[g,m]=_react3.useState.call(void 0, ""),[C,h]=_react3.useState.call(void 0, "default"),[c,u]=_react3.useState.call(void 0, null),{mutateAsync:v,isPending:d}=_chunkWRCXZMKKjs.l.call(void 0, _chunkWRCXZMKKjs.j.publicApi.userPanelLogin),[I,w]=_react3.useState.call(void 0, "");_react3.useEffect.call(void 0, ()=>{if(typeof window>"u"||window.parent!==window)return;let D=Ge(window.location.search);D&&$e(D);let _=_nullishCoalesce(D, () => (De()));if(!_)return;let A=_chunkXRNTUSBHjs.k.call(void 0, a,n);A&&(window.location.href=Le(_,A))},[t,a,n]);async function M(){w(""),h("default");let D=await v({email:g}),_=D.result.case==="success"?"ok":"error",A=0,q;D.result.case==="success"&&(A=D.result.value.retryIn),_==="error"&&(q="Nieprawid\u0142owy adres email, spr\xF3buj ponownie."),u({status:_,retryIn:A,message:q}),_==="ok"&&o==="login"?s():_==="ok"&&o==="verifyCode"?h("success"):_==="error"&&w(_nullishCoalesce(q, () => ("Nieprawid\u0142owy adres email, spr\xF3buj ponownie.")))}return _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:r,ref:l,children:[_jsxruntime.jsxs.call(void 0, "header",{children:[_optionalChain([e, 'optionalAccess', _14 => _14.logoDarkURL])&&_jsxruntime.jsx.call(void 0, "img",{src:_optionalChain([e, 'optionalAccess', _15 => _15.logoDarkURL]),className:"hidden dark:inline",alt:"Company Logo",draggable:!1}),_optionalChain([e, 'optionalAccess', _16 => _16.logoURL])&&_jsxruntime.jsx.call(void 0, "img",{src:_optionalChain([e, 'optionalAccess', _17 => _17.logoURL]),className:"dark:hidden",alt:"Company Logo",draggable:!1})]}),o==="login"&&_jsxruntime.jsx.call(void 0, Tr,{projectID:a,host:n,reveal:s,email:g,setEmail:m,loginUser:M,isLoginLoading:d,errMsg:I}),o==="verifyCode"&&_jsxruntime.jsx.call(void 0, Dr,{projectID:a,host:n,email:g,reveal:s,setEmail:m,loginUser:M,isLoginLoading:d,loginUserResponse:c,setLoginUserResponse:u,responseStatus:C,setResponseStatus:h,errMsg:I})]})})},Er= exports.n =()=>_jsxruntime.jsx.call(void 0, Lr,{});function hn(e){let[t,a]=_react3.useState.call(void 0, ()=>{if(typeof window>"u")return e;let r=new URLSearchParams(window.location.search),o={};return Object.keys(e).forEach(i=>{let l=r.get(i);if(l!==null)try{o[i]=JSON.parse(l)}catch (e3){o[i]=l}}),{...e,...o}}),n=_react3.useCallback.call(void 0, r=>{a(o=>{let i={...o,...r};if(typeof window<"u"){let l=new URLSearchParams;Object.keys(i).forEach(g=>{let m=i[g];m!=null&&l.set(g,JSON.stringify(m))});let s=`${window.location.pathname}?${l.toString()}`;window.history.pushState({},"",s)}return i})},[]);return _react3.useEffect.call(void 0, ()=>{let r=()=>{let o=new URLSearchParams(window.location.search),i={};Object.keys(e).forEach(l=>{let s=o.get(l);if(s!==null)try{i[l]=JSON.parse(s)}catch (e4){i[l]=s}}),a({...e,...i})};return window.addEventListener("popstate",r),()=>window.removeEventListener("popstate",r)},[e]),[t,n]}function Pn(e,t){if(e!=null)return e;let a=_optionalChain([t, 'optionalAccess', _18 => _18.trim, 'call', _19 => _19()]);if(!(a==null||a===""))return{tokens:_chunkWRCXZMKKjs.t.call(void 0, a)}}var _reactswitch = require('@radix-ui/react-switch'); var at = _interopRequireWildcard(_reactswitch);function wn({className:e,...t}){return _jsxruntime.jsx.call(void 0, at.Root,{"data-slot":"switch",className:_chunkZ2BKIX6Fjs.a.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, at.Thumb,{"data-slot":"switch-thumb",className:_chunkZ2BKIX6Fjs.a.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 jr({}){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, wn,{id:"disable-all-notifications",checked:e.disableAll,onCheckedChange:a=>t(n=>({...n,disableAll:a}))}),_jsxruntime.jsxs.call(void 0, _chunkLWK4E5G5js.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 xn=jr;function kn({className:e,...t}){return _jsxruntime.jsx.call(void 0, "nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:_chunkZ2BKIX6Fjs.a.call(void 0, "mx-auto flex w-full justify-center",e),...t})}function Cn({className:e,...t}){return _jsxruntime.jsx.call(void 0, "ul",{"data-slot":"pagination-content",className:_chunkZ2BKIX6Fjs.a.call(void 0, "flex flex-row items-center gap-1",e),...t})}function ge({...e}){return _jsxruntime.jsx.call(void 0, "li",{"data-slot":"pagination-item",...e})}function Ee({className:e,isActive:t,size:a="icon",...n}){return _jsxruntime.jsx.call(void 0, "a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:_chunkZ2BKIX6Fjs.a.call(void 0, _chunkWRCXZMKKjs.p.call(void 0, {variant:t?"outline":"ghost",size:a}),e),...n})}function Nn({className:e,...t}){return _jsxruntime.jsxs.call(void 0, Ee,{"aria-label":"Go to previous page",size:"default",className:_chunkZ2BKIX6Fjs.a.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 Sn({className:e,...t}){return _jsxruntime.jsxs.call(void 0, Ee,{"aria-label":"Go to next page",size:"default",className:_chunkZ2BKIX6Fjs.a.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 Rt({className:e,...t}){return _jsxruntime.jsxs.call(void 0, "span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:_chunkZ2BKIX6Fjs.a.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 Gr=e=>new Date(e*1e3).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),$r=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase()}).format(e/100),Vr={draft:"Szkic",unpaid:"Nieop\u0142acona",paid:"Op\u0142acona",overdue:"Zaleg\u0142a",cancelled:"Anulowana",completed:"Zako\u0144czone",processing:"Przetwarzane",refunded:"Zwr\xF3cone"},Wr={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 Zr({openOrderDetails:e,projectID:t,accessToken:a}){let[n,r]=_react3.useState.call(void 0, 0),o=20,{data:i,isFetching:l}=_chunkWRCXZMKKjs.k.call(void 0, _chunkWRCXZMKKjs.j.publicApi.getOrders,{projectId:t,accessToken:a,offset:n,limit:o}),s=_nullishCoalesce(_optionalChain([i, 'optionalAccess', _20 => _20.orders]), () => ([])),g=_nullishCoalesce(_optionalChain([i, 'optionalAccess', _21 => _21.totalCount]), () => (0)),m=Math.floor(n/o)+1,C=Math.ceil(g/o),h=c=>{r(c)};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"}),l?_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 flex w-full flex-col gap-3",children:[...Array(5)].map((c,u)=>_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, _chunkWRCXZMKKjs.u,{className:"h-4 w-24"}),_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.u,{className:"h-3 w-32"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2 text-right",children:[_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.u,{className:"ml-auto h-4 w-16"}),_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.u,{className:"ml-auto h-3 w-12"})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-3",children:_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.u,{className:"h-3 w-40"})})]},u))}):s.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:s.map(c=>_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>e(c.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 #",c.id]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:c.customerName||"Klient"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-semibold",children:$r(c.totalAmount,c.currency)}),_jsxruntime.jsx.call(void 0, "p",{className:`text-xs font-medium ${_nullishCoalesce(Wr[c.status], () => ("text-neutral-400"))}`,children:_nullishCoalesce(Vr[c.status], () => (c.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:"," ",c.createdAt?Gr(Number(c.createdAt.seconds)):"-"]})})]},c.id))}),C>1&&!l&&_jsxruntime.jsx.call(void 0, "div",{className:"mt-4 flex justify-center",children:_jsxruntime.jsx.call(void 0, kn,{children:_jsxruntime.jsxs.call(void 0, Cn,{children:[m>1&&_jsxruntime.jsx.call(void 0, ge,{children:_jsxruntime.jsx.call(void 0, Nn,{onClick:()=>h(n-o)})}),m>2&&_jsxruntime.jsx.call(void 0, ge,{children:_jsxruntime.jsx.call(void 0, Ee,{onClick:()=>h(0),children:"1"})}),m>3&&_jsxruntime.jsx.call(void 0, ge,{children:_jsxruntime.jsx.call(void 0, Rt,{})}),[m-1,m,m+1].filter(c=>c>0&&c<=C).map(c=>_jsxruntime.jsx.call(void 0, ge,{children:_jsxruntime.jsx.call(void 0, Ee,{onClick:()=>h((c-1)*o),isActive:m===c,children:c})},c)),m<C-2&&_jsxruntime.jsx.call(void 0, ge,{children:_jsxruntime.jsx.call(void 0, Rt,{})}),m<C&&_jsxruntime.jsx.call(void 0, ge,{children:_jsxruntime.jsx.call(void 0, Ee,{onClick:()=>h((C-1)*o),children:C})}),m<C&&_jsxruntime.jsx.call(void 0, ge,{children:_jsxruntime.jsx.call(void 0, Sn,{onClick:()=>h(n+o)})})]})})})]})]})}var Rn=Zr;var An=e=>new Date(e*1e3).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),Kr={active:"Aktywny",cancelled:"Anulowany",paused:"Wstrzymany"},Qr={active:"text-green-600",cancelled:"text-red-500",paused:"text-yellow-500"};function Yr({projectID:e}){let[t,a]=_react3.useState.call(void 0, []),[n,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"}),n?_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(o=>_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:o.tierName}),o.configName&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500",children:o.configName})]}),_jsxruntime.jsx.call(void 0, "span",{className:`text-sm font-medium ${_nullishCoalesce(Qr[o.status], () => ("text-neutral-500"))}`,children:_nullishCoalesce(Kr[o.status], () => (o.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:"})," ",o.billingDay]}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Data startu:"})," ",An(o.startDate)]}),o.endDate&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Data zako\u0144czenia:"})," ",An(o.endDate)]})]})]},o.id))})]})}var Tn=Yr;function ta(e,t,a,n){typeof window>"u"||(t&&_chunkXRNTUSBHjs.n.call(void 0, a,n),window.location.href=e)}function na({projectID:e,host:t,loginURL:a,screen:n,params:r,setParams:o,setActiveScreen:i}){let{status:l,exchangeError:s}=_chunkLWK4E5G5js.j.call(void 0, "PanelReturns"),g=_chunkLWK4E5G5js.i.call(void 0, ),m=l==="anonymous"&&(s==null||_chunkLWK4E5G5js.g.call(void 0, s));_react3.useEffect.call(void 0, ()=>{m&&ta(a,s!=null,e,t)},[m,a,s,e,t]);let[C,h]=_react3.useState.call(void 0, "orders"),[c,u]=_react3.useState.call(void 0, {items:[],note:""}),[v,d]=_react3.useState.call(void 0, );if(l==="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:g(_chunkLWK4E5G5js.h.call(void 0, s))}),_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.q,{type:"button",onClick:()=>window.location.reload(),children:g("errorRetry")})]});if(l!=="authenticated")return _jsxruntime.jsx.call(void 0, _chunkLWK4E5G5js.s,{});let I=w=>{h(w),o({state:"returns",orderId:void 0,returnId:void 0}),i("returns")};if(n==="return-details"&&r.returnId)return _jsxruntime.jsx.call(void 0, _chunkLWK4E5G5js.A,{returnId:r.returnId,onBack:()=>I("myReturns")});if(C==="myReturns")return _jsxruntime.jsx.call(void 0, _chunkLWK4E5G5js.z,{onBack:()=>I("orders"),onSelectReturn:w=>{o({state:"return-details",returnId:w,orderId:void 0}),i("return-details")}});if(C==="result"&&v!=null)return _jsxruntime.jsx.call(void 0, _chunkLWK4E5G5js.y,{returnId:v,onContinue:()=>I("orders"),onOpenMyReturns:()=>I("myReturns")});if(r.orderId){let w=r.orderId;return C==="confirmation"?_jsxruntime.jsx.call(void 0, _chunkLWK4E5G5js.x,{orderId:w,items:c.items,note:c.note,onBack:()=>h("orders"),onSubmitted:M=>{d(M),u({items:[],note:""}),h("result"),o({orderId:void 0})}}):_jsxruntime.jsx.call(void 0, _chunkLWK4E5G5js.w,{orderId:w,initialItems:c.items.length>0?c.items:void 0,initialNote:c.note,onBack:()=>{u({items:[],note:""}),o({orderId:void 0})},onContinue:M=>{u(M),h("confirmation")}})}return _jsxruntime.jsx.call(void 0, _chunkLWK4E5G5js.v,{showLogout:!1,onSelectOrder:w=>{u({items:[],note:""}),h("orders"),o({orderId:w})},onOpenMyReturns:()=>I("myReturns")})}function Tt({accessToken:e,appearance:t,texts:a,...n}){return _jsxruntime.jsx.call(void 0, _chunkLWK4E5G5js.k,{projectID:n.projectID,host:n.host,appearance:t,texts:a,panelAccessToken:e,children:_jsxruntime.jsx.call(void 0, na,{...n})})}var aa=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g,oa=e=>[...e.matchAll(aa)].map(a=>({url:a[0],startIndex:a.index,endIndex:a.index+a[0].length-1})),ia=(e,t)=>{let a="",n=0;t.sort((r,o)=>r.startIndex-o.startIndex);for(let{startIndex:r,endIndex:o,replacementText:i}of t)a+=e.slice(n,r),a+=i,n=o+1;return a+=e.slice(n),a},Dn=e=>{let t=oa(e);return _jsxruntime.jsx.call(void 0, "p",{dangerouslySetInnerHTML:{__html:ia(e,t.map(a=>(a.replacementText=`<a key=${a.url} href=${a.url} style="text-decoration: underline;" target="_blank">
|
|
2
|
-
${a.url}
|
|
3
|
-
</a>`,a)))}})};var _protobuf = require('@bufbuild/protobuf');var _hlsjs = require('hls.js'); var _hlsjs2 = _interopRequireDefault(_hlsjs);function Ln(){typeof navigator>"u"||typeof navigator.mediaSession>"u"||(navigator.mediaSession.playbackState="playing")}function En(){typeof navigator>"u"||typeof navigator.mediaSession>"u"||(navigator.mediaSession.playbackState="paused")}function Un(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 zn(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 On(){navigator.mediaSession.metadata=null}var ma=_react3.forwardRef.call(void 0, ({chapters:e,styles:t,updateCurrentTime:a,setCurrentTimeHandler:n,title:r,imageURL:o,uniqueProductID:i,onChapterChange:l},s)=>{let g;(B=>(B[B.Playing=0]="Playing",B[B.Paused=1]="Paused"))(g||={});let[m,C]=_react3.useState.call(void 0, 1);_react3.useEffect.call(void 0, ()=>{switch(m){case 0:Ln();break;case 1:En();break}},[m]),_react3.useImperativeHandle.call(void 0, s,()=>({selectChapter:f=>{_e(f)}}));let[h,c]=_react3.useState.call(void 0, void 0),[u,v]=_react3.useState.call(void 0, void 0),d=_react3.useRef.call(void 0, null),I=_react3.useRef.call(void 0, void 0),w=_react3.useRef.call(void 0, void 0),M=_react3.useRef.call(void 0, null),D=_react3.useRef.call(void 0, null),[_,A]=_react3.useState.call(void 0, !0),[q,ke]=_react3.useState.call(void 0, !1),[de,E]=_react3.useState.call(void 0, !pa());function J(f){f<10||localStorage.setItem(`__player__${i}_${_optionalChain([D, 'access', _22 => _22.current, 'optionalAccess', _23 => _23.id])}`,`${f}`)}function ue(){let f=localStorage.getItem(`__player__${i}_${_optionalChain([D, 'access', _24 => _24.current, 'optionalAccess', _25 => _25.id])}`);if(f!=null)try{let U=parseInt(f);return isNaN(U)||U<0?void 0:U}catch (e5){return}}function ve(){let f=localStorage.getItem(`__player__${i}_last_chapter`);if(f!=null)return f}function y(f){localStorage.setItem(`__player__${i}_last_chapter`,f)}function G(f){localStorage.removeItem(`__player__${i}_${f}`)}function Ce(){d.current!=null&&(d.current.onloadeddata=()=>{if(d.current!=null){if(d.current.readyState<2&&E(!0),d.current.readyState>=2&&E(!1),!q){let f=ue();f!=null&&nt(f),ke(!0)}if(_){A(!1);try{ft()}catch(f){console.log("play error",f)}}}},d.current.onplay=()=>{},d.current.onseeked=()=>{},d.current.onseeking=()=>{},d.current.onpause=()=>{},d.current.onended=()=>{Ne()},zn({title:_nullishCoalesce(r, () => ("")),artwork:o,action:f=>{switch(f.action){case"play":ft();break;case"pause":gt();break;case"seekbackward":tt(-15);break;case"seekforward":tt(15);break;case"seekto":f.seekTime&&nt(f.seekTime);break;case"stop":gt();break;default:break}}}),Xe())}function Ne(){if(e==null||e.length==0)return;let f=e.findIndex(B=>B.id==_optionalChain([D, 'access', _26 => _26.current, 'optionalAccess', _27 => _27.id]));f==-1||(G(e[f].id),f+1>=e.length)||_e(e[f+1])}function Xe(){et(),w.current==null&&(w.current=setTimeout(()=>{et(),w.current=void 0,Xe()},500))}function ho(){w.current!=null&&clearTimeout(w.current)}function et(){d.current!=null&&(C(d.current.paused?1:0),v(d.current.duration),c(d.current.currentTime),J(d.current.currentTime),Un(d.current.duration,d.current.currentTime),d.current.networkState===d.current.NETWORK_LOADING&&d.current.readyState<=d.current.HAVE_FUTURE_DATA?E(!0):E(!1),a&&a(d.current.currentTime))}function ft(){_optionalChain([d, '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()]),et()}function gt(){_optionalChain([d, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.pause, 'call', _37 => _37()]),et()}function pr(){if(m===0){gt();return}ft()}function tt(f){if(d.current==null)return;let U=d.current.currentTime+f;if(U<0){d.current.currentTime=0;return}if(U>d.current.duration){d.current.currentTime=d.current.duration;return}d.current.currentTime+=f}function nt(f){if(d.current!=null){if(c(f),f<0){d.current.currentTime=0;return}if(f>d.current.duration){d.current.currentTime=d.current.duration;return}d.current.currentTime=f}}function fr(){d.current!=null&&(d.current.onplay=null,d.current.onseeked=null,d.current.onseeking=null,d.current.onpause=null,d.current.onended=null,d.current.src="",_optionalChain([I, 'access', _38 => _38.current, 'optionalAccess', _39 => _39.destroy, 'call', _40 => _40()]))}function Gt(f){if(f.length==0)return;let U=ve();if(U==null){_e(f[0]);return}let B=f.find(Se=>Se.id==U);if(B==null){_e(f[0]);return}_e(B)}function _e(f){ke(!1),A(!0),D.current=f,gr(f.publicUrl),_optionalChain([l, 'optionalCall', _41 => _41(f)]),y(f.id)}function gr(f){d.current!=null&&(d.current.canPlayType("application/vnd.apple.mpegurl")?d.current.src=f:_hlsjs2.default.isSupported()&&(I.current==null&&(I.current=new _hlsjs2.default,_optionalChain([I, 'access', _42 => _42.current, 'optionalAccess', _43 => _43.attachMedia, 'call', _44 => _44(d.current)])),_optionalChain([I, 'access', _45 => _45.current, 'optionalAccess', _46 => _46.loadSource, 'call', _47 => _47(f)])))}_react3.useEffect.call(void 0, ()=>{d.current!=null&&(Ce(),Gt(e))},[d.current]),_react3.useEffect.call(void 0, ()=>{Gt(e)},[e]),_react3.useEffect.call(void 0, ()=>(_optionalChain([n, 'optionalCall', _48 => _48(nt)]),()=>{c(void 0),_optionalChain([d, 'access', _49 => _49.current, 'optionalAccess', _50 => _50.pause, 'call', _51 => _51()]),fr(),On()}),[]);let $t=f=>{let U=Math.floor(f/3600),B=Math.floor(f/60)%60,Se=Math.floor(f%60),br=U>0?U<10?`0${U}:`:`${U}:`:"",hr=Se<10?`0${Se}`:`${Se}`;return isNaN(Se)||isNaN(B)||isNaN(U)?"":`${br}${B}:${hr}`},yr=f=>{let U=parseFloat(f.value)/parseFloat(f.max)*100;M.current.style.setProperty("--seek-before-width",U+"%");let B=u*U/100;nt(B)};return _jsxruntime.jsxs.call(void 0, "div",{id:"audio-player-container",className:"flex flex-col",style:t,ref:M,children:[_jsxruntime.jsx.call(void 0, "video",{ref:d,className:"hidden",poster:o,title:r}),_jsxruntime.jsx.call(void 0, "input",{type:"range",min:"0",max:u!=null?Math.floor(u).toString():100,value:_nullishCoalesce(h, () => (0)),onChange:f=>yr(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:$t(h)}),_jsxruntime.jsx.call(void 0, "span",{id:"duration",children:$t(u)})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mt-6 flex items-center justify-center gap-x-12",children:[_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.q,{variant:"outline",onClick:()=>tt(-10),"aria-label":"Rewind 10 Seconds",children:"-10"}),_jsxruntime.jsxs.call(void 0, _chunkWRCXZMKKjs.q,{variant:"outline",onClick:pr,"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, _chunkWRCXZMKKjs.q,{variant:"outline",onClick:()=>tt(10),"aria-label":"Fast Forward 10 Seconds",children:"+10"})]}),de&&_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 flex w-full justify-center",children:_jsxruntime.jsx.call(void 0, $,{})})]})});function pa(){return navigator.userAgent.toLowerCase().indexOf("safari/")>-1}var jn=ma;var fa={pl:{returnsNavLabel:"Zwroty",openCourse:"Otw\xF3rz kurs"},en:{returnsNavLabel:"Returns",openCourse:"Open the course"}};function Ze(e=_chunkZ2BKIX6Fjs.j.call(void 0, )){return _chunkZ2BKIX6Fjs.e.call(void 0, fa,e)}function Fn(){let[e,t]=st.useState(13);return st.useEffect(()=>{let a=setTimeout(()=>t(66),500);return()=>clearTimeout(a)},[]),_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 le(e,...t){console.warn(e,...t)}function Dt(e){console.error(e)}var ba=({accessToken:e,product:t,styles:a,reveal:n,onOpenCourse:r})=>{let o=t.productType,i=_react3.useRef.call(void 0, null),[l]=_react.useAutoAnimate.call(void 0, ),[s,g]=_react3.useState.call(void 0, null),{mutateAsync:m,isPending:C}=_chunkWRCXZMKKjs.l.call(void 0, _chunkWRCXZMKKjs.j.publicApi.userPanelGetFileDetails),h=_react3.useRef.call(void 0, void 0),[c,u]=_react3.useState.call(void 0, null),[v,d]=_react3.useState.call(void 0, null),[I,w]=_react3.useState.call(void 0, !1),{mutateAsync:M,isPending:D}=_chunkWRCXZMKKjs.l.call(void 0, _chunkWRCXZMKKjs.j.publicApi.userPanelGetAudiobookDetails),{mutateAsync:_,isPending:A}=_chunkWRCXZMKKjs.l.call(void 0, _chunkWRCXZMKKjs.j.publicApi.userPanelGetAudiobookDetailsDownloadURLs),[q,ke]=_react3.useState.call(void 0, null),[de,E]=_react3.useState.call(void 0, null);async function J(){try{let y=await m({accessId:t.accessId,accessToken:e});if(y.result.case==="success"){g(y.result.value.files);return}else le("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),le("Kod b\u0142\u0119du: ",y.result.value)}catch(y){le("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),Dt("B\u0142\u0105d podczas pobierania danych:"+y)}}async function ue(){try{let y=await M({accessId:t.accessId,accessToken:e});if(y.result.case==="audiobook"){u(y.result.value);return}else le("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),le("Kod b\u0142\u0119du: ",y.result.value)}catch(y){le("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),Dt("B\u0142\u0105d podczas pobierania danych:"+y)}}async function ve(){try{let y=await _({accessId:t.accessId,accessToken:e,isBrowser:!0});if(y.result.case==="success"){d(y.result.value.audiobookDownloadDetails),w(y.result.value.isAvailableToDownloadInMobileApp===!0);return}else le("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),le("Kod b\u0142\u0119du: ",y.result.value)}catch(y){le("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),Dt("B\u0142\u0105d podczas pobierania danych:"+y)}}return _react3.useEffect.call(void 0, ()=>{o===1&&(ue().then().catch(),ve().then().catch())},[]),_react3.useEffect.call(void 0, ()=>{if(c!=null&&v!=null){let y=c.chapters;if(!y)return;let G=y.map(Ce=>{let Ne=_optionalChain([v, 'optionalAccess', _52 => _52.find, 'call', _53 => _53(Xe=>Xe.chapterId===Ce.id)]);if(Ne!=null)return{...Ce,publicUrl:Ne.publicUrl,downloadableUrl:Ne.downloadableUrl,duration:Ne.duration}}).filter(Ce=>Ce!=null);G!=null&&G.length>0&&E(G)}},[c,v]),_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, _chunkWRCXZMKKjs.q,{onClick:()=>n(),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:[o===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"}),(s==null||s.length==0)&&_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.q,{onClick:J,"aria-label":"Download Product",className:"text-sm font-medium transition-opacity duration-300 ease-in-out hover:opacity-80 active:opacity-80",style:a,children:C?_jsxruntime.jsx.call(void 0, $,{}):"Wy\u015Bwietl"})]}),C&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-2",children:[_jsxruntime.jsx.call(void 0, Fn,{}),_jsxruntime.jsx.call(void 0, "p",{className:"font-bold transition hover:text-blue-600",children:"Trwa przygotowanie plik\xF3w..."})]}),s!=null&&s.length>0&&_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-start justify-start gap-2",children:s.map((y,G)=>_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:y,download:!0,children:[`Plik numer ${G+1}`,_jsxruntime.jsx.call(void 0, _lucidereact.Download,{width:14,height:14})]},G))})]}),o===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, _chunkWRCXZMKKjs.q,{onClick:()=>r(t.accessId),className:"text-sm font-medium transition-opacity duration-300 ease-in-out hover:opacity-80 active:opacity-80",style:a,children:Ze().openCourse})}),o===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([q, 'optionalAccess', _54 => _54.name]), () => ("Odtwarzacz"))}),_optionalChain([q, 'optionalAccess', _55 => _55.description])&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",children:_optionalChain([q, 'optionalAccess', _56 => _56.description])}),_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:D?_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, $,{}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xl font-semibold",children:"Trwa pobierania audiobooka..."})]}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:de!=null?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:_jsxruntime.jsx.call(void 0, jn,{ref:i,chapters:de,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:a,setCurrentTimeHandler:y=>{h.current=y},uniqueProductID:t.productId,onChapterChange:y=>{ke(y)}})}):_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:I?"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:o===1&&_jsxruntime.jsx.call(void 0, "div",{className:"max-h-96 w-full overflow-y-auto",children:D?_jsxruntime.jsxs.call(void 0, "div",{className:"jusitfy-center flex flex-col items-center gap-2",children:[_jsxruntime.jsx.call(void 0, $,{}),_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"}),de==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:de.map((y,G)=>_jsxruntime.jsxs.call(void 0, "li",{className:"flex items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "button",{className:_chunkZ2BKIX6Fjs.a.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([q, 'optionalAccess', _59 => _59.id])==y.id?"bg-neutral-200 dark:bg-neutral-700":"bg-neutral-100 dark:bg-neutral-800 dark:text-neutral-300"),onClick:()=>{i.current.selectChapter(y)},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:y.name}),y.duration&&_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs text-neutral-500",children:[Math.floor(y.duration/60),":",String(Math.floor(y.duration%60)).padStart(2,"0")]})]}),y.description&&_jsxruntime.jsx.call(void 0, "p",{className:"mt-3 text-xs",children:y.description})]}),c&&c.isDownloadable&&y.downloadableUrl&&_jsxruntime.jsx.call(void 0, "a",{href:y.downloadableUrl,children:_jsxruntime.jsx.call(void 0, _lucidereact.Download,{width:14,height:14})})]},G))})]})})})]}),_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})]})]})]})},Gn=ba;var wa=({accessToken:e,projectID:t,loginURL:a,styles:n,activeScreen:r,params:o,setParams:i,openCourse:l})=>{let{data:s,isLoading:g}=_chunkWRCXZMKKjs.k.call(void 0, _chunkWRCXZMKKjs.j.publicApi.userPanelGetProducts,{accessToken:e});if(g)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:"\u0141adowanie..."}),_jsxruntime.jsx.call(void 0, $,{})]});if(s&&s.result.case==="failure")return console.warn("error:",`Kod b\u0142\u0119du: ${s.result.value}`),_chunkXRNTUSBHjs.n.call(void 0, t),window.location.href=a,null;let m=s&&s.result.case==="success"?s.result.value.products:[];return _jsxruntime.jsx.call(void 0, xa,{accessToken:e,products:m,styles:n,loginURL:a,activeScreen:r,params:o,setParams:i,openCourse:l})},$n=wa,xa=({accessToken:e,products:t,styles:a,loginURL:n,activeScreen:r,params:o,setParams:i,openCourse:l})=>{if(t.length===0)return window.location.href=n,null;let[s,g]=_react3.useState.call(void 0, o.product?_protobuf.fromJsonString.call(void 0, _chunkWRCXZMKKjs.e,o.product):void 0),m=c=>{c==null?(g(void 0),i({product:void 0,state:"products"})):i({product:_protobuf.toJsonString.call(void 0, _chunkWRCXZMKKjs.e,c),state:"products"})};function C(c){switch(c){case 1:return"Audio";case 2:return"Plik";case 3:return"Bilet";case 4:return"Kurs";default:return}}function h(c){if(c.productType===4){l(c.accessId);return}g(c),m(c)}return r==="products"&&s!=null?_jsxruntime.jsx.call(void 0, Gn,{accessToken:e,product:s,styles:a,reveal:m,onOpenCourse:l}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:"Hej \u{1F44B}"}),_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', _60 => _60.map, 'call', _61 => _61((c,u)=>_jsxruntime.jsxs.call(void 0, "section",{onClick:()=>h(c),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:[c.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:C(c.productType)})}),_jsxruntime.jsx.call(void 0, "div",{className:"jusitfy-center flex max-h-40 items-center",children:_jsxruntime.jsx.call(void 0, "img",{src:c.productImageUrl,alt:`Product ${u} 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:c.productName}),_jsxruntime.jsx.call(void 0, "p",{title:c.productDescription,className:"line-clamp-3 text-sm font-normal text-neutral-600 dark:text-neutral-300",children:Dn(c.productDescription)}),_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.q,{onClick:v=>{v.stopPropagation(),h(c)},className:"w-full text-sm font-medium transition-opacity duration-300 ease-in-out hover:opacity-80 active:opacity-80",style:a,children:"Zobacz"})]})]},u))])})]})};function Ra({activeScreen:e,setActiveScreen:t,setParams:a,styles:n,theme:r,logout:o}){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, Ia,{activeScreen:e,setActiveScreen:t,setParams:a}),_jsxruntime.jsx.call(void 0, Aa,{activeScreen:e,setActiveScreen:t,setParams:a,theme:r,logout:o})]})}var Zn=Ra;function Ia({activeScreen:e,setActiveScreen:t,setParams:a}){let{returnsNavLabel:n}=Ze();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, ct,{panelScreen:"products",label:"Produkty",imageURL:"/icons/bitsnap-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:a}),_jsxruntime.jsx.call(void 0, ct,{panelScreen:"orders",label:"Faktury",imageURL:"/icons/category-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:a}),_jsxruntime.jsx.call(void 0, ct,{panelScreen:"returns",label:n,icon:_jsxruntime.jsx.call(void 0, _lucidereact.Undo2,{className:"h-5 w-5 text-white","aria-hidden":!0}),activeScreen:e,setActiveScreen:t,setParams:a}),_jsxruntime.jsx.call(void 0, ct,{panelScreen:"profile",label:"Profil",imageURL:"/icons/profile-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:a})]})}function ct({panelScreen:e,label:t,imageURL:a,icon:n,activeScreen:r,setActiveScreen:o,setParams:i}){return _jsxruntime.jsxs.call(void 0, _chunkWRCXZMKKjs.q,{onClick:()=>{o(e),i({product:void 0,state:e})},"aria-label":t,variant:null,className:_chunkZ2BKIX6Fjs.a.call(void 0, "flex flex-col gap-0",r===e?"opacity-100":"opacity-50"),children:[_nullishCoalesce(n, () => (_jsxruntime.jsx.call(void 0, "img",{src:a,alt:t,className:"scale-75"}))),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-normal text-white",children:t})]})}function dt({panelScreen:e,label:t,imageURL:a,darkImageURL:n,icon:r,activeScreen:o,setActiveScreen:i,setParams:l,isExpanded:s}){return _jsxruntime.jsxs.call(void 0, _chunkWRCXZMKKjs.q,{onClick:()=>{i(e),l({product:void 0,state:e})},variant:o===e?"secondary":"ghost",className:"justify-start",children:[r!=null?_jsxruntime.jsx.call(void 0, "span",{className:_chunkZ2BKIX6Fjs.a.call(void 0, "inline-flex h-5 w-5 items-center justify-center",s?"mr-4":"mr-2"),children:r}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "img",{src:a,alt:t,className:_chunkZ2BKIX6Fjs.a.call(void 0, "aspect-auto h-5 w-5 dark:hidden",s?"mr-4":"mr-2")}),_jsxruntime.jsx.call(void 0, "img",{src:n,alt:t,className:_chunkZ2BKIX6Fjs.a.call(void 0, "hidden aspect-auto h-5 w-5 dark:inline",s?"mr-4":"mr-2")})]}),s&&_jsxruntime.jsx.call(void 0, "span",{className:"md:text-medium hidden md:inline",children:t})]})}function Aa({activeScreen:e,setActiveScreen:t,setParams:a,theme:n,logout:r}){let[o]=_react.useAutoAnimate.call(void 0, ),[i,l]=_react3.useState.call(void 0, !0),{returnsNavLabel:s}=Ze();return _jsxruntime.jsxs.call(void 0, "div",{ref:o,className:_chunkZ2BKIX6Fjs.a.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, Ta,{theme:n,isExpanded:i})}),_jsxruntime.jsx.call(void 0, Vn,{className:"my-6"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-1 flex-col gap-2",children:[_jsxruntime.jsx.call(void 0, dt,{panelScreen:"products",label:"Produkty",imageURL:"/icons/bitsnap-dark-24x24.svg",darkImageURL:"/icons/bitsnap-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:a,isExpanded:i}),_jsxruntime.jsx.call(void 0, dt,{panelScreen:"orders",label:"Zam\xF3wienia",imageURL:"/icons/category-dark-24x24.svg",darkImageURL:"/icons/category-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:a,isExpanded:i}),_jsxruntime.jsx.call(void 0, dt,{panelScreen:"returns",label:s,icon:_jsxruntime.jsx.call(void 0, _lucidereact.Undo2,{className:"h-5 w-5","aria-hidden":!0}),activeScreen:e,setActiveScreen:t,setParams:a,isExpanded:i}),_jsxruntime.jsx.call(void 0, dt,{panelScreen:"profile",label:"Profil",imageURL:"/icons/profile-dark-24x24.svg",darkImageURL:"/icons/profile-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:a,isExpanded:i})]}),_jsxruntime.jsx.call(void 0, Vn,{className:"mb-6"}),_jsxruntime.jsxs.call(void 0, _chunkWRCXZMKKjs.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 Vn({className:e}){return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkZ2BKIX6Fjs.a.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 Ta({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', _62 => _62.logoDarkURL])||_optionalChain([e, 'optionalAccess', _63 => _63.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', _64 => _64.logoURL])&&_jsxruntime.jsx.call(void 0, "img",{src:e.logoURL,alt:"Company Logo",className:"h-6 w-6 dark:hidden",draggable:!1})]})}function La({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, _chunkWRCXZMKKjs.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 Kn=La;var Oa=_react3.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./course.js"))).then(e=>({default:e.PanelCourse})));function Et(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, $,{})}),children:_jsxruntime.jsx.call(void 0, Oa,{...e})})}function _a({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}},a=t[e]||t.created,n=a.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 ${a.color}`,children:[n&&_jsxruntime.jsx.call(void 0, n,{className:"h-4 w-4"}),r[e]||e]})}function Fa({orderID:e,email:t}){let[a,n]=_react3.useState.call(void 0, ""),r=_chunkWRCXZMKKjs.l.call(void 0, _chunkWRCXZMKKjs.j.publicApi.addPublicOrderComment);return _jsxruntime.jsxs.call(void 0, "form",{onSubmit:async i=>{if(i.preventDefault(),!!a.trim())try{await r.mutateAsync({projectId:"",orderId:e,message:a.trim(),accessToken:t}),n("")}catch(l){console.error("Failed to add comment:",l)}},className:"mt-4 space-y-2",children:[_jsxruntime.jsx.call(void 0, _chunkLWK4E5G5js.a,{htmlFor:"comment",children:"Dodaj komentarz"}),_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.v,{id:"comment",value:a,onChange:i=>n(i.target.value),placeholder:"Wpisz komentarz...",rows:3,disabled:r.isPending}),_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.q,{type:"submit",disabled:!a.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 Xn(e){return e?new Date(Number(e.seconds)*1e3).toLocaleDateString("pl-PL",{year:"numeric",month:"long",day:"numeric"}):"N/A"}function er(e,t){return new Intl.NumberFormat("pl-PL",{style:"currency",currency:t.toUpperCase()}).format(e/100)}function qa({orderID:e,initialEmail:t,onBack:a,accessToken:n}){let{theme:r,projectID:o}=_chunkXRNTUSBHjs.j.call(void 0, ),[i,l]=_react3.useState.call(void 0, t||""),[s,g]=_react3.useState.call(void 0, !1),{data:m,isLoading:C,error:h,refetch:c}=_chunkWRCXZMKKjs.k.call(void 0, _chunkWRCXZMKKjs.j.publicApi.getPublicOrderDetails,{projectId:_nullishCoalesce(o, () => ("")),orderId:e,email:i||void 0,accessToken:n},{enabled:!!e}),u=_optionalChain([m, 'optionalAccess', _65 => _65.result, 'access', _66 => _66.case])==="order"?m.result.value:null,v=_nullishCoalesce(_optionalChain([u, 'optionalAccess', _67 => _67.isVerified]), () => (!1)),d=()=>{c(),g(!1)},I={"--button-background-color":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _68 => _68.colors, 'optionalAccess', _69 => _69.brand]), () => ("#000000")),"--button-background-color-dark":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _70 => _70.colors, 'optionalAccess', _71 => _71.brandDark]), () => ("#ffffff")),"--button-text-color":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _72 => _72.colors, 'optionalAccess', _73 => _73.brandDark]), () => ("#000000")),"--button-text-color-dark":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _74 => _74.colors, 'optionalAccess', _75 => _75.brand]), () => ("#000000"))};return C?_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..."})]})}):h||!u?_jsxruntime.jsx.call(void 0, "div",{className:"flex min-h-screen items-center justify-center",children:_jsxruntime.jsx.call(void 0, ie,{className:"w-full max-w-md",children:_jsxruntime.jsx.call(void 0, se,{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:I,children:_jsxruntime.jsxs.call(void 0, "div",{className:"w-full px-4",children:[a&&_jsxruntime.jsxs.call(void 0, _chunkWRCXZMKKjs.q,{onClick:a,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([r, 'optionalAccess', _76 => _76.logoURL])&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "img",{src:r.logoURL,alt:"Project logo",className:`h-12 w-auto ${r.logoDarkURL?"dark:hidden":""}`}),r.logoDarkURL&&_jsxruntime.jsx.call(void 0, "img",{src:r.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: #",u.orderId]})]})]}),_jsxruntime.jsxs.call(void 0, ie,{className:"mb-6",children:[_jsxruntime.jsx.call(void 0, pe,{children:_jsxruntime.jsxs.call(void 0, fe,{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, se,{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, _a,{status:u.status}),u.processingStatus&&_jsxruntime.jsxs.call(void 0, "span",{className:"text-sm text-neutral-600",children:["\xB7 ",u.processingStatus]})]}),_jsxruntime.jsxs.call(void 0, "p",{className:"mt-2 text-sm text-neutral-600",children:["Zam\xF3wienie z\u0142o\u017Cone ",Xn(u.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:v?"":"text-neutral-500",children:u.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:v?"":"text-neutral-500",children:u.customerEmail})]}),u.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:v?"":"text-neutral-500",children:u.customerPhone})]})]})]}),!v&&_jsxruntime.jsx.call(void 0, "div",{className:"border-t pt-4",children:_jsxruntime.jsxs.call(void 0, _chunkWRCXZMKKjs.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, ie,{className:"mb-6",children:[_jsxruntime.jsx.call(void 0, pe,{children:_jsxruntime.jsx.call(void 0, fe,{children:"Produkty"})}),_jsxruntime.jsxs.call(void 0, se,{className:"space-y-6",children:[_jsxruntime.jsx.call(void 0, "div",{className:"space-y-4",children:u.items.map((w,M)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-4",children:[w.imageUrl&&_jsxruntime.jsx.call(void 0, "img",{src:w.imageUrl,alt:w.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:w.name}),_jsxruntime.jsxs.call(void 0, "p",{className:"text-sm text-neutral-600",children:["Ilo\u015B\u0107: ",w.quantity]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"text-right",children:_jsxruntime.jsx.call(void 0, "p",{className:"font-medium",children:er(Number(w.price),w.currency)})})]},M))}),(u.deliveryAddress||u.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:[u.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:v?"":"text-neutral-500",children:u.deliveryAddress})]}),u.deliveryMethod&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Metoda:"})," ",u.deliveryMethod]}),u.trackingNumber&&v&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Tracking:"})," ",u.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:er(Number(u.totalAmount),u.currency)})]})})]})]}),_jsxruntime.jsxs.call(void 0, ie,{children:[_jsxruntime.jsx.call(void 0, pe,{children:_jsxruntime.jsxs.call(void 0, fe,{children:["Komentarze ",u.commentCount>0&&`(${u.commentCount})`]})}),_jsxruntime.jsxs.call(void 0, se,{children:[u.comments.length>0?_jsxruntime.jsx.call(void 0, "div",{className:"space-y-4",children:u.comments.map(w=>_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:w.authorName||"System"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs text-neutral-500",children:Xn(w.createdAt)}),w.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:v?"":"text-neutral-500",children:w.message})]},w.id))}):_jsxruntime.jsx.call(void 0, "p",{className:"text-neutral-600",children:"Brak komentarzy."}),v?_jsxruntime.jsx.call(void 0, Fa,{orderID:u.orderId,email:i}):_jsxruntime.jsx.call(void 0, "div",{className:"mt-4",children:_jsxruntime.jsxs.call(void 0, _chunkWRCXZMKKjs.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"]})})]})]}),s&&_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, ie,{className:"w-full max-w-md",children:[_jsxruntime.jsx.call(void 0, pe,{children:_jsxruntime.jsx.call(void 0, fe,{children:"Zweryfikuj sw\xF3j email"})}),_jsxruntime.jsxs.call(void 0, se,{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, _chunkLWK4E5G5js.a,{htmlFor:"verify-email",children:"Adres email"}),_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.r,{id:"verify-email",type:"email",placeholder:"twoj@email.com",value:i,onChange:w=>l(w.target.value)})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.q,{variant:"outline",onClick:()=>g(!1),className:"flex-1",children:"Anuluj"}),_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.q,{onClick:d,className:"flex-1",children:"Zweryfikuj"})]})]})]})})]})})}function Ba(e){return _jsxruntime.jsx.call(void 0, qa,{...e})}var Ot=Ba;var $a=({returnsAppearance:e,returnsTexts:t}={})=>{let{projectID:a,theme:n,loginURL:r,host:o}=_chunkXRNTUSBHjs.j.call(void 0, ),i=_chunkXRNTUSBHjs.k.call(void 0, a,o),l=_chunkXRNTUSBHjs.m.call(void 0, a,o),{mutateAsync:s}=_chunkWRCXZMKKjs.l.call(void 0, _chunkWRCXZMKKjs.j.publicApi.userPanelLogout);async function g(){i&&await s({accessToken:i}),typeof window<"u"&&(_chunkXRNTUSBHjs.n.call(void 0, a,o),window.location.reload())}let[m]=_react.useAutoAnimate.call(void 0, ),C=A=>["products","notifications","profile","plans","orders","order-details","returns","return-details","course"].includes(A),[h,c]=hn({product:void 0,state:"products",orderId:void 0,returnId:void 0,course:void 0,item:void 0}),[u,v]=_react3.useState.call(void 0, C(h.state)?h.state:"products"),d=A=>{c({state:"order-details",orderId:A}),v("order-details")},I=()=>{c({state:"orders",orderId:void 0}),v("orders")},w=A=>c({orderId:void 0,returnId:void 0,course:void 0,item:void 0,...A}),M=A=>{c({state:"course",course:A,item:void 0,product:void 0}),v("course")},D=()=>{c({state:"products",course:void 0,item:void 0,product:void 0}),v("products")};_react3.useEffect.call(void 0, ()=>{C(h.state)&&(h.state==="course"||u==="course")&&v(h.state)},[h.state]);let _={"--button-background-color":_nullishCoalesce(_optionalChain([n, 'optionalAccess', _77 => _77.colors, 'optionalAccess', _78 => _78.brand]), () => ("#000000")),"--button-background-color-dark":_nullishCoalesce(_optionalChain([n, 'optionalAccess', _79 => _79.colors, 'optionalAccess', _80 => _80.brandDark]), () => ("#ffffff")),"--button-text-color":_nullishCoalesce(_optionalChain([n, 'optionalAccess', _81 => _81.colors, 'optionalAccess', _82 => _82.brandDark]), () => ("#000000")),"--button-text-color-dark":_nullishCoalesce(_optionalChain([n, 'optionalAccess', _83 => _83.colors, 'optionalAccess', _84 => _84.brand]), () => ("#000000"))};return _react3.useEffect.call(void 0, ()=>{if(i==null||i.length===0){window.location.href=_nullishCoalesce(r, () => ("/panel/login"));return}},[]),_react3.useEffect.call(void 0, ()=>{if(i==null||i.length===0){window.location.href=_nullishCoalesce(r, () => ("/panel/login"));return}},[u]),_react3.useEffect.call(void 0, ()=>{if(typeof window>"u"||window.parent!==window||!i)return;let A=Ge(window.location.search);A&&$e(A);let q=_nullishCoalesce(A, () => (De()));q&&(window.location.href=Le(q,i))},[i]),_jsxruntime.jsxs.call(void 0, "div",{ref:m,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, Zn,{activeScreen:u,setActiveScreen:v,setParams:w,styles:_,theme:n,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:[u==="products"&&_jsxruntime.jsx.call(void 0, $n,{projectID:_nullishCoalesce(a, () => ("")),accessToken:i,loginURL:_nullishCoalesce(r, () => ("/panel/login")),styles:_,activeScreen:u,params:h,setParams:c,openCourse:M}),u==="course"&&h.course&&i&&_jsxruntime.jsx.call(void 0, Et,{accessId:h.course,accessToken:i,theme:n,itemId:h.item,onItemChange:A=>c({item:A}),onBack:D}),u==="notifications"&&_jsxruntime.jsx.call(void 0, xn,{}),u==="plans"&&_jsxruntime.jsx.call(void 0, Tn,{projectID:_nullishCoalesce(a, () => (""))}),u==="orders"&&_jsxruntime.jsx.call(void 0, Rn,{projectID:_nullishCoalesce(a, () => ("")),accessToken:_nullishCoalesce(i, () => ("")),openOrderDetails:d}),u==="order-details"&&h.orderId&&_jsxruntime.jsx.call(void 0, Ot,{orderID:h.orderId,onBack:I}),(u==="returns"||u==="return-details")&&i&&_jsxruntime.jsx.call(void 0, Tt,{projectID:_nullishCoalesce(a, () => ("")),host:o,accessToken:i,loginURL:_nullishCoalesce(r, () => ("/panel/login")),appearance:Pn(e,_optionalChain([n, 'optionalAccess', _85 => _85.colors, 'optionalAccess', _86 => _86.brand])),texts:t,screen:u,params:h,setParams:c,setActiveScreen:v}),u==="profile"&&_jsxruntime.jsx.call(void 0, Kn,{email:l,logout:g})]})]})},Va= exports.q =$a;var _reactquery = require('@tanstack/react-query');var _connect = require('@connectrpc/connect');var _connectweb = require('@connectrpc/connect-web');var be;(n=>{function e(r){return _connect.createClient.call(void 0, _chunkWRCXZMKKjs.f,a(r))}n.get=e;let t=new Map;function a(r){let o=t.get(r);return o==null&&(o=_connectweb.createConnectTransport.call(void 0, {useBinaryFormat:!0,baseUrl:r+"/api/rpc"}),t.set(r,o)),o}})(be = exports.a||={});var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);function j(e,t=2){return+(Math.round(+(e+"e+"+t))+"e-"+t)}function or(e,t){let a=typeof navigator>"u"?"pl-PL":navigator.language;return Intl.NumberFormat(a,{style:"currency",currency:t,currencyDisplay:"symbol"}).format(e/100)}var El=_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 Mt(e){typeof window>"u"||(Ja(e),Qa(e),Ya(e))}function Ja(e){try{typeof window.dataLayer>"u"&&(window.dataLayer=[]);let t=Ka(e);window.dataLayer.push(t)}catch(t){console.warn("cannot send google analytics event",t)}}function Ka(e){let t=_nullishCoalesce(_nullishCoalesce(e.value, () => (_optionalChain([e, 'access', _87 => _87.items, 'optionalAccess', _88 => _88.reduce, 'call', _89 => _89((o,i)=>o+(i.price||0)*(i.quantity||1),0)]))), () => (0)),a=_optionalChain([e, 'access', _90 => _90.items, 'optionalAccess', _91 => _91.map, 'call', _92 => _92(o=>({item_id:o.id,item_name:o.name||o.id,price:j((o.price||0)/100,2),quantity:o.quantity||1}))]),n={currency:e.currency||"PLN",value:j(t/100,2)};a&&a.length>0&&(n.items=a);let r;switch(e.event){case"purchase":r="purchase",n.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:n,...e.step&&{step:e.step},...e.content_name&&{content_name:e.content_name}}}function Qa(e){if(typeof window.fbq>"u")return;let t="",a="",n={};switch(e.event){case"purchase":t="track",a="Purchase",n={category_name:e.step,...e};break;case"lead":t="track",a="Lead",n={category_name:e.step,...e};break;case"addToCart":t="track",a="Add to Cart",n={category_name:e.step,...e};break;case"customizeProduct":t="track",a="Customize Product",n={category_name:e.step,...e};break;case"viewCart":t="track",a="View Cart",n={category_name:e.step,...e};break;case"removeFromCart":t="track",a="Remove from Cart",n={category_name:e.step,...e};break;case"initiateCheckout":t="track",a="Initiate Checkout",n={category_name:e.step,...e};break;default:break}window.location.search.includes("analytics")&&console.log("Pushing FB event",t,a,n),window.fbq(t,a,n)}function Ya(e){try{if(typeof window.ttq>"u")return;let t=Xa(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 Xa(e){let t=_nullishCoalesce(_nullishCoalesce(e.value, () => (_optionalChain([e, 'access', _93 => _93.items, 'optionalAccess', _94 => _94.reduce, 'call', _95 => _95((o,i)=>o+(i.price||0)*(i.quantity||1),0)]))), () => (0)),a=_optionalChain([e, 'access', _96 => _96.items, 'optionalAccess', _97 => _97.map, 'call', _98 => _98(o=>({content_id:o.id,content_type:"product",content_name:o.name||o.id,quantity:o.quantity||1,price:j((o.price||0)/100,2)}))])||[];a.length===0&&e.content_name&&a.push({content_id:e.step||"unknown",content_type:"product",content_name:e.content_name,quantity:1,price:j(t/100,2)});let n={currency:e.currency||"PLN",value:j(t/100,2)};a.length>0&&(n.contents=a);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:n}}function ir(e){let{items:t,googlePayConfig:a,checkout:n,result:r,cartRequiresShipping:o}=e;if(r.totalAmount==null)return;let i=[];return o&&(i.push("SHIPPING_ADDRESS"),i.push("SHIPPING_OPTION")),{apiVersion:2,apiVersionMinor:0,callbackIntents:i,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["MASTERCARD","VISA"]},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:a.gateway,gatewayMerchantId:a.gatewayId}}}],emailRequired:!0,shippingAddressParameters:{phoneNumberRequired:o},shippingAddressRequired:o,shippingOptionRequired:o,shippingOptionParameters:o?{shippingOptions:r.methods.slice(0,5).map(s=>({id:s.id,label:s.name+` - ${or(s.amount,r.currency)}`,description:_nullishCoalesce(s.description, () => (""))})),defaultSelectedOptionId:r.selectedDeliveryMethod}:void 0,merchantInfo:{merchantId:a.merchantId+"",merchantName:a.merchantName},transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:"P\u0142atno\u015B\u0107 za koszyk",totalPrice:`${j(r.totalAmount/100,2)}`,currencyCode:r.currency,countryCode:r.country,checkoutOption:"COMPLETE_IMMEDIATE_PURCHASE",displayItems:eo(t,r.methods,_nullishCoalesce(r.selectedDeliveryMethod, () => ((r.methods.length>0?r.methods[0].id:void 0))),n.couponCode,r.couponValue)}}}function eo(e,t,a,n,r){let o=[],i=0;for(let s of e)s.details!=null&&(i+=s.details.price*s.quantity,o.push({label:s.details.name+" x "+s.quantity,price:`${j(s.details.price/100,2)}`,type:"LINE_ITEM",status:"FINAL"}));let l=t.find(s=>s.id===a);return l!=null&&o.push({label:l.name,price:`${j(l.amount/100,2)}`,type:"SHIPPING_OPTION",status:"FINAL"}),n!=null&&r!=null&&o.push({label:`Kupon ${n}`,price:`${j(r/100,2)}`,type:"DISCOUNT",status:"FINAL"}),i>0&&o.push({label:"Subtotal",price:`${j(i/100,2)}`,type:"SUBTOTAL",status:"FINAL"}),o}function Ke(e,t){return`${_chunkZ2BKIX6Fjs.c}/api/integrations/${e}/public-commerce${t}`}function he(e){return typeof e=="object"&&e!=null&&"ERR"in e}function Z(e,t,a){return{ERR:!0,error:e,type:t,data:a}}function sr(e,t){return _optionalChain([t, 'optionalAccess', _99 => _99.find, 'call', _100 => _100(a=>a.id===e||(_nullishCoalesce(_optionalChain([a, 'access', _101 => _101.variants, 'optionalAccess', _102 => _102.some, 'call', _103 => _103(n=>n.id===e)]), () => (!1))))])}function lr(e,t){let a=new Set(t.map(n=>n.productID));return Array.from(new Set(e.filter(n=>!a.has(n))))}var _zustand = require('zustand');var Me=_zustand.create.call(void 0, e=>({isCartVisible:!1,numberOfProductsInCart:0,showCart:()=>e(t=>({...t,isCartVisible:!0})),hideCart:()=>e(t=>({...t,isCartVisible:!1})),setNumberOfProductsInCart:t=>e(a=>({...a,numberOfProductsInCart:t}))}));var so="__m_a",ur=_react3.createContext.call(void 0, void 0),Ft= exports.C =void 0;function cc(e){_chunkXRNTUSBHjs.a.call(void 0, {projectID:e}),Ft= exports.C =e,typeof window<"u"&&_chunkXRNTUSBHjs.g.call(void 0, [window.location.origin])}function Ye(){return _nullishCoalesce(_nullishCoalesce(Ft, () => (_optionalChain([document, 'access', _104 => _104.querySelector, 'call', _105 => _105('script[data-id][data-name="internal-cart"]'), 'optionalAccess', _106 => _106.getAttribute, 'call', _107 => _107("data-id")]))), () => (void 0))}function lo(){return _nullishCoalesce(_optionalChain([document, 'access', _108 => _108.querySelector, 'call', _109 => _109('script[data-id][data-name="internal-cart"]'), 'optionalAccess', _110 => _110.getAttribute, 'call', _111 => _111("data-custom-host")]), () => (void 0))}var co=({children:e,locale:t})=>{let a=new _reactquery.QueryClient;_react3.useEffect.call(void 0, ()=>{Qe()},[]);let n=Ye();if(n==null)return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{});let r=Ht(n,t);return _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider,{client:a,children:_jsxruntime.jsx.call(void 0, ur.Provider,{value:r,children:e})})},je=async(e,t)=>{let a=[];_optionalChain([t, 'optionalAccess', _112 => _112.items])!=null&&t.items.length>0?a=t.items:a=_nullishCoalesce(_optionalChain([z, 'call', _113 => _113(), 'optionalAccess', _114 => _114.products]), () => ([]));let n=Array.from(new Set(a.map(l=>l.productID))),r=new URLSearchParams;r.set("ids",n.join(",")),r.set("locale",_nullishCoalesce(_optionalChain([t, 'optionalAccess', _115 => _115.locale]), () => (_chunkZ2BKIX6Fjs.j.call(void 0, ))));let o=await fetch(Ke(e,`/products?${r.toString()}`),{method:"GET"});if(o.status!=200)return[];let i=await o.json();return a.flatMap(l=>{let s=sr(l.productID,i.result);return s==null?[]:[{...l,details:go(l.productID,s)}]})},dc= exports.F =()=>{let e=_react3.useContext.call(void 0, ur);if(e===void 0)throw new Error("useCartProvider must be used within a CartProvider");return e},uc= exports.G =co,uo=_zod2.default.object({isAvailable:_zod2.default.boolean(),merchantId:_zod2.default.string(),merchantName:_zod2.default.string(),gateway:_zod2.default.string(),gatewayId:_zod2.default.string()}),mo=_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()}),po=_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(mo).optional(),googlePayConfig:uo.optional()}),qt={country:void 0,couponCode:void 0,email:void 0,selectedDeliveryMethod:void 0,postalCode:void 0,products:[],googlePayConfig:void 0},mr="checkout";function z(){try{let e=localStorage.getItem(mr);return e==null?qt:po.parse(JSON.parse(e))}catch (e6){return qt}}async function cr(e,t){let a=await je(e,{items:t.map((o,i)=>({...o,id:`price-check-${i}`}))});if(he(a))return a;let n=lr(t.map(o=>o.productID),a);if(n.length>0)return Z("item-ids-not-found","notFound",n);let r=z();r.products==null&&(r.products=[]),r.products.push(...t.map(o=>({id:Math.random().toString(36).substring(7),productID:o.productID,quantity:o.quantity,priceVersion:_optionalChain([a, 'access', _116 => _116.find, 'call', _117 => _117(i=>i.productID===o.productID), 'optionalAccess', _118 => _118.details, 'optionalAccess', _119 => _119.pricing, 'optionalAccess', _120 => _120.priceVersion]),metadata:o.metadata}))),Mt({event:"addToCart",currency:"PLN",items:t.map(o=>({id:o.productID,name:_nullishCoalesce(o.name, () => ("")),price:_nullishCoalesce(o.price, () => (0)),quantity:o.quantity,currency:_nullishCoalesce(o.currency, () => ("PLN"))}))}),ee(r),Qe()}function dr(e){let t=z(),a={...t,products:_optionalChain([t, 'optionalAccess', _121 => _121.products, 'optionalAccess', _122 => _122.filter, 'call', _123 => _123(n=>!e.includes(n.productID)&&!e.includes(n.id))])};Mt({event:"removeFromCart",items:e.map(n=>({id:n,name:"",price:0,quantity:1,currency:"PLN"}))}),ee(a),Qe()}function ee(e){localStorage.setItem(mr,JSON.stringify(e))}var Ht=(e,t=_chunkZ2BKIX6Fjs.j.call(void 0, ))=>{let a=lo();return a!=null&&_chunkZ2BKIX6Fjs.d.call(void 0, a),{async checkIfApplePayIsAvailable(){if(typeof window>"u"||typeof document>"u"||!("ApplePaySession"in window))return!1;try{return(await be.get(_chunkZ2BKIX6Fjs.c).isOneClickPaymentAvailable({projectId:e})).applePay}catch(n){return console.error("Error checking if Apple Pay is available",n),!1}},async getGooglePayConfiguration(n){if(typeof window>"u"||typeof document>"u")return{isAvailable:!1};try{let r=await fo(e);if(_optionalChain([r, 'optionalAccess', _124 => _124.isAvailable])!=!0)return{isAvailable:!1};let o=z();if(o==null)return console.log("checkout is null"),{isAvailable:!1};let i=await je(e,{locale:t,items:n.items.map(m=>({id:Math.random().toString(36).substring(7),quantity:m.quantity,metadata:m.metadata,productID:m.productID}))});if(he(i))return{isAvailable:!1};let l=await be.get(_chunkZ2BKIX6Fjs.c).getPreOrderDetails({items:i.map(m=>_protobuf.create.call(void 0, _chunkWRCXZMKKjs.c,{id:m.productID,quantity:m.quantity})),projectId:e,postCode:o.postalCode,couponCode:o.couponCode,countryCode:o.country,selectedDeliveryMethod:o.selectedDeliveryMethod});if(l.totalAmount==null)return{isAvailable:!1};let s=i.find(m=>_optionalChain([m, 'access', _125 => _125.details, 'optionalAccess', _126 => _126.isDeliverable])==!0)!=null,g=await ir({items:i,googlePayConfig:r,checkout:o,cartRequiresShipping:s,result:l});return g==null?{isAvailable:!1}:{isAvailable:!0,config:g}}catch(r){return console.error("Error resolving Google Pay configuration",r),{isAvailable:!1}}},async clearCart(){let n=structuredClone(qt);n.country=_optionalChain([z, 'call', _127 => _127(), 'optionalAccess', _128 => _128.country]),ee(n),Qe()},async getAvailableCountries(){let n=await fetch(Ke(e,"/countries"),{method:"GET"});if(n.status!=200)return[];try{return _zod2.default.array(_zod2.default.object({name:_zod2.default.string(),code:_zod2.default.string()})).parse(await n.json())}catch(r){return Z(r.toString(),"internal")}},async getCountry(){let n=_optionalChain([z, 'call', _129 => _129(), 'optionalAccess', _130 => _130.country]);if(n==null){n="PL";let r=z();r.country=n,ee(r)}return n},async getNumberOfElementsInCart(){return _nullishCoalesce(_optionalChain([z, 'call', _131 => _131(), 'optionalAccess', _132 => _132.products, 'optionalAccess', _133 => _133.reduce, 'call', _134 => _134((n,r)=>n+r.quantity,0)]), () => (0))},async getProducts(){return await je(e,{locale:t})},async removeProductFromCart(n){return dr([n.id])},async setCountry(n){let r=z();r.country=n,ee(r)},async setCouponCodeIfPossible(n){let r=z();r.couponCode=n,ee(r)},async setPostalCode(n){let r=z();r.postalCode=n,ee(r)},async setDeliveryMethod(n){let r=z();r.selectedDeliveryMethod=n,ee(r)},async setEmail(n){let r=z();r.email=n,ee(r)},async addProduct(n){return await cr(e,[n])},async updateQuantity(n){let r=z();r.products=_optionalChain([r, 'access', _135 => _135.products, 'optionalAccess', _136 => _136.map, 'call', _137 => _137(o=>(o.id===n.id&&(o.quantity=n.quantity),o))]),ee(r),Qe()},async redirectToNextStep(){let n=z();if(n.products==null||n.products.length==0)return Z("cart-is-empty","badInput");let r=n.products.reduce((l,s)=>(s.metadata!=null&&Object.keys(s.metadata).forEach(g=>{let m=_optionalChain([s, 'access', _138 => _138.metadata, 'optionalAccess', _139 => _139[g]]);m!=null&&(l[g]=m)}),l),{}),o={items:n.products.map(l=>({id:l.productID,quantity:l.quantity,priceVersion:l.priceVersion})),askForNote:!0,countries:n.country?[n.country]:void 0,metadata:r,locale:t},i=await _t(o);return he(i)?(console.warn("cannot create payment URL",i.error),i):{url:i.url}},async justRedirectToPayment(n){let r={items:[{id:n.productID,quantity:1}],askForNote:!1,details:n.email||n.name?{name:n.name,email:n.email}:void 0,locale:_nullishCoalesce(n.locale, () => (t))};r=Bt(r),n.country==null&&(n.country="pl"),r.details==null&&(r.details={}),r.details.address==null&&(r.details.address={}),r.details.address.country=n.country,n.marketingAgreement===!0&&(r.additionalAgreements=[{id:so,name:"",required:!0,answer:!0}]);let o=await _t(r);return he(o)?o:{url:o.url}},async completeApplePayPayment(n){let r=z();if(r==null)return Z("Checkout not found");let o=await je(e,{locale:t});if(he(o))return o;try{let i=_optionalChain([n, 'access', _140 => _140.shippingContact, 'optionalAccess', _141 => _141.givenName]);_optionalChain([n, 'access', _142 => _142.shippingContact, 'optionalAccess', _143 => _143.familyName])!=null?i+=" "+_optionalChain([n, 'access', _144 => _144.shippingContact, 'optionalAccess', _145 => _145.familyName]):_optionalChain([n, 'access', _146 => _146.billingContact, 'optionalAccess', _147 => _147.familyName])!=null&&(i+=" "+_optionalChain([n, 'access', _148 => _148.billingContact, 'optionalAccess', _149 => _149.familyName]));let l={},s=pt();s!=null&&(l.ref=s);let g=await be.get(_chunkZ2BKIX6Fjs.c).authorizeOneClickPayment({gateway:0,paymentData:JSON.stringify(n.token.paymentData),paymentMethod:JSON.stringify(n.token.paymentMethod),transactionIdentifier:n.token.transactionIdentifier,order:_protobuf.create.call(void 0, _chunkWRCXZMKKjs.d,{items:o.map(m=>({id:m.productID,quantity:m.quantity})),couponCode:r.couponCode,email:_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([n, 'access', _150 => _150.shippingContact, 'optionalAccess', _151 => _151.emailAddress]), () => (_optionalChain([n, 'access', _152 => _152.billingContact, 'optionalAccess', _153 => _153.emailAddress]))), () => (r.email)), () => (void 0)),phone:_nullishCoalesce(_nullishCoalesce(_optionalChain([n, 'access', _154 => _154.shippingContact, 'optionalAccess', _155 => _155.phoneNumber]), () => (_optionalChain([n, 'access', _156 => _156.billingContact, 'optionalAccess', _157 => _157.phoneNumber]))), () => (void 0)),selectedDeliveryMethod:r.selectedDeliveryMethod,postCode:r.postalCode,projectId:e}),shippingAddress:_protobuf.create.call(void 0, _chunkWRCXZMKKjs.a,{line1:_nullishCoalesce(_optionalChain([n, 'access', _158 => _158.shippingContact, 'optionalAccess', _159 => _159.addressLines, 'optionalAccess', _160 => _160[0]]), () => ("")),city:_nullishCoalesce(_optionalChain([n, 'access', _161 => _161.shippingContact, 'optionalAccess', _162 => _162.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([n, 'access', _163 => _163.shippingContact, 'optionalAccess', _164 => _164.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([n, 'access', _165 => _165.shippingContact, 'optionalAccess', _166 => _166.postalCode]), () => ("")),name:i}),billingAddress:_protobuf.create.call(void 0, _chunkWRCXZMKKjs.b,{name:_nullishCoalesce(_optionalChain([n, 'access', _167 => _167.billingContact, 'optionalAccess', _168 => _168.givenName]), () => (" "+(_nullishCoalesce(_optionalChain([n, 'access', _169 => _169.billingContact, 'optionalAccess', _170 => _170.familyName]), () => (""))))),line1:_nullishCoalesce(_optionalChain([n, 'access', _171 => _171.billingContact, 'optionalAccess', _172 => _172.addressLines, 'optionalAccess', _173 => _173[0]]), () => ("")),city:_nullishCoalesce(_optionalChain([n, 'access', _174 => _174.billingContact, 'optionalAccess', _175 => _175.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([n, 'access', _176 => _176.billingContact, 'optionalAccess', _177 => _177.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([n, 'access', _178 => _178.billingContact, 'optionalAccess', _179 => _179.postalCode]), () => (""))}),metadata:Object.keys(l).length>0?JSON.stringify(l):void 0});return{isSuccess:g.isSuccess,redirectURL:g.redirectUrl}}catch(i){return console.error(i),Z("Failed to authorize payment")}},async completeGooglePayPayment(n){let r=z();if(r==null)return Z("Checkout not found");let o=await je(e,{locale:t});if(he(o))return o;try{let i=_optionalChain([n, 'access', _180 => _180.paymentData, 'access', _181 => _181.shippingAddress, 'optionalAccess', _182 => _182.name]),l={},s=pt();s!=null&&(l.ref=s);let g=await be.get(_chunkZ2BKIX6Fjs.c).authorizeOneClickPayment({gateway:1,paymentData:n.paymentData.paymentMethodData.tokenizationData.token,paymentMethod:n.paymentData.paymentMethodData.type,transactionIdentifier:"",order:_protobuf.create.call(void 0, _chunkWRCXZMKKjs.d,{items:o.map(m=>({id:m.productID,quantity:m.quantity})),couponCode:r.couponCode,email:_nullishCoalesce(n.paymentData.email, () => (void 0)),phone:_nullishCoalesce(_optionalChain([n, 'access', _183 => _183.paymentData, 'access', _184 => _184.shippingAddress, 'optionalAccess', _185 => _185.phoneNumber]), () => (void 0)),selectedDeliveryMethod:_nullishCoalesce(_optionalChain([n, 'access', _186 => _186.paymentData, 'access', _187 => _187.shippingOptionData, 'optionalAccess', _188 => _188.id]), () => (r.selectedDeliveryMethod)),postCode:_optionalChain([n, 'access', _189 => _189.paymentData, 'access', _190 => _190.shippingAddress, 'optionalAccess', _191 => _191.postalCode]),projectId:e}),shippingAddress:_protobuf.create.call(void 0, _chunkWRCXZMKKjs.a,{line1:_nullishCoalesce(_optionalChain([n, 'access', _192 => _192.paymentData, 'access', _193 => _193.shippingAddress, 'optionalAccess', _194 => _194.address1]), () => ("")),city:_nullishCoalesce(_optionalChain([n, 'access', _195 => _195.paymentData, 'access', _196 => _196.shippingAddress, 'optionalAccess', _197 => _197.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([n, 'access', _198 => _198.paymentData, 'access', _199 => _199.shippingAddress, 'optionalAccess', _200 => _200.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([n, 'access', _201 => _201.paymentData, 'access', _202 => _202.shippingAddress, 'optionalAccess', _203 => _203.postalCode]), () => ("")),name:i}),billingAddress:_protobuf.create.call(void 0, _chunkWRCXZMKKjs.b,{name:_optionalChain([n, 'access', _204 => _204.paymentData, 'access', _205 => _205.paymentMethodData, 'access', _206 => _206.info, 'optionalAccess', _207 => _207.billingAddress, 'optionalAccess', _208 => _208.name]),line1:_nullishCoalesce(_optionalChain([n, 'access', _209 => _209.paymentData, 'access', _210 => _210.paymentMethodData, 'access', _211 => _211.info, 'optionalAccess', _212 => _212.billingAddress, 'optionalAccess', _213 => _213.address1]), () => ("")),city:_nullishCoalesce(_optionalChain([n, 'access', _214 => _214.paymentData, 'access', _215 => _215.paymentMethodData, 'access', _216 => _216.info, 'optionalAccess', _217 => _217.billingAddress, 'optionalAccess', _218 => _218.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([n, 'access', _219 => _219.paymentData, 'access', _220 => _220.paymentMethodData, 'access', _221 => _221.info, 'optionalAccess', _222 => _222.billingAddress, 'optionalAccess', _223 => _223.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([n, 'access', _224 => _224.paymentData, 'access', _225 => _225.paymentMethodData, 'access', _226 => _226.info, 'optionalAccess', _227 => _227.billingAddress, 'optionalAccess', _228 => _228.postalCode]), () => (""))}),metadata:Object.keys(l).length>0?JSON.stringify(l):void 0});return{isSuccess:g.isSuccess,redirectURL:g.redirectUrl}}catch(i){return console.error(i),Z("Failed to authorize payment")}return{isSuccess:!0}},async getApplePayPaymentRequest(n){let r=z();if(r==null)return Z("Checkout not found");n&&n.expectedItems!=null&&n.expectedItems.length>0&&(r.products&&dr(r.products.map(s=>s.productID)),await cr(e,n.expectedItems));let o=await je(e,{locale:t});if(he(o))return o;let i=await be.get(_chunkZ2BKIX6Fjs.c).getPreOrderDetails({items:o.map(s=>_protobuf.create.call(void 0, _chunkWRCXZMKKjs.c,{id:s.productID,quantity:s.quantity})),projectId:e,postCode:r.postalCode,couponCode:r.couponCode,countryCode:r.country,selectedDeliveryMethod:r.selectedDeliveryMethod}),l=o.map(s=>({amount:`${j(s.quantity*(_nullishCoalesce(_optionalChain([s, 'access', _229 => _229.details, 'optionalAccess', _230 => _230.price]), () => (0)))/100,2)}`,label:_optionalChain([s, 'access', _231 => _231.details, 'optionalAccess', _232 => _232.name])+" - "+s.quantity,type:"final"}));if(i.selectedDeliveryMethod!=null){let s=i.methods.find(g=>g.id==i.selectedDeliveryMethod);s!=null&&l.push({amount:`${j(s.amount/100,2)}`,label:s.name,type:"final"})}return i.couponCode!=null&&i.couponValue!=null&&l.push({amount:`-${j(i.couponValue/100,2)}`,label:i.couponCode,type:"final"}),{countryCode:_nullishCoalesce(r.country, () => ("PL")),merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard"],total:{amount:`${j((_nullishCoalesce(i.totalAmount, () => (0)))/100,2)}`,label:"P\u0142atno\u015B\u0107 za koszyk",type:"final"},shippingMethods:i.methods.map(s=>({amount:`${j(s.amount/100,2)}`,detail:_nullishCoalesce(s.description, () => ("")),identifier:s.id,label:s.name,dateComponentsRange:{startDateComponents:{days:_nullishCoalesce(s.minDays, () => (1)),hours:0,months:0,years:0},endDateComponents:{days:_nullishCoalesce(s.maxDays, () => (14)),hours:0,months:0,years:0}}})),lineItems:l,currencyCode:"PLN"}}}};async function fo(e){let t=z();if(_optionalChain([t, 'access', _233 => _233.googlePayConfig, 'optionalAccess', _234 => _234.isAvailable])!=!0){let a=await be.get(_chunkZ2BKIX6Fjs.c).isOneClickPaymentAvailable({projectId:e});a.googlePay==!0&&a.googlePayConfig!=null?t.googlePayConfig={isAvailable:!0,gateway:a.googlePayConfig.gateway,gatewayId:a.googlePayConfig.gatewayMerchantId,merchantName:a.googlePayConfig.merchantName,merchantId:a.googlePayConfig.merchantId}:t.googlePayConfig={isAvailable:!1,gateway:"",gatewayId:"",merchantName:"",merchantId:""}}return ee(t),t.googlePayConfig}function go(e,t){if(e==t.id){let n=_optionalChain([t, 'access', _235 => _235.variants, 'optionalAccess', _236 => _236.findIndex, 'call', _237 => _237(r=>r.id===e)]);if(n!=null&&n!=-1){let r=t.variants[n];return{...t,availableQuantity:r.availableQuantity,isDeliverable:r.isDeliverable,images:_nullishCoalesce(r.images, () => (t.images)),name:t.name+" "+r.name,price:r.price,currency:r.currency,pricing:r.pricing}}return t}let a=_optionalChain([t, 'access', _238 => _238.variants, 'optionalAccess', _239 => _239.find, 'call', _240 => _240(n=>n.id===e)]);return a==null?t:{...t,id:a.id,name:t.name+" "+a.name,price:a.price,currency:a.currency,pricing:a.pricing,metadata:t.metadata,availableQuantity:a.availableQuantity,isDeliverable:a.isDeliverable,images:_nullishCoalesce(a.images, () => (t.images))}}function Qe(){let e=z(),t=0;if(e==null){Me.setState(a=>({...a,numberOfProductsInCart:t}));return}t=_nullishCoalesce(_optionalChain([e, 'access', _241 => _241.products, 'optionalAccess', _242 => _242.reduce, 'call', _243 => _243((a,n)=>a+n.quantity,0)]), () => (0)),Me.setState(a=>({...a,numberOfProductsInCart:t}))}var bo;(n=>{async function e(r,o=1,i,l){let s=Ye();if(s==null)throw new Error("No project ID found");let m=await Ht(s).addProduct({productID:r,quantity:o,metadata:i,...l});if(m!=null)return m}n.addProductToCart=e;function t(){Me.setState({isCartVisible:!0})}n.showCart=t;function a(){Me.setState({isCartVisible:!1})}n.hideCart=a})(bo = exports.w||={});async function _t(e){let t=Ye();if(t==null)throw new Error("No project ID found");e=Bt(e),e.locale??=_chunkZ2BKIX6Fjs.j.call(void 0, );let a=await fetch(Ke(t,"/buy"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(a.status!=200){if(_optionalChain([a, 'access', _244 => _244.headers, 'access', _245 => _245.get, 'call', _246 => _246("Content-Type"), 'optionalAccess', _247 => _247.includes, 'call', _248 => _248("application/json")])){try{let r=await a.json();if("itemIds"in r&&Array.isArray(r.itemIds)){let o=r.itemIds;return Z("item-ids-not-found","badInput",o)}}catch (e7){}return Z("internal-error","internal")}else console.warn("result",await a.text(),a.status,a.statusText);return Z("internal-error","internal")}return{url:(await a.json()).url}}async function vc(e){let t=Ye();if(t==null)throw new Error("No project ID found");let a={"Content-Type":"application/json",...e.apiKey!=null?{Authorization:`Bearer ${e.apiKey}`}:{}},n=e.testMode?`/api/payment/link/auto/${t}/test`:`/api/payment/link/auto/${t}`;return delete e.apiKey,delete e.testMode,e.locale??=_chunkZ2BKIX6Fjs.j.call(void 0, ),{status:"ok",redirectURL:(await(await fetch(_chunkZ2BKIX6Fjs.c+n,{method:"POST",headers:a,body:JSON.stringify(e)})).json()).url}}function pt(){if(typeof localStorage>"u")return;let e=localStorage.getItem("bitsnap-ref");if(e!=null)return e}function Bt(e){let t=pt();return t==null||(e.metadata==null&&(e.metadata={}),e.metadata.ref=t),e}exports.a = be; exports.b = ie; exports.c = pe; exports.d = fe; exports.e = xt; exports.f = se; exports.g = fn; exports.h = kt; exports.i = xe; exports.j = Ge; exports.k = $e; exports.l = De; exports.m = Le; exports.n = Er; exports.o = wn; exports.p = Ot; exports.q = Va; exports.r = j; exports.s = or; exports.t = Mt; exports.u = he; exports.v = Me; exports.w = bo; exports.x = _t; exports.y = vc; exports.z = pt; exports.A = Bt; exports.B = so; exports.C = Ft; exports.D = cc; exports.E = Ye; exports.F = dc; exports.G = uc; exports.H = Ht;
|
|
4
|
-
//# sourceMappingURL=chunk-7XTDFTQU.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-7XTDFTQU.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","playState"],"mappings":"AAAA,ylCAAwI,sDAAiG,sDAAsJ,sDAAuE,oDCAva,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,CF/CA,SGzBgBC,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;ACyPNE,YAAAA","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-7XTDFTQU.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 { 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 { 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 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 const { theme, allowedReturnOrigins, projectID, host } = usePanelConfig();\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 <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 );\n};\n\nexport const PanelLogin = () => {\n return <PanelLoginComponentWrapper />;\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"]}
|
package/dist/chunk-C6Z7LOHB.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as g}from"./chunk-WSM4OM72.mjs";var t={projectID:void 0,loginURL:"/panel/login",theme:void 0,host:void 0,allowedReturnOrigins:[]},d=[];function c(e){t={...t,...e}}function o(){return t}function m(e){t.projectID=e}function w(e){t.theme=e}function P(e){t.loginURL=e}function C(e){t.host=e}function R(e){d=e,t={...t,allowedReturnOrigins:e}}function x(){return d}import{createContext as p,useContext as u}from"react";import{jsx as i}from"react/jsx-runtime";var f=p(o()),O=({children:e})=>i(g,{children:i(f.Provider,{value:{...o()},children:i("div",{className:"bitsnap-react",children:e})})}),I=()=>u(f);var r=(e,n)=>`bitsnap-panel-session:${encodeURIComponent(n??"https://bitsnap.pl")}:${encodeURIComponent(e)}`,s=(e,n)=>`bitsnap-panel-email:${encodeURIComponent(n??"https://bitsnap.pl")}:${encodeURIComponent(e)}`;function L(e,n){return typeof window>"u"||!e?void 0:window.localStorage.getItem(r(e,n))??void 0}function T(e,n,l,a){typeof window>"u"||!e||(window.localStorage.setItem(r(e,a),n),window.localStorage.setItem(s(e,a),l))}function $(e,n){return typeof window>"u"||!e?null:window.localStorage.getItem(s(e,n))}function G(e,n){typeof window>"u"||!e||(window.localStorage.removeItem(r(e,n)),window.localStorage.removeItem(s(e,n)))}export{c as a,o as b,m as c,w as d,P as e,C as f,R as g,x as h,O as i,I as j,L as k,T as l,$ as m,G as n};
|
|
2
|
-
//# sourceMappingURL=chunk-C6Z7LOHB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/panel/config.ts","../src/panel/PanelProvider.tsx","../src/panel/session-storage.ts"],"sourcesContent":["import type { GetThemeOutput } from \"./types\";\n\nlet config: PanelConfig = {\n projectID: undefined,\n loginURL: \"/panel/login\",\n theme: undefined,\n host: undefined,\n allowedReturnOrigins: [],\n};\n\nlet allowedReturnOrigins: string[] = [];\n\nexport interface PanelConfig {\n projectID?: string;\n loginURL?: string;\n theme?: GetThemeOutput;\n host?: string;\n allowedReturnOrigins: string[];\n}\n\nexport function setPanelConfig(newConfig: Partial<PanelConfig>): void {\n config = { ...config, ...newConfig };\n}\n\nexport function getPanelConfig(): PanelConfig {\n return config;\n}\n\nexport function setProjectID(projectID: string): void {\n config.projectID = projectID;\n}\n\nexport function setTheme(theme: GetThemeOutput): void {\n config.theme = theme;\n}\n\nexport function setLoginURL(loginURL: string): void {\n config.loginURL = loginURL;\n}\n\nexport function setHost(host: string): void {\n config.host = host;\n}\n\nexport function setAllowedReturnOrigins(origins: string[]): void {\n allowedReturnOrigins = origins;\n config = { ...config, allowedReturnOrigins: origins };\n}\n\nexport function getAllowedReturnOrigins(): string[] {\n return allowedReturnOrigins;\n}\n","import { createContext, useContext } from \"react\";\nimport { RpcProvider } from \"../rpc-provider\";\nimport { getPanelConfig, type PanelConfig } from \"./config\";\n\nconst PanelContext = createContext<PanelConfig>(getPanelConfig());\n\nexport const PanelProvider: React.FC<{\n children: React.ReactNode;\n}> = ({ children }) => {\n return (\n <RpcProvider>\n <PanelContext.Provider value={{ ...getPanelConfig() }}>\n <div className=\"bitsnap-react\">{children}</div>\n </PanelContext.Provider>\n </RpcProvider>\n );\n};\n\nexport const usePanelConfig = () => useContext(PanelContext);\n","const panelSessionKey = (projectID: string, host?: string) =>\n `bitsnap-panel-session:${encodeURIComponent(host ?? \"https://bitsnap.pl\")}:${encodeURIComponent(projectID)}`;\n\nconst panelEmailKey = (projectID: string, host?: string) =>\n `bitsnap-panel-email:${encodeURIComponent(host ?? \"https://bitsnap.pl\")}:${encodeURIComponent(projectID)}`;\n\nexport function getPanelSession(projectID?: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return undefined;\n const token = window.localStorage.getItem(panelSessionKey(projectID, host));\n return token ?? undefined;\n}\n\nexport function savePanelSession(projectID: string | undefined, token: string, email: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return;\n window.localStorage.setItem(panelSessionKey(projectID, host), token);\n window.localStorage.setItem(panelEmailKey(projectID, host), email);\n}\n\nexport function getPanelEmail(projectID?: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return null;\n return window.localStorage.getItem(panelEmailKey(projectID, host));\n}\n\nexport function clearPanelSession(projectID?: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return;\n window.localStorage.removeItem(panelSessionKey(projectID, host));\n window.localStorage.removeItem(panelEmailKey(projectID, host));\n}\n"],"mappings":"yCAEA,IAAIA,EAAsB,CACxB,UAAW,OACX,SAAU,eACV,MAAO,OACP,KAAM,OACN,qBAAsB,CAAC,CACzB,EAEIC,EAAiC,CAAC,EAU/B,SAASC,EAAeC,EAAuC,CACpEH,EAAS,CAAE,GAAGA,EAAQ,GAAGG,CAAU,CACrC,CAEO,SAASC,GAA8B,CAC5C,OAAOJ,CACT,CAEO,SAASK,EAAaC,EAAyB,CACpDN,EAAO,UAAYM,CACrB,CAEO,SAASC,EAASC,EAA6B,CACpDR,EAAO,MAAQQ,CACjB,CAEO,SAASC,EAAYC,EAAwB,CAClDV,EAAO,SAAWU,CACpB,CAEO,SAASC,EAAQC,EAAoB,CAC1CZ,EAAO,KAAOY,CAChB,CAEO,SAASC,EAAwBC,EAAyB,CAC/Db,EAAuBa,EACvBd,EAAS,CAAE,GAAGA,EAAQ,qBAAsBc,CAAQ,CACtD,CAEO,SAASC,GAAoC,CAClD,OAAOd,CACT,CCnDA,OAAS,iBAAAe,EAAe,cAAAC,MAAkB,QAYlC,cAAAC,MAAA,oBARR,IAAMC,EAAeC,EAA2BC,EAAe,CAAC,EAEnDC,EAER,CAAC,CAAE,SAAAC,CAAS,IAEbL,EAACM,EAAA,CACC,SAAAN,EAACC,EAAa,SAAb,CAAsB,MAAO,CAAE,GAAGE,EAAe,CAAE,EAClD,SAAAH,EAAC,OAAI,UAAU,gBAAiB,SAAAK,EAAS,EAC3C,EACF,EAISE,EAAiB,IAAMC,EAAWP,CAAY,EClB3D,IAAMQ,EAAkB,CAACC,EAAmBC,IAC1C,yBAAyB,mBAAmBA,GAAQ,oBAAoB,CAAC,IAAI,mBAAmBD,CAAS,CAAC,GAEtGE,EAAgB,CAACF,EAAmBC,IACxC,uBAAuB,mBAAmBA,GAAQ,oBAAoB,CAAC,IAAI,mBAAmBD,CAAS,CAAC,GAEnG,SAASG,EAAgBH,EAAoBC,EAAe,CACjE,OAAI,OAAO,OAAW,KAAe,CAACD,EAAW,OACnC,OAAO,aAAa,QAAQD,EAAgBC,EAAWC,CAAI,CAAC,GAC1D,MAClB,CAEO,SAASG,EAAiBJ,EAA+BK,EAAeC,EAAeL,EAAe,CACvG,OAAO,OAAW,KAAe,CAACD,IACtC,OAAO,aAAa,QAAQD,EAAgBC,EAAWC,CAAI,EAAGI,CAAK,EACnE,OAAO,aAAa,QAAQH,EAAcF,EAAWC,CAAI,EAAGK,CAAK,EACnE,CAEO,SAASC,EAAcP,EAAoBC,EAAe,CAC/D,OAAI,OAAO,OAAW,KAAe,CAACD,EAAkB,KACjD,OAAO,aAAa,QAAQE,EAAcF,EAAWC,CAAI,CAAC,CACnE,CAEO,SAASO,EAAkBR,EAAoBC,EAAe,CAC/D,OAAO,OAAW,KAAe,CAACD,IACtC,OAAO,aAAa,WAAWD,EAAgBC,EAAWC,CAAI,CAAC,EAC/D,OAAO,aAAa,WAAWC,EAAcF,EAAWC,CAAI,CAAC,EAC/D","names":["config","allowedReturnOrigins","setPanelConfig","newConfig","getPanelConfig","setProjectID","projectID","setTheme","theme","setLoginURL","loginURL","setHost","host","setAllowedReturnOrigins","origins","getAllowedReturnOrigins","createContext","useContext","jsx","PanelContext","createContext","getPanelConfig","PanelProvider","children","RpcProvider","usePanelConfig","useContext","panelSessionKey","projectID","host","panelEmailKey","getPanelSession","savePanelSession","token","email","getPanelEmail","clearPanelSession"]}
|