PageSourceSearch

https://flyttfabriken.vercel.app/_next/static/chunks/31724.35e629324ca99eba.js

js flyttfabriken.vercel.app collected 2026-10-03 06:58:40 UTC 117,795 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[31724],{5917:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},7217:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]])},8803:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},10489:(e,t,l)=>{l.d(t,{b:()=>o});var a=l(12115),s=l(88142),n=l(95155),r=a.forwardRef((e,t)=>(0,n.jsx)(s.sG.label,{...e,ref:t,onMouseDown:t=>{var l;t.target.closest("button, input, select, textarea")||(null==(l=e.onMouseDown)||l.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));r.displayName="Label";var o=r},17910:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},20562:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]])},21873:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]])},24719:(e,t,l)=>{l.d(t,{d:()=>n});var a=l(12115),s=l(80560);function n(e,t){let[l,n]=(0,a.useState)(t||[]),[r,o]=(0,a.useState)(!t),[i,d]=(0,a.useState)(null),[c,u]=(0,a.useState)(!1),[m,g]=(0,a.useState)({name:"",partner:null,email:null,phone:null,personal_number:null,company_name:null,org_number:null,invoice_address:null,invoice_reference:null,is_internal:!1}),[p,h]=(0,a.useState)(!1),[x,b]=(0,a.useState)(!1),[v,f]=(0,a.useState)(!1),[_,y]=(0,a.useState)(null),j=(0,a.useCallback)(async()=>{o(!0),d(null);try{let t=await fetch("/".concat(e,"/api/customers"));if(!t.ok)throw Error("Failed to fetch customers: ".concat(t.status));let l=await t.json();n(l)}catch(e){(0,s.hS)(e)}finally{o(!1)}},[e]);(0,a.useEffect)(()=>{t||j()},[t,j]);let k=(0,a.useCallback)(async t=>{h(!0),d(null);try{let l=await fetch("/".concat(e,"/api/customers"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!l.ok){let e=await l.text(),t="Failed to create customer: ".concat(l.status);if(e.includes("<html")||e.includes("<!DOCTYPE"))t="Server returned an HTML error page. Please check the API endpoint.";else try{t=JSON.parse(e).error||t}catch(l){t=e||t}throw Error(t)}let a=await l.json();n(e=>[a,...e]),u(!1),g({name:"",partner:null,email:null,phone:null,personal_number:null,company_name:null,org_number:null,invoice_address:null,invoice_reference:null,is_internal:!1})}catch(e){throw e}finally{h(!1)}},[e]),N=(0,a.useCallback)(async t=>{if(_){f(!0),d(null);try{let l=await fetch("/".concat(e,"/api/customers/").concat(_),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!l.ok){let e=await l.text(),t="Failed to update customer: ".concat(l.status);if(e.includes("<html")||e.includes("<!DOCTYPE"))t="Server returned an HTML error page. Please check the API endpoint.";else try{t=JSON.parse(e).error||t}catch(l){t=e||t}throw Error(t)}let a=await l.json();n(e=>e.map(e=>e.id===_?a:e)),u(!1),y(null)}catch(e){throw e}finally{f(!1)}}},[_,e]);return{customers:l,loading:r,error:i,isDialogOpen:c,setIsDialogOpen:u,newCustomer:m,setNewCustomer:g,isCreating:p,isDeleting:x,isEditing:v,editingId:_,setEditingId:y,createCustomer:k,updateCustomer:N,deleteCustomer:(0,a.useCallback)(async t=>{b(!0),d(null);try{let l=await fetch("/".concat(e,"/api/customers/").concat(t),{method:"DELETE"});if(!l.ok){let e=await l.text(),t="Failed to delete customer: ".concat(l.status);if(e.includes("<html")||e.includes("<!DOCTYPE"))t="Server returned an HTML error page. Please check the API endpoint.";else try{t=JSON.parse(e).error||t}
1catch(l){t=e||t}throw Error(t)}n(e=>e.filter(e=>e.id!==t))}catch(e){throw e}finally{b(!1)}},[e]),fetchCustomers:j}}},35951:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]])},52987:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},57828:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},63817:(e,t,l)=>{l.d(t,{G7:()=>i,L$:()=>u,h_:()=>m,oI:()=>d,uB:()=>o,xL:()=>c});var a=l(95155);l(12115);var s=l(60425),n=l(86651),r=l(64269);function o(e){let{className:t,...l}=e;return(0,a.jsx)(s.uB,{"data-slot":"command",className:(0,r.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...l})}function i(e){let{className:t,...l}=e;return(0,a.jsxs)("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[(0,a.jsx)(n.A,{className:"size-4 shrink-0 opacity-50"}),(0,a.jsx)(s.uB.Input,{"data-slot":"command-input",className:(0,r.cn)("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...l})]})}function d(e){let{className:t,...l}=e;return(0,a.jsx)(s.uB.List,{"data-slot":"command-list",className:(0,r.cn)("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...l})}function c(e){let{...t}=e;return(0,a.jsx)(s.uB.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function u(e){let{className:t,...l}=e;return(0,a.jsx)(s.uB.Group,{"data-slot":"command-group",className:(0,r.cn)("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...l})}function m(e){let{className:t,...l}=e;return(0,a.jsx)(s.uB.Item,{"data-slot":"command-item",className:(0,r.cn)("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...l})}l(51834)},80560:(e,t,l)=>{function a(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];return t.filter(Boolean).join(" ")}function s(e){throw console.error("API Error:",e),Error(e.message||"An un expected error occurred")}l.d(t,{U6:()=>r,cn:()=>a,hS:()=>s,qy:()=>n});let n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(null==e)return"N/A";let l=e.toFixed(t).split("."),a=l[0],s=l[1],n=a;return parseInt(a)>=1e4&&(n=a.replace(/\B(?=(\d{3})+(?!\d))/g," ")),s?"".concat(n,".").concat(s):n};function r(e){if(null==e)return"";let t=String(e).replace(/\D/g,"");if(!t)return"";if(t.startsWith("19")||t.startsWith("20")){let e=t.slice(0,12);return e.length<=8?e:"".concat(e.slice(0,8),"-").concat(e.slice(8))}{let e=t.slice(0,10);return e.length<=6?e:"".concat(e.slice(0,6),"-").concat(e.slice(6))}}},80647:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]])},86870:(e,t,l)=>{async function a(e,t){let l=await fetch("/api/maps/calculate-distance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({origins:e,destinations:t})});if(!l.ok)return{distance:0,duration:0,error:await l.text().catch(()=>"")||"Failed (".concat(l.status,")")};let a=await l.json();return{distance:a.distance||0,duration:a.duration||0,originAddress:a.originAddress,destinationAddress:a.destinationAddress}}async function s(e,t,l){let a=await fetch("/api/maps/calculate-route-distance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({origin:e,waypoints:t,destination:l})});if(!a.ok)return{distance:0,duration:0,error:await a.text().catch(()=>"")||"Failed (".concat(a.status,")")};let s=await a.json();return{distance:s.distance||0,duration:s.duration||0,legs:s.legs}}async function n(e,t,l){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:864e5;return e.fetchQuery({queryKey:["distance-v2",t.trim().toLowerCase(),l.trim().toLowerCase()],queryFn:()=>a(t,l),staleTime:s,gcTime:864e5})}async function r(e,t,l,a){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:864e5;return e.fetchQuery({queryKey:["route-distance-v2",t.trim().toLowerCase(),...(l||[]).map(e=>e.trim().toLowerCase()),a.trim().toLowerCase()],queryFn:()=>s(t,l,a),staleTime:n,gcTime:864e5})}l.d(t,{U:()=>r,t:()=>n})},93341:(e,t,l)=>{l.d(t,{A:()=>a});let a=(0,l(71847).A)("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]])},93943:(e,t,l)=>{l.r(t),l.d(t,{JobForm:()=>eK});var a=l(95155),s=l(12115),n=l(47650),r=l(46826),o=l(21873),i=l(71360),d=l(89715),c=l(92603),u=l(35299),m=l(11010),g=l(48314),p=l(57828),h=l(65229),x=l(46398),b=l(37586),v=l(71847);let f=(0,v.A)("circle-minus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);
1var _=l(52987),y=l(80647),j=l(63961),k=l(4661),N=l(89030);let w=(0,v.A)("user-pen",[["path",{d:"M11.5 15H7a4 4 0 0 0-4 4v2",key:"15lzij"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}]]);var C=l(20508),A=l(69141),S=l(23664),q=l(71871),M=l(48648),F=l(10383),R=l(68096),T=l(73457),D=l(76444),E=l(64269),I=l(63817),L=l(26333),P=l(24719);let z=s.memo(function(e){let{field:t,value:l,onDataChange:n,onDataChangeMultiple:r,label:o,icon:i,required:d,compact:c,type:m="text"}=e,[g,p]=s.useState(!1),[h,x]=s.useState(l||""),{language:b}=(0,N.o)(),{customers:v,loading:f}=(0,P.d)(b),[_,y]=s.useState(!1);s.useEffect(()=>{l!==h&&x(l||"")},[l]),s.useEffect(()=>{let e=setTimeout(()=>{h!==l&&n(t,h)},150);return()=>clearTimeout(e)},[h,t,n,l]);let j=s.useMemo(()=>{if(!h)return[];let e=h.toLowerCase();return(v||[]).filter(t=>(t.name||"").toLowerCase().includes(e)||t.email&&t.email.toLowerCase().includes(e)||t.phone&&t.phone.includes(e)||t.company_name&&t.company_name.toLowerCase().includes(e)).slice(0,8)},[v,h]),k=async e=>{p(!1);let l=e.company_name?"".concat(e.company_name," (").concat(e.name,")"):e.name;x(l),n(t,l),r({customer_name:e.name||"",customer_email:e.email||"",customer_phone:e.phone||"",company_name:e.company_name||"",partner:e.partner||"",is_company_request:!!e.company_name});try{y(!0);let t=await fetch("/".concat(b,"/api/customers/").concat(e.id,"/latest-job-data"));if(t.ok){let e=await t.json();e&&Object.keys(e).length>0&&r(e)}}catch(e){console.error("Failed to fetch latest job data:",e)}finally{y(!1)}};return(0,a.jsxs)("div",{className:"space-y-1.5 flex-1 min-w-0",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-slate-400 ml-1",children:o}),(0,a.jsxs)(L.AM,{open:g&&h.length>0,onOpenChange:p,children:[(0,a.jsx)(L.dT,{asChild:!0,children:(0,a.jsxs)("div",{className:"relative group",children:[(0,a.jsx)("div",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400 z-10 group-hover:text-slate-300 transition-colors pointer-events-none",children:(0,a.jsx)(i,{size:18})}),(0,a.jsx)("input",{type:m,className:(0,E.cn)("flex w-full rounded-lg border border-slate-600/50 bg-slate-700/50 pl-12 pr-10 text-[15px] text-white ring-offset-slate-950 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-500/50 focus-visible:border-cyan-500/50 disabled:cursor-not-allowed disabled:opacity-50 transition-colors hover:border-slate-500/50",c?"h-10":"h-12 md:h-[52px]"),value:h,onChange:e=>{let t=e.target.value;x(t),t.length>0&&!g&&p(!0),0===t.length&&g&&p(!1)},onFocus:()=>{h.length>0&&p(!0)},onClick:()=>{h.length>0&&p(!0)},required:d,autoComplete:"off"}),(0,a.jsx)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1.5",children:_&&(0,a.jsx)(u.A,{size:16,className:"text-cyan-500 animate-spin"})})]})}),(0,a.jsx)(L.hl,{className:"p-0 w-[var(--radix-popover-trigger-width)] bg-slate-800 border-slate-700",align:"start",sideOffset:5,onOpenAutoFocus:e=>e.preventDefault(),children:(0,a.jsx)(I.uB,{className:"bg-transparent border-none",shouldFilter:!1,children:(0,a.jsxs)(I.oI,{className:"max-h-[300px] overflow-y-auto custom-scrollbar",children:[f&&0===j.length&&(0,a.jsxs)("div",{className:"py-4 text-center text-slate-400 text-sm flex items-center justify-center gap-2",children:[(0,a.jsx)(u.A,{size:16,className:"animate-spin text-cyan-500"}),"S\xf6ker..."]}),!f&&0===j.length&&h.length>0&&(0,a.jsxs)(I.xL,{className:"py-4 text-center text-slate-400 text-sm",children:['Inga tr\xe4ffar f\xf6r "',h,'"']}),(0,a.jsx)(I.L$,{children:j.map(e=>(0,a.jsxs)(I.h_,{value:"".concat(e.name," ").concat(e.company_name||""," ").concat(e.email||""," ").concat(e.phone||""),onSelect:()=>k(e),className:"flex items-center gap-3 p-3 cursor-pointer data-[selected=true]:bg-slate-700/70 border-b border-slate-700/50 last:border-0 transition-colors",children:[(0,a.jsx)("div",{className:(0,E.cn)("p-1.5 rounded-md shrink-0",e.company_name?"bg-cyan-500/10":"bg-blue-500/10"),children:e.company_name?(0,a.jsx)(q.A,{size:14,className:"text-cyan-400"}):(0,a.jsx)(C.A,{size:14,className:"text-blue-400"})}),(0,a.jsx)("span",{className:"font-medium text-slate-100 truncate",children:e.company_name?"".concat(e.company_name," (").concat(e.name,")"):e.name}),e.is_internal&&(0,a.jsx)("span",{className:"ml-auto text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-500 border border-amber-500/30 uppercase font-bold tracking-tight shrink-0",children:"Intern"})]},e.id))})]})})})]})]})});var B=l(76600);let J=e=>
1{var t,l,n,r,o,i,d,c,u,m,g,p,h,x,b,v,f,_,y,k,E,I,L,P,J,V,O,H,U,$,W,Y,G,K,X,Q,Z,ee,et,el,ea,es,en,er;let{data:eo,onDataChange:ei,onDataChangeMultiple:ed,showCompanyField:ec,companyNameRef:eu,noCard:em,hideHeader:eg=!1,compactInputs:ep=!1,showMoveDate:eh=!1,moveDate:ex,onMoveDateChange:eb,verticalLayout:ev=!1,showCustomerSearch:ef=!1}=e,{dictionary:e_}=(0,N.o)(),ey=s.useId(),ej=ex?new Date(ex):null,ek=(e,t)=>"string"==typeof e?e:t,eN=(0,a.jsxs)(a.Fragment,{children:[!eg&&(0,a.jsxs)("h2",{className:"text-lg font-bold text-white mb-2 flex items-center gap-2",children:[(0,a.jsx)(w,{size:20,className:"text-blue-400"}),ek(null==e_||null==(r=e_.jobs)||null==(n=r.details)||null==(l=n.jobForm)||null==(t=l.contact)?void 0:t.title,"Contact Information")]}),(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{className:ev?"flex flex-col gap-3":"grid grid-cols-1 gap-x-4 gap-y-5 md:grid-cols-2 lg:grid-cols-3",children:[ef?(0,a.jsx)(z,{icon:C.A,label:ek(null==e_||null==(c=e_.jobs)||null==(d=c.details)||null==(i=d.jobForm)||null==(o=i.contact)?void 0:o.name,"Name"),field:"customer_name",value:eo.customer_name,onDataChange:ei,onDataChangeMultiple:ed,required:!0,compact:ep}):(0,a.jsx)(R.A,{icon:C.A,label:ek(null==e_||null==(p=e_.jobs)||null==(g=p.details)||null==(m
1=g.jobForm)||null==(u=m.contact)?void 0:u.name,"Name"),id:"customer_name",value:eo.customer_name,onChange:e=>ei("customer_name",e.target.value),required:!0,compact:ep,inputClassName:"h-12 md:h-[52px]"}),ef?(0,a.jsx)(z,{icon:A.A,label:ek(null==e_||null==(v=e_.jobs)||null==(b=v.details)||null==(x=b.jobForm)||null==(h=x.contact)?void 0:h.phone,"Phone"),field:"customer_phone",type:"tel",value:eo.customer_phone||"",onDataChange:ei,onDataChangeMultiple:ed,compact:ep}):(0,a.jsx)(R.A,{icon:A.A,label:ek(null==e_||null==(k=e_.jobs)||null==(y=k.details)||null==(_=y.jobForm)||null==(f=_.contact)?void 0:f.phone,"Phone"),id:"customer_phone",type:"tel",value:eo.customer_phone||"",onChange:e=>ei("customer_phone",e.target.value),compact:ep,inputClassName:"h-12 md:h-[52px]"}),ef?(0,a.jsx)(z,{icon:S.A,label:ek(null==e_||null==(P=e_.jobs)||null==(L=P.details)||null==(I=L.jobForm)||null==(E=I.contact)?void 0:E.email,"Email"),field:"customer_email",type:"email",value:eo.customer_email,onDataChange:ei,onDataChangeMultiple:ed,required:!0,compact:ep}):(0,a.jsx)(R.A,{icon:S.A,label:ek(null==e_||null==(H=e_.jobs)||null==(O=H.details)||null==(V=O.jobForm)||null==(J=V.contact)?void 0:J.email,"Email"),id:"customer_email",type:"email",value:eo.customer_email,onChange:e=>ei("customer_email",e.target.value),required:!0,compact:ep,inputClassName:"h-12 md:h-[52px]"})]}),ec&&(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-x-4 gap-y-5 md:grid-cols-2",children:[(0,a.jsx)(R.A,{icon:q.A,label:ek(null==e_||null==(Y=e_.jobs)||null==(W=Y.details)||null==($=W.jobForm)||null==(U=$.contact)?void 0:U.company,"Company"),id:"company_name",inputRef:eu,value:eo.company_name||"",onChange:e=>ei("company_name",e.target.value),required:!1,compact:ep,inputClassName:"h-12 md:h-[52px] bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500 ring-offset-slate-950 hover:border-slate-500/50"}),(0,a.jsx)(R.A,{icon:M.A,label:ek(null==e_||null==(Q=e_.jobs)||null==(X=Q.details)||null==(K=X.jobForm)||null==(G=K.contact)?void 0:G.partner,"Partner"),id:"partner",value:eo.partner||"",onChange:e=>ei("partner",e.target.value),required:!1,compact:ep,inputClassName:"h-12 md:h-[52px] bg-slate-700/50 border-slate-600/50 text-white placeholder:text-slate-500 ring-offset-slate-950 hover:border-slate-500/50"})]}),eo.discount_code_raw&&(0,a.jsx)(B.G,{code:eo.discount_code_raw,status:eo.discount_code_status,snapshot:eo.discount_code_snapshot,expanded:!0}),eh&&eb&&(0,a.jsxs)("div",{children:[(0,a.jsx)(j.R,{label:ek(null==e_||null==(ee=e_.jobs)||null==(Z=ee.details)?void 0:Z.moveDate,"Flyttdatum"),id:"contact_move_date",date:ej,onDateChange:e=>{if(eb)if(e){let t=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");eb("".concat(t,"-").concat(l,"-").concat(a))}else eb("")},placeholder:"V\xe4lj flyttdatum...",icon:F.A,required:!1,labelClassName:"text-white",forceTheme:"dark",className:"h-12 md:h-[52px] pl-12 text-[15px] bg-slate-700/50 border border-slate-600/50 text-slate-300 hover:border-cyan-500/50 focus:ring-cyan-500/50 focus:border-cyan-500/50"}),e.showMoveRequestedToggle&&e.onMoveDateRequestedToggle&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,a.jsx)(T.S,{id:ey,checked:null==(en=e.isMoveDateRequestedByCustomer)||en,onCheckedChange:t=>{var l;return null==(l=e.onMoveDateRequestedToggle)?void 0:l.call(e,!!t)},className:"h-4 w-4 border-slate-400 data-[state=checked]:bg-cyan-500 data-[state=checked]:border-cyan-300"}),(0,a.jsx)(D.J,{htmlFor:ey,className:"text-xs cursor-pointer ".concat(null==(er=e.isMoveDateRequestedByCustomer)||er?"text-cyan-300":"text-slate-400"),children:ek(null==e_||null==(es=e_.jobs)||null==(ea=es.details)||null==(el=ea.jobForm)||null==(et=el.contact)?void 0:et.customerRequestedDate,"Kundens \xf6nskade datum")})]})]})]})]});return em?(0,a.jsx)("div",{children:eN}):(0,a.jsx)("div",{className:"bg-slate-800/80 rounded-xl p-5 md:p-6 border border-slate-700/80",children:eN})};J.displayName="ContactSection";var V=l(19574),O=l(34157),H=l(26617),U=l(46994),$=l(91169),W=l(60952),Y=l(69181),G=l(76731),K=l(53873),X=l(22458),Q=l(75609),Z=l(64545),ee=l(17910),et=l(11047),el=l(57174),ea=l(45345),es=l(5917),en=l(24033),er=l(42529),eo=l(75036),ei=l(39137),ed=l(53943),ec=l(18957),eu=l(95847);let em={[eu.UN]:x.A,[eu.kC]:x.A,[eu.XQ]:O.A,[eu.Mn]:H.A,[eu.OP]:U.A,[eu.n6]:$.A,[eu.bt]:W.A},eg=(e,t)=>{var l,a,s;if(e===eu.bt)return"Materialleverans";if(e===eu.UN||e===eu.kC)return(0,eu.VD)(e);let n=null==t||null==(s=t.jobs)||null==(a=s.bookingRequest)||null==(l=a.services)?void 0:l[e];
1if("string"==typeof n)return n;if(n&&"object"==typeof n){if("string"==typeof n.label)return n.label;if("string"==typeof n.name)return n.name}return e},ep={[eu.UN]:{grad:"from-blue-900/40 to-cyan-900/40",border:"border-blue-600/50 hover:border-blue-500/70",iconBg:"bg-blue-500/20",icon:"text-blue-400"},[eu.kC]:{grad:"from-blue-900/40 to-cyan-900/40",border:"border-blue-600/50 hover:border-blue-500/70",iconBg:"bg-blue-500/20",icon:"text-blue-400"},[eu.OP]:{grad:"from-indigo-900/40 to-indigo-800/40",border:"border-indigo-600/50 hover:border-indigo-500/70",iconBg:"bg-indigo-500/20",icon:"text-indigo-400"},[eu.XQ]:{grad:"from-emerald-900/40 to-lime-900/40",border:"border-emerald-600/50 hover:border-emerald-500/70",iconBg:"bg-emerald-500/20",icon:"text-emerald-400"},[eu.Mn]:{grad:"from-amber-900/40 to-yellow-900/40",border:"border-amber-600/50 hover:border-amber-500/70",iconBg:"bg-amber-500/20",icon:"text-amber-400"},[eu.n6]:{grad:"from-fuchsia-900/40 to-fuchsia-800/40",border:"border-fuchsia-500/50 hover:border-fuchsia-400/70",iconBg:"bg-fuchsia-500/20",icon:"text-fuchsia-400"},[eu.bt]:{grad:"from-cyan-900/40 to-sky-900/40",border:"border-cyan-600/50 hover:border-cyan-500/70",iconBg:"bg-cyan-500/20",icon:"text-cyan-300"}},eh=[eo.X3,"tippen","tunglyft_gt100kg","service_bil","filt","flyttlada","soppasar"],ex=[eo.X3,"garderob_kartong","packpapper","golvskydd","markningsetiketter","tejp",ec.oA],eb=[eu.UN,eu.OP,eu.bt];eu.XQ,eu.Mn,eu.n6;let ev=e=>{let{placeholder:t,options:l,optionsMoving:n,optionsPacking:o,selectedValues:i,onToggle:d,className:c="",commitOnClose:u=!1,onCommit:m,dynamicDisable:g}=e,p=Array.isArray(n)&&Array.isArray(o)&&(n.length>0||o.length>0),h=e=>{let t=u?v:i,l=t.includes(e.id),s=!!g&&g(e.id,t),n=e.disabled||s,r=e.icon;return(0,a.jsxs)("button",{type:"button",onClick:()=>{n||(u?f(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id]):d(e.id))},disabled:n,className:"w-full flex items-center gap-3 px-4 py-3 text-left transition-colors duration-75 first:rounded-t-lg last:rounded-b-lg ".concat(n?"opacity-40 cursor-not-allowed":"hover:bg-slate-800/80 active:bg-slate-700/80 cursor-pointer"),children:[l?(0,a.jsx)(es.A,{size:16,className:"text-green-400 flex-shrink-0"}):(0,a.jsx)("div",{className:"w-4 h-4 flex-shrink-0"}),r&&(0,a.jsx)(r,{size:16,className:"flex-shrink-0 ".concat(n?"text-slate-600":"text-slate-400")}),(0,a.jsx)("span",{className:n?"text-slate-500":"text-white",children:e.name})]},e.id)},[x,b]=(0,s.useState)(!1),[v,f]=(0,s.useState)(i),_=(0,s.useRef)(null),y=(0,s.useRef)(null),j=()=>{if(!_.current||!y.current)return;let e=(e=>{let t=null==e?void 0:e.parentElement;for(;t;){let e=window.getComputedStyle(t);if(("auto"===e.overflowY||"scroll"===e.overflowY)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return document.scrollingElement||document.documentElement})(_.current),t=e.getBoundingClientRect(),l=y.current.getBoundingClientRect().bottom+24-t.bottom;l>0&&e.scrollTo({top:e.scrollTop+l,behavior:"auto"})};(0,s.useEffect)(()=>{x&&u&&f(i)},[x,u,i]),(0,s.useEffect)(()=>{if(!x)return;let e=requestAnimationFrame(()=>{j(),requestAnimationFrame(j)});return()=>cancelAnimationFrame(e)},[x]),(0,s.useEffect)(()=>{let e=e=>{let t=e.target;if(x&&_.current&&!_.current.contains(t)){try{u&&m&&m(v)}catch(e){console.error("Dropdown commit error:",e)}b(!1)}};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x,u,m,v]);let k=x&&(0,a.jsx)("div",{ref:y,className:"mt-2 w-full bg-slate-900 border border-slate-700/70 rounded-lg overflow-hidden flex",children:p?(0,a.jsxs)("div",{className:"grid grid-cols-2 w-full min-w-0 overflow-hidden",children:[(0,a.jsx)("div",{className:"overflow-y-auto border-r border-slate-700/70 overscroll-contain touch-pan-y max-h-[420px] bg-slate-900",children:(n||[]).map(e=>h(e))}),(0,a.jsx)("div",{className:"overflow-y-auto overscroll-contain touch-pan-y max-h-[420px] bg-slate-900",children:(o||[]).map(e=>h(e))})]}):(0,a.jsx)("div",{className:"overflow-y-auto w-full overscroll-contain touch-pan-y max-h-[420px] bg-slate-900",children:l.map(e=>h(e))})});return(0,a.jsxs)("div",{className:"relative ".concat(c),ref:_,children:[(0,a.jsxs)("button",{type:"button",onMouseDown:e=>{e.stopPropagation()},onClick:()=>
1{if(x){try{u&&m&&m(v)}catch(e){console.error("Dropdown commit error:",e)}b(!1)}else b(!0)},className:"w-full flex items-center justify-between px-4 py-3 bg-slate-900/80 border border-slate-700/70 rounded-lg text-left text-gray-300 hover:bg-slate-800/90 hover:border-slate-600/80 transition-colors duration-100 focus:outline-none focus:ring-0 active:scale-[0.99]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r.A,{size:16,className:"text-slate-400"}),(0,a.jsx)("span",{children:t})]}),(0,a.jsx)(en.A,{size:16,className:"text-slate-400 transition-transform duration-200 ".concat(x?"rotate-180":"")})]}),k]})},ef=(0,s.forwardRef)((e,t)=>{var l,n,o,d,c,u,m,g,p,b,v,f,_,y,j,k;let{services:w,additionalServices:C,availableServices:A,onServicesChange:S,onAdditionalServicesChange:q,showMainServices:M=!0,hideIds:F=[],colorClass:R="text-blue-400"}=e,T=e=>Array.from(new Set(e.map(e=>e===eu.kC?eu.UN:e).filter(Boolean))),D=(0,s.useRef)(null),{dictionary:E}=(0,N.o)(),I=(e=>{var t,l,a,s,n,r,o,d,c,u,m,g,p,h,b,v,f,_,y,j,k,N,w,C,A,S,q,M,F,R,T,D,E,I,L,P,z,B,J,V,O,U,$,W,es,en,er,ei,ed,eu,em,eg,ep,eh,ex,eb,ev,ef,e_,ey,ej,ek,eN,ew,eC;return[{id:eo.X3,name:(null==e||null==(n=e.jobs)||null==(s=n.bookingRequest)||null==(a=s.additionalInfo)||null==(l=a.additionalServices)||null==(t=l.options)?void 0:t[eo.X3])||"Hantverk",icon:Y.A},{id:"tippen",name:(null==e||null==(u=e.jobs)||null==(c=u.bookingRequest)||null==(d=c.additionalInfo)||null==(o=d.additionalServices)||null==(r=o.options)?void 0:r.tippen)||"Tur till tippen",icon:i.A},{id:"tunglyft_gt100kg",name:(null==e||null==(b=e.jobs)||null==(h=b.bookingRequest)||null==(p=h.additionalInfo)||null==(g=p.additionalServices)||null==(m
1=g.options)?void 0:m.tunglyft_gt100kg)||"Tunglyft (>100kg)",icon:G.A},{id:"garderob_kartong",name:(null==e||null==(j=e.jobs)||null==(y=j.bookingRequest)||null==(_=y.additionalInfo)||null==(f=_.additionalServices)||null==(v=f.options)?void 0:v.garderob_kartong)||"Garderob kartong",icon:K.A},{id:"packpapper",name:(null==e||null==(A=e.jobs)||null==(C=A.bookingRequest)||null==(w=C.additionalInfo)||null==(N=w.additionalServices)||null==(k=N.options)?void 0:k.packpapper)||"Packpapper",icon:X.A},{id:"soppasar",name:(null==e||null==(R=e.jobs)||null==(F=R.bookingRequest)||null==(M=F.additionalInfo)||null==(q=M.additionalServices)||null==(S=q.options)?void 0:S.soppasar)||"Sopp\xe5sar",icon:Q.A},{id:"service_bil",name:(null==e||null==(L=e.jobs)||null==(I=L.bookingRequest)||null==(E=I.additionalInfo)||null==(D=E.additionalServices)||null==(T=D.options)?void 0:T.service_bil)||"Service bil",icon:x.A},{id:"filt",name:(null==e||null==(V=e.jobs)||null==(J=V.bookingRequest)||null==(B=J.additionalInfo)||null==(z=B.additionalServices)||null==(P=z.options)?void 0:P.filt)||"Filt",icon:Z.A},{id:"flyttlada",name:(null==e||null==(es=e.jobs)||null==(W=es.bookingRequest)||null==($=W.additionalInfo)||null==(U=$.additionalServices)||null==(O=U.options)?void 0:O.flyttlada)||"Flyttl\xe5da",icon:H.A},{id:"golvskydd",name:(null==e||null==(eu=e.jobs)||null==(ed=eu.bookingRequest)||null==(ei=ed.additionalInfo)||null==(er=ei.additionalServices)||null==(en=er.options)?void 0:en.golvskydd)||"Golvskydd",icon:ee.A},{id:"markningsetiketter",name:(null==e||null==(ex=e.jobs)||null==(eh=ex.bookingRequest)||null==(ep=eh.additionalInfo)||null==(eg=ep.additionalServices)||null==(em=eg.options)?void 0:em.markningsetiketter)||"M\xe4rkningsetiketter",icon:et.A},{id:"tejp",name:(null==e||null==(ey=e.jobs)||null==(e_=ey.bookingRequest)||null==(ef=e_.additionalInfo)||null==(ev=ef.additionalServices)||null==(eb=ev.options)?void 0:eb.tejp)||"Tejp",icon:el.A},{id:ec.oA,name:(null==e||null==(eC=e.jobs)||null==(ew=eC.bookingRequest)||null==(eN=ew.additionalInfo)||null==(ek=eN.additionalServices)||null==(ej=ek.options)?void 0:ej[ec.oA])||"\xd6vrigt",icon:ea.A}]})(E).filter(e=>!F.includes(e.id)&&(e.id!==eo.X3||w.some(e=>e===eu.UN||e===eu.kC||e===eu.n6||e===eu.Mn))),L=I.filter(e=>eh.includes(e.id)&&(e.id!==eo.X3||!w.includes(eu.Mn))),P=new Set(L.map(e=>{let{id:t}=e;return t})),z=I.filter(e=>{let{id:t}=e;return ex.includes(t)&&!P.has(t)}),B=s.useMemo(()=>C.map(e=>(0,ed.nj)(e)?e.split(":")[0]:(0,ei.oM)(e)?ei.GY:(0,ec.dd)(e)?ec.oA:e),[C]),J=e=>{let t=e===eu.kC?eu.UN:e,l=T(w);S(T(l.includes(t)?l.filter(e=>e!==t):[...l,t]))},V=e=>{q((0,ed.I5)(e)?(0,ed.jZ)(C,e):e===ec.oA?C.filter(e=>!(0,ec.dd)(e)):C.filter(t=>t!==e))},O=eu.Yl,U=Array.isArray(A)&&A.length>0?A:O,$=T(w);return(0,a.jsx)("div",{ref:t,className:"relative z-20 pb-4",style:{overflowAnchor:"auto"},children:(0,a.jsxs)("div",{className:"grid grid-cols-1 ".concat(M?"lg:grid-cols-2":"lg:grid-cols-1"," gap-6"),children:[M&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[(0,a.jsx)(er.A,{size:20,className:"text-blue-400"}),(null==E||null==(d=E.jobs)||null==(o=d.bookingRequest)||null==(n=o.additionalInfo)||null==(l=n.mainServices)?void 0:l.label)||"Huvudtj\xe4nster *"]}),(0,a.jsx)("div",{className:"relative",style:{zIndex:1e3},ref:D,children:(0,a.jsx)(ev,{placeholder:(null==E||null==(g=E.jobs)||null==(m
1=g.bookingRequest)||null==(u=m.additionalInfo)||null==(c=u.mainServices)?void 0:c.placeholder)||"V\xe4lj tj\xe4nster...",options:[],optionsMoving:U.filter(e=>eb.includes(e)).map(e=>({id:e,name:eg(e,E),icon:em[e],disabled:!1})),optionsPacking:U.filter(e=>!eb.includes(e)).map(e=>({id:e,name:eg(e,E),icon:em[e],disabled:!1})),selectedValues:$,onToggle:J,commitOnClose:!0,onCommit:e=>{S(T(e))}})}),$.length>0&&(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mt-4",children:$.map(e=>{var t;let l=em[e]||H.A,s=eg(e,E),n=ep[e]||ep[eu.UN];return(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-xl bg-gradient-to-r ".concat(n.grad," border-2 ").concat(n.border," transition-colors duration-150"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-1.5 rounded-lg ".concat(n.iconBg),children:(0,a.jsx)(l,{className:"h-5 w-5 ".concat(n.icon)})}),(0,a.jsx)("span",{className:"font-bold text-base text-white",children:s})]}),(0,a.jsx)("button",{type:"button",onClick:()=>J(e),className:"p-1 rounded-full text-slate-400 hover:bg-red-500/20 hover:text-red-400 transition-colors duration-200","aria-label":(null==E||null==(t=E.common)?void 0:t.remove)||"Ta bort",children:(0,a.jsx)(h.A,{size:14})})]},e)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[(0,a.jsx)(r.A,{size:20,className:R}),(null==E||null==(f=E.jobs)||null==(v=f.bookingRequest)||null==(b=v.additionalInfo)||null==(p=b.additionalServices)?void 0:p.label)||"Till\xe4ggstj\xe4nster (Valfritt)"]}),(0,a.jsx)("div",{className:"relative w-full",style:{zIndex:1e3},children:(0,a.jsx)(ev,{placeholder:(null==E||null==(k=E.jobs)||null==(j=k.bookingRequest)||null==(y=j.additionalInfo)||null==(_=y.additionalServices)?void 0:_.placeholder)||"V\xe4lj till\xe4ggstj\xe4nster...",options:I,optionsMoving:L,optionsPacking:z,selectedValues:B,onToggle:e=>{B.includes(e)?V(e):q([...C,e])},commitOnClose:!0,onCommit:e=>{let t=ed.ST.filter(t=>e.includes(t)),l=e.includes(ec.oA),a=e.filter(e=>!(0,ed.I5)(e)&&e!==ec.oA),s=C.filter(e=>(0,ec.dd)(e));q([...a,...t.reduce((e,t)=>{let l=(0,ed.E)(C,t);return(0,ed.$b)(e,t,l>0?l:1)},[]),...l?s.length>0?s:[(0,ec.ZF)()]:[]])}})}),C.length>0&&(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mt-4",children:Array.from(new Set(B)).map(e=>{var t;let l=I.find(t=>t.id===e);return l?(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-slate-900/60 border border-indigo-600/30 hover:border-indigo-500/50 transition-colors duration-150",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(l.icon,{className:"h-5 w-5 flex-shrink-0 "+R}),(0,a.jsx)("span",{className:"font-medium text-white",children:l.name})]}),(0,a.jsx)("button",{type:"button",onClick:()=>V(l.id),className:"p-1 rounded-full text-slate-400 hover:bg-red-500/20 hover:text-red-400 transition-colors duration-200","aria-label":(null==E||null==(t=E.common)?void 0:t.remove)||"Ta bort till\xe4ggstj\xe4nst",children:(0,a.jsx)(h.A,{size:14})})]},l.id):null})})]})]})})});ef.displayName="AdditionalInfo";var e_=l(31719),ey=l(24882);let ej=e=>(0,a.jsx)(e_.toq,{...e,className:"".concat(e.className||""," rotate-180")}),ek=(0,s.forwardRef)((e,t)=>{var l,n,r,o,i,d,c,u;let{title:m,address:g,date:p,squareMeters:x,onAddressChange:b,onDateChange:v,onSquareMetersChange:f,noCard:_,isCompany:y,onCompanyChange:k,showCompanyToggle:w=!1,isRequestedByCustomer:C,onRequestedToggle:A,onRemove:S}=e,{dictionary:q}=(0,N.o)(),M=s.useId(),E=s.useId(),I=p?new Date(p):null,L=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between ".concat(_?"mb-2":"mb-4"),children:[(0,a.jsxs)("h2",{className:"text-lg font-bold text-white flex items-center gap-2",children:[(0,a.jsx)(O.A,{size:20,className:"text-green-400"}),m||(null==q||null==(o=q.jobs)||null==(r=o.details)||null==(n=r.jobForm)||null==(l=n.cleaning)?void 0:l.title)||"St\xe4ddetaljer"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[S&&(0,a.jsx)("button",{type:"button",onClick:S,className:"p-1 rounded-full text-slate-400 hover:bg-red-500/20 hover:text-red-400 transition-colors","aria-label":"Ta bort",children:(0,a.jsx)(h.A,{size:14})}),w&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(T.S,{id:"cleaning_company_".concat(M),checked:!!y,onCheckedChange:e=>k&&k(!!e)}),(0,a.jsx)(D.J,{htmlFor:"cleaning_company_".concat(M),className:"text-sm text-slate-300",children:"F\xf6retagspris"})]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-x-4 gap-y-5 md:grid-cols-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)(j.R,{label:"St\xe4ddatum",id:"cleaning_date_".concat(M),date:I,onDateChange:e=>{if(e){let t=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");v("".concat(t,"-").concat(l,"-").concat(a))}else v(null)},placeholder:"V\xe4lj st\xe4ddatum...",icon:F.A,className:"h-12 md:h-[52px] pl-12 text-[15px] bg-slate-700/50 border border-slate-600/50 text-slate-300 hover:border-cyan-500/50 focus:ring-cyan-500/50 focus:border-cyan-500/50"}),A&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,a.jsx)(T.S,{id:E,checked:null==C||C,onCheckedChange:e=>A(!!e),className:"h-4 w-4 border-slate-400 data-[state=checked]:bg-cyan-500 data-[state=checked]:border-cyan-300"}),(0,a.jsx)(D.J,{htmlFor:E,className:"text-xs cursor-pointer ".concat(null==C||C?"text-cyan-300":"text-slate-400"),children:"Kundens \xf6nskade datum"})]})]}),(0,a.jsx)("div",{className:"min-w-0",children:(0,a.jsx)(ey.GoogleMapsAutocomplete,{label:"St\xe4dadress",value:g,onChange:e=>b(e),placeholder:"",className:"w-full",inputClassName:"h-12 md:h-[52px]"})}),(0,a.jsx)("div",{className:"min-w-0",children:(0,a.jsx)(R.A,{icon:ej,label:(null==q||null==(u=q.jobs)||null==(c=u.details)||null==(d=c.jobForm)||null==(i=d.cleaning)?void 0:i.areaLabel)||"Yta (m\xb2)",id:"cleaning_square_meters_".concat(M),type:"number",min:"0",inputClassName:"h-12 md:h-[52px]",value:String(null!=x?x:""),onChange:e=>f(e.target.value)})})]})]});return _?(0,a.jsx)("div",{ref:t,children:L}):(0,a.jsx)("div",{ref:t,className:"bg-slate-800/80 rounded-xl p-4 md:p-6 border border-slate-700/80",children:L})});ek.displayName="CleaningDetails";var eN=l(11186),ew=l(7217),eC=l(93341);let eA=(0,s.forwardRef)((e,t)=>
1{var l,n,r,o,i,d,c,u,m,g,p,x,b,v,f,_,y,k,w,C,A,S,q,M,E,I,L,P,z,B,J,V,O,U,$,W;let{title:Y,address:G,packingDate:K,packingLevel:X,squareMeters:Q,onAddressChange:Z,onPackingDateChange:ee,onPackingLevelChange:et,onSquareMetersChange:el,isCompany:ea,onCompanyChange:es,showCompanyToggle:en=!1,isRequestedByCustomer:er,onRequestedToggle:eo,onRemove:ei}=e,{dictionary:ed}=(0,N.o)(),ec=s.useId(),eu=s.useId(),em=[{value:"full",label:(null==ed||null==(o=ed.jobs)||null==(r=o.details)||null==(n=r.jobForm)||null==(l=n.packing)?void 0:l.full)||"Fullst\xe4ndig packning"},{value:"kitchen",label:(null==ed||null==(u=ed.jobs)||null==(c=u.details)||null==(d=c.jobForm)||null==(i=d.packing)?void 0:i.kitchen)||"Endast k\xf6k"},{value:"fragiles",label:(null==ed||null==(x=ed.jobs)||null==(p=x.details)||null==(g=p.jobForm)||null==(m=g.packing)?void 0:m.fragiles)||"Endast \xf6mt\xe5ligt"}],eg=s.useMemo(()=>{if(!K)return null;let e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(K));if(e)return new Date(Number(e[1]),Number(e[2])-1,Number(e[3]));let t=new Date(K);return Number.isNaN(t.getTime())?null:t},[K]);return(0,a.jsxs)("div",{ref:t,className:"bg-slate-800/80 rounded-xl p-4 md:p-6 border border-slate-700/80",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-bold text-white flex items-center gap-2",children:[(0,a.jsx)(H.A,{size:20,className:"text-orange-400"}),Y||(null==ed||null==(_=ed.jobs)||null==(f=_.details)||null==(v=f.jobForm)||null==(b=v.packing)?void 0:b.title)||"Packningsdetaljer"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[ei&&(0,a.jsx)("button",{type:"button",onClick:ei,className:"p-1 rounded-full text-slate-400 hover:bg-red-500/20 hover:text-red-400 transition-colors","aria-label":"Ta bort",children:(0,a.jsx)(h.A,{size:14})}),en&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(T.S,{id:"packing_company_".concat(ec),checked:!!ea,onCheckedChange:e=>es&&es(!!e)}),(0,a.jsx)(D.J,{htmlFor:"packing_company_".concat(ec),className:"text-sm text-slate-300",children:"F\xf6retagspris"})]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(j.R,{label:(null==ed||null==(C=ed.jobs)||null==(w=C.details)||null==(k=w.jobForm)||null==(y=k.packing)?void 0:y.dateLabel)||"Packningsdatum",id:"packing_date_".concat(ec),date:eg,onDateChange:e=>{if(e){let t=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");ee("".concat(t,"-").concat(l,"-").concat(a))}else ee("")},placeholder:"V\xe4lj packningsdatum...",icon:F.A,className:"h-12 md:h-[52px] pl-12 text-[15px] bg-slate-700/50 hover:bg-slate-600/50 border border-slate-600/50 text-slate-300 focus:ring-cyan-500/50 focus:border-cyan-500/50"}),eo&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,a.jsx)(T.S,{id:eu,checked:null==er||er,onCheckedChange:e=>eo(!!e),className:"h-4 w-4 border-slate-400 data-[state=checked]:bg-cyan-500 data-[state=checked]:border-cyan-300"}),(0,a.jsx)(D.J,{htmlFor:eu,className:"text-xs cursor-pointer ".concat(null==er||er?"text-cyan-300":"text-slate-400"),children:"Kundens \xf6nskade datum"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-300 mb-1",children:(null==ed||null==(M=ed.jobs)||null==(q=M.details)||null==(S=q.jobForm)||null==(A=S.packing)?void 0:A.levelLabel)||"Packningsniv\xe5"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 z-10",children:(0,a.jsx)(H.A,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})}),(0,a.jsxs)(eN.l6,{value:X||"",onValueChange:e=>et(e||null),children:[(0,a.jsx)(eN.bq,{className:"pl-10 h-12 md:h-[52px] bg-slate-700/50 hover:bg-slate-600/50 border border-slate-600/50 text-slate-300 focus-visible:ring-cyan-500/50 focus-visible:border-cyan-500/50",children:(0,a.jsx)(eN.yv,{placeholder:(null==ed||null==(P=ed.jobs)||null==(L=P.details)||null==(I=L.jobForm)||null==(E=I.packing)?void 0:E.selectLevel)||"V\xe4lj niv\xe5..."})}),(0,a.jsx)(eN.gC,{children:em.map(e=>(0,a.jsx)(eN.eb,{value:e.value,children:e.label},e.value))})]})]})]}),(0,a.jsx)("div",{children:(0,a.jsx)(R.A,{icon:ew.A,label:(null==ed||null==(V=ed.jobs)||null==(J=V.details)||null==(B=J.jobForm)||null==(z=B.packing)?void 0:z.squareMetersLabel)||"Yta f\xf6r packning (m\xb2)",id:"packing_square_meters_".concat(ec),type:"number",value:null!=Q?Q:"",inputClassName:"h-12 md:h-[52px]",onChange:e=>el&&el(e.target.value),placeholder:""})})]}),void 0!==G&&(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(R.A,{icon:eC.A,label:(null==ed||null==(W=ed.jobs)||null==($=W.details)||null==(U=$.jobForm)||null==(O=U.packing)?void 0:O.addressLabel)||"Packningsadress",id:"packing_address_".concat(ec),type:"text",value:G||"",inputClassName:"h-12 md:h-[52px]",onChange:e=>Z&&Z(e.target.value),placeholder:""})})]})});eA.displayName="PackingDetails";let eS=(0,s.forwardRef)((e,t)=>
1{var l,n,r,o,i,d,c,u;let{title:m,address:g,date:p,onAddressChange:x,onDateChange:b,hideAddress:v=!1,addressDisabled:f=!1,isRequestedByCustomer:_,onRequestedToggle:y,onRemove:k}=e,{dictionary:w}=(0,N.o)(),C=s.useId(),A=s.useId(),S=p?new Date(p):null;return(0,a.jsxs)("div",{ref:t,className:"bg-slate-800/80 rounded-xl p-4 md:p-6 border border-slate-700/80",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-bold text-white flex items-center gap-2",children:[(0,a.jsx)($.A,{size:20,className:"text-fuchsia-400"}),m||(null==w||null==(o=w.jobs)||null==(r=o.details)||null==(n=r.jobForm)||null==(l=n.express)?void 0:l.title)||"Expressdetaljer"]}),k&&(0,a.jsx)("button",{type:"button",onClick:k,className:"p-1 rounded-full text-slate-400 hover:bg-red-500/20 hover:text-red-400 transition-colors","aria-label":"Ta bort",children:(0,a.jsx)(h.A,{size:14})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 ".concat((()=>{let e=1;return(!v&&e++,1===e)?"md:grid-cols-1":"md:grid-cols-2"})()," gap-x-4 gap-y-5 mb-1"),children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.R,{label:(null==w||null==(d=w.jobs)||null==(i=d.details)?void 0:i.date)||"Datum",id:"express_date_".concat(C),date:S,onDateChange:e=>{if(b)if(e){let t=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");b("".concat(t,"-").concat(l,"-").concat(a))}else b("")},placeholder:"V\xe4lj datum...",icon:F.A,className:"h-12 md:h-[52px] pl-12 text-[15px] bg-slate-700/50 border border-slate-600/50 text-slate-300 hover:border-cyan-500/50 focus:ring-cyan-500/50 focus:border-cyan-500/50"}),y&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,a.jsx)(T.S,{id:A,checked:null==_||_,onCheckedChange:e=>y(!!e),className:"h-4 w-4 border-slate-400 data-[state=checked]:bg-cyan-500 data-[state=checked]:border-cyan-300"}),(0,a.jsx)(D.J,{htmlFor:A,className:"text-xs cursor-pointer ".concat(null==_||_?"text-cyan-300":"text-slate-400"),children:"Kundens \xf6nskade datum"})]})]}),!v&&(0,a.jsx)(ey.GoogleMapsAutocomplete,{label:(null==w||null==(u=w.jobs)||null==(c=u.details)?void 0:c.address)||"Adress",value:g||"",onChange:e=>x&&x(e),placeholder:"Var ska vi hj\xe4lpa till?",disabled:f,className:"w-full",inputClassName:"h-12 md:h-[52px]"})]})]})});eS.displayName="ExpressDetails";var eq=l(95740),eM=l(61362),eF=l(52056),eR=l(78874);let eT=(0,v.A)("calendar-check-2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"bce9hv"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);var eD=l(69152),eE=l(75426),eI=l(33700);let eL={Bohagsflytt:x.A,Företagsflytt:x.A,Flyttstädning:eq.A,Packning:H.A,"Leverans av material":W.A,Magasinering:U.A,Expressarbetare:$.A},eP={Bohagsflytt:"text-blue-400",Företagsflytt:"text-blue-400",Magasinering:"text-violet-400",Flyttstädning:"text-emerald-400",Packning:"text-amber-400","Leverans av material":"text-cyan-400",Expressarbetare:"text-fuchsia-400"},ez=s.memo(e=>{var t,l,n,r,o,d,c,p,v,f,_,y,j,w,C,S,q,M,F,R,T,D,E,I,L,P,z,B;let{contactData:J,fromAddressData:V,toAddressData:O,viaStops:U=[],secondViaStops:W=[],storageOutViaStops:Y=[],secondMoveAddressData:es,storageOutAddressData:en,propertyData:er,cleaningData:eo,packingData:ei,services:ed,additionalServices:eu,notes:em,isCleaningSelected:eg,isStorageSelected:ep,onEdit:eh,onReset:ex,onClose:eb,hideResetButton:ev=!1,isCalculating:ef=!1,compactNotes:e_=!1,disableAnimation:ey=!1,expressData:ej,extraServiceInstances:ek=[],availabilityChecks:eN=[]}=e,{language:ew,dictionary:eC}=(0,N.o)(),eA="sv"===ew?"Meddelande fr\xe5n kontoret":"Message from the office",[eS,ez]=s.useState(!1),[eB,eJ]=s.useState([]),[eV,eO]=s.useState(!1),[eH,eU]=s.useState(null),e$=s.useMemo(()=>(e=>{var t,l,a,s,n,r,o,d,c,u,m,g,p,h,b,v,f,_,y,j,k,N,w,C,A,S,q,M,F,R,T,D,E,I,L,P,z,B,J,V,O,U,$,W,Y,es,en,er,eo,ei,ed,eu,em,eg,ep,eh,ex,eb,ev,ef,e_,ey,ej,ek,eN;return{tippen:{name:(null==e||null==(n=e.jobs)||null==(s=n.bookingRequest)||null==(a=s.additionalInfo)||null==(l=a.additionalServices)||null==(t=l.options)?void 0:t.t
1ippen)||"Tur till tippen",icon:i.A},tunglyft_gt100kg:{name:(null==e||null==(u=e.jobs)||null==(c=u.bookingRequest)||null==(d=c.additionalInfo)||null==(o=d.additionalServices)||null==(r=o.options)?void 0:r.tunglyft_gt100kg)||"Tunglyft (>100kg)",icon:G.A},packpapper:{name:(null==e||null==(b=e.jobs)||null==(h=b.bookingRequest)||null==(p=h.additionalInfo)||null==(g=p.additionalServices)||null==(m=g.options)?void 0:m.packpapper)||"Packpapper",icon:X.A},soppasar:{name:(null==e||null==(j=e.jobs)||null==(y=j.bookingRequest)||null==(_=y.additionalInfo)||null==(f=_.additionalServices)||null==(v=f.options)?void 0:v.soppasar)||"Sopp\xe5sar",icon:Q.A},packpapper_halv:{name:(null==e||null==(A=e.jobs)||null==(C=A.bookingRequest)||null==(w=C.additionalInfo)||null==(N=w.additionalServices)||null==(k=N.options)?void 0:k.packpapper_halv)||"Halv packpapper",icon:X.A},garderob_kartong:{name:(null==e||null==(R=e.jobs)||null==(F=R.bookingRequest)||null==(M=F.additionalInfo)||null==(q=M.additionalServices)||null==(S=q.options)?void 0:S.garderob_kartong)||"Garderob kartong",icon:K.A},filt:{name:(null==e||null==(L=e.jobs)||null==(I=L.bookingRequest)||null==(E=I.additionalInfo)||null==(D=E.additionalServices)||null==(T=D.options)?void 0:T.filt)||"Filt",icon:Z.A},flyttlada:{name:(null==e||null==(V=e.jobs)||null==(J=V.bookingRequest)||null==(B=J.additionalInfo)||null==(z=B.additionalServices)||null==(P=z.options)?void 0:P.flyttlada)||"Flyttl\xe5da",icon:H.A},tejp:{name:(null==e||null==(Y=e.jobs)||null==(W=Y.bookingRequest)||null==($=W.additionalInfo)||null==(U=$.additionalServices)||null==(O=U.options)?void 0:O.tejp)||"Tejp",icon:el.A},service_bil:{name:(null==e||null==(ei=e.jobs)||null==(eo=ei.bookingRequest)||null==(er=eo.additionalInfo)||null==(en=er.additionalServices)||null==(es=en.options)?void 0:es.service_bil)||"Service bil",icon:x.A},golvskydd:{name:(null==e||null==(ep=e.jobs)||null==(eg=ep.bookingRequest)||null==(em=eg.additionalInfo)||null==(eu=em.additionalServices)||null==(ed=eu.options)?void 0:ed.golvskydd)||"Golvskydd",icon:ee.A},markningsetiketter:{name:(null==e||null==(ef=e.jobs)||null==(ev=ef.bookingRequest)||null==(eb=ev.additionalInfo)||null==(ex=eb.additionalServices)||null==(eh=ex.options)?void 0:eh.markningsetiketter)||"M\xe4rkningsetiketter",icon:et.A},[ec.oA]:{name:(null==e||null==(eN=e.jobs)||null==(ek=eN.bookingRequest)||null==(ej=ek.additionalInfo)||null==(ey=ej.additionalServices)||null==(e_=ey.options)?void 0:e_[ec.oA])||"\xd6vrigt",icon:ea.A}}})(eC),[eC]),eW=(null==J?void 0:J.customer_phone)||"",eY=(0,eI.Vf)(eW),eG=(0,eI.tw)(eW),eK=s.useMemo(()=>JSON.stringify(eN.map(e=>({label:e.label,date:e.date,cars:e.cars}))),[eN]),eX=s.useMemo(()=>JSON.parse(eK),[eK]);s.useEffect(()=>{if(0===eX.length){eJ([]),eU(null),eO(!1);return}let e=new AbortController;return async function(){eO(!0),eU(null);try{let t=await fetch("/api/jobs/availability-check",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",signal:e.signal,body:JSON.stringify({checks:eX})}),l=await t.json().catch(()=>({}));if(!t.ok)throw Error((null==l?void 0:l.error)||("sv"===ew?"Kunde inte kontrollera tillg\xe4nglighet":"Could not check availability"));e.signal.aborted||eJ(Array.isArray(null==l?void 0:l.results)?l.results:[])}catch(t){if(e.signal.aborted)return;eJ([]),eU((t instanceof Error?t.message:null)||("sv"===ew?"Kunde inte kontrollera tillg\xe4nglighet":"Could not check availability"))}finally{e.signal.aborted||eO(!1)}}(),()=>e.abort()},[eX,ew]);let eQ=(e,t)=>{var l,s,n;return(null==t?void 0:t.address)?(0,a.jsxs)("a",{href:"https://www.google.com/maps/search/?api=1&query=".concat(encodeURIComponent(t.address)),target:"_blank",rel:"noopener noreferrer",className:"flex flex-col items-center justify-center gap-2 px-6 py-3 rounded-lg bg-slate-800/60 border border-slate-700/50 min-w-[140px] hover:bg-slate-800/80 hover:border-cyan-500/50 transition-colors cursor-pointer",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500 font-medium uppercase tracking-wide",children:e}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-center",children:[(0,a.jsxs)("div",{className:"text-lg font-bold",children:[(0,a.jsx)("span",{className:"text-xs text-slate-500 font-normal",children:(null==eC||null==(l=eC.common)?void 0:l.floor)||"V\xe5n"})," ",(0,a.jsx)("span",{className:(null==t?void 0:t.stairs)&&(null==t?void 0:t.stairs)!=="?"?"text-slate-200":"text-amber-400",children:(null==t?void 0:t.stairs)||"?"})]}),(0,a.jsxs)("div",{className:"text-lg font-bold text-slate-200",children:[(0,a.jsx)("span",{className:"text-xs text-slate-500 font-normal",children:(null==eC||null==(n=eC.jobs)||null==(s=n.details)?void 0:s.elevator)||"Hiss"})," ",(0,a.jsx)("span",{className:(null==t?void 0:t.elevator)===null||(null==t?void 0:t.elevator)===void 0?"text-amber-400":(null==t?void 0:t.elevator)===!1||(null==t?void 0:t.elevator)==="nej"?"text-rose-400":"text-emerald-400",children:(e=>null==e?"?":!0===e||"ja_stor"===e?"Stor":"ja_liten"===e?"Liten":"Nej")(null==t?void 0:t.elevator)})]})]})]}):null},eZ=ed.includes("Expressarbetare")&&!ed.includes("Bohagsflytt")&&!ed.includes("F\xf6retagsflytt")&&!eg&&!ed.includes("Packning"),e0=(null==(t=er.propertyTypeFrom)?void 0:t.toLowerCase())==="office"||(null==(l=er.propertyType)?void 0:l.toLowerCase())==="office",e1=String(em||"").trim(),e2=e1.length>0,e5=s.useMemo(()=>e1.replace(/[=\-]+\s*(?:Meddelande från kontoret|Från kontoret|Message from the office|From the office)\s*[=\-]+/g,'<div style="display:flex;align-items:center;gap:8px;margin:12px 0 4px 0;"><div style="flex:1;height:1px;background:#94a3b8;"></div>'+'<strong style="white-space:nowrap;color:#fbbf24;">'.concat(eA,"</strong>")+'<div style="flex:1;height:1px;background:#94a3b8;"></div></div>').replace(/\n/g,"<br>"),[e1,eA]),e4=()=>{ez(!0),window.setTimeout(()=>ez(!1),1800)},e3=async()=>
1{if(e2)try{await navigator.clipboard.writeText(e1),e4()}catch(t){let e=document.createElement("textarea");e.value=e1,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),e4()}},e6=e=>{if(!e)return null;try{return new Date(e).toLocaleDateString("en"===ew?"en-US":"sv-SE",{weekday:"short",day:"2-digit",month:"short"}).replace(/\.$/,"")}catch(t){return e}},e7=e=>e6(e)||e||"",e8={green:{label:"sv"===ew?"Ser bra ut":"Looks good",icon:eM.A,className:"border-emerald-500/45 bg-emerald-950/35 text-emerald-100",iconClassName:"text-emerald-300",pillClassName:"border-emerald-400/35 bg-emerald-400/10 text-emerald-200"},yellow:{label:"sv"===ew?"Dubbelkolla dagen":"Double-check the day",icon:eF.A,className:"border-amber-500/50 bg-amber-950/35 text-amber-100",iconClassName:"text-amber-300",pillClassName:"border-amber-400/35 bg-amber-400/10 text-amber-200"},red:{label:"sv"===ew?"\xd6ver bilkapacitet":"Over vehicle capacity",icon:eR.A,className:"border-rose-500/55 bg-rose-950/35 text-rose-100",iconClassName:"text-rose-300",pillClassName:"border-rose-400/40 bg-rose-400/10 text-rose-200"}},e9=!eg||ed.includes("Bohagsflytt")||ed.includes("F\xf6retagsflytt")||ed.includes("Packning")||ed.includes("Expressarbetare")?er.squareMeters:eo.squareMeters,te=s.useMemo(()=>ek.reduce((e,t)=>{let l=String((null==t?void 0:t.type)||"");return l&&(e[l]||(e[l]=[])).push(t),e},{}),[ek]),tt=!!es&&!!((null==(n=es.from)?void 0:n.address)||(null==(r=es.to)?void 0:r.address)||es.date),tl="Andra flytten",ta="Magasin ut",ts=!!((null==es||null==(o=es.from)?void 0:o.address)||(null==es||null==(d=es.to)?void 0:d.address)),tn=!!((null==en||null==(c=en.from)?void 0:c.address)||(null==en||null==(p=en.to)?void 0:p.address)),tr=s.useMemo(()=>{let e=(e=>{let t=["Bohagsflytt","F\xf6retagsflytt","Packning","Leverans av material","Flyttst\xe4dning","Magasinering","Expressarbetare"];return[...e].sort((e,l)=>{let a=t.indexOf(e),s=t.indexOf(l);return a>=0&&s>=0?a-s:a>=0?-1:+(s>=0)})})(ed).map(e=>({key:"primary-".concat(e),service:e,name:((e,t)=>{var l,a,s;let n=null==t||null==(s=t.jobs)||null==(a=s.bookingRequest)||null==(l=a.services)?void 0:l[e];return"string"==typeof n?n:(null==n?void 0:n.label)?n.label:(null==n?void 0:n.name)?n.name:e})(e,eC),icon:eL[e]||H.A,iconColor:eP[e]||"text-slate-400",date:(e=>["Bohagsflytt","F\xf6retagsflytt"].includes(e)?er.moveDate||null:"Expressarbetare"===e?(null==ej?void 0:ej.date)||er.moveDate||null:"Flyttst\xe4dning"===e?eo.date||null:"Packning"===e?(null==ei?void 0:ei.date)||null:"Magasinering"===e&&((null==es?void 0:es.date)||er.moveDate)||null)(e)})),t=tt?{key:"second-move",service:tl,name:tl,icon:x.A,iconColor:"text-blue-400",date:(null==es?void 0:es.date)||null}:null,l=e.findIndex(e=>["Bohagsflytt","F\xf6retagsflytt"].includes(e.service));return[...t?l>=0?[...e.slice(0,l+1),t,...e.slice(l+1)]:[t,...e]:e,...["packing","cleaning","express"].flatMap(e=>(te[e]||[]).map((e,t)=>({key:e.id,name:((e,t)=>{switch(e.type){case"packing":return"Packning ".concat(t+2);case"cleaning":return"Flyttst\xe4dning ".concat(t+2);case"express":return"Expressarbetare ".concat(t+2);default:return"Tj\xe4nst ".concat(t+2)}})(e,t),icon:"packing"===e.type?H.A:"cleaning"===e.type?eq.A:$.A,iconColor:"packing"===e.type?"text-amber-400":"cleaning"===e.type?"text-emerald-400":"text-fuchsia-400",date:e.date||null})))]},[ed,eC,er.moveDate,eo.date,null==ei?void 0:ei.date,null==ej?void 0:ej.date,null==es?void 0:es.date,te,tt,tl]),to="inline-flex items-center gap-2 px-6 py-3 border-2 text-base font-semibold rounded-lg transition-colors";return(0,a.jsxs)("div",{className:"relative bg-slate-800/80 rounded-xl border border-slate-700/80 mt-4 flex flex-col flex-1 min-h-0 overflow-hidden p-4 ".concat(ey?"":"transition-colors duration-150"),style:{overflowAnchor:"none"},children:[(0,a.jsxs)("header",{className:"flex flex-wrap justify-between items-center shrink-0 mb-4 pb-3 border-b border-slate-700/50 gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 min-w-0 flex-1",children:[(null==J?void 0:J.customer_name)&&(0,a.jsx)("h2",{className:"text-xl font-bold bg-gradient-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent truncate",children:J.customer_name}),eW&&(0,a.jsxs)("a",{href:"tel:".concat(eG||eW),className:"inline-flex items-center gap-2 text-base text-slate-300 hover:text-cyan-400 transition-colors shrink-0",children:[(0,a.jsx)(A.A,{className:"h-4 w-4 shrink-0"}),eY]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[ex&&!ev&&(0,a.jsxs)("button",{onClick:()=>{!ef&&ex&&(ex(),(0,k.showSuccessToast)("Formul\xe4r \xe5terst\xe4llt","Alla \xe4ndringar har tagits bort."))},className:"".concat(to," border-amber-500/60 text-amber-200 hover:bg-amber-500/20 hover:border-amber-400"),children:[(0,a.jsx)(g.A,{size:18})," ",(null==eC||null==(v=eC.common)?void 0:v.reset)||"Reset"]}),(0,a.jsxs)("button",{"data-role":"summary-edit-toggle",onClick:eh,className:"".concat(to," border-slate-500/60 text-slate-200 hover:bg-slate-500/20 hover:border-slate-400"),children:[(0,a.jsx)(m.A,{size:18})," ",(null==eC||null==(f=eC.common)?void 0:f.edit)||"Edit"]}),eb&&(0,a.jsxs)("button",{onClick:eb,className:"".concat(to," border-slate-500/60 text-slate-200 hover:bg-slate-500/20 hover:border-slate-400"),"aria-label":(null==eC||null==(_=eC.common)?void 0:_.close)||"St\xe4ng",children:[(0,a.jsx)(h.A,{size:18,strokeWidth:2.5}
1)," ",(null==eC||null==(y=eC.common)?void 0:y.close)||"St\xe4ng"]})]})]}),(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto flex flex-col gap-5",children:[(()=>{if(0===eN.length)return null;let e=eB.some(e=>"red"===e.status)?"red":eB.some(e=>"yellow"===e.status)?"yellow":eB.length>0?"green":null,t=e?e8[e]:null,l=eH?"border-amber-500/45 bg-amber-950/35 text-amber-100":eV||!t?"border-slate-700/70 bg-slate-900/45 text-slate-300":t.className,s=(null==t?void 0:t.pillClassName)||"border-slate-600/70 bg-slate-950/40 text-slate-300",n=eB.length>0?Math.min(...eB.map(e=>e.remainingCars)):null;return(0,a.jsxs)("div",{className:"shrink-0 rounded-xl border p-4 md:p-5 ".concat(l),children:[(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold uppercase tracking-widest text-current opacity-80",children:[(0,a.jsx)(eT,{className:"h-4 w-4"}),"sv"===ew?"Tillg\xe4nglighet":"Availability"]}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-semibold ".concat(s),children:[(0,a.jsx)(x.A,{className:"h-3.5 w-3.5"}),9," ","sv"===ew?"bilar":"cars",null!==n&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"opacity-50",children:"\xb7"}),(0,a.jsxs)("span",{children:[n>0?"+".concat(n):n," ","sv"===ew?"kvar":"left"]})]})]})]}),eV?(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(u.A,{className:"h-4 w-4 animate-spin text-cyan-300"}),"sv"===ew?"Kontrollerar valda datum...":"Checking selected dates..."]}):eH?(0,a.jsx)("div",{className:"text-sm",children:"sv"===ew?"Kunde inte kontrollera tillg\xe4nglighet just nu. Du kan fortfarande forts\xe4tta.":"Could not check availability right now. You can still continue."}):eB.length>0?(0,a.jsx)("div",{className:"divide-y divide-white/10",children:eB.map(e=>{let t=e8[e.status],l=t.icon,s=e.hasUntimedJobs&&e.remainingCars>=0,n=s?"sv"===ew?"F\xe5r plats med tidsplanering":"Fits with time planning":t.label,r=e.suggestions.map(e=>"".concat(e7(e.date)," (").concat(e.existingCars,"/").concat(9,")")).join(", ");return(0,a.jsxs)("div",{className:"py-2 first:pt-0 last:pb-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[(0,a.jsx)(l,{className:"h-4 w-4 shrink-0 ".concat(t.iconClassName)}),(0,a.jsx)("span",{className:"font-semibold",children:n}),(0,a.jsxs)("span",{className:"text-sm text-current opacity-80",children:[e.label," \xb7 ",e7(e.date)]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-sm text-current opacity-80",children:[(0,a.jsxs)("span",{children:[e.totalCarsAfterRequest," / ",9," ","sv"===ew?"bilar efter denna f\xf6rfr\xe5gan":"cars after this request"]}),(0,a.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,a.jsxs)("span",{children:[e.existingJobsCount," ","sv"===ew?1===e.existingJobsCount?"flyttjobb inlagt":"flyttjobb inlagda":1===e.existingJobsCount?"move booked":"moves booked"]}),e.supportJobsCount>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{"aria-hidden":"true",children:"\xb7"}),(0,a.jsxs)("span",{children:[e.supportJobsCount," ","sv"===ew?1===e.supportJobsCount?"leverans/h\xe4mtning separat":"leveranser/h\xe4mtningar separat":1===e.supportJobsCount?"delivery/pickup separate":"deliveries/pickups separate"]})]}),e.hasUntimedJobs&&(0,a.jsx)("span",{className:"font-medium opacity-100",children:"sv"===ew?"jobb utan starttid":"job without start time"})]}),s&&(0,a.jsx)("p",{className:"mt-2 text-sm font-medium text-current opacity-90",children:"sv"===ew?"Kapaciteten r\xe4cker om jobben f\xf6rdelas mellan f\xf6rmiddag och eftermiddag.":"Capacity is available when the jobs are split between morning and afternoon."})]}),("yellow"===e.status||"red"===e.status)&&r&&(0,a.jsxs)("p",{className:"mt-2 text-sm text-current opacity-80",children:[(0,a.jsx)("span",{className:"font-semibold opacity-100",children:"sv"===ew?"Alternativ: ":"Alternatives: "}),r]})]},"".concat(e.label,"-").concat(e.date))})}):(0,a.jsx)("div",{className:"text-sm opacity-80",children:"sv"===ew?"Inget flyttdatum att kontrollera.":"No moving date to check."})]})})(),(0,a.jsxs)("div",{className:"shrink-0 rounded-xl border bg-amber-900/25 border-amber-500/50 p-5 md:p-6",children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,a.jsxs)("h3",{className:"text-base font-semibold text-amber-300 flex items-center gap-2",children:[(0,a.jsx)(b.A,{size:20,className:"text-amber-400 shrink-0"}),(null==eC||null==(j=eC.common)?void 0:j.notes)||"Anteckningar"]}),(0,a.jsx)("button",{type:"button",onClick:e3,disabled:!e2,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border transition disabled:cursor-not-allowed disabled:opacity-40 ".concat(eS?"border-emerald-400/50 bg-emerald-400/15 text-emerald-300":"border-amber-400/30 bg-amber-400/10 text-amber-200 hover:bg-amber-400/20 hover:border-amber-300/50 disabled:hover:bg-amber-400/10 disabled:hover:border-amber-400/30"),"aria-label":"sv"===ew?"Kopiera anteckningar":"Copy notes",title:"sv"===ew?"Kopiera anteckningar":"Copy notes",children:eS?(0,a.jsx)(eD.A,{size:17}):(0,a.jsx)(eE.A,{size:17})})]}),e2?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"text-base md:text-lg text-slate-200 leading-relaxed",dangerouslySetInnerHTML:{__html:e5}})}):(0,a.jsx)("p",{className:"text-base text-slate-400 italic",children:"sv"===ew?"Inga anteckningar":"No notes"})]}),(0,a.jsxs)("div",{className:"shrink-0 bg-slate-900/40 rounded-xl border border-slate-700/60 p-5 space-y-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-slate-500 uppercase tracking-widest mb-3 text-center",children:"string"==typeof(null==eC||null==(C=eC.jobs)||null==(w=C.bookingRequest)?void 0:w.services)?null==eC||null==(q=eC.jobs)||null==(S=q.bookingRequest)?void 0:S.services:(null==eC||null==(M=eC.common)?void 0:M.services)||"Tj\xe4nster"}),(0,a.jsx)("div",{className:"".concat(1===tr.length||2===tr.length?"flex justify-center flex-wrap gap-2":"grid gap-2 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3"),children:tr.map((e,t)=>{let l=e.icon;return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 p-3 rounded-lg bg-slate-800/60 border border-slate-700/50 ".concat(1===tr.length||2===tr.length?"w-full sm:w-1/2 lg:w-1/3":""),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,a.jsx)(l,{className:"h-4 w-4 shrink-0 ".concat(e.iconColor)}),(0,a.jsx)("span",{className:"text-base font-medium text-slate-200 truncate",children:e.name})]}),(0,a.jsx)("span",{className:"text-sm text-slate-500 shrink-0",children:e.date?e6(e.date):(0,a.jsx)("span",{className:"text-slate-600",children:"?"})})]},e.key)})}),eu.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap justify-center gap-2 pt-1",children:eu.map((e,t)=>{let l=(0,ec.dd)(e)?ec.oA:e,s=e$[l];return s?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 bg-slate-800/80 text-slate-300 text-sm font-medium px-3 py-1.5 rounded-lg border border-slate-600/60",children:[(0,a.jsx)(s.icon,{className:"h-3.5 w-3.5 text-slate-500 shrink-0"}),l===ec.oA?(0,ec.SD)("en"===ew?"en":"sv"):s.name]},t):null})}),(0,a.jsxs)("div",{className:"flex flex-wrap items-stretch justify-center gap-3 pt-4 border-t border-slate-700/60",children:[(ed.includes("Bohagsflytt")||ed.includes("F\xf6retagsflytt"))&&eQ((null==eC||null==(R=eC.jobs)||null==(F=R.details)?void 0:F.from)||"Fr\xe5n",V),!eZ&&e9&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 px-6 py-3 rounded-lg bg-slate-800/60 border border-slate-700/50 min-w-[140px]",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500 font-medium uppercase tracking-wide",children:e0?"sv"===ew?"Arbetsplatser":"Workstations":(null==eC||null==(D=eC.jobs)||null==(T=D.details)?void 0:T.squareMeters)||"Yta"}),(0,a.jsxs)("p",{className:"text-lg font-bold text-slate-200",children:[e9,e0?"":" m\xb2"]})]}),(ed.includes("Bohagsflytt")||ed.includes("F\xf6retagsflytt"))&&eQ((null==eC||null==(I=eC.jobs)||null==(E=I.details)?void 0:E.to)||"Till",O),eZ&&ej&&(ej.workers||ej.hours)&&(0,a.jsxs)(a.Fragment,{children:[ej.workers&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 px-6 py-3 rounded-lg bg-slate-800/60 border border-slate-700/50 min-w-[140px]",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500 font-medium uppercase tracking-wide",children:(null==eC||null==(P=eC.jobs)||null==(L=P.details)?void 0:L.workers)||"Arbetare"}),(0,a.jsx)("p",{className:"text-lg font-bold text-slate-200",children:ej.workers})]}),ej.hours&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 px-6 py-3 rounded-lg bg-slate-800/60 border border-slate-700/50 min-w-[140px]",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500 font-medium uppercase tracking-wide",children:(null==eC||null==(B=eC.jobs)||null==(z=B.details)?void 0:z.hours)||"Timmar"}),(0,a.jsx)("p",{className:"text-lg font-bold text-slate-200",children:ej.hours})]})]})]}),ts&&(0,a.jsxs)("div",{className:"flex flex-wrap items-stretch justify-center gap-3 pt-3 border-t border-slate-700/60",children:[eQ("".concat(tl," fr\xe5n"),null==es?void 0:es.from),eQ("".concat(tl," till"),null==es?void 0:es.to)]}),tn&&(0,a.jsxs)("div",{className:"flex flex-wrap items-stretch justify-center gap-3 pt-3 border-t border-slate-700/60",children:[eQ("".concat(ta," fr\xe5n"),null==en?void 0:en.from),eQ("".concat(ta," till"),null==en?void 0:en.to)]}),(U.length>0||W.length>0||Y.length>0)&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-slate-700/60",children:[U.length>0&&(0,a.jsxs)("div",{className:"rounded-lg bg-slate-800/50 border border-slate-700/50 px-4 py-3 text-sm text-slate-300",children:[(0,a.jsx)("span",{className:"font-semibold text-slate-200",children:"Via: "}),U.join(" • ")]}),W.length>0&&(0,a.jsxs)("div",{className:"rounded-lg bg-slate-800/50 border border-slate-700/50 px-4 py-3 text-sm text-slate-300",children:[(0,a.jsxs)("span",{className:"font-semibold text-slate-200",children:["Via ","andra flytt",":"," "]}),W.join(" • ")]}),Y.length>0&&(0,a.jsxs)("div",{className:"rounded-lg bg-slate-800/50 border border-slate-700/50 px-4 py-3 text-sm text-slate-300",children:[(0,a.jsxs)("span",{className:"font-semibold text-slate-200",children:["Via ","magasin ut",":"," "]}),Y.join(" • ")]})]})]})]})]})});
1ez.displayName="JobSummaryDisplay";var eB=l(45794),eJ=l(3998),eV=l(96648),eO=l(67909),eH=l(99776),eU=l(86870),e$=l(28811),eW=l(25061);let eY=(0,eO.default)(()=>Promise.resolve().then(l.bind(l,24882)).then(e=>e.GoogleMapsAutocomplete),{loadableGenerated:{webpack:()=>[24882]},ssr:!1,loading:()=>(0,a.jsx)("div",{className:"h-11 rounded bg-slate-700/50 border border-slate-600/50 animate-pulse"})}),eG=function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];for(let e of t){let t=Number(e);if(Number.isFinite(t)&&t>0){let t=Number(e);return!Number.isFinite(t)||t<=0?1:Math.max(1,Math.round(t))}}return 1},eK=(0,s.forwardRef)((e,t)=>{var l,v,w,C,A,S,q,M,F,R,T,D,E,I,L,P,z,B,O,H,U,$,W,Y,G,K,X,Q,Z,ee,et,el,ea,es,en,er,eo,ei,ed,ec,em,eg,ep,eh,ex,eb,ev,e_,ey,ej,eN,ew,eC,eq,eM,eF,eR,eT,eD,eE,eI,eL,eP,eO,eK,eX,eQ,eZ,e0,e1,e2,e5,e4,e3,e6,e7,e8,e9,te,tt,tl,ta,ts,tn,tr,to,ti,td,tc,tu,tm,tg,tp,th,tx,tb,tv,tf,t_,ty,tj,tk,tN,tw,tC,tA,tS,tq,tM,tF,tR,tT,tD,tE,tI,tL,tP,tz,tB;let{data:tJ,onDataChange:tV,onDataChangeMultiple:tO,onReset:tH,onLocalReset:tU,onCalculatePrice:t$,onCancelCalculate:tW,onSubmit:tY,availableServices:tG=[...eu.Yl],isCalculating:tK=!1,isResetting:tX=!1,submitButtonText:tQ,forceEditMode:tZ=!1,isCardExpanded:t0=!0,allowFormCalculation:t1=!0,bookingRequestId:t2,onDistanceCalculationStart:t5,onDistanceCalculationEnd:t4,isDetailsEditingMode:t3=!1,isSavingDetails:t6=!1,hideResetButton:t7=!1,onContinueDetailsEditing:t8,originallyRequestedMoveDate:t9,originallyRequestedCleaningDate:le,originallyRequestedPackingDate:lt,originallyRequestedExpressDate:ll,hideSummaryToggle:la=!1,showCancelInsteadOfReset:ls=!1,onCancelDraft:ln,onUnlock:lr,showCustomerSearch:lo=!1,onClose:li,hideHeader:ld=!1,disableAnimation:lc=!1,communicationMode:lu="offer",onCommunicationModeChange:lm,onPreviewPresentation:lg,isPreparingPresentation:lp=!1,hidePresentationPreviewAction:lh=!1}=e,{dictionary:lx,loading:lb,language:lv}=(0,N.o)(),lf=(0,eH.jE)(),l_="number"==typeof t2?"".concat("bookingJobFormView:").concat(t2):null,[ly,lj]=(0,s.useState)(()=>{if(l_)try{let e=sessionStorage.getItem(l_);if("edit"===e)return!0;if("summary"===e)return!1}catch(e){}return tZ}),[lk,lN]=(0,s.useState)(!1),lw=e=>{if(l_)try{sessionStorage.setItem(l_,e?"edit":"summary")}catch(e){}lj(e)},lC=!!(t9&&tJ.move_date&&t9!==tJ.move_date),lA=!!(le&&tJ.cleaning_date&&le!==tJ.cleaning_date),lS=!!(lt&&tJ.packing_date&&lt!==tJ.packing_date),lq=null!=(em=tJ.express_date)?em:tJ.move_date,lM=!!(ll&&lq&&ll!==lq),lF=s.useRef(!1),lR=s.useRef(!1),lT=s.useRef(!1),lD=s.useRef(!1);(0,s.useEffect)(()=>{lC&&!lF.current&&tV("move_date_is_requested_by_customer",!0),lF.current=lC},[lC,tV]),(0,s.useEffect)(()=>{lA&&!lR.current&&tV("cleaning_date_is_requested_by_customer",!0),lR.current=lA},[lA,tV]),(0,s.useEffect)(()=>{lS&&!lT.current&&tV("packing_date_is_requested_by_customer",!0),lT.current=lS},[lS,tV]),(0,s.useEffect)(()=>{lM&&!lD.current&&tV("express_date_is_requested_by_customer",!0),lD.current=lM},[lM,tV]);let lE=(0,s.useRef)(null),lI=null!=(eg=null==(l=tJ.services)?void 0:l.some(e=>e===eu.UN||e===eu.kC))&&eg,lL=null!=(ep=null==(v=tJ.services)?void 0:v.some(e=>e===eu.XQ))&&ep,lP=null!=(eh=null==(w=tJ.services)?void 0:w.some(e=>e===eu.Mn))&&eh,lz=(ex=null==(C=tJ.services)?void 0:C.some(e=>e===eu.n6),(null==(A=eu.TS.companyInfo)?void 0:A.storageAddress)||null),lB=((null==(S=eu.TS.companyInfo)?void 0:S.storageAddress)||"").trim()||e$.l0,lJ=(0,s.useMemo)(()=>Array.from(new Set([...e$.nZ,lB])),[lB]);(0,s.useEffect)(()=>{tX||lL&&!lI&&!lP&&tJ.cleaning_date&&tJ.cleaning_date!==tJ.move_date&&tV("move_date",tJ.cleaning_date)},[tJ.cleaning_date,lL,lI,lP,tJ.move_date,tV,tX]);let lV=(0,s.useRef)(!1),lO=(0,s.useRef)(!1),lH=(0,s.useRef)(!1),lU=(0,s.useRef)(String(null!=(eb=tJ.square_meters)?eb:"")),l$=(0,s.useRef)(String(null!=(ev=tJ.cleaning_square_meters)?ev:"")),lW=(0,s.useRef)(!1),lY=(0,s.useRef)(!1),lG=s.useCallback(()=>{let e=String(tJ.move_from||"").trim();if(e&&!(0,e$.Ju)(e,lz))return e;let t=String(tJ.move_to||"").trim();return t&&!(0,e$.Ju)(t,lz)?t:e},[lz,tJ.move_from,tJ.move_to]);(0,s.useEffect)(()=>
1{if(tX){lV.current=!1,lO.current=!1,lH.current=!1;return}if(!lL){lV.current=!1;return}let e=lG();e&&!lV.current&&(tJ.cleaning_address||"").trim()!==e&&tV("cleaning_address",e)},[lL,tJ.cleaning_address,lG,tV,tX]),(0,s.useEffect)(()=>{if(tX||!lP){lO.current=!1;return}let e=String(tJ.move_from||"").trim();e&&!lO.current&&String(tJ.packing_address||"").trim()!==e&&tV("packing_address",e)},[lP,tJ.move_from,tJ.packing_address,tV,tX]),(0,s.useEffect)(()=>{var e,t,l,a,s,n,r,o;if(tX){lH.current=!1,lU.current=String(null!=(e=tJ.square_meters)?e:""),l$.current=String(null!=(t=tJ.cleaning_square_meters)?t:"");return}if(!lL){lH.current=!1,lU.current=String(null!=(l=tJ.square_meters)?l:""),l$.current=String(null!=(a=tJ.cleaning_square_meters)?a:"");return}let i=String(null!=(s=tJ.square_meters)?s:""),d=String(null!=(n=tJ.cleaning_square_meters)?n:""),c=lU.current,u=l$.current;!lL||lI||lP?(d!==u&&d!==i&&d!==c?lH.current=!0:(""===d||d===i)&&(lH.current=!1),lH.current||d===i||tV("cleaning_square_meters",null!=(o=tJ.square_meters)?o:"")):(lH.current=!1,d!==i&&tV("cleaning_square_meters",null!=(r=tJ.square_meters)?r:"")),lU.current=i,l$.current=d},[tJ.cleaning_square_meters,tJ.square_meters,lL,lI,lP,tX,tV]),(0,s.useEffect)(()=>{if(!(tJ.services||[]).includes(eu.OP)){lW.current=!1;return}let e=String(tJ.storage_out_from||"").trim();if(e&&(0,e$.Ju)(e,lz)){lW.current=!0;return}lW.current=!0,tV("storage_out_from",lB)},[lz,tJ.services,tJ.storage_out_from,tV,lB]),(0,s.useEffect)(()=>{if(!(tJ.services||[]).includes(eu.OP))return;let e=String(tJ.move_to||"").trim(),t=String(tJ.storage_out_to||"").trim(),l=(0,e$.Ju)(t,lz);if(!e||(0,e$.Ju)(e,lz)){t&&l&&tV("storage_out_to","");return}(!t||l)&&(lY.current=!0,tV("storage_out_to",e)),tV("move_to",lB)},[lz,tJ.move_to,tJ.storage_out_to,tJ.services,tV,lB]);let lK=(0,s.useMemo)(()=>(0,e$.Ju)(tJ.move_to,lz),[tJ.move_to,lz]),lX=(0,s.useMemo)(()=>(0,e$.Ju)(tJ.second_move_from,lz),[tJ.second_move_from,lz]),lQ=(0,s.useMemo)(()=>(0,e$.Ju)(tJ.storage_out_from,lz),[tJ.storage_out_from,lz]);(0,s.useEffect)(()=>{var e,t;if(!lK)return;let l=Number(null!=(e=tJ.stairs_to)?e:0)||0,a=null!=(t=tJ.elevator_to)?t:null;0!==l&&tV("stairs_to",0),"ja_stor"!==a&&tV("elevator_to","ja_stor"),"storage"!==(tJ.property_type_to||"").toLowerCase()&&tV("property_type_to","storage")},[lK,tJ.stairs_to,tJ.elevator_to,tJ.property_type_to,tV]),(0,s.useEffect)(()=>{var e,t;if(!lQ)return;let l=Number(null!=(e=tJ.storage_out_stairs_from)?e:0)||0,a=null!=(t=tJ.storage_out_elevator_from)?t:null;0!==l&&tV("storage_out_stairs_from",0),"ja_stor"!==a&&tV("storage_out_elevator_from","ja_stor")},[lQ,tJ.storage_out_stairs_from,tJ.storage_out_elevator_from,tV]),(0,s.useImperativeHandle)(t,()=>({getFormData:()=>({...tJ})}));let lZ=()=>{if(!tK){tH();try{t2&&window.dispatchEvent(new CustomEvent("booking-request-status-updated",{detail:{id:t2,is_edited:!1}}))}catch(e){}(0,k.showSuccessToast)("Formul\xe4r \xe5terst\xe4llt","Alla \xe4ndringar har tagits bort."),requestAnimationFrame(()=>{if(t2){let e=document.getElementById("request-card-header-".concat(t2))||document.getElementById("request-card-".concat(t2));null==e||e.scrollIntoView({behavior:"auto",block:"start"}),setTimeout(()=>null==e?void 0:e.scrollIntoView({behavior:"auto",block:"start"}),200)}else{var e;null==(e=aP.current)||e.scrollIntoView({behavior:"auto",block:"start"}),setTimeout(()=>{var e;return null==(e=aP.current)?void 0:e.scrollIntoView({behavior:"auto",block:"start"})},200)}})}},l0=JSON.stringify([tJ.move_from,...tJ.route_stops||[],tJ.move_to]),l1=(0,s.useRef)(l0);l1.current=l0;let l2=async(e,t)=>{if(e&&t&&t2)try{var l;let a=(tJ.route_stops||[]).filter(Boolean),s="distance_".concat(e,"_").concat(a.join(">"),"_").concat(t),n=(null==(l=eu.TS.companyInfo)?void 0:l.hqAddress)||"\xd6stermalmstorg 1, 114 42 Stockholm",r=sessionStorage.getItem(s),o="".concat(s,"_duration_min");if(r){let l=parseInt(r),a=parseInt(sessionStorage.getItem(o)||"0"),s=0;if(a>0)s=a/60;else if(l>250){let e=Math.min(4,(l-250)/200);s=8+e}else s=l/50*2;let i="hq_dist_from_".concat(n,"_").concat(e),d="hq_dist_back_".concat(t,"_").concat(n),c=sessionStorage.getItem(i),u=sessionStorage.getItem(d);if(l1.current!==l0)return;let m=(0,eV.U)();if(await m.from("booking_requests").update({distance_km:l,driving_time_hours:Math.round(100*s)/100,...c?{hq_distance_from_km:parseFloat(c)}:{},...u?{hq_distance_back_km:parseFloat(u)}:{}}).eq("id",t2),l1.current!==l0)return;tV("distance_km",l),tV("hq_distance_from_km",c?parseFloat(c):null),tV("hq_distance_back_km",u?parseFloat(u):null),null==t4||t4(l);return}null==t5||t5();let i=0,d=0;try{if(a.length>0){let l=await (0,eU.U)(lf,e,a,t);if(l.error)console.warn("Route distance lookup failed (cached):",l.error),i=0;else{let e=(l.distance||0)/1e3;i=Math.round(e),d=Math.round((l.duration||0)/60)}}else{let l=await (0,eU.t)(lf,e,t);if(l.error)console.warn("Distance lookup failed (cached):",l.error),i=0;else{let e=(l.distance||0)/1e3;i=Math.round(e),d=Math.round((l.duration||0)/60)}}}catch(e){console.warn("Distance calculation failed, proceeding without update:",e),i=0,d=0}i>0&&sessionStorage.setItem(s,i.toString()),sessionStorage.setItem("".concat(s,"_duration_min"),String(d));let c=null,u=null,m="hq_dist_from_".concat(n,"_").concat(e),g="hq_dist_back_".concat(t,"_").concat(n);try{let[l,a]=await Promise.all([(0,eU.t)(lf,n,e),(0,eU.t)(lf,t,n
1)]);!l.error&&Number.isFinite(l.distance)&&(c=Math.round((l.distance||0)/1e3*100)/100,sessionStorage.setItem(m,String(c))),!a.error&&Number.isFinite(a.distance)&&(u=Math.round((a.distance||0)/1e3*100)/100,sessionStorage.setItem(g,String(u)))}catch(e){console.warn("HQ distance calculation failed:",e)}let p=0;if(d>0)p=d/60;else if(i>250){let e=Math.min(4,(i-250)/200);p=8+e}else p=i/50*2;if(l1.current!==l0)return;let h=(0,eV.U)();if(await h.from("booking_requests").update({distance_km:i,driving_time_hours:Math.round(100*p)/100,...null!==c?{hq_distance_from_km:c}:{},...null!==u?{hq_distance_back_km:u}:{}}).eq("id",t2),l1.current!==l0)return;tV("distance_km",i),tV("hq_distance_from_km",c),tV("hq_distance_back_km",u),null==t4||t4(i)}catch(e){console.warn("Failed to update distance in database:",e)}},l5=()=>{let e=tJ.move_from,t=tJ.move_to;e&&t&&l2(e,t)},l4=async e=>{if(e.preventDefault(),!t$||tK)return;let t=[],l={};if(!lL||lI||lP||tJ.cleaning_date||(t.push("cleaning_date"),l.cleaning_date="cleaning_date"),lI&&(tJ.move_from||(t.push("move_from"),l.move_from="move_from"),tJ.move_to||(t.push("move_to"),l.move_to="move_to")),t.length>0){let e={move_date:"flyttdatum",cleaning_date:"st\xe4ddatum",move_from:"fr\xe5n-adress",move_to:"till-adress",square_meters:"kvadratmeter"},s=t.map(t=>e[t]||t).join(", ");(0,k.showErrorToast)("F\xe4lt saknas","Fyll i f\xf6ljande f\xe4lt:\n".concat(s));let n=l[t[0]];if(n){let e=null;if("move_date"===n)e=document.querySelector('[id*="move_date"]');else if("cleaning_date"===n)e=document.querySelector('[id*="cleaning_date"]');else if("square_meters"===n)e=document.querySelector('[id*="square_meters"]');else if("move_from"===n)e=document.querySelector('[id*="address"]');else if("move_to"===n){let t=document.querySelectorAll('[id*="address"]');e=t.length>1?t[1]:t[0]}if(e){e.scrollIntoView({behavior:"auto",block:"center"}),e.classList.add("validation-error-border"),e.classList.add("flash-red-border");try{setTimeout(()=>e.classList.remove("flash-red-border"),1800)}catch(e){}try{let t=()=>{try{e.classList.remove("validation-error-border"),e.classList.remove("flash-red-border")}catch(e){}try{e.removeEventListener("input",t),e.removeEventListener("change",t),e.removeEventListener("keydown",t)}catch(e){}};e.addEventListener("input",t,{once:!0}),e.addEventListener("change",t,{once:!0}),e.addEventListener("keydown",t,{once:!0})}catch(e){}try{var a;null==(a=e.focus)||a.call(e)}catch(e){}}}return}t$(tJ,void 0,!t0)},l3=tJ.services||[],l6=l3.includes(eu.kC),l7=!!(tJ.is_company_request||String(tJ.company_name||"").trim()||l6||tJ.express_company_pricing||tJ.packing_company_pricing||tJ.cleaning_company_pricing),l8=!!l6||l7,l9=(e,t)=>{let l="services"===e&&Array.isArray(t)?Array.from(new Set(t.map(e=>e===eu.kC?eu.UN:e).filter(Boolean))):t;if(tV(e,l),"company_name"===e&&tV("is_company_request",!!String(t||"").trim()),"cleaning_address"===e&&(lV.current=!0),"packing_address"===e&&(lO.current=!0),"square_meters"===e&&l3.some(e=>/städ|cleaning/i.test(e))&&!tJ.cleaning_square_meters&&tV("cleaning_square_meters",t),"cleaning_square_meters"===e&&(!lL||lI||lP||tV("square_meters",t)),"services"===e&&Array.isArray(l)){let e=l.some(e=>e===eu.n6),t=l3.some(e=>e===eu.n6);if(e&&!t){tJ.adjusted_express_workers||tV("adjusted_express_workers","2");let e=Math.max(eu.TS.baseRates.minimumBillableHours,3);tJ.adjusted_express_hours||tV("adjusted_express_hours",String(e))}let a=l.some(e=>e===eu.Mn),s=l3.some(e=>e===eu.Mn);a&&!s&&(tJ.packing_level||tV("packing_level","full"),null==tJ.packing_requires_materials&&tV("packing_requires_materials",!0),!String(tJ.packing_address||"").trim()&&String(tJ.move_from||"").trim()&&tV("packing_address",tJ.move_from));let n=l.some(e=>/städ|cleaning/i.test(e)),r=l3.some(e=>/städ|cleaning/i.test(e));if(n&&!r&&!String(tJ.cleaning_address||"").trim()){let e=lG();e&&tV("cleaning_address",e)}let o=l.some(e=>e===eu.OP),i=l3.some(e=>e===eu.OP);if(o&&!i){let e=String(tJ.move_to||"").trim(),t=String(tJ.storage_out_to||"").trim(),l=(0,e$.Ju)(e,lz),a=(0,e$.Ju)(t,lz);e&&!l&&(!t||a)&&tV("storage_out_to",e),tV("storage_out_from",lB),tV("move_to",lB)}if(!o&&i){let e=String(tJ.move_to||"").trim(),t=String(tJ.storage_out_to||"").trim(),l=String(tJ.storage_out_from||"").trim(),a=(0,e$.Ju)(e,lz),s=(0,e$.Ju)(t,lz);a&&tV("move_to",t&&!s?t:""),l&&(0,e$.Ju)(l,lz)&&tV("storage_out_from",""),t&&tV("storage_out_to",""),tV("storage_out_date",""),tV("storage_out_stairs_from",""),tV("storage_out_elevator_from",null),tV("storage_out_stairs_to",""),tV("storage_out_elevator_to",null),tV("storage_volume_m3",""),tV("storage_cost_override",null)}}},ae=()=>{l3.includes(eu.XQ)&&tV("adjusted_cleaning_hours",(()=>{var e;return(0,eu.VG)(Number(null!=(e=tJ.cleaning_square_meters)?e:tJ.square_meters)||0).hours})())},at=!!(String(tJ.second_move_from||"").trim()||String(tJ.second_move_to||"").trim()||String(tJ.second_move_date||"").trim()),al=!!(String(tJ.storage_out_from||"").trim()||String(tJ.storage_out_to||"").trim()||String(tJ.storage_out_date||"").trim());s.useEffect(()=>{if(t3&&t2)try{let e=window.localStorage,t="offer-last-company-mode-".concat(t2),l=null==e?void 0:e.getItem(t);if("1"===l||"0"===l){let e="1"===l;e!==l8&&(e=>{tV("is_company_request",e),e?(tV("express_company_pricing",!0),tV("packing_company_pricing",!0),tV("cleaning_company_pricing",!0),ae()):(tV("express_company_pricing",!1),tV("packing_company_pricing",!1),tV("cleaning_company_pricing",!1))})(e)}}catch(e){}},[t3,t2]);let aa=l3.some(e=>/städ|cleaning/i.test(e)),as=l3.includes("Packning"),an=l3.includes(eu.OP),ar=lI&&(at||lk),ao=lI&&(an||al),ai=(0,s.useMemo)(()=>{let e=[];return lI&&tJ.move_date&&e.push({label:"Flytt",date:tJ.move_date,cars:eG(tJ.adjusted_cars,tJ.num_cars)}),lI&&tJ.second_move_date&&e.push({label:"Andra flytten",date:tJ.second_move_date,cars:eG(tJ.adjusted_cars_2,tJ.adjusted_cars,tJ.num_cars)}),lI&&tJ.storage_out_date&&e.push({label:"Magasin ut",date:tJ.storage_out_date,cars:eG(tJ.adjusted_storage_out_cars,tJ.adjusted_cars,tJ.num_cars)}),e},[tJ.adjusted_cars,tJ.adjusted_cars_2,tJ.move_date,tJ.num_cars,tJ.second_move_date,tJ.adjusted_storage_out_cars,tJ.storage_out_date,lI]),ad="Andra flytten",ac="andra flytt",au="Magasin ut",am="magasin ut",ag=Array.isArray(tJ.route_stops)?tJ.route_stops:[],ap=Array.isArray(tJ.second_route_stops)?tJ.second_route_stops:[],ah=Array.isArray(tJ.storage_out_route_stops)?tJ.storage_out_route_stops:[],ax=e=>{let t="route_stops"===e?ag:"second_route_stops"===e?ap:ah;l9(e,[...t,""])},ab=()=>{lN(!0);let e=String(tJ.second_move_from||"").trim();!e&&tJ.move_to&&l9("second_move_from",tJ.move_to),e||tJ.move_to||l9("second_move_from","")},av=s.useMemo(()=>{try{return RegExp("[=\\-]+\\s*(?:Meddelande fr\xe5n kontoret|Fr\xe5n kontoret|Message from the office|From the office)\\s*[=\\-]+","i").test(tJ.notes||"")}catch(e){return/(?:Meddelande\s+fr.n\s+kontoret|Fr.n\s+kontoret|Message\s+from\s+the\s+office|From\s+the\s+office)/i.test(tJ.notes||"")}},[tJ.notes]),af=l3.includes("Expressarbetare"),a_=(0,eW.mv)(tJ),ay=(0,eW.H6)(tJ,"packing"),aj=(0,eW.H6)(tJ,"cleaning"),ak=(0,eW.H6)(tJ,"express"),aN=e=>{l9("extra_service_instances",e)},aw=(e,t)=>{aN(a_.map(l=>l.id===e?{...l,...t}:l))},aC=e=>{aN(a_.filter(t=>t.id!==e))},aA=(e,t)=>{l9("services",(tJ.services||[]).filter(t=>t!==e)),aN(a_.filter(e=>e.type!==t))},aS=e=>{let{type:t,label:l}=e;return(0,a.jsxs)("button",{type:"button",onClick:()=>(e=>{var t;if(a_.some(t=>t.type===e))return;let l="packing"===e?{date:tJ.packing_date||"",start_time:tJ.packing_start_time||null,address:tJ.packing_address||tJ.move_from||"",square_meters:tJ.square_meters||"",workers:tJ.adjusted_packing_workers||"2",hours:tJ.adjusted_packing_hours||String(eu.TS.packingMinimumHours||eu.TS.baseRates.minimumBillableHours||2),packing_level:tJ.packing_level||"full",requires_materials:null==(t=tJ.packing_requires_materials)||t,company_pricing:!!tJ.packing_company_pricing}:"cleaning"===e?{date:tJ.cleaning_date||"",start_time:tJ.cleaning_start_time||null,address:tJ.cleaning_address||lG()||"",square_meters:tJ.cleaning_square_meters||tJ.
1square_meters||"",hours:tJ.adjusted_cleaning_hours||"",company_pricing:!!tJ.cleaning_company_pricing}:{date:tJ.express_date||tJ.move_date||"",start_time:tJ.delivery_start_time||null,address:tJ.express_address||(lI?tJ.move_to:tJ.move_from)||"",workers:tJ.adjusted_express_workers||"2",hours:tJ.adjusted_express_hours||String(Math.max(eu.TS.baseRates.minimumBillableHours,3)),company_pricing:!!tJ.express_company_pricing};aN([...a_,(0,eW.b)(e,l,a_.filter(t=>t.type===e).length)])})(t),className:"mt-3 inline-flex items-center justify-center gap-2 rounded-xl border border-cyan-500/30 bg-cyan-500/10 px-4 py-2 text-sm font-semibold text-cyan-200 hover:bg-cyan-500/15 hover:border-cyan-400/50 transition-colors",children:[(0,a.jsx)(r.A,{size:16}),l]})},aq={contain:"layout style"},aM="bg-slate-800/80 rounded-xl p-4 md:p-6 border border-slate-700/80",aF="inline-flex items-center justify-center gap-2 rounded-xl border border-cyan-500/30 bg-cyan-500/10 px-4 py-2 text-sm font-semibold text-cyan-200 hover:bg-cyan-500/15 hover:border-cyan-400/50 transition-colors",aR="relative px-16 py-8 text-xl font-semibold bg-cyan-600 hover:bg-cyan-500 text-white border-0 rounded-2xl transition-colors duration-150 tracking-wide disabled:opacity-50 disabled:cursor-not-allowed",aT=(e,t)=>{let l=t+2;return"packing"===e?"Packningsdetaljer ".concat(l):"cleaning"===e?"St\xe4ddetaljer ".concat(l):"Expressdetaljer ".concat(l)},aD=(e,t,l,s)=>l.length>0?(0,a.jsxs)("div",{className:"lg:col-span-2 ".concat(aM),style:aq,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("h3",{className:"text-base font-semibold text-white flex items-center gap-2",children:[(0,a.jsx)(o.A,{className:"h-4 w-4 text-cyan-400"})," ",t]}),(0,a.jsxs)(eJ.$,{type:"button",variant:"secondary",onClick:()=>ax(e),className:aF,children:[(0,a.jsx)(r.A,{size:16}),"+ L\xe4gg till via-adress"]})]}),(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:l.map((t,l)=>(0,a.jsxs)("div",{className:"flex items-end gap-2",children:[(0,a.jsx)(eY,{label:"".concat(s," ").concat(l+1),value:t,onChange:t=>((e,t,l)=>{let a=[..."route_stops"===e?ag:"second_route_stops"===e?ap:ah];a[t]=l,l9(e,a)})(e,l,t),placeholder:"L\xe4gg till via-adress",className:"w-full"}),(0,a.jsx)(eJ.$,{type:"button",variant:"ghost",onClick:()=>((e,t)=>{let l=[..."route_stops"===e?ag:"second_route_stops"===e?ap:ah];l.splice(t,1),l9(e,l)})(e,l),className:"self-end h-12 w-10 p-0 text-red-300 hover:text-red-200 shrink-0","aria-label":"Ta bort via-adress ".concat(l+1),children:(0,a.jsx)(i.A,{className:"h-4 w-4"})})]},"".concat(e,"-").concat(l)))})})]}):null,aE=(0,s.useRef)(null),aI=()=>{if("undefined"==typeof document)return;let e=document.scrollingElement||document.documentElement||document.body,t=e.scrollTop,l=e.style.scrollBehavior;try{e.style.scrollBehavior="auto"}catch(e){}let a=()=>{window.scrollTo(0,t),setTimeout(()=>{window.scrollTo(0,t);try{e.style.scrollBehavior=l}catch(e){}},0)};a(),requestAnimationFrame(a)},aL=e=>{let t=("string"==typeof e?document.getElementById(e):e)||aP.current;if(!t)return;let l=(e=>{let t=null==e?void 0:e.parentElement;for(;t;){let e=window.getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e)&&t.scrollHeight>t.clientHeight+1)return t;t=t.parentElement}return document.scrollingElement||document.documentElement||document.body})(t),a=t.getBoundingClientRect(),s=l.getBoundingClientRect?l.getBoundingClientRect():{top:0},n=a.top-s.top,r=l.style.scrollBehavior;try{l.style.scrollBehavior="auto"}catch(e){}aE.current={container:l,target:t,prevRelTop:n,prevScrollBehavior:r}};(0,s.useLayoutEffect)(()=>{(()=>{let e=aE.current;if(!e)return;let{container:t,target:l,prevRelTop:a,prevScrollBehavior:s}=e;(()=>{let e=t.getBoundingClientRect?t.getBoundingClientRect():{top:0},s=l;try{if("undefined"!=typeof document&&l&&!document.body.contains(l)){let e=aP.current||t;s=e.querySelector('[data-role="edit-summary-toggle"]')||e.querySelector('[data-role="summary-edit-toggle"]')||("number"==typeof t2?document.getElementById("request-card-header-".concat(t2)):null)||l}}catch(e){}let n=(s||l).getBoundingClientRect().top-e.top-a;n&&(t.scrollTop+=n)})();try{void 0!==s&&(t.style.scrollBehavior=s)}catch(e){}aE.current=null})()},[ly]);let aP=(0,s.useRef)(null),az=lm?(0,a.jsx)("div",{className:"rounded-2xl border border-slate-700/70 bg-slate-950/70 p-1.5 shadow-inner",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-1.5",role:"group","aria-label":"sv"===lv?"V\xe4lj utskick":"Choose message type",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>lm("offer"),"aria-pressed":"offer"===lu,className:"inline-flex min-h-11 items-center justify-center gap-2 rounded-xl px-4 text-sm font-semibold transition-colors ".concat("offer"===lu?"bg-cyan-500 text-slate-950 shadow-sm":"text-slate-300 hover:bg-slate-800 hover:text-white"),children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"sv"===lv?"Offert":"Offer"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>lm("presentation"),"aria-pressed":"presentation"===lu,className:"inline-flex min-h-11 items-center justify-center gap-2 rounded-xl px-4 text-sm font-semibold transition-colors ".concat("presentation"===lu?"bg-
1orange-500 text-white shadow-sm":"text-slate-300 hover:bg-slate-800 hover:text-white"),children:[(0,a.jsx)(c.A,{className:"h-4 w-4"}),"Presentation"]})]})}):null;if("presentation"===lu)return(0,a.jsxs)("form",{ref:aP,onSubmit:e=>{e.preventDefault(),null==lg||lg()},className:"".concat(lc?"":"animate-in fade-in slide-in-from-bottom-2 duration-150"," space-y-6"),children:[az,(0,a.jsxs)("div",{className:"rounded-2xl border border-orange-400/20 bg-gradient-to-br from-slate-900 to-slate-950 p-4 sm:p-6",children:[(0,a.jsxs)("div",{className:"mb-5 flex items-start gap-3",children:[(0,a.jsx)("div",{className:"rounded-xl bg-orange-500/15 p-2.5 text-orange-300",children:(0,a.jsx)(c.A,{className:"h-5 w-5"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"font-semibold text-white",children:"sv"===lv?"F\xf6retagspresentation":"Company presentation"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"sv"===lv?"Endast kontaktuppgifter sparas.":"Only contact details are saved. Pricing, services and other job data remain unchanged."})]})]}),(0,a.jsx)(J,{companyNameRef:lE,showCustomerSearch:lo,data:tJ,onDataChange:(e,t)=>
1l9(e,t),onDataChangeMultiple:e=>{Object.entries(e).forEach(e=>{let[t,l]=e;l9(t,l)})},showCompanyField:!0,showMoveDate:!1,disableAnimation:!0})]}),lh?null:(0,a.jsx)("div",{className:"flex items-center justify-center border-t border-slate-700/40 pt-5",children:(0,a.jsxs)(eJ.$,{type:"submit",disabled:lp,size:"lg",className:"min-h-14 min-w-[260px] rounded-2xl bg-orange-500 px-7 text-base font-semibold text-white shadow-lg shadow-orange-950/30 hover:bg-orange-400",children:[lp?(0,a.jsx)(u.A,{className:"mr-3 h-5 w-5 animate-spin"}):(0,a.jsx)(c.A,{className:"mr-3 h-5 w-5"}),lp?"sv"===lv?"F\xf6rbereder…":"Preparing…":"sv"===lv?"F\xf6rhandsgranska presentation":"Preview presentation"]})})]});let aB=!ly&&t0;return(0,a.jsxs)("form",{ref:aP,onSubmit:e=>{e&&e.preventDefault(),tY(tJ)},className:"".concat(!lc?"animate-in fade-in slide-in-from-bottom-2 duration-150":""," ").concat(aB?"flex flex-col flex-1 min-h-0":"space-y-6"),style:{overflowAnchor:"auto"},children:[az,ly?(0,a.jsxs)(a.Fragment,{children:[!ld&&(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6 mt-4",children:[(0,a.jsx)("div",{children:(0,a.jsxs)("h2",{className:"text-xl font-bold text-cyan-300 flex items-center gap-3",children:[(0,a.jsx)(m.A,{size:24,className:"text-cyan-400"}),t3?"Redigera Detaljer":"string"==typeof(null==lx||null==(M=lx.jobs)||null==(q=M.jobForm)?void 0:q.editJob)?null==lx||null==(R=lx.jobs)||null==(F=R.jobForm)?void 0:F.editJob:"Edit Job"]})}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[ls&&ln?(0,a.jsx)("button",{type:"button",onClick:ln,className:"inline-flex items-center gap-2 px-6 py-3 border-2 border-red-500/60 text-base font-semibold rounded-lg text-red-200 hover:bg-red-500/20 hover:border-red-400 transition-colors",children:"sv"===lv?"Avbryt":"Cancel"}):!t7&&(0,a.jsxs)("button",{type:"button",onClick:lZ,className:"inline-flex items-center gap-2 px-6 py-3 border-2 border-amber-500/60 text-base font-semibold rounded-lg text-amber-200 hover:bg-amber-500/20 hover:border-amber-400 transition-colors",children:[(0,a.jsx)(g.A,{size:18}),"string"==typeof(null==lx||null==(T=lx.common)?void 0:T.reset)?null==lx||null==(D=lx.common)?void 0:D.reset:"\xc5terst\xe4ll"]}),!la&&(0,a.jsxs)("button",{type:"button","data-role":"edit-summary-toggle",onClick:e=>{try{aL(e.currentTarget),aI(),(0,n.flushSync)(()=>lw(!1))}catch(e){(0,n.flushSync)(()=>lw(!1))}},className:"inline-flex items-center gap-2 px-6 py-3 border-2 border-slate-500/60 text-base font-semibold rounded-lg text-slate-200 hover:bg-slate-500/20 hover:border-slate-400 transition-colors",children:[(0,a.jsx)(p.A,{size:18}),"string"==typeof(null==lx||null==(I=lx.jobs)||null==(E=I.details)?void 0:E.title)?null==lx||null==(P=lx.jobs)||null==(L=P.details)?void 0:L.title:"Visa Sammanfattning"]}),li&&(0,a.jsxs)("button",{type:"button",onClick:li,className:"inline-flex items-center gap-2 px-6 py-3 border-2 border-slate-500/60 text-base font-semibold rounded-lg text-slate-200 hover:bg-slate-500/20 hover:border-slate-400 transition-colors","aria-label":(null==lx||null==(z=lx.common)?void 0:z.close)||"St\xe4ng",children:[(0,a.jsx)(h.A,{size:18,strokeWidth:2.5})," ",(null==lx||null==(B=lx.common)?void 0:B.close)||"St\xe4ng"]})]})]}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{style:aq,children:(0,a.jsx)(J,{companyNameRef:lE,showCustomerSearch:lo,data:tJ,onDataChange:(e,t)=>
1l9(e,t),onDataChangeMultiple:e=>{Object.entries(e).forEach(e=>{let[t,l]=e;l9(t,l)})},showCompanyField:!0,showMoveDate:lI,moveDate:null!=(e_=tJ.move_date)?e_:"",onMoveDateChange:e=>l9("move_date",e),showMoveRequestedToggle:lC,isMoveDateRequestedByCustomer:tJ.move_date_is_requested_by_customer,onMoveDateRequestedToggle:e=>l9("move_date_is_requested_by_customer",e),disableAnimation:lc})}),!lL||lI||lP?null:(0,a.jsxs)("div",{style:aq,children:[(0,a.jsx)(ek,{address:tJ.cleaning_address||"",date:tJ.cleaning_date||"",squareMeters:String(null!=(ey=tJ.cleaning_square_meters)?ey:""),onAddressChange:e=>l9("cleaning_address",e),onDateChange:e=>l9("cleaning_date",e),onSquareMetersChange:e=>l9("cleaning_square_meters",e),showCompanyToggle:!1,isCompany:!!tJ.cleaning_company_pricing,onCompanyChange:e=>{l9("cleaning_company_pricing",e),e&&ae()},isRequestedByCustomer:tJ.cleaning_date_is_requested_by_customer,onRequestedToggle:lA?e=>l9("cleaning_date_is_requested_by_customer",e):void 0,onRemove:()=>aA(eu.XQ,"cleaning"),disableAnimation:lc}),0===aj.length?(0,a.jsx)(aS,{type:"cleaning",label:"+ L\xe4gg till andra st\xe4dning"}):null]}),lI&&(0,a.jsxs)("div",{className:"grid ".concat(lI?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"," gap-4 md:gap-6"),children:[(0,a.jsx)(V.W,{title:"Fr\xe5n",address:null!=(ej=tJ.move_from)?ej:"",stairs:String(null!=(eN=tJ.stairs_from)?eN:""),elevator:null!=(ew=tJ.elevator_from)?ew:null,onAddressChange:e=>l9("move_from",e),onAddressFinalized:l5,onStairsChange:e=>l9("stairs_from",e),onElevatorChange:e=>l9("elevator_from",e),isToAddress:!1,squareMeters:String(null!=(eC=tJ.square_meters)?eC:""),onSquareMetersChange:e=>l9("square_meters",e),propertyType:null!=(eq=tJ.property_type_from)?eq:null,onPropertyTypeChange:e=>l9("property_type_from",e),disableAnimation:lc}),lI&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(V.W,{title:"Till",address:null!=(eM=tJ.move_to)?eM:"",stairs:String(null!=(eF=tJ.stairs_to)?eF:""),elevator:null!=(eR=tJ.elevator_to)?eR:null,onAddressChange:e=>l9("move_to",e),onAddressFinalized:l5,onStairsChange:e=>l9("stairs_to",e),onElevatorChange:e=>l9("elevator_to",e),isToAddress:!0,squareMeters:lK?void 0:String(null!=(eT=tJ.square_meters_to)?eT:""),onSquareMetersChange:lK?void 0:e=>l9("square_meters_to",e),propertyType:null!=(eD=tJ.property_type_to)?eD:null,onPropertyTypeChange:e=>l9("property_type_to",e),hideStairsElevator:lK,disableAnimation:lc}),(!ar||0===ag.length)&&(0,a.jsxs)("div",{className:"lg:col-span-2 flex flex-wrap items-center gap-3",style:aq,children:[!ar&&(0,a.jsxs)(eJ.$,{type:"button",variant:"secondary",onClick:ab,className:aF,children:[(0,a.jsx)(r.A,{size:16}),"+ L\xe4gg till andra flytt"]}),0===ag.length&&(0,a.jsxs)(eJ.$,{type:"button",variant:"secondary",onClick:()=>ax("route_stops"),className:aF,children:[(0,a.jsx)(r.A,{size:16}),"+ L\xe4gg till via-adress"]})]}),ar&&(0,a.jsxs)("div",{className:"relative lg:col-span-2 ".concat(aM),style:aq,children:[(0,a.jsxs)("div",{className:ar?"flex items-start justify-between gap-3":"flex items-start justify-start gap-3",children:[(0,a.jsxs)("h2",{className:"".concat(ar?"":"sr-only"," text-lg font-bold text-white flex items-center gap-2"),children:[(0,a.jsx)(x.A,{className:"h-4 w-4 text-blue-400"}),ad]}),ar?(0,a.jsx)("button",{type:"button",onClick:()=>{lN(!1),l9("second_move_date",""),l9("second_move_from",""),l9("second_move_to",""),l9("second_stairs_from",""),l9("second_elevator_from",null),l9("second_stairs_to",""),l9("second_elevator_to",null)},className:"p-1 rounded-full text-slate-400 hover:bg-red-500/20 hover:text-red-400 transition-colors","aria-label":"Ta bort ".concat(ac),children:(0,a.jsx)(h.A,{size:14})}):(0,a.jsxs)(eJ.$,{type:"button",variant:"secondary",onClick:ab,className:aF,children:[(0,a.jsx)(r.A,{size:16}),"+ L\xe4gg till andra flytt"]})]}),ar&&(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(j.R,{label:"Datum (kan l\xe4mnas tomt)",id:"second_move_date",date:tJ.second_move_date?new Date(tJ.second_move_date):null,onDateChange:e=>{if(e){let t=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");l9("second_move_date","".concat(t,"-").concat(l,"-").concat(a))}else l9("second_move_date","")},minDate:tJ.move_date?(()=>{let e=new Date(tJ.move_date);return e.setHours(0,0,0,0),e})():new Date,forceTheme:"dark",placeholder:"V\xe4lj datum...",className:"h-12 md:h-[52px] pl-12 text-[15px] bg-slate-700/50 border border-slate-600/50 text-slate-300 hover:border-cyan-500/50 focus:ring-cyan-500/50 focus:border-cyan-500/50"})})]}),ar&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(V.W,{title:"".concat(ad," - Fr\xe5n"),address:null!=(eE=tJ.second_move_from)?eE:"",stairs:String(null!=(eI=tJ.second_stairs_from)?eI:""),elevator:null!=(eL=tJ.second_elevator_from)?eL:null,onAddressChange:e=>
1l9("second_move_from",e),onStairsChange:e=>l9("second_stairs_from",e),onElevatorChange:e=>l9("second_elevator_from",e),isToAddress:!1,headerIconClassName:"text-blue-400",hideStairsElevator:lX,disableAnimation:lc}),(0,a.jsx)(V.W,{title:"".concat(ad," - Till"),address:null!=(eP=tJ.second_move_to)?eP:"",stairs:String(null!=(eO=tJ.second_stairs_to)?eO:""),elevator:null!=(eK=tJ.second_elevator_to)?eK:null,onAddressChange:e=>l9("second_move_to",e),onStairsChange:e=>l9("second_stairs_to",e),onElevatorChange:e=>l9("second_elevator_to",e),isToAddress:!0,headerIconClassName:"text-blue-400",addressRequired:!1,squareMeters:String(null!=(eX=tJ.square_meters_to)?eX:""),onSquareMetersChange:e=>l9("square_meters_to",e),disableAnimation:lc})]}),aD("route_stops","Via-adresser - f\xf6rsta flytt",ag,"Via"),ar&&0===ap.length&&(0,a.jsx)("div",{className:"lg:col-span-2",style:aq,children:(0,a.jsxs)(eJ.$,{type:"button",variant:"secondary",onClick:()=>ax("second_route_stops"),className:aF,children:[(0,a.jsx)(r.A,{size:16}),"+ L\xe4gg till via-adress"]})}),ar&&aD("second_route_stops","Via-adresser - ".concat(ac),ap,"Via"),ao&&(0,a.jsxs)("div",{className:"relative lg:col-span-2 ".concat(aM),style:aq,children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("h2",{className:"text-lg font-bold text-white flex items-center gap-2",children:[(0,a.jsx)(x.A,{className:"h-4 w-4 text-blue-400"}),au]}),(0,a.jsx)("button",{type:"button",onClick:()=>l9("services",(tJ.services||[]).filter(e=>e!==eu.OP)),className:"p-1 rounded-full text-slate-400 hover:bg-red-500/20 hover:text-red-400 transition-colors","aria-label":"Ta bort ".concat(am),children:(0,a.jsx)(h.A,{size:14})})]}),(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("label",{htmlFor:"storage_facility_address",className:"mb-2 block text-sm font-medium text-slate-300",children:"Magasinadress"}),(0,a.jsx)("select",{id:"storage_facility_address",value:null!=(eQ=(0,e$.$6)(tJ.move_to,lz))?eQ:lB,onChange:e=>{let t=e.target.value;l9("move_to",t),l9("storage_out_from",t)},className:"mb-4 h-12 w-full rounded-xl border border-slate-600/50 bg-slate-700/50 px-3 text-[15px] text-slate-200 outline-none transition-colors hover:border-cyan-500/50 focus:border-cyan-500/50 focus:ring-2 focus:ring-cyan-500/30",children:lJ.map((e,t)=>(0,a.jsxs)("option",{value:e,children:[t+1,". ",e]},e))}),(0,a.jsx)(j.R,{label:"Datum (kan l\xe4mnas tomt)",id:"storage_out_date",date:tJ.storage_out_date?new Date(tJ.storage_out_date):null,onDateChange:e=>{if(e){let t=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");l9("storage_out_date","".concat(t,"-").concat(l,"-").concat(a))}else l9("storage_out_date","")},minDate:tJ.move_date?(()=>{let e=new Date(tJ.move_date);return e.setHours(0,0,0,0),e})():new Date,forceTheme:"dark",placeholder:"V\xe4lj datum...",className:"h-12 md:h-[52px] pl-12 text-[15px] bg-slate-700/50 border border-slate-600/50 text-slate-300 hover:border-cyan-500/50 focus:ring-cyan-500/50 focus:border-cyan-500/50"})]})]}),ao&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(V.W,{title:"".concat(au," - Fr\xe5n"),address:null!=(eZ=tJ.storage_out_from)?eZ:"",stairs:String(null!=(e0=tJ.storage_out_stairs_from)?e0:""),elevator:null!=(e1=tJ.storage_out_elevator_from)?e1:null,onAddressChange:e=>l9("storage_out_from",e),onStairsChange:e=>l9("storage_out_stairs_from",e),onElevatorChange:e=>l9("storage_out_elevator_from",e),isToAddress:!1,headerIconClassName:"text-blue-400",hideStairsElevator:lQ,disableAnimation:lc}),(0,a.jsx)(V.W,{title:"".concat(au," - Till"),address:null!=(e2=tJ.storage_out_to)?e2:"",stairs:String(null!=(e5=tJ.storage_out_stairs_to)?e5:""),elevator:null!=(e4=tJ.storage_out_elevator_to)?e4:null,onAddressChange:e=>l9("storage_out_to",e),onStairsChange:e=>l9("storage_out_stairs_to",e),onElevatorChange:e=>l9("storage_out_elevator_to",e),isToAddress:!0,headerIconClassName:"text-blue-400",squareMeters:String(null!=(e3=tJ.square_meters_to)?e3:""),onSquareMetersChange:e=>l9("square_meters_to",e),disableAnimation:lc})]}),ao&&0===ah.length&&(0,a.jsx)("div",{className:"lg:col-span-2",style:aq,children:(0,a.jsxs)(eJ.$,{type:"button",variant:"secondary",onClick:()=>ax("storage_out_route_stops"),className:aF,children:[(0,a.jsx)(r.A,{size:16}),"+ L\xe4gg till via-adress"]})}),ao&&aD("storage_out_route_stops","Via-adresser - ".concat(am),ah,"Via")]})]}),!1,aa&&(lI||lP)&&(0,a.jsxs)("div",{style:aq,children:[(0,a.jsx)(ek,{address:tJ.cleaning_address||"",date:tJ.cleaning_date||"",squareMeters:String(null!=(e6=tJ.cleaning_square_meters)?e6:""),onAddressChange:e=>l9("cleaning_address",e),onDateChange:e=>l9("cleaning_date",e),onSquareMetersChange:e=>l9("cleaning_square_meters",e),showCompanyToggle:!1,isCompany:!!tJ.cleaning_company_pricing,onCompanyChange:e=>{l9("cleaning_company_pricing",e),e&&ae()},isRequestedByCustomer:tJ.cleaning_date_is_requested_by_customer,onRequestedToggle:lA?e=>l9("cleaning_date_is_requested_by_customer",e):void 0,onRemove:()=>aA(eu.XQ,"cleaning"),disableAnimation:lc}),0===aj.length?(0,a.jsx)(aS,{type:"cleaning",label:"+ L\xe4gg till andra st\xe4dning"}):null]}),aj.map((e,t)=>{var l;return(0,a.jsx)("div",{style:aq,children:(0,a.jsx)(ek,{title:aT("cleaning",t),address:e.address||"",date:e.date||"",squareMeters:String(null!=(l=e.square_meters)?l:""),onAddressChange:t=>aw(e.id,{address:t}),onDateChange:t=>aw(e.id,{date:t||""}),onSquareMetersChange:t=>aw(e.id,{square_meters:t}),showCompanyToggle:!1,isCompany:!!e.company_pricing,onCompanyChange:t=>aw(e.id,{company_pricing:t}),onRemove:()=>aC(e.id),disableAnimation:lc})},e.id)}),as&&(0,a.jsxs)("div",{style:aq,children:[(0,a.jsx)(eA,{address:null!=(e8=null!=(e7=tJ.packing_address)?e7:tJ.move_from)?e8:"",packingDate:tJ.packing_date,packingLevel:tJ.packing_level,requiresMaterials:tJ.packing_requires_materials,squareMeters:null!=(e9=tJ.square_meters)?e9:"",onAddressChange:e=>l9("packing_address",e),onPackingDateChange:e=>l9("packing_date",e),onPackingLevelChange:e=>l9("packing_level",e),onSquareMetersChange:e=>l9("square_meters",e),onRequiresMaterialsChange:e=>l9("packing_requires_materials",e),showCompanyToggle:!1,isCompany:!!tJ.packing_company_pricing,onCompanyChange:e=>l9("packing_company_pricing",e),isRequestedByCustomer:tJ.packing_date_is_requested_by_customer,onRequestedToggle:lS?e=>l9("packing_date_is_requested_by_customer",e):void 0,onRemove:()=>aA(eu.Mn,"packing"),disableAnimation:lc}),0===ay.length?(0,a.jsx)(aS,{type:"packing",label:"+ L\xe4gg till andra packning"}):null]}),ay.map((e,t)=>{var l,s,n,r;return(0,a.jsx)("div",{style:aq,children:(0,a.jsx)(eA,{title:aT("packing",t),address:e.address||"",packingDate:e.date||"",packingLevel:e.packing_level||tJ.packing_level||"full",requiresMaterials:null==(s=null!=(l=e.requires_materials)?l:tJ.packing_requires_materials)||s,squareMeters:null!=(r=null!=(n=e.square_meters)?n:tJ.square_meters)?r:"",onAddressChange:t=>aw(e.id,{address:t}),onPackingDateChange:t=>aw(e.id,{date:t||""}),onPackingLevelChange:t=>aw(e.id,{packing_level:t}),onSquareMetersChange:t=>aw(e.id,{square_meters:t}),onRequiresMaterialsChange:t=>aw(e.id,{requires_materials:t}),showCompanyToggle:!1,isCompany:!!e.company_pricing,onCompanyChange:t=>aw(e.id,{company_pricing:t}),onRemove:()=>aC(e.id),disableAnimation:lc})},e.id)}),af&&(0,a.jsxs)("div",{style:aq,children:[(0,a.jsx)(eS,{address:null!=(tl=tJ.express_address)?tl:lI?null!=(te=tJ.move_to)?te:"":null!=(tt=tJ.move_from)?tt:"",date:null!=(ts=null!=(ta=tJ.express_date)?ta:tJ.move_date)?ts:"",onAddressChange:e=>l9("express_address",e),onDateChange:e=>l9("express_date",e),isRequestedByCustomer:tJ.express_date_is_requested_by_customer,onRequestedToggle:lM?e=>l9("express_date_is_requested_by_customer",e):void 0,onRemove:()=>aA(eu.n6,"express"),disableAnimation:lc}),0===ak.length?(0,a.jsx)(aS,{type:"express",label:"+ L\xe4gg till andra express"}):null]}),ak.map((e,t)=>(0,a.jsx)("div",{style:aq,children:(0,a.jsx)(eS,{title:aT("express",t),address:e.address||"",date:e.date||"",onAddressChange:t=>aw(e.id,{address:t}),onDateChange:t=>aw(e.id,{date:t||""}),onRemove:()=>aC(e.id),disableAnimation:lc})},e.id)),(0,a.jsxs)("div",{className:aM,style:aq,children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsxs)("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:[(0,a.jsx)(b.A,{size:20,className:"text-blue-400"}),"string"==typeof(null==lx||null==(U=lx.jobs)||null==(H=U.jobForm)||null==(O=H.additionalInfo)?void 0:O.notes)?null==lx||null==(Y=lx.jobs)||null==(W=Y.jobForm)||null==($=W.additionalInfo)?void 0:$.notes:"Notes"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{let e=tJ.notes||"",t="Meddelande fr\xe5n kontoret",l=" ".concat(t," "),a="";try{let e=document.getElementById("edit-notes");if(e){let t=window.getComputedStyle(e),s=document.createElement("canvas").getContext("2d");if(s){s.font="".concat(t.fontStyle||""," ").concat(t.fontVariant||""," ").concat(t.fontWeight||""," ").concat(t.fontSize||"14px"," ").concat(t.fontFamily||"sans-serif").trim();let n=Math.max(3,s.measureText("=").width||0),r=Math.ceil(s.measureText(l).width),o=parseFloat(t.paddingLeft||"0")||0,i=parseFloat(t.paddingRight||"0")||0,d=parseFloat(t.borderLeftWidth||"0")||0,c=parseFloat(t.borderRightWidth||"0")||0,u=Math.max(0,e.clientWidth-o-i-d-c-8),m=Math.max(6,Math.floor((u-r)/n)),g=Math.max(3,Math.floor(m/2)),p=Math.max(3,m-g),h="".concat("=".repeat(g)).c
1oncat(l).concat("=".repeat(p));for(;s.measureText(h).width>u&&g+p>6;)g>=p?g--:p--,h="".concat("=".repeat(g)).concat(l).concat("=".repeat(p));a=h}}}catch(e){}if(!a){let e=Math.max(3,Math.floor((120-l.length)/2)),t=Math.max(3,120-l.length-e);a="".concat("=".repeat(e)).concat(l).concat("=".repeat(t))}let s=e=>e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");if(RegExp("^\\s*[=\\-]+\\s*".concat(s(t),"\\s*[=\\-]+\\s*$"),"m").test(e)){let l=e.replace(RegExp("(?:^|\\n)\\s*[=\\-]+\\s*".concat(s(t),"\\s*[=\\-]+\\s*(?:\\n|$)"),"m"),e=>e.startsWith("\n")&&e.endsWith("\n")?"\n":"");l9("notes",(l=l.replace(/\n{3,}/g,"\n\n")).trim())}else l9("notes",(e||"").trimEnd()+"\n\n".concat(a,"\n"))},className:"flex items-center gap-1.5 text-xs text-slate-300 hover:text-slate-200 bg-slate-900/50 px-2 py-1 rounded-md border border-slate-700",children:[av?(0,a.jsx)(f,{size:14,className:"text-red-400"}):(0,a.jsx)(r.A,{size:14,className:"text-blue-400"}),"string"==typeof(null==lx||null==(X=lx.jobs)||null==(K=X.jobForm)||null==(G=K.additionalInfo)?void 0:G.officeNote)?null==lx||null==(ee=lx.jobs)||null==(Z=ee.jobForm)||null==(Q=Z.additionalInfo)?void 0:Q.officeNote:"sv"===lv?"Meddelande fr\xe5n kontoret":"Message from the office"]})]}),(0,a.jsx)(eB.A,{id:"edit-notes",minRows:4,className:"block w-full overflow-hidden text-base px-3 py-2 bg-slate-700/50 border border-slate-600/50 rounded-lg placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500/50 text-slate-300 resize-none",placeholder:"string"==typeof(null==lx||null==(es=lx.jobs)||null==(ea=es.jobForm)||null==(el=ea.additionalInfo)||null==(et=el.notes)?void 0:et.placeholder)?null==lx||null==(ei=lx.jobs)||null==(eo=ei.jobForm)||null==(er=eo.additionalInfo)||null==(en=er.notes)?void 0:en.placeholder:"Describe specific needs: door codes, heavy items (piano, safe), items to discard, packing material needs, etc.",value:null!=(tn=tJ.notes)?tn:"",onChange:e=>l9("notes",e.target.value)})]}),(0,a.jsx)("div",{className:aM,style:{position:"relative",zIndex:20},children:(0,a.jsx)(ef,{services:l3,additionalServices:null!=(tr=tJ.additional_services)?tr:[],onServicesChange:e=>l9("services",e),onAdditionalServicesChange:e=>l9("additional_services",e),availableServices:tG,disableAnimation:lc})})]})]}):(0,a.jsx)("div",{className:aB?"flex-1 min-h-0 overflow-hidden flex flex-col":void 0,children:(0,a.jsx)(ez,{onEdit:()=>{try{var e;let t=t2?"request-card-header-".concat(t2):void 0,l=null==(e=aP.current)?void 0:e.querySelector('[data-role="summary-edit-toggle"]');aL(l||t),aI(),(0,n.flushSync)(()=>lw(!0))}catch(e){(0,n.flushSync)(()=>lw(!0))}},onReset:tU||lZ,contactData:{customer_name:null!=(to=tJ.customer_name)?to:"",customer_phone:null!=(ti=tJ.customer_phone)?ti:"",customer_email:null!=(td=tJ.customer_email)?td:"",company_name:null!=(tc=tJ.company_name)?tc:null},fromAddressData:{address:null!=(tu=tJ.move_from)?tu:"",stairs:String(null!=(tm=tJ.stairs_from)?tm:""),elevator:null!=(tg=tJ.elevator_from)?tg:null},toAddressData:{address:null!=(tp=tJ.move_to)?tp:"",stairs:String(null!=(th=tJ.stairs_to)?th:""),elevator:null!=(tx=tJ.elevator_to)?tx:null},viaStops:tJ.route_stops||[],secondViaStops:tJ.second_route_stops||[],storageOutViaStops:tJ.storage_out_route_stops||[],secondMoveAddressData:tJ.second_move_from||tJ.second_move_to?{from:{address:null!=(tb=tJ.second_move_from)?tb:"",stairs:String(null!=(tv=tJ.second_stairs_from)?tv:""),elevator:null!=(tf=tJ.second_elevator_from)?tf:null},to:{address:null!=(t_=tJ.second_move_to)?t_:"",stairs:String(null!=(ty=tJ.second_stairs_to)?ty:""),elevator:null!=(tj=tJ.second_elevator_to)?tj:null},date:null!=(tk=tJ.second_move_date)?tk:null}:void 0,storageOutAddressData:tJ.storage_out_from||tJ.storage_out_to?{from:{address:null!=(tN=tJ.storage_out_from)?tN:"",stairs:String(null!=(tw=tJ.storage_out_stairs_from)?tw:""),elevator:null!=(tC=tJ.storage_out_elevator_from)?tC:null},to:{address:null!=(tA=tJ.storage_out_to)?tA:"",stairs:String(null!=(tS=tJ.storage_out_stairs_to)?tS:""),elevator:null!=(tq=tJ.storage_out_elevator_to)?tq:null},date:null!=(tM=tJ.storage_out_date)?tM:null}:void 0,propertyData:{squareMeters:String(null!=(tF=tJ.square_meters)?tF:""),moveDate:null!=(tR=tJ.move_date)?tR:"",propertyType:tJ.property_type,propertyTypeFrom:tJ.property_type_from,propertyTypeTo:tJ.property_type_to},cleaningData:{address:tJ.cleaning_address||tJ.move_from||"",date:tJ.cleaning_date||tJ.move_date||"",squareMeters:String(null!=(tD=null!=(tT=tJ.cleaning_square_meters)?tT:tJ.square_meters)?tD:"")},packingData:{date:tJ.packing_date,level:tJ.packing_level,materials:tJ.packing_requires_materials},services:l3,additionalServices:null!=(tE=tJ.additional_services)?tE:[],notes:null!=(tI=tJ.notes)?tI:"",isCleaningSelected:aa,isPackingSelected:as,isStorageSelected:an,hideResetButton:t7,isCalculating:tK,compactNotes:t0,onClose:li,extraServiceInstances:Array.isArray(tJ.extra_service_instances)?tJ.extra_service_instances:[],availabilityChecks:ai,expressData:{date:null!=(tP=null!=(tL=tJ.express_date)?tL:tJ.move_date)?tP:null,workers:null!=(tz=tJ.adjusted_express_workers)?tz:null,hours:null!=(tB=tJ.adjusted_express_hours)?tB:null},disableAnimation:lc})}),(0,a.jsxs)("div",{className:"pt-4 mt-6 border-t border-slate-700/30 shrink-0 bg-slate-900",children:[t3?(0,a.jsx)("div",{className:"flex items-center justify-center gap-4 flex-wrap",children:(0,a.jsx)("div",{className:"relative inline-flex items-center",children:(0,a.jsx)(eJ.$,{type:"button",onClick:()=>void(null==t8||t8()),disabled:tK||t6,size:"lg",className:aR,children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-4",children:[t6?(0,a.jsx)(u.A,{className:"h-7 w-7 animate-spin"}):(0,a.jsx)(_.A,{className:"h-7 w-7"}),(0,a.jsx)("span",{className:"font-medium",children:t6?"Sparar...":"sv"===lv?"Forts\xe4tt":"Continue"})]})})})}):t$&&t1?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-4 flex-wrap",children:[(0,a.jsx)("div",{className:"min-w-[88px] flex justify-end",children:tK&&tW?(0,a.jsxs)("button",{type:"button",onClick:tW,className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-xl border-2 border-red-500/60 text-red-300 bg-red-900/20 hover:bg-red-800/40 hover:border-red-400/80 hover:text-red-200 font-medium text-sm transition-colors duration-150","aria-label":"sv"===lv?"Avbryt":"Cancel",children:[(0,a.jsx)(h.A,{className:"h-4 w-4",strokeWidth:2.5}),"sv"===lv?"Avbryt":"Cancel"]}):null}),(0,a.jsx)(eJ.$,{type:"button",onClick:l4,disabled:tK,size:"lg",className:aR,children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-4",children:[tK?(0,a.jsx)(u.A,{className:"h-7 w-7 animate-spin"}):(0,a.jsx)(y.A,{className:"h-7 w-7"}),(0,a.jsx)("span",{className:"font-medium",children:(()=>{var e,t,l,a,s,n,r,o,i,d;if(lb)return tK?"Calculating price...":"Calculate Price Basis";let c=(e,t)=>{for(let t of e)if("string"==typeof t)return t;return t},u=c([null==lx||null==(t=lx.jobs)||null==(e=t.bookingRequest)?void 0:e.calculatePrice,null==lx||null==(s=lx.jobs)||null==(a=s.details)||null==(l=a.jobForm)?void 0:l.calculatePrice],"sv"===lv?"Ber\xe4kna Prisgrund":"Calculate Price"),m=c([null==lx||null==(r=lx.jobs)||null==(n=r.bookingRequest)?void 0:n.calculatingPrice,null==lx||null==(d=lx.jobs)||null==(i=d.details)||null==(o=i.jobForm)?void 0:o.calculating],"sv"===lv?"Ber\xe4knar pris...":"Calculating price...");return tK?m:u})()})]})})]}):li?(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsxs)("button",{type:"button",onClick:li,className:"inline-flex items-center gap-2 px-4 py-3 border border-slate-600 text-slate-300 hover:bg-slate-700/80 rounded-xl text-base font-medium transition-colors","aria-label":(null==lx||null==(ed=lx.common)?void 0:ed.close)||"St\xe4ng",children:[(0,a.jsx)(h.A,{className:"h-5 w-5",strokeWidth:2.5})," ",(null==lx||null==(ec=lx.common)?void 0:ec.close)||"St\xe4ng"]})}):null,t$&&!t1&&!t3&&(0,a.jsx)("div",{className:"flex justify-center",children:(0,a.jsx)("div",{className:"text-center text-slate-400 text-sm",children:(0,a.jsx)("p",{children:"Use the diamond button above to calculate price"})})})]})]})});eK.displayName="JobForm"}}]);

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.