1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3900aa71-1fb2-449c-b0a0-abd6aeb0b577",e._sentryDebugIdIdentifier="sentry-dbid-3900aa71-1fb2-449c-b0a0-abd6aeb0b577")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8859],{3722:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>f});var n=a(95155),s=a(92584),r=a(31610),i=a(35625),l=a(26708),c=a(48934),o=a(73321),d=a(12115),u=a(66609),m=a(34875),p=a(38245),x=a(55601),h=a(25555),b=a(23181);function f(){let e=(0,h.kj)(),t=(0,o.useRouter)(),a=(0,i.jE)(),{isAuthenticated:p,isLoading:f}=(0,b.nc)(),[v,k]=(0,d.useState)(!1);(0,d.useEffect)(()=>{f||p||t.replace("/auth/login")},[f,p,t]);let{data:j,isPending:N}=(0,l.I)({queryKey:["finance","entries"],queryFn:()=>x.rA.entries(),enabled:p}),w=(0,c.n)({mutationFn:e=>x.rA.removeEntry(e),onSuccess:()=>a.invalidateQueries({queryKey:["finance"]}),onError:()=>u.toast.error(e.finance.failed)});if(f)return(0,n.jsx)("div",{className:"sb-sky min-h-dvh"});let S=j?.entries??[],C=j?.totals.income??{},E=j?.totals.expense??{};return(0,n.jsxs)("div",{className:"sb-sky min-h-dvh pb-(--bottomnav-h)",children:[(0,n.jsxs)("header",{className:"flex items-center justify-between gap-3 px-5",style:{paddingTop:"calc(env(safe-area-inset-top, 0px) + 18px)"},children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[13px] text-slate-ink",children:e.finance.subtitle}),(0,n.jsx)("h1",{className:"font-display text-2xl font-extrabold text-ink",children:e.finance.title})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>k(e=>!e),className:"inline-flex items-center gap-1.5 rounded-full bg-gradient-to-br from-[var(--sb-primary)] to-[var(--sb-primary-deep)] px-4 py-2.5 text-[13px] font-bold text-white shadow-[0_10px_24px_rgba(47,107,255,0.32)] transition active:scale-[0.98]",children:[(0,n.jsx)(r.gc,{icon:s.QLR,className:"h-4 w-4"}),e.finance.add]})]}),(0,n.jsxs)("main",{className:"px-5 py-6",children:[(0,n.jsxs)("section",{className:"mb-5 grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(g,{title:e.finance.income,totals:C,tone:"income"}),(0,n.jsx)(g,{title:e.finance.expense,totals:E,tone:"expense"})]}),v&&(0,n.jsx)(y,{onDone:()=>{k(!1),a.invalidateQueries({queryKey:["finance"]})},onCancel:()=>k(!1)}),N?(0,n.jsx)("div",{className:"space-y-2","aria-hidden":!0,children:[0,1,2].map(e=>(0,n.jsx)("div",{className:"h-14 animate-pulse rounded-xl sb-card"},e))}):0===S.length?(0,n.jsx)("p",{className:"rounded-2xl sb-card px-6 py-12 text-center text-[14px] text-slate-ink",children:e.finance.empty}):(0,n.jsx)("div",{className:"space-y-2",children:S.map(t=>(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-xl sb-card px-3.5 py-3",children:[(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block truncate text-[14px] text-ink",children:t.note||e.finance.noNote}),(0,n.jsxs)("span",{className:"block text-[12px] text-slate-ink",children:[new Date(t.occurredAt).toLocaleDateString(e.common.numberLocale),t.method&&` \xb7 ${e.finance.method[t.method]}`]})]}),(0,n.jsxs)("span",{className:`shrink-0 text-[15px] font-bold tabular-nums ${"income"===t.kind?"text-emerald-600 dark:text-emerald-400":"text-rose-600 dar
1k:text-rose-400"}`,children:["income"===t.kind?"+":"â",(0,x.Vt)(t.amountMinor,t.currency,e.common.numberLocale)]}),(0,n.jsx)("button",{type:"button",onClick:()=>w.mutate(t.id),"aria-label":e.finance.remove,className:"grid h-8 w-8 shrink-0 place-items-center rounded-full bg-blue-50/80 text-slate-ink dark:bg-white/10",children:(0,n.jsx)(r.gc,{icon:s.yLS,className:"h-3 w-3"})})]},t.id))})]}),(0,n.jsx)(m.l,{})]})}function g({title:e,totals:t,tone:a}){let s=(0,h.kj)(),r=Object.keys(t);return(0,n.jsxs)("div",{className:"rounded-2xl sb-card p-4",children:[(0,n.jsx)("p",{className:"text-[13px] text-slate-ink",children:e}),0===r.length?(0,n.jsx)("p",{className:"mt-1 text-[15px] text-slate-ink",children:s.finance.none}):(0,n.jsx)("div",{className:"mt-1 space-y-0.5",children:r.map(e=>(0,n.jsx)("p",{className:`font-display text-xl font-extrabold tabular-nums ${"income"===a?"text-emerald-600 dark:text-emerald-400":"text-rose-600 dark:text-rose-400"}`,children:(0,x.Vt)(t[e]??0,e,s.common.numberLocale)},e))})]})}function y({onDone:e,onCancel:t}){let a=(0,h.kj)(),[s,r]=(0,d.useState)("income"),[i,l]=(0,d.useState)(""),[o,m]=(0,d.useState)("TRY"),[b,f]=(0,d.useState)(""),[g,v]=(0,d.useState)(null),k=(0,x.qP)(i,o),j=(0,c.n)({mutationFn:()=>x.rA.addEntry({kind:s,amountMinor:k??0,currency:o,...b.trim()?{note:b.trim()}:{},...g?{patientId:g.id}:{}}),onSuccess:()=>{u.toast.success(a.finance.saved),e()},onError:e=>u.toast.error("err_no_relationship"===e.message?a.finance.notLinked:a.finance.failed)});return(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),null===k||j.isPending||j.mutate()},className:"mb-5 space-y-2 rounded-2xl sb-card p-4",children:[(0,n.jsx)("div",{className:"inline-flex rounded-full bg-blue-50/80 p-1 dark:bg-white/10",children:["income","expense"].map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>r(e),"aria-pressed":s===e,className:`rounded-full px-3.5 py-1.5 text-[13px] font-semibold transition ${s===e?"bg-white text-[var(--sb-primary-text)] shadow-sm dark:bg-white/15 dark:text-white":"text-slate-ink"}`,children:"income"===e?a.finance.income:a.finance.expense},e))}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("input",{value:i,onChange:e=>l(e.target.value),placeholder:a.finance.amount,inputMode:"decimal",required:!0,className:"min-w-0 flex-1 rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink outline-none focus:border-[var(--sb-primary)] dark:bg-white/5"}),(0,n.jsx)("select",{value:o,onChange:e=>m(e.target.value),className:"shrink-0 rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink dark:bg-white/5",children:x.yR.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})]}),""!==i.trim()&&(0,n.jsx)("p",{className:`text-[12px] ${null===k?"text-rose-600 dar
1k:text-rose-400":"text-slate-ink"}`,children:null===k?a.finance.amountUnclear:a.finance.willRecord.replace("{amount}",(0,x.Vt)(k,o,a.common.numberLocale))}),(0,n.jsx)("input",{value:b,onChange:e=>f(e.target.value),placeholder:a.finance.notePlaceholder,maxLength:500,className:"w-full rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink outline-none focus:border-[var(--sb-primary)] dark:bg-white/5"}),(0,n.jsx)(p.C,{value:g,onChange:v,scope:"linked",label:a.finance.patientLabel}),(0,n.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,n.jsx)("button",{type:"submit",disabled:j.isPending||null===k,className:"flex-1 rounded-full bg-[var(--sb-primary)] px-4 py-2.5 text-[14px] font-bold text-white disabled:opacity-40",children:a.finance.save}),(0,n.jsx)("button",{type:"button",onClick:t,className:"rounded-full bg-blue-50/80 px-4 py-2.5 text-[14px] font-semibold text-slate-ink dark:bg-white/10",children:a.finance.cancel})]})]})}},38245:(e,t,a)=>{"use strict";a.d(t,{C:()=>m});var n=a(95155),s=a(12115),r=a(26708),i=a(31610),l=a(92584),c=a(22356),o=a(51252),d=a(25555),u=a(41421);function m({value:e,onChange:t,label:a,placeholder:u,scope:x="all"}){let h=(0,d.kj)(),[b,f]=(0,s.useState)(""),[g,y]=(0,s.useState)(""),[v,k]=(0,s.useState)(!1),j=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=setTimeout(()=>y(b.trim()),250);return()=>clearTimeout(e)},[b]);let N=(0,r.I)({queryKey:["user-search",g],queryFn:()=>c.userApi.search(g),enabled:"all"===x&&v&&g.length>=2,staleTime:3e4}),w=(0,r.I)({queryKey:["relationships","picker",g],queryFn:()=>o.g.list(void 0,g||void 0),enabled:"linked"===x&&v,staleTime:3e4});(0,s.useEffect)(()=>{if(!v)return;let e=e=>{j.current&&!j.current.contains(e.target)&&k(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[v]);let S="linked"===x?w.isFetching:N.isFetching,C="linked"===x?(w.data?.items??[]).map(e=>({id:e.user.id,username:e.user.username,avatarUrl:e.user.avatarUrl})):N.data?.items??[];return(0,n.jsxs)("div",{ref:j,className:"relative",children:[a&&(0,n.jsx)("span",{className:"mb-1.5 block text-[13px] font-medium text-slate-ink",children:a}),e?(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded-2xl border border-[var(--sb-card-border)] bg-white/85 px-3 py-2.5 dark:bg-white/10",children:[(0,n.jsx)(p,{user:e}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"truncate text-[14px] font-semibold text-ink",children:e.fullName||`@${e.username}`}),(0,n.jsxs)("p",{className:"truncate text-[12px] text-slate-ink",children:["@",e.username]})]}),(0,n.jsx)("button",{type:"button",onClick:()=>t(null),"aria-label":h.userPicker.clear,className:"grid h-8 w-8 shrink-0 place-items-center rounded-full text-[var(--sb-slate)] transition hover:text-ink active:scale-95",children:(0,n.jsx)(i.gc,{icon:l.Jyw,className:"h-4 w-4"})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("span",{className:"pointer-events-none absolute inset-y-0 start-3.5 grid place-items-center text-[var(--sb-slate)]",children:(0,n.jsx)(i.gc,{icon:l.$UM,className:"h-4 w-4"})}),(0,n.jsx)("input",{type:"search",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,value:b,placeholder:u??h.userPicker.placeholder,onChange:e=>{f(e.target.value),k(!0)},onFocus:()=>k(!0),className:"w-full rounded-2xl border border-[var(--sb-card-border)] bg-white/85 py-3 ps-11 pe-4 text-[15px] text-ink outline-none transition placeholder:text-[var(--sb-slate)] focus:border-[var(--sb-primary)] focus:ring-2 focus:ring-[var(--sb-primary)]/25 dark:bg-white/10"})]}),v&&("linked"===x||g.length>=2)&&(0,n.jsx)("div",{className:"absolute inset-x-0 top-full z-20 mt-1.5 max-h-64 overflow-y-auto rounded-2xl border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] dark:bg-[#0b1d3a] p-1 shadow-xl",children:S&&0===C.length?(0,n.jsxs)("p",{className:"flex items-center gap-2 px-3 py-3 text-[13px] text-slate-ink",children:[(0,n.jsx)(i.gc,{icon:l.s4k,className:"h-3.5 w-3.5 animate-spin"}),h.userPicker.searching]}):0===C.length?(0,n.jsx)("p",{className:"px-3 py-3 text-[13px] text-slate-ink",children:h.userPicker.noResults}):C.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>{t(e),f(""),y(""),k(!1)},className:"flex w-full items-center gap-3 rounded-xl px-2.5 py-2 text-start transition hover:bg-[var(--sb-primary)]/10 active:scale-[0.99]",children:[(0,n.jsx)(p,{user:e}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block truncate text-[14px] font-semibold text-ink",children:e.fullName||`@${e.username}`}),(0,n.jsxs)("span",{className:"block truncate text-[12px] text-slate-ink",children:["@",e.username]})]})]},e.id))})]})]})}function p({user:e}){return(0,n.jsx)(u.e,{src:e.avatarUrl,name:e.username,className:"h-9 w-9 shrink-0 rounded-full object-cover",fallbackClassName:"grid h-9 w-9 shrink-0 place-items-center rounded-full bg-[var(--sb-primary)]/10 text-[13px] font-bold text-[var(--sb-primary)]"})}},41421:(e,t,a)=>{"use strict";a.d(t,{e:()=>l});var n=a(95155),s=a(12115),r=a(31610),i=a(92584);function l({src:e,name:t,className:a="",fallbackClassName:c,fallback:o,fallbackStyle:d,size:u,chars:m=1}
1){let p,[x,h]=(0,s.useState)(null),b="string"==typeof e&&e.trim()?e.trim():null,f=null!==b&&x===b,g=u?{width:u,height:u}:void 0;if(b&&!f)return(0,n.jsx)("img",{src:b,alt:"",className:a,style:g,onError:()=>h(b)});let y=(p=(t??"").replace(/^@/,"").trim())?p.slice(0,m).toUpperCase():"";return(0,n.jsx)("span",{className:c??a,style:d||g?{...g,...d}:void 0,"aria-hidden":!0,children:o??(y||(0,n.jsx)(r.gc,{icon:i.X46}))})}},51070:(e,t,a)=>{Promise.resolve().then(a.bind(a,3722))},51252:(e,t,a)=>{"use strict";a.d(t,{g:()=>s});var n=a(22356);let s={detail:e=>(0,n.nr)(`/api/relationships/${encodeURIComponent(e)}/detail`,{auth:!0}),list:(e,t)=>{let a=new URLSearchParams;return e&&a.set("tag",e),t&&""!==t.trim()&&a.set("q",t.trim()),(0,n.nr)(`/api/relationships?${a.toString()}`,{auth:!0})},requests:()=>(0,n.nr)("/api/relationships/requests",{auth:!0}),acceptRequest:e=>(0,n.nr)(`/api/relationships/requests/${e}/accept`,{method:"POST",auth:!0}),declineRequest:e=>(0,n.nr)(`/api/relationships/requests/${e}`,{method:"DELETE",auth:!0}),upsert:e=>(0,n.nr)("/api/relationships",{method:"POST",auth:!0,body:JSON.stringify(e)}),update:(e,t)=>(0,n.nr)(`/api/relationships/${encodeURIComponent(e)}`,{method:"PATCH",auth:!0,body:JSON.stringify(t)}),remove:e=>(0,n.nr)(`/api/relationships/${encodeURIComponent(e)}`,{method:"DELETE",auth:!0})}},55601:(e,t,a)=>{"use strict";a.d(t,{Ey:()=>l,Vt:()=>o,qP:()=>c,rA:()=>s,yR:()=>i});var n=a(22356);let s={entries:e=>{let t=new URLSearchParams;e?.from&&t.set("from",e.from),e?.to&&t.set("to",e.to),e?.limit&&t.set("limit",String(e.limit));let a=t.toString()?`?${t.toString()}`:"";return(0,n.nr)(`/api/finance/entries${a}`,{auth:!0})},addEntry:e=>(0,n.nr)("/api/finance/entries",{method:"POST",auth:!0,body:JSON.stringify(e)}),removeEntry:e=>(0,n.nr)(`/api/finance/entries/${e}`,{method:"DELETE",auth:!0}),plans:e=>{let t=e?.patientId?`?patientId=${encodeURIComponent(e.patientId)}`:"";return(0,n.nr)(`/api/finance/plans${t}`,{auth:!0})},createPlan:e=>(0,n.nr)("/api/finance/plans",{method:"POST",auth:!0,body:JSON.stringify(e)}),updatePlan:(e,t)=>(0,n.nr)(`/api/finance/plans/${e}`,{method:"PUT",auth:!0,body:JSON.stringify(t)}),planBalance:e=>(0,n.nr)(`/api/finance/plans/${e}/balance`,{auth:!0})},r={TRY:100,EUR:100,USD:100,GBP:100,BGN:100,RUB:100,JPY:1},i=["TRY","EUR","USD","GBP"],l=e=>r[e.toUpperCase()]??100;function c(e,t){let a,n=e.trim().replace(/[^\d.,-]/g,"");if(""===n||!/\d/.test(n))return null;let s=n.lastIndexOf("."),r=n.lastIndexOf(",");if(-1===s&&-1===r)a=n;else{let e=Math.max(s,r),t=n.slice(0,e).replace(/[.,]/g,""),i=n.slice(e+1).replace(/[.,]/g,"");a=3===i.length?`${t}${i}`:`${t}.${i}`}let i=Number(a);if(!Number.isFinite(i))return null;let c=Math.round(i*l(t));return Number.isSafeInteger(c)?c:null}function o(e,t,a="tr-TR"){let n=t.toUpperCase(),s=l(n),r=2*(1!==s);try{return new Intl.NumberFormat(a,{style:"currency",currency:n,minimumFractionDigits:r,maximumFractionDigits:r}).format(e/s)}catch{return`${(e/s).toFixed(r)} ${n}`}}}},e=>{e.O(0,[2266,8058,804,1610,8500,3747,6708,7805,3501,7538,6609,8934,5555,3394,4875,5449,9793,8441,5642,7358],()=>e(e.s=51070)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.