PageSourceSearch

https://app.morsis.com/admin/assets/booking-scheduling-tab-bWHvpYU0.js

js morsis.com collected 2026-10-04 08:09:14 UTC 50,695 bytes, 2 lines download raw bytes

1import{r as m,j as e}from"./react-vendor-B8vxJpvE.js";import{L as be,u as ze}from"./lib-RaNg_boI.js";import{t as f,bv as Ue,a as x,g as _e,c as Be}from"./providers-C_Baw-03.js";import{ae as Fe,af as Oe,ag as Re,B as b,bb as se,x as P,y as E,k as He,a4 as W,a5 as K,a6 as J,a7 as Z,a8 as $,p as q,g as G,aR as Qe,r as $e,s as Ge,t as Ve,v as Ye,w as We,bd as Ke,ba as Je,cn as ve,J as ne,K as ae,N as oe,dJ as Ze,dA as qe,dB as Xe,dC as es,a3 as ie,bs as re,a2 as Ne,aK as ss,aL as ts,bu as ns,aM as as,aN as os,aO as is,aP as rs,aQ as ls,az as ye,aA as ke,aB as Ce,aC as we,bc as Pe}from"./morsis-ui-vendor-DD84N7Nf.js";import{u as A,i as z}from"./i18n-vendor-D0AVrI2s.js";import{u as cs}from"./use-copy-to-clipboard-kBLXW69j.js";import{a as ms}from"./hooks-B1tjDKYu.js";import{a as ds,u as us}from"./use-permissions-Bqun5Oo6.js";import{u as Y}from"./notification-dnd-DMEnkoTP.js";import{r as ps}from"./use-pending-invitations-wHOPlanK.js";import{I as _,d9 as gs,q as Se,ah as xs,w as pe,aq as hs,da as fs,db as js,bf as ge,ad as bs,aG as le,aO as V,cd as vs,t as Ns,M as me,aw as ce,O as ys,az as ks,aA as Ee,P as Cs,Q as ws,N as Te}from"./icons-vendor-BFJnptSH.js";import{e as Ps,i as xe,D as Ss,v as Es}from"./product-edit-side-panel-CqbvkC-M.js";import"./dnd-vendor-Dw8VUN31.js";import{n as he,f as te,D as Ts,g as Ms,a as Ds,v as Is}from"./personal-document-BOlqAG6i.js";import{u as As,T as Ls}from"./theme-selector-CXpIRzh1.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"5.19.3"};var t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="572a5bb7-0e10-4aa6-972f-f3d11d9cf5a5",s._sentryDebugIdIdentifier="sentry-dbid-572a5bb7-0e10-4aa6-972f-f3d11d9cf5a5")}catch{}})();function zs(s){return(s??"").split("@")[0]?.trim()??""}function wt(s,t){const n=zs(t).toLowerCase();return!!n&&(s??"").trim().toLowerCase()===n}function Us(s,t){return(s.trim()||t.trim()).split(/\s+/).map(o=>o[0]).join("").toUpperCase().slice(0,2)||"U"}function _s({name:s,email:t,image:n,onImageChange:o}){const{t:l}=A(["common","catalogDetail"]),r=m.useRef(null),[p,d]=m.useState(!1),h=async a=>{if(!(!a||p)){if(!a.type.startsWith("image/")&&!/\.(heic|heif)$/i.test(a.name)){f.error(l("common:profile.photo.invalidImage"));return}d(!0);try{const u=await Ps(a),N=await Ue(u,{folder:"profile-images",compress:{maxWidth:512,maxHeight:512,quality:.84,mimeType:"image/webp",padToSquare:!0}});o(N.url)}catch(u){f.error(u instanceof Error?u.message:l("common:profile.photo.uploadFailed"))}finally{d(!1),r.current&&(r.current.value="")}}};return e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(Fe,{className:"size-16",children:[n&&e.jsx(Oe,{src:n,alt:s}),e.jsx(Re,{children:Us(s,t)})]}),e.jsxs("div",{className:"min-w-0 space-y-2",children:[e.jsxs(b,{type:"button",variant:"outline",onClick:()=>!p&&r.current?.click(),children:[p?e.jsx(_,{className:"size-4 animate-spin"}):e.jsx(gs,{className:"size-4"}),l(p?"common:profile.photo.uploading":n?"common:profile.photo.change":"catalogDetail:mediaGallery.addMenu.upload")]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:l("common:profile.photo.formats")})]}),e.jsx("input",{ref:r,type:"file","aria-label":l("common:profile.photo.ariaLabel"),accept:"image/png,image/jpeg,image/webp,image/gif,image/avif,image/heic,image/heif",className:"hidden",onChange:a=>{h(a.target.files?.[0])}})]})}const Bs=10,Fs="lastMonth",Os=[{code:"es",label:"Español"},{code:"en",label:"English"},{code:"pt",label:"Português"}];function Rs(){return new Date().toISOString().slice(0,Bs)}function Pt(){return e.jsxs("div",{className:"flex flex-col gap-6 pb-8",children:[e.jsx(Hs,{}),e.jsx(Qs,{}),e.jsx(Vs,{})]})}function L({title:s,description:t,children:n}){return Qe()?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold",children:s}),t&&e.jsx("p",{className:"text-muted-foreground text-xs",children:t})]}
1),e.jsx("div",{className:"bg-card flex flex-col gap-4 rounded-2xl border p-4",children:n})]}):e.jsxs($e,{children:[e.jsxs(Ge,{className:"border-b",children:[e.jsx(Ve,{className:"text-base",children:s}),t&&e.jsx(Ye,{children:t})]}),e.jsx(We,{className:"flex flex-col gap-4",children:n})]})}function Hs(){const{t:s}=A(["common","employees"]),[t,n]=m.useState(""),[o,l]=m.useState(""),[r,p]=m.useState(""),[d,h]=m.useState(null),[a,u]=m.useState(""),[N,j]=m.useState("DNI"),[g,T]=m.useState(""),[y,D]=m.useState(""),[c,S]=m.useState(""),[k,B]=m.useState(""),R=x.useUtils(),C=x.auth.profile.useQuery();m.useEffect(()=>{if(C.data){n(se(C.data.user.name)),l(C.data.user.nickname??""),p(C.data.user.birthDate??""),h(C.data.user.image??null),u(C.data.user.phone??"");const v=he(C.data.user.documentType);j(v),T(te(v,C.data.user.documentNumber??""))}},[C.data]);const F=x.auth.updateProfile.useMutation({onSuccess:async()=>{await ps(_e()),f.success("Perfil actualizado"),await Promise.all([R.auth.me.invalidate(),R.auth.profile.invalidate()])},onError:v=>f.error(v.message)}),ee=()=>{if(F.isPending)return;const v=se(t).trim(),H=a?String(a):null;if(v.length===0){D(s("common:profile.aboutMe.fullNameRequired"));return}if(!Ke(v)){D(s("common:profile.aboutMe.firstAndLastRequired"));return}if(H&&!Je(H)){S(s("common:profile.aboutMe.phoneInvalid"));return}const Q=Is(N,g);if(Q){B(Q);return}D(""),S(""),B(""),n(v),F.mutate({name:v,nickname:o.trim()||null,birthDate:r||null,documentType:N,documentNumber:g.trim()||null,phone:H,image:d})};return e.jsxs(L,{title:s("common:profile.aboutMe.account"),description:s("common:profile.aboutMe.accountDescription"),children:[e.jsx(_s,{name:t,email:C.data?.user.email??"",image:d,onImageChange:h}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-email",children:s("common:settings.b2b.contactEmail")}),e.jsx(E,{id:"profile-email",value:C.data?.user.email??"",disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-name",children:s("common:profile.aboutMe.fullName")}),e.jsx(E,{id:"profile-name",placeholder:s("common:profile.aboutMe.namePlaceholder"),value:t,"aria-invalid":!!y,"aria-describedby":y?"profile-name-error":void 0,onChange:v=>{n(se(v.target.value)),y&&D("")}}),y&&e.jsx("p",{id:"profile-name-error",className:"text-error text-sm",children:y})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-nickname",children:s("common:profile.aboutMe.nickname")}),e.jsx(E,{id:"profile-nickname",placeholder:s("common:profile.aboutMe.nicknamePlaceholder"),value:o,onChange:v=>l(v.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-birth-date",children:s("common:profile.aboutMe.birthDate")}),e.jsx(E,{id:"profile-birth-date",type:"date",max:Rs(),value:r,onChange:v=>p(v.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-phone",children:s("common:integrations.whatsapp.phoneNumber")}),e.jsx(He,{id:"profile-phone",international:!1,defaultCountry:"AR",placeholder:s("common:profile.aboutMe.phonePlaceholder"),value:a,"aria-invalid":!!c,"aria-describedby":c?"profile-phone-error":void 0,onChange:v=>{u(v??""),c&&S("")}}),c&&e.jsx("p",{id:"profile-phone-error",className:"text-error text-sm",children:c})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-document-type",children:s("employees:form.fields.documentType")}),e.jsxs(W,{value:N,onValueChange:v=>{const H=he(v);j(H),T(Q=>te(H,Q)),k&&B("")},children:[e.jsx(K,{id:"profile-document-type",children:e.jsx(J,{})}),e.jsx(Z,{children:Ts.map(v=>e.jsx($,{value:v.value,children:v.label},v.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-document-number",children:Ms(N)}),e.jsx(E,{id:"profile-document-number",placeholder:Ds(N),value:g,inputMode:N==="OTHER"?"text":"numeric","aria-invalid":!!k,"aria-describedby":k?"profile-document-number-error":void 0,onChange:v=>{T(te(N,v.target.value)),k&&B("")}}),k&&e.jsx("p",{id:"profile-document-number-error",className:"text-error text-sm",children:k})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(b,{onClick:ee,children:F.isPending?s("saving"):s("save")})})]})}function Qs(){const{t:s}=A(["common","aiMedia"]),t=Y(a=>a.theme),n=Y(a=>a.setTheme),{options:o}=As(),l=Y(a=>a.language),r=Y(a=>a.setLanguage),[p,d]=m.useState(!1),h=a=>{a===l||p||(d(!0),r(a).catch(u=>{Be(u,{tags:{feature:"i18n-language-switch"},extra:{code:a}}),f.error(s("common:profile.aboutMe.languageChangeFailed"))}).finally(()=>d(!1)))};return e.jsxs(L,{title:s("common:profile.aboutMe.preferences"),description:s("common:profile.aboutMe.preferencesDescription"),children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-sm",children:s("common:settings.general.fields.theme")}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:o.map(a=>{const u=t===a.id;return e.jsxs("button",{type:"button",onClick:()=>n(a.id,a.isCustom?a.colors:void 0),className:`flex items-center gap-2 rounded-xl border-2 px-3 py-2 text-left text-sm transition-colors ${u?"border-primary":"border-border hover:bg-muted/50"}`,children:[e.jsx(Ls,{colors:a.colors}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.name}),u&&e.jsx(Se,{className:"text-primary size-4 shrink-0"})]},a.id)})})]}),e.jsx(q,{}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xs,{className:"size-4"}),e.jsx("span",{className:"text-sm",children:s("aiMedia:plateBuilder.languageLabel")})]}),e.jsxs(W,{value:l,onValueChange:a=>h(a),children:[e.jsx(K,{className:"w-40",children:p?e.jsx(_,{className:"size-4 animate-spin"}):e.jsx(J,{})}),e.jsx(Z,{children:Os.map(a=>e.jsx($,{value:a.code,children:a.label},a.code))})]})]}),e.jsx(q,{}),e.jsx(Gs,{}),e.jsx($s,{})]})}function $s(){const{t:s}=A("common"),t=ds(),n=x.useUtils(),o=x.userPreferences.getPostitVisibility.useQuery(void 0,{enabled:t}),l=x.userPreferences.setPostitVisibility.useMutation({onError:d=>f.error(d.message),onSettled:()=>n.userPreferences.getPostitVisibility.invalidate()});if(!t)return null;const r=!(o.data?.hidePinnedPostits??!1),p=d=>{n.userPreferences.getPostitVisibility.setData(void 0,{hidePinnedPostits:!d}),l.mutate({hidePinnedPostits:!d})};return e.jsxs(e.Fragment,{children:[e.jsx(q,{}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-medium",children:s("profile.stickyNotes.title")}),e.jsx("span",{className:"text-muted-foreground text-xs",children:s("profile.stickyNotes.description")})]}),e.jsx(ve,{checked:r,onCheckedChange:p,"aria-label":s("profile.stickyNotes.title")})]})]})}function Gs(){const{t:s}=A(["common","sidebar"]),t=x.useUtils(),n=x.userPreferences.getDashboardPreferences.useQuery(),[o,l]=m.useState(""),r=n.data?.defaultPeriodPreset,p=r&&xe(r)?r:Fs,d=x.userPreferences.updateDashboardPreferences.useMutation({onSuccess:()=>{t.userPreferences.getDashboardPreferences.invalidate()},onError:u=>f.error(u.message)}),h=m.useMemo(()=>({...xe(p),preset:p}),[p]),a=u=>{if(!u.preset||u.preset==="custom"){l(s("common:profile.aboutMe.pickPresetPeriod"));return}l(""),t.userPreferences.getDashboardPreferences.setData(void 0,{defaultPeriodPreset:u.preset}),d.mutate({defaultPeriodPreset:u.preset})};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s("sidebar:modules.analytics_dashboard")}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm",children:s("common:profile.aboutMe.defaultAnalyticsPeriod")}),e.jsx(Ss,{value:h,onChange:a})]}),o&&e.jsx("p",{className:"text-error text-sm",children:o})]})}function Vs(){const{t:s}=A(["common","sidebar"]),[t,n]=m.useState(!1),[o,l]=m.useState(""),[r,p]=m.useState(""),[d,h]=m.useState(null),a=x.useUtils(),u=x.staffAuth.credentials.hasMyPin.useQuery(void 0,{retry:!1}),N=x.staffAuth.credentials.setMyPin.useMutation({onSuccess:()=>{f.success("PIN actualizado"),a.staffAuth.credentials.hasMyPin.invalidate(),n(!1),l(""),p(""),h(null)},onError:c=>f.error(c.message)}),j=x.staffAuth.credentials.myFaceStatus.useQuery(void 0,{retry:!1}),g=x.staffAuth.credentials.unlinkMyFace.useMutation({onSuccess:()=>{f.success("Rostro desvinculado de esta organización"),a.staffAuth.credentials.myFaceStatus.invalidate()},onError:c=>f.error(c.message)});if(u.isError)return null;const T=u.data===!0,y=j.data,D=()=>
1{if(!N.isPending){if(!/^\d{4,8}$/.test(o)){h(s("common:profile.aboutMe.pinLength"));return}if(o!==r){h(s("common:profile.aboutMe.pinMismatch"));return}h(null),N.mutate({pin:o})}};return e.jsxs(L,{title:s("common:profile.aboutMe.security"),description:s("common:profile.aboutMe.securityDescription"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"text-sm font-medium",children:s("sidebar:userMenu.pin.title")}),T&&!t&&e.jsxs(G,{variant:"outline",className:"border-success/30 bg-success/10 text-success gap-1 text-xs",children:[e.jsx(pe,{className:"h-3 w-3"}),s("common:profile.aboutMe.configured")]})]}),t?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{type:"password",inputMode:"numeric",pattern:"\\d*",maxLength:8,placeholder:"••••",value:o,onChange:c=>{l(c.target.value.replace(/\D/g,"")),d&&h(null)},autoFocus:!0}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s("common:profile.aboutMe.pinHint")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{type:"password",inputMode:"numeric",pattern:"\\d*",maxLength:8,placeholder:s("sidebar:userMenu.pin.confirmLabel"),value:r,onChange:c=>{p(c.target.value.replace(/\D/g,"")),d&&h(null)}}),d&&e.jsx("p",{className:"text-error text-xs",children:d})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{variant:"outline",size:"sm",onClick:()=>{n(!1),l(""),p(""),h(null)},children:s("cancel")}),e.jsx(b,{size:"sm",onClick:D,children:N.isPending?s("saving"):s("save")})]})]}):e.jsx("div",{children:e.jsxs(b,{variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>n(!0),children:[e.jsx(hs,{className:"h-3.5 w-3.5"}),s(T?"sidebar:userMenu.pin.changePin":"sidebar:userMenu.pin.setPin")]})}),y?.enrolled&&e.jsxs("div",{className:"border-border/60 mt-4 space-y-2 border-t pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"text-muted-foreground h-4 w-4"}),e.jsx("h4",{className:"text-sm font-medium",children:s("common:settings.staffAuth.methods.face.label")}),y.grantedHere?e.jsxs(G,{variant:"outline",className:"border-success/30 bg-success/10 text-success gap-1 text-xs",children:[e.jsx(pe,{className:"h-3 w-3"}),s("common:profile.aboutMe.faceShared")]}):e.jsx(G,{variant:"outline",className:"text-muted-foreground text-xs",children:s("common:profile.aboutMe.faceNotShared")})]}),y.grantedHere?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:s("common:profile.aboutMe.faceSharedHint")}),e.jsxs(b,{variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>g.mutate(),children:[g.isPending?e.jsx(_,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(js,{className:"h-3.5 w-3.5"}),s("common:profile.aboutMe.unlinkFace")]})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:s("common:profile.aboutMe.faceNotSharedHint")})]})]})}function Ys(){return{endpoint:"https://mcp.morsis.com/mcp",environment:"production"}}function Ws(s,t){return t==="local"?null:`https://claude.ai/customize/connectors?${new URLSearchParams({modal:"add-custom-connector",connectorName:t==="staging"?"Morsis Staging":"Morsis",connectorUrl:s}).toString()}`}function Ks({steps:s}){return e.jsx("ol",{className:"text-type space-y-2",children:s.map((t,n)=>e.jsxs("li",{className:"flex gap-3",children:[e.jsxs("span",{className:"text-muted-foreground w-4 shrink-0 text-right",children:[n+1,"."]}),e.jsx("span",{children:t})]},t))})}function Js(){const{t:s}=A("common"),[{endpoint:t,environment:n}]=m.useState(Ys),o=Ws(t,n),{copy:l,copied:r}=cs(),p=ms(),d=us("organization:manage_settings"),h=p.data?.find(C=>C.key==="mcp"),a=h?.enabled??!1,u=h?.mcpToolGroups??null,N=new Set((p.data??[]).filter(C=>C.enabled).map(C=>C.key)),j=(u?.catalogToolsEnabled??!1)&&N.has("catalog"),g=(u?.branchToolsEnabled??!1)&&N.has("branches"),T=(u?.postitToolsEnabled??!1)&&N.has("postits"),y=s("integrations.mcp.title"),D=s("integrations.mcp.description");if(p.isLoading)return e.jsx(L,{title:y,description:D,children:e.jsx("p",{className:"text-muted-foreground text-sm",children:s("integrations.mcp.moduleLoading")})});if(!a)return e.jsxs(L,{title:y,description:D,children:[e.jsxs(ne,{variant:"info",children:[e.jsx(ge,{className:"size-4"}),e.jsx(ae,{children:s("integrations.mcp.moduleDisabledTitle")}),e.jsx(oe,{children:s(d?"integrations.mcp.moduleDisabledAdminDescription":"integrations.mcp.moduleDisabledMemberDescription")})]}),d?e.jsx("div",{children:e.jsx(b,{asChild:!0,variant:"outline",children:e.jsx(be,{to:"/settings?tab=modules",children:s("integrations.mcp.openModuleSettings")})})}):null]});const c=s(n==="production"?"integrations.mcp.environment.production":n==="staging"?"integrations.mcp.environment.staging":"integrations.mcp.environment.local"),S=s(n==="local"?"integrations.mcp.localTitle":"integrations.mcp.secureTitle"),k=s(n==="local"?"integrations.mcp.localDescription":"integrations.mcp.secureDescription"),B=[{value:"chatgpt",title:s("integrations.mcp.chatgpt.title"),steps:[s("integrations.mcp.chatgpt.step1"),s("integrations.mcp.chatgpt.step2"),s("integrations.mcp.chatgpt.step3"),s("integrations.mcp.chatgpt.step4")],documentationUrl:"https://help.openai.com/en/articles/12584461-developer-mode-and-full-mcp-connectors-in-chatgpt"},{value:"claude",title:s("integrations.mcp.claude.title"),steps:[s("integrations.mcp.claude.step1"),s("integrations.mcp.claude.step2"),s("integrations.mcp.claude.step3"),s("integrations.mcp.claude.step4")],documentationUrl:"https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp"},{value:"other",title:s("integrations.mcp.other.title"),steps:[s("integrations.mcp.other.step1"),s("integrations.mcp.other.step2"),s("integrations.mcp.other.step3"),s("integrations.mcp.other.step4")]}];async function R(){await l(t)||f.error(s("integrations.mcp.copyError"))}return e.jsxs(L,{title:y,description:D,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(bs,{className:"text-ai size-5"}),e.jsx(G,{variant:"outline",children:c})]}),e.jsxs(ne,{variant:n==="local"?"warning":"info",children:[e.jsx(ge,{className:"size-4"}),e.jsx(ae,{children:S}),e.jsx(oe,{children:k})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(P,{htmlFor:"mcp-endpoint",children:s("integrations.mcp.endpointLabel")}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(E,{id:"mcp-endpoint",value:t,readOnly:!0,className:"font-mono"}),e.jsxs(b,{variant:"outline",onClick:R,children:[r?e.jsx(Se,{className:"size-4"}):e.jsx(le,{className:"size-4"}),s(r?"integrations.mcp.endpointCopied":"integrations.mcp.copyEndpoint")]})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s("integrations.mcp.endpointHelp")})]}),o?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{asChild:!0,className:"w-full sm:w-fit",children:e.jsxs("a",{href:o,target:"_blank",rel:"noreferrer",children:[s("integrations.mcp.connectClaude"),e.jsx(V,{className:"size-4"})]})}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s("integrations.mcp.connectClaudeHelp")})]}):null,n==="local"?e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-type text-sm font-medium",children:s("integrations.mcp.localSetupTitle")}),e.jsxs("ol",{className:"text-type space-y-3 text-sm",children:[e.jsxs("li",{className:"space-y-1.5",children:[e.jsxs("p",{children:["1. ",s("integrations.mcp.localStartWorker")]}),e.jsx("code",{className:"bg-muted block overflow-x-auto rounded-md px-3 py-2 text-xs",children:"pnpm --filter @morsis/api dev:mcp"})]}),e.jsxs("li",{className:"space-y-1.5",children:[e.jsxs("p",{children:["2. ",s("integrations.mcp.localStartInspector")]}),e.jsx("code",{className:"bg-muted block overflow-x-auto rounded-md px-3 py-2 text-xs",children:"NODE_TLS_REJECT_UNAUTHORIZED=0 npx @modelcontextprotocol/inspector"})]}),e.jsxs("li",{children:["3. ",s("integrations.mcp.localConnectInspector")]})]}),e.jsxs("a",{href:"https://modelcontextprotocol.io/docs/tools/inspector",target:"_blank",rel:"noreferrer",className:"text-type inl
1ine-flex items-center gap-1 text-sm underline underline-offset-4",children:[s("integrations.mcp.inspectorGuide"),e.jsx(V,{className:"size-4"})]})]}):null,e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-type text-sm font-medium",children:s("integrations.mcp.setupTitle")}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s("integrations.mcp.availabilityNote")}),e.jsx(Ze,{type:"single",collapsible:!0,className:"border-border border-t",children:B.map(C=>e.jsxs(qe,{value:C.value,children:[e.jsx(Xe,{className:"hover:no-underline",children:C.title}),e.jsxs(es,{className:"space-y-3",children:[e.jsx(Ks,{steps:C.steps}),C.documentationUrl?e.jsxs("a",{href:C.documentationUrl,target:"_blank",rel:"noreferrer",className:"text-type inline-flex items-center gap-1 text-sm underline underline-offset-4",children:[s("integrations.mcp.officialGuide"),e.jsx(V,{className:"size-4"})]}):null]})]},C.value))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-type text-sm font-medium",children:s("integrations.mcp.capabilitiesTitle")}),e.jsxs("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-sm",children:[j?e.jsx("li",{children:s("integrations.mcp.capabilities.catalog")}):null,g?e.jsx("li",{children:s("integrations.mcp.capabilities.branches")}):null,T?e.jsx("li",{children:s("integrations.mcp.capabilities.notes")}):null,e.jsx("li",{children:s("integrations.mcp.capabilities.connection")}),e.jsx("li",{children:s("integrations.mcp.capabilities.limits")})]})]})]})}const Me=[{key:"notes"},{key:"supplier_payments"},{key:"recurring_expenses"},{key:"receivables"}],Zs=Me.map(s=>s.key);function St(){return e.jsxs("div",{className:"flex flex-col gap-6 pb-8",children:[e.jsx(Js,{}),e.jsx(qs,{})]})}function qs(){const{t:s,i18n:t}=A("common"),n=x.useUtils(),[o,l]=ze(),{data:r,isLoading:p}=x.googleCalendar.status.useQuery(),d=m.useRef(!1);m.useEffect(()=>{const c=o.get("googleCalendar");!c||d.current||(d.current=!0,c==="connected"?(f.success(s("profile.integrations.googleCalendar.connectedToast")),n.googleCalendar.status.invalidate()):f.error(s("profile.integrations.googleCalendar.connectError")),l(S=>{const k=new URLSearchParams(S);return k.delete("googleCalendar"),k},{preventScrollReset:!0,replace:!0}))},[o,l,n,s]);const h=x.googleCalendar.connect.useMutation({onSuccess:c=>{c.url?window.location.href=c.url:f.error(s("profile.integrations.googleCalendar.startError"))},onError:c=>f.error(c.message||s("profile.integrations.googleCalendar.startError"))}),a=x.googleCalendar.disconnect.useMutation({onSuccess:()=>{f.success(s("profile.integrations.googleCalendar.disconnectedToast")),n.googleCalendar.status.invalidate()},onError:c=>f.error(c.message||s("profile.integrations.googleCalendar.disconnectError"))}),u=x.googleCalendar.syncNow.useMutation({onSuccess:c=>{f.success(s("profile.integrations.googleCalendar.syncSuccess",{inserted:c.inserted,patched:c.patched,deleted:c.deleted})),n.googleCalendar.status.invalidate()},onError:c=>f.error(c.message||s("profile.integrations.googleCalendar.syncError"))}),N=x.googleCalendar.configure.useMutation({onMutate:async c=>{await n.googleCalendar.status.cancel();const S=n.googleCalendar.status.getData();return n.googleCalendar.status.setData(void 0,k=>k&&{...k,metadata:{...k.metadata??{},...c.syncLayers!==void 0&&{syncLayers:c.syncLayers},...c.importPrimary!==void 0&&{importPrimary:c.importPrimary}}}),{previous:S}},onError:(c,S,k)=>{k?.previous!==void 0&&n.googleCalendar.status.setData(void 0,k.previous),f.error(c.message||s("profile.integrations.googleCalendar.saveLayersError"))},onSettled:()=>{n.googleCalendar.status.invalidate()}}),j=s("profile.integrations.googleCalendar.title"),g=s("profile.integrations.googleCalendar.description");if(p)return e.jsx(L,{title:j,description:g,children:e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[e.jsx(_,{className:"h-4 w-4 animate-spin"}),s("profile.integrations.googleCalendar.loading")]})});if(!(r?.status==="connected"))return e.jsxs(L,{title:j,description:g,children:[r?.status==="error"&&r.error&&e.jsx("p",{className:"text-error text-sm",children:r.error}),e.jsx("div",{children:e.jsxs(b,{onClick:()=>{h.isPending||h.mutate()},children:[h.isPending?e.jsx(_,{className:"h-4 w-4 animate-spin"}):e.jsx(vs,{className:"h-4 w-4"}),s("profile.integrations.googleCalendar.connect")]})})]});const y=r.metadata?.syncLayers??Zs,D=(c,S)=>
1{const k=S?[...new Set([...y,c])]:y.filter(B=>B!==c);N.mutate({syncLayers:k})};return e.jsxs(L,{title:j,description:g,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(G,{className:"bg-success text-type-foreground border-transparent",children:s("profile.integrations.googleCalendar.connectedBadge")}),r.accountId&&e.jsx("span",{className:"text-muted-foreground text-sm",children:r.accountId})]}),r.lastSyncedAt&&e.jsx("p",{className:"text-muted-foreground text-xs",children:s("profile.integrations.googleCalendar.lastSynced",{time:ie(r.lastSyncedAt,{locale:t.language})})}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(P,{className:"text-type",children:s("profile.integrations.googleCalendar.whatToSync")}),e.jsx("div",{className:"flex flex-col gap-2",children:Me.map(c=>{const S=`gcal-layer-${c.key}`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{id:S,checked:y.includes(c.key),onCheckedChange:k=>D(c.key,k===!0)}),e.jsx(P,{htmlFor:S,className:"text-type text-sm font-normal",children:s(`profile.integrations.googleCalendar.layers.${c.key}`)})]},c.key)})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(b,{variant:"secondary",onClick:()=>{u.isPending||u.mutate()},children:[u.isPending?e.jsx(_,{className:"h-4 w-4 animate-spin"}):e.jsx(Ns,{className:"h-4 w-4"}),s("profile.integrations.googleCalendar.syncNow")]}),e.jsxs(b,{variant:"secondary",onClick:()=>{a.isPending||a.mutate()},children:[a.isPending&&e.jsx(_,{className:"h-4 w-4 animate-spin"}),s("profile.integrations.googleCalendar.disconnect")]})]})]})}const U="admin",Xs=Intl.DateTimeFormat().resolvedOptions().timeZone||"America/Argentina/Buenos_Aires";function et(s){const t=new Date(s),n=o=>String(o).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}const X=[{value:1,get label(){return z.t("common:branches.openingHours.days.monday")}},{value:2,get label(){return z.t("common:branches.openingHours.days.tuesday")}},{value:3,get label(){return z.t("common:branches.openingHours.days.wednesday")}},{value:4,get label(){return z.t("common:branches.openingHours.days.thursday")}},{value:5,get label(){return z.t("common:branches.openingHours.days.friday")}},{value:6,get label(){return z.t("common:branches.openingHours.days.saturday")}},{value:0,get label(){return z.t("common:branches.openingHours.days.sunday")}}],st={google_meet:"Google Meet",get phone(){return z.t("common:meetingBooking.page.phone")},get in_person(){return z.t("common:meetingBooking.page.inPerson")},get custom(){return z.t("common:meetingBooking.toBeArranged")}},tt=["hello","thanks","help","chat"],fe={get text(){return z.t("common:profile.booking.questionType.text")},get textarea(){return z.t("common:profile.booking.questionType.textarea")},get select(){return z.t("common:settings.customFields.fieldOptions")}};function je({type:s,className:t}){return s==="phone"?e.jsx(Cs,{className:t}):s==="in_person"?e.jsx(ws,{className:t}):s==="custom"?e.jsx(me,{className:t}):e.jsx(Te,{className:t})}function Et(){const{t:s}=A(["common"]),{data:t,isLoading:n}=x.booking.myPage.useQuery({surface:U});return n?e.jsx(L,{title:s("common:profile.booking.pageTitle"),description:s("common:loading"),children:e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[e.jsx(_,{className:"h-4 w-4 animate-spin"})," ",s("common:settings.themes.kioskPreview.loading")]})}):t?e.jsx(at,{page:t}):e.jsx(nt,{})}function nt(){const{t:s}=A(["common"]),t=x.useUtils(),[n,o]=m.useState(""),l=x.booking.upsertPage.useMutation({onSuccess:()=>{f.success("Página de reuniones creada"),t.booking.myPage.invalidate()},onError:r=>f.error(r.message||"No se pudo crear la página")});return e.jsx(L,{title:s("common:profile.booking.pageTitle"),description:s("common:profile.booking.createDescription"),children:e.jsxs("div",{className:"max-w-sm space-y-3",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:s("common:profile.booking.publicName")}),e.jsx(E,{value:n,onChange:r=>
1o(r.target.value),placeholder:s("common:profile.booking.publicNamePlaceholder")})]}),e.jsxs(b,{onClick:()=>{l.isPending||l.mutate({surface:U,displayName:n.trim()||void 0,timezone:Xs})},children:[l.isPending?e.jsx(_,{className:"h-4 w-4 animate-spin"}):e.jsx(me,{className:"h-4 w-4"}),s("common:profile.booking.createPage")]})]})})}function at({page:s}){const{t}=A(["common","catalogDetail"]),n=x.useUtils(),o=s.page,l=s.eventTypes,r=m.useMemo(()=>`${typeof window<"u"?window.location.origin:""}/calendar-book/${o.slug}`,[o.slug]),[p,d]=m.useState(!1),[h,a]=m.useState(null),u=x.booking.upsertPage.useMutation({onMutate:async({isActive:g})=>{await n.booking.myPage.cancel();const T=n.booking.myPage.getData({surface:U});return n.booking.myPage.setData({surface:U},y=>y&&{...y,page:{...y.page,isActive:g??y.page.isActive}}),{prev:T}},onError:(g,T,y)=>{y?.prev&&n.booking.myPage.setData({surface:U},y.prev),f.error(g.message||"No se pudo actualizar")},onSettled:()=>{n.booking.myPage.invalidate()}}),N=x.booking.deleteEventType.useMutation({onSuccess:()=>{f.success("Tipo de reunión eliminado"),n.booking.myPage.invalidate()},onError:g=>f.error(g.message||"No se pudo eliminar")}),j=g=>{navigator.clipboard?.writeText(g),f.success(t("common:settings.b2b.publicUrlCopied"))};return e.jsxs("div",{className:"flex flex-col gap-6 pb-8",children:[!s.googleConnected&&e.jsxs(ne,{variant:"warning",children:[e.jsx(ae,{children:t("common:profile.booking.connectGoogle")}),e.jsxs(oe,{className:"flex flex-col items-start gap-2",children:[e.jsx("span",{children:t("common:profile.booking.connectGoogleHint")}),e.jsx(b,{variant:"secondary",size:"sm",asChild:!0,children:e.jsx(be,{to:"/profile?tab=integrations",children:t("common:settings.modules.goToIntegrations")})})]})]}),e.jsxs(L,{title:t("common:profile.booking.yourPage"),description:t("common:profile.booking.yourPageDescription"),children:[e.jsxs("div",{className:"bg-muted/40 border-border flex flex-col gap-4 roun
1ded-2xl border p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:"bg-foreground text-type-foreground flex h-11 w-11 shrink-0 items-center justify-center rounded-full text-base font-semibold",children:o.displayName.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-type truncate font-medium",children:o.displayName}),e.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-type block truncate text-sm",children:r.replace(/^https?:\/\//,"")})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsxs(b,{variant:"secondary",size:"sm",onClick:()=>j(r),children:[e.jsx(le,{className:"h-4 w-4"})," ",t("common:profile.booking.copyLink")]}),e.jsx(b,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(V,{className:"h-4 w-4"})," ",t("common:view")]})})]})]}),e.jsxs("div",{className:"border-border flex items-center justify-between gap-4 rounded-xl border p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-type text-sm font-medium",children:o.isActive?t("common:profile.booking.pageActive"):t("common:profile.booking.pagePaused")}),e.jsx("p",{className:"text-muted-foreground text-xs",children:o.isActive?t("common:profile.booking.guestsCanBook"):t("common:profile.booking.nobodyCanBook")})]}),e.jsx(ve,{checked:o.isActive,onCheckedChange:g=>u.mutate({surface:U,isActive:g})})]}),e.jsx(q,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-type mb-3 text-sm font-medium",children:t("catalogDetail:aiProductWizard.kind.customization")}),e.jsx(ot,{page:o})]})]}),e.jsx(L,{title:t("common:profile.booking.eventTypes"),description:t("common:profile.booking.eventTypesDescription"),children:l.length===0?e.jsxs("div",{className:"border-border flex flex-col items-center gap-2 rounded-2xl border border-dashed p-8 text-center",children:[e.jsx("div",{className:"bg-muted text-muted-foreground flex h-12 w-12 items-center justify-center rounded-full",children:e.jsx(me,{className:"h-6 w-6"})}),e.jsx("p",{className:"text-type text-sm font-medium",children:t("common:profile.booking.noEventTypes")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:t("common:profile.booking.noEventTypesHint")}),e.jsxs(b,{className:"mt-2",onClick:()=>{a(null),d(!0)},children:[e.jsx(ce,{className:"h-4 w-4"})," ",t("common:profile.booking.createEventType")]})]}):e.jsxs("div",{className:"flex flex-col gap-2.5",children:[l.map(g=>{const T=`${r}/${g.slug}`;return e.jsxs("div",{className:"bg-card border-border hover:border-primary group flex items-center gap-3 rounded-xl border p-3 transition-colors",children:[e.jsx("div",{className:"bg-muted text-muted-foreground flex h-10 w-10 shrink-0 items-center justify-center rounded-lg",children:e.jsx(je,{type:g.locationType,className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-type truncate font-medium",children:g.title}),!g.isActive&&e.jsx(G,{variant:"secondary",children:t("common:devices.connectionStatus.paused")})]}),e.jsxs("div",{className:"text-muted-foreground mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ys,{className:"h-3.5 w-3.5"})," ",g.durationMinutes," min"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(je,{type:g.locationType,className:"h-3.5 w-3.5"}),st[g.locationType]]}),e.jsxs("span",{className:"bg-muted rounded px-1.5 py-0.5 font-mono text-[11px]",children:["/",g.slug]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(b,{variant:"ghost",size:"icon","aria-label":t("common:profile.booking.copyLink"),onClick:()=>j(T),children:e.jsx(le,{className:"h-4 w-4"})}),e.jsx(b,{variant:"ghost",size:"icon","aria-label":t("common:view"),asChild:!0,children:e.jsx("a",{href:T,target:"_blank",rel:"noopener noreferrer",children:e.jsx(V,{className:"h-4 w-4"})})}),e.jsx(b,{variant:"ghost",size:"icon","aria-label":t("common:edit"),onClick:()=>{a(g),d(!0)},children:e.jsx(ks,{className:"h-4 w-4"})}),e.jsx(b,{variant:"ghost",size:"icon","aria-label":t("common:delete"),onClick:()=>{N.isPending||N.mutate({surface:U,eventTypeId:g.id})},children:e.jsx(Ee,{className:"h-4 w-4"})})]})]},g.id)}),e.jsxs("button",{type:"button",onClick:()=>{a(null),d(!0)},className:"border-border text-muted-foreground hover:border-primary hover:text-type flex items-center justify-center gap-2 rounded-xl border border-dashed p-3 text-sm font-medium transition-colors",children:[e.jsx(ce,{className:"h-4 w-4"})," ",t("common:profile.booking.newEventType")]})]})}),e.jsx(lt,{}),p&&e.jsx(rt,{pageId:o.id,eventType:h,onClose:()=>d(!1)})]})}function ot({page:s}){const{t}=A(["common"]),n=x.useUtils(),[o,l]=m.useState(s.displayName),[r,p]=m.useState(s.slug),[d,h]=m.useState(s.timezone),[a,u]=m.useState(s.welcomeMessage??""),N=x.booking.upsertPage.useMutation({onSuccess:()=>
1{f.success("Guardado"),n.booking.myPage.invalidate()},onError:j=>f.error(j.message||"No se pudo guardar")});return e.jsxs("div",{className:"grid max-w-xl gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:t("common:profile.booking.publicName")}),e.jsx(E,{value:o,onChange:j=>l(j.target.value)})]}),e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:t("common:profile.booking.slug")}),e.jsx(E,{value:r,onChange:j=>p(j.target.value)})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:t("common:branches.localization.timezone")}),e.jsx(Es,{value:d,onChange:h})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:t("common:branches.config.fields.welcomeMessage")}),e.jsx(Ne,{value:a,onChange:j=>u(j.target.value),rows:2,placeholder:t("common:profile.booking.welcomePlaceholder")}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:t("common:profile.booking.welcomeHint")}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:t("common:profile.booking.suggestions")}),tt.map(j=>t(`common:profile.booking.welcomePresets.${j}`)).map(j=>e.jsx("button",{type:"button",title:j,onClick:()=>u(j),className:"border-border text-muted-foreground hover:border-primary hover:text-type max-w-[16rem] truncate rounded-lg border px-2 py-1 text-left text-xs transition-colors",children:j},j))]})]}),e.jsx("div",{className:"sm:col-span-2",children:e.jsxs(b,{onClick:()=>{N.isPending||N.mutate({surface:U,displayName:o.trim()||void 0,slug:r.trim()||void 0,timezone:d,welcomeMessage:a.trim()||null})},children:[N.isPending&&e.jsx(_,{className:"h-4 w-4 animate-spin"}),t("common:publicBooking.saveChanges")]})})]})}function it(s){const t={};for(const n of X)t[n.value]={enabled:n.value>=1&&n.value<=5,start:"09:00",end:"17:00"};if(s){for(const n of X)t[n.value]={...t[n.value],enabled:!1};for(const n of s.weeklyAvailability){const o=n.intervals[0];t[n.weekday]={enabled:!0,start:o?.start??"09:00",end:o?.end??"17:00"}}}return t}function rt({pageId:s,eventType:t,onClose:n}){const{t:o}=A(["common"]),l=x.useUtils(),r=!!t,[p,d]=m.useState(t?.title??""),[h,a]=m.useState(t?.description??""),[u,N]=m.useState(String(t?.durationMinutes??30)),[j,g]=m.useState(t?.locationType??"google_meet"),[T,y]=m.useState(t?.locationDetail??""),[D,c]=m.useState(String(t?.minNoticeMinutes??0)),[S,k]=m.useState(()=>it(t)),[B,R]=m.useState(()=>(t?.customQuestions??[]).map(i=>({id:i.id,label:i.label,type:i.type,required:i.required,optionsText:(i.options??[]).join(", ")}))),[C,F]=m.useState(null),ee=()=>R(i=>[...i,{id:crypto.randomUUID(),label:"",type:"text",required:!1,optionsText:""}]),v=(i,w)=>R(O=>O.map(I=>I.id===i?{...I,...w}:I)),H=i=>R(w=>w.filter(O=>O.id!==i)),Q=()=>{l.booking.myPage.invalidate()},de=x.booking.createEventType.useMutation({onSuccess:()=>{f.success("Tipo de reunión creado"),Q(),n()},onError:i=>F(i.message||"No se pudo crear")}),ue=x.booking.updateEventType.useMutation({onSuccess:()=>{f.success("Cambios guardados"),Q(),n()},onError:i=>F(i.message||"No se pudo guardar")}),De=de.isPending||ue.isPending,Ie=()=>X.filter(i=>S[i.value]?.enabled).map(i=>({weekday:i.value,intervals:[{start:S[i.value].start,end:S[i.value].end}]})),Ae=()=>{if(F(null),!p.trim()){F(o("common:profile.booking.titleRequired"));return}const i=Number(u);if(!Number.isFinite(i)||i<5){F(o("common:profile.booking.durationInvalid"));return}const w=Ie();if(w.length===0){F(o("common:profile.booking.enableOneDay"));return}for(const M of w)if(M.intervals[0].end<=M.intervals[0].start){F(o("common:profile.booking.endAfterStart"));return}const O=B.map(M=>({id:M.id,label:M.label.trim(),type:M.type,required:M.required,...M.type==="select"?{options:M.optionsText.split(",").map(Le=>Le.trim()).filter(Boolean)}:{}})).filter(M=>M.label);for(const M of O)if(M.type==="select"&&(!M.options||M.options.length===0)){F(`La pregunta "${M.label}" necesita al menos una opción`);return}const I={title:p.trim(),description:h.trim()||null,durationMinutes:i,minNoticeMinutes:Number(D)||0,locationType:j,locationDetail:T.trim()||null,weeklyAvailability:w,customQuestions:O};r&&t?ue.mutate({surface:U,eventTypeId:t.id,data:I}):de.mutate({surface:U,pageId:s,data:I})};return e.jsx(ye,{open:!0,onOpenChange:i=>!i&&n(),children:e.jsxs(ke,{className:"max-h-[88vh] overflow-y-auto sm:max-w-2xl",children:[e.jsx(Ce,{children:e.jsx(we,{children:o(r?"common:profile.booking.editEventType":"common:profile.booking.newEventType")})}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:o("common:settings.deviceAppearance.linkPreviewTitle")}),e.jsx(E,{value:p,onChange:i=>d(i.target.value),placeholder:o("common:profile.booking.titlePlaceholder")})]}),e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:o("common:tableHeaders.description")}),e.jsx(Ne,{value:h,onChange:i=>a(i.target.value),rows:2})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:o("common:reservations.form.durationMin")}),e.jsx(E,{type:"number",min:5,value:u,onChange:i=>N(i.target.value)})]}),e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:o("common:profile.booking.minNotice")}),e.jsx(E,{type:"number",min:0,value:D,onChange:i=>c(i.target.value)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:o("common:profile.booking.location")}),e.jsxs(W,{value:j,onValueChange:i=>g(i),children:[e.jsx(K,{className:"w-full",children:e.jsx(J,{})}),e.jsxs(Z,{children:[e.jsx($,{value:"google_meet",children:"Google Meet"}),e.jsx($,{value:"phone",children:o("common:meetingBooking.page.phone")}),e.jsx($,{value:"in_person",children:o("common:meetingBooking.page.inPerson")}),e.jsx($,{value:"custom",children:o("common:meetingBooking.toBeArranged")})]})]})]}),j!=="google_meet"&&e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:o("common:implementationPlan.detail")}),e.jsx(E,{value:T,onChange:i=>y(i.target.value),placeholder:o(j==="phone"?"common:profile.booking.number":"common:profile.booking.addressPlaceholder")})]})]}),e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-2 block text-sm font-medium",children:o("common:profile.booking.weeklyAvailability")}),e.jsx("div",{className:"border-border divide-border divide-y rounded-xl border",children:X.map(i=>{const w=S[i.value];return e.jsxs("div",{className:"flex items-center gap-4 px-3 py-2.5",children:[e.jsxs("label",{className:"flex w-32 shrink-0 cursor-pointer select-none items-center gap-2",children:[e.jsx(re,{checked:w.enabled,onCheckedChange:O=>k(I=>({...I,[i.value]:{...I[i.value],enabled:O===!0}}))}),e.jsx("span",{className:"text-type text-sm",children:i.label})]}),w.enabled?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{type:"time",value:w.start,onCh
1ange:O=>k(I=>({...I,[i.value]:{...I[i.value],start:O.target.value}})),className:"w-36"}),e.jsx("span",{className:"text-muted-foreground",children:"–"}),e.jsx(E,{type:"time",value:w.end,onChange:O=>k(I=>({...I,[i.value]:{...I[i.value],end:O.target.value}})),className:"w-36"})]}):e.jsx("span",{className:"text-muted-foreground text-sm",children:o("common:statusTooltips.unavailable")})]},i.value)})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx(P,{className:"text-type text-sm font-medium",children:o("common:profile.booking.questions")}),e.jsxs(b,{variant:"ghost",size:"sm",onClick:ee,children:[e.jsx(ce,{className:"h-4 w-4"})," ",o("common:add")]})]}),B.length===0?e.jsx("p",{className:"text-muted-foreground text-xs",children:o("common:profile.booking.questionsHint")}):e.jsx("div",{className:"space-y-2",children:B.map(i=>e.jsxs("div",{className:"border-border space-y-2 rounded-xl border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{value:i.label,onChange:w=>v(i.id,{label:w.target.value}),placeholder:o("common:profile.booking.questionPlaceholder")}),e.jsx(b,{variant:"ghost",size:"icon","aria-label":o("common:profile.booking.deleteQuestion"),onClick:()=>H(i.id),children:e.jsx(Ee,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(W,{value:i.type,onValueChange:w=>v(i.id,{type:w}),children:[e.jsx(K,{className:"w-40",children:e.jsx(J,{})}),e.jsx(Z,{children:Object.keys(fe).map(w=>e.jsx($,{value:w,children:fe[w]},w))})]}),e.jsxs("label",{className:"flex cursor-pointer select-none items-center gap-2 text-sm",children:[e.jsx(re,{checked:i.required,onCheckedChange:w=>v(i.id,{required:w===!0})}),e.jsx("span",{className:"text-type",children:o("common:profile.booking.required")})]})]}),i.type==="select"&&e.jsx(E,{value:i.optionsText,onChange:w=>v(i.id,{optionsText:w.target.value}),placeholder:o("common:profile.booking.optionsPlaceholder")})]},i.id))})]}),C&&e.jsx("p",{className:"text-error text-sm",children:C})]}),e.jsxs(Pe,{children:[e.jsx(b,{variant:"outline",onClick:n,children:o("common:cancel")}),e.jsxs(b,{onClick:Ae,children:[De&&e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}),o(r?"common:save":"common:create")]})]})]})})}function lt(){const{t:s}=A(["common"]),{data:t,isLoading:n}=x.booking.myBookings.useQuery({surface:U,upcomingOnly:!0}),o=x.useUtils(),[l,r]=m.useState(null),[p,d]=m.useState(null),h=x.booking.cancelBooking.useMutation({onSuccess:()=>{f.success("Reunión cancelada"),o.booking.myBookings.invalidate()},onError:a=>f.error(a.message||"No se pudo cancelar")}
1);return e.jsxs(L,{title:s("common:profile.booking.upcoming"),description:s("common:profile.booking.upcomingDescription"),children:[n?e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[e.jsx(_,{className:"h-4 w-4 animate-spin"})," ",s("common:settings.themes.kioskPreview.loading")]}):!t||t.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:s("common:profile.booking.noUpcoming")}):e.jsx("div",{className:"flex flex-col gap-2",children:t.map(a=>e.jsxs("div",{className:"border-border flex flex-col gap-2 rounded-xl border p-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-type text-sm font-medium",children:[a.eventTitle," · ",a.inviteeName]}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:[ie(a.startIso)," (",a.timezoneLabel,") · ",a.inviteeEmail,a.inviteePhone?` · ${a.inviteePhone}`:""]}),(a.customAnswers.length>0||a.inviteeNotes)&&e.jsxs("div",{className:"bg-muted text-type mt-1.5 space-y-0.5 rounded-md px-2 py-1 text-xs",children:[a.customAnswers.map(u=>e.jsxs("p",{className:"whitespace-pre-wrap",children:[e.jsxs("span",{className:"text-muted-foreground",children:[u.label,": "]}),u.answer]},u.questionId)),a.inviteeNotes&&e.jsxs("p",{className:"whitespace-pre-wrap",children:[e.jsxs("span",{className:"text-muted-foreground",children:[s("common:profile.booking.note")," "]}),a.inviteeNotes]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.meetingUrl&&e.jsx(b,{variant:"ghost",size:"icon","aria-label":s("common:profile.booking.join"),asChild:!0,children:e.jsx("a",{href:a.meetingUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(Te,{className:"h-4 w-4"})})}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>d(a),children:s("common:edit")}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>r(a),children:s("common:cancel")})]})]},a.id))}),e.jsx(ss,{open:!!l,onOpenChange:a=>!a&&r(null),children:e.jsxs(ts,{children:[e.jsxs(ns,{children:[e.jsx(as,{children:s("common:profile.booking.cancelQuestion")}),e.jsxs(os,{children:[l&&`${l.eventTitle} con ${l.inviteeName} · ${ie(l.startIso)}.`," ",s("common:profile.booking.guestNotified")]})]}),e.jsxs(is,{children:[e.jsx(rs,{children:s("common:meetingBooking.back")}),e.jsx(ls,{className:"bg-destructive text-type-foreground hover:bg-destructive/90",onClick:()=>{l&&h.mutate({surface:U,bookingId:l.id}),r(null)},children:s("common:meetingBooking.manage.cancelMeeting")})]})]})}),p&&e.jsx(ct,{booking:p,onClose:()=>d(null)})]})}function ct({booking:s,onClose:t}){const{t:n}=A(["common"]),o=x.useUtils(),[l,r]=m.useState(()=>et(s.startIso)),[p,d]=m.useState(null),h=x.booking.rescheduleBooking.useMutation({onSuccess:()=>{f.success("Reunión reprogramada"),o.booking.myBookings.invalidate(),t()},onError:a=>d(a.message||"No se pudo reprogramar")});return e.jsx(ye,{open:!0,onOpenChange:a=>!a&&t(),children:e.jsxs(ke,{className:"sm:max-w-md",children:[e.jsx(Ce,{children:e.jsx(we,{children:n("common:profile.booking.reschedule")})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.eventTitle," · ",s.inviteeName]}),e.jsxs("div",{children:[e.jsx(P,{className:"text-type mb-1 block text-sm font-medium",children:n("common:profile.booking.newDateTime")}),e.jsx(E,{type:"datetime-local",value:l,onChange:a=>r(a.target.value)})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:n("common:profile.booking.rescheduleHint")}),p&&e.jsx("p",{className:"text-error text-sm",children:p})]}),e.jsxs(Pe,{children:[e.jsx(b,{variant:"outline",onClick:t,children:n("common:cancel")}),e.jsxs(b,{onClick:()=>{if(d(null),!l){d(n("common:profile.booking.pickDateTime"));return}h.mutate({surface:U,bookingId:s.id,newStartIso:new Date(l).toISOString()})},children:[h.isPending&&e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}),n("common:save")]})]})]})})}export{Pt as A,Et as B,St as I,_s as P,zs as g,wt as i};
2//# sourceMappingURL=booking-scheduling-tab-bWHvpYU0.js.map

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.