PageSourceSearch

https://shop.malfini.com/assets/index-e2885893.js

js malfini.com collected 2026-09-25 19:58:16 UTC 238,145 bytes, 46 lines download raw bytes

1import{r as T,u as kr,g as wr,t as Jn,f as Re,a as Le,b as Je,c as Rs,j as e,B as Ve,d as gn,e as rs,p as Br,h as jn,i as Us,k as Ps,l as Vr,m as is,n as Gt,o as Yr,q as Fr,s as Qn,v as mn,w as x,x as Ms,y as ks,z as Wr,D as $r,U as Xn,A as Gr,C as lt,E as zr,I as et,M as vn,P as gt,F as ws,G as Hr,H as Xr,J as Bn,K as k,L as de,N as w,O as J,Q as yn,R as We,S as D,T as Hn,V as Ut,W as le,X as tt,Y as Tn,Z as R,_ as nn,$ as H,a0 as _n,a1 as _e,a2 as me,a3 as Bs,a4 as Se,a5 as ge,a6 as un,a7 as Pt,a8 as En,a9 as Ne,aa as je,ab as Vs,ac as oe,ad as Kr,ae as Qr,af as qr,ag as ot,ah as he,ai as ae,aj as Zr,ak as st,al as Jr,am as Mt,an as as,ao as ei,ap as ni,aq as ti,ar as Ys,as as ne,at as z,au as tn,av as rt,aw as Fs,ax as ls,ay as Nn,az as fe,aA as Ws,aB as Z,aC as $s,aD as Be,aE as Mn,aF as si,aG as it,aH as kt,aI as Ge,aJ as Dn,aK as wt,aL as Vn,aM as zt,aN as Gs,aO as ri,aP as On,aQ as ii,aR as zs,aS as Hs,aT as Yn,aU as qn,aV as os,aW as en,aX as ve,aY as Ke,aZ as Ht,a_ as kn,a$ as Xs,b0 as Ks,b1 as nt,b2 as ai,b3 as Rn,b4 as Xt,b5 as li,b6 as fn,b7 as In,b8 as vt,b9 as we,ba as Bt,bb as Qs,bc as cs,bd as ct,be as oi,bf as Kn,bg as ci,bh as di,bi as dt,bj as hn,bk as ui,bl as Vt,bm as ze,bn as hi,bo as I,bp as qs,bq as be,br as Ci,bs as Ni,bt as mi,bu as Zs,bv as Js,bw as er,bx as wn,by as Ai,bz as xi,bA as pi,bB as Ti,bC as Ei,bD as Oi,bE as ji,bF as Kt,bG as fi,bH as Ii,bI as gi,bJ as vi,bK as yi,bL as bi,bM as Si,bN as Li,bO as Di,bP as Oe,bQ as _i,bR as Ri,bS as Ui}from"./index-294078f4.js";function Pi(t,n){if(t===n||Number.isNaN(t)&&Number.isNaN(n))return!0;if(!(t instanceof Object)||!(n instanceof Object))return!1;const s=Object.keys(t),{length:a}=s;if(a!==Object.keys(n).length)return!1;for(let i=0;i<a;i+=1){const o=s[i];if(!(o in n)||t[o]!==n[o]&&!(Number.isNaN(t[o])&&Number.isNaN(n[o])))return!1}return!0}function Mi({timeout:t=2e3}={}){const[n,s]=T.useState(null),[a,i]=T.useState(!1),[o,r]=T.useState(null),l=d=>{window.clearTimeout(o),r(window.setTimeout(()=>i(!1),t)),i(d)};return{copy:d=>{"clipboard"in navigator?navigator.clipboard.writeText(d).then(()=>l(!0)).catch(h=>s(h)):s(new Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{i(!1),s(null),window.clearTimeout(o)},error:n,copied:a}}function ki(t,n){if(!t||!n)return!1;if(t===n)return!0;if(t.length!==n.length)return!1;for(let s=0;s<t.length;s+=1)if(!Pi(t[s],n[s]))return!1;return!0}function wi(t){const n=T.useRef([]),s=T.useRef(0);return ki(n.current,t)||(n.current=t,s.current+=1),[s.current]}function Bi(t,n){T.useEffect(t,wi(n))}function Vi(t,n,s){const a=T.useRef(null),i=T.useRef(null);return T.useEffect(()=>{const o=typeof s=="function"?s():s;return(o||i.current)&&(a.current=new MutationObserver(t),a.current.observe(o||i.current,n)),()=>{var r;(r=a.current)==null||r.disconnect()}},[t,n]),i}function Yi(){const[t,n]=T.useState(!1);return T.useEffect(()=>n(!0),[]),t}function Fi(t,n){if(!n||!t)return!1;let s=n.parentNode;for(;s!=null;){if(s===t)return!0;s=s.parentNode}return!1}function Wi({target:t,parent:n,ref:s,displayAfterTransitionEnd:a}){const i=T.useRef(-1),[o,r]=T.useState(!1),[l,c]=T.useState(typeof a=="boolean"?a:!1),u=()=>{if(!t||!n||!s.current)return;const m=t.getBoundingClientRect(),C=n.getBoundingClientRect(),A=window.getComputedStyle(t),p=window.getComputedStyle(n),f=Jn(A.borderTopWidth)+Jn(p.borderTopWidth),j=Jn(A.borderLeftWidth)+Jn(p.borderLeftWidth),g={top:m.top-C.top-f,left:m.left-C.left-j,width:m.width,height:m.height};s.current.style.transform=`translateY(${g.top}px) translateX(${g.left}px)`,s.current.style.width=`${g.width}px`,s.current.style.height=`${g.height}px`},d=()=>{window.clearTimeout(i.current),s.current&&(s.current.style.transitionDuration="0ms"),u(),i.current=window.setTimeout(()=>{s.current&&(s.current.style.transitionDuration="")},30)},h=T.useRef(null),N=T.useRef(null);return T.useEffect(()=>{if(u(),t)return h.current=new ResizeObserver(d),h.current.observe(t),n&&(N.current=new ResizeObserver(d),N.current.observe(n)),()=>{var m,C;(m=h.current)==null||m.disconnect(),(C=N.current)==null||C.disconnect()}},[n,t]),T.useEffect(()=>{if(n){const m=C=>{Fi(C.target,n)&&(d(),c(!1))};return n.addEventListener("transitionend",m),()=>{n.removeEventListener("transitionend",m)}}},[n]),kr(()=>{wr()!=="test"&&r(!0)},20,{autoInvoke:!0}),Vi(m=>{m.forEach(C=>{C.type==="attributes"&&C.attributeName==="dir"&&d()})},{attributes:!0,attributeFilter:["dir"]},()=>document.documentElement),{initialized:o,hidden:l}}var nr={root:"m_96b553a6"};const $i={},Gi=gn((t,{transitionDuration:n})=>({root:{"--transition-duration":typeof n=="number"?`${n}ms`:n}})),Qt=Re((t,n)=>{const s=Le("FloatingIndicator",$i,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,target:u,parent:d,transitionDuration:h,mod:N,displayAfterTransitionEnd:m,...C}=s,A=Je({name:"FloatingIndicator",classes:nr,props:s,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,varsResolver:Gi}),p=T.useRef(null),{initialized:f,hidden:j}=Wi({target:u,parent:d,ref:p,displayAfterTransitionEnd:m}),g=Rs(n,p);return!u||!d?null:e.jsx(Ve,{ref:g,mod:[{initialized:f,hidden:j},N],...A("root"),...C})});Qt.displayName="@mantine/core/FloatingIndicator";Qt.classes=nr;function Yt({style:t,size:n=16,...s}){return e.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:rs(n),height:rs(n),display:"block"},...s,children:e.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.564
164L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}Yt.displayName="@mantine/core/AccordionChevron";var tr={root:"m_347db0ec","root--dot":"m_fbd81e3d",label:"m_5add502a",section:"m_91fdda9b"};const zi={},Hi=gn((t,{radius:n,color:s,gradient:a,variant:i,size:o,autoContrast:r})=>{const l=t.variantColorResolver({color:s||t.primaryColor,theme:t,gradient:a,variant:i||"filled",autoContrast:r});return{root:{"--badge-height":jn(o,"badge-height"),"--badge-padding-x":jn(o,"badge-padding-x"),"--badge-fz":jn(o,"badge-fz"),"--badge-radius":n===void 0?void 0:Us(n),"--badge-bg":s||i?l.background:void 0,"--badge-color":s||i?l.color:void 0,"--badge-bd":s||i?l.border:void 0,"--badge-dot-color":i==="dot"?Ps(s,t):void 0}}}),qt=Br((t,n)=>{const s=Le("Badge",zi,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,radius:u,color:d,gradient:h,leftSection:N,rightSection:m,children:C,variant:A,fullWidth:p,autoContrast:f,circle:j,mod:g,...v}=s,S=Je({name:"Badge",props:s,classes:tr,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,varsResolver:Hi});return e.jsxs(Ve,{variant:A,mod:[{block:p,circle:j,"with-right-section":!!m,"with-left-section":!!N},g],...S("root",{variant:A}),ref:n,...v,children:[N&&e.jsx("span",{...S("section"),"data-position":"left",children:N}),e.jsx("span",{...S("label"),children:C}),m&&e.jsx("span",{...S("section"),"data-position":"right",children:m})]})});qt.classes=tr;qt.displayName="@mantine/core/Badge";const Xi={timeout:1e3};function sr(t){const{children:n,timeout:s,value:a,...i}=Le("CopyButton",Xi,t),o=Mi({timeout:s}),r=()=>o.copy(a);return e.jsx(e.Fragment,{children:n({copy:r,copied:o.copied,...i})})}sr.displayName="@mantine/core/CopyButton";var rr={root:"m_cf365364",indicator:"m_9e182ccd",label:"m_1738fcb2",input:"m_1714d588",control:"m_69686b9b",innerLabel:"m_78882f40"};const Ki={withItemsBorders:!0},Qi=gn((t,{radius:n,color:s,transitionDuration:a,size:i,transitionTimingFunction:o})=>({root:{"--sc-radius":n===void 0?void 0:Us(n),"--sc-color":s?Ps(s,t):void 0,"--sc-shadow":s?void 0:"var(--mantine-shadow-xs)","--sc-transition-duration":a===void 0?void 0:`${a}ms`,"--sc-transition-timing-function":o,"--sc-padding":jn(i,"sc-padding"),"--sc-font-size":Qn(i)}})),Zt=Re((t,n)=>{var pe,ce;const s=Le("SegmentedControl",Ki,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,data:u,value:d,defaultValue:h,onChange:N,size:m,name:C,disabled:A,readOnly:p,fullWidth:f,orientation:j,radius:g,color:v,transitionDuration:S,transitionTimingFunction:y,variant:L,autoContrast:O,withItemsBorders:_,mod:M,...B}=s,P=Je({name:"SegmentedControl",props:s,classes:rr,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,varsResolver:Qi}),F=Vr(),q=u.map(X=>typeof X=="string"?{label:X,value:X}:X),W=Yi(),[ee,$]=T.useState(is()),[K,b]=T.useState(null),[Q,U]=T.useState({}),V=(X,ue)=>{Q[ue]=X,U(Q)},[se,xe]=Gt({value:d,defaultValue:h,finalValue:Array.isArray(u)?((pe=q.find(X=>!X.disabled))==null?void 0:pe.value)??((ce=u[0])==null?void 0:ce.value)??null:null,onChange:N}),Ie=Yr(C),Ue=q.map(X=>T.createElement(Ve,{...P("control"),mod:{active:se===X.value,orientation:j},key:X.value},T.createElement("input",{...P("input"),disabled:A||X.disabled,type:"radio",name:Ie,value:X.value,id:`${Ie}-${X.value}`,checked:se===X.value,onChange:()=>!p&&xe(X.value),"data-focus-ring":F.focusRing,key:`${X.value}-input`}),T.createElement(Ve,{component:"label",...P("label"),mod:{active:se===X.value&&!(A||X.disabled),disabled:A||X.disabled,"read-only":p},htmlFor:`${Ie}-${X.value}`,ref:ue=>V(ue,X.value),__vars:{"--sc-label-color":v!==void 0?Fr({color:v,theme:F,autoContrast:O}):void 0},key:`${X.value}-label`},e.jsx("span",{...P("innerLabel"),children:X.label})))),De=Rs(n,X=>b(X));return Bi(()=>{$(is())},[u.length]),u.length===0?null:e.jsxs(Ve,{...P("root"),variant:L,size:m,ref:De,mod:[{"full-width":f,orientation:j,initialized:W,"with-items-borders":_},M],...B,role:"radiogroup","data-disabled":A,children:[typeof se=="string"&&e.jsx(Qt,{target:Q[se],parent:K,component:"span",transitionDuration:"var(--sc-transition-duration)",...P("indicator")},ee),Ue]})});Zt.classes=rr;Zt.displayName="@mantine/core/SegmentedControl";/**
2 * @license @tabler/icons-react v3.36.1 - MIT
3 *
4 * This source code is licensed under the MIT license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const qi=[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l6 6",key:"svg-1"}],["path",{d:"M5 12l6 -6",key:"svg-2"}]],Zi=mn("outline","arrow-left","ArrowLeft",qi);/**
7 * @license @tabler/icons-react v3.36.1 - MIT
8 *
9 * This source code is licensed under the MIT license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Ji=[["path",{d:"M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12",key:"svg-0"}],["path",{d:"M16 3v4",key:"svg-1"}],["path",{d:"M8 3v4",key:"svg-2"}],["path",{d:"M4 11h16",key:"svg-3"}],["path",{d:"M8 14v4",key:"svg-4"}],["path",{d:"M12 14v4",key:"svg-5"}],["path",{d:"M16 14v4",key:"svg-6"}]],ea=mn("outline","calendar-month","CalendarMonth",Ji);/**
12 * @license @tabler/icons-react v3.36.1 - MIT
13 *
14 * This source code is licensed under the MIT license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const na=[["path",{d:"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666",key:"svg-0"}],["path",{d:"M4.012 16.737a2 2 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}],["path",{d:"M11 14l2 2l4 -4",key:"svg-2"}]],ta=mn("outline","copy-check","CopyCheck",na);/**
17 * @license @tabler/icons-react v3.36.1 - MIT
18 *
19 * This source code is licensed under the MIT license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const sa=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M12 9v4",key:"svg-1"}],["path",{d:"M12 16v.01",key:"svg-2"}]],ra=mn("outline","exclamation-circle","ExclamationCircle",sa);/**
22 * @license @tabler/icons-react v3.36.1 - MIT
23 *
24 * This source code is licensed under the MIT license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const ia=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M19 12v7a1.78 1.78 0 0 1 -3.1 1.4a1.65 1.65 0 0 0 -2.6 0a1.65 1.65 0 0 1 -2.6 0a1.65 1.65 0 0 0 -2.6 0a1.78 1.78 0 0 1 -3.1 -1.4v-14a2 2 0 0 1 2 -2h7l5 5v4.25",key:"svg-1"}]],aa=mn("outline","invoice","Invoice",ia);/**
27 * @license @tabler/icons-react v3.36.1 - MIT
28 *
29 * This source code is licensed under the MIT license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const la=[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]],oa=mn("outline","link","Link",la);/**
32 * @license @tabler/icons-react v3.36.1 - MIT
33 *
34 * This source code is licensed under the MIT license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const ca=[["path",{d:"M17 17h2a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2h-14a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h2",key:"svg-0"}],["path",{d:"M17 9v-4a2 2 0 0 0 -2 -2h-6a2 2 0 0 0 -2 2v4",key:"svg-1"}],["path",{d:"M7 15a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2l0 -4",key:"svg-2"}]],da=mn("outline","printer","Printer",ca);/**
37 * @license @tabler/icons-react v3.36.1 - MIT
38 *
39 * This source code is licensed under the MIT license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const ua=[["path",{d:"M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.00
417 9.425 4.747",key:"svg-0"}],["path",{d:"M20 4v5h-5",key:"svg-1"}]],ha=mn("outline","reload","Reload",ua);/**
42 * @license @tabler/icons-react v3.36.1 - MIT
43 *
44 * This source code is licensed under the MIT license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const Ca=[["path",{d:"M4.698 4.034l16.302 7.966l-16.302 7.966a.503 .503 0 0 1 -.546 -.124a.555 .555 0 0 1 -.12 -.568l2.468 -7.274l-2.468 -7.274a.555 .555 0 0 1 .12 -.568a.503 .503 0 0 1 .546 -.124",key:"svg-0"}],["path",{d:"M6.5 12h14.5",key:"svg-1"}]],Na=mn("outline","send-2","Send2",Ca);function ma(t,n,s=!0){return{...t,default:n,decode:(...i)=>{const o=t.decode(...i);return o===void 0||s&&o===null?n:o}}}function Aa({type:t,date:n,locale:s,format:a,labelSeparator:i}){const o=r=>x(r).locale(s).format(a);return t==="default"?n===null?"":o(n):t==="multiple"?n.map(o).join(", "):t==="range"&&Array.isArray(n)?n[0]&&n[1]?`${o(n[0])} ${i} ${o(n[1])}`:n[0]?`${o(n[0])} ${i} `:"":""}function xa({formatter:t,...n}){return(t||Aa)(n)}function pa({direction:t,levelIndex:n,rowIndex:s,cellIndex:a,size:i}){switch(t){case"up":return n===0&&s===0?null:s===0?{levelIndex:n-1,rowIndex:a<=i[n-1][i[n-1].length-1]-1?i[n-1].length-1:i[n-1].length-2,cellIndex:a}:{levelIndex:n,rowIndex:s-1,cellIndex:a};case"down":return s===i[n].length-1?{levelIndex:n+1,rowIndex:0,cellIndex:a}:s===i[n].length-2&&a>=i[n][i[n].length-1]?{levelIndex:n+1,rowIndex:0,cellIndex:a}:{levelIndex:n,rowIndex:s+1,cellIndex:a};case"left":return n===0&&s===0&&a===0?null:s===0&&a===0?{levelIndex:n-1,rowIndex:i[n-1].length-1,cellIndex:i[n-1][i[n-1].length-1]-1}:a===0?{levelIndex:n,rowIndex:s-1,cellIndex:i[n][s-1]-1}:{levelIndex:n,rowIndex:s,cellIndex:a-1};case"right":return s===i[n].length-1&&a===i[n][s]-1?{levelIndex:n+1,rowIndex:0,cellIndex:0}:a===i[n][s]-1?{levelIndex:n,rowIndex:s+1,cellIndex:0}:{levelIndex:n,rowIndex:s,cellIndex:a+1};default:return{levelIndex:n,rowIndex:s,cellIndex:a}}}function ir({controlsRef:t,direction:n,levelIndex:s,rowIndex:a,cellIndex:i,size:o}){var c,u,d;const r=pa({direction:n,size:o,rowIndex:a,cellIndex:i,levelIndex:s});if(!r)return;const l=(d=(u=(c=t.current)==null?void 0:c[r.levelIndex])==null?void 0:u[r.rowIndex])==null?void 0:d[r.cellIndex];l&&(l.disabled||l.getAttribute("data-hidden")||l.getAttribute("data-outside")?ir({controlsRef:t,direction:n,levelIndex:r.levelIndex,cellIndex:r.cellIndex,rowIndex:r.rowIndex,size:o}):l.focus())}function Ta(t){switch(t){case"ArrowDown":return"down";case"ArrowUp":return"up";case"ArrowRight":return"right";case"ArrowLeft":return"left";default:return null}}function Ea(t){var n;return(n=t.current)==null?void 0:n.map(s=>s.map(a=>a.length))}function Jt({controlsRef:t,levelIndex:n,rowIndex:s,cellIndex:a,event:i}){const o=Ta(i.key);if(o){i.preventDefault();const r=Ea(t);ir({controlsRef:t,direction:o,levelIndex:n,rowIndex:s,cellIndex:a,size:r})}}var ar={exports:{}};(function(t,n){(function(s,a){t.exports=a()})(Ms,function(){var s={year:0,month:1,day:2,hour:3,minute:4,second:5},a={};return function(i,o,r){var l,c=function(N,m,C){C===void 0&&(C={});var A=new Date(N),p=function(f,j){j===void 0&&(j={});var g=j.timeZoneName||"short",v=f+"|"+g,S=a[v];return S||(S=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:f,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:g}),a[v]=S),S}(m,C);return p.formatToParts(A)},u=function(N,m){for(var C=c(N,m),A=[],p=0;p<C.length;p+=1){var f=C[p],j=f.type,g=f.value,v=s[j];v>=0&&(A[v]=parseInt(g,10))}var S=A[3],y=S===24?0:S,L=A[0]+"-"+A[1]+"-"+A[2]+" "+y+":"+A[4]+":"+A[5]+":000",O=+N;return(r.utc(L).valueOf()-(O-=O%1e3))/6e4},d=o.prototype;d.tz=function(N,m){N===void 0&&(N=l);var C,A=this.utcOffset(),p=this.toDate(),f=p.toLocaleString("en-US",{timeZone:N}),j=Math.round((p-new Date(f))/1e3/60),g=15*-Math.round(p.getTimezoneOffset()/15)-j;if(!Number(g))C=this.utcOffset(0,m);else if(C=r(f,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(g,!0),m){var v=C.utcOffset();C=C.add(A-v,"minute")}return C.$x.$timezone=N,C},d.offsetName=function(N){var m=this.$x.$timezone||r.tz.guess(),C=c(this.valueOf(),m,{timeZoneName:N}).find(function(A){return A.type.toLowerCase()==="timezonename"});return C&&C.value};var h=d.startOf;d.startOf=function(N,m){if(!this.$x||!this.$x.$timezone)return h.call(this,N,m);var C=r(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return h.call(C,N,m).tz(this.$x.$timezone,!0)},r.tz=function(N,m,C){var A=C&&m,p=C||m||l,f=u(+r(),p);
46if(typeof N!="string")return r(N).tz(p);var j=function(y,L,O){var _=y-60*L*1e3,M=u(_,O);if(L===M)return[_,L];var B=u(_-=60*(M-L)*1e3,O);return M===B?[_,M]:[y-60*Math.min(M,B)*1e3,Math.max(M,B)]}(r.utc(N,A).valueOf(),f,p),g=j[0],v=j[1],S=r(g).utcOffset(v);return S.$x.$timezone=p,S},r.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},r.tz.setDefault=function(N){l=N}}})})(ar);var Oa=ar.exports;const ja=ks(Oa);x.extend(Wr);x.extend(ja);function fa(t,n){return n?x(t).tz(n).utcOffset()+t.getTimezoneOffset():0}const ds=(t,n,s)=>{if(!t)return null;if(!n)return t;let a=fa(t,n);return s==="remove"&&(a*=-1),x(t).add(a,"minutes").toDate()};function Cn(t,n,s,a){return a||!n?n:Array.isArray(n)?n.map(i=>ds(i,s,t)):ds(n,s,t)}function Ia({minDate:t,maxDate:n,timezone:s}){const a=Cn("add",new Date,s);return!t&&!n?a:t&&x(a).isBefore(t)?t:n&&x(a).isAfter(n)?n:a}function He(){const t=T.useContext($r),n=T.useCallback(r=>r||t.locale,[t.locale]),s=T.useCallback(r=>r||t.timezone||void 0,[t.timezone]),a=T.useCallback(r=>typeof r=="number"?r:t.firstDayOfWeek,[t.firstDayOfWeek]),i=T.useCallback(r=>Array.isArray(r)?r:t.weekendDays,[t.weekendDays]),o=T.useCallback(r=>typeof r=="string"?r:t.labelSeparator,[t.labelSeparator]);return{...t,getLocale:n,getTimezone:s,getFirstDayOfWeek:a,getWeekendDays:i,getLabelSeparator:o}}function ga(t,n){const s=He(),a=i=>Cn("remove",i,s.getTimezone()).toISOString();if(n==="range"&&Array.isArray(t)){const[i,o]=t;return i?o?`${a(i)} – ${a(o)}`:`${a(i)} –`:""}return n==="multiple"&&Array.isArray(t)?t.map(i=>i&&a(i)).filter(Boolean).join(", "):!Array.isArray(t)&&t?a(t):""}function lr({value:t,type:n,name:s,form:a}){return e.jsx("input",{type:"hidden",value:ga(t,n),name:s,form:a})}lr.displayName="@mantine/dates/HiddenDatesInput";var or={day:"m_396ce5cb"};const va={},ya=gn((t,{size:n})=>({day:{"--day-size":jn(n,"day-size")}})),es=Re((t,n)=>{const s=Le("Day",va,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,date:u,disabled:d,__staticSelector:h,weekend:N,outside:m,selected:C,renderDay:A,inRange:p,firstInRange:f,lastInRange:j,hidden:g,static:v,highlightToday:S,...y}=s,L=Je({name:h||"Day",classes:or,props:s,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,varsResolver:ya,rootSelector:"day"}),O=He();return e.jsx(Xn,{...L("day",{style:g?{display:"none"}:void 0}),component:v?"div":"button",ref:n,disabled:d,"data-today":x(u).isSame(Cn("add",new Date,O.getTimezone()),"day")||void 0,"data-hidden":g||void 0,"data-highlight-today":S||void 0,"data-disabled":d||void 0,"data-weekend":!d&&!m&&N||void 0,"data-outside":!d&&m||void 0,"data-selected":!d&&C||void 0,"data-in-range":p&&!d||void 0,"data-first-in-range":f&&!d||void 0,"data-last-in-range":j&&!d||void 0,"data-static":v||void 0,unstyled:l,...y,children:(A==null?void 0:A(u))||x(u).date()})});es.classes=or;es.displayName="@mantine/dates/Day";function ba({locale:t,format:n="dd",firstDayOfWeek:s=1}){const a=x().day(s),i=[];for(let o=0;o<7;o+=1)typeof n=="string"?i.push(x(a).add(o,"days").locale(t).format(n)):i.push(n(x(a).add(o,"days").toDate()));return i}var cr={weekday:"m_18a3eca"};const Sa={},La=gn((t,{size:n})=>({weekdaysRow:{"--wr-fz":Qn(n),"--wr-spacing":Gr(n)}})),ns=Re((t,n)=>{const s=Le("WeekdaysRow",Sa,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,locale:u,firstDayOfWeek:d,weekdayFormat:h,cellComponent:N="th",__staticSelector:m,withWeekNumbers:C,...A}=s,p=Je({name:m||"WeekdaysRow",classes:cr,props:s,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,varsResolver:La,rootSelector:"weekdaysRow"}),f=He(),j=ba({locale:f.getLocale(u),format:h,firstDayOfWeek:f.getFirstDayOfWeek(d)}).map((g,v)=>e.jsx(N,{...p("weekday"),children:g},v));return e.jsxs(Ve,{component:"tr",ref:n,...p("weekdaysRow"),...A,children:[C&&e.jsx(N,{...p("weekday"),children:"#"}),j]})});ns.classes=cr;ns.displayName="@mantine/dates/WeekdaysRow";function Da(t,n=1){let s=x(t);const a=n===0?6:n-1;for(;s.day()!==a;)s=s.add(1,"day");return s.toDate()}function _a(t,n=1){let s=x(t);for(;s.day()!==n;)s=s.subtract(1,"day");return s.toDate()}function Ra({month:t,firstDayOfWeek:n=1,consistentWeeks:s}){const a=x(t).subtract(x(t).date()-1,"day"),i=x(a).startOf("day"),o=i.toDate(),r=i.add(+i.daysInMonth()-1,"day").toDate(),l=Da(r,n),c=_a(o,n),u=[];for(;c<=l;){const d=[];for(let h=0;h<7;h+=1)d.push(new Date(c)),c.setDate(c.getDate()+1);u.push(d)}if(s&&u.length<6){const d=u[u.length-1],h=d[d.length-1],N=new Date(h);for(N.setDate(N.getDate()+1);u.length<6;){const m=[];for(let C=0;C<7;C+=1)m.push(new Date(N)),N.setDate(N.getDate()+1);u.push(m)}}return u}function dr(t,n){return x(t).format("YYYY-MM")===x(n).format("YYYY-MM")}function ur(t,n){return n instanceof Date?x(t).isAfter(x(n).subtract(1,"day"),"day"):!0}function hr(t,n){return n instanceof Date?x(t).isBefore(x(n).add(1,"day"),"day"):!0}function Ua(t,n,s,a,i,o,r){const l=t.flat().filter(d=>{var h;return hr(d,s)&&ur(d,n)&&!(i!=null&&i(d))&&!((h=a==null?void 0:a(d))!=null&&h.disabled)&&(!o||dr(d,r))}),c=l.find(d=>{var h;
46return(h=a==null?void 0:a(d))==null?void 0:h.selected});if(c)return c;const u=l.find(d=>x().isSame(d,"date"));return u||l[0]}var Cr={exports:{}};(function(t,n){(function(s,a){t.exports=a()})(Ms,function(){var s="day";return function(a,i,o){var r=function(u){return u.add(4-u.isoWeekday(),s)},l=i.prototype;l.isoWeekYear=function(){return r(this).year()},l.isoWeek=function(u){if(!this.$utils().u(u))return this.add(7*(u-this.isoWeek()),s);var d,h,N,m,C=r(this),A=(d=this.isoWeekYear(),h=this.$u,N=(h?o.utc:o)().year(d).startOf("year"),m=4-N.isoWeekday(),N.isoWeekday()>4&&(m+=7),N.add(m,s));return C.diff(A,"week")+1},l.isoWeekday=function(u){return this.$utils().u(u)?this.day()||7:this.day(this.day()%7?u:u-7)};var c=l.startOf;l.startOf=function(u,d){var h=this.$utils(),N=!!h.u(d)||d;return h.p(u)==="isoweek"?N?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):c.bind(this)(u,d)}}})})(Cr);var Pa=Cr.exports;const Ma=ks(Pa);x.extend(Ma);function ka(t){const n=t.find(s=>x(s).day()===1);return x(n).isoWeek()}var Nr={month:"m_cc9820d3",monthCell:"m_8f457cd5",weekNumber:"m_6cff9dea"};const wa={withCellSpacing:!0},Ba=gn((t,{size:n})=>({weekNumber:{"--wn-fz":Qn(n),"--wn-size":jn(n,"wn-size")}})),ut=Re((t,n)=>{const s=Le("Month",wa,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,__staticSelector:u,locale:d,firstDayOfWeek:h,weekdayFormat:N,month:m,weekendDays:C,getDayProps:A,excludeDate:p,minDate:f,maxDate:j,renderDay:g,hideOutsideDates:v,hideWeekdays:S,getDayAriaLabel:y,static:L,__getDayRef:O,__onDayKeyDown:_,__onDayClick:M,__onDayMouseEnter:B,__preventFocus:P,__stopPropagation:F,withCellSpacing:q,size:W,highlightToday:ee,withWeekNumbers:$,...K}=s,b=Je({name:u||"Month",classes:Nr,props:s,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,varsResolver:Ba,rootSelector:"month"}),Q=He(),U=Ra({month:m,firstDayOfWeek:Q.getFirstDayOfWeek(h),consistentWeeks:Q.consistentWeeks}),V=Ua(U,f,j,A,p,v,m),{resolvedClassNames:se,resolvedStyles:xe}=lt({classNames:a,styles:r,props:s}),Ie=U.map((Ue,De)=>{const pe=Ue.map((ce,X)=>{const ue=!dr(ce,m),Ye=(y==null?void 0:y(ce))||x(ce).locale(d||Q.locale).format("D MMMM YYYY"),G=A==null?void 0:A(ce),ke=x(ce).isSame(V,"date");return e.jsx("td",{...b("monthCell"),"data-with-spacing":q||void 0,children:e.jsx(es,{__staticSelector:u||"Month",classNames:se,styles:xe,unstyled:l,"data-mantine-stop-propagation":F||void 0,highlightToday:ee,renderDay:g,date:ce,size:W,weekend:Q.getWeekendDays(C).includes(ce.getDay()),outside:ue,hidden:v?ue:!1,"aria-label":Ye,static:L,disabled:(p==null?void 0:p(ce))||!hr(ce,j)||!ur(ce,f),ref:Ae=>O==null?void 0:O(De,X,Ae),...G,onKeyDown:Ae=>{var ye;(ye=G==null?void 0:G.onKeyDown)==null||ye.call(G,Ae),_==null||_(Ae,{rowIndex:De,cellIndex:X,date:ce})},onMouseEnter:Ae=>{var ye;(ye=G==null?void 0:G.onMouseEnter)==null||ye.call(G,Ae),B==null||B(Ae,ce)},onClick:Ae=>{var ye;(ye=G==null?void 0:G.onClick)==null||ye.call(G,Ae),M==null||M(Ae,ce)},onMouseDown:Ae=>{var ye;(ye=G==null?void 0:G.onMouseDown)==null||ye.call(G,Ae),P&&Ae.preventDefault()},tabIndex:P||!ke?-1:0})},ce.toString())});return e.jsxs("tr",{...b("monthRow"),children:[$&&e.jsx("td",{...b("weekNumber"),children:ka(Ue)}),pe]},De)});return e.jsxs(Ve,{component:"table",...b("month"),size:W,ref:n,...K,children:[!S&&e.jsx("thead",{...b("monthThead"),children:e.jsx(ns,{__staticSelector:u||"Month",locale:d,firstDayOfWeek:h,weekdayFormat:N,size:W,classNames:se,styles:xe,unstyled:l,withWeekNumbers:$})}),e.jsx("tbody",{...b("monthTbody"),children:Ie})]})});ut.classes=Nr;ut.displayName="@mantine/dates/Month";var mr={pickerControl:"m_dc6a3c71"};const Va={},Ya=gn((t,{size:n})=>({pickerControl:{"--dpc-fz":Qn(n),"--dpc-size":jn(n,"dpc-size")}})),ht=Re((t,n)=>{const s=Le("PickerControl",Va,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,firstInRange:u,lastInRange:d,inRange:h,__staticSelector:N,selected:m,disabled:C,...A}=s,p=Je({name:N||"PickerControl",classes:mr,props:s,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,varsResolver:Ya,rootSelector:"pickerControl"});return e.jsx(Xn,{...p("pickerControl"),ref:n,unstyled:l,"data-picker-control":!0,"data-selected":m&&!C||void 0,"data-disabled":C||void 0,"data-in-range":h&&!C&&!m||void 0,"data-first-in-range":u&&!C||void 0,"data-last-in-range":d&&!C||void 0,disabled:C,...A})});ht.classes=mr;ht.displayName="@mantine/dates/PickerControl";function Ar(t,n,s){return!n&&!s?!1:!!(n&&x(t).isBefore(n,"year")||s&&x(t).isAfter(s,"year"))}function Fa(t,n,s,a){const i=t.flat().filter(l=>{var c;return!Ar(l,n,s)&&!((c=a==null?void 0:a(l))!=null&&c.disabled)}),o=i.find(l=>{var c;return(c=a==null?void 0:a(l))==null?void 0:c.selected});if(o)return o;const r=i.find(l=>x().isSame(l,"year"));return r||i[0]}function xr(t){const n=t.getFullYear(),s=n-n%10;let a=0;const i=[[],[],[],[]];for(let o=0;o<4;o+=1){const r=o===3?1:3;for(let l=0;l<r;l+=1)i[o].push(new Date(s+a,0)),a+=1}return i}var pr={yearsList:"m_9206547b",yearsListCell:"m_c5a19c7d"};const Wa={yearsListFormat:"YYYY",withCellSpacing:!0},Ct=Re((t,n)=>{const s=Le("YearsList",Wa,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,decade:u,yearsListFormat:d,locale:h,minDate:N,maxDate:m,getYearControlProps:C,__staticSelector:A,__getControlRef:p,__onControlKeyDown:f,__onControlClick:j,__onControlMouseEnter:g,__preventFocus:v,__stopPropagation:S,withCellSpacing:y,size:L,...O}=s,_=Je({name:A||"YearsList",classes:pr,props:s,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,rootSelector:"yearsList"}),M=He(),B=xr(u),P=Fa(B,N,m,C),F=B.map((q,W)=>{const ee=q.map(($,K)=>{const b=C==null?void 0:C($),Q=x($).isSame(P,"year");return e.jsx("td",{..._("yearsListCell"),"data-with-spacing":y||void 0,children:e.jsx(ht,{..._("yearsListControl"),size:L,unstyled:l,"data-mantine-stop-propagation":S||void 0,disabled:Ar($,N,m),ref:U=>p==null?void 0:p(W,K,U),...b,onKeyDown:U=>{var V;(V=b==null?void 0:b.onKeyDown)==null||V.call(b,U),f==null||f(U,{rowIndex:W,cellIndex:K,date:$})},onClick:U=>{var V;(V=b==null?void 0:b.onClick)==null||V.call(b,U),j==null||j(U,$)},onMouseEnter:U=>{var V;(V=b==null?void 0:b.onMouseEnter)==null||V.call(b,U),g==null||g(U,$)},onMouseDown:U=>{var V;(V=b==null?void 0:b.onMouseDown)==null||V.call(b,U),v&&U.preventDefault()},tabIndex:v||!Q?-1:0,children:x($).locale(M.getLocale(h)).format(d)})},K)});
46return e.jsx("tr",{..._("yearsListRow"),children:ee},W)});return e.jsx(Ve,{component:"table",ref:n,size:L,..._("yearsList"),...O,children:e.jsx("tbody",{children:F})})});Ct.classes=pr;Ct.displayName="@mantine/dates/YearsList";function Tr(t,n,s){return!n&&!s?!1:!!(n&&x(t).isBefore(n,"month")||s&&x(t).isAfter(s,"month"))}function $a(t,n,s,a){const i=t.flat().filter(l=>{var c;return!Tr(l,n,s)&&!((c=a==null?void 0:a(l))!=null&&c.disabled)}),o=i.find(l=>{var c;return(c=a==null?void 0:a(l))==null?void 0:c.selected});if(o)return o;const r=i.find(l=>x().isSame(l,"month"));return r||i[0]}function Ga(t){const n=x(t).startOf("year").toDate(),s=[[],[],[],[]];let a=0;for(let i=0;i<4;i+=1)for(let o=0;o<3;o+=1)s[i].push(x(n).add(a,"months").toDate()),a+=1;return s}var Er={monthsList:"m_2a6c32d",monthsListCell:"m_fe27622f"};const za={monthsListFormat:"MMM",withCellSpacing:!0},Nt=Re((t,n)=>{const s=Le("MonthsList",za,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,__staticSelector:u,year:d,monthsListFormat:h,locale:N,minDate:m,maxDate:C,getMonthControlProps:A,__getControlRef:p,__onControlKeyDown:f,__onControlClick:j,__onControlMouseEnter:g,__preventFocus:v,__stopPropagation:S,withCellSpacing:y,size:L,...O}=s,_=Je({name:u||"MonthsList",classes:Er,props:s,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,rootSelector:"monthsList"}),M=He(),B=Ga(d),P=$a(B,m,C,A),F=B.map((q,W)=>{const ee=q.map(($,K)=>{const b=A==null?void 0:A($),Q=x($).isSame(P,"month");return e.jsx("td",{..._("monthsListCell"),"data-with-spacing":y||void 0,children:e.jsx(ht,{..._("monthsListControl"),size:L,unstyled:l,__staticSelector:u||"MonthsList","data-mantine-stop-propagation":S||void 0,disabled:Tr($,m,C),ref:U=>p==null?void 0:p(W,K,U),...b,onKeyDown:U=>{var V;(V=b==null?void 0:b.onKeyDown)==null||V.call(b,U),f==null||f(U,{rowIndex:W,cellIndex:K,date:$})},onClick:U=>{var V;(V=b==null?void 0:b.onClick)==null||V.call(b,U),j==null||j(U,$)},onMouseEnter:U=>{var V;(V=b==null?void 0:b.onMouseEnter)==null||V.call(b,U),g==null||g(U,$)},onMouseDown:U=>{var V;(V=b==null?void 0:b.onMouseDown)==null||V.call(b,U),v&&U.preventDefault()},tabIndex:v||!Q?-1:0,children:x($).locale(M.getLocale(N)).format(h)})},K)});return e.jsx("tr",{..._("monthsListRow"),children:ee},W)});return e.jsx(Ve,{component:"table",ref:n,size:L,..._("monthsList"),...O,children:e.jsx("tbody",{children:F})})});Nt.classes=Er;Nt.displayName="@mantine/dates/MonthsList";var Or={calendarHeader:"m_730a79ed",calendarHeaderLevel:"m_f6645d97",calendarHeaderControl:"m_2351eeb0",calendarHeaderControlIcon:"m_367dc749"};const Ha={nextDisabled:!1,previousDisabled:!1,hasNextLevel:!0,withNext:!0,withPrevious:!0},Xa=gn((t,{size:n})=>({calendarHeader:{"--dch-control-size":jn(n,"dch-control-size"),"--dch-fz":Qn(n)}})),bn=Re((t,n)=>{const s=Le("CalendarHeader",Ha,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,nextIcon:u,previousIcon:d,nextLabel:h,previousLabel:N,onNext:m,onPrevious:C,onLevelClick:A,label:p,nextDisabled:f,previousDisabled:j,hasNextLevel:g,levelControlAriaLabel:v,withNext:S,withPrevious:y,__staticSelector:L,__preventFocus:O,__stopPropagation:_,...M}=s,B=Je({name:L||"CalendarHeader",classes:Or,props:s,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,varsResolver:Xa,rootSelector:"calendarHeader"}),P=O?F=>F.preventDefault():void 0;return e.jsxs(Ve,{...B("calendarHeader"),ref:n,...M,children:[y&&e.jsx(Xn,{...B("calendarHeaderControl"),"data-direction":"previous","aria-label":N,onClick:C,unstyled:l,onMouseDown:P,disabled:j,"data-disabled":j||void 0,tabIndex:O||j?-1:0,"data-mantine-stop-propagation":_||void 0,children:d||e.jsx(Yt,{...B("calendarHeaderControlIcon"),"data-direction":"previous",size:"45%"})}),e.jsx(Xn,{component:g?"button":"div",...B("calendarHeaderLevel"),onClick:g?A:void 0,unstyled:l,onMouseDown:g?P:void 0,disabled:!g,"data-static":!g||void 0,"aria-label":v,tabIndex:O||!g?-1:0,"data-mantine-stop-propagation":_||void 0,children:p}),S&&e.jsx(Xn,{...B("calendarHeaderControl"),"data-direction":"next","aria-label":h,onClick:m,unstyled:l,onMouseDown:P,disabled:f,"data-disabled":f||void 0,tabIndex:O||f?-1:0,"data-mantine-stop-propagation":_||void 0,children:u||e.jsx(Yt,{...B("calendarHeaderControlIcon"),"data-direction":"next",size:"45%"})})]})});bn.classes=Or;bn.displayName="@mantine/dates/CalendarHeader";function Ka(t){const n=xr(t);return[n[0][0],n[3][0]]}const Qa={decadeLabelFormat:"YYYY"},mt=Re((t,n)=>{const s=Le("DecadeLevel",Qa,t),{decade:a,locale:i,minDate:o,maxDate:r,yearsListFormat:l,getYearControlProps:c,__getControlRef:u,__onControlKeyDown:d,__onControlClick:h,__onControlMouseEnter:N,withCellSpacing:m,__preventFocus:C,nextIcon:A,previousIcon:p,nextLabel:f,previousLabel:j,onNext:g,onPrevious:v,nextDisabled:S,previousDisabled:y,levelControlAriaLabel:L,withNext:O,withPrevious:_,decadeLabelFormat:M,classNames:B,styles:P,unstyled:F,__staticSelector:q,__stopPropagation:W,size:ee,...$}=s,K=He(),[b,Q]=Ka(a),U={__staticSelector:q||"DecadeLevel",classNames:B,styles:P,unstyled:F,size:ee},V=typeof S=="boolean"?S:r?!x(Q).endOf("year").isBefore(r):!1,se=typeof y=="boolean"?y:o?!x(b).startOf("year").isAfter(o
46):!1,xe=(Ie,Ue)=>x(Ie).locale(i||K.locale).format(Ue);return e.jsxs(Ve,{"data-decade-level":!0,size:ee,ref:n,...$,children:[e.jsx(bn,{label:typeof M=="function"?M(b,Q):`${xe(b,M)} – ${xe(Q,M)}`,__preventFocus:C,__stopPropagation:W,nextIcon:A,previousIcon:p,nextLabel:f,previousLabel:j,onNext:g,onPrevious:v,nextDisabled:V,previousDisabled:se,hasNextLevel:!1,levelControlAriaLabel:L,withNext:O,withPrevious:_,...U}),e.jsx(Ct,{decade:a,locale:i,minDate:o,maxDate:r,yearsListFormat:l,getYearControlProps:c,__getControlRef:u,__onControlKeyDown:d,__onControlClick:h,__onControlMouseEnter:N,__preventFocus:C,__stopPropagation:W,withCellSpacing:m,...U})]})});mt.classes={...Ct.classes,...bn.classes};mt.displayName="@mantine/dates/DecadeLevel";const qa={yearLabelFormat:"YYYY"},At=Re((t,n)=>{const s=Le("YearLevel",qa,t),{year:a,locale:i,minDate:o,maxDate:r,monthsListFormat:l,getMonthControlProps:c,__getControlRef:u,__onControlKeyDown:d,__onControlClick:h,__onControlMouseEnter:N,withCellSpacing:m,__preventFocus:C,nextIcon:A,previousIcon:p,nextLabel:f,previousLabel:j,onNext:g,onPrevious:v,onLevelClick:S,nextDisabled:y,previousDisabled:L,hasNextLevel:O,levelControlAriaLabel:_,withNext:M,withPrevious:B,yearLabelFormat:P,__staticSelector:F,__stopPropagation:q,size:W,classNames:ee,styles:$,unstyled:K,...b}=s,Q=He(),U={__staticSelector:F||"YearLevel",classNames:ee,styles:$,unstyled:K,size:W},V=typeof y=="boolean"?y:r?!x(a).endOf("year").isBefore(r):!1,se=typeof L=="boolean"?L:o?!x(a).startOf("year").isAfter(o):!1;return e.jsxs(Ve,{"data-year-level":!0,size:W,ref:n,...b,children:[e.jsx(bn,{label:typeof P=="function"?P(a):x(a).locale(i||Q.locale).format(P),__preventFocus:C,__stopPropagation:q,nextIcon:A,previousIcon:p,nextLabel:f,previousLabel:j,onNext:g,onPrevious:v,onLevelClick:S,nextDisabled:V,previousDisabled:se,hasNextLevel:O,levelControlAriaLabel:_,withNext:M,withPrevious:B,...U}),e.jsx(Nt,{year:a,locale:i,minDate:o,maxDate:r,monthsListFormat:l,getMonthControlProps:c,__getControlRef:u,__onControlKeyDown:d,__onControlClick:h,__onControlMouseEnter:N,__preventFocus:C,__stopPropagation:q,withCellSpacing:m,...U})]})});At.classes={...bn.classes,...Nt.classes};At.displayName="@mantine/dates/YearLevel";const Za={monthLabelFormat:"MMMM YYYY"},xt=Re((t,n)=>{const s=Le("MonthLevel",Za,t),{month:a,locale:i,firstDayOfWeek:o,weekdayFormat:r,weekendDays:l,getDayProps:c,excludeDate:u,minDate:d,maxDate:h,renderDay:N,hideOutsideDates:m,hideWeekdays:C,getDayAriaLabel:A,__getDayRef:p,__onDayKeyDown:f,__onDayCl
46ick:j,__onDayMouseEnter:g,withCellSpacing:v,highlightToday:S,withWeekNumbers:y,__preventFocus:L,__stopPropagation:O,nextIcon:_,previousIcon:M,nextLabel:B,previousLabel:P,onNext:F,onPrevious:q,onLevelClick:W,nextDisabled:ee,previousDisabled:$,hasNextLevel:K,levelControlAriaLabel:b,withNext:Q,withPrevious:U,monthLabelFormat:V,classNames:se,styles:xe,unstyled:Ie,__staticSelector:Ue,size:De,static:pe,...ce}=s,X=He(),ue={__staticSelector:Ue||"MonthLevel",classNames:se,styles:xe,unstyled:Ie,size:De},Ye=typeof ee=="boolean"?ee:h?!x(a).endOf("month").isBefore(h):!1,G=typeof $=="boolean"?$:d?!x(a).startOf("month").isAfter(d):!1;return e.jsxs(Ve,{"data-month-level":!0,size:De,ref:n,...ce,children:[e.jsx(bn,{label:typeof V=="function"?V(a):x(a).locale(i||X.locale).format(V),__preventFocus:L,__stopPropagation:O,nextIcon:_,previousIcon:M,nextLabel:B,previousLabel:P,onNext:F,onPrevious:q,onLevelClick:W,nextDisabled:Ye,previousDisabled:G,hasNextLevel:K,levelControlAriaLabel:b,withNext:Q,withPrevious:U,...ue}),e.jsx(ut,{month:a,locale:i,firstDayOfWeek:o,weekdayFormat:r,weekendDays:l,getDayProps:c,excludeDate:u,minDate:d,maxDate:h,renderDay:N,hideOutsideDates:m,hideWeekdays:C,getDayAriaLabel:A,__getDayRef:p,__onDayKeyDown:f,__onDayCl
46ick:j,__onDayMouseEnter:g,__preventFocus:L,__stopPropagation:O,static:pe,withCellSpacing:v,highlightToday:S,withWeekNumbers:y,...ue})]})});xt.classes={...ut.classes,...bn.classes};xt.displayName="@mantine/dates/MonthLevel";var jr={levelsGroup:"m_30b26e33"};const Ja={},Sn=Re((t,n)=>{const s=Le("LevelsGroup",Ja,t),{classNames:a,className:i,style:o,styles:r,unstyled:l,vars:c,__staticSelector:u,...d}=s,h=Je({name:u||"LevelsGroup",classes:jr,props:s,className:i,style:o,classNames:a,styles:r,unstyled:l,vars:c,rootSelector:"levelsGroup"});return e.jsx(Ve,{ref:n,...h("levelsGroup"),...d})});Sn.classes=jr;Sn.displayName="@mantine/dates/LevelsGroup";const el={numberOfColumns:1},pt=Re((t,n)=>{const s=Le("DecadeLevelGroup",el,t),{decade:a,locale:i,minDate:o,maxDate:r,yearsListFormat:l,getYearControlProps:c,__onControlClick:u,__onControlMouseEnter:d,withCellSpacing:h,__preventFocus:N,nextIcon:m,previousIcon:C,nextLabel:A,previousLabel:p,onNext:f,onPrevious:j,nextDisabled:g,previousDisabled:v,classNames:S,styles:y,unstyled:L,__staticSelector:O,__stopPropagation:_,numberOfColumns:M,levelControlAriaLabel:B,decadeLabelFormat:P,size:F,vars:q,...W}=s,ee=T.useRef([]),$=Array(M).fill(0).map((K,b)=>{const Q=x(a).add(b*10,"years").toDate();return e.jsx(mt,{size:F,yearsListFormat:l,decade:Q,withNext:b===M-1,withPrevious:b===0,decadeLabelFormat:P,__onControlClick:u,__onControlMouseEnter:d,__onControlKeyDown:(U,V)=>Jt({levelIndex:b,rowIndex:V.rowIndex,cellIndex:V.cellIndex,event:U,controlsRef:ee}),__getControlRef:(U,V,se)=>{Array.isArray(ee.current[b])||(ee.current[b]=[]),Array.isArray(ee.current[b][U])||(ee.current[b][U]=[]),ee.current[b][U][V]=se},levelControlAriaLabel:typeof B=="function"?B(Q):B,locale:i,minDate:o,maxDate:r,__preventFocus:N,__stopPropagation:_,nextIcon:m,previousIcon:C,nextLabel:A,previousLabel:p,onNext:f,onPrevious:j,nextDisabled:g,previousDisabled:v,getYearControlProps:c,__staticSelector:O||"DecadeLevelGroup",classNames:S,styles:y,unstyled:L,withCellSpacing:h},b)});return e.jsx(Sn,{classNames:S,styles:y,__staticSelector:O||"DecadeLevelGroup",ref:n,size:F,unstyled:L,...W,children:$})});pt.classes={...Sn.classes,...mt.classes};pt.displayName="@mantine/dates/DecadeLevelGroup";const nl={numberOfColumns:1},Tt=Re((t,n)=>{const s=Le("YearLevelGroup",nl,t),{year:a,locale:i,minDate:o,maxDate:r,monthsListFormat:l,getMonthControlProps:c,__onControlClick:u,__onControlMouseEnter:d,withCellSpacing:h,__preventFocus:N,nextIcon:m,previousIcon:C,nextLabel:A,previousLabel:p,onNext:f,onPrevious:j,onLevelClick:g,nextDisabled:v,previousDisabled:S,hasNextLevel:y,classNames:L,styles:O,unstyled:_,__staticSelector:M,__stopPropagation:B,numberOfColumns:P,levelControlAriaLabel:F,yearLabelFormat:q,size:W,vars:ee,...$}=s,K=T.useRef([]),b=Array(P).fill(0).map((Q,U)=>{const V=x(a).add(U,"years").toDate();return e.jsx(At,{size:W,monthsListFormat:l,year:V,withNext:U===P-1,withPrevious:U===0,yearLabelFormat:q,__stopPropagation:B,__onControlClick:u,__onControlMouseEnter:d,__onControlKeyDown:(se,xe)=>Jt({levelIndex:U,rowIndex:xe.rowIndex,cellIndex:xe.cellIndex,event:se,controlsRef:K}),__getControlRef:(se,xe,Ie)=>{Array.isArray(K.current[U])||(K.current[U]=[]),Array.isArray(K.current[U][se])||(K.current[U][se]=[]),K.current[U][se][xe]=Ie},levelControlAriaLabel:typeof F=="function"?F(V):F,locale:i,minDate:o,maxDate:r,__preventFocus:N,nextIcon:m,previousIcon:C,nextLabel:A,previousLabel:p,onNext:f,onPrevious:j,onLevelClick:g,nextDisabled:v,previousDisabled:S,hasNextLevel:y,getMonthControlProps:c,classNames:L,styles:O,unstyled:_,__staticSelector:M||"YearLevelGroup",withCellSpacing:h},U)});return e.jsx(Sn,{classNames:L,styles:O,__staticSelector:M||"YearLevelGroup",ref:n,size:W,unstyled:_,...$,children:b})});Tt.classes={...At.classes,...Sn.classes};Tt.displayName="@mantine/dates/YearLevelGroup";const tl={numberOfColumns:1},Et=Re((t,n)=>{const s=Le("MonthLevelGroup",tl,t),{month:a,locale:i,firstDayOfWeek:o,weekdayFormat:r,weekendDays:l,getDayProps:c,excludeDate:u,minDate:d,maxDate:h,renderDay:N,hideOutsideDates:m,hideWeekdays:C,getDayAriaLabel:A,__onDayClick:p,__onDayMouseEnter:f,withCellSpacing:j,highlightToday:g,withWeekNumbers:v,__preventFocus:S,nextIcon:y,previousIcon:L,nextLabel:O,previousLabel:_,onNext:M,onPrevious:B,onLevelClick:P,nextDisabled:F,previousDisabled:q,hasNextLevel:W,classNames:ee,styles:$,unstyled:K,numberOfColumns:b,levelControlAriaLabel:Q,monthLabelFormat:U,__staticSelector:V,__stopPropagation:se,size:xe,static:Ie,vars:Ue,...De}=s,pe=T.useRef([]),ce=Array(b).fill(0).map((X,ue)=>{const Ye=x(a).add(ue,"months").toDate();return e.jsx(xt,{month:Ye,withNext:ue===b-1,withPrevious:ue===0,monthLabelFormat:U,__stopPropagation:se,__onDayCl
46ick:p,__onDayMouseEnter:f,__onDayKeyDown:(G,ke)=>Jt({levelIndex:ue,rowIndex:ke.rowIndex,cellIndex:ke.cellIndex,event:G,controlsRef:pe}),__getDayRef:(G,ke,Ae)=>{Array.isArray(pe.current[ue])||(pe.current[ue]=[]),Array.isArray(pe.current[ue][G])||(pe.current[ue][G]=[]),pe.current[ue][G][ke]=Ae},levelControlAriaLabel:typeof Q=="function"?Q(Ye):Q,locale:i,firstDayOfWeek:o,weekdayFormat:r,weekendDays:l,getDayProps:c,excludeDate:u,minDate:d,maxDate:h,renderDay:N,hideOutsideDates:m,hideWeekdays:C,getDayAriaLabel:A,__preventFocus:S,nextIcon:y,previousIcon:L,nextLabel:O,previousLabel:_,onNext:M,onPrevious:B,onLevelClick:P,nextDisabled:F,previousDisabled:q,hasNextLevel:W,classNames:ee,styles:$,unstyled:K,__staticSelector:V||"MonthLevelGroup",size:xe,static:Ie,withCellSpacing:j,highlightToday:g,withWeekNumbers:v},ue)});return e.jsx(Sn,{classNames:ee,styles:$,__staticSelector:V||"MonthLevelGroup",ref:n,size:xe,...De,children:ce})});Et.classes={...Sn.classes,...xt.classes};Et.displayName="@mantine/dates/MonthLevelGroup";var fr={input:"m_6fa5e2aa"};const sl={},Ot=Re((t,n)=>{const{inputProps:s,wrapperProps:a,placeholder:i,classNames:o,styles:r,unstyled:l,popoverProps:c,modalProps:u,dropdownType:d,children:h,formattedValue:N,dropdownHandlers:m,dropdownOpened:C,onClick:A,clearable:p,onClear:f,clearButtonProps:j,rightSection:g,shouldClear:v,readOnly:S,disabled:y,value:L,name:O,form:_,type:M,...B}=zr("PickerInputBase",sl,t),P=e.jsx(et.ClearButton,{onClick:f,unstyled:l,...j}),F=()=>{M==="range"&&Array.isArray(L)&&L[0]&&!L[1]&&f(),m.close()};return e.jsxs(e.Fragment,{children:[d==="modal"&&!S&&e.jsx(vn,{opened:C,onClose:F,withCloseButton:!1,size:"auto","data-dates-modal":!0,unstyled:l,...u,children:h}),e.jsx(et.Wrapper,{...a,children:e.jsxs(gt,{position:"bottom-start",opened:C,trapFocus:!0,returnFocus:!1,unstyled:l,...c,disabled:(c==null?void 0:c.disabled)||d==="modal"||S,onChange:q=>{var W;q||((W=c==null?void 0:c.onClose)==null||W.call(c),F())},children:[e.jsx(gt.Target,{children:e.jsx(et,{"data-dates-input":!0,"data-read-only":S||void 0,disabled:y,component:"button",type:"button",multiline:!0,onClick:q=>{A==null||A(q),m.toggle()},__clearSection:P,__clearable:p&&v&&!S&&!y,rightSection:g,...s,ref:n,classNames:{...o,input:ws(fr.input,o==null?void 0:o.input)},...B,children:N||e.jsx(et.Placeholder,{error:s.error,unstyled:l,className:o==null?void 0:o.placeholder,style:r==null?void 0:r.placeholder,children:i})})}),e.jsx(gt.Dropdown,{"data-dates-dropdown":!0,children:h})]})}),e.jsx(lr,{value:L,name:O,form:_,type:M})]})});Ot.classes=fr;Ot.displayName="@mantine/dates/PickerInputBase";const us=t=>t==="range"?[null,null]:t==="multiple"?[]:null;function ts({type:t,value:n,defaultValue:s,onChange:a,applyTimezone:i=!0}){const o=T.useRef(t),r=He(),[l,c,u]=Gt({value:Cn("add",n,r.getTimezone(),!i),defaultValue:Cn("add",s,r.getTimezone(),!i),finalValue:us(t),onChange:h=>{a==null||a(Cn("remove",h,r.getTimezone(),!i))}});let d=l;return o.current!==t&&(o.current=t,n===void 0&&(d=s!==void 0?s:us(t),c(d))),[d,c,u]}function yt(t,n){return t?t==="month"?0:t==="year"?1:2:n||0}function rl(t){return t===0?"month":t===1?"year":"decade"}function zn(t,n,s){return rl(Hr(yt(t,0),yt(n,0),yt(s,2)))}const il={maxLevel:"decade",minLevel:"month",__updateDateOnYearSelect:!0,__updateDateOnMonthSelect:!0},jt=Re((t,n)=>{const s=Le("Calendar",il,t),{vars:a,maxLevel:i,minLevel:o,defaultLevel:r,level:l,onLevelChange:c,date:u,defaultDate:d,onDateChange:h,numberOfColumns:N,columnsToScroll:m,ariaLabels:C,nextLabel:A,previousLabel:p,onYearSelect:f,onMonthSelect:j,onYearMouseEnter:g,onMonthMouseEnter:v,__updateDateOnYearSelect:S,__updateDateOnMonthSelect:y,firstDayOfWeek:L,weekdayFormat:O,weekendDays:_,getDayProps:M,excludeDate:B,renderDay:P,hideOutsideDates:F,hideWeekdays:q,getDayAriaLabel:W,monthLabelFormat:ee,nextIcon:$,previousIcon:K,__onDayClick:b,__onDayMouseEnter:Q,withCellSpacing:U,highlightToday:V,withWeekNumbers:se,monthsListFormat:xe,getMonthControlProps:Ie,yearLabelFormat:Ue,yearsListFormat:De,getYearControlProps:pe,decadeLabelFormat:ce,classNames:X,styles:ue,unstyled:Ye,minDate:G,maxDate:ke,locale:Ae,__staticSelector:ye,size:An,__preventFocus:sn,__stopPropagation:rn,onNextDecade:an,onPreviousDecade:ln,onNextYear:on,onPreviousYear:E,onNextMonth:re,onPreviousMonth:ie,static:Ce,__timezoneApplied:Te,...Pe}=s,{resolvedClassNames:cn,resolvedStyles:xn}=lt({classNames:X,styles:ue,props:s}),[Un,Ln]=Gt({value:l?zn(l,o,i):void 0,defaultValue:r?zn(r,o,i):void 0,finalValue:zn(void 0,o,i),onChange:c}),[Zn,Qe]=ts({type:"default",value:u,defaultValue:d,onChange:h,applyTimezone:!Te}),Pn={__staticSelector:ye||"Calendar",styles:xn,classNames:cn,unstyled:Ye,size:An},Y=He(),qe=m||N||1,dn=new Date,Ee=G&&G>dn?G:dn,Ze=Zn||Cn("add",Ee,Y.getTimezone()),Dr=()=>{const Me=x(Ze).add(qe,"month").toDate();
46re==null||re(Me),Qe(Me)},_r=()=>{const Me=x(Ze).subtract(qe,"month").toDate();ie==null||ie(Me),Qe(Me)},Rr=()=>{const Me=x(Ze).add(qe,"year").toDate();on==null||on(Me),Qe(Me)},Ur=()=>{const Me=x(Ze).subtract(qe,"year").toDate();E==null||E(Me),Qe(Me)},Pr=()=>{const Me=x(Ze).add(10*qe,"year").toDate();an==null||an(Me),Qe(Me)},Mr=()=>{const Me=x(Ze).subtract(10*qe,"year").toDate();ln==null||ln(Me),Qe(Me)};return e.jsxs(Ve,{ref:n,size:An,"data-calendar":!0,...Pe,children:[Un==="month"&&e.jsx(Et,{month:Ze,minDate:G,maxDate:ke,firstDayOfWeek:L,weekdayFormat:O,weekendDays:_,getDayProps:M,excludeDate:B,renderDay:P,hideOutsideDates:F,hideWeekdays:q,getDayAriaLabel:W,onNext:Dr,onPrevious:_r,hasNextLevel:i!=="month",onLevelClick:()=>Ln("year"),numberOfColumns:N,locale:Ae,levelControlAriaLabel:C==null?void 0:C.monthLevelControl,nextLabel:(C==null?void 0:C.nextMonth)??A,nextIcon:$,previousLabel:(C==null?void 0:C.previousMonth)??p,previousIcon:K,monthLabelFormat:ee,__onDayClick:b,__onDayMouseEnter:Q,__preventFocus:sn,__stopPropagation:rn,static:Ce,withCellSpacing:U,highlightToday:V,withWeekNumbers:se,...Pn}),Un==="year"&&e.jsx(Tt,{year:Ze,numberOfColumns:N,minDate:G,maxDate:ke,monthsListFormat:xe,getMonthControlProps:Ie,locale:Ae,onNext:Rr,onPrevious:Ur,hasNextLevel:i!=="month"&&i!=="year",onLevelClick:()=>Ln("decade"),levelControlAriaLabel:C==null?void 0:C.yearLevelControl,nextLabel:(C==null?void 0:C.nextYear)??A,nextIcon:$,previousLabel:(C==null?void 0:C.previousYear)??p,previousIcon:K,yearLabelFormat:Ue,__onControlMouseEnter:v,__onControlClick:(Me,Gn)=>{y&&Qe(Gn),Ln(zn("month",o,i)),j==null||j(Gn)},__preventFocus:sn,__stopPropagation:rn,withCellSpacing:U,...Pn}),Un==="decade"&&e.jsx(pt,{decade:Ze,minDate:G,maxDate:ke,yearsListFormat:De,getYearControlProps:pe,locale:Ae,onNext:Pr,onPrevious:Mr,numberOfColumns:N,nextLabel:(C==null?void 0:C.nextDecade)??A,nextIcon:$,previousLabel:(C==null?void 0:C.previousDecade)??p,previousIcon:K,decadeLabelFormat:ce,__onControlMouseEnter:g,__onControlClick:(Me,Gn)=>{S&&Qe(Gn),Ln(zn("year",o,i)),f==null||f(Gn)},__preventFocus:sn,__stopPropagation:rn,withCellSpacing:U,...Pn})]})});jt.classes={...pt.classes,...Tt.classes,...Et.classes};jt.displayName="@mantine/dates/Calendar";function al(t){const{maxLevel:n,minLevel:s,defaultLevel:a,level:i,onLevelChange:o,nextIcon:r,previousIcon:l,date:c,defaultDate:u,onDateChange:d,numberOfColumns:h,columnsToScroll:N,ariaLabels:m,nextLabel:C,previousLabel:A,onYearSelect:p,onMonthSelect:f,onYearMouseEnter:j,onMonthMouseEnter:g,onNextMonth:v,onPreviousMonth:S,onNextYear:y,onPreviousYear:L,onNextDecade:O,onPreviousDecade:_,withCellSpacing:M,highlightToday:B,__updateDateOnYearSelect:P,__updateDateOnMonthSelect:F,withWeekNumbers:q,firstDayOfWeek:W,weekdayFormat:ee,weekendDays:$,getDayProps:K,excludeDate:b,renderDay:Q,hideOutsideDates:U,hideWeekdays:V,getDayAriaLabel:se,monthLabelFormat:xe,monthsListFormat:Ie,getMonthControlProps:Ue,yearLabelFormat:De,yearsListFormat:pe,getYearControlProps:ce,decadeLabelFormat:X,allowSingleDateInRange:ue,allowDeselect:Ye,minDate:G,maxDate:ke,locale:Ae,...ye}=t;return{calendarProps:{maxLevel:n,minLevel:s,defaultLevel:a,level:i,onLevelChange:o,nextIcon:r,previousIcon:l,date:c,defaultDate:u,onDateChange:d,numberOfColumns:h,columnsToScroll:N,ariaLabels:m,nextLabel:C,previousLabel:A,onYearSelect:p,onMonthSelect:f,onYearMouseEnter:j,onMonthMouseEnter:g,onNextMonth:v,onPreviousMonth:S,onNextYear:y,onPreviousYear:L,onNextDecade:O,onPreviousDecade:_,withCellSpacing:M,highlightToday:B,__updateDateOnYearSelect:P,__updateDateOnMonthSelect:F,withWeekNumbers:q,firstDayOfWeek:W,weekdayFormat:ee,weekendDays:$,getDayProps:K,excludeDate:b,renderDay:Q,hideOutsideDates:U,hideWeekdays:V,getDayAriaLabel:se,monthLabelFormat:xe,monthsListFormat:Ie,getMonthControlProps:Ue,yearLabelFormat:De,yearsListFormat:pe,getYearControlProps:ce,decadeLabelFormat:X,allowSingleDateInRange:ue,allowDeselect:Ye,minDate:G,maxDate:ke,locale:Ae},others:ye}}function hs(t,n){const s=[...n].sort((a,i)=>a.getTime()-i.getTime());return x(s[0]).startOf("day").subtract(1,"ms").isBefore(t)&&x(s[1]).endOf("day").add(1,"ms").isAfter(t)}function ll({type:t,level:n,value:s,defaultValue:a,onChange:i,allowSingleDateInRange:o,allowDeselect:r,onMouseLeave:l,applyTimezone:c=!0}){const[u,d]=ts({type:t,value:s,defaultValue:a,onChange:i,applyTimezone:c}),[h,N]=T.useState(t==="range"&&u[0]&&!u[1]?u[0]:null),[m,C]=T.useState(null),A=y=>{if(t==="range"){if(h instanceof Date&&!u[1]){if(x(y).isSame(h,n)&&!o){N(null),C(null),d([null,null]);return}const L=[y,h];L.sort((O,_)=>O.getTime()-_.getTime()),d(L),C(null),N(null);return}if(u[0]&&!u[1]&&x(y).isSame(u[0],n)&&!o){N(null),C(null),d([null,null]);return}d([y,null]),C(null),N(y);return}if(t==="multiple"){u.some(L=>x(L).isSame(y,n))?d(u.filter(L=>!x(L).isSame(y,n))):d([...u,y]);return}u&&r&&x(y).isSame(u,n)?d(null):d(y)},p=y=>h instanceof Date&&m instanceof Date?hs(y,[m,h]):u[0]instanceof Date&&u[1]instanceof Date?hs(y,u):!1,f=t==="range"?y=>{l==null||l(y),C(null)}:l,j=y=>u[0]instanceof Date&&x(y).isSame(u[0],n)?!(m&&x(m).isBefore(u[0])):!1,g=y=>u[1]instanceof Date?x(y).isSame(u[1],n):!(u[0]instanceof Date)||!m?!1:x(m).isBefore(u[0])&&x(y).isSame(u[0],n),v=y=>{if(t==="range")return{selected:u.some(O=>O&&x(O).isSame(y,n)),inRange:p(y),firstInRange:j(y),lastInRange:g(y),"data-autofocus":!!u[0]&&x(u[0]).isSame(y,n)||void 0};if(t==="multiple")return{selected:u.some(O=>O&&x(O).isSame(y,n)),"data-autofocus":!!u[0]&&x(u[0]).isSame(y,n)||void 0};const L=x(u).isSame(y,n);return{selected:L,"data-autofocus":L||void 0}},S=t==="range"&&h?C:()=>{};return T.useEffect(()=>{if(t==="range")if(u[0]&&!u[1]&&(h==null?void 0:h.getTime())!==u[0].getTime())N(u[0]);
46else{const y=u[0]==null&&u[1]==null,L=u[0]!=null&&u[1]!=null;(y||L)&&(N(null),C(null))}},[u]),{onDateChange:A,onRootMouseLeave:f,onHoveredDateChange:S,getControlProps:v,_value:u,setValue:d}}const ol={type:"default",defaultLevel:"month",numberOfColumns:1},ft=Re((t,n)=>{const s=Le("DatePicker",ol,t),{classNames:a,styles:i,vars:o,type:r,defaultValue:l,value:c,onChange:u,__staticSelector:d,getDayProps:h,allowSingleDateInRange:N,allowDeselect:m,onMouseLeave:C,numberOfColumns:A,hideOutsideDates:p,__onDayMouseEnter:f,__onDayClick:j,__timezoneApplied:g,...v}=s,{onDateChange:S,onRootMouseLeave:y,onHoveredDateChange:L,getControlProps:O}=ll({type:r,level:"day",allowDeselect:m,allowSingleDateInRange:N,value:c,defaultValue:l,onChange:u,onMouseLeave:C,applyTimezone:!g}),{resolvedClassNames:_,resolvedStyles:M}=lt({classNames:a,styles:i,props:s}),B=He();return e.jsx(jt,{ref:n,minLevel:"month",classNames:_,styles:M,__staticSelector:d||"DatePicker",onMouseLeave:y,numberOfColumns:A,hideOutsideDates:p??A!==1,__onDayMouseEnter:(P,F)=>{L(F),f==null||f(P,F)},__onDayClick:(P,F)=>{S(F),j==null||j(P,F)},getDayProps:P=>({...O(P),...h==null?void 0:h(P)}),...v,date:Cn("add",v.date,B.getTimezone(),g),__timezoneApplied:!0})});ft.classes=jt.classes;ft.displayName="@mantine/dates/DatePicker";function cl({type:t,value:n,defaultValue:s,onChange:a,locale:i,format:o,closeOnChange:r,sortDates:l,labelSeparator:c,valueFormatter:u}){const d=He(),[h,N]=Xr(!1),[m,C]=ts({type:t,value:n,defaultValue:s,onChange:a}),A=xa({type:t,date:m,locale:d.getLocale(i),format:o,labelSeparator:d.getLabelSeparator(c),formatter:u}),p=g=>{r&&(t==="default"&&N.close(),t==="range"&&g[0]&&g[1]&&N.close()),C(l&&t==="multiple"?[...g].sort((v,S)=>v.getTime()-S.getTime()):g)},f=()=>p(t==="range"?[null,null]:t==="multiple"?[]:null),j=t==="range"?!!m[0]:t==="multiple"?m.length>0:m!==null;return{_value:m,setValue:p,onClear:f,shouldClear:j,formattedValue:A,dropdownOpened:h,dropdownHandlers:N}}const dl={type:"default",valueFormat:"MMMM D, YYYY",closeOnChange:!0,sortDates:!0,dropdownType:"popover"},ss=Re((t,n)=>{const s=Le("DatePickerInput",dl,t),{type:a,value:i,defaultValue:o,onChange:r,valueFormat:l,labelSeparator:c,locale:u,classNames:d,styles:h,unstyled:N,closeOnChange:m,size:C,variant:A,dropdownType:p,sortDates:f,minDate:j,maxDate:g,vars:v,defaultDate:S,valueFormatter:y,...L}=s,{resolvedClassNames:O,resolvedStyles:_}=lt({classNames:d,styles:h,props:s}),{calendarProps:M,others:B}=al(L),{_value:P,setValue:F,formattedValue:q,dropdownHandlers:W,dropdownOpened:ee,onClear:$,shouldClear:K}=cl({type:a,value:i,defaultValue:o,onChange:r,locale:u,format:l,labelSeparator:c,closeOnChange:m,sortDates:f,valueFormatter:y}),b=Array.isArray(P)?P[0]||S:P||S,Q=He();return e.jsx(Ot,{formattedValue:q,dropdownOpened:ee,dropdownHandlers:W,classNames:O,styles:_,unstyled:N,ref:n,onClear:$,shouldClear:K,value:P,size:C,variant:A,dropdownType:p,...B,type:a,__staticSelector:"DatePickerInput",children:e.jsx(ft,{...M,size:C,variant:A,type:a,value:P,defaultDate:b||Ia({maxDate:g,minDate:j,timezone:Q.getTimezone()}),onChange:F,locale:u,classNames:O,styles:_,unstyled:N,__staticSelector:"DatePickerInput",__stopPropagation:p==="popover",minDate:j,maxDate:g,date:Cn("add",M.date,Q.getTimezone()),__timezoneApplied:!0})})});ss.classes={...Ot.classes,...ft.classes};ss.displayName="@mantine/dates/DatePickerInput";const ul=new Bn("Switch"),hl=({id:t,required:n,value:s,disabled:a,className:i,style:o,onChange:r,children:l,responsiveSpan:c})=>e.jsxs("div",{className:`${ul.m(c&&{"responsive-span":c})} ${i??""}`,style:o,children:[e.jsx("input",{required:n,type:"checkbox",id:t,checked:s,disabled:a,onChange:r}),e.jsx("label",{htmlFor:t,children:l})]});function Ir(t){const[n,s]=T.useState({innerState:t,dirty:!1}),a=T.useCallback((o,r=!0)=>{s(l=>({innerState:typeof o=="function"?o(l.innerState):o,dirty:r}))},[s]),i=T.useCallback(o=>{s(r=>({...r,dirty:o}))},[]);return[n.innerState,a,n.dirty,i]}const Cs="10ch",Ns={whiteSpace:"nowrap",flexShrink:0};function Cl({close:t,defaultValues:n,onSubmit:s}){const{t:a}=k(),[i,o]=T.useState({submitting:!1,error:!1}),{data:r,isValidating:l}=de("/api/v4/country-delivery/country-names",w),[c,u,d]=Ir({vatNumber:(n==null?void 0:n.vat)??""});async function h(N){var m,C;N.preventDefault();try{o({submitting:!0,error:!1});const A={id:(n==null?void 0:n.id)??((m=c.deliveryCountry)==null?void 0:m.id),deliveryCountryCode:(n==null?void 0:n.countryCode)??((C=c.deliveryCountry)==null?void 0:C.isoCode),isVatRegistered:!!c.vatNumber,vatNumber:c.vatNumber};await s(A),nn("success",a("ACCOUNT.COMPANY.MODAL.STATE.ADD_SUCCESS")),t()}catch(A){H(A),o({submitting:!1,error:!0})}}return e.jsx(J,{open:!0,style:{width:"46rem"},children:e.jsxs("form",{onSubmit:h,autoComplete:"off",children:[e.jsx(J.Header,{children:a("ACCOUNT.COMPANY.MODAL.STATE.HEADER")}),e.jsxs(J.Content,{children:[e.jsx(yn,{className:"mb-2"}),e.jsxs(We,{children:[e.jsx(D,{label:a("ACCOUNT.COMPANY.MODAL.STATE.LABEL.COUNTRY"),labelWidth:Cs,labelStyle:Ns,children:n?e.jsx("p",{children:n.countryName}):e.jsx(Hn,{options:r,renderItem:N=>N.name,renderValue:N=>N.name,value:c.deliveryCountry,onChange:N=>u(m=>({...m,deliveryCountry:N})),loading:l,required:!0})}),e.jsx(D,{label:e.jsxs("div",{className:"flex",children:[e.jsx("div",{children:a("ACCOUNT.COMPANY.MODAL.STATE.LABEL.VAT_NUMBER")})," ",e.jsx(Ut,{content:a("ACCOUNT.COMPANY.MODAL.STATE.TOOLTIP.VAT_REQUIRED"),children:e.jsx(le,{path:tt,size:"1rem"})})]}),labelWidth:Cs,labelStyle:Ns,children:e.jsx("input",{id:"vatNumber",value:c.vatNumber??void 0,onChange:N=>u(m=>({...m,vatNumber:N.target.value}))})})]}),i.error&&e.jsx(Tn,{type:"error",small:!0,className:"mt-2",children:a("ACCOUNT.COMPANY.MODAL.STATE.ALERT.ERROR")})]}),e.jsxs(J.Footer,{gaps:!0,children:[e.jsx(R,{onClick:t,up:!0,children:a("ACCOUNT.COMPANY.MODAL.STATE.CLOSE")}),e.jsx(R,{htmlType:"submit",loading:i.submitting,disabled:!d,type:"primary",up:!0,children:a("ACCOUNT.COMPANY.MODAL.STATE.SAVE")})]})]})})}function Nl(t,n=s=>s.id){const{data:s,...a}=de(t,w),i=T.useMemo(()=>{const o=new Map;if(s){for(const r of s)o.set(n(r),r);return o}},[s]);return{data:s,map:i,...a}}function gr({close:t,onSubmit:n,defaultData:s}){var u,d,h,N,m,C,A,p,f,j,g;const{t:a}=k(),i=_n({initialValues:{name:"",countryCode:"",bankCode:"",bankAccountNumber:"",iban:"",currencyCode:"",isValid:!0,...s},validate:{name:_e(),countryCode:s?void 0:_e(),bankCode:s?void 0:_e(),bankAccountNumber:s?void 0:_e(),currencyCode:s?void 0:_e()}}),o=me(()=>w("/api/v4/country/country-names"),{onError:H}),r=me(()=>w(`/api/v4/bank/country/${i.values.countryCode}`),{onError:H,refreshDeps:[i.values.countryCode],ready:!!i.values.countryCode}),l=me(()=>w("/api/v4/currency"),{onError:H}),c=me(n,{onError:H,onSuccess:t,manual:!0});return e.jsx(vn,{opened:!0,onClose:t,title:a("ACCOUNT.COMPANY.MODAL.BANK.HEADER"),size:"xl",children:e.jsx("form",{onSubmit:i.onSubmit(c.run),children:e.jsxs(Bs,{cols:{base:1,md:2},className:"items-end",children:[e.jsx(yn,{className:"col-span-full mb-2"}),e.jsx(Se,{label:a("ACCOUNT.COMPANY.MODAL.BANK.LABEL.NAME"),...i.getInputProps("name")}
46),e.jsxs(ge,{when:!s,children:[e.jsx(un,{label:a("ACCOUNT.COMPANY.MODAL.BANK.LABEL.COUNTRY"),...i.getInputProps("countryCode"),data:(u=o.data)==null?void 0:u.map(v=>({label:v.name,value:v.isoCode})),searchable:!0,loading:o.loading}),e.jsx(un,{label:a("ACCOUNT.COMPANY.MODAL.BANK.LABEL.BANK"),...i.getInputProps("bankCode"),data:(h=(d=r.data)==null?void 0:d.items)==null?void 0:h.map(v=>({value:v.bankCode,label:v.name})),searchable:!0,loading:r.loading,disabled:!((m=(N=r.data)==null?void 0:N.items)!=null&&m.length),description:!((A=(C=r.data)==null?void 0:C.items)!=null&&A.length)&&a("ACCOUNT.COMPANY.MODAL.BANK.LABEL.NO_BANK")}),e.jsx(Se,{label:a("ACCOUNT.COMPANY.MODAL.BANK.LABEL.ACCOUNT"),...i.getInputProps("bankAccountNumber"),disabled:!!s}),e.jsx(Se,{label:a("ACCOUNT.COMPANY.MODAL.BANK.LABEL.IBAN"),...i.getInputProps("iban"),disabled:!!s}),e.jsx(un,{label:a("ACCOUNT.COMPANY.MODAL.BANK.LABEL.CURRENCY"),...i.getInputProps("currencyCode"),data:(f=(p=l.data)==null?void 0:p.items)==null?void 0:f.map(v=>({value:v.code,label:v.code})),searchable:!0,loading:l.loading,disabled:!((g=(j=l.data)==null?void 0:j.items)!=null&&g.length)})]}),e.jsx(Pt,{label:a("ACCOUNT.COMPANY.MODAL.BANK.EDIT.TOOLTIP.VALID_ACCOUNT"),disabled:!(s!=null&&s.isMain),children:e.jsx(En,{label:a("ACCOUNT.COMPANY.MODAL.BANK.EDIT.LABEL.VALID_ACCOUNT"),className:"col-start-1",...i.getInputProps("isValid",{type:"checkbox"}),disabled:s==null?void 0:s.isMain})}),e.jsxs(ge,{when:!!s,children:[e.jsx(Pt,{label:a("ACCOUNT.COMPANY.MODAL.BANK.EDIT.TOOLTIP.MAIN"),children:e.jsx(En,{label:a("ACCOUNT.COMPANY.MODAL.BANK.EDIT.LABEL.MAIN"),...i.getInputProps("isMain",{type:"checkbox"}),disabled:!0})}),e.jsx(Se,{label:a("ACCOUNT.COMPANY.MODAL.BANK.EDIT.LABEL.COUNTRY"),value:(s==null?void 0:s.countryName)??void 0,disabled:!0}),e.jsx(Se,{label:a("ACCOUNT.COMPANY.MODAL.BANK.EDIT.LABEL.ACCOUNT"),value:(s==null?void 0:s.account)??void 0,disabled:!0}),e.jsx(Se,{label:a("ACCOUNT.COMPANY.MODAL.BANK.EDIT.LABEL.IBAN"),value:(s==null?void 0:s.iban)??void 0,disabled:!0}),e.jsx(Se,{label:a("ACCOUNT.COMPANY.MODAL.BANK.EDIT.LABEL.CURRENCY"),value:(s==null?void 0:s.currencyCode)??void 0,disabled:!0})]}),e.jsxs(Ne,{justify:"end",className:"col-span-full",children:[e.jsx(je,{variant:"light",onClick:t,children:a("ACCOUNT.COMPANY.MODAL.BANK.CLOSE")}),e.jsx(je,{type:"submit",loading:c.loading,disabled:!i.isDirty(),children:a("ACCOUNT.COMPANY.MODAL.BANK.SAVE")})]})]})})})}const ml="_list_uhmxe_1",Al="_row_uhmxe_10",xl="_thumb_uhmxe_22",pl="_placeholder_uhmxe_41",Tl="_info_uhmxe_47",El="_name_uhmxe_55",Ol="_discount_uhmxe_60",jl="_action_uhmxe_66",pn={list:ml,row:Al,thumb:xl,placeholder:pl,info:Tl,name:El,discount:Ol,action:jl};function fl({product:t,onNavigate:n}){const{t:s}=k(),[a,i]=T.useState(!1),o=`/product/${t.seoName}`+(t.colorCode?`?color=${t.colorCode}`:""),r=!a&&t.productCode&&t.colorCode?Vs.src({code:t.productCode,colorCode:t.colorCode},{width:120}):null,l=Math.floor(t.maxDiscount);return e.jsxs("div",{className:pn.row,children:[e.jsx("div",{className:pn.thumb,children:r?e.jsx("img",{src:r,alt:t.name,onError:()=>i(!0)}):e.jsx("span",{className:pn.placeholder,children:t.productCode})}),e.jsxs("div",{className:pn.info,children:[e.jsxs("span",{className:pn.name,children:[e.jsx("strong",{children:t.productCode})," ",t.name]}),l>0&&e.jsx("span",{className:pn.discount,children:s("ACCOUNT.ABO.PRODUCTS_DIALOG.DISCOUNT",{discount:l})})]}),e.jsx(oe,{to:o,className:pn.action,onClick:n,children:e.jsx(R,{type:"black",size:"small",up:!0,children:s("ACCOUNT.ABO.PRODUCTS_DIALOG.SHOW")})})]})}function Il({products:t,close:n}){const{t:s}=k();return e.jsxs(J,{open:!0,children:[e.jsx(J.Header,{onClose:n,children:s("ACCOUNT.ABO.PRODUCTS_DIALOG.TITLE")}),e.jsx(J.Content,{children:t.length===0?e.jsx("p",{children:s("ACCOUNT.ABO.PRODUCTS_DIALOG.EMPTY")}):e.jsx("div",{className:pn.list,children:t.map(a=>e.jsx(fl,{product:a,onNavigate:n},a.seoName))})})]})}const gl="_dialog_1lssw_1",vl="_header_1lssw_5",yl="_logo_1lssw_12",bl="_title_1lssw_16",Sl="_text_1lssw_23",Ll="_benefitsTitle_1lssw_28",Dl="_benefits_1lssw_28",_l="_benef
46it_1lssw_28",Rl="_benefitIcon_1lssw_48",Ul="_buttons_1lssw_60",Pl="_keepButton_1lssw_74",Ml="_cancelButton_1lssw_80",Xe={dialog:gl,header:vl,logo:yl,title:bl,text:Sl,benefitsTitle:Ll,benefits:Dl,benefit:_l,benefitIcon:Rl,buttons:Ul,keepButton:Pl,cancelButton:Ml},kl=[{icon:Kr,key:"BENEFIT_PRICES"},{icon:Qr,key:"BENEFIT_SHIPPING"},{icon:qr,key:"BENEFIT_DISCOUNTS"}];function wl({onConfirm:t,close:n}){const{t:s}=k();function a(){n(),t()}return e.jsx(J,{open:!0,className:Xe.dialog,children:e.jsxs("div",{children:[e.jsx(J.Header,{className:Xe.header,onClose:n,children:e.jsx("img",{className:Xe.logo,src:"/img/logo/malfini-plus-logo.svg",alt:"MALFINI+",width:222,height:74})}),e.jsxs(J.Content,{children:[e.jsx("h3",{className:Xe.title,children:s("ACCOUNT.ABO.AUTO_RENEWAL_DIALOG.TITLE")}),e.jsx("p",{className:Xe.text,children:s("ACCOUNT.ABO.AUTO_RENEWAL_DIALOG.TEXT")}),e.jsx("p",{className:Xe.benefitsTitle,children:s("ACCOUNT.ABO.AUTO_RENEWAL_DIALOG.BENEFITS_TITLE")}),e.jsx("ul",{className:Xe.benefits,children:kl.map(({icon:i,key:o})=>e.jsxs("li",{className:Xe.benefit,children:[e.jsx("span",{className:Xe.benefitIcon,children:e.jsx(le,{path:i,size:"1.25rem"})}),e.jsx("span",{children:s(`ACCOUNT.ABO.AUTO_RENEWAL_DIALOG.${o}`)})]},o))}),e.jsx(Tn,{type:"info",small:!0,children:s("ACCOUNT.ABO.AUTO_RENEWAL_DIALOG.NOTE")})]}),e.jsx(J.Footer,{children:e.jsxs("div",{className:Xe.buttons,children:[e.jsx(R,{type:"black",className:Xe.keepButton,onClick:n,children:s("ACCOUNT.ABO.AUTO_RENEWAL_DIALOG.KEEP")}),e.jsx(R,{type:"ghost-black",className:Xe.cancelButton,onClick:a,children:s("ACCOUNT.ABO.AUTO_RENEWAL_DIALOG.CANCEL_RENEWAL")})]})})]})})}const Bl="_banner_anock_2",Vl="_main_anock_11",Yl="_logo_anock_18",Fl="_text_anock_23",Wl="_actions_anock_31",$l="_title_anock_40",Gl="_subtitle_anock_46",zl="_stats_anock_51",Hl="_stat_anock_51",Xl="_autoRenewal_anock_89",Kl="_footer_anock_94",Ql="_contactLink_anock_103",$e={banner:Bl,main:Vl,logo:Yl,text:Fl,actions:Wl,title:$l,subtitle:Gl,stats:zl,stat:Hl,autoRenewal:Xl,footer:Kl,contactLink:Ql};function ms(t){const n=t?x(t):void 0;return n!=null&&n.isValid()?Jr(n,Mt.locale)??"—":"—"}function ql({abo:t}){const{t:n,i18n:s}=k(),a=ot("POST /api/v4/abo/customer-portal-session");if(!(t!=null&&t.active))return null;const i=t.exampleNomenclatures??[],o=he.isInRole(ae.ADMIN),r=Zr(s.language,"#contact");function l(){as(Il,{products:i})}async function c(){try{const d=await a.call({returnUrl:globalThis.location.href});d.url&&globalThis.location.assign(d.url)}catch(d){H(d)}}function u(){as(wl,{onConfirm:c})}return e.jsxs("div",{className:$e.banner,children:[e.jsxs("div",{className:$e.main,children:[e.jsx("img",{className:$e.logo,src:"/img/logo/malfini-plus-logo.svg",alt:"MALFINI+",width:222,height:74}),e.jsxs("div",{className:$e.text,children:[e.jsx("div",{className:$e.title,children:n("ACCOUNT.ABO.BANNER.TITLE")}),e.jsx("div",{className:$e.subtitle,children:n("ACCOUNT.ABO.BANNER.SUBTITLE")})]}),e.jsxs("div",{className:$e.actions,children:[e.jsx(R,{type:"black",size:"small",up:!0,onClick:l,children:n("ACCOUNT.ABO.BANNER.SHOW_PRODUCTS")}),o&&e.jsx(R,{type:"ghost-black",size:"small",up:!0,loading:a.loading,disabled:a.loading,onClick:c,children:n("ACCOUNT.ABO.BANNER.MANAGE_SUBSCRIPTION")})]})]}),e.jsxs("dl",{className:$e.stats,children:[e.jsxs("div",{className:$e.stat,children:[e.jsx("dt",{children:n("ACCOUNT.ABO.BANNER.MEMBER_SINCE")}),e.jsx("dd",{children:ms(t.validFrom)})]}),e.jsxs("div",{className:$e.stat,children:[e.jsx("dt",{children:n("ACCOUNT.ABO.BANNER.VALID_TO")}),e.jsx("dd",{children:ms(t.validTo)}),o&&e.jsx(st,{id:"abo-auto-renewal",className:$e.autoRenewal,value:!0,onChange:u,children:n("ACCOUNT.ABO.BANNER.AUTO_RENEWAL")})]}),e.jsxs("div",{className:$e.stat,children:[e.jsx("dt",{children:n("ACCOUNT.ABO.BANNER.PRODUCT_COUNT")}),e.jsx("dd",{children:i.length})]})]}),e.jsxs("div",{className:$e.footer,children:[n("ACCOUNT.ABO.BANNER.CONTACT_QUESTION")," ",!!r&&e.jsx("a",{className:$e.contactLink,href:r,children:n("ACCOUNT.ABO.BANNER.CONTACT_LINK")})]})]})}function As(t=16){return!(document.body.scrollTop>t||document.documentElement.scrollTop>t)}const Zl=new Bn("BackToTop");function Jl(){const[t,n]=T.useState(!As()),s=T.useRef(void 0),a=T.useRef(void 0),i=T.useCallback(()=>{As()?n(!1):n(!0)},[]);T.useEffect(()=>{function r(){const c=document.documentElement.scrollTop||document.body.scrollTop;a.current&&c>a.current&&s.current&&s.current(),a.current=c}function l(){s.current&&s.current()}return window.addEventListener("scroll",i),window.addEventListener("scroll",r),globalThis.addEventListener("touchstart",l),function(){window.removeEventListener("scroll",i),window.removeEventListener("scroll",r),globalThis.removeEventListener("touchstart",l)}},[i]);const o=T.useCallback(()=>{const r=ei(!0);s.current=r},[]);return t&&ni.createPortal(e.jsx("div",{className:Zl.toString(),onClick:o,children:e.jsx(le,{path:ti})}),document.body)}const Fe=new Bn("Account");function eo(){var C,A,p,f,j,g,v,S,y,L;const{t}=k(),{data:n,mutate:s}=de("/api/v4/company-detail"),a=ot("PUT /api/v4/company-detail/communication-preference"),{data:i,map:o}=Nl("/api/v4/address/invoice-delivery"),[r,l]=T.useState(!1),[c,u,d]=Ir({invoiceDeliveryTypeId:"",invoiceEmailCopy:!1,invoiceEmailCopyEmail
46:"",packageEmailInfo:!1,packageEmailInfoEmail:""});T.useEffect(()=>{n&&u({invoiceDeliveryTypeId:n.invoiceDeliveryId,invoiceEmailCopy:n.invoiceEmailCopy,invoiceEmailCopyEmail:n.invoiceEmailCopyEmail,packageEmailInfo:n.packageEmailInfo,packageEmailInfoEmail:n.packageEmailInfoEmail})},[n]);async function h(O){O.preventDefault();const _={invoiceDeliveryTypeId:c.invoiceDeliveryTypeId,sendInvoiceByEmail:c.invoiceEmailCopy,invoiceEmail:c.invoiceEmailCopy?c.invoiceEmailCopyEmail:null,sendParcelInfoByEmail:c.packageEmailInfo,parcelInfoEmail:c.packageEmailInfo?c.packageEmailInfoEmail:null};try{await a.call(_),nn("success",t("ACCOUNT.COMPANY_INFORMATION.SAVED")),s()}catch(M){H(M)}}function N(O){fe(gr,{defaultData:O,onSubmit:async _=>{await(O?w(`PUT /api/v4/bank-account/${O.id}`,{body:_}):w("POST /api/v4/bank-account",{body:_})),s()}})}function m(O){fe(Cl,{defaultValues:O,onSubmit:async _=>{await(O?w(`/api/v4/country-delivery/${_.id}`,{method:"PUT",body:_}):w("/api/v4/country-delivery",{method:"POST",body:_})),s()}})}return e.jsxs("div",{className:Fe.em("content"),children:[e.jsx(Jl,{}),e.jsx("h2",{children:t("ACCOUNT.COMPANY_INFORMATION.TITLE")}),e.jsx(ql,{abo:n==null?void 0:n.abo}),e.jsxs(We,{children:[e.jsxs(ne,{header:t("ACCOUNT.COMPANY_INFORMATION.CARD.ADDRESS.TITLE"),className:Fe.em("card","column"),children:[e.jsx("p",{children:e.jsx("strong",{children:(C=n==null?void 0:n.address)==null?void 0:C.name})}),e.jsxs("p",{className:"mt-1",children:[t("ACCOUNT.COMPANY_INFORMATION.CARD.ADDRESS.LABEL.ID"),": ",n==null?void 0:n.crn]}),e.jsx("p",{children:(A=n==null?void 0:n.address)==null?void 0:A.street}),e.jsxs("p",{children:[(p=n==null?void 0:n.address)==null?void 0:p.zipCode," ",(f=n==null?void 0:n.address)==null?void 0:f.city]}),e.jsx("p",{children:(j=n==null?void 0:n.address)==null?void 0:j.countryName})]}),e.jsxs(ne,{header:t("ACCOUNT.COMPANY_INFORMATION.CARD.CONTACT.TITLE"),className:Fe.em("card","column"),children:[e.jsxs("p",{children:[t("ACCOUNT.COMPANY_INFORMATION.CARD.CONTACT.TELEPHONE"),": ",n==null?void 0:n.phoneNumber]}),e.jsxs("p",{children:[t("ACCOUNT.COMPANY_INFORMATION.CARD.CONTACT.EMAIL"),":"," ",e.jsx("a",{href:`mailto:${n==null?void 0:n.email}`,className:Fe.m("company-link"),children:n==null?void 0:n.email})]})]}),e.jsx(ne,{header:t("ACCOUNT.COMPANY_INFORMATION.CARD.TURNOVER.TITLE"),className:Fe.em("card","column"),blockColSpan:2,children:e.jsx("strong",{children:((g=n==null?void 0:n.turnover)==null?void 0:g.amount)!==void 0&&z.formatMoney(n.turnover.amount)})})]}),e.jsx(ne,{header:t("ACCOUNT.COMPANY_INFORMATION.CARD.DELIVERIES_TO_COUNTRIES.TITLE"),noBodyPadding:!0,extra:e.jsx(ge,{when:he.isInRole(ae.ADMIN),children:e.jsxs(R,{responsiveSpan:!0,onClick:()=>m(),size:"small",type:"primary",up:!0,children:[e.jsx(le,{size:"1rem",path:tn})," ",e.jsx("span",{children:t("ACCOUNT.COMPANY_INFORMATION.CARD.DELIVERIES_TO_COUNTRIES.BUTTON.ADD")})]})}),className:Fe.em("card","card-scroll-wrapper"),children:e.jsxs("table",{className:Fe.em("account-table"),children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.COMPANY_INFORMATION.CARD.DELIVERIES_TO_COUNTRIES.LABEL.COUNTRY")}),e.jsx("th",{children:t("ACCOUNT.COMPANY_INFORMATION.CARD.DELIVERIES_TO_COUNTRIES.LABEL.VAT_NUMBER")}),he.isInRole(ae.ADMIN)?e.jsx("th",{}):null]})}),e.jsx("tbody",{children:(v=n==null?void 0:n.deliveryStates)==null?void 0:v.map((O,_)=>e.jsxs("tr",{children:[e.jsx("td",{children:O.countryName}),e.jsx("td",{children:O.vat}),e.jsx(ge,{when:he.isInRole(ae.ADMIN),children:e.jsx("td",{style:{width:"1px"},children:e.jsx("div",{className:Fe.em("icon-link-wrapper"),onClick:()=>m(O),children:e.jsx(le,{size:"1.5rem",path:rt})})})})]},_))})]})}),e.jsx(ne,{header:t("ACCOUNT.COMPANY_INFORMATION.CARD.BANK_ACCOUNTS.TITTLE"),noBodyPadding:!0,className:Fe.em("card"),extra:e.jsxs("span",{className:Fe.em("bank_card_extra"),children:[e.jsx(hl,{responsiveSpan:!0,id:"bank",value:r,onChange:O=>l(O.target.checked),style:{marginRight:"1rem"},children:e.jsx("span",{children:t("ACCOUNT.COMPANY_INFORMATION.CARD.BANK_ACCOUNTS.LABEL.VALID_ONLY")})}),e.jsx(ge,{when:he.isInRole(ae.ADMIN),children:e.jsxs(R,{responsiveSpan:!0,onClick:()=>N(),size:"small",type:"primary",up:!0,children:[e.jsx(le,{size:"1rem",path:tn}),e.jsx("span",{children:t("ACCOUNT.COMPANY_INFORMATION.CARD.BANK_ACCOUNTS.BUTTON.ADD")}
46)]})})]}),children:e.jsxs("table",{className:Fe.em("account-table"),children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.COMPANY_INFORMATION.CARD.BANK_ACCOUNTS.LABEL.NAME")}),e.jsx("th",{children:t("ACCOUNT.COMPANY_INFORMATION.CARD.BANK_ACCOUNTS.LABEL.ACCOUNT")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.COMPANY_INFORMATION.CARD.BANK_ACCOUNTS.LABEL.COUNTRY")}),e.jsx("th",{children:t("ACCOUNT.COMPANY_INFORMATION.CARD.BANK_ACCOUNTS.LABEL.CURRENCY")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.COMPANY_INFORMATION.CARD.BANK_ACCOUNTS.LABEL.IBAN")}),he.isInRole(ae.ADMIN)?e.jsx("th",{}):null]})}),e.jsx("tbody",{children:(S=n==null?void 0:n.bankAccounts)==null?void 0:S.filter(O=>!r||O.isValid).map((O,_)=>e.jsxs("tr",{style:O.isValid?{}:{textDecoration:"line-through",color:"#9b9b9b"},children:[e.jsx("td",{className:"hidden lg:table-cell",children:O.name}),e.jsx("td",{children:`${O.account}/${O.code}`}),e.jsx("td",{className:"hidden lg:table-cell",children:O.countryName}),e.jsx("td",{children:O.currencyCode}),e.jsx("td",{className:"hidden lg:table-cell",children:O.iban}),e.jsx(ge,{when:he.isInRole(ae.ADMIN),children:e.jsx("td",{style:{width:"1px"},children:e.jsx("div",{className:Fe.em("icon-link-wrapper"),onClick:()=>N(O),children:e.jsx(le,{size:"1.5rem",path:rt})})})})]},_))})]})}),e.jsx("form",{onSubmit:O=>void h(O),children:e.jsxs(ne,{header:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"mr-1",children:t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.TITTLE")}),e.jsx("div",{className:"flex",tooltip:t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.TITTLE.TOOLTIP"),"tooltip-multiline":"true",children:e.jsx(le,{path:tt,size:"1rem"})})]}),className:Fe.em("card"),children:[e.jsx(D,{borderless:!0,label:t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.LABEL.SEND_INVOICE"),labelWidth:"15ch",children:he.isInRole(ae.ADMIN)?e.jsx(Fs,{value:((y=c.invoiceDeliveryTypeId)==null?void 0:y.toString())??"",onChange:O=>u({...c,invoiceDeliveryTypeId:Number.parseInt(O,10)}),options:i==null?void 0:i.map(O=>({value:O.id.toString(),label:O.name??"EMPTY",isVisible:O.isEnabled}))}):e.jsx("p",{children:(L=o==null?void 0:o.get(c.invoiceDeliveryTypeId)
46)==null?void 0:L.name})}),e.jsx("div",{className:Fe.em("form-communication-block"),children:he.isInRole(ae.ADMIN)?e.jsxs(e.Fragment,{children:[e.jsx(st,{id:"sendInvoiceCopy",value:c.invoiceEmailCopy,onChange:O=>u({...c,invoiceEmailCopy:O.target.checked}),style:{minWidth:"30ch"},children:t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.LABEL.COPY_INVOICE")}),e.jsx(ge,{when:c.invoiceEmailCopy,children:e.jsx(D,{label:t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.LABEL.EMAIL"),labelWidth:"1px",style:{width:"unset"},children:e.jsx("input",{value:c.invoiceEmailCopyEmail??void 0,onChange:O=>u({...c,invoiceEmailCopyEmail:O.target.value}),required:!0,type:"email",pattern:"^[a-zA-Z0-9]+(?:\\.[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:\\.[a-zA-Z0-9]+)*$"})})})]}):e.jsxs("p",{className:"flex items-center",children:[e.jsx(le,{size:"1rem",path:c.invoiceEmailCopy?ls:Nn,className:"mr-1"})," ",t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.LABEL.COPY_INVOICE")," ",c.invoiceEmailCopyEmail]})}),e.jsx("div",{className:Fe.em("form-communication-block"),children:he.isInRole(ae.ADMIN)?e.jsxs(e.Fragment,{children:[e.jsx(st,{id:"sendPackageInfo",value:c.packageEmailInfo,onChange:O=>u({...c,packageEmailInfo:O.target.checked}),style:{minWidth:"30ch"},children:t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.LABEL.INFORMATION_PARCEL")}),e.jsx(ge,{when:c.packageEmailInfo,children:e.jsx(D,{label:t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.LABEL.EMAIL"),labelWidth:"1px",style:{width:"unset"}
46,children:e.jsx("input",{value:c.packageEmailInfoEmail??void 0,onChange:O=>u({...c,packageEmailInfoEmail:O.target.value}),required:!0,type:"email",pattern:"^[a-zA-Z0-9]+(?:\\.[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:\\.[a-zA-Z0-9]+)*$"})})})]}):e.jsxs("p",{className:"flex items-center",children:[e.jsx(le,{size:"1rem",path:c.packageEmailInfo?ls:Nn,className:"mr-1"})," ",t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.LABEL.INFORMATION_PARCEL")," ",c.packageEmailInfoEmail]})}),e.jsx(ge,{when:he.isInRole(ae.ADMIN),children:e.jsx("div",{className:Fe.em("box-right"),children:e.jsx(R,{loading:a.loading,disabled:!d,type:"primary",htmlType:"submit",up:!0,children:e.jsx("span",{children:t("ACCOUNT.COMPANY_INFORMATION.CARD.COMMUNICATION.BUTTON.SAVE")})})})})]})})]})}const no=Ys(eo);function to({close:t,onSubmit:n,login:s}){const{t:a}=k(),i=_n({initialValues:{oldPassword:"",newPassword:"",newPassword2:"",login:s},validate:{oldPassword:_e(),newPassword:o=>{const r=Ws({password:o,login:s}).filter(l=>!l.result);return r.length>0?e.jsx("div",{children:r.map(l=>e.jsx(Z,{size:"xs",component:"div",children:a(l.code)},l.code))}):null},newPassword2:$s("newPassword",a("PASSWORD.VALIDATION.PASSWORD_MATCH"))},transformValues:o=>{const r={...o};return delete r.newPassword2,r}});return e.jsx(vn,{opened:!0,onClose:t,title:a("ACCOUNT.USERS.MODAL.PASSWORD.HEADER"),children:e.jsx("form",{onSubmit:i.onSubmit(n),children:e.jsxs(Be,{children:[e.jsx(yn,{className:"mb-2"}),e.jsx(Mn,{label:a("ACCOUNT.USERS.PASSWORD_OLD"),...i.getInputProps("oldPassword"),autoComplete:"current-password"}),e.jsx(Mn,{label:a("ACCOUNT.USERS.PASSWORD_NEW"),...i.getInputProps("newPassword"),autoComplete:"new-password"}),e.jsx(Mn,{label:a("ACCOUNT.USERS.PASSWORD_REPEAT"),...i.getInputProps("newPassword2"),autoComplete:"new-password"}),e.jsxs(Ne,{justify:"end",children:[e.jsx(je,{variant:"light",onClick:t,children:a("CLOSE")}),e.jsx(je,{type:"submit",children:a("SAVE")})]})]})})})}function so({close:t,defaultValues:n,onSubmit:s,permission:a={}}){const{t:i}=k(),{isAdmin:o,isOwner:r}=a,{data:l}=me(()=>w("GET /api/v4/user-detail/language")),{data:c}=me(()=>w("GET /api/v4/user-detail/role")),{data:u}=me(()=>w("GET /api/v4/user-detail/status")),d=_n({initialValues:{login:"",degree:"",firstName:"",lastName:"",phone:"",mobilePhone:"",email:"",password:"",password2:"",...n,languageId:(n==null?void 0:n.languageId.toString())??"",roleId:(n==null?void 0:n.roleId.toString())??"",statusId:(n==null?void 0:n.statusId.toString())??""},validate:{phone:si(),firstName:_e(),lastName:_e(),login:_e(),languageId:_e(),password:n?void 0:(h,N)=>{const m=Ws({password:h,login:N.email}).filter(C=>!C.result);return m.length>0?e.jsx("div",{children:m.map(C=>e.jsx(Z,{size:"xs",component:"div",children:i(C.code)},C.code))}):null},password2:n?void 0:$s("password",i("PASSWORD.VALIDATION.PASSWORD_MATCH"))},transformValues:h=>({...h,email:h.email||h.login,languageId:Number(h.languageId),roleId:Number(h.roleId),statusId:Number(h.statusId)})});return T.useEffect(()=>{var h,N;l&&!n&&d.setFieldValue("languageId",((N=(h=l.find(m=>m.code===it()))==null?void 0:h.id)==null?void 0:N.toString())??"")},[l,n]),T.useEffect(()=>{var h;u&&!n&&d.setFieldValue("statusId",(h=u.find(N=>N.isDefaultValue))==null?void 0:h.id.toString())},[u,n]),T.useEffect(()=>{var h;c&&!n&&d.setFieldValue("roleId",(h=c.find(N=>N.isDefaultValue))==null?void 0:h.id.toString())},[c,n]),e.jsx(vn,{opened:!0,onClose:t,title:i(n?"ACCOUNT.USERS.HEADER_MODAL":"ACCOUNT.USERS.HEADER_MODAL_NEW"),size:"xl",children:e.jsxs("form",{onSubmit:d.onSubmit(s),autoComplete:"off",children:[e.jsx(yn,{className:"mb-2"}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsx(Se,{label:i("ACCOUNT.USERS.DEGREE"),...d.getInputProps("degree"),disabled:!o}),e.jsx(kt,{label:i("ACCOUNT.USERS.PHONE"),...d.getInputProps("phone"),disabled:!(o??r)}),e.jsx(Se,{label:i("ACCOUNT.USERS.FIRST_NAME"),...d.getInputProps("firstName"),disabled:!o}),e.jsx(kt,{label:i("ACCOUNT.USERS.MOBILE_PHONE"),...d.getInputProps("mobilePhone"),disabled:!(o??r)}),e.jsx(Se,{label:i("ACCOUNT.USERS.LAST_NAME"),...d.getInputProps("lastName"),disabled:!o}),e.jsx(Ge,{className:"col-span-full",my:"md"}),e.jsx(Se,{label:i("ACCOUNT.USERS.EMAIL"),...d.getInputProps("email"),type:"email",disabled:!0}),e.jsx(Se,{label:i("ACCOUNT.USERS.LOGIN"),...d.getInputProps("login"),type:"email",disabled:!!n,autoComplete:"email"}),!n&&e.jsxs(e.Fragment,{children:[e.jsx(Mn,{label:i("ACCOUNT.USERS.PASSWORD"),...d.getInputProps("password"),autoComplete:"new-password"}),e.jsx(Mn,{label:i("ACCOUNT.USERS.PASSWORD_REPEAT"),...d.getInputProps("password2"),autoComplete:"off"})]}),e.jsx(Ge,{className:"col-span-full",my:"md"}),e.jsx(Dn.Group,{label:i("ACCOUNT.USERS.USER_RIGHTS"),...d.getInputProps("roleId"),className:"col-span-full",children:e.jsx(Ne,{mt:"xs",children:c==null?void 0:c.map(h=>e.jsx(Dn,{value:h.id.toString(),label:h.name,disabled:!o}
46,h.id))})}),e.jsx(Dn.Group,{label:i("ACCOUNT.USERS.ALLOWED"),...d.getInputProps("statusId"),className:"col-span-full",children:e.jsx(Ne,{mt:"xs",children:u==null?void 0:u.filter(h=>h.isVisible).map(h=>e.jsx(Dn,{value:h.id.toString(),label:h.name,disabled:!o},h.id))})}),e.jsx(Ge,{className:"col-span-full",my:"md"}),e.jsx(En,{label:i("ACCOUNT.USERS.DISPLAY_PRICELIST"),checked:Number(d.values.roleId)!==3,disabled:!0}),e.jsx(En,{label:i("ACCOUNT.USERS.DISPLAY_INVOICES"),checked:Number(d.values.roleId)!==3,disabled:!0}),e.jsx(En,{label:i("ACCOUNT.USERS.DISPLAY_STOCK"),checked:Number(d.values.roleId)!==3,disabled:!0}),e.jsx(En,{label:i("ACCOUNT.USERS.MULTIPLE_ENTRIES"),checked:Number(d.values.roleId)!==3,disabled:!0}),e.jsx(Ge,{className:"col-span-full",my:"md"}),e.jsx(un,{className:"col-span-full",label:i("ACCOUNT.USERS.LANGUAGE"),...d.getInputProps("languageId"),data:l==null?void 0:l.map(h=>({value:h.id.toString(),label:h.name})),disabled:!(o??r)})]}),e.jsxs(Ne,{justify:"end",className:"mt-3",children:[e.jsx(je,{onClick:t,variant:"subtle",children:i("CLOSE")}),e.jsx(je,{type:"submit",disabled:!d.isDirty(),children:i("SAVE")})]})]})})}function ro({close:t,onSubmit:n,login:s}){const{t:a}=k(),i=_n({initialValues:{oldLogin:s,newLogin:"",password:""},validate:{newLogin:_e(),password:_e()}});return e.jsx(vn,{opened:!0,onClose:t,title:a("ACCOUNT.USERS.MODAL.LOGIN.HEADER"),children:e.jsx("form",{onSubmit:i.onSubmit(n),children:e.jsxs(Be,{children:[e.jsx(yn,{className:"mb-2"}),e.jsx(Mn,{label:a("ACCOUNT.USERS.LOGIN.PASSWORD"),...i.getInputProps("password")}),e.jsx(Se,{label:a("ACCOUNT.USERS.LOGIN.LOGIN_NEW"),...i.getInputProps("newLogin")}),e.jsxs(Ne,{justify:"end",children:[e.jsx(je,{variant:"light",onClick:t,children:a("CLOSE")}),e.jsx(je,{type:"submit",children:a("SAVE")})]})]})})})}function io(){const{t}=k(),[n,s]=wt(!1),[a,i]=T.useState(1),o=new URLSearchParams({_page:a-1,isDisabled:n?"":!1,_limit:25}),{data:r,refresh:l}=me(()=>w("GET /api/v4/user-detail/user?"+o.toString()),{refreshDeps:[n,a]}),{data:c}=me(()=>w("GET /api/v4/user-detail/role"));async function u(N){var A;let m=null;N&&(m=await w(`GET /api/v4/user-detail?login=${N.login}`));const C=fe(so,{defaultValues:m,permission:{isAdmin:he.isInRole(ae.ADMIN),isOwner:(N==null?void 0:N.login)===((A=he.data)==null?void 0:A.unique_name)},onSubmit:async p=>{try{N?(await w(`PUT /api/v4/user-detail/${N.id}`,{body:p}),nn("success",t("ACCOUNT.USER.MESSAGE.USER_CHANGED"))):(await w("POST /api/v4/user-detail",{body:p}),nn("success",t("ACCOUNT.USER.MESSAGE.USER_CREATED"))),C(),l()}catch(f){H(f)}}})}function d(){var m;const N=fe(to,{login:(m=he.data)==null?void 0:m.unique_name,onSubmit:async C=>{try{await w("POST /api/v4/user-detail/change-password",{body:C}),nn("success",t("ACCOUNT.USER.MESSAGE.USER_PASSWORD_CHANGED")),N()}catch(A){H(A)}}})}function h(){var m;const N=fe(ro,{login:(m=he.data)==null?void 0:m.unique_name,onSubmit:async C=>{try{await w("POST /api/v4/user-detail/change-login",{body:C}),N(),await he.logOut()}catch(A){H(A)}}})}return e.jsx("div",{className:"w-full p-2",children:e.jsxs(Be,{children:[e.jsx(Vn,{className:"mb-2",children:t("ACCOUNT.USERS.TITLE")}),e.jsx(zt,{slot:"ACCOUNT_USERS",className:"mb-2"}),e.jsxs(Ne,{children:[e.jsx(je,{onClick:()=>d(),children:t("ACCOUNT.USERS.CHANGE_PASSWORD")}),e.jsx(je,{onClick:()=>h(),children:t("ACCOUNT.USERS.CHANGE_LOGIN")})]}),e.jsx(Ge,{my:"lg"}),e.jsx(Gs,{records:r==null?void 0:r.data,page:(r==null?void 0:r.pagination.page)===void 0?0:r.pagination.page+1,totalRecords:r==null?void 0:r.pagination.total,recordsPerPage:(r==null?void 0:r.pagination.limit)??10,onPageChange:i,rowClassName:N=>N.isDisabled?"line-through text-gray-300":"",columns:[{title:t("ACCOUNT.USERS.FIRST_NAME"),accessor:"firstName"},{title:t("ACCOUNT.USERS.LAST_NAME"),accessor:"lastName"},{title:t("ACCOUNT.USERS.LOGIN"),accessor:"login"},{title:t("ACCOUNT.USERS.USER_RIGHTS"),accessor:"roleId",render:N=>{var m;return(m=c==null?void 0:c.find(C=>C.id===N.roleId))==null?void 0:m.name}},{accessor:"actions",title:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Pt,{label:t("ACCOUNT.USERS.SHOW_ALL"),children:e.jsx("div",{children:e.jsx(ri,{checked:n,onChange:s})})}),e.jsx(On,{onClick:()=>l(),size:"sm",children:e.jsx(ii,{})}),he.isInRole(ae.ADMIN)&&e.jsx(On,{onClick:()=>void u(),size:"sm",children:e.jsx(zs,{})})]}),render:N=>e.jsx("div",{className:"flex justify-end gap-2",children:e.jsx(On,{onClick:()=>void u(N),size:"sm",children:e.jsx(Hs,{})})})}]})]})})}function Ft(t,n={}){const{removeUndefined:s=!0,removeNull:a=!0,removeEmptyString:i=!1,removeZero:o=!1}=n,r={};for(const l of Object.keys(t))if(typeof t[l]=="object"&&t[l]!==null)r[l]=Ft(t[l],n);else if(t[l])r[l]=t[l];else switch(typeof t[l]){case"number":{o||(r[l]=t[l]);break}case"string":{i||(r[l]=t[l]);break}case"object":{a||(r[l]=t[l]);break}case"undefined":{s||(r[l]=t[l]);break}case"boolean":{r[l]=t[l];break}default:throw new Error(`Unsupported type: ${typeof t[l]}`)}return r}function Fn({defaultParams:t,apiCall:n}){const s=Yn(),a=qn(),[i,o]=T.useState(!0),[r,l]=T.useState([]),[c,u]=T.useState({...t,...os(a.search)}),d=T.useCallback(n,[]);T.useEffect(()=>{u(m=>({...m,...os(a.search)}))},[a.search]);const h=T.useCallback(m=>function(C){u(A=>({...A,[m]:C}))},[]),N=T.useCallback(async()=>{o(!0);const m=Ft(c,{removeEmptyString:!0});s(a.pathname+en(m),{replace:!0});try{const C=Ft(c,{removeEmptyString:!0}),A=await d(C);l(A)}catch(C){H(C)}finally{o(!1)}},[d,c]);return{params:c,loading:i,data:r,getSetter:h,search:N}}const ao={textDecoration:"line-through"};function lo(){const{t}=k(),{params:n,loading:s,data:a,search:i,getSetter:o}=Fn({defaultParams:{fromDate:x.utc().startOf("date").add(-6,"month").toISOString(),toDate:x.utc().startOf("date").add(1,"day").toISOString(),order:"",status:"",shipToAddress:"",yourNumber:"",isCancelled:"false"},apiCall:c=>w("/api/v4/order"+en(c))}),{data:r}=de("/api/v4/address"),{data:l}=de("/api/v4/order/status");return T.useEffect(()=>{i()},[]),e.jsxs(ve,{noShadow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.ORDER.TITLE")}),e.jsx(zt,{slot:"ORDER_LIST"}),e.jsxs("div",{className:"mt-4",children:[e.jsxs(We,{children:[e.jsx(D,{label:t("ACCOUNT.ORDER.DATE_FROM"),children:e.jsx(Ke.Input,{value:x.utc(n.fromDate),onChange:c=>o("fromDate")(c==null?void 0:c.toISOString()),hideIcon:!0,"data-testid":"order-date-from-input"})}),e.jsx(D,{label:t("ACCOUNT.ORDER.DATE_TO"),children:e.jsx(Ke.Input,{value:x.utc(n.toDate),onChange:c=>o("toDate")(c==null?void 0:c.toISOString()),hideIcon:!0,"data-testid":"order-date-to-input"})}),e.jsx(D,{label:t("ACCOUNT.ORDER.ORDER_NUMBER"),children:e.jsx("input",{value:n.order,onChange:c=>o("order")(c.target.value),"data-testid":"order-number-input"})}),e.jsx(D,{label:t("ACCOUNT.ORDER.STATUS"),children:e.jsxs("select",{value:n.status,onChange:c=>o("status")(c.target.value),"data-testid":"order-status-select",children:[e.jsx("option",{value:"",children:"--"}),l==null?void 0:l.map(({id:c,status:u})=>e.jsx("option",{value:c,children:u},c))]})}),e.jsx(D,{label:t("ACCOUNT.ORDER.CUSTOMER_ORDER_NUMBER"),children:e.jsx("input",{value:n.yourNumber,onChange:c=>o("yourNumber")(c.target.value),"data-testid":"order-your-number-input"})}),e.jsx(D,{label:t("ACCOUNT.ORDER.ADDRESS"),children:e.jsxs("select",{value:n.shipToAddress,onChange:c=>o("shipToAddress")(c.target.value),"data-testid":"order-address-select",children:[e.jsx("option",{value:"",children:"--"}),r==null?void 0:r.map(({karatCode:c,name:u,street:d,city:h,country:N})=>e.jsx("option",{value:c??void 0,children:`${u} - ${d} ${h} ${N}`},c))]})}),e.jsx(D,{label:t("ACCOUNT.ORDER.CANCELLED"),borderless:!0,children:e.jsx(Fs,{value:n.isCancelled.toString(),onChange:c=>o("isCancelled")(c),labelPosition:"bottom",options:[{label:t("ALL"),value:""},{label:t("YES"),value:"true"},{label:t("NO"),value:"false"}],"data-testid":"order-cancelled-radio"})})]}),e.jsx("div",{className:"my-3 flex items-center justify-end",children:e.jsx(R,{type:"primary",onClick:i,loading:s,"data-testid":"order-search-button",children:t("ACCOUNT.ORDER.SEARCH")})}),e.jsx("div",{className:"table__wrapper",children:e.jsxs("table",{className:"table-pretty",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.ORDER.ORDER_NUMBER")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.ORDER.ADDRESSEE")}),e.jsx("th",{children:t("ACCOUNT.ORDER.STATUS")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.ORDER.PAYMENT")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.ORDER.TRANSPORT")}),e.jsx("th",{children:t("ACCOUNT.ORDER.DEADLINE")})]})}),e.jsx("tbody",{children:a.map((c,u)=>e.jsxs("tr",{style:c.isCancelled?ao:void 0,children:[e.jsx("td",{children:e.jsx(oe,{to:`/account/order/${c.order}`,children:c.order})}),e.jsx("td",{className:"hidden lg:table-cell",children:c.address}),e.jsx("td",{children:c.status}),e.jsx("td",{className:"hidden lg:table-cell",children:c.payment}),e.jsx("td",{className:"hidden lg:table-cell",children:c.transport}),e.jsx("td",{children:x.utc(c.deadline).format("L")})]},u))})]})})]})]})}const oo={textDecoration:"line-through"};function co(){const{t}=k(),{params:n,loading:s,data:a,search:i,getSetter:o}=Fn({defaultParams:{fromDate:x.utc().startOf("date").add(-6,"month").toISOString(),toDate:x.utc().startOf("date").add(1,"day").toISOString(),complaintNumber:"",order:"",status:""},apiCall:l=>w("/api/v4/complaint"+en(l))}),{data:r}=de("/api/v4/complaint/status");return T.useEffect(()=>{i()},[]),e.jsxs(ve,{noShadow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.COMPLAINT.TITLE")}),e.jsxs("div",{className:"mt-4",children:[e.jsxs(We,{children:[e.jsx(D,{label:t("ACCOUNT.COMPLAINT.DATE_FROM"),children:e.jsx(Ke.Input,{value:x.utc(n.fromDate),onChange:l=>o("fromDate")(l==null?void 0:l.toISOString()),hideIcon:!0,"data-testid":"complaint-date-from-input"})}),e.jsx(D,{label:t("ACCOUNT.COMPLAINT.DATE_TO"),children:e.jsx(Ke.Input,{value:x.utc(n.toDate),onChange:l=>o("toDate")(l==null?void 0:l.toISOString()),hideIcon:!0,"data-testid":"complaint-date-to-input"})}),e.jsx(D,{label:t("ACCOUNT.COMPLAINT.COMPLAINTS_NUMBER"),children:e.jsx("input",{value:n.complaintNumber,onChange:l=>o("complaintNumber")(l.target.value),"data-testid":"complaint-number-input"})}),e.jsx(D,{label:t("ACCOUNT.COMPLAINT.ORDER"),children:e.jsx("input",{value:n.order,onChange:l=>o("order")(l.target.value),"data-testid":"complaint-order-input"})}),e.jsx(D,{label:t("ACCOUNT.COMPLAINT.STATE"),children:e.jsxs("select",{value:n.status,onChange:l=>o("status")(l.target.value),"data-testid":"complaint-status-select",children:[e.jsx("option",{value:"",children:"--"}),r==null?void 0:r.map(({karatId:l,description:c})=>e.jsx("option",{value:l,children:c},l))]})})]}),e.jsxs("div",{className:"my-3 flex items-center justify-between",children:[e.jsx(oe,{to:"/account/invoice",children:e.jsxs(R,{type:"primary","data-testid":"complaint-ne
46w-button",children:[e.jsx(le,{path:tn}),e.jsx("span",{children:t("ACCOUNT.COMPLAINT.NEW")})]})}),e.jsx(R,{type:"primary",onClick:i,loading:s,"data-testid":"complaint-search-button",children:t("ACCOUNT.COMPLAINT.SEARCH")})]}),e.jsxs("table",{className:"table-pretty",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.COMPLAINT.COMPLAINTS_NUMBER")}),e.jsx("th",{children:t("ACCOUNT.COMPLAINT.DATE")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.COMPLAINT.TYPE")}),e.jsx("th",{children:t("ACCOUNT.COMPLAINT.STATE")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.COMPLAINT.DESCRIPTION")})]})}),e.jsx("tbody",{children:a.map((l,c)=>e.jsxs("tr",{style:l.isCancelled?oo:void 0,children:[e.jsx("td",{children:e.jsx(oe,{to:`/account/complaint/${l.id}`,"data-testid":`complaint-link-${l.id}`,children:l.id})}),e.jsx("td",{children:x.utc(l.date).format("L")}),e.jsx("td",{className:"hidden lg:table-cell",children:l.type}),e.jsx("td",{className:"whitespace-nowrap",children:l.status}),e.jsx("td",{className:"hidden lg:table-cell",children:l.description})]},c))})]})]})]})}const bt=t=>t?(t.replaceAll(/[^a-zA-Z0-9]/g,"").toUpperCase().match(/.{1,4}/g)??[]).join("-").slice(0,19):"";function uo({close:t,onSubmit:n,contractCode:s,delivery:a}){const[i,o]=wt(""),[r,l]=wt(null),[c,u]=T.useState(!0),{data:d,loading:h}=me(()=>w(`/api/v4/ro-e-transport/${s}/${a.id}`),{refreshDeps:[a.id],onError:H,onSuccess:j=>{j!=null&&j.uitCode&&o(bt(j.uitCode))}}),N=me(({deliveryId:j,body:g})=>w(`POST /api/v4/ro-e-transport/${j}`,{body:g}),{manual:!0,onError:H}),m=me(({roETransportUitId:j,body:g})=>w(`PUT /api/v4/ro-e-transport/${j}`,{body:g}),{manual:!0,onError:H}),{t:C}=k(),A=T.useCallback((j,g)=>{const v=j.replaceAll("-","");if(v.length===0)return null;const S=v.length===16;return/^[0-9ACDEFHJKLMNPQRTUVWXY]{4}-[0-9ACDEFHJKLMNPQRTUVWXY]{4}-[0-9ACDEFHJKLMNPQRTUVWXY]{4}-[0-9ACDEFHJKLMNPQRTUVWXY]{2}[0-9]{2}$/.test(j)?null:!g||S?C("ACCOUNT.ORDER_DETAIL.DELIVERY.E_TRANSPORT.MODAL.UIT_INPUT_ERROR"):null},[C]),p=j=>{const g=i,v=j.currentTarget.value;if(v.length<g.length){o(bt(v));return}const S=v.length>g.length&&v.endsWith("-"),y=v.length===5||v.length===10||v.length===15;if(S&&y){o(v);return}o(bt(v))};T.useEffect(()=>{const j=A(i,c);l(j)},[i,c,A,l]);async function f(){if(i===(d==null?void 0:d.uitCode)){t();return}await(d!=null&&d.roETransportUitId?m.runAsync({roETransportUitId:d.roETransportUitId,body:{code:i}}):N.runAsync({deliveryId:a.id,body:{code:i}})),n(),t()}return e.jsxs(vn,{opened:!0,onClose:t,title:C("ACCOUNT.ORDER_DETAIL.DELIVERY.E_TRANSPORT.MODAL.TITLE"),size:"auto",children:[e.jsx(Ht,{visible:h}),e.jsxs(Be,{children:[e.jsx(Tn,{type:"info",children:e.jsx(kn,{i18nKey:"ACCOUNT.ORDER_DETAIL.DELIVERY.E_TRANSPORT.MODAL.INFO"})}),e.jsxs(Ne,{children:[e.jsx(Se,{className:"flex-grow",placeholder:C("ACCOUNT.ORDER_DETAIL.DELIVERY.E_TRANSPORT.MODAL.UIT_INPUT"),value:i,onChange:p,onFocus:()=>u(!0),onBlur:()=>u(!1),autoFocus:!0,"data-autofocus":!0,error:r,maxLength:19}),e.jsx(je,{onClick:f,disabled:!i||!!r,loading:N.loading||m.loading,children:C("ACCOUNT.ORDER_DETAIL.DELIVERY.E_TRANSPORT.MODAL.CONFIRM")})]})]})]})}function ho(){const{t}=k();return e.jsx(Xs,{title:t("MESSAGE.ERROR.UNKNOWN"),message:t("MESSAGE.ERROR.UNKNOWN_MESSAGE")})}function It({isLoading:t,responseError:n}){if(t)return e.jsx(Ve,{pos:"relative",className:"h-screen w-full",children:e.jsx(Ht,{visible:!0})});if((n==null?void 0:n.response.status)===404)return e.jsx(Ks,{});if(n)return e.jsx(ho,{})}function Co({orderId:t,onRetryPayment:n,onShowOrderDetail:s}){const{t:a}=k();return e.jsx(ve,{noShadow:!0,className:"mt-[100px] flex justify-center text-center",children:e.jsxs(Be,{className:"w-[450px] items-center gap-y-4",children:[e.jsx(ra,{size:60,stroke:1.5,color:"red",className:"align-middle"}),e.jsx(Vn,{order:2,className:"text-red-600",children:a("ACCOUNT.INVOICE_DETAIL.PAYMENT_FAILED")}),e.jsx(Z,{children:a("ACCOUNT.ORDER_DETAIL.UNSUCCESSFUL_PAYMENT.ERROR_MESSAGE",{orderId:t})}),e.jsxs(nt,{className:"justify-center gap-x-2",children:[e.jsx(R,{onClick:n,type:"primary",children:a("ACCOUNT.ORDER_DETAIL.UNSUCCESSFUL_PAYMENT.RETRY_BUTTON")}),e.jsx(R,{onClick:s,children:a("ACCOUNT.ORDER_DETAIL.UNSUCCESSFUL_PAYMENT.BACK_BUTTON")})]})]})})}const xs={PL:{imgSrc:"/img/logo/pp-logo.png"},GP:{imgSrc:"/img/logo/gp-webpay.png"},PU:{imgSrc:"/img/logo/payu-logo.svg"}},ps="unsuccessful-payment";function No(){var g,v,S,y,L,O,_,M,B,P,F,q,W,ee,$,K,b,Q,U,V,se,xe,Ie,Ue,De,pe,ce,X,ue,Ye,G,ke,Ae,ye,An,sn,rn,an,ln,on,E,re,ie,Ce,Te,Pe,cn,xn,Un,Ln,Zn,Qe,Pn;const[t,n]=ai(),[s,a]=T.useState(t.get("error")===ps);T.useEffect(()=>{if(t.get("error")===ps){const Y=new URLSearchParams(t);Y.delete("error"),n(Y)}},[t]);const{order:i}=Rn(),{t:o}=k(),{data:r,refresh:l,loading:c,error:u}=me(()=>w(`/api/v4/order/${i}`),{refreshDeps:[i],onError:H}),{data:d,refresh:h}=me(()=>w(`/api/v4/order/${i}/package-info`),{refreshDeps:[i],onError:H}),[N,m]=Xt("@"),C=me(Y=>w(`POST /api/v4/order/${i}/send-email`,{body:Y}),{manual:!0,onError:H,onSuccess:()=>li.show({color:"blue",message:o("ACCOUNT.INVOICE_DETAIL.PDF_SENT")})}),A=me(Y=>w(`POST /api/v4/order/${i}/create-payment/${r==null?void 0:r.paymentMethodCode}`,{body:Y}),{manual:!0,onError:H}),p=me(()=>In(`/api/v4/order/${i}/pdf`),{manual:!0,onError:H,onSuccess:Y=>fn(Y,`${i}.pdf`)});async function f(){var qe;const Y=(qe=r==null?void 0:r.deliveries)==null?void 0:qe[0];if(!Y){console.error("No Deliveries!");return}try{const dn={name:Y.isCustomer?Y.customerAddressName:Y.addressName,street:Y.isCustomer?Y.customerAddressStreet:Y.addressStreet,city:Y.isCustomer?Y.customerAddressCity:Y.addressCity,postalCode:Y.isCustomer?Y.customerAddressZipCode:Y.addressZipCode,countryCode:Y.isCustomer?Y.customerAddressCountryCode:Y.addressCountryCode,phone:Y.isCustomer?Y.customerPhone:Y.phone,email:Y.isCustomer?Y.customerEmail:Y.email},{link:Ee}=await A.runAsync(dn);globalThis.location.href=Ee}catch(dn){H(dn)}}function j(Y){fe(uo,{contractCode:i,delivery:Y,onSubmit:()=>{l(),h()}})}return c||u?e.jsx(It,{isLoading:c,responseError:u}):s?e.jsx(Co,{orderId:(r==null?void 0:r.id)??void 0,onRetryPayment:f,onShowOrderDetail
46:()=>a(void 0)}):e.jsxs(ve,{noShadow:!0,children:[e.jsxs(Vn,{order:2,children:[o("ACCOUNT.ORDER_DETAIL.ORDER")," ",r==null?void 0:r.id]}),e.jsx(zt,{slot:"ORDER_DETAIL",className:"mb-4"}),(r==null?void 0:r.isCanceled)&&e.jsx(vt,{color:"red",title:o("ACCOUNT.ORDER_DETAIL.IS_CANCELED"),className:"mb-1"}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx(je,{variant:"light",component:oe,to:"/account/order",children:e.jsx(Zi,{})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Se,{value:N,onChange:m,type:"email",autoComplete:"off"}),e.jsx(je,{onClick:()=>void C.runAsync({email:N}),disabled:(r==null?void 0:r.isCanceled)??C.loading,loading:C.loading,leftSection:e.jsx(Na,{}),children:o("ACCOUNT.ORDER_DETAIL.SEND")})]})]}),e.jsxs("div",{className:"mb-2 mt-1 flex gap-2",children:[e.jsx(je,{onClick:()=>void p.runAsync(),loading:p.loading,disabled:r==null?void 0:r.isCanceled,leftSection:e.jsx(da,{}),children:o("ACCOUNT.ORDER_DETAIL.PRINT")}),e.jsx(ge,{when:he.isInRole(ae.INVOICE),children:e.jsx(je,{component:oe,to:`/account/invoice?orderNumber=${r==null?void 0:r.id}&fromDate=${x.utc().add(-10,"year").toISOString()}`,leftSection:e.jsx(aa,{}),children:o("ACCOUNT.ORDER_DETAIL.INVOICES")})})]}),e.jsx(ge,{when:!!((g=r==null?void 0:r.deliveries)!=null&&g.some(Y=>Y.isRoETransport)),children:e.jsx(vt,{color:"yellow",className:"mb-2",variant:"light",children:e.jsx(kn,{i18nKey:"ACCOUNT.ORDER_DETAIL.DELIVERY.E_TRANSPORT.WARNING"})})}),e.jsx(ge,{when:!!(!(r!=null&&r.isPaymentDone)&&(r!=null&&r.paymentMethodCode)),children:e.jsx("div",{className:"mb-2",children:e.jsx(je,{type:"primary",style:{width:"100%"},loading:A.loading,onClick:()=>void f(),children:e.jsxs("div",{className:"flex items-center",children:[(r==null?void 0:r.paymentMethodCode)&&xs[r.paymentMethodCode]&&e.jsx("img",{src:xs[r==null?void 0:r.paymentMethodCode].imgSrc,style:{display:"block",maxHeight:"2rem"},alt:""}),e.jsxs("div",{className:"ml-2",children:[o("ACCOUNT.ORDER_DETAIL.PAY")," ",z.formatMoney(r==null?void 0:r.unpaidAmount,r==null?void 0:r.unpaidAmountCurrencyCode)]})]})})})}),e.jsx(ge,{when:!!r,children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx("table",{className:"table",style:{height:"100%"},children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.REVISION")})}),e.jsx("td",{children:r==null?void 0:r.confirmedRevision})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.CONFIRMED")})}),e.jsx("td",{children:r!=null&&r.confirmDate?x.utc(r==null?void 0:r.confirmDate).format("L"):""})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.RELEASE")})}),e.jsx("td",{children:r!=null&&r.toDespatchDate?x.utc(r==null?void 0:r.toDespatchDate).format("L"):""})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.ORDER")})}),e.jsx("td",{children:r==null?void 0:r.id})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.NOTE")})}),e.jsx("td",{children:r==null?void 0:r.customerInstruction})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DELIVERY_ADDRESS")})}),((v=r==null?void 0:r.deliveries)==null?void 0:v[0])&&e.jsxs("td",{children:[e.jsx("p",{children:e.jsx("strong",{children:r==null?void 0:r.deliveries[0].addressName})}),e.jsx("p",{children:r==null?void 0:r.deliveries[0].addressStreet}),e.jsxs("p",{children:[r==null?void 0:r.deliveries[0].addressZipCode," ",r==null?void 0:r.deliveries[0].addressCity]}),e.jsx("p",{children:r==null?void 0:r.deliveries[0].addressCountry})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.PHONE")})}),e.jsx("td",{children:(y=(S=r==null?void 0:r.deliveries)==null?void 0:S[0])==null?void 0:y.customerPhone})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.EMAIL")})}),e.jsx("td",{children:(O=(L=r==null?void 0:r.deliveries)==null?void 0:L[0])==null?void 0:O.customerEmail})]})]})}),e.jsx("table",{className:"table",style:{height:"100%"},children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.STATUS")})}),e.jsx("td",{children:r==null?void 0:r.orderStatus})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.CONFIRMED_BY")})}),e.jsx("td",{children:r==null?void 0:r.confirmedBy})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.RELEASED")}
46)}),e.jsx("td",{children:r==null?void 0:r.toDespatchBy})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.CUSTOM_NUMBER")})}),e.jsx("td",{children:r==null?void 0:r.order})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.TRANSPORT_TYPE")})}),e.jsx("td",{children:(M=(_=r==null?void 0:r.deliveries)==null?void 0:_[0])==null?void 0:M.delivery})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.PAYMENT_TYPE")})}),e.jsx("td",{children:r==null?void 0:r.paymentMethod})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.INVOICE_DELIVERY")})}),e.jsx("td",{children:r==null?void 0:r.invoiceDeliveryType})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DELIVERY_DATE_FIRST")})}),e.jsx("td",{children:x.utc(r==null?void 0:r.deliveryDateFirst).format("L")})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DELIVERY_DATE_LAST")})}),e.jsx("td",{children:x.utc(r==null?void 0:r.deliveryDateLast).format("L")})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.TOTAL_PRICE_NOT_VAT")})}),e.jsx("td",{children:z.formatMoney(r==null?void 0:r.netPrice,(P=(B=r==null?void 0:r.deliveries)==null?void 0:B[0])==null?void 0:P.currencyCode)})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.TOTAL_PRICE")})}),e.jsx("td",{children:z.formatMoney(r==null?void 0:r.price,(q=(F=r==null?void 0:r.deliveries)==null?void 0:F[0])==null?void 0:q.currencyCode)})]})]})})]})}),e.jsx(ge,{when:!!((ee=(W=r==null?void 0:r.deliveries)==null?void 0:W[0])!=null&&ee.isCustomer),children:e.jsxs(we,{withBorder:!0,className:"mt-2",children:[e.jsx(we.Section,{inheritPadding:!0,withBorder:!0,py:"xs",bg:"#e7e7e7",children:e.jsx(Z,{fw:600,children:o("ACCOUNT.ORDER_DETAIL.DIRECT_DELIVERY")})}),e.jsx(we.Section,{children:e.jsx("table",{className:"table--no-outside-border table",children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DIRECT_DELIVERY.INVOICE_ATTACHED")})}),e.jsx("td",{children:(K=($=r==null?void 0:r.deliveries)==null?void 0:$[0])!=null&&K.requireInvoice?o("YES"):o("NO")})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DIRECT_DELIVERY.CASH_ON_DELIVERY")})}),e.jsx("td",{children:(Q=(b=r==null?void 0:r.deliveries)==null?void 0:b[0])!=null&&Q.isCashOnDelivery?o("YES"):o("NO")})]}),!!((V=(U=r==null?void 0:r.deliveries)==null?void 0:U[0])!=null&&V.cashOnDeliveryPrice)&&e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DIRECT_DELIVERY.CASH_ON_DELIVERY_VALUE")})}),e.jsx("td",{children:z.formatMoney(r==null?void 0:r.deliveries[0].cashOnDeliveryPrice,r==null?void 0:r.deliveries[0].currencyCode)})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DIRECT_DELIVERY.SYMBOL_VARIABLE")})}),e.jsx("td",{children:(xe=(se=r==null?void 0:r.deliveries)==null?void 0:se[0])==null?void 0:xe.variableSymbol})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DIRECT_DELIVERY.ACCOUNT")})}),e.jsxs("td",{children:[(Ue=(Ie=r==null?void 0:r.deliveries)==null?void 0:Ie[0])==null?void 0:Ue.bankAccountNumber,"/",(pe=(De=r==null?void 0:r.deliveries)==null?void 0:De[0])==null?void 0:pe.bankCode]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DIRECT_DELIVERY.ADDRESS_SENDER")})}),e.jsxs("td",{children:[e.jsx("p",{children:e.jsx("strong",{children:(X=(ce=r==null?void 0:r.deliveries)==null?void 0:ce[0])==null?void 0:X.addressName})}),e.jsx("p",{children:(Ye=(ue=r==null?void 0:r.deliveries)==null?void 0:ue[0])==null?void 0:Ye.addressStreet}),e.jsxs("p",{children:[(ke=(G=r==null?void 0:r.deliveries)==null?void 0:G[0])==null?void 0:ke.addressZipCode," ",(ye=(Ae=r==null?void 0:r.deliveries)==null?void 0:Ae[0])==null?void 0:ye.addressCity]}),e.jsx("p",{children:(sn=(An=r==null?void 0:r.deliveries)==null?void 0:An[0])==null?void 0:sn.addressCountry})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DIRECT_DELIVERY.ADDRESS_CUSTOMER")})}),e.jsxs("td",{children:[e.jsx("p",{children:e.jsx("strong",{children:(an=(rn=r==null?void 0:r.deliveries)==null?void 0:rn[0])==null?void 0:an.customerAddressName})}),e.jsx("p",{children:(on=(ln=r==null?void 0:r.deliveries)==null?void 0:ln[0])==null?void 0:on.customerAddressRecipient}),e.jsx("p",{children:(re=(E=r==null?void 0:r.deliveries)==null?void 0:E[0])==null?void 0:re.customerAddressStreet}),e.jsxs("p",{children:[(Ce=(ie=r==null?void 0:r.deliveries)==null?void 0:ie[0])==null?void 0:Ce.customerAddressZipCode," ",(Pe=(Te=r==null?void 0:r.deliveries)==null?void 0:Te[0])==null?void 0:Pe.customerAddressCity]}),e.jsx("p",{children:(xn=(cn=r==null?void 0:r.deliveries)==null?void 0:cn[0])==null?void 0:xn.customerAddressCountry}),e.jsx("p",{children:(Ln=(Un=r==null?void 0:r.deliveries)==null?void 0:Un[0])==null?void 0:Ln.customerPhone}),e.jsx("p",{children:(Qe=(Zn=r==null?void 0:r.deliveries)==null?void 0:Zn[0])==null?void 0:Qe.customerEmail})]})]})]})})})]})}),(Pn=r==null?void 0:r.deliveries)==null?void 0:Pn.map((Y,qe)=>{var dn;return e.jsxs(Bt.Fragment,{children:[e.jsx(vt,{color:Y.isRoETransport?"yellow":"blue",className:"my-2",icon:e.jsx(ea,{}),children:e.jsxs(Ne,{justify:"space-between",children:[e.jsxs("div",{children:[o("ACCOUNT.ORDER_DETAIL.DELIVERY")," ",e.jsx("strong",{children:x.utc(Y.requiredDeliveryDate).format("L")})]}),e.jsx(ge,{when:Y.isRoETransport,children:e.jsx(je,{onClick:()=>j(Y),color:"red",size:"compact-xs",children:o("ACCOUNT.ORDER_DETAIL.DELIVERY.E_TRANSPORT.BUTTON")})})]})}),e.jsx("table",{className:"table",children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DELIVERY.NUMBER")})}),e.jsx("td",{children:Y.id})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DELIVERY.STATUS")})}),e.jsx("td",{children:Y.orderIsDelivery})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.DELIVERY.DATE")})}),e.jsx("td",{children:x.utc(Y.requiredDeliveryDate).format("L")})]})]})}),e.jsxs(we,{className:"mt-2",withBorder:!0,children:[e.jsx(we.Section,{inheritPadding:!0,withBorder:!0,py:"xs",bg:"#e7e7e7",children:e.jsx(Z,{fw:600,children:o("ACCOUNT.ORDER_DETAIL.ITEMS")})}),e.jsx(we.Section,{children:e.jsxs("table",{className:"table-pretty table--no-outside-border",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:o("ACCOUNT.ORDER_DETAIL.ITEMS.NUMBER")}),e.jsx("th",{children:o("ACCOUNT.ORDER_DETAIL.ITEMS.NAME")}),e.jsx("th",{className:"text-right",children:o("ACCOUNT.ORDER_DETAIL.ITEMS.PRICE")}),e.jsx("th",{className:"text-center",children:o("ACCOUNT.ORDER_DETAIL.ITEMS.QUANTITY")}),e.jsx("th",{className:"text-right",children:o("ACCOUNT.ORDER_DETAIL.ITEMS.TOTAL")}),e.jsx("th",{className:"text-center",children:o("ACCOUNT.ORDER_DETAIL.ITEMS.DELIVERED")})]})}),e.jsxs("tbody",{children:[(dn=Y.items)==null?void 0:dn.map((Ee,Ze)=>e.jsxs("tr",{children:[e.jsx("td",{children:Ee.nomenclatureCode}),e.jsx("td",{children:Ee.name}),e.jsx("td",{className:"text-right",children:z.formatMoney(Ee.unitNetPrice,Y.currencyCode)}),e.jsx("td",{className:"text-center",children:Ee.amount}),e.jsx("td",{className:"text-right",children:z.formatMoney(Ee.netPrice,Y.currencyCode)}),e.jsx("td",{className:"text-center",children:Ee.shippedAmount})]},Ze)),e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.ITEMS.TOTAL_PRICE_NO_VAT")})}),e.jsx("td",{}),e.jsx("td",{}),e.jsx("td",{className:"text-right",children:z.formatMoney(Y.netPrice,Y.currencyCode)}),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx("td",{children:e.jsx("strong",{children:o("ACCOUNT.ORDER_DETAIL.ITEMS.TOTAL_PRICE")})}),e.jsx("td",{}),e.jsx("td",{}),e.jsx("td",{className:"text-right",children:z.formatMoney(Y.price,Y.currencyCode)}),e.jsx("td",{})]})]})]})})]}),e.jsxs(we,{className:"mt-2",withBorder:!0,children:[e.jsx(we.Section,{inheritPadding:!0,withBorder:!0,py:"xs",bg:"#e7e7e7",children:e.jsx(Z,{fw:600,children:o("ACCOUNT.ORDER_DETAIL.EXPEDITION")})}),e.jsx(we.Section,{children:e.jsx(Qs,{data:{head:[o("ACCOUNT.ORDER_DETAIL.ITEMS.INVOICE"),o("ACCOUNT.ORDER_DETAIL.ITEMS.PREPARED"),o("ACCOUNT.ORDER_DETAIL.ITEMS.PARCELS"),o("ACCOUNT.ORDER_DETAIL.ITEMS.DISPATCHED"),o("ACCOUNT.ORDER_DETAIL.ITEMS.DELIVERED")],body:d==null?void 0:d.map(Ee=>[e.jsx(cs,{component:oe,to:`/account/invoice/${Ee.invoiceCode}`,children:Ee.invoiceCode},Ee.invoiceCode),Ee.importedAt&&x.utc(Ee.importedAt).format("L LT"),e.jsx(cs,{component:"a",href:Ee.trackingCode??void 0,target:"_blank",rel:"noopener noreferrer",children:Ee.packageCode},Ee.trackingCode),Ee.loadedAt&&x.utc(Ee.loadedAt).format("L LT"),Ee.deliveredAt&&x.utc(Ee.deliveredAt).format("L LT")])},withColumnBorders:!0})})]})]},qe)})]})}const mo=new Bn("Account");function Ao(){var m,C;const{invoice:t}=Rn(),{t:n}=k(),[s,a]=Xt("@"),{data:i,isLoading:o,error:r}=de(`/api/v4/invoice/${t}`),l=ot(`POST /api/v4/invoice/${t}/send-email`),[c,u]=T.useState(!1);async function d(){try{await l.call({email:s}),nn("info",n("ACCOUNT.INVOICE_DETAIL.PDF_SENT"))}catch(A){H(A)}}async function h(){try{u(!0);const A=await In(`/api/v4/invoice/${t}/pdf`);fn(A,`${t}.pdf`)}catch(A){H(A)}finally{u(!1)}}const N=`/account/parcel${en({invoice:t,fromDate:x.utc().add(-10,"year").toISOString()})}`;return o||r?e.jsx(It,{isLoading:o,responseError:r}):e.jsxs(ve,{noShadow:!0,children:[e.jsxs("h2",{children:[n("ACCOUNT.INVOICE_DETAIL.INVOICE")," ",t]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx(oe,{to:"/account/invoice",children:e.jsx(R,{"data-testid":"invoice-back-link",children:e.jsx(le,{path:ct})})}),e.jsxs("div",{className:"flex",children:[e.jsx(D,{children:e.jsx("input",{value:s,onChange:a,type:"email",autoComplete:"off","data-testid":"invoice-email-input"})}),e.jsxs(R,{type:"primary",responsiveSpan:!0,onClick:d,loading:l.loading,"data-testid":"invoice-send-email-button",children:[e.jsx(le,{path:oi}),e.jsx("span",{children:n("ACCOUNT.INVOICE_DETAIL.SEND")})]})]})]}),e.jsxs("div",{className:"mt-1 flex justify-between",children:[e.jsxs("div",{className:"flex",children:[e.jsxs(R,{type:"primary",responsiveSpan:!0,onClick:h,disabled:i==null?void 0:i.isCancelled,loading:c,"data-testid":"invoice-print-button",children:[e.jsx(le,{path:Kn}),e.jsx("span",{children:n("ACCOUNT.INVOICE_DETAIL.PRINT")})]}),e.jsx(oe,{to:`/account/order/${i==null?void 0:i.contractId}`,children:e.jsxs(R,{type:"primary",responsiveSpan:!0,className:"ml-1","data-testid":"invoice-order-button",children:[e.jsx(le,{path:ci}),e.jsx("span",{children:n("ACCOUNT.INVOICE_DETAIL.ORDER")})]})}),e.jsx(oe,{to:N,children:e.jsxs(R,{type:"primary",responsiveSpan:!0,className:"ml-1","data-testid":"invoice-parcels-button",children:[e.jsx(le,{path:di}),e.jsx("span",{children:n("ACCOUNT.INVOICE_DETAIL.PARCELS")})]})})]}),e.jsx(oe,{to:`/account/complain/${i==null?void 0:i.issueNoteId}`,children:e.jsx(R,{type:"primary",disabled:!(i!=null&&i.complaintAllowed),"data-testid":"invoice-complain-button",children:e.jsx("span",{children:n("ACCOUNT.INVOICE_DETAIL.COMPLAIN")})})})]}),e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:`${mo.em("invoice-top-wrapper")} mb-2`,children:[e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.ORDER"),children:e.jsx("strong",{children:i==null?void 0:i.contractId})}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.DELIVERY"),children:e.jsx("strong",{children:i==null?void 0:i.orderDocumentId})}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.CUSTOMER_NUMBER"),children:e.jsx("strong",{children:i==null?void 0:i.order})})]}),e.jsxs(We,{children:[e.jsxs(ne,{header:n("ACCOUNT.INVOICE_DETAIL.INVOICE_ADDRESS"),children:[e.jsx("strong",{children:i==null?void 0:i.invoiceAddressName}),e.jsx("p",{children:i==null?void 0:i.invoiceAddressStreet}),e.jsxs("p",{children:[i==null?void 0:i.invoiceAddressZipCode," ",i==null?void 0:i.invoiceAddressCity]}),e.jsx("p",{children:i==null?void 0:i.invoiceAddressCountry}),e.jsxs("p",{children:[n("IC"),": ",e.jsx("strong",{children:i==null?void 0:i.regNumber})]}),e.jsxs("p",{children:[n("DIC"),": ",e.jsx("strong",{children:i==null?void 0:i.vatNumber})]})]}),e.jsxs(ne,{header:n("ACCOUNT.INVOICE_DETAIL.CUSTOMER"),children:[e.jsx("strong",{children:i==null?void 0:i.deliveryAddressName}),e.jsx("p",{children:i==null?void 0:i.deliveryAddressStreet}),e.jsxs("p",{children:[i==null?void 0:i.deliveryAddressZipCode," ",i==null?void 0:i.deliveryAddressCity]}),e.jsx("p",{children:i==null?void 0:i.deliveryAddressCountry}),e.jsxs("p",{children:[n("IC"),": ",e.jsx("strong",{children:i==null?void 0:i.regNumber})]}),e.jsxs("p",{children:[n("DIC"),": ",e.jsx("strong",{children:i==null?void 0:i.vatNumber})]}),e.jsx(Ge,{my:"lg"}),e.jsx("p",{children:n("ACCOUNT.INVOICE_DETAIL.COMPANY_HQ")}),e.jsx("strong",{children:i==null?void 0:i.mainAddressName}),e.jsx("p",{children:i==null?void 0:i.mainAddressStreet}),e.jsxs("p",{children:[i==null?void 0:i.mainAddressZipCode," ",i==null?void 0:i.mainAddressCity]}),e.jsx("p",{children:i==null?void 0:i.mainAddressCountry})]}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.SYMBOL_VAR"),children:e.jsx("strong",{children:i==null?void 0:i.variableSymbol})}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.SYMBOL_CONST"),children:e.jsx("strong",{children:i==null?void 0:i.constantSymbol})}),e.jsxs(ne,{header:n("ACCOUNT.INVOICE_DETAIL.BANK"),children:[e.jsx("p",{children:e.jsx("strong",{children:i==null?void 0:i.bankBranch})}),e.jsxs("p",{children:[i==null?void 0:i.bankBankAccountNumber," / ",i==null?void 0:i.bankCode]})]}),e.jsxs(ne,{header:n("ACCOUNT.INVOICE_DETAIL.INFO"),children:[e.jsxs("p",{className:"flex justify-between",children:[e.jsxs("strong",{children:[n("ACCOUNT.INVOICE_DETAIL.DATE_DUE"),":"]})," ",x.utc(i==null?void 0:i.dueDate).format("L")]}),e.jsxs("p",{className:"flex justify-between",children:[e.jsxs("strong",{children:[n("ACCOUNT.INVOICE_DETAIL.DATE_TAXABLE_SUPPLY"),":"]})," ",x.utc(i==null?void 0:i.dateTaxableSupply).format("L")]}),e.jsxs("p",{className:"flex justify-between",children:[e.jsxs("strong",{children:[n("ACCOUNT.INVOICE_DETAIL.DATE_INVOICE"),":"]})," ",x.utc(i==null?void 0:i.invoiceDate).format("L")]})]}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.DELIVERY_TYPE"),children:e.jsx("strong",{children:i==null?void 0:i.deliveryName})}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.PAYMENT_TYPE"),children:e.jsx("strong",{children:i==null?void 0:i.paymentMethodName})}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.ISSUER"),children:e.jsx("strong",{children:i==null?void 0:i.issue})}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.INVOICE_DELIVERY_TYPE"),children:e.jsx("strong",{children:i==null?void 0:i.invoiceDeliveryTypeName})}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.PRODUCTS.HEADER"),blockColSpan:2,noBodyPadding:!0,children:e.jsxs("table",{className:"table-simple",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("ACCOUNT.INVOICE_DETAIL.PRODUCTS.PRODUCT_NUMBER")}),e.jsx("th",{children:n("ACCOUNT.INVOICE_DETAIL.PRODUCTS.PRODUCT")}),e.jsx("th",{className:"text-center",children:n("ACCOUNT.INVOICE_DETAIL.PRODUCTS.UNIT_PRICE")}),e.jsx("th",{className:"text-center",children:n("ACCOUNT.INVOICE_DETAIL.PRODUCTS.QTY")}),e.jsx("th",{className:"text-center",children:n("ACCOUNT.INVOICE_DETAIL.PRODUCTS.VAT")}),e.jsx("th",{className:"text-right",children:n("ACCOUNT.INVOICE_DETAIL.PRODUCTS.UNIT_TOTAL_PRICE")})]})}),e.jsxs("tbody",{children:[(m=i==null?void 0:i.products)==null?void 0:m.map((A,p)=>
46e.jsxs("tr",{children:[e.jsx("td",{children:A.productCode}),e.jsx("td",{children:A.productName}),e.jsx("td",{className:"text-center",children:z.formatMoney(A.unitNetPrice,i==null?void 0:i.currencyCode)}),e.jsx("td",{className:"text-center",children:A.amount}),e.jsx("td",{className:"text-center",children:A.vatRate}),e.jsx("td",{className:"text-right",children:z.formatMoney(A.netPrice,i==null?void 0:i.currencyCode)})]},p)),e.jsxs("tr",{style:{border:"none"},children:[e.jsx("th",{colSpan:5,className:"text-right",children:n("ACCOUNT.INVOICE_DETAIL.PRODUCT.TOTAL")}),e.jsx("td",{className:"text-right",children:z.formatMoney(i==null?void 0:i.foreignExchangeNetPrice,i==null?void 0:i.currencyCode)})]})]})]})}),(i==null?void 0:i.footerText)&&e.jsx(ve,{noShadow:!0,color:"gray",blockColSpan:2,children:e.jsx("p",{className:"m-0 p-1",children:i==null?void 0:i.footerText})}),e.jsx(ne,{header:n("ACCOUNT.INVOICE_DETAIL.VAT.HEADER"),blockColSpan:2,noBodyPadding:!0,children:e.jsxs("table",{className:"table-simple",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("ACCOUNT.INVOICE_DETAIL.VAT.CODE")}),e.jsx("th",{className:"text-center",children:n("ACCOUNT.INVOICE_DETAIL.VAT.TARIFF")}),e.jsx("th",{className:"text-center",children:n("ACCOUNT.INVOICE_DETAIL.VAT.NET_PRICE")}),e.jsx("th",{className:"text-right",children:n("ACCOUNT.INVOICE_DETAIL.VAT.TAX")})]})}),e.jsxs("tbody",{children:[(C=i==null?void 0:i.taxItems)==null?void 0:C.map((A,p)=>e.jsxs("tr",{children:[e.jsx("td",{children:A.vatCode}),e.jsx("td",{className:"text-center",children:A.vatRate}),e.jsx("td",{className:"text-center",children:z.formatMoney(A.unitNetPrice,i==null?void 0:i.currencyCode)}),e.jsx("td",{className:"text-right",children:z.formatMoney(A.netPrice,i==null?void 0:i.currencyCode)})]},p)),e.jsxs("tr",{children:[e.jsx("td",{colSpan:3,className:"text-right",children:e.jsxs("strong",{children:[n("ACCOUNT.INVOICE_DETAIL.VAT.ROUNDING"),":"]})}),e.jsx("td",{className:"text-right",children:z.formatMoney(i==null?void 0:i.foreignExchangeRound,i==null?void 0:i.currencyCode)})]}),e.jsxs("tr",{children:[e.jsx("td",{colSpan:3,className:"text-right",children:e.jsxs("strong",{children:[n("ACCOUNT.INVOICE_DETAIL.VAT.TOTAL"),":"]})}),e.jsx("td",{className:"text-right",children:(i==null?void 0:i.foreignExchange)!==void 0&&(i==null?void 0:i.foreignExchangeRound)!==void 0&&z.formatMoney(i.foreignExchange-i.foreignExchangeRound,i==null?void 0:i.currencyCode)})]}),e.jsxs("tr",{children:[e.jsx("td",{colSpan:3,className:"text-right",children:e.jsxs("strong",{children:[n("ACCOUNT.INVOICE_DETAIL.VAT.DEPOSIT"),":"]})}),e.jsx("td",{className:"text-right",children:z.formatMoney(i==null?void 0:i.foreignExchangeAdvance,i==null?void 0:i.currencyCode)})]}),e.jsxs("tr",{style:{border:"none"},children:[e.jsx("td",{colSpan:3,className:"text-right",children:e.jsxs("strong",{children:[n("ACCOUNT.INVOICE_DETAIL.VAT.BILLED_AMOUNT"),":"]})}),e.jsx("td",{className:"text-right",children:z.formatMoney(i==null?void 0:i.foreignExchangeMinusAdvance,i==null?void 0:i.currencyCode)})]})]})]})})]})]})]})}function xo({close:t,complaint:n}){const{t:s}=k(),a=Yn(),i=qn(),[o,r]=T.useState(!1);async function l(u){u.preventDefault();try{r(!0);const d=await In(`/api/v4/complaint/${n}/pdf`);fn(d,`${n}.pdf`)}catch(d){H(d)}finally{r(!1)}}function c(){a(i.pathname,{replace:!0,state:null}),t()}return e.jsx(J,{open:!0,children:e.jsxs("div",{children:[e.jsx(J.Header,{children:s("ACCOUNT.COMPLAINT_DETAIL.PRINT_COMPLAINT_DIALOG.HEADER")}),e.jsx(J.Content,{children:s("ACCOUNT.COMPLAINT_DETAIL.PRINT_COMPLAINT_DIALOG.MESSAGE")}),e.jsxs(J.Footer,{gaps:!0,children:[e.jsx(R,{type:"outline",loading:o,onClick:l,children:s("ACCOUNT.COMPLAINT_DETAIL.PRINT")}),e.jsx(R,{type:"primary",onClick:c,children:s("DIALOG.CANCEL")})]})]})})}function po(){var h,N;const{complaint:t}=Rn(),{t:n}=k(),s=Yn(),{state:a}=qn(),{data:i,isLoading:o,error:r}=de(`/api/v4/complaint/${t}`),[l,c]=T.useState(!1),u=`/account/ats/new-delivery/${t}`;T.useEffect(()=>{i&&!(a!=null&&a.isNewComplaint)&&!i.isCancelled&&i.isWithTransport&&!i.isTransportCreated&&fe(dt,{message:n("ACCOUNT.COMPLAINT_DETAIL.NO_ATS"),onSubmit:()=>s(`${hn()}${u}`)})},[i,a]),T.useEffect(()=>{a!=null&&a.isNewComplaint&&fe(xo,{complaint:t})},[a]);async function d(){try{c(!0);const m=await In(`/api/v4/complaint/${t}/pdf`);fn(m,`${t}.pdf`)}catch(m){H(m)}finally{c(!1)}}return o||r?e.jsx(It,{isLoading:o,responseError:r}):e.jsxs(ve,{noShadow:!0,children:[e.jsxs("h2",{children:[n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT")," ",t]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx(oe,{to:"/account/complaint",children:e.jsx(R,{children:e.jsx(le,{path:ct})})}),e.jsxs("div",{className:"flex",children:[e.jsxs(R,{type:"primary",className:"ml-1",disabled:i==null?void 0:i.isCancelled,loading:l,onClick:d,children:[e.jsx(le,{path:Kn}),e.jsx("span",{children:n("ACCOUNT.COMPLAINT_DETAIL.PRINT")})]}),(i==null?void 0:i.hasReturns)&&(i==null?void 0:i.isWithTransport)&&e.jsx(oe,{to:u,children:e.jsxs(R,{type:"primary",className:"ml-1",disabled:(i==null?void 0:i.isCancelled)||!(i!=null&&i.isWithTransport),"tooltip-no-arrow":"true",children:[e.jsx(le,{path:ui}),e.jsx("span",{children:n("ACCOUNT.COMPLAINT_DETAIL.ORDER_PICKUP")})]})})]})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx(ne,{header:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.BASIC_INFO"),className:"mt-2",noBodyPadding:!0,children:e.jsx("table",{className:"table--no-outside-border table",children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.BASIC_INFO.DATE_ISSUED")})}),e.jsx("td",{children:x.utc(i==null?void 0:i.date).format("L")}),e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.BASIC_INFO.STATUS")})}),e.jsx("td",{children:i==null?void 0:i.statusName})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.BASIC_INFO.REQUIRED")}
46)}),e.jsx("td",{children:i==null?void 0:i.customerInstruction}),e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.BASIC_INFO.RETURN_TYPE")})}),e.jsx("td",{children:i==null?void 0:i.wayOfReturnGoods})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.BASIC_INFO.NOTE")})}),e.jsx("td",{colSpan:3,children:i==null?void 0:i.note})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.BASIC_INFO.ADDRESS")})}),e.jsx("td",{colSpan:3,children:(i==null?void 0:i.returnCountry)&&e.jsxs(e.Fragment,{children:[e.jsx("p",{children:e.jsx("strong",{children:i==null?void 0:i.returnCountry.name})}),e.jsx("p",{children:i==null?void 0:i.returnCountry.subject}),e.jsx("p",{children:i==null?void 0:i.returnCountry.street}),e.jsx("p",{children:i==null?void 0:i.returnCountry.city}),e.jsx("p",{children:i==null?void 0:i.returnCountry.country})]})})]})]})})}),e.jsx(ne,{header:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.DOCUMENTS"),className:"mt-2",noBodyPadding:!0,children:e.jsxs("table",{className:"table-pretty table--no-outside-border",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.DOCUMENTS.TYPE")}),e.jsx("th",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.DOCUMENTS.INVOICE")})]})}),e.jsx("tbody",{children:(h=i==null?void 0:i.relatedDocuments)==null?void 0:h.map((m,C)=>e.jsxs("tr",{children:[e.jsx("td",{children:m.documentTypeName}),e.jsx("td",{children:m.type?e.jsx(oe,{to:`/account/${m.type}/${m.documentCode}`,children:m.documentCode}):m.documentCode})]},C))})]})}),e.jsx(ne,{header:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.ITEMS"),className:"mt-2",noBodyPadding:!0,children:e.jsxs("table",{className:"table-pretty table--no-outside-border",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.ITEMS.PRODUCT")}),e.jsx("th",{className:"textext-center",children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.ITEMS.TYPE")}),e.jsx("th",{className:"text-center",children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.ITEMS.QUANTITY")}),e.jsx("th",{className:"text-center",children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.ITEMS.PRICE")}),e.jsx("th",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.ITEMS.RETURN")}),e.jsx("th",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.ITEMS.STATUS")}),e.jsx("th",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.ITEMS.SUGGESTION")}),e.jsx("th",{children:n("ACCOUNT.COMPLAINT_DETAIL.COMPLAINT.ITEMS.DECISION")})]})}),e.jsx("tbody",{children:(N=i==null?void 0:i.products)==null?void 0:N.map((m,C)=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("strong",{children:m.code})," ",m.name]}),e.jsx("td",{className:"text-center",children:m.type}),e.jsx("td",{className:"text-center",children:m.amount}),e.jsx("td",{className:"text-center",children:z.formatMoney(m.unitExpectedPrice)}),e.jsx("td",{children:m.isReturn?n("YES"):n("NO")}),e.jsx("td",{children:m.status}),e.jsx("td",{children:m.descriptionComplaintReason}),e.jsx("td",{children:m.description})]},C))})]})})]})]})}function To(){const{t}=k(),{params:n,loading:s,data:a,search:i,getSetter:o}=Fn({defaultParams:{fromDate:x.utc().startOf("date").add(-6,"month").toISOString(),toDate:x.utc().startOf("date").add(1,"day").toISOString()},apiCall:r=>w("/api/v4/issue-note"+en(r))});return T.useEffect(()=>{i()},[]),e.jsxs(ve,{noShadow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.EXPEDITION.TITLE")}),e.jsxs("div",{className:"mt-4",children:[e.jsxs(We,{children:[e.jsx(D,{label:t("ACCOUNT.EXPEDITION.DATE_FROM"),children:e.jsx(Ke.Input,{value:x.utc(n.fromDate),onChange:r=>o("fromDate")(r==null?void 0:r.toISOString()),hideIcon:!0})}),e.jsx(D,{label:t("ACCOUNT.EXPEDITION.DATE_TO"),children:e.jsx(Ke.Input,{value:x.utc(n.toDate),onChange:r=>o("toDate")(r==null?void 0:r.toISOString()),hideIcon:!0})})]}),e.jsx("div",{className:"my-3 flex items-center justify-end",children:e.jsx(R,{type:"primary",onClick:i,loading:s,children:t("ACCOUNT.EXPEDITION.SEARCH")})}),e.jsx("div",{className:"table__wrapper",children:e.jsxs("table",{className:"table-pretty",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.EXPEDITION.DATE")}),e.jsx("th",{children:t("ACCOUNT.EXPEDITION.EXPEDITION")}),e.jsx("th",{children:t("ACCOUNT.EXPEDITION.INVOICE")}),e.jsx("th",{children:t("ACCOUNT.EXPEDITION.ORDER")}),e.jsx("th",{style:{width:"1px",paddingRight:"0.5rem"},children:t("ACCOUNT.EXPEDITION.COMPLAINT")})]})}),e.jsx("tbody",{children:a.map((r,l)=>e.jsxs("tr",{children:[e.jsx("td",{children:x.utc(r.date).format("L")}),e.jsx("td",{children:e.jsx(oe,{to:`/account/expedition/${r.id}`,children:r.id})}),e.jsx("td",{children:e.jsx(oe,{to:`/account/invoice/${r.invoice}`,children:r.invoice})}),e.jsx("td",{children:e.jsx(oe,{to:`/account/order/${r.order}`,children:r.order})}),e.jsx("td",{className:"text-center",style:{width:"1px",paddingRight:"0.5rem"},children:r.complaintAllowed?e.jsx(oe,{to:`/account/complain/${r.id}`,state:{fromExpedition:!0},children:t("ACCOUNT.EXPEDITION.COMPLAIN")}):e.jsx(Vt,{children:t("ACCOUNT.EXPEDITION.COMPLAIN_NOT_ALLOWED")})})]},l))})]})})]})]})}const St={styleHeader:{fontSize:"0.75rem",backgroundColor:"#dff0d8",borderColor:"#d6e9c6",color:"#3c763d"},style:{borderColor:"#d6e9c6"}};function Eo(){var a,i;const{expedition:t}=Rn(),{t:n}=k(),{data:s}=de(`/api/v4/issue-note/${t}`);return e.jsxs(ve,{noShadow:!0,children:[e.jsxs("h2",{children:[n("ACCOUNT.EXPEDITION_DETAIL.EXPEDITION")," ",t]}),e.jsx("div",{className:"flex justify-between",children:e.jsx(oe,{to:"/account/expedition",children:e.jsx(R,{children:e.jsx(le,{path:ct})})})}),e.jsxs("div",{className:"mt-2",children:[e.jsxs(We,{children:[e.jsx(ne,{header:n("ACCOUNT.EXPEDITION_DETAIL.ORDER"),children:e.jsx("p",{children:e.jsx(oe,{to:`/account/order/${s==null?void 0:s.orderId}`,children:s==null?void 0:s.orderId})})}),e.jsx(ne,{header:n("ACCOUNT.EXPEDITION_DETAIL.INVOICE"),children:e.jsx("p",{children:e.jsx(oe,{to:`/account/invoice/${s==null?void 0:s.invoiceId}`,children:s==null?void 0:s.invoiceId})})})]}),e.jsxs("div",{className:"my-2 flex justify-between",children:[e.jsx(ne,{className:"flex-grow",header:n("ACCOUNT.EXPEDITION_DETAIL.RETURN_DEADLINE"),...St,children:e.jsx("p",{children:e.jsx("strong",{children:x.utc(s==null?void 0:s.returnDeadlineDate).format("L")})})}),e.jsx(ne,{className:"ml-2 flex-grow",header:n("ACCOUNT.EXPEDITION_DETAIL.CLAIM_DEFECT_DEADLINE"),...St,children:e.jsx("p",{children:e.jsx("strong",{children:x.utc(s==null?void 0:s.claimDefectDeadlineDate).format("L")})})}),e.jsx(ne,{className:"ml-2 flex-grow",header:n("ACCOUNT.EXPEDITION_DETAIL.CLAIM_HIDDEN_DEFECT_DEADLINE"),...St,children:e.jsx("p",{children:e.jsx("strong",{children:x.utc(s==null?void 0:s.claimHiddenDefectDeadlineDate).format("L")})})})]}),e.jsx(ne,{header:n("ACCOUNT.EXPEDITION_DETAIL.ITEMS"),noBodyPadding:!0,children:e.jsxs("table",{className:"table-pretty table--no-outside-border",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("ACCOUNT.EXPEDITION_DETAIL.ITEMS.CODE")}),e.jsx("th",{children:n("ACCOUNT.EXPEDITION_DETAIL.ITEMS.PRODUCT")}),e.jsx("th",{className:"text-center",children:n("ACCOUNT.EXPEDITION_DETAIL.ITEMS.ORDER_QTY")}),e.jsx("th",{className:"text-center",children:n("ACCOUNT.EXPEDITION_DETAIL.ITEMS.DELIVERED_QTY")})]})}),e.jsxs("tbody",{children:[(a=s==null?void 0:s.products)==null?void 0:a.map((o,r)=>
46e.jsxs("tr",{children:[e.jsx("td",{children:o.productSizeCode}),e.jsx("td",{children:o.name}),e.jsx("td",{className:"text-center",children:o.orderedAmount}),e.jsx("td",{className:"text-center",children:o.shippedAmount})]},r)),(i=s==null?void 0:s.additionalItems)==null?void 0:i.map((o,r)=>e.jsxs("tr",{children:[e.jsx("td",{colSpan:2,children:o.name}),e.jsx("td",{className:"text-center",children:o.orderedAmount}),e.jsx("td",{className:"text-center",children:o.shippedAmount})]},r))]})]})})]})]})}function Wn(t){const[n,s]=T.useState({...t}),[a,i]=T.useState(!1);function o({target:c}){i(!0),s(u=>{var h;let d=c.value;if(c.type==="number"){const N=Number.parseFloat(c.value);d=Number.isNaN(N)?null:N}return c.type==="checkbox"&&(d=c.checked),c.type==="file"&&(d=(h=c.files)==null?void 0:h[0]),{...u,[c.name]:d}})}const r=T.useCallback(c=>{i(!0),s(c)},[]),l=T.useCallback(()=>i(!1),[]);return{data:n,handleChange:o,setData:r,dirty:a,undirty:l}}function $n({url:t,defaultData:n}){const{data:s,handleChange:a,setData:i,dirty:o,undirty:r}=Wn(n),{data:l,mutate:c}=de(t),{t:u}=k();T.useEffect(()=>{l&&(i(l),r())},[l,i,r]);async function d(){try{await w(t,{method:"PUT",body:s}),await c(),r()}catch(h){h.message.includes("DUPLICATE_KEY")&&h.message.includes("URL:")?nn("error",u("MESSAGE.ERROR.ONLINE_CATALOG.URL_EXISTS"),{duration:0}):H(h)}}return{data:s,setData:i,refresh:c,handleChange:a,save:d,dirty:o}}function Oo({refresh:t}){var m;const{t:n}=k(),{data:s,setData:a,save:i,dirty:o,handleChange:r}=$n({url:"/api/v4/online-catalog/setting",defaultData:{url:"",supportedLanguages:[],link:null,isDemandEnabled:!1,contactEmail:null}}),{data:l}=de("/api/v4/online-catalog/available-language");function c(){fe(hi,{options:l==null?void 0:l.map(C=>{var A;return{value:C,label:C,disabled:(A=s.supportedLanguages)==null?void 0:A.includes(C)}}),onSubmit:({value:C})=>{a(A=>({...A,supportedLanguages:[...A.supportedLanguages,C]}))}})}function u(C){a(A=>{var p;return{...A,supportedLanguages:(p=A.supportedLanguages)==null?void 0:p.filter((f,j)=>j!==C)}})}function d(){fe(dt,{title:n("ACCOUNT.ONLINE_CATALOG.DELETE"),message:n("ACCOUNT.ONLINE_CATALOG.DELETE.MESSAGE"),onSubmit:async()=>{await w("/api/v4/online-catalog",{method:"DELETE"}),t()}})}function h(C){C.preventDefault(),i()}const N=T.useMemo(()=>{var C;return s.link?`${s.link}/${s.url}/${(C=s.supportedLanguages)==null?void 0:C[0]}`:""},[s.link,s.url,s.supportedLanguages]);return e.jsx("div",{className:"p-2",children:e.jsxs("form",{onSubmit:h,children:[e.jsxs(We,{children:[e.jsx(D,{label:"URL",children:e.jsx("input",{name:"url",value:s.url??"",onChange:({target:C})=>a(A=>{var p;return{...A,url:(p=C.value)==null?void 0:p.toLocaleLowerCase()}})})}),e.jsx("p",{className:"break-all",children:s.url&&e.jsx("a",{href:N,target:"_blank",rel:"noopener noreferrer",children:N})}),e.jsx(D,{blockColSpan:1,label:n("ACCOUNT.ONLINE_CATALOG.SETTING.IS_DEMAND_ENABLED"),children:e.jsx("input",{name:"isDemandEnabled",type:"checkbox",checked:s.isDemandEnabled,onChange:r})}),s.isDemandEnabled&&e.jsx(D,{label:n("ACCOUNT.ONLINE_CATALOG.SETTING.CONTACT"),children:e.jsx("input",{name:"contactEmail",type:"email",value:s.contactEmail??void 0,onChange:r})})]}),s.isDemandEnabled&&e.jsxs(Tn,{type:"info",className:"my-2",children:[e.jsx("div",{children:n("ACCOUNT.ONLINE_CATALOG.SETTING.GDPR_ALERT_1")}),e.jsx("div",{className:"mt-2",children:n("ACCOUNT.ONLINE_CATALOG.SETTING.GDPR_ALERT_2")})]}),e.jsx(Ge,{my:"lg"}),e.jsx("div",{className:"table__wrapper",children:e.jsxs("table",{className:"table-simple",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("ACCOUNT.ONLINE_CATALOG.SETTING.LANGUAGE")}),e.jsx("th",{style:{width:"1px"},children:e.jsx(ze,{path:tn,onClick:c})})]})}),e.jsx("tbody",{children:(m=s.supportedLanguages)==null?void 0:m.map((C,A)=>e.jsxs("tr",{children:[e.jsx("td",{children:C}),e.jsx("td",{children:e.jsx(ze,{path:Nn,color:"red",onClick:()=>u(A)})})]},C))})]})}),e.jsxs("div",{className:"mt-2 flex",children:[e.jsx(R,{disabled:!o,type:"primary",htmlType:"submit",children:n("ACCOUNT.ONLINE_CATALOG.SAVE")}),e.jsx(R,{type:"danger",style:{marginLeft:"auto"},onClick:d,children:n("ACCOUNT.ONLINE_CATALOG.DELETE")})]})]})})}var Wt=globalThis&&globalThis.__assign||function(){return Wt=Object.assign||function(t){for(var n,s=1,a=arguments.length;s<a;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Wt.apply(this,arguments)},vr={onActivate:I.func,onAddUndo:I.func,onBeforeAddUndo:I.func,onBeforeExecCommand:I.func,onBeforeGetContent:I.func,onBeforeRenderUI:I.func,onBeforeSetContent:I.func,onBeforePaste:I.func,onBlur:I.func,onChange:I.func,onClearUndos:I.func,onClick:I.func,onContextMenu:I.func,onCommentChange:I.func,onCopy:I.func,onCut:I.func,onDblclick:I.func,onDeactivate:I.func,onDirty:I.func,onDrag:I.func,onDragDrop:I.func,onDragEnd:I.func,onDragGesture:I.func,onDragOver:I.func,onDrop:I.func,onExecCommand:I.func,onFocus:I.func,onFocusIn:I.func,onFocusOut:I.func,onGetContent:I.func,onHide:I.func,onInit:I.func,onKeyDown:I.func,onKeyPress:I.func,onKeyUp:I.func,onLoadContent:I.func,onMouseDown:I.func,onMouseEnter:I.func,onMouseLeave:I.func,onMouseMove:I.func,onMouseOut:I.func,onMouseOver:I.func,onMouseUp:I.func,onNodeChange:I.func,onObjectResizeStart:I.func,onObjectResized:I.func,onObjectSelected:I.func,onPaste:I.func,onPostProcess:I.func,onPostRender:I.func,onPreProcess:I.func,onProgressState:I.func,onRedo:I.func,onRemove:I.func,onReset:I.func,onSaveContent:I.func,onSelectionChange:I.func,onSetAttrib:I.func,onSetContent:I.func,onShow:I.func,onSubmit:I.func,onUndo:I.func,onVisualAid:I.func,onSkinLoadError:I.func,onThemeLoadError:I.func,onModelLoadError:I.func,onPluginLoadError:I.func,onIconsLoadError:I.func,onLanguageLoadError:I.func,onScriptsLoad:I.func,onScriptsLoadError:I.func},jo=Wt({apiKey:I.string,id:I.string,inline:I.bool,init:I.object,initialValue:I.str
46ing,onEditorChange:I.func,value:I.string,tagName:I.string,cloudChannel:I.string,plugins:I.oneOfType([I.string,I.array]),toolbar:I.oneOfType([I.string,I.array]),disabled:I.bool,textareaName:I.string,tinymceScriptSrc:I.oneOfType([I.string,I.arrayOf(I.string),I.arrayOf(I.shape({src:I.string,async:I.bool,defer:I.bool}))]),rollback:I.oneOfType([I.number,I.oneOf([!1])]),scriptLoading:I.shape({async:I.bool,defer:I.bool,delay:I.number})},vr),Lt=function(t){return typeof t=="function"},Ts=function(t){return t in vr},Es=function(t){return t.substr(2)},fo=function(t,n,s,a,i,o,r){var l=Object.keys(i).filter(Ts),c=Object.keys(o).filter(Ts),u=l.filter(function(h){return o[h]===void 0}),d=c.filter(function(h){return i[h]===void 0});u.forEach(function(h){var N=Es(h),m=r[N];s(N,m),delete r[N]}),d.forEach(function(h){var N=a(t,h),m=Es(h);r[m]=N,n(m,N)})},Io=function(t,n,s,a,i){return fo(i,t.on.bind(t),t.off.bind(t),function(o,r){return function(l){var c;return(c=o(r))===null||c===void 0?void 0:c(l,t)}},n,s,a)},Os=0,yr=function(t){var n=Date.now(),s=Math.floor(Math.random()*1e9);return Os++,t+"_"+s+Os+String(n)},js=function(t){return t!==null&&(t.tagName.toLowerCase()==="textarea"||t.tagName.toLowerCase()==="input")},fs=function(t){return typeof t>"u"||t===""?[]:Array.isArray(t)?t:t.split(" ")},go=function(t,n){return fs(t).concat(fs(n))},vo=function(){return window.InputEvent&&typeof InputEvent.prototype.getTargetRanges=="function"},yo=function(t){if(!("isConnected"in Node.prototype)){for(var n=t,s=t.parentNode;s!=null;)n=s,s=n.parentNode;return n===t.ownerDocument}return t.isConnected},Is=function(t,n){t!==void 0&&(t.mode!=null&&typeof t.mode=="object"&&typeof t.mode.set=="function"?t.mode.set(n):t.setMode(n))},$t=globalThis&&globalThis.__assign||function(){return $t=Object.assign||function(t){for(var n,s=1,a=arguments.length;s<a;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},$t.apply(this,arguments)},bo=function(t,n,s){var a,i,o=t.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=n.id,o.src=n.src,o.async=(a=n.async)!==null&&a!==void 0?a:!1,o.defer=(i=n.defer)!==null&&i!==void 0?i:!1;var r=function(){o.removeEventListener("load",r),o.removeEventListener("error",l),s(n.src)},l=function(c){o.removeEventListener("load",r),o.removeEventListener("error",l),s(n.src,c)};o.addEventListener("load",r),o.addEventListener("error",l),t.head&&t.head.appendChild(o)},So=function(t){var n={},s=function(r,l){var c=n[r];c.done=!0,c.error=l;for(var u=0,d=c.handlers;u<d.length;u++){var h=d[u];h(r,l)}c.handlers=[]},a=function(r,l,c){var u=function(j){return c!==void 0?c(j):console.error(j)};if(r.length===0){u(new Error("At least one script must be provided"));return}for(var d=0,h=!1,N=function(j,g){h||(g?(h=!0,u(g)):++d===r.length&&l())},m=0,C=r;m<C.length;m++){var A=C[m],p=n[A.src];if(p)p.done?N(A.src,p.error):p.handlers.push(N);else{var f=yr("tiny-");n[A.src]={id:f,src:A.src,done:!1,error:null,handlers:[N]},bo(t,$t({id:f},A),s)}}},i=function(){for(var r,l=0,c=Object.values(n);l<c.length;l++){var u=c[l],d=t.getElementById(u.id);d!=null&&d.tagName==="SCRIPT"&&((r=d.parentNode)===null||r===void 0||r.removeChild(d))}n={}},o=function(){return t};return{loadScripts:a,deleteScripts:i,getDocument:o}},Lo=function(){var t=[],n=function(i){var o=t.find(function(r){return r.getDocument()===i});return o===void 0&&(o=So(i),t.push(o)),o},s=function(i,o,r,l,c){var u=function(){return n(i).loadScripts(o,l,c)};r>0?setTimeout(u,r):u()},a=function(){for(var i=t.pop();i!=null;i=t.pop())i.deleteScripts()};return{loadList:s,reinitialize:a}},Do=Lo(),Dt=function(t){var n=t;return n&&n.tinymce?n.tinymce:null},_o=globalThis&&globalThis.__extends||function(){var t=function(n,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(a[o]=i[o])},t(n,s)};return function(n,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");t(n,s);function a(){this.constructor=n}
46n.prototype=s===null?Object.create(s):(a.prototype=s.prototype,new a)}}(),at=globalThis&&globalThis.__assign||function(){return at=Object.assign||function(t){for(var n,s=1,a=arguments.length;s<a;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},at.apply(this,arguments)},Ro=function(t){_o(n,t);function n(s){var a,i,o,r=t.call(this,s)||this;return r.rollbackTimer=void 0,r.valueCursor=void 0,r.rollbackChange=function(){var l=r.editor,c=r.props.value;l&&c&&c!==r.currentContent&&l.undoManager.ignore(function(){if(l.setContent(c),r.valueCursor&&(!r.inline||l.hasFocus()))try{l.selection.moveToBookmark(r.valueCursor)}catch{}}),r.rollbackTimer=void 0},r.handleBeforeInput=function(l){if(r.props.value!==void 0&&r.props.value===r.currentContent&&r.editor&&(!r.inline||r.editor.hasFocus()))try{r.valueCursor=r.editor.selection.getBookmark(3)}catch{}},r.handleBeforeInputSpecial=function(l){(l.key==="Enter"||l.key==="Backspace"||l.key==="Delete")&&r.handleBeforeInput(l)},r.handleEditorChange=function(l){var c=r.editor;if(c&&c.initialized){var u=c.getContent();r.props.value!==void 0&&r.props.value!==u&&r.props.rollback!==!1&&(r.rollbackTimer||(r.rollbackTimer=window.setTimeout(r.rollbackChange,typeof r.props.rollback=="number"?r.props.rollback:200))),u!==r.currentContent&&(r.currentContent=u,Lt(r.props.onEditorChange)&&r.props.onEditorChange(u,c))}},r.handleEditorChangeSpecial=function(l){(l.key==="Backspace"||l.key==="Delete")&&r.handleEditorChange(l)},r.initialise=function(l){var c,u,d;l===void 0&&(l=0);var h=r.elementRef.current;if(h){if(!yo(h)){if(l===0)setTimeout(function(){return r.initialise(1)},1);else if(l<100)setTimeout(function(){return r.initialise(l+1)},100);else throw new Error("tinymce can only be initialised when in a document");return}var N=Dt(r.view);if(!N)throw new Error("tinymce should have been loaded into global scope");var m=at(at({},r.props.init),{selector:void 0,target:h,readonly:r.props.disabled,inline:r.inline,plugins:go((c=r.props.init)===null||c===void 0?void 0:c.plugins,r.props.plugins),toolbar:(u=r.props.toolbar)!==null&&u!==void 0?u:(d=r.props.init)===null||d===void 0?void 0:d.toolbar,setup:function(C){r.editor=C,r.bindHandlers({}),r.inline&&!js(h)&&C.once("PostRender",function(A){C.setContent(r.getInitialValue(),{no_events:!0})}),r.props.init&&Lt(r.props.init.setup)&&r.props.init.setup(C)},init_instance_callback:function(C){var A,p,f=r.getInitialValue();r.currentContent=(A=r.currentContent)!==null&&A!==void 0?A:C.getContent(),r.currentContent!==f&&(r.currentContent=f,C.setContent(f),C.undoManager.clear(),C.undoManager.add(),C.setDirty(!1));var j=(p=r.props.disabled)!==null&&p!==void 0?p:!1;Is(r.editor,j?"readonly":"design"),r.props.init&&Lt(r.props.init.init_instance_callback)&&r.props.init.init_instance_callback(C)}});r.inline||(h.style.visibility=""),js(h)&&(h.value=r.getInitialValue()),N.init(m)}},r.id=r.props.id||yr("tiny-react"),r.elementRef=T.createRef(),r.inline=(o=(a=r.props.inline)!==null&&a!==void 0?a:(i=r.props.init)===null||i===void 0?void 0:i.inline)!==null&&o!==void 0?o:!1,r.boundHandlers={},r}return Object.defineProperty(n.prototype,"view",{get:function(){var s,a;return(a=(s=this.elementRef.current)===null||s===void 0?void 0:s.ownerDocument.defaultView)!==null&&a!==void 0?a:window},enumerable:!1,configurable:!0}),n.prototype.componentDidUpdate=function(s){var a=this,i,o;if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(s),this.editor.initialized)){if(this.currentContent=(i=this.currentContent)!==null&&i!==void 0?i:this.editor.getContent(),typeof this.props.initialValue=="string"&&this.props.initialValue!==s.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if(typeof this.props.value=="string"&&this.props.value!==this.currentContent){var r=this.editor;r.undoManager.transact(function(){var c;if(!a.inline||r.hasFocus())try{c=r.selection.getBookmark(3)}catch{}var u=a.valueCursor;if(r.setContent(a.props.value),!a.inline||r.hasFocus())for(var d=0,h=[c,u];d<h.length;d++){var N=h[d];if(N)try{r.selection.moveToBookmark(N),a.valueCursor=N;break}catch{}}})}if(this.props.disabled!==s.disabled){var l=(o=this.props.disabled)!==null&&o!==void 0?o:!1;Is(this.editor,l?"readonly":"design")}}},n.prototype.componentDidMount=function(){var s=this,a,i,o,r,l;if(Dt(this.view)!==null)this.initialise();else if(Array.isArray(this.props.tinymceScriptSrc)&&this.props.tinymceScriptSrc.length===0)(i=(a=this.props).onScriptsLoadError)===null||i===void 0||i.call(a,new Error("No `tinymce` global is present but the `tinymceScriptSrc` prop was an empty array."));else if(!((o=this.elementRef.current)===null||o===void 0)&&o.ownerDocument){var c=function(){var d,h;(h=(d=s.props).onScriptsLoad)===null||h===void 0||h.call(d),s.initialise()},u=function(d){var h,N;(N=(h=s.props).onScriptsLoadError)===null||N===void 0||N.call(h,d)};
46Do.loadList(this.elementRef.current.ownerDocument,this.getScriptSources(),(l=(r=this.props.scriptLoading)===null||r===void 0?void 0:r.delay)!==null&&l!==void 0?l:0,c,u)}},n.prototype.componentWillUnmount=function(){var s=this,a=this.editor;a&&(a.off(this.changeEvents(),this.handleEditorChange),a.off(this.beforeInputEvent(),this.handleBeforeInput),a.off("keypress",this.handleEditorChangeSpecial),a.off("keydown",this.handleBeforeInputSpecial),a.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach(function(i){a.off(i,s.boundHandlers[i])}),this.boundHandlers={},a.remove(),this.editor=void 0)},n.prototype.render=function(){return this.inline?this.renderInline():this.renderIframe()},n.prototype.changeEvents=function(){var s,a,i,o=(i=(a=(s=Dt(this.view))===null||s===void 0?void 0:s.Env)===null||a===void 0?void 0:a.browser)===null||i===void 0?void 0:i.isIE();return o?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"},n.prototype.beforeInputEvent=function(){return vo()?"beforeinput SelectionChange":"SelectionChange"},n.prototype.renderInline=function(){var s=this.props.tagName,a=s===void 0?"div":s;return T.createElement(a,{ref:this.elementRef,id:this.id})},n.prototype.renderIframe=function(){return T.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})},n.prototype.getScriptSources=function(){var s,a,i=(s=this.props.scriptLoading)===null||s===void 0?void 0:s.async,o=(a=this.props.scriptLoading)===null||a===void 0?void 0:a.defer;if(this.props.tinymceScriptSrc!==void 0)return typeof this.props.tinymceScriptSrc=="string"?[{src:this.props.tinymceScriptSrc,async:i,defer:o}]:this.props.tinymceScriptSrc.map(function(u){return typeof u=="string"?{src:u,async:i,defer:o}:u});var r=this.props.cloudChannel,l=this.props.apiKey?this.props.apiKey:"no-api-key",c="https://cdn.tiny.cloud/1/".concat(l,"/tinymce/").concat(r,"/tinymce.min.js");return[{src:c,async:i,defer:o}]},n.prototype.getInitialValue=function(){return typeof this.props.initialValue=="string"?this.props.initialValue:typeof this.props.value=="string"?this.props.value:""},n.prototype.bindHandlers=function(s){var a=this;if(this.editor!==void 0){Io(this.editor,s,this.props,this.boundHandlers,function(l){return a.props[l]});var i=function(l){return l.onEditorChange!==void 0||l.value!==void 0},o=i(s),r=i(this.props);!o&&r?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):o&&!r&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}},n.propTypes=jo,n.defaultProps={cloudChannel:"6"},n}(T.Component);function br({value:t,onChange:n}){function s(i){n(i)}const a=T.useMemo(()=>t,[]);return e.jsx(Ro,{apiKey:"w3v80f13ox9z7mnqdpwitfdfzeo24mfg59sktdebaj0bm232",init:{plugins:"print preview paste importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons",toolbar:"undo redo | bold italic underline strikethrough | fontsizeselect formatselect | alignleft aligncenter alignright al
46ignjustify | outdent indent |  numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen  preview print | insertfile image media template link anchor codesample | ltr rtl",height:640},initialValue:a,onEditorChange:s})}function gs({close:t,onSubmit:n,defaultData:s}){var h,N;const{t:a}=k(),{data:i,handleChange:o,setData:r}=Wn({title:{},code:"",value:{},displayOrder:0,...s}),{data:l}=de("/api/v4/online-catalog/setting",w),[c,u]=T.useState((h=l==null?void 0:l.supportedLanguages)==null?void 0:h[0]);function d(m){var C;if(m.preventDefault(),(C=l==null?void 0:l.supportedLanguages)!=null&&C.some(A=>{var p;return!((p=i.title)!=null&&p[A])})){nn("error",a("ACCOUNT.ONLINE_CATALOG.ARTICLE.ERROR.EMPTY"));return}n(i),t()}return e.jsx(J,{open:!0,children:e.jsxs("form",{onSubmit:d,children:[e.jsx(J.Header,{onClose:t,closable:!0,children:a("ACCOUNT.ONLINE_CATALOG.ARTICLE")}),e.jsxs(J.Content,{children:[e.jsx(D,{className:"mb-2",label:a("ACCOUNT.ONLINE_CATALOG.ARTICLE.CODE"),children:e.jsx("input",{value:i.code??"",name:"code",onChange:o,required:!0})}),e.jsx(be,{current:c,onChange:u,children:(N=l==null?void 0:l.supportedLanguages)==null?void 0:N.map(m=>{var C,A;return e.jsx(be.Tab,{label:m,children:e.jsxs("div",{className:"p-2",children:[e.jsx(D,{className:"mb-2",label:a("ACCOUNT.ONLINE_CATALOG.ARTICLE.NAME"),children:e.jsx("input",{value:i&&c?(C=i==null?void 0:i.title)==null?void 0:C[c]:"",onChange:({target:p})=>r(f=>({...f,title:{...f.title,[c]:p.value}})),required:!0})}),e.jsx(br,{value:i&&c?(A=i==null?void 0:i.value)==null?void 0:A[c]:"",onChange:p=>r(f=>({...f,value:{...f.value,[c]:p}}))})]})},m)})})]}),e.jsxs(J.Footer,{gaps:!0,children:[e.jsx(R,{onClick:t,up:!0,children:a("ACCOUNT.ONLINE_CATALOG.CLOSE")}),e.jsx(R,{htmlType:"submit",type:"primary",up:!0,children:a("ACCOUNT.ONLINE_CATALOG.SAVE")})]})]})})}function Uo(){var c;const{t}=k(),{data:n,setData:s,save:a,dirty:i}=$n({url:"/api/v4/online-catalog/article",defaultData:[]});function o(){fe(gs,{onSubmit:u=>{s([...Array.isArray(n)?n:[],u])}},{style:{width:"calc(100vw - 2rem)"}})}function r(u){fe(gs,{defaultData:n[u],onSubmit:d=>{const h=[...Array.isArray(n)?n:[]];h[u]=d,s(h)}},{style:{width:"calc(100vw - 2rem)"}})}function l(u){s(d=>d.filter((h,N)=>u!==N))}return e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"table__wrapper",children:e.jsxs("table",{className:"table-simple",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.ONLINE_CATALOG.ARTICLE")}),e.jsx("th",{className:"table-cell-action",children:e.jsx(ze,{path:tn,onClick:o})})]})}),e.jsx("tbody",{children:(c=n==null?void 0:n.map)==null?void 0:c.call(n,(u,d)=>e.jsxs("tr",{children:[e.jsx("td",{children:u.code}),e.jsxs("td",{className:"table-cell-action",children:[e.jsx(ze,{path:qs,onClick:()=>r(d)}),e.jsx(ze,{path:Nn,color:"red",onClick:()=>l(d)})]})]},u.code))})]})}),e.jsx(R,{disabled:!i,className:"mt-2",type:"primary",onClick:a,children:t("ACCOUNT.ONLINE_CATALOG.SAVE")})]})}function Po({close:t,onSubmit:n,supportedLanguages:s,defaultData:a}){const{t:i}=k(),{data:o,handleChange:r}=Wn({link:"",banner:null,language:void 0,...a});async function l(c){c.preventDefault();try{await n(o),t()}catch(u){console.error(u)}}return e.jsx(J,{open:!0,children:e.jsxs("form",{onSubmit:l,children:[e.jsx(J.Header,{onClose:t,closable:!0,children:i("ACCOUNT.ONLINE_CATALOG.BANNER")}),e.jsxs(J.Content,{children:[e.jsx(D,{label:i("ACCOUNT.ONLINE_CATALOG.BANNER.LANGUAGE"),children:e.jsxs("select",{name:"language",value:o.language,onChange:r,required:!0,children:[e.jsx("option",{value:""}),s==null?void 0:s.map(c=>e.jsx("option",{value:c,children:c},c))]})}),e.jsx(D,{className:"mt-2",label:i("ACCOUNT.ONLINE_CATALOG.BANNER.LINK"),required:!0,children:e.jsx("input",{name:"link",value:o.link||"",onChange:r})}),e.jsx(D,{className:"mt-2",label:i("ACCOUNT.ONLINE_CATALOG.BANNER.IMAGE"),required:!0,children:e.jsx("input",{name:"banner",type:"file",onChange:r})})]}),e.jsxs(J.Footer,{gaps:!0,children:[e.jsx(R,{onClick:t,up:!0,children:i("ACCOUNT.ONLINE_CATALOG.CLOSE")}),e.jsx(R,{htmlType:"submit",type:"primary",up:!0,children:i("ACCOUNT.ONLINE_CATALOG.SAVE")})]})]})})}function Mo(){var l;const{t}=k(),{data:n,refresh:s}=$n({url:"/api/v4/online-catalog/banner",defaultData:[]}),{data:a}=de("/api/v4/online-catalog/setting");function i(){fe(Po,{supportedLanguages:a==null?void 0:a.supportedLanguages,onSubmit:async c=>{const u=new FormData;u.set("link",c.link),c.banner&&u.set("banner",c.banner),c.language&&u.set("language",c.language),await w("/api/v4/online-catalog/banner",{method:"POST",body:u}),s()}})}async function o(c){const u=n.map(d=>d.path===c?{...d,isActive:!d.isActive}:d);try{await w("/api/v4/online-catalog/banner",{method:"PUT",body:u}),s()}catch(d){console.error(d)}}function r(c){fe(dt,{message:t("ACCOUNT.ONLINE_CATALOG.BANNER.REMOVE"),onSubmit:async()=>{try{await w(`/api/v4/online-catalog/banner/${c}`,{method:"DELETE"}),s()}catch(u){console.error(u)}}})}return e.jsx("div",{className:"p-2",children:e.jsx("div",{className:"table__wrapper",children:e.jsxs("table",{className:"table-simple",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.ONLINE_CATALOG.BANNER.PICTURE")}),e.jsx("th",{children:t("ACCOUNT.ONLINE_CATALOG.BANNER.URL")}),e.jsx("th",{style:{width:"1px"},children:e.jsx(ze,{path:tn,onClick:i})})]})}),e.jsx("tbody",{children:(l=a==null?void 0:a.supportedLanguages)==null?void 0:l.map(c=>{var u;return e.jsxs(T.Fragment,{children:[e.jsx("tr",{style:{backgroundColor:"var(--color-light-0)",fontWeight:600},children:e.jsx("td",{colSpan:4,children:c})}),(u=n==null?void 0:n.filter)==null?void 0:u.call(n,d=>d.language===c).map(d=>e.jsxs("tr",{style:d.isActive?void 0:{textDecoration:"line-through",opacity:.33},children:[e.jsx("td",{children:e.jsx("img",{width:"320px",src:`/image/${d.path}`,alt:""})}),e.jsx("td",{children:d.link}),e.jsxs("td",{className:"table-cell-action",children:[e.jsx(ze,{path:d.isActive?Ci:Ni,onClick:()=>o(d.path)}),e.jsx(ze,{color:"red",path:Nn,onClick:()=>r(d.id)})]})]},d.path))]},c)})})]})})})}const ko="_percent_regsi_1",vs={percent:ko};function wo({close:t,onSubmit:n,defaultData:s,usedCurrencies:a}){const{t:i}=k(),{data:o,handleChange:r}=Wn({currency:"",rounding:"",exchange:0,...s}),{data:l}=de("/api/v4/online-catalog/available-currency",w),{data:c}=de("/api/v4/online-catalog/rounding-type",w);async function u(d){d.preventDefault(),await n(o),t()}return e.jsx(J,{open:!0,children:e.jsxs("form",{onSubmit:u,children:[e.jsx(J.Header,{onClose:t,closable:!0,children:i("ACCOUNT.ONLINE_CATALOG.PRICES.CURRENCY")}),e.jsxs(J.Content,{children:[e.jsx(D,{label:i("ACCOUNT.ONLINE_CATALOG.PRICES.CURRENCY"),disabled:!!s,children:e.jsxs("select",{name:"currency",value:o.currency??"",onChange:r,required:!0,children:[e.jsx("option",{value:""}),l==null?void 0:l.map(d=>e.jsx("option",{value:d,disabled:!!(a!=null&&a.find(h=>
46h.currency===d)),children:d},d))]})}),e.jsx(D,{className:"mt-2",label:i("ACCOUNT.ONLINE_CATALOG.PRICES.ROUNDING"),required:!0,children:e.jsxs("select",{name:"rounding",value:o.rounding??"",onChange:r,required:!0,children:[e.jsx("option",{value:""}),c==null?void 0:c.map(d=>e.jsx("option",{value:d.value,children:i(`ACCOUNT.ONLINE_CATALOG.PRICES.ROUNDING.${d.value}`)},d.id))]})}),e.jsx(D,{className:"mt-2",label:i("ACCOUNT.ONLINE_CATALOG.PRICES.EXCHANGE"),required:!0,children:e.jsx("input",{name:"exchange",type:"number",value:o.exchange||"",onChange:r,min:0,step:"any",required:!0})})]}),e.jsxs(J.Footer,{gaps:!0,children:[e.jsx(R,{onClick:t,up:!0,children:i("ACCOUNT.ONLINE_CATALOG.CLOSE")}),e.jsx(R,{htmlType:"submit",type:"primary",up:!0,children:i("ACCOUNT.ONLINE_CATALOG.SAVE")})]})]})})}function Bo(){var u;const{t}=k(),{data:n,setData:s,handleChange:a,save:i,dirty:o}=$n({url:"/api/v4/online-catalog/price",defaultData:{supportedCurrencies:[],margin:0,vat:.21,showPrice:void 0,isRoundingForVat:!1,isLimitDisplayed:!1}}),{data:r}=de("/api/v4/online-catalog/show-price-type");function l(d){fe(wo,{defaultData:d,usedCurrencies:n.supportedCurrencies,onSubmit:h=>{s(d?N=>{var m;return{...N,supportedCurrencies:(m=N.supportedCurrencies)==null?void 0:m.map(C=>C.currency===d.currency?h:C)}}:N=>({...N,supportedCurrencies:[...N.supportedCurrencies,h]}))}})}function c(d){s(h=>{var N;return{...h,supportedCurrencies:(N=h.supportedCurrencies)==null?void 0:N.filter((m,C)=>C!==d)}})}return e.jsxs("div",{className:"p-2",children:[e.jsxs("div",{className:"table__wrapper",children:[e.jsxs("table",{className:"table-simple",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.ONLINE_CATALOG.PRICES.CURRENCY")}),e.jsx("th",{children:t("ACCOUNT.ONLINE_CATALOG.PRICES.ROUNDING")}),e.jsx("th",{children:t("ACCOUNT.ONLINE_CATALOG.PRICES.EXCHANGE")}),e.jsx("th",{className:"table-cell-action",children:e.jsx(ze,{path:tn,onClick:()=>l()})})]})}),e.jsx("tbody",{children:(u=n.supportedCurrencies)==null?void 0:u.map((d,h)=>e.jsxs("tr",{children:[e.jsx("td",{children:d.currency}),e.jsx("td",{children:t(`ACCOUNT.ONLINE_CATALOG.PRICES.ROUNDING.${d.rounding}`)}),e.jsx("td",{children:d.exchange}),e.jsxs("td",{className:"table-cell-action",children:[e.jsx(ze,{path:rt,onClick:()=>l(d)}),e.jsx(ze,{path:Nn,color:"red",onClick:()=>c(h)})]})]},d.currency))})]}),e.jsxs(We,{className:"mt-2",children:[e.jsx(D,{className:vs.percent,label:t("ACCOUNT.ONLINE_CATALOG.PRICES.MARGIN"),children:e.jsx("input",{name:"margin",type:"number",value:n.margin??"",onChange:a})}),e.jsx(D,{className:vs.percent,label:t("ACCOUNT.ONLINE_CATALOG.PRICES.VAT"),children:e.jsx("input",{name:"vat",type:"number",value:n.vat??"",onChange:a})}),e.jsx(D,{label:t("ACCOUNT.ONLINE_CATALOG.PRICES.SHOW_PRICE"),children:e.jsx("select",{name:"showPrice",value:n.showPrice,onChange:a,children:r==null?void 0:r.map(d=>e.jsx("option",{value:d.value,children:t(`ACCOUNT.ONLINE_CATALOG.PRICES.SHOW_PRICE.${d.value}`)},d.id))})}),e.jsx(D,{label:t("ACCOUNT.ONLINE_CATALOG.PRICES.ROUNDING"),children:e.jsxs("select",{name:"isRoundingForVat",value:n.isRoundingForVat,onChange:({target:d})=>s(h=>({...h,isRoundingForVat:JSON.parse(d.value)})),children:[e.jsx("option",{value:!0,children:t("ACCOUNT.ONLINE_CATALOG.PRICES.ROUNDING_WITH_VAT")}),e.jsx("option",{value:!1,children:t("ACCOUNT.ONLINE_CATALOG.PRICES.ROUNDING_WITHOUT_VAT")})]})}),e.jsx(D,{label:t("ACCOUNT.ONLINE_CATALOG.PRICES.SHOW_LIMITS"),children:e.jsx("input",{name:"isLimitDisplayed",type:"checkbox",checked:n.isLimitDisplayed,onChange:a})})]})]}),e.jsx(R,{disabled:!o,className:"mt-2",type:"primary",onClick:i,children:t("ACCOUNT.ONLINE_CATALOG.SAVE")})]})}function Vo(){const{t}=k(),{data:n,handleChange:s,save:a,dirty:i}=$n({url:"/api/v4/online-catalog/social-media",defaultData:{facebookUrl:"",gPlusUrl:"",googleAnalyticsBasicCode:"",googleAnalyticsComplexCode:"",twitterUrl:"",instagramUrl:"",mapFrame:""}});return e.jsxs("div",{className:"p-2",children:[e.jsxs(We,{children:[e.jsx(D,{label:"Facebook URL",children:e.jsx("input",{name:"facebookUrl",value:n.facebookUrl??void 0,onChange:s})}),e.jsx(D,{label:"Twitter URL",children:e.jsx("input",{name:"twitterUrl",value:n.twitterUrl??void 0,onChange:s})}),e.jsx(D,{label:"Instagram URL",children:e.jsx("input",{name:"instagramUrl",value:n.instagramUrl??void 0,onChange:s})})]}),e.jsx(R,{disabled:!i,className:"mt-2",type:"primary",onClick:a,children:t("ACCOUNT.ONLINE_CATALOG.SAVE")})]})}function Yo({close:t,onSubmit:n,defaultData:s}){var d,h;const{t:a}=k(),{data:i,setData:o}=Wn({code:"",value:{},...s}),{data:r}=de("/api/v4/online-catalog/setting"),[l,c]=T.useState((d=r==null?void 0:r.supp
46ortedLanguages)==null?void 0:d[0]);function u(N){N.preventDefault(),n(i),t()}return e.jsx(J,{open:!0,children:e.jsxs("form",{onSubmit:u,children:[e.jsx(J.Header,{onClose:t,closable:!0,children:a("ACCOUNT.ONLINE_CATALOG.TEXTATION")}),e.jsx(J.Content,{children:e.jsx(be,{current:l,onChange:c,children:(h=r==null?void 0:r.supportedLanguages)==null?void 0:h.map(N=>{var m;return e.jsx(be.Tab,{label:N,children:e.jsx("div",{className:"p-2",children:e.jsx(br,{value:(m=i.value)==null?void 0:m[l],onChange:C=>o(A=>({...A,value:{...A.value,[l]:C}}))})})},N)})})}),e.jsxs(J.Footer,{gaps:!0,children:[e.jsx(R,{onClick:t,up:!0,children:a("ACCOUNT.ONLINE_CATALOG.CLOSE")}),e.jsx(R,{htmlType:"submit",type:"primary",up:!0,children:a("ACCOUNT.ONLINE_CATALOG.SAVE")})]})]})})}function Fo(){var l,c,u,d;const{t}=k(),{data:n,setData:s,save:a,dirty:i}=$n({url:"/api/v4/online-catalog/main-content",defaultData:[]});function o(h){fe(Yo,{defaultData:h,onSubmit:N=>{const m=[...Array.isArray(n)?n:[]],C=m.findIndex(A=>A.code===h.code);C===-1?m.push(N):m[C]=N,s(m)}},{style:{width:"calc(100vw - 2rem)"}})}function r(h){s(N=>N.filter((m,C)=>h!==C))}return e.jsxs("div",{className:"p-2",children:[e.jsxs("div",{className:"mb-2",children:[!((l=n==null?void 0:n.find)!=null&&l.call(n,h=>h.code==="homepage"))&&e.jsx(R,{className:"mr-2",type:"primary",onClick:()=>o({code:"homepage"}),children:t("ACCOUNT.ONLINE_CATALOG.TEXTATION.HOME_PAGE")}),!((c=n==null?void 0:n.find)!=null&&c.call(n,h=>h.code==="footer-about-us"))&&e.jsx(R,{className:"mr-2",type:"primary",onClick:()=>o({code:"footer-about-us"}),children:t("ACCOUNT.ONLINE_CATALOG.TEXTATION.FOOTER_ABOUT_US")}),!((u=n==null?void 0:n.find)!=null&&u.call(n,h=>h.code==="footer-contacts"))&&e.jsx(R,{className:"mr-2",type:"primary",onClick:()=>o({code:"footer-contacts"}),children:t("ACCOUNT.ONLINE_CATALOG.TEXTATION.FOOTER_CONTACTS")})]}),e.jsx("div",{className:"table__wrapper",children:e.jsxs("table",{className:"table-simple",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.ONLINE_CATALOG.TEXTATION")}),e.jsx("th",{className:"table-cell-action"})]})}),e.jsx("tbody",{children:(d=n==null?void 0:n.map)==null?void 0:d.call(n,(h,N)=>e.jsxs("tr",{children:[e.jsx("td",{children:h.code}),e.jsxs("td",{className:"table-cell-action",children:[e.jsx(ze,{path:qs,onClick:()=>o(h)}),e.jsx(ze,{path:Nn,color:"red",onClick:()=>r(N)})]})]},h.code))})]})}),e.jsx(R,{disabled:!i,className:"mt-2",type:"primary",onClick:a,children:t("ACCOUNT.ONLINE_CATALOG.SAVE")})]})}const ys=new Bn("Account");function bs(t){const[n,s]=T.useState();return T.useEffect(()=>{if(!t){s(void 0);return}const a=URL.createObjectURL(t);return s(a),()=>URL.revokeObjectURL(a)},[t]),n}function Wo(){const{t}=k(),{data:n,mutate:s}=de("/api/v4/online-catalog/design"),[a,i]=T.useState(()=>Date.now()),{data:o,handleChange:r,setData:l,dirty:c}=Wn({color:"",logoPath:void 0,faviconPath:void 0,logo:void 0,favicon:void 0});T.useEffect(()=>{n&&l(n)},[n,l]);const u=bs(o.logo),d=bs(o.favicon),h=u??(o.logoPath&&`/image/${o.logoPath}?v=${a}`),N=d??(o.faviconPath&&`/image/${o.faviconPath}?v=${a}`);async function m(){try{const C=new FormData;C.set("Color",o.color),o.logo&&C.set("Logo",o.logo),o.favicon&&C.set("Favicon",o.favicon),await w("/api/v4/online-catalog/design",{method:"PUT",body:C}),l({...o,logo:void 0,favicon:void 0}),i(Date.now()),await s()}catch(C){console.error(C)}}return e.jsxs("div",{className:"p-2",children:[e.jsx(D,{label:t("ACCOUNT.ONLINE_CATALOG.VISUALIZATION.COLOR"),children:e.jsx("input",{name:"color",type:"color",value:o.color||"",onChange:r})}),e.jsx("br",{}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("label",{children:t("ACCOUNT.ONLINE_CATALOG.VISUALIZATION.LOGO")}),e.jsx("input",{type:"file",name:"logo",onChange:r}),h&&e.jsx("img",{src:h,alt:"logo",className:ys.em("logo-preview")})]}),e.jsx("br",{}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("label",{children:t("ACCOUNT.ONLINE_CATALOG.VISUALIZATION.FAVICON")}),e.jsx("input",{type:"file",name:"favicon",onChange:r}),N&&e.jsx("img",{src:N,alt:"favicon",className:ys.em("favicon-preview")})]}),e.jsx(R,{disabled:!c,className:"mt-2",type:"primary",onClick:m,children:t("ACCOUNT.ONLINE_CATALOG.SAVE")})]})}function $o(){const{t}=k("settings"),{data:n,mutate:s}=de("/api/v4/online-catalog/is-exists"),[a,i]=T.useState();async function o(){try{await w("/api/v4/online-catalog",{method:"POST"}),s()}catch(r){r.message.includes("DUPLICATE_KEY")&&r.message.includes("URL:")?nn("error",t("MESSAGE.ERROR.ONLINE_CATALOG.URL_EXISTS"),{duration:0}):H(r)}}return e.jsxs(ve,{noShadow:!0,overflow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.ONLINE_CATALOG.TITLE")}),n!=null&&n.isExist?e.jsxs(be,{current:a,onChange:i,children:[e.jsx(be.Tab,{label:t("ACCOUNT.ONLINE_CATALOG.SETTING"),children:e.jsx(Oo,{refresh:s})},"settings"),e.jsx(be.Tab,{label:t("ACCOUNT.ONLINE_CATALOG.PRICES"),children:e.jsx(Bo,{})},"prices"),e.jsx(be.Tab,{label:t("ACCOUNT.ONLINE_CATALOG.VISUALIZATION"),children:e.jsx(Wo,{})},"visualization"),e.jsx(be.Tab,{label:t("ACCOUNT.ONLINE_CATALOG.ARTICLES"),children:e.jsx(Uo,{})},"articles"),e.jsx(be.Tab,{label:t("ACCOUNT.ONLINE_CATALOG.TEXTATION"),children:e.jsx(Fo,{})},"textation"),e.jsx(be.Tab,{label:t("ACCOUNT.ONLINE_CATALOG.BANNERS"),children:e.jsx(Mo,{})},"banner"),e.jsx(be.Tab,{label:t("ACCOUNT.ONLINE_CATALOG.SOCIAL_MEDIA"),children:e.jsx(Vo,{})},"social")]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{children:t("ACCOUNT.ONLINE_CATALOG.NO_CATALOG")}),e.jsx(R,{type:"primary",onClick:o,children:t("ACCOUNT.ONLINE_CATALOG.CREATE")})]})]})}function Go(){const{t}=k();return e.jsxs("div",{className:"p-2",children:[e.jsx("p",{children:t("ACCOUNT.EXPORTS.B2B.DESCRIPTION")}),e.jsx(Ge,{my:"lg"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("strong",{children:t("ACCOUNT.EXPORTS.B2B.DOCUMENTATION")}),e.jsx(Ut,{content:t("ACCOUNT.EXPORTS.B2B.DOCUMENTATION.TOOLTIP"),children:e.jsx("div",{className:"ml-1",children:e.jsx(le,{path:tt,size:"1rem"})})}),e.jsx("a",{href:"https://api.malfini.com",target:"_blank",rel:"noopener noreferrer",style:{marginLeft:"auto"},children:"https://api.malfini.com"})]}),e.jsxs("div",{className:"mt-2 flex items-center",children:[e.jsx("strong",{children:t("ACCOUNT.EXPORTS.B2B.FAQ")}),e.jsx(Ut,{content:t("ACCOUNT.EXPORTS.B2B.FAQ.TOOLTIP"),children:e.jsx("div",{className:"ml-1",children:e.jsx(le,{path:tt,size:"1rem"})})}),e.jsx(oe,{to:"/article/b2b-faq?c",style:{marginLeft:"auto"},children:e.jsx(R,{type:"primary",children:t("ACCOUNT.EXPORTS.B2B.FAQ.SHOW")})})]})]})}async function zo(t){const n=Js();try{const s={...t};s.priceRatioEnabled||delete s.priceRatio,delete s.priceRatioEnabled;const a=await In("/api/v4/feed/export-csv"+en(s));fn(a,"malfini_products.csv")}catch(s){H(s)}finally{n()}}function Ho(){const{t}=k(),{register:n,handleSubmit:s,watch:a}=mi({defaultValues:{type:"1",languageCode:it(),priceRatioEnabled:"",priceRatio:""}}),i=a("priceRatioEnabled"),{data:o}=de("/api/v4/encoding-type"),{data:r}=de("/api/v4/ui-translation/languages");return e.jsxs("div",{className:"p-2",children:[e.jsx("p",{children:t("ACCOUNT.EXPORTS.MANUAL.DESCRIPTION")}),e.jsx(Ge,{my:"lg"}),e.jsxs("form",{onSubmit:s(zo),children:[e.jsxs(We,{children:[e.jsx(D,{label:t("ACCOUNT.EXPORTS.MANUAL.LANGUAGE"),children:e.jsx("select",{required:!0,...n("languageCode"),children:r==null?void 0:r.map(l=>e.jsx("option",{children:l.code},l.code))})}),e.jsx(D,{label:t("ACCOUNT.EXPORTS.MANUAL.ENCODING"),children:e.jsx("select",{required:!0,...n("type"),children:o==null?void 0:o.map(l
46=>e.jsx("option",{value:l.id,children:l.value},l.id))})}),e.jsx(D,{label:t("ACCOUNT.EXPORTS.MANUAL.PRICE_MODIFIER_ENABLED"),children:e.jsx("input",{type:"checkbox",...n("priceRatioEnabled")})}),e.jsx(D,{label:t("ACCOUNT.EXPORTS.MANUAL.PRICE_MODIFIER"),disabled:!i,children:e.jsx("input",{type:"number",...n("priceRatio"),step:"0.001"})})]}),e.jsx(R,{className:"mt-2",type:"primary",htmlType:"submit",children:t("ACCOUNT.EXPORTS.MANUAL.DOWNLOAD")})]}),e.jsx(Ge,{my:"lg"}),e.jsx(R,{href:`/api/v4/product/ean?_country=${Zs()}&_language=${it()}`,children:t("ACCOUNT.EXPORTS.MANUAL.DOWNLOAD_EAN")})]})}function Xo({close:t,defaultValues:n,onResolve:s}){const{t:a}=k(),i=Mt.languages,{data:o}=me(()=>w("GET /api/v4/feed-rounding-type"),{onError:H}),r=T.useMemo(()=>o==null?void 0:o.map(u=>({label:a(`ACCOUNT.ONLINE_CATALOG.PRICES.ROUNDING.${u.value}`),value:String(u.id)})),[o]),l=_n({initialValues:{name:"",languageCode:Mt.language,hasCustomPrices:!1,additionalCharge:0,...n,feedRoundingType:String((n==null?void 0:n.feedRoundingType)??5)},transformValues:u=>({...u,feedRoundingType:Number(u.feedRoundingType)}),validate:{name:_e(),languageCode:_e(),additionalCharge:_e(),feedRoundingType:_e()}}),c=me(s,{manual:!0,onError:H,onSuccess:t});return e.jsx(vn,{opened:!0,onClose:t,size:"auto",children:e.jsx("form",{onSubmit:l.onSubmit(c.run),children:e.jsxs(Be,{children:[e.jsx(Se,{label:a("ACCOUNT.EXPORTS.XML_FEED.NAME"),withAsterisk:!0,...l.getInputProps("name")}),e.jsx(Zt,{data:[{label:a("ACCOUNT.EXPORTS.XML_FEED.RECOMMENDED_PRICE"),value:"false"},{label:a("ACCOUNT.EXPORTS.XML_FEED.CUSTOM_PRICE"),value:"true"}],value:l.values.hasCustomPrices?"true":"false",onChange:u=>l.setFieldValue("hasCustomPrices",JSON.parse(u))}),e.jsx(wn,{label:a("ACCOUNT.EXPORTS.XML_FEED.ADDITIONAL_CHARGE"),suffix:"%",allowNegative:!1,...l.getInputProps("additionalCharge")}),e.jsx(un,{data:r,label:a("ACCOUNT.EXPORTS.XML_FEED.ROUNDING_TYPE"),...l.getInputProps("feedRoundingType")}),e.jsx(un,{data:i,label:a("ACCOUNT.EXPORTS.XML_FEED.LANGUAGE"),...l.getInputProps("languageCode")}),e.jsx(je,{type:"submit",loading:c.loading,disabled:!l.isValid()||!l.isDirty(),children:a("ACCOUNT.EXPORTS.XML_FEED.SUBMIT")})]})})})}function Ko(){const{t}=k(),{data:n}=me(()=>w("GET /api/v4/feed-rounding-type"),{onError:H}),{data:s,loading:a,refresh:i}=me(()=>w("GET /api/v4/xml-feed"),{onError:H}),o=me(c=>w(`PATCH /api/v4/xml-feed/${c}/toggle-is-active`),{manual:!0,onError:H,onSuccess:i}),r=T.useMemo(()=>{const c=new Map;if(n)for(const u of n)c.set(u.id,t(`ACCOUNT.ONLINE_CATALOG.PRICES.ROUNDING.${u.value}`));return c},[n,t]);function l(c){fe(Xo,{defaultValues:c,onResolve:async u=>{await(c?w("PUT /api/v4/xml-feed/"+c.id,{body:u}):w("POST /api/v4/xml-feed",{body:u})),i()}})}return e.jsx(Be,{p:"md",children:e.jsx(Gs,{fetching:a||o.loading,records:s,mih:s!=null&&s.length&&s.length>0?80:150,rowClassName:c=>c.isActive?void 0:"line-through",pinLastColumn:!0,columns:[{accessor:"name",title:t("ACCOUNT.EXPORTS.XML_FEED.NAME")},{accessor:"hasCustomPrices",title:t("ACCOUNT.EXPORTS.XML_FEED.PRICES"),render:({hasCustomPrices:c})=>t(c?"ACCOUNT.EXPORTS.XML_FEED.CUSTOM_PRICE":"ACCOUNT.EXPORTS.XML_FEED.RECOMMENDED_PRICE")},{accessor:"additionalCharge",title:t("ACCOUNT.EXPORTS.XML_FEED.ADDITIONAL_CHARGE"),render:({additionalCharge:c})=>`${c}%`},{accessor:"languageCode",title:t("ACCOUNT.EXPORTS.XML_FEED.LANGUAGE")},{accessor:"feedRoundingType",title:t("ACCOUNT.EXPORTS.XML_FEED.ROUNDING_TYPE"),render:({feedRoundingType:c})=>r.get(c)},{accessor:"actions",title:e.jsx(Ne,{justify:"flex-end",gap:"xs",children:e.jsx(On,{variant:"filled",size:"sm",onClick:()=>l(),children:e.jsx(zs,{})})}),width:"0%",render:c=>{const u=`${globalThis.location.origin}/api/v4/xml-feed/customized/${c.externalId}?_country=${c.countryCode}&_language=${c.languageCode}&asFile=true`;return e.jsxs(Ne,{wrap:"nowrap",gap:"xs",children:[e.jsx(On,{size:"sm",onClick:()=>o.run(c.id),color:c.isActive?"red":void 0,children:c.isActive?e.jsx(er,{}):e.jsx(ha,{})}),e.jsx(On,{size:"sm",onClick:()=>l(c),children:e.jsx(Hs,{})}),e.jsx(sr,{value:u,children:({copied:d,copy:h})=>e.jsx(On,{size:"sm",onClick:h,c:d?"teal":void 0,title:u,children:d?e.jsx(ta,{}):e.jsx(oa,{})})})]})}}]})})}function Qo(){const{t}=k(),n=`?_country=${Zs()}&_language=${it()}`;return e.jsxs("div",{className:"p-2",children:[e.jsx("p",{children:t("ACCOUNT.EXPORTS.PRICE_LIST.STANDARD")}),e.jsxs("div",{style:{display:"flex",gap:"1rem"},children:[e.jsxs(R,{href:"/api/v4/price-list-pdf/standard"+n,children:[t("ACCOUNT.EXPORTS.PRICE_LIST.DOWNLOAD")," (PDF)"]}),e.jsxs(R,{href:"/api/v4/price-list-csv/standard"+n,children:[t("ACCOUNT.EXPORTS.PRICE_LIST.DOWNLOAD")," (CSV)"]})]}),e.jsx("br",{}),e.jsx("p",{children:t("ACCOUNT.EXPORTS.PRICE_LIST.ACTION")}),e.jsxs("div",{style:{display:"flex",gap:"1rem"},children:[e.jsxs(R,{href:"/api/v4/price-list-pdf/action"+n,children:[t("ACCOUNT.EXPORTS.PRICE_LIST.DOWNLOAD")," (PDF)"]}),e.jsxs(R,{href:"/api/v4/price-list-csv/action"+n,children:[t("ACCOUNT.EXPORTS.PRICE_LIST.DOWNLOAD")," (CSV)"]})]})]})}function qo(){const{t}=k("settings"),[n,s]=Ai("tab",ma(xi,"xml-feed"));return e.jsxs(ve,{noShadow:!0,overflow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.EXPORTS.TITLE")}),e.jsxs(be,{current:n,onChange:s,children:[e.jsx(be.Tab,{label:t("ACCOUNT.EXPORTS.XML_FEED"),children:e.jsx(Ko,{})},"xml-feed"),e.jsx(be.Tab,{label:t("ACCOUNT.EXPORTS.MANUAL"),children:e.jsx(Ho,{})},"manual-export"),e.jsx(be.Tab,{label:t("ACCOUNT.EXPORTS.PRICE_LIST"),children:e.jsx(Qo,{})},"price-list"),e.jsx(be.Tab,{label:t("ACCOUNT.EXPORTS.B2B"),children:e.jsx(Go,{})},"b2b")]})]})}function Zo(){const{t}=k(),{data:n}=de("/api/v4/invoice/payment-method"),{data:s}=de("/api/v4/invoice/payment-status"),{data:a}=de("/api/v4/invoice/type"),{params:i,loading:o,data:r,search:l,getSetter:c}=Fn({defaultParams:{fromDate:x.utc().startOf("date").add(-6,"month").toISOString(),toDate:x.utc().startOf("date").add(1,"day").toISOString(),variableSymbol:"",yourOrderNumber:"",orderNumber:"",paymentStatus:"",formsOfPayment:"",typeOfInvoice:"",productSizeCode:""},apiCall:d=>w("/api/v4/invoice"+en(d))}),u=T.useMemo(()=>Sr(r),[r]);return T.useEffect(()=>{l()},[]),e.jsxs(ve,{noShadow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.INVOICE.TITLE")}),e.jsxs("div",{className:"mt-4",children:[e.jsxs(We,{children:[e.jsx(D,{label:t("ACCOUNT.INVOICE.DATE_FROM"),children:e.jsx(Ke.Input,{value:x.utc(i.fromDate),onChange:d=>c("fromDate")(d==null?void 0:d.toISOString()),hideIcon:!0,"data-testid":"invoice-date-from-input"})}),e.jsx(D,{label:t("ACCOUNT.INVOICE.DATE_TO"),children:e.jsx(Ke.Input,{value:x.utc(i.toDate),onChange:d=>c("toDate")(d==null?void 0:d.toISOString()),hideIcon:!0,"data-testid":"invoice-date-to-input"})}),e.jsx(D,{label:t("ACCOUNT.INVOICE.SYMBOL_VAR"),children:e.jsx("input",{value:i.variableSymbol,onChange:d=>c("variableSymbol")(d.target.value),"data-testid":"invoice-variable-symbol-input"})}),e.jsx(D,{label:t("ACCOUNT.INVOICE.ORDER_NUMBER"),children:e.jsx("input",{value:i.orderNumber,onChange:d=>c("orderNumber")(d.target.value),"data-testid":"invoice-order-number-input"})}),e.jsx(D,{label:t("ACCOUNT.INVOICE.CUSTOMER_ORDER_NUMBER"),children:e.jsx("input",{value:i.yourOrderNumber,onChange:d=>c("yourOrderNumber")(d.target.value),"data-testid":"invoice-your-order-number-input"})}),e.jsx(D,{label:t("ACCOUNT.INVOICE.PAYMENT_FORM"),children:e.jsxs("select",{value:i.formsOfPayment,onChange:d=>c("formsOfPayment")(d.target.value),"data-testid":"invoice-payment-form-select",children:[e.jsx("option",{value:"",children:"--"}),n==null?void 0:n.map(({karatId:d,name:h})=>e.jsx("option",{value:d,children:h},d))]})}),e.jsx(D,{label:t("ACCOUNT.INVOICE.PAYMENT_STATE"),children:e.jsxs("select",{value:i.paymentStatus,onChange:d=>c("paymentStatus")(d.target.value),"data-testid":"invoice-payment-status-select",children:[e.jsx("option",{value:"",children:"--"}),s==null?void 0:s.map(({karatId:d,name:h})=>e.jsx("option",{value:d,children:h},d))]})}),e.jsx(D,{label:t("ACCOUNT.INVOICE.TYPE"),children:e.jsxs("select",{value:i.typeOfInvoice,onChange:d=>c("typeOfInvoice")(d.target.value),"data-testid":"invoice-type-select",children:[e.jsx("option",{value:"",children:"--"}),a==null?void 0:a.map(({karatId:d,name:h})=>e.jsx("option",{value:d,children:h},d))]})}),e.jsx(D,{label:t("ACCOUNT.INVOICE.PRODUCT_CODE"),children:e.jsx("input",{value:i.productSizeCode,onChange:d=>c("productSizeCode")(d.target.value),"data-testid":"invoice-product-code-input"})})]}),e.jsx("div",{className:"my-3 flex items-center justify-end",children:e.jsx(R,{type:"primary",onClick:l,loading:o,"data-testid":"invoice-search-button",children:t("ACCOUNT.INVOICE.SEARCH")})}),e.jsxs("table",{className:"table-pretty table--border",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.INVOICE.SYMBOL_VAR")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.INVOICE.ISSUED")}),e.jsx("th",{children:t("ACCOUNT.INVOICE.DUE_DATE")}),e.jsx("th",{children:t("ACCOUNT.INVOICE.BILLED_AMOUNT")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.INVOICE.TOTAL")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.INVOICE.DATE_OF_PAYMENT")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.INVOICE.COMPLAIN")})]})}),e.jsxs("tbody",{children:[r==null?void 0:r.map((d,h)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(oe,{to:`/account/invoice/${d.invoice}`,children:d.variableSymbol})}),e.jsx("td",{className:"hidden lg:table-cell",children:x.utc(d.invoiceDate).format("L")}),e.jsx("td",{children:x.utc(d.dueDate).format("L")}),e.jsx("td",{className:"text-center",children:z.formatMoney(d.foreignExchangeToPay,d.currencyCode)}),e.jsx("td",{className:"hidden text-center lg:table-cell",children:z.formatMoney(d.foreignExchange,d.currencyCode)}),e.jsx("td",{className:"hidden lg:table-cell",children:d.paidDate?x.utc(d.paidDate).format("L"):t("ACCOUNT.INVOICE.UNPAID")}),e.jsx("td",{className:"hidden text-center lg:table-cell",children:d.complaintAllowed?e.jsx(oe,{to:`/account/complain/${d.issueNoteId}`,children:e.jsx(Vt,{type:"primary",children:t("ACCOUNT.INVOICE.COMPLAIN_ALLOWED")})}):e.jsx(Vt,{type:"disabled",children:t("ACCOUNT.INVOICE.COMPLAIN_ALLOWED")})})]},h)),u.map((d,h)=>e.jsxs("tr",{className:"table-merging-row",children:[e.jsx("td",{}),e.jsx("td",{className:"hidden lg:table-cell"}),e.jsx("td",{}),e.jsx("td",{className:"text-center",children:e.jsx("strong",{children:z.formatMoney(d.foreignExchangeToPay,d.currencyCode)})}),e.jsx("td",{className:"hidden text-center lg:table-cell",children:e.jsx("strong",{children:z.formatMoney(d.foreignExchange,d.currencyCode)})}),e.jsx("td",{className:"hidden lg:table-cell"}),e.jsx("td",{className:"hidden lg:table-cell"})]},h))]})]})]})]})}function Jo(t){const n={};if(t)for(const{currencyCode:s,beforeMaturity:a,overdue:i}of t)s&&!n[s]&&(n[s]={beforeMaturity:0,overdue:0,currencyCode:s}),s&&n[s]&&(n[s].overdue+=i,n[s].beforeMaturity+=a);return Object.values(n)}async function ec(t){const n=Js();try{const s=await In(`/api/v4/receivable/${t.id}/pdf/${t.documentType}`);fn(s,`${t.id}.pdf`)}catch(s){H(s)}finally{n()}}function nc(){const{t}=k(),{data:n}=de("/api/v4/receivable"),s=T.useMemo(()=>n&&Jo(n),[n]);return e.jsxs(ve,{noShadow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.RECEIVABLES.TITLE")}),e.jsx("div",{className:"mt-4",children:e.jsxs("table",{className:"table-pretty table--border",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.RECEIVABLES.TYPE")}),e.jsx("th",{children:t("ACCOUNT.RECEIVABLES.VARIABLE_SYMBOL")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.RECEIVABLES.DATE_ISSUED")}),e.jsx("th",{children:t("ACCOUNT.RECEIVABLES.DATE_DUE")}),e.jsx("th",{className:"hidden text-center lg:table-cell",children:t("ACCOUNT.RECEIVABLES.BEFORE_AFTER_DUE_DATE")}),e.jsx("th",{className:"hidden text-right lg:table-cell",children:t("ACCOUNT.RECEIVABLES.BEFORE_DUE_DATE")}),e.jsx("th",{className:"text-right",children:t("ACCOUNT.RECEIVABLES.AFTER_DUE_DATE")}),e.jsx("th",{className:"hidden text-center lg:table-cell",style:{width:"1px"},children:t("ACCOUNT.RECEIVABLES.PRINT")})]})}),e.jsxs("tbody",{children:[n==null?void 0:n.map((a,i)=>{const o=x.utc(a.dueDate).startOf("date").diff(x.utc().startOf("date"),"day");return e.jsxs("tr",{style:{backgroundColor:o<0?"lightcoral":"lightyellow"},children:[e.jsx("td",{className:"hidden lg:table-cell",children:a.type}),e.jsx("td",{children:a.hasInvoice?e.jsx(oe,{to:`/account/invoice/${a.id}`,children:a.variableSymbol}):a.variableSymbol}),e.jsx("td",{className:"hidden lg:table-cell",children:x.utc(a.invoiceDate).format("L")}),e.jsx("td",{children:x.utc(a.dueDate).format("L")}),e.jsx("td",{className:"hidden text-center lg:table-cell",children:o}),e.jsx("td",{className:"hidden text-right lg:table-cell",children:z.formatMoney(a.beforeMaturity,a.currencyCode)}),e.jsx("td",{className:"text-right",children:z.formatMoney(a.overdue,a.currencyCode)}),e.jsx("td",{className:"hidden text-center lg:table-cell",style:{width:"1px",paddingRight:"0.5rem"},children:e.jsx(ze,{onClick:()=>ec(a),path:Kn})})]},i)}),s==null?void 0:s.map((a,i)=>e.jsxs("tr",{className:"table-merging-row",children:[e.jsx("td",{className:"hidden lg:table-cell"}),e.jsx("td",{}),e.jsx("td",{className:"hidden lg:table-cell"}),e.jsx("td",{}),e.jsx("td",{className:"hidden lg:table-cell"}),e.jsx("td",{className:"hidden text-right lg:table-cell",children:e.jsx("strong",{children:z.formatMoney(a.beforeMaturity,a.currencyCode)})}),e.jsx("td",{className:"text-right",children:e.jsx("strong",{children:z.formatMoney(a.overdue,a.currencyCode)})}),e.jsx("td",{className:"hidden lg:table-cell"})]},i))]})]})})]})}function tc(){const{t}=k(),{data:n}=de("/api/v4/invoice"+en({isTransportInvoice:!0})),s=T.useMemo(()=>Sr(n),[n]);return e.jsxs(ve,{noShadow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.INVOICE.ATS.TITLE")}),e.jsx("div",{className:"mt-4",children:e.jsxs("table",{className:"table-pretty table--border",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.INVOICE.INVOICE_NUMBER")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.INVOICE.ORDER_NUMBER")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.INVOICE.ISSUED")}),e.jsx("th",{children:t("ACCOUNT.INVOICE.DUE_DATE")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.INVOICE.BILLED_AMOUNT")}),e.jsx("th",{children:t("ACCOUNT.INVOICE.TOTAL")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.INVOICE.DATE_OF_PAYMENT")})]})}),e.jsxs("tbody",{children:[n==null?void 0:n.map(a=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(oe,{to:`/account/invoice/${a.invoice}`,children:a.invoice})}),e.jsx("td",{className:"hidden lg:table-cell",children:e.jsx(oe,{to:`/account/order/${a.order}`,children:a.order})}),e.jsx("td",{className:"hidden lg:table-cell",children:x.utc(a.invoiceDate).format("L")}),e.jsx("td",{children:x.utc(a.dueDate).format("L")}),e.jsx("td",{className:"hidden lg:table-cell",children:z.formatMoney(a.foreignExchange,a.currencyCode)}),e.jsx("td",{children:z.formatMoney(a.foreignExchangeToPay,a.currencyCode)}),e.jsx("td",{className:"hidden lg:table-cell",children:a.paidDate?x.utc(a.paidDate).format("L"):t("ACCOUNT.INVOICE.UNPAID")})]},a.invoice)),s==null?void 0:s.map((a,i)=>e.jsxs("tr",{className:"table-merging-row",children:[e.jsx("td",{}),e.jsx("td",{className:"hidden lg:table-cell"}),e.jsx("td",{className:"hidden lg:table-cell"}),e.jsx("td",{}),e.jsx("td",{className:"hidden lg:table-cell",children:e.jsx("strong",{children:z.formatMoney(a.foreignExchangeToPay,a.currencyCode)})}),e.jsx("td",{children:e.jsx("strong",{children:z.formatMoney(a.foreignExchange,a.currencyCode)})}),e.jsx("td",{className:"hidden lg:table-cell"})]},i))]})]})})]})}function Sr(t){const n={};if(t)for(const{currencyCode:s,foreignExchange:a,foreignExchangeToPay:i}of t)s&&!n[s]&&(n[s]={foreignExchangeToPay:0,foreignExchange:0,currencyCode:s}),s&&n[s]&&(n[s].foreignExchange+=a,n[s].foreignExchangeToPay+=i);return Object.values(n)}function sc(){const{t}=k(),[n,s]=T.useState("invoices");return e.jsxs(be,{current:n,onChange:s,fullWidth:!0,padding:0,children:[e.jsx(be.Tab,{label:t("ACCOUNT.INVOICE.TAB_INVOICES"),children:e.jsx(Zo,{})},"invoices"),e.jsx(be.Tab,{label:t
46("ACCOUNT.INVOICE.TAB_RECEIVABLES"),children:e.jsx(nc,{})},"receivables"),e.jsx(be.Tab,{label:t("ACCOUNT.INVOICE.TAB_ATS"),children:e.jsx(tc,{})},"ats")]})}const rc=Ti();function Ss({code:t}){const{data:n,error:s}=de(`/api/v4/article/code/${t}`);return e.jsx(e.Fragment,{children:s?e.jsx(Xs,{}):e.jsx("div",{children:pi((n==null?void 0:n.text)??"",{replace:rc})})})}function ic(){const{t}=k(),{params:n,loading:s,data:a,search:i,getSetter:o}=Fn({defaultParams:{fromDate:x.utc().startOf("date").add(-6,"month").toISOString(),toDate:x.utc().startOf("date").add(1,"day").toISOString(),number:"",invoice:"",order:""},apiCall:l=>w("/api/v4/parcel"+en(l))});T.useEffect(()=>{i()},[]);const r=T.useMemo(()=>[...a].sort((l,c)=>x.utc(c.date).diff(x.utc(l.date))),[a]);return e.jsxs(ve,{noShadow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.PARCEL.TITLE")}),e.jsxs("div",{className:"mt-4",children:[e.jsxs(We,{children:[e.jsx(D,{label:t("ACCOUNT.PARCEL.DATE_FROM"),children:e.jsx(Ke.Input,{value:x.utc(n.fromDate),onChange:l=>o("fromDate")(l==null?void 0:l.toISOString()),hideIcon:!0})}),e.jsx(D,{label:t("ACCOUNT.PARCEL.DATE_TO"),children:e.jsx(Ke.Input,{value:x.utc(n.toDate),onChange:l=>o("toDate")(l==null?void 0:l.toISOString()),hideIcon:!0})}),e.jsx(D,{label:t("ACCOUNT.PARCEL.PARCEL_NUMBER"),children:e.jsx("input",{value:n.number,onChange:l=>o("number")(l.target.value)})}),e.jsx(D,{label:t("ACCOUNT.PARCEL.INVOICE"),children:e.jsx("input",{value:n.invoice,onChange:l=>o("invoice")(l.target.value)})}),e.jsx(D,{label:t("ACCOUNT.PARCEL.ORDER"),children:e.jsx("input",{value:n.order,onChange:l=>o("order")(l.target.value)})})]}),e.jsx("div",{className:"my-3 flex items-center justify-end",children:e.jsx(R,{type:"primary",onClick:i,loading:s,children:t("ACCOUNT.PARCEL.SEARCH")})}),e.jsxs("table",{className:"table-pretty",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.PARCEL.PARCEL_NUMBER")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.PARCEL.TYPE")}),e.jsx("th",{children:t("ACCOUNT.PARCEL.COD")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.PARCEL.INVOICE")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.PARCEL.ORDER")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.PARCEL.DATE")})]})}),e.jsx("tbody",{children:r.map((l,c)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("a",{href:l.trackingUrl??void 0,target:"_blank",rel:"noopener noreferrer",children:l.number})}),e.jsx("td",{className:"hidden lg:table-cell",children:l.type}),e.jsx("td",{children:z.formatMoney(l.cashOnDelivery,l.currencyCode)}),e.jsx("td",{className:"hidden lg:table-cell",children:e.jsx(oe,{to:`/account/invoice/${l.invoice}`,disabled:!0,children:l.invoice})}),e.jsx("td",{className:"hidden lg:table-cell",children:e.jsx(oe,{to:`/account/order/${l.order}`,disabled:!0,children:l.order})}),e.jsx("td",{className:"hidden lg:table-cell",children:x.utc(l.date).format("L")})]},c))})]})]})]})}function Lr(t,n,s){if(n!==void 0)if(n&&typeof n=="object"&&!(n instanceof Date)&&!(n instanceof File))for(const a of Object.keys(n))Lr(t,n[a],s?`${s}[${a}]`:a);else{const a=n??"";t.append(s,a)}}function ac(t){const n=new FormData;return Lr(n,t),n}const te={WrongQuantity:0,Defect:2,Return:3,WrongPrice:4,WrongPrint:6},_t={CreditNote:20},Rt={PRODUCT:[te.WrongQuantity,te.Defect,te.Return,te.WrongPrice],POTISK:[te.WrongQuantity,te.WrongPrice,te.WrongPrint],VYSIVKA:[te.WrongQuantity,te.WrongPrice,te.WrongPrint],OST_POT_VYS:[te.WrongQuantity,te.WrongPrice,te.WrongPrint],DOPRAVNE:[te.WrongPrice],SLEVY:[te.WrongPrice]};function lc({nomenclatureGroupCode:t,productSizeCode:n}){if(Rt[t])return Rt[t];if(n.startsWith(t))return Rt.PRODUCT}function Ls({close:t,reasons:n,item:s,issueNote:a,onSubmit:i,original:o}){var m,C;const{t:r}=k(),l=T.useMemo(()=>{if(o!=null&&o._reason)return o._reason;const A=n.find(p=>p.isValid);return A||{karatId:0}},[o,n]),[c,u]=T.useState(l),d=_n({initialValues:{isReturn:!0,amount:s.shippedAmount,defect:null,defectId:null,unitExpectedPrice:s.unitNetPrice,_reason:c,itemTypeId:c.karatId},validateInputOnChange:!0,validateInputOnBlur:!0,validate:{defect:(A,p)=>p.itemTypeId===te.Defect&&!A?r("ACCOUNT.COMPLAINT_NEW.ERROR.DEFECT_REQUIRED"):null,amount:_e(r("ACCOUNT.COMPLAINT_NEW.ERROR.AMOUNT_REQUIRED")),unitExpectedPrice:(A,p)=>
46{if(p.itemTypeId===te.WrongPrice&&!A)return r("ACCOUNT.COMPLAINT_NEW.ERROR.EXPECTED_PRICE_REQUIRED")}}});T.useEffect(()=>{d.setFieldValue("itemTypeId",c.karatId),d.setFieldValue("_reason",c);const A=d.values.defect,p=(c.items??[]).find(f=>f.name===A);d.setFieldValue("defectId",(p==null?void 0:p.karatId)??null)},[c,d.values.defect]);const h=A=>{const p={...A,productName:s.name??null,nomeclatureCode:("productSizeCode"in s&&s.productSizeCode)??null,displayOrder:s.displayOrder??null,currencyCode:a.currencyCode??null};i(p),t()},N=n.filter(A=>{var p;return(p=lc(s))==null?void 0:p.includes(A.karatId)});return e.jsx(J,{open:!0,children:e.jsxs("form",{onSubmit:d.onSubmit(h),autoComplete:"off",children:[e.jsx(J.Header,{children:e.jsxs(Be,{gap:2,children:[e.jsx(Vn,{order:4,children:`${r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG")} - ${"productSizeCode"in s&&s.productSizeCode}`}),e.jsx(Z,{c:"gray.7",size:"xs",children:`${r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG.QTY")}: ${s.shippedAmount}`})]})}),e.jsxs(J.Content,{className:"lg:w-[700px] lg:max-w-[700px]",children:[e.jsx(Dn.Group,{value:(m=c.karatId)==null?void 0:m.toString(),onChange:A=>{const p=n.find(f=>f.karatId.toString()===A);p&&u(p),d.reset()},children:e.jsx("div",{className:"flex flex-col gap-1",children:N.map(A=>e.jsx(Dn.Card,{p:"xs",className:`border border-solid border-[var(--mantine-color-gray-1)] ${A.isValid?"hover:bg-[var(--mantine-color-gray-2)] [&[data-checked]]:border-[var(--mantine-color-gray-4)] [&[data-checked]]:bg-[var(--mantine-color-gray-light)]":"cursor-not-allowed bg-gray-100 opacity-70 hover:bg-gray-100"}
46 `,withBorder:!1,disabled:!A.isValid,value:A.karatId.toString(),children:e.jsxs(Ne,{wrap:"nowrap",p:"xs",children:[e.jsx(Dn.Indicator,{className:`${A.isValid?"":"cursor-not-allowed opacity-70"}`}),e.jsxs(nt,{w:"100%",justify:"space-between",direction:{base:"column",xs:"row"},children:[e.jsx(Z,{size:"sm",className:"self-center",children:A.type}),e.jsx(qt,{color:A.isValid?"gray.9":"gray",variant:"filled",size:"lg",radius:"xs",fw:600,w:{base:"100%",xs:"10rem"},children:x.utc(A.date).format("L")})]})]})},A.karatId))})}),(c==null?void 0:c.karatId)!==void 0&&e.jsx(Ge,{my:"md"}),e.jsx(Be,{children:e.jsxs(Bs,{className:"items-center",cols:{base:1,md:c.karatId===te.WrongQuantity||c.karatId===te.Return||c.karatId===te.WrongPrice?1:2},verticalSpacing:"sm",children:[(c.karatId===te.WrongQuantity||c.karatId===te.Return)&&e.jsx(wn,{w:"100%",min:c.karatId===te.WrongQuantity?0:1,mih:"81px",allowNegative:!1,withAsterisk:!0,label:c.karatId===te.WrongQuantity?r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG.QTY_DELIVERED"):r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG.QTY_RETURN")+` (max. ${s.shippedAmount})`,max:c.karatId===te.Return?s.shippedAmount:void 0,...d.getInputProps("amount")}),(c.karatId===te.Defect||c.karatId===te.WrongPrint)&&e.jsxs(e.Fragment,{children:[e.jsx(wn,{label:r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG.QTY_COMPLAINT")+` (max. ${s.shippedAmount})`,max:s.shippedAmount,min:1,mih:"81px",allowNegative:!1,withAsterisk:!0,...d.getInputProps("amount")}),e.jsx(un,{label:r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG.DEFECT"),mih:"81px",data:[...((C=c.items)==null?void 0:C.map(A=>({label:A.name,value:A.name})))??[]],clearable:!0,searchable:!0,withAsterisk:!0,...d.getInputProps("defect")})]}),c.karatId===te.WrongPrice&&e.jsxs(e.Fragment,{children:[e.jsxs(Ne,{justify:"space-between",children:[e.jsx(Z,{size:"sm",children:r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG.UNIT_PRICE")}),e.jsx(Z,{size:"sm",fw:600,children:z.formatMoney(s.unitNetPrice,a.currencyCode)})]}),e.jsxs(Ne,{justify:"space-between",children:[e.jsx(Z,{size:"sm",children:r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG.TOTAL_PRICE")}),e.jsx(Z,{size:"sm",fw:600,children:z.formatMoney(s.netPrice,a.currencyCode)})]}),e.jsx(Ge,{}),e.jsx(wn,{label:r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG.PRICE_ESTIMATED"),allowNegative:!1,mih:"81px",min:1,hideControls:!0,decimalSeparator:",",withAsterisk:!0,suffix:` ${a.currencyCode}`,...d.getInputProps("unitExpectedPrice")})]})]})})]}),e.jsx(J.Footer,{gaps:!0,children:e.jsxs(nt,{gap:"xs",w:"100%",justify:"space-between",direction:{base:"column",xs:"row"},children:[e.jsx(En,{label:r("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.DIALOG.RETURN"),...d.getInputProps("isReturn",{type:"checkbox"})}),e.jsxs(nt,{gap:"xs",direction:{base:"column-reverse",xs:"row"},children:[e.jsx(je,{w:{base:"100%",xs:"6rem"},variant:"default",onClick:t,children:r("DIALOG.CLOSE")}),e.jsx(je,{w:{base:"100%",xs:"6rem"},color:"gray.9",variant:"filled",type:"submit",children:r("DIALOG.CONFIRM")})]})]})})]})})}function Ds({close:t,onSubmit:n,issueNote:s,reasons:a,original:i}){const{t:o}=k(),[r,l]=T.useState(i?{...i}:{productName:"",nomeclatureCode:"",isReturn:!0,amount:""});function c(u){u.preventDefault();const d=a.find(N=>N.karatId===te.WrongQuantity),h={...r,amount:Number(r.amount),displayOrder:null,currencyCode:s.currencyCode,unitExpectedPrice:0,defect:null,itemTypeId:d==null?void 0:d.karatId,reason:d};n(h),t()}return e.jsx(J,{open:!0,children:e.jsxs("form",{onSubmit:c,autoComplete:"off",children:[e.jsx(J.Header,{children:o("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS.DIALOG")}),e.jsxs(J.Content,{children:[e.jsx(yn,{className:"mb-2"}),e.jsx(D,{label:o("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS.CODE"),children:e.jsx("input",{type:"text",required:!0,value:r.nomeclatureCode??void 0,onChange:u=>l({...r,nomeclatureCode:u.target.value})})}),e.jsx(D,{label:o("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS.NAME"),className:"mt-2",children:e.jsx("input",{type:"text",required:!0,value:r.productName??void 0,onChange:u=>l({...r,productName:u.target.value})})}),e.jsx(D,{label:o("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS.QTY"),className:"mt-2",children:e.jsx("input",{min:0,type:"number",required:!0,value:r.amount,onChange:u=>l({...r,amount:Number(u.target.value)})})}),e.jsx(D,{label:o("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS.RETURN"),className:"mt-2",children:e.jsx("input",{type:"checkbox",checked:r.isReturn,onChange:u=>l({...r,isReturn:u.target.checked})})})]}),e.jsxs(J.Footer,{gaps:!0,children:[e.jsx(R,{type:"flat",onClick:t,children:o("DIALOG.CLOSE")}),e.jsx(R,{type:"primary",htmlType:"submit",children:o("DIALOG.CONFIRM")})]})]})})}function oc(){var De,pe,ce,X,ue,Ye,G,ke,Ae,ye,An,sn,rn,an,ln,on;const{invoice:t}=Rn(),{state:n}=qn(),{t:s}=k(),a=Yn(),[,i]=T.useState(!0),[o,r]=T.useState(!1),{data:l}=de(`/api/v4/complaint/options/${t}`),{data:c,mutate:u}=de("/api/v4/company-detail"),[d,h]=T.useState(),[N,m]=T.useState(),[C,A]=T.useState(),[p,f]=T.useState(""),[j,g]=T.useState([]),[v,S]=T.useState([]),[y,L]=T.useState([]),[O,_]=T.useState(null),M=(n==null?void 0:n.fromExpedition)??!1,B=he.isInRole(ae.ADMIN),P=(De=l==null?void 0:l.complaintReasons)==null?void 0:De.find(({karatId:E})=>E===te.WrongPrice);function F(E){return E!=null&&E.karatId?E.karatId===(_t==null?void 0:_t.CreditNote):!1}function q(){fe(gr,{onSubmit:async E=>{const re=await w("POST /api/v4/bank-account",{body:E});await u(),_(re.id)}})}const W=new Map;for(const E of v)E.displayOrder&&W.set(E.displayOrder,E);
46function ee(){fe(Ds,{issueNote:l==null?void 0:l.issueNote,reasons:l==null?void 0:l.complaintReasons,onSubmit:E=>{L([...y,E])}})}function $(E,re){fe(Ds,{original:re,issueNote:l==null?void 0:l.issueNote,reasons:l==null?void 0:l.complaintReasons,onSubmit:ie=>{const Ce=[...y];Ce[E]=ie,L(Ce)}})}function K(E){const re=[...y];re.splice(E,1),L(re)}function b(E,re){fe(E,{item:re,original:v.find(ie=>ie.displayOrder===re.displayOrder),issueNote:l==null?void 0:l.issueNote,reasons:l==null?void 0:l.complaintReasons,onSubmit:ie=>{const Ce=[...v],Te=v.findIndex(Pe=>Pe.displayOrder===ie.displayOrder);Te===-1?Ce.push(ie):Ce[Te]=ie,S(Ce)}},{style:{width:"820px"}})}function Q(E){const re=[...v],ie=v.findIndex(Ce=>Ce.displayOrder===E);re.splice(ie,1),S(re)}function U(){var ie,Ce,Te;const E=(ie=l==null?void 0:l.complaintReasons)==null?void 0:ie.find(Pe=>Pe.karatId===te.Return),re=(Te=(Ce=l==null?void 0:l.issueNote)==null?void 0:Ce.products)==null?void 0:Te.map(Pe=>{var cn;return{productName:Pe.name,nomeclatureCode:Pe.productSizeCode,displayOrder:Pe.displayOrder,itemTypeId:E==null?void 0:E.karatId,_reason:E,isReturn:!0,amount:Pe.shippedAmount,defectId:null,unitExpectedPrice:Pe.unitNetPrice,currencyCode:(cn=l.issueNote)==null?void 0:cn.currencyCode}});S(re??[])}async function V(E){var re,ie,Ce;if(E.preventDefault(),F(d)&&!O){H(new Error(s("ACCOUNT.COMPLAINT_NEW.ERROR.BANK_ACCOUNT_REQUIRED")??""));return}r(!0);try{const Te={contractId:(re=l==null?void 0:l.issueNote)==null?void 0:re.orderId,preferredSolution:d==null?void 0:d.karatId,goodsReturnType:N==null?void 0:N.karatId,description:p,issueNoteId:(ie=l==null?void 0:l.issueNote)==null?void 0:ie.id,invoiceId:(Ce=l==null?void 0:l.issueNote)==null?void 0:Ce.invoiceId,userId:C==null?void 0:C.id,isPrinter:M,bankAccountId:F(d)?O:null,items:[...v.map(xn=>({...xn,_reason:void 0})),...y.map(xn=>({...xn,_reason:void 0}))],attachments:j},Pe=ac(Te),{complaintId:cn}=await w("/api/v4/complaint",{method:"POST",body:Pe});i(!1),a(`${hn()}/account/complaint/${cn}`,{state:{isNewComplaint:!0}})}catch(Te){r(!1),H(Te)}}const se=x.utc((pe=l==null?void 0:l.issueNote)==null?void 0:pe.returnDeadlineDate).format("L"),xe=x.utc((ce=l==null?void 0:l.issueNote)==null?void 0:ce.claimDefectDeadlineDate).format("L"),Ie=x.utc((X=l==null?void 0:l.issueNote)==null?void 0:X.claimHiddenDefectDeadlineDate).format("L");return e.jsxs(ve,{noShadow:!0,children:[e.jsxs("h2",{children:[s("ACCOUNT.COMPLAINT_NEW.HEADER")," ",t]}),e.jsx(ne,{header:s("ACCOUNT.COMPLAINT_NEW.BASIC_INFO"),children:e.jsxs("div",{className:"flex",children:[e.jsxs("div",{className:"flex-grow",children:[e.jsx("p",{children:e.jsx("strong",{children:s("ACCOUNT.COMPLAINT_NEW.INVOICE")})}),e.jsx(oe,{to:`/account/invoice/${(ue=l==null?void 0:l.issueNote)==null?void 0:ue.invoiceId}`,children:(Ye=l==null?void 0:l.issueNote)==null?void 0:Ye.invoiceId})]}),e.jsxs("div",{className:"flex-grow",children:[e.jsx("p",{children:e.jsx("strong",{children:s("ACCOUNT.COMPLAINT_NEW.EXPEDITION")})}),e.jsx("span",{children:(G=l==null?void 0:l.issueNote)==null?void 0:G.id})]}),e.jsxs("div",{className:"flex-grow",children:[e.jsx("p",{children:e.jsx("strong",{children:s("ACCOUNT.COMPLAINT_NEW.DATE")})}),e.jsx("span",{children:x.utc((ke=l==null?void 0:l.issueNote)==null?void 0:ke.deliveryDate).format("L")})]})]})}),e.jsx(Tn,{type:"warning",className:"mt-2",children:e.jsxs("div",{children:[!!se&&e.jsxs(e.Fragment,{children:[s("ACCOUNT.COMPLAINT_NEW.CONDITIONS"),":",e.jsx(kn,{i18nKey:"ACCOUNT.COMPLAINT_NEW.CONDITIONS.LIST",components:{li:e.jsx("li",{})},values:{returnDate:se,claimDefectDeadlineDate:xe,claimHiddenDefectDeadlineDate:Ie}}),e.jsx("br",{})]}),s("ACCOUNT.COMPLAINT_NEW.OBLIGATIONS"),":",e.jsx(kn,{i18nKey:"ACCOUNT.COMPLAINT_NEW.OBLIGATIONS.LIST",components:{li:e.jsx("li",{})}}),e.jsx("br",{}),e.jsx(kn,{i18nKey:"ACCOUNT.COMPLAINT_NEW.WARRANTY_CLAIM_GUIDELINES_LINK",components:{a:e.jsx("a",{href:`${hn()}/article/obchodni-podminky`,target:"_blank",rel:"noreferrer",children:s("ACCOUNT.COMPLAINT_NEW.WARRANTY_CLAIM_GUIDELINES_LINK")})}})]})}),e.jsx(ge,{when:(Ae=l==null?void 0:l.issueNote)!=null&&Ae.returnDeadlineDate?new Date(l.issueNote.returnDeadlineDate)>new Date:!1,children:e.jsx(Tn,{type:"success",className:"mt-2",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("p",{dangerouslySetInnerHTML:{__html:s("ACCOUNT.COMPLAINT_NEW.RETURN_ALLOWED",{date:`<strong>${x.utc((ye=l==null?void 0:l.issueNote)==null?void 0:ye.returnDeadlineDate).format("L")}</strong>`})??""}}),e.jsxs(R,{type:"primary",size:"small",onClick:U,children:[e.jsx(le,{path:Ei}),e.jsx("span",{children:s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.RETURN_ALL")})]})]})})}),e.jsx(ne,{className:"mt-2",header:s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS"),noBodyPadding:!0,children:e.jsxs("table",{className:"table--no-outside-border table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.CODE")}),e.jsx("th",{children:s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.NAME")}),e.jsx("th",{className:"text-center",children:s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.QTY")}),e.jsx("th",{className:"text-right",children:s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.PRICE")}),e.jsx("th",{className:"text-right",children:s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.TOTAL_PRICE")}),e.jsx("th",{className:"table-cell-action"})]})}
46),e.jsxs("tbody",{children:[(sn=(An=l==null?void 0:l.issueNote)==null?void 0:An.products)==null?void 0:sn.map((E,re)=>{var Ce,Te;const ie=W.get(E.displayOrder);return e.jsxs(Bt.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{children:E.productSizeCode}),e.jsx("td",{children:E.name}),e.jsx("td",{className:"text-center",children:E.shippedAmount}),e.jsx("td",{className:"text-right",children:z.formatMoney(E.unitNetPrice,(Ce=l==null?void 0:l.issueNote)==null?void 0:Ce.currencyCode)}),e.jsx("td",{className:"text-right",children:z.formatMoney(E.netPrice,(Te=l==null?void 0:l.issueNote)==null?void 0:Te.currencyCode)}),e.jsx("td",{className:"table-cell-action",children:e.jsx(R,{disabled:!!ie,type:"primary",size:"small",onClick:()=>b(Ls,E),children:e.jsx(le,{path:tn})})})]}),!!ie&&e.jsx(Ue,{complaint:ie,item:E})]},re)}),(an=(rn=l==null?void 0:l.issueNote)==null?void 0:rn.additionalItems)==null?void 0:an.map((E,re)=>{var Ce,Te;const ie=W.get(E.displayOrder);return e.jsxs(Bt.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx("td",{children:E.name}),e.jsx("td",{className:"text-center",children:E.shippedAmount}),e.jsx("td",{className:"text-right",children:z.formatMoney(E.unitNetPrice,(Ce=l==null?void 0:l.issueNote)==null?void 0:Ce.currencyCode)}),e.jsx("td",{className:"text-right",children:z.formatMoney(E.netPrice,(Te=l==null?void 0:l.issueNote)==null?void 0:Te.currencyCode)}),e.jsx("td",{className:"table-cell-action",children:e.jsx("div",{tooltip:x.utc(P==null?void 0:P.date).format("L"),"tooltip-placement":"left",children:e.jsx(R,{disabled:!!ie,type:"primary",size:"small",onClick:()=>b(Ls,E),children:e.jsx(le,{path:tn})})})})]}),!!ie&&e.jsx(Ue,{complaint:ie,item:E})]},re)})]})]})}),e.jsx(ne,{className:"mt-2",header:s("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS"),noBodyPadding:!0,children:e.jsxs("table",{className:"table--no-outside-border table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS.CODE")}),e.jsx("th",{children:s("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS.NAME")}),e.jsx("th",{className:"text-center",children:s("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS.QTY")}),e.jsx("th",{className:"text-center",children:s("ACCOUNT.COMPLAINT_NEW.OVERHEAD_ITEMS.RETURN")}),e.jsx("th",{className:"table-cell-action",children:e.jsx(R,{type:"primary",size:"small",onClick:ee,children:e.jsx(le,{path:tn})})})]})}),e.jsx("tbody",{children:y.map((E,re)=>e.jsxs("tr",{children:[e.jsx("td",{children:E.nomeclatureCode}),e.jsx("td",{children:E.productName}),e.jsx("td",{className:"text-center",children:E.amount}),e.jsx("td",{className:"text-center",children:e.jsx(st,{value:E.isReturn,id:"overhead_item_return",readOnly:!0})}),e.jsx("td",{className:"table-cell-action",children:e.jsxs("div",{className:"flex",children:[e.jsx(R,{size:"small",onClick:()=>$(re,E),children:e.jsx(le,{path:rt})}),e.jsx(R,{type:"danger",size:"small",onClick:()=>K(re),children:e.jsx(le,{path:Nn})})]})})]},re))})]})}),e.jsx(Tn,{type:"info",className:"mt-2",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:s("ACCOUNT.COMPLAINT_NEW.METHOD_DESCRIPTION")??""}})}),e.jsxs("form",{onSubmit:V,autoComplete:"off",children:[e.jsxs(ne,{header:s("ACCOUNT.COMPLAINT_NEW.METHOD"),className:"mt-2",children:[e.jsx(yn,{className:"mb-2"}),e.jsxs(We,{children:[e.jsx(D,{label:s("ACCOUNT.COMPLAINT_NEW.METHOD.SOLUTION"),labelPlacement:"top",children:e.jsx(Hn,{options:(l==null?void 0:l.complaintSolutions)??[],renderItem:E=>E.description,renderValue:E=>E.description,value:d,onChange:h,required:!0})}),e.jsxs(ge,{when:F(d),children:[e.jsx(D,{label:s("ACCOUNT.COMPLAINT_NEW.BANK_ACCOUNT"),labelPlacement:"top",children:e.jsx(Hn,{options:[...((ln=c==null?void 0:c.bankAccounts)==null?void 0:ln.filter(E=>E.isValid).map(E=>({value:E.id,label:`${E.name} (${E.account}/${E.code})`})))??[],...B?[{value:"create_new",label:s("ACCOUNT.COMPLAINT_NEW.BANK_ACCOUNT.CREATE_NEW")}]:[]],renderItem:E=>E.label,renderValue:E=>E.label,value:[...((on=c==null?void 0:c.bankAccounts)==null?void 0:on.map(E=>({value:E.id,label:`${E.name} (${E.account}/${E.code})`})))??[],{value:"create_new",label:s("ACCOUNT.COMPLAINT_NEW.BANK_ACCOUNT.CREATE_NEW")}].find(E=>E.value===O),onChange:E=>{E.value==="create_new"?q():_(E.value)},required:!0})}),!B&&e.jsx(Tn,{type:"warning",children:s("ACCOUNT.COMPLAINT_NEW.BANK_ACCOUNT_ADMIN_REQUIRED")}
46)]}),e.jsx(D,{label:s("ACCOUNT.COMPLAINT_NEW.METHOD.RETURN_TYPE"),labelPlacement:"top",children:e.jsx(Hn,{options:(l==null?void 0:l.goodsReturnTypes)??[],renderItem:E=>E.description,renderValue:E=>E.description,value:N,onChange:m,required:!0})}),e.jsx(D,{label:s("ACCOUNT.COMPLAINT_NEW.METHOD.NOTE"),labelPlacement:"top",children:e.jsx("textarea",{value:p,onChange:E=>f(E.target.value)})}),e.jsx(D,{label:s("ACCOUNT.COMPLAINT_NEW.METHOD.CONTACT"),labelPlacement:"top",children:e.jsx(Hn,{options:(l==null?void 0:l.users)??[],renderItem:E=>`${E.firstName} ${E.lastName}`,renderValue:E=>`${E.firstName} ${E.lastName}`,value:C,onChange:A,required:!0})})]})]}),e.jsx(ne,{header:s("ACCOUNT.COMPLAINT_NEW.FOTO_DOCUMENTATION"),className:"mt-2",children:e.jsx(D,{label:s("ACCOUNT.COMPLAINT_NEW.FOTO_DOCUMENTATION.ATTACHMENT"),borderless:!0,children:e.jsx(Oi,{name:"file",files:j,onChange:g})})}),e.jsx("div",{className:"mt-2 flex justify-end",children:e.jsx(R,{type:"primary",htmlType:"submit",loading:o,disabled:y.length===0&&v.length===0,children:s("ACCOUNT.COMPLAINT_NEW.SUBMIT")})})]})]});function Ue({complaint:E,item:re}){var ie,Ce,Te,Pe;return e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx("td",{children:(ie=E._reason)==null?void 0:ie.type}),e.jsx("td",{colSpan:"3",children:e.jsxs("div",{children:[e.jsx(ge,{when:E.itemTypeId===te.WrongQuantity,children:e.jsxs("div",{children:[s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.COMPLAIN_QTY"),": ",e.jsx("strong",{children:E.amount})]})}),e.jsxs(ge,{when:E.itemTypeId===te.Defect,children:[e.jsxs("div",{children:[s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.COMPLAIN_QTY"),": ",e.jsx("strong",{children:E.amount})]}),e.jsxs("div",{children:[s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.COMPLAIN_DEFECT"),": ",e.jsx("strong",{children:(Ce=E.defect)==null?void 0:Ce.name})]})]}),e.jsx(ge,{when:E.itemTypeId===te.Return,children:e.jsxs("div",{children:[s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.COMPLAIN_QTY"),": ",e.jsx("strong",{children:E.amount})]})}),e.jsx(ge,{when:E.itemTypeId===te.WrongPrice,children:e.jsxs("div",{children:[s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.COMPLAIN_PRICE_ESTIMATED"),":"," ",e.jsx("strong",{children:z.formatMoney(E.unitExpectedPrice,(Te=l==null?void 0:l.issueNote)==null?void 0:Te.currencyCode)})]})}),e.jsxs(ge,{when:E.itemTypeId===te.WrongPrint,children:[e.jsxs("div",{children:[s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.COMPLAIN_QTY"),": ",e.jsx("strong",{children:E.amount})]}),e.jsxs("div",{children:[s("ACCOUNT.COMPLAINT_NEW.COMPLAIN_ITEMS.COMPLAIN_DEFECT"),": ",e.jsx("strong",{children:(Pe=E.defect)==null?void 0:Pe.name})]})]})]})}),e.jsx("td",{className:"table-cell-action",children:e.jsx(R,{type:"danger",size:"small",onClick:()=>Q(re.displayOrder),children:e.jsx(le,{path:Nn})})})]})}}function cc(){var C;const{transport:t}=Rn(),{t:n}=k(),{data:s,isLoading:a,error:i,mutate:o}=de(`/api/v4/transport/${t}`),r=ot(`/api/v4/transport/${t}/cancel`),[l,c]=T.useState(!1),[u,d]=T.useState(!1);async function h(){try{c(!0);const A=await In(`/api/v4/transport/${t}/pdf`);fn(A,`${t}.pdf`)}catch(A){H(A)}finally{c(!1)}}async function N(){try{await r.call(),o()}catch(A){H(A)}}async function m(){try{d(!0);const A=await In(`/api/v4/transport/${t}/packages-pdf`);fn(A,`${t}-package-info.pdf`)}catch(A){H(A)}finally{d(!1)}}return a||i?e.jsx(It,{isLoading:a,responseError:i}):e.jsxs(ve,{noShadow:!0,children:[e.jsxs("h2",{children:[n("ACCOUNT.ATS_DETAIL")," ",t]}),e.jsxs("div",{className:"flex flex-wrap justify-between",children:[e.jsx(oe,{to:"/account/ats/transport/",children:e.jsx(R,{children:e.jsx(le,{path:ct})})}),e.jsxs("div",{className:"flex",children:[e.jsxs(R,{type:"primary",onClick:h,disabled:s==null?void 0:s.isCancelled,loading:l,responsiveSpan:!0,children:[e.jsx(le,{path:Kn}),e.jsx("span",{children:n("ACCOUNT.ATS_DETAIL.PRINT")})]}),e.jsxs(R,{className:"ml-1",type:"primary",onClick:m,disabled:s==null?void 0:s.isCancelled,loading:u,children:[e.jsx(le,{path:Kn}),e.jsx("span",{children:n("ACCOUNT.ATS_DETAIL.MARK_PACKAGES")})]}),e.jsxs(R,{className:"ml-1",type:"primary",onClick:N,disabled:!(s!=null&&s.isCancellable),loading:r.loading,responsiveSpan:!0,children:[e.jsx(le,{path:ji}),e.jsx("span",{children:n("ACCOUNT.ATS_DETAIL.CANCEL")})]})]})]}),e.jsx(ve,{className:"mb-2 mt-2",color:"gray",noShadow:!0,children:e.jsx("p",{className:"m-0 p-1",children:n("ACCOUNT.ATS_DETAIL.HEADER_INSTRUCTION")})}),e.jsxs(We,{children:[e.jsx("table",{className:"table",style:{height:"100%"},children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.STATUS")})}),e.jsx("td",{children:s==null?void 0:s.transportStatus})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.CREATED")})}),e.jsx("td",{children:x.utc(s==null?void 0:s.creationDate).format("L")})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.ORDER")})}),e.jsx("td",{children:s==null?void 0:s.id})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.PICKUP")})}),e.jsx("td",{children:s!=null&&s.isPickup?n("YES"):n("NO")})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.SENDER_ADDRESS")})}),e.jsxs("td",{children:[e.jsx("p",{children:e.jsx("strong",{children:s==null?void 0:s.senderAddressName})}),e.jsx("p",{children:s==null?void 0:s.senderAddressRecipient}),e.jsx("p",{children:s==null?void 0:s.senderAddressStreet}),e.jsxs("p",{children:[s==null?void 0:s.senderAddressZipCode," ",s==null?void 0:s.senderAddressCity]}),e.jsx("p",{children:s==null?void 0:s.senderAddressCountry})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.SENDER_PHONE")})}),e.jsx("td",{children:s==null?void 0:s.senderPhone})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.SENDER_EMAIL")})}),e.jsx("td",{children:s==null?void 0:s.senderEmail})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.PACKAGE_QTY")})}),e.jsx("td",{children:s==null?void 0:s.parcelCount})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.NOTE")}
46)}),e.jsx("td",{children:s==null?void 0:s.customerInstruction})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.PRICE_TOTAL_NO_VAT")})}),e.jsx("td",{children:z.formatMoney(s==null?void 0:s.netPrice)})]})]})}),e.jsx("table",{className:"table",style:{height:"100%"},children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.PICKUP_DATE")})}),e.jsx("td",{children:x.utc(s==null?void 0:s.pickupDate).format("L")})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.DELIVERY_DATE")})}),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.CUSTOMER_ORDER_NUMBER")})}),e.jsx("td",{children:s==null?void 0:s.order})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.CASH_ON_DELIVERY")})}),e.jsx("td",{children:s!=null&&s.isCashOnDelivery?n("YES"):n("NO")})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.DELIVERY_ADDRESS")})}),e.jsxs("td",{children:[e.jsx("p",{children:e.jsx("strong",{children:s==null?void 0:s.deliveryAddressName})}),e.jsx("p",{children:s==null?void 0:s.deliveryAddressRecipient}),e.jsx("p",{children:s==null?void 0:s.deliveryAddressStreet}),e.jsxs("p",{children:[s==null?void 0:s.deliveryAddressZipCode," ",s==null?void 0:s.deliveryAddressCity]}),e.jsx("p",{children:s==null?void 0:s.deliveryAddressCountry})]})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.DELIVERY_PHONE")})}),e.jsx("td",{children:s==null?void 0:s.deliveryPhone})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.DELIVERY_EMAIL")})}),e.jsx("td",{children:s==null?void 0:s.deliveryEmail})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.PARCEL_WEIGHT")})}),e.jsx("td",{children:s==null?void 0:s.weight})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.LAST_DELIVERY_DATE")})}),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("strong",{children:n("ACCOUNT.ATS_DETAIL.INFO.PRICE_TOTAL_VAT")})}),e.jsx("td",{children:z.formatMoney(s==null?void 0:s.price)})]})]})})]}),e.jsx(ve,{color:"gray",className:"mt-2",noShadow:!0,children:e.jsx("p",{className:"m-0 p-1",children:n("ACCOUNT.ATS_DETAIL.INSTRUCTION.DESCRIPTION")})}),e.jsx(ne,{header:n("ACCOUNT.ATS_DETAIL.INSTRUCTION"),className:"mt-2",noBodyPadding:!0,children:e.jsxs("table",{className:"table-pretty table--no-outside-border",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("ACCOUNT.ATS_DETAIL.INSTRUCTION.PACKAGE")}),e.jsx("th",{children:n("ACCOUNT.ATS_DETAIL.INSTRUCTION.STATUS")}),e.jsx("th",{style:{width:"1px"},children:n("ACCOUNT.ATS_DETAIL.INSTRUCTION.PRINT")})]})}),e.jsx("tbody",{children:(C=s==null?void 0:s.parcels)==null?void 0:C.map(A=>e.jsxs("tr",{children:[e.jsx("td",{children:A.number}),e.jsx("td",{children:A.packageStatus}),e.jsx("td",{style:{width:"1px"},children:n("NO")})]},A.packageId))})]})})]})}function dc(){const{t}=k(),[n,s]=Xt("");Kt({allowedRoles:[ae.ATS,ae.COMPLAINT_TRANSPORT],redirect:`${hn()}/account`});const{params:a,loading:i,data:o,search:r,getSetter:l}=Fn({defaultParams:{fromDate:x.utc().startOf("date").add(-6,"month").toISOString(),toDate:x.utc().startOf("date").add(1,"day").toISOString(),order:"",status:"",yourNumber:""},apiCall:u=>w("/api/v4/transport"+en(u))}),{data:c}=de("/api/v4/transport/status");return T.useEffect(()=>{r()},[]),e.jsxs(ve,{noShadow:!0,children:[e.jsx("h2",{children:t("ACCOUNT.ATS.MY_TRANSPORT.TITLE")}),e.jsxs("div",{className:"mt-4",children:[e.jsxs(We,{children:[e.jsx(D,{label:t("ACCOUNT.ATS.MY_TRANSPORT.DATE_FROM"),children:e.jsx(Ke.Input,{value:x.utc(a.fromDate),onChange:u=>l("fromDate")(u==null?void 0:u.toISOString()),hideIcon:!0})}),e.jsx(D,{label:t("ACCOUNT.ATS.MY_TRANSPORT.DATE_TO"),children:e.jsx(Ke.Input,{value:x.utc(a.toDate),onChange:u=>l("toDate")(u==null?void 0:u.toISOString()),hideIcon:!0})}),e.jsx(D,{label:t("ACCOUNT.ATS.MY_TRANSPORT.ORDER_NUMBER"),children:e.jsx("input",{value:a.order,onChange:u=>l("order")(u.target.value)})}),e.jsx(D,{label:t("ACCOUNT.ATS.MY_TRANSPORT.CUSTOMER_ORDER_NUMBER"),children:e.jsx("input",{value:n,onChange:s})}),e.jsx(D,{label:t("ACCOUNT.ATS.MY_TRANSPORT.STATUS"),children:e.jsxs("select",{value:a.status,onChange:u=>l("status")(u.target.value),children:[e.jsx("option",{value:"",children:"--"}
46),c==null?void 0:c.map(({karatId:u,name:d})=>e.jsx("option",{value:u,children:d},u))]})})]}),e.jsx("div",{className:"my-3 flex items-center justify-end",children:e.jsx(R,{type:"primary",onClick:r,loading:i,children:t("ACCOUNT.ATS.MY_TRANSPORT.SEARCH")})}),e.jsx("div",{className:"table__wrapper",children:e.jsxs("table",{className:"table-pretty",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("ACCOUNT.ATS.MY_TRANSPORT.ORDER_NUMBER")}),e.jsx("th",{children:t("ACCOUNT.ATS.MY_TRANSPORT.DATE")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.ATS.MY_TRANSPORT.SERVICE")}),e.jsx("th",{children:t("ACCOUNT.ATS.MY_TRANSPORT.CUSTOMER_ORDER_NUMBER")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.ATS.MY_TRANSPORT.ADDRESSEE")}),e.jsx("th",{className:"hidden lg:table-cell",children:t("ACCOUNT.ATS.MY_TRANSPORT.STATUS")})]})}),e.jsx("tbody",{children:o.map((u,d)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(oe,{to:`/account/ats/transport/${u.id}`,children:u.id})}),e.jsx("td",{children:x.utc(u.date).format("L")}),e.jsx("td",{className:"hidden lg:table-cell",children:u.delivery}),e.jsx("td",{children:u.yourNumber}),e.jsx("td",{className:"hidden lg:table-cell",children:u.country}),e.jsx("td",{className:"hidden lg:table-cell",children:u.status})]},d))})]})})]})]})}function uc({form:t,deliveries:n,deliveryAddress:s,selectedDelivery:a,complaintData:i}){const{t:o}=k(),r=t.values.senderAddressCountryCode,l=t.values.packageCount;T.useEffect(()=>{t.setValues({senderAddressName:"",senderAddressRecipient:"",senderAddressStreet:"",senderAddressCity:"",senderAddressZipCode:"",senderPhone:"",senderEmail:"@"})},[r]);const c=T.useMemo(()=>{const d=new Set;return n==null?void 0:n.reduce((h,{fromCountryCode:N,fromCountry:m})=>(N&&m&&!d.has(N)&&(d.add(N),h.push({value:N,label:m})),h),[])},[n]);T.useEffect(()=>{if(a){const d=Math.ceil(t.values.weight/a.maxWeight);t.values.packageCount<d&&t.setValues({packageCount:d})}},[t.values.weight,t.values.packageCount,a]);const u=n==null?void 0:n.find(d=>{var h;return d.toCountryId===((h=i.returnCountry)==null?void 0:h.countryId)});return e.jsxs(we,{withBorder:!0,shadow:"xl",children:[e.jsx(we.Section,{inheritPadding:!0,withBorder:!0,py:"md",bg:"#e7e7e7",children:e.jsx(Z,{fw:600,children:o("ACCOUNT.ATS.NEW_DELIVERY.BASIC_PARAMS")})}),e.jsx(we.Section,{className:"p-4",children:e.jsxs(Be,{children:[e.jsx(un,{...t.getInputProps("senderAddressCountryCode"),label:o("ACCOUNT.ATS.NEW_DELIVERY.BASIC_PARAMS.SENDER_COUNTER"),data:c??[],allowDeselect:!1,required:!0}),e.jsx(un,{placeholder:(u==null?void 0:u.toCountry)??void 0,label:o("ACCOUNT.ATS.NEW_DELIVERY.BASIC_PARAMS.RECIPIENT_COUNTER"),disabled:!0,required:!0}),e.jsx(wn,{...t.getInputProps("weight"),label:o("ACCOUNT.ATS.NEW_DELIVERY.BASIC_PARAMS.WEIGHT"),min:1,required:!0}),e.jsx(wn,{...t.getInputProps("packageCount"),label:o("ACCOUNT.ATS.NEW_DELIVERY.BASIC_PARAMS.QUANTITY"),allowDecimal:!1,min:1,required:!0}),e.jsxs(Ne,{children:[e.jsxs(Z,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.BASIC_PARAMS.PRICE"),": "]}),e.jsx(Z,{children:a&&z.formatMoney(a.netPrice,"")})]}),e.jsxs(Ne,{children:[e.jsxs(Z,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.BASIC_PARAMS.PRICE_TOTAL"),": "]}),e.jsx(Z,{children:a&&z.formatMoney(a.netPrice*l,"")})]}),e.jsxs(Ne,{children:[e.jsxs(Z,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.BASIC_PARAMS.PACKAGE_DIMENSION"),": "]}),e.jsx(Z,{children:e.jsx(kn,{i18nKey:"ACCOUNT.ATS.NEW_DELIVERY.BASIC_PARAMS.PACKAGE_DIMENSION_DESCRIPTION",values:{weight:`<strong>${(a==null?void 0:a.maxWeight)??"?"}</strong>`}})})]}),e.jsxs(Be,{children:[e.jsx(Vn,{order:3,children:o("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_DELIVERY")}),s&&e.jsxs(e.Fragment,{children:[e.jsxs(Ne,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_DELIVERY.COMPANY_NAME"),":",e.jsx(Z,{children:s.name})]}),e.jsxs(Ne,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_DELIVERY.NAME"),": ",e.jsx(Z,{children:s.recipient})]}),e.jsxs(Ne,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_DELIVERY.STREET"),": ",e.jsx(Z,{children:s.street})]}),e.jsxs(Ne,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_DELIVERY.ZIP"),": ",e.jsx(Z,{children:s.zipCode})]}),e.jsxs(Ne,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_DELIVERY.COUNTRY"),": ",e.jsx(Z,{children:s.countryName})]}),e.jsxs(Ne,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_DELIVERY.PHONE"),": ",e.jsx(Z,{children:s.phone})]}),e.jsxs(Ne,{children:[o("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_DELIVERY.EMAIL"),": ",e.jsx(Z,{children:s.email})]})]})]})]})})]})}function hc({close:t,title:n,options:s,onOptionSelect:a}){const[i,o]=T.useState(),{t:r}=k();function l(){i!==void 0&&a(i),t()}return e.jsxs(vn,{opened:!0,onClose:t,size:"lg",title:n,children:[e.jsx(fi,{h:300,children:e.jsx(Be,{children:s.map((c,u)=>e.jsxs("button",{className:ws("border-0 bg-white px-4 py-1 text-left hover:cursor-pointer hover:bg-gray-300",i===u&&"!bg-gray-300",c.disabled&&"border-gray-400 text-gray-400 hover:cursor-default"),onClick:()=>{c.disabled||o(u)},children:[e.jsx(Z,{children:c.label}),c.description&&e.jsx(Z,{size:"xs",c:"dimmed",children:c.description})]},c.value))})}),e.jsx(Ge,{className:"col-span-full",my:"md"}),e.jsxs(Ne,{className:"col-span-full",justify:"end",children:[e.jsx(je,{variant:"outline",onClick:t,children:r("DIALOG.CANCEL")}),e.jsx(je,{disabled:i===void 0,onClick:l,children:r("DIALOG.CONFIRM")})]})]})}function Cc({form:t,selectedDelivery:n}){const{t:s}=k(),a=t.values.senderAddressCountryCode,{data:i,loading:o}=me(()=>w(`/api/v4/address/${n.fromCountryId}`),{ready:!!a,onError:H});function r(u){const d=i==null?void 0:i[u];if(d){const h={senderAddressName:d.name??void 0,senderAddressRecipient:d.recipient??void 0,senderAddressStreet:d.street??void 0,senderAddressCity:d.city??void 0,senderAddressZipCode:d.zipCode??void 0,senderPhone:d.phone??void 0,senderEmail:d.email??void 0};t.setValues(h)}}function l(){fe(hc,{title:s("ACCOUNT.ATS.NEW_DELIVERY.SELECT_ADDRESS"),onOptionSelect:r,options:c})}const c=(i==null?void 0:i.map(u=>({value:u.id.toString(),label:u.name,description:e.jsx(e.Fragment,{children:`${u.street}, ${u.zipCode} - ${u.city}, ${u.country}`})})))??[];return e.jsxs(we,{withBorder:!0,shadow:"xl",children:[e.jsx(we.Section,{inheritPadding:!0,withBorder:!0,py:"md",bg:"#e7e7e7",children:e.jsxs(Ne,{justify:"space-between",children:[e.jsx(Z,{fw:600,children:s("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_SENDER")}),e.jsx(R,{type:"primary",size:"small",loading:o,onClick:l,children:s("ACCOUNT.ATS.NEW_DELIVERY.SELECT_ADDRESS")})]})}),e.jsx(we.Section,{className:"p-4",children:e.jsxs(Be,{children:[e.jsx(Se,{...t.getInputProps("senderAddressName"),label:s("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_SENDER.COMPANY_NAME"),required:!0}),e.jsx(Se,{...t.getInputProps("senderAddressRecipient"),label:s("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_SENDER.NAME"),required:!0}),e.jsx(Se,{...t.getInputProps("senderAddressStreet"),label:s("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_SENDER.STREET"),required:!0}),e.jsx(Ii,{...t.getInputProps("senderAddressZipCode"),label:s("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_SENDER.ZIP"),countryCode:(n==null?void 0:n.fromCountryCode)??"",value:{city:t.values.senderAddressCity,code:t.values.senderAddressZipCode},onChange:u=>
46t.setValues({senderAddressCity:u.city,senderAddressZipCode:u.code}),required:!0}),e.jsxs(Ne,{children:[e.jsxs(Z,{children:[s("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_SENDER.COUNTRY"),": "]}),e.jsx(Z,{children:n==null?void 0:n.fromCountry})]}),e.jsx(kt,{...t.getInputProps("senderPhone"),label:s("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_SENDER.PHONE")}),e.jsx(Se,{...t.getInputProps("senderEmail"),label:s("ACCOUNT.ATS.NEW_DELIVERY.ADDRESS_SENDER.EMAIL"),type:"email"})]})})]})}function _s(t){return Array.isArray(t)||t===null?t:new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))}function Nc(t){return e.jsx(ss,{...t,value:t.value?_s(t.value):t.value,onChange:n=>{var s;(s=t.onChange)==null||s.call(t,_s(n))}})}const mc={senderAddressCountryCode:"",weight:10,packageCount:1,complaintId:"",senderAddressName:"",senderAddressRecipient:"",senderAddressStreet:"",senderAddressCity:"",senderAddressZipCode:"",senderPhone:"",senderEmail:"@",order:"",pickupDateInput:void 0,customerInstruction:""},Ac=t=>{const n=x.utc(t);return n.day()===5||n.day()===6};function xc(t,n){return t==null?void 0:t.find(s=>s.fromCountryCode===n)}function pc({deliveries:t,complaintData:n,onSubmit:s,isSubmitting:a}){var u;const[i,o]=T.useState(!1),{t:r}=k(),l=_n({initialValues:{...mc,senderAddressCountryCode:((u=t==null?void 0:t[0])==null?void 0:u.fromCountryCode)??""},validate:{senderAddressName:_e(),senderAddressRecipient:_e(),senderAddressStreet:_e()},transformValues:d=>({...d,pickupDate:x.utc(d.pickupDateInput)})});T.useEffect(()=>{t&&t.length===0&&nn("error",r("ACCOUNT.ATS.NEW_DELIVERY.NO_ATS"),{duration:0})},[t]);const c=T.useMemo(()=>xc(t,l.values.senderAddressCountryCode),[t,l.values.senderAddressCountryCode]);return T.useEffect(()=>{if(c!=null&&c.firstPickupDate){const d=x.utc(c.firstPickupDate).toDate();l.setFieldValue("pickupDateInput",d)}},[c]),e.jsxs("form",{onSubmit:l.onSubmit(s),children:[e.jsxs(Be,{children:[e.jsx(uc,{form:l,deliveries:t??[],deliveryAddress:n.returnCountry,selectedDelivery:c,complaintData:n}),c&&e.jsx(Cc,{form:l,selectedDelivery:c}),c&&e.jsxs(we,{withBorder:!0,shadow:"xl",children:[e.jsx(we.Section,{inheritPadding:!0,withBorder:!0,py:"md",bg:"#e7e7e7",children:e.jsx(Z,{fw:600,children:r("ACCOUNT.ATS.NEW_DELIVERY.ADDITIONAL_INFO")})}),e.jsx(we.Section,{className:"p-4",children:e.jsxs(Be,{children:[e.jsxs(Be,{gap:0,children:[e.jsx(Se,{...l.getInputProps("order"),label:r("ACCOUNT.ATS.NEW_DELIVERY.ADDITIONAL_INFO.CUSTOMER_ORDER_NUMBER"),maxLength:20}),e.jsx(Z,{size:"sm",children:r("ACCOUNT.ATS.NEW_DELIVERY.ADDITIONAL_INFO.CUSTOMER_ORDER_NUMBER.DESCRIPTION")})]}),e.jsx(Nc,{...l.getInputProps("pickupDateInput"),label:r("ACCOUNT.ATS.NEW_DELIVERY.ADDITIONAL_INFO.PICKUP_DATE"),minDate:new Date(c.firstPickupDate),excludeDate:Ac,valueFormat:"L"}),e.jsx(gi,{...l.getInputProps("customerInstruction"),label:r("ACCOUNT.ATS.NEW_DELIVERY.ADDITIONAL_INFO.NOTE"),resize:"vertical"})]})})]})]}),e.jsx(Ge,{className:"col-span-full",my:"md"}),e.jsxs(Ne,{className:"col-span-full",justify:"end",children:[e.jsxs("label",{className:"flex cursor-pointer gap-x-2",children:[e.jsx(En,{checked:i,onChange:d=>o(d.target.checked)}),r("ACCOUNT.ATS.NEW_DELIVERY.PERMISSION_LABEL")]}),e.jsx(je,{type:"submit",loading:a,disabled:!i,children:r("ACCOUNT.ATS.NEW_DELIVERY.ORDER")})]})]})}function Tc(){const t=Yn(),{complaint:n}=Rn();Kt({allowedRoles:[ae.ATS,ae.COMPLAINT_TRANSPORT],redirect:`${hn()}/account`});const{data:s,loading:a,error:i}=me(()=>w(`/api/v4/complaint/${n}`)),{data:o,loading:r}=me(()=>w(`/api/v4/transport/country-delivery${en({deliveryCode:s==null?void 0:s.deliveryCode})}`),{ready:!!(s!=null&&s.deliveryCode),onError:H}),l=me(u=>w("POST /api/v4/transport",{body:u}),{manual:!0,onError:H,onSuccess:u=>{t(`${hn()}/account/ats/transport/${u.transportId}`)}}),c=T.useCallback(u=>{var d;if(s!=null&&s.returnCountry){const h={...u,pickupDate:u.pickupDate.toISOString(),complaintId:n,deliveryAddressCountryCode:(d=o==null?void 0:o.find(N=>{var m;return N.toCountryId===((m=s.returnCountry)==null?void 0:m.countryId)}))==null?void 0:d.toCountryCode,deliveryCode:s.deliveryCode,deliveryAddressName:s.returnCountry.name,deliveryAddressRecipient:s.returnCountry.recipient,deliveryAddressStreet:s.returnCountry.street,deliveryAddressCity:s.returnCountry.city,deliveryAddressZipCode:s.returnCountry.zipCode,deliveryPhone:s.returnCountry.phone,deliveryEmail:s.returnCountry.email,variableSymbol:""};l.run(h)}},[s,l]);return a||r?e.jsx(Ve,{pos:"relative",className:"h-screen w-full",children:e.jsx(Ht,{visible:!0})}):!n||!(s!=null&&s.contractId)||i?e.jsx(Ks,{}):e.jsxs(Be,{children:[e.jsx(yn,{className:"mb-2"}),e.jsx(pc,{deliveries:o,complaintData:s,onSubmit:c,isSubmitting:l.loading})]})}const Ec="_table_jj3r5_1",Oc={table:Ec};function jc(){const{t}=k(),{data:n,refresh:s}=me(()=>w("/api/v4/watch-dog"),{onError:H}),a=me(r=>w(`DELETE /api/v4/watch-dog/${r}`),{manual:!0,onError:H,onSuccess:s});function i(r){fe(dt,{message:t("ACCOUNT.WATCHDOG.TABLE.ARE_U_SURE"),onSubmit:()=>{a.run(r)}})}const o=T.useMemo(()=>
46{if(n)return n.map(r=>{var l,c,u,d,h,N,m,C,A,p,f,j,g,v,S,y,L,O,_,M,B,P,F,q,W;return[e.jsx(vi,{to:`/product/${(l=r.product)==null?void 0:l.code}?color=${(u=(c=r.product)==null?void 0:c.color)==null?void 0:u.code}`,children:e.jsx("img",{src:Vs.src({code:(d=r.product)==null?void 0:d.code,colorCode:(N=(h=r.product)==null?void 0:h.color)==null?void 0:N.code},{width:52}),alt:""})},(C=(m=r.product)==null?void 0:m.color)==null?void 0:C.code),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex gap-2",children:[e.jsx(Z,{fw:"bolder",fz:"lg",children:(A=r.product)==null?void 0:A.name}),e.jsx(Z,{fw:"bold",fz:"lg",c:"dimmed",children:(p=r.product)==null?void 0:p.code})]}),e.jsxs(Z,{children:[t("ACCOUNT.WATCHDOG.TABLE.CODE"),": ",(j=(f=r.product)==null?void 0:f.size)==null?void 0:j.code]}),e.jsxs(Z,{children:[t("ACCOUNT.WATCHDOG.TABLE.SIZE"),": ",(S=(v=(g=r.product)==null?void 0:g.size)==null?void 0:v.size)==null?void 0:S.toLocaleUpperCase()]}),e.jsxs(Z,{children:[t("ACCOUNT.WATCHDOG.TABLE.COLOR"),": ",(L=(y=r.product)==null?void 0:y.color)==null?void 0:L.code," ",(_=(O=r.product)==null?void 0:O.color)==null?void 0:_.name]})]},(B=(M=r.product)==null?void 0:M.color)==null?void 0:B.code),e.jsx(Z,{children:r.email},(F=(P=r.product)==null?void 0:P.color)==null?void 0:F.code),e.jsx(On,{size:"sm",variant:"subtle",color:"red",className:"align-middle",onClick:()=>i(r.id),children:e.jsx(er,{})},(W=(q=r.product)==null?void 0:q.color)==null?void 0:W.code)]})},[n]);return e.jsx(yi,{shadow:"xs",className:"w-full",p:"md",children:e.jsxs(Be,{children:[e.jsx(Vn,{order:2,children:t("ACCOUNT.WATCHDOG.TITLE")}),e.jsx("div",{className:"overflow-auto",children:e.jsx(Qs,{className:Oc.table,data:{body:o}})})]})})}const fc=new Bn("Account");function Ic(){const t=fc,{t:n}=k(),s=qn(),a=Yn(),i=s.pathname.replace(hn(),""),o=[{key:"/account",label:n("ACCOUNT.MENU.COMPANY_INFORMATION")},{key:"/account/user",label:n("ACCOUNT.MENU.USERS")},he.isInRole(ae.ADMIN)&&{key:"/account/address",label:n("ACCOUNT.MENU.ADDRESSES")},he.isInRole([ae.ORDER,ae.INVOICE])&&{key:"/account/order",label:n("ACCOUNT.MENU.ORDERS")},he.isInRole(ae.INVOICE)&&{key:"/account/invoice",label:n("ACCOUNT.MENU.INVOICES")},he.isInRole(ae.PRINTER)&&{key:"/account/expedition",label:n("ACCOUNT.MENU.EXPEDITIONS")},he.isInRole(ae.INVOICE)&&{key:"/account/complain",label:n("ACCOUNT.MENU.COMPLAINT_2")},he.isInRole(ae.INVOICE)&&{key:"/account/complaint",label:n("ACCOUNT.MENU.COMPLAINT")},{key:"/account/parcel",label:n("ACCOUNT.MENU.PARCELS")},he.isInRole([ae.ATS,ae.COMPLAINT_TRANSPORT])&&{key:"/account/ats",label:n("ACCOUNT.MENU.ATS"),isFolder:!0,children:[he.isInRole(ae.ATS)&&{key:"/account/ats/description",label:n("ACCOUNT.MENU.ATS.DESCRIPTION")},he.isInRole(ae.ATS)&&{key:"/account/ats/new-delivery",label:n("ACCOUNT.MENU.ATS.NEW_TRANSPORT")},he.isInRole([ae.ATS,ae.COMPLAINT_TRANSPORT])&&{key:"/account/ats/transport",label:n("ACCOUNT.MENU.ATS.MY_TRANSPORT")}].filter(Boolean)},he.isInRole(ae.PICKUP)&&{key:"/account/faq",label:n("ACCOUNT.MENU.FAQ")},{key:"/account/online-catalog",label:n("ACCOUNT.MENU.ONLINE_CATALOG")},{key:"/account/offer-creator",label:n("ACCOUNT.MENU.OFFER_CREATOR")},{key:"/account/exports",label:n("ACCOUNT.MENU.EXPORTS")},{key:"/account/watchdogs",label:n("ACCOUNT.MENU.WATCHDOGS")}].filter(Boolean);Kt();const r=o.flatMap(c=>[c,...c.children??[]]).find(c=>c.key===i);bi({title:r==null?void 0:r.label,noIndex:!0});function l(c){var u;c&&("isFolder"in c&&c.isFolder?(u=c.children)!=null&&u[0]&&l(c.children[0]):a(`${hn()}${c.key}`))}return e.jsxs(Si,{className:`${t}`,children:[e.jsx(Li,{style:{width:"18rem"},items:o,onClick:l,renderLabel:c=>c.label,getKey:c=>c.key,openKey:i}),e.jsx("div",{className:t.em("page-main-wrapper"),children:e.jsxs(Di,{children:[e.jsx(Oe,{index:!0,element:e.jsx(no,{})}),e.jsx(Oe,{path:"user",element:e.jsx(io,{})}),e.jsx(Oe,{path:"address",element:e.jsx(_i,{})}),e.jsx(Oe,{path:"order",element:e.jsx(lo,{})}),e.jsx(Oe,{path:"order/:order",element:e.jsx(No,{})}),e.jsx(Oe,{path:"invoice",element:e.jsx(sc,{})}),e.jsx(Oe,{path:"invoice/:invoice",element:e.jsx(Ao,{})}),e.jsx(Oe,{path:"expedition",element:e.jsx(To,{})}),e.jsx(Oe,{path:"expedition/:expedition",element:e.jsx(Eo,{})}),e.jsx(Oe,{path:"complain",element:e.jsx(Ri,{to:`${hn()}/account/invoice`})}),e.jsx(Oe,{path:"complain/:invoice",element:e.jsx(oc,{})}),e.jsx(Oe,{path:"complaint",element:e.jsx(co,{})}),e.jsx(Oe,{path:"complaint/:complaint",element:e.jsx(po,{})}),e.jsx(Oe,{path:"parcel",element:e.jsx(ic,{})}),e.jsx(Oe,{path:"ats/description",element:e.jsx(ve,{noShadow:!0,fullWidth:!0,children:e.jsx(Ss,{code:"adler_transport_service"})})}),e.jsx(Oe,{path:"ats/new-delivery/:complaint",element:e.jsx(Tc,{})}),e.jsx(Oe,{path:"ats/transport",element:e.jsx(dc,{})}),e.jsx(Oe,{path:"ats/transport/:transport",element:e.jsx(cc,{})}),e.jsx(Oe,{path:"faq",element:e.jsx(ve,{noShadow:!0,fullWidth:!0,children:e.jsx(Ss,{code:"pickup-faq"})})}),e.jsx(Oe,{path:"online-catalog",element:e.jsx($o,{})}),e.jsx(Oe,{path:"offer-creator",element:e.jsx(Ui,{})}),e.jsx(Oe,{path:"exports",element:e.jsx(qo,{})}),e.jsx(Oe,{path:"watchdogs",element:e.jsx(jc,{})})]})})]})}const vc=Ys(Ic);export{vc as default};

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.