1import{r as d,j as e,c as q}from"./client-auj285-g.js";const R=d.createContext(null),F=R.Provider;function v(){const t=d.useContext(R);if(!t)throw new Error("SalonBookingContext not provided");return t}function B(t,s={}){return{Authorization:`Bearer ${t.idToken}`,...s}}function z(t,s){const n=new URL(t,window.location.origin);return n.searchParams.set("liffId",s.liffId),n.pathname+n.search}async function $(t,s){const n=await fetch(z(t,s),{headers:B(s)});if(!n.ok)throw new Error(`API ${n.status}: ${await n.text()}`);return n.json()}async function Z(t,s,n,r={}){const l=await fetch(z(t,n),{method:"POST",headers:B(n,{"Content-Type":"application/json",...r}),body:JSON.stringify(s)});if(!l.ok){const i=await l.text();let m=null;try{m=JSON.parse(i)}catch{}const c=new Error(`API ${l.status}`);throw c.status=l.status,c.body=m??i,c}return l.json()}function T(t){return{menus:()=>$("/api/liff/booking/menus",t),staffOf:s=>$(`/api/liff/booking/menus/${s}/staff`,t),availability:(s,n,r,l)=>{const i=new URLSearchParams({menu_id:s,from:r,to:l});return n&&i.set("staff_id",n),$(`/api/liff/booking/availability?${i}`,t)},createRequest:(s,n)=>Z("/api/liff/booking/requests",s,t,{"Idempotency-Key":n}),me:()=>$("/api/liff/booking/me",t)}}function K({onSelect:t}){const s=v(),[n,r]=d.useState(null),[l,i]=d.useState(null);if(d.useEffect(()=>{i(null),T(s).menus().then(c=>r(c.menus)).catch(c=>i(c instanceof Error?c.message:String(c)))},[s]),l)return e.jsxs("div",{className:"sb-card text-center",style:{animation:"sb-fade-in 0.3s"},children:[e.jsx("p",{className:"text-red-600 text-sm mb-3",children:"ã¡ãã¥ã¼æ
å ±ã
1®åå¾ã«å¤±æãã¾ãã"}),e.jsx("p",{className:"text-gray-500 text-xs mb-4",children:l}),e.jsx("button",{onClick:()=>window.location.reload(),className:"text-sm font-semibold sb-line-green-text underline",children:"åèªã¿è¾¼ã¿"})]});if(!n)return e.jsxs("div",{className:"flex flex-col items-center py-12",children:[e.jsx("div",{className:"sb-spinner"}),e.jsx("p",{className:"text-sm text-gray-500 mt-3",children:"ã¡ãã¥ã¼ãèªã¿è¾¼ã¿ä¸â¦"})]});if(n.length===0)return e.jsx("div",{className:"sb-card text-center text-sm text-gray-500",children:"ã¾ã ã¡ãã¥ã¼ãç»é²ããã¦ãã¾ãã"});const m=new Map;for(const c of n){const o=c.category_label??"ãã®ä»";m.has(o)||m.set(o,[]),m.get(o).push(c)}return e.jsxs("div",{className:"space-y-5 sb-fade-in",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-base font-bold text-gray-900",children:"ã¡ãã¥ã¼ãé¸ãã§ãã ãã"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"step 1 / 4"})]}),[...m.entries()].map(([c,o])=>e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide px-1",children:c}),e.jsx("ul",{className:"space-y-2",children:o.map(a=>e.jsx("li",{children:e.jsx("button",{onClick:()=>t(a),className:"w-full text-left sb-card hover:shadow-md transition-shadow active:scale-[0.99]",style:{transition:"box-shadow 0.15s, transform 0.1s"},children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-gray-900",children:a.name}),a.description&&e.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-2",children:a.description}),e.jsxs("div",{className:"text-xs text-gray-400 mt-2",children:["æè¦ ",a.duration_minutes,"å",a.buffer_after_minutes>0&&e.jsxs("span",{className:"text-gray-300",children:[" +",a.buffer_after_minutes]})]})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsxs("div",{className:"font-bold sb-line-green-text tabular-nums",children:["Â¥",a.base_price.toLocaleString()]}),e.jsx("div",{className:"text-xs text-gray-300",children:"ã"})]})]})})},a.id))})]},c))]})}function Y({menuId:t,basePrice:s,onSelect:n,onBack:r}){const l=v(),[i,m]=d.useState(null),[c,o]=d.useState(null);return d.useEffect(()=>{o(null),T(l).staffOf(t).then(a=>m(a.staff)).catch(a=>o(a instanceof Error?a.message:String(a)))},[l,t]),c?e.jsxs("div",{className:"space-y-5 sb-fade-in",children:[e.jsx(E,{onBack:r}),e.jsxs("div",{className:"sb-card text-center",children:[e.jsx("p",{className:"text-red-600 text-sm mb-2",children:"ã¹ã¿ããæ
å ±ã®åå¾ã«å¤±æãã¾ãã"}),e.jsx("p",{className:"text-gray-500 text-xs mb-4",children:c}),e.jsx("button",{onClick:()=>window.location.reload(),className:"text-sm font-semibold sb-line-green-text underline",children:"åèªã¿è¾¼ã¿"})]})]}):i?i.length===0?e.jsxs("div",{className:"space-y-5 sb-fade-in",children:[e.jsx(E,{onBack:r}),e.jsx("div",{className:"sb-card text-center text-sm text-gray-500",children:"ãã®ã¡ãã¥ã¼ãæ
å½ã§ããã¹ã¿ããããã¾ãã"})]}):e.jsxs("div",{className:"space-y-5 sb-fade-in",children:[e.jsx(E,{onBack:r}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-base font-bold text-gray-900",children:"æ
å½ãé¸ãã§ãã ãã"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"step 2 / 4"})]}),e.jsx("ul",{className:"space-y-2",children:i.map(a=>e.jsx("li",{children:e.jsxs("button",{onClick:()=>n(a),className:"w-full sb-card flex items-center gap-3 active:scale-[0.99]",style:{transition:"transform 0.1s, box-shadow 0.15s"},children:[a.profile_image_url?e.jsx("img",{src:a.profile_image_url,alt:a.display_name,className:"w-12 h-12 rounded-full object-cover shrink-0"}):e.jsx("div",{className:"w-12 h-12 rounded-full shrink-0 flex items-center justify-center text-white font-semibold",style:{background:a.is_designation_optional?"#9CA3AF":"linear-gradient(135deg, #06C755 0%, #04a046 100%)"},children:a.is_designation_optional?"æ":a.display_name.slice(0,1)}),e.jsxs("div",{className:"text-left flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-gray-900",children:a.display_name}),a.role&&e.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:a.role}),a.is_designation_optional?e.jsx("div",{className:"text-xs text-purple-600 mt-1",children:"æåãªãæ "}):null]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsxs("div",{className:"text-sm font-semibold sb-line-green-text tabular-nums",children:["Â¥",a.price.toLocaleStr
1ing()]}),a.price!==s&&e.jsx("div",{className:"text-xs text-gray-300",children:"ã"})]})]})},a.id))})]}):e.jsxs("div",{className:"space-y-5 sb-fade-in",children:[e.jsx(E,{onBack:r}),e.jsxs("div",{className:"flex flex-col items-center py-12",children:[e.jsx("div",{className:"sb-spinner"}),e.jsx("p",{className:"text-sm text-gray-500 mt-3",children:"ã¹ã¿ãããèªã¿è¾¼ã¿ä¸â¦"})]})]})}function E({onBack:t}){return e.jsxs("button",{onClick:t,className:"sb-back-btn",children:[e.jsx("span",{"aria-hidden":!0,children:"â"}),"æ»ã"]})}const W=9*36e5;function G(){const t=new Date;return new Date(t.getTime()+W).toISOString().slice(0,10)}function y(t,s){const n=new Date(`${t}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()+s),n.toISOString().slice(0,10)}function D(t){const s=new Date(`${t}T00:00:00Z`);return`${s.getUTCMonth()+1}/${s.getUTCDate()}(${"æ¥æç«æ°´æ¨éå"[s.getUTCDay()]})`}function Q(t,s){return new Date(`${t}T${s}:00+09:00`).toISOString()}function V(t){const s=new Date(new Date(t).getTime()+W).toISOString();return`${s.slice(0,10)} ${s.slice(11,16)}`}function X(t){const[s,n]=t.split(":").map(Number);return s*60+n}function ee(t){const s=Math.floor(t/60),n=t%60;return`${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`}const te=30;function se({byDate:t,weekStart:s,onPick:n,selectedDate:r,selectedStart:l}){const i=d.useMemo(()=>Array.from({length:7},(a,f)=>y(s,f)),[s]),{rows:m,hasAny:c}=d.useMemo(()=>{const a=new Set;for(const x of i)for(const u of t[x]??[])a.add(X(u));if(a.size===0)return{rows:[],hasAny:!1};const f=Math.min(...a),h=Math.max(...a),b=[];for(let x=f;x<=h;x+=te)b.push(ee(x));return{rows:b,hasAny:!0}},[t,i]);if(!c)return e.jsx("div",{className:"sb-card text-center text-sm text-gray-500 py-8",children:"ãã®é±ã«ç©ºãã¯ããã¾ãã"});const o=new Date(Date.now()+9*36e5).toISOString().slice(0,10);return e.jsx("div",{className:"bg-white rounded-2xl overflow-hidden",style:{boxShadow:"0 1px 3px rgba(0,0,0,0.06)",padding:4},children:e.jsxs("div",{className:"grid text-center",style:{gridTemplateColumns:"40px repeat(7, minmax(0, 1fr))",gap:0},children:[e.jsx("div",{className:"bg-gray-50 border-b border-gray-200"}),i.map(a=>{const f=new Date(`${a}T00:00:00Z`).getUTCDay(),h=a===o,b=f===0?"#ef4444":f===6?"#3b82f6":"#374151";return e.jsxs("div",{className:"bg-gray-50 border-b border-gray-200 py-2 px-1",style:{color:b},children:[e.jsx("div",{className:"text-[10px] leading-none font-medium",children:"æ¥æç«æ°´æ¨éå"[f]}),e.jsx("div",{className:"text-sm font-bold mt-1 leading-none",style:h?{color:"#fff",background:"#06C755",borderRadius:9999,width:22,height:22,display:"inline-flex",alignItems:"center",justifyContent:"center"}:void 0,children:Number(a.slice(8))})]},a)}),m.map(a=>{const f=a.endsWith(":00");return e.jsxs("div",{style:{display:"contents"},children:[e.jsx("div",{className:"border-r border-gray-100 text-[10px] text-gray-400 tabular-nums flex items-start justify-center pt-0.5",style:{height:36,borderTop:f?"1px solid #e5e7eb":"1px dashed #f3f4f6"},children:f?a:""}),i.map(h=>{const x=(t[h]??[]).includes(a),u=x&&r===h&&l===a;return e.jsx("div",{className:"border-r border-gray-100",style:{height:36,borderTop:f?"1px solid #e5e7eb":"1px dashed #f3f4f6",padding:1},children:x?e.jsx("button",{onClick:()=>n({date:h,start:a}),className:"rounded-md transition-transform active:scale-90 tabular-nums",style:{width:"100%",height:"100%",background:u?"#06C755":"#ecfdf5",border:u?"1.5px solid #06C755":"1px solid #86efac",color:u?"#fff":"#047857",fontSize:11,fontWeight:700,lineHeight:1},"aria-label":`${D(h)} ${a}`,children:u?"â":a}):null},`${h}-${a}`)})]},`row-${a}`)})]})})}const O=14;function ae({menuId:t,staffId:s,ctaLabel:n,onSelect:r,onBack:l,selected:i}){const m=v(),c=d.useMemo(()=>G(),[]),o=c,a=y(c,O-1),f=Math.floor((O-1)/7),[h,b]=d.useState(null),[x,u]=d.useState(null),[j,p]=d.useState(0);if(d.useEffect(()=>{u(null),T(m).availability(t,s,o,a).then(S=>{var A,U;const J=((A=S.by_staff[0])==null?void 0:A.slots)??[],k={};for(const g of J)(k[U=g.date]??(k[U]=[])).push(g.start);if(b(k),i)for(let g=0;g<=f;g++){const M=y(c,g*7);for(let w=0;w<7;w++)if(y(M,w)===i.date){p(g);return}}for(let g=0;g<=f;g++){const M=y(c,g*7);let w=!1;for(let L=0;L<7;L++)if((k[y(M,L)]??[]).length>0){w=!0;break}if(w){p(g);break}}}).catch(S=>u(S instanceof Error?S.message:String(S)))},[m,t,s,o,a,c,f]),x)return e.jsxs("div",{className:"space-y-5 sb-fade-in",children:[e.jsx(I,{onBack:l}),e.jsxs("div",{className:"sb-card text-center",children:[e.jsx("p",{className:"text-red-600 text-sm mb-2",children:"ç©ºãæ ã®åå¾ã«å¤±æãã¾ãã"}),e.jsx("p",{className:"text-gray-500 text-xs",children:x})]})]});if(!h)return e.jsxs("div",{className:"space-y-5 sb-fade-in",children:[e.jsx(I,{onBack:l}),e.jsxs("div",{className:"flex flex-col items-center py-12",children:[e.jsx("div",{className:"sb-spinner"}),e.jsx("p",{className:"text-sm text-gray-500 mt-3",children:"ç©ºãæ ãåå¾ä¸â¦"})]})]});const N=y(c,j*7),H=y(N,6);return e.jsxs("div",{className:"space-y-5 sb-fade-in",children:[e.jsx(I,{onBack:l}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-base font-bold text-gray-900",children:"æ¥æãé¸ãã§ãã ãã"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:n})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("button",{onClick:()=>p(Math.max(0,j-1)),disabled:j===0,className:"px-3 py-1.5 text-xs rounded-lg disabled:opacity-30",style:{background:"#f3f4f6",color:"#374151"},children:"â åé±"}),e.jsxs("span",{className:"text-xs text-gray-600 tabular-nums",children:[D(N)," ã ",D(H)]}),e.jsx("button",{onClick:()=>p(Math.min(f,j+1)),disabled:j>=f,className:"px-3 py-1.5 text-xs rounded-lg disabled:opacity-30",style:{background:"#f3f4f6",color:"#374151"},children:"æ¬¡é± â"})]}),e.jsx(se,{byDate:h,weekStart:N,onPick:r,selectedDate:i==null?void 0:i.date,selectedStart:i==null?void 0:i.start}),e.jsx("p",{className:"text-[11px] text-gray-400 text-center pt-1",children:"ç·ã®ã»ã«ãã¿ãããã¦æéã鏿"})]})}function I({onBack:t}){return e.jsxs("button",{onClick:t,className:"sb-back-btn",children:[e.jsx("span",{"aria-hidden":!0,
1children:"â"}),"æ»ã"]})}function ne({menu:t,staff:s,slot:n,onSubmitted:r,onBack:l}){const i=v(),[m,c]=d.useState(""),[o,a]=d.useState(!1),[f,h]=d.useState(null),[b]=d.useState(()=>crypto.randomUUID());async function x(){var u;a(!0),h(null);try{await T(i).createRequest({menu_id:t.id,staff_id:s.id,starts_at:Q(n.date,n.start),customer_note:m||void 0},b),r()}catch(j){const p=j;p.status===409&&((u=p.body)==null?void 0:u.error)==="slot_conflict"?h("ãã®æéæ ã¯ä»ã®æ¹ã®äºç´ã¨éãªãã¾ãããæ¥æãé¸ã³ç´ãã¦ãã ããã"):h("äºç´ãªã¯ã¨ã¹ãã®éä¿¡ã«å¤±æãã¾ãããæéãããã¦å度ã試ããã ããã")}finally{a(!1)}}return e.jsxs("div",{className:"space-y-4 sb-slide-up",children:[e.jsxs("button",{onClick:l,className:"sb-back-btn",children:[e.jsx("span",{"aria-hidden":!0,children:"â"}),"æ»ã"]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-base font-bold text-gray-900",children:"å
容ã®ã確èª"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"step 4 / 4"})]}),e.jsx("div",{className:"sb-card",children:e.jsxs("dl",{className:"space-y-3 text-sm",children:[e.jsx(C,{label:"ã¡ãã¥ã¼",value:t.name}),e.jsx(C,{label:"æ
å½",value:s.display_name}),e.jsx(C,{label:"æ¥æ",value:`${D(n.date)} ${n.start}`}),e.jsx(C,{label:"æè¦",value:`${s.duration_minutes} å`}),e.jsx(C,{label:"æé",value:`Â¥${s.price.toLocaleString()}`,valueClassName:"font-bold text-base sb-line-green-text"})]})}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-gray-600 mb-1 block",children:"ãè¦æï¼ä»»æï¼"}),e.jsx("textarea",{value:m,onChange:u=>c(u.target.value),className:"w-full border border-gray-300 rounded-xl px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-500 resize-y bg-white",rows:3,placeholder:"髪åã®å¸æãã¢ã¬ã«ã®ã¼ããã®ä»"})]}),f&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-xl text-red-700 text-sm",children:f}),e.jsx("button",{onClick:x,disabled:o,className:"w-full text-white py-3.5 rounded-xl font-bold disabled:opacity-50",style:{background:"#06C755",boxShadow:"0 1px 3px rgba(6, 199, 85, 0.3)"},children:o?"éä¿¡ä¸â¦":"äºç´ããªã¯ã¨ã¹ã"}),e.jsx("p",{className:"text-xs text-gray-400 text-center",children:"確å®ãã㨠LINE ã«éç¥ãå±ãã¾ã"})]})}function C({label:t,value:s,valueClassName:n}){return e.jsxs("div",{className:"flex justify-between items-center pb-3 border-b border-gray-100 last:border-b-0 last:pb-0",children:[e.jsx("dt",{className:"text-gray-500 text-xs",children:t}),e.jsx("dd",{className:`text-gray-900 ${n??""}`,children:s})]})}function re(){const t=v();function s(){const r=new URL(window.location.href);r.searchParams.set("view","history"),window.location.href=r.toString()}function n(){const r=window.liff;if(r!=null&&r.closeWindow)try{r.closeWindow();return}catch{}window.close()}return e.jsxs("div",{className:"sb-fade-in pt-8 pb-4",children:[e.jsxs("div",{className:"sb-card text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto rounded-full flex items-center justify-center text-white text-3xl font-bold",style:{background:"#06C755"},children:"â"}),e.jsx("h1",{className:"text-lg font-bold text-gray-900 mt-4",children:"ãªã¯ã¨ã¹ããéä¿¡ãã¾ãã"}),e.jsxs("p",{className:"text-sm text-gray-600 mt-3 leading-relaxed",children:["ãåºããã®è¿ä¿¡ããå¾
ã¡ãã ããã",e.jsx("br",{}),"確å®ãã㨠LINE ã«éç¥ãå±ãã¾ãã"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-6",children:[e.jsx("button",{onClick:s,className:"py-3 rounded-xl font-semibold text-sm border-2 sb-line-green-text",style:{borderColor:"#06C755"},children:"äºç´å±¥æ´"}),e.jsx("button",{onClick:n,className:"py-3 rounded-xl font-semibold text-sm text-white",style:{background:"#06C755"},children:"éãã"})]})]}),e.jsxs("p",{className:"text-xs text-gray-400 text-center mt-4",children:["user: ",t.lineUserId.slice(0,8),"â¦"]})]})}const P=[{key:"menu",label:"ã¡ãã¥ã¼"},{key:"staff",label:"æ
å½"},{key:"datetime",label:"æ¥æ"},{key:"confirm",label:"確èª"}];function le({peekMode:t,exitPeek:s}
1){const[n,r]=d.useState("menu"),[l,i]=d.useState(null),[m,c]=d.useState(null),[o,a]=d.useState(null);function f(){const x=new URL(window.location.href);x.searchParams.delete("mode"),window.history.replaceState(null,"",x.toString()),s(),r("confirm")}const h=n!=="done",b=P.findIndex(x=>x.key===n);return e.jsxs("div",{children:[h&&b>=0&&e.jsx("div",{className:"mb-5 px-1",style:{display:"grid",gridTemplateColumns:`repeat(${P.length}, minmax(0, 1fr))`,gap:0},children:P.map((x,u)=>{const j=u<b,p=u===b,N=u>b;return e.jsxs("div",{className:"relative flex flex-col items-center",children:[u>0&&e.jsx("span",{"aria-hidden":!0,className:"absolute",style:{top:12,left:"-50%",width:"100%",height:2,background:u<=b?"#06C755":"#e5e7eb",zIndex:0}}),e.jsx("div",{className:"relative flex items-center justify-center",style:{width:24,height:24,borderRadius:9999,background:N?"#e5e7eb":"#06C755",color:N?"#9ca3af":"#fff",fontSize:11,fontWeight:700,zIndex:1,boxShadow:p?"0 0 0 4px rgba(6, 199, 85, 0.18)":"none",transform:p?"scale(1.1)":"scale(1)",transition:"transform 0.2s, box-shadow 0.2s"},children:j?"â":u+1}),e.jsx("span",{className:"mt-1.5 text-[10px] leading-tight",style:{color:p?"#111827":"#9ca3af",fontWeight:p?700:500},children:x.label})]},x.key)})}),n==="menu"&&e.jsx(K,{onSelect:x=>{(l==null?void 0:l.id)!==x.id&&(c(null),a(null)),i(x),r("staff")}}),n==="staff"&&l&&e.jsx(Y,{menuId:l.id,basePrice:l.base_price,onSelect:x=>{(m==null?void 0:m.id)!==x.id&&a(null),c(x),r("datetime")},onBack:()=>r("menu")}),n==="datetime"&&l&&m&&e.jsx(ae,{menuId:l.id,staffId:m.id,ctaLabel:t?"空ãç¶æ³ã®ç¢ºèªã¢ã¼ãã§ãï¼ã¿ããã§äºç´ã«é²ãã¾ãï¼":"step 3 / 4",selected:o,onSelect:x=>{a(x),t||r("confirm")},onBack:()=>r("staff")}),n==="datetime"&&t&&o&&e.jsx("div",{className:"fixed bottom-0 left-0 right-0 px-4 py-3 sb-slide-up",style:{background:"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",borderTop:"1px solid #e5e7eb"},children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsxs("p",{className:"text-xs text-gray-600 mb-2",children:["鏿ä¸: ",e.jsxs("span",{className:"font-semibold",children:[o.date," ",o.start]})]}),e.jsx("button",{onClick:f,className:"w-full text-white py-3 rounded-xl font-bold text-sm",style:{background:"#06C755",boxShadow:"0 1px 3px rgba(6, 199, 85, 0.3)"},children:"ãã®æéã§äºç´ã«é²ã"})]})}),n==="confirm"&&l&&m&&o&&e.jsx(ne,{menu:l,staff:m,slot:o,onSubmitted:()=>r("done"),onBack:()=>r("datetime")}),n==="done"&&e.jsx(re,{})]})}const ie={requested:{label:"ãªã¯ã¨ã¹ãä¸",bg:"#fef3c7",fg:"#92400e"},confirmed:{label:"確å®",bg:"#d1fae5",fg:"#065f46"},rejected:{label:"ä¸å¯",bg:"#f3f4f6",fg:"#6b7280"},expired:{label:"æéåã",bg:"#f3f4f6",fg:"#6b7280"},cancelled:{label:"ãã£ã³ã»ã«",bg:"#f3f4f6",fg:"#6b7280"},completed:{label:"å®äº",bg:"#dbeafe",fg:"#1e40af"},no_show:{label:"ç¡æ",bg:"#fee2e2",fg:"#991b1b"}};function ce({booking:t}){const s=ie[t.status]??{label:t.status,bg:"#f3f4f6",fg:"#6b7280"};return e.jsxs("li",{className:"sb-card flex gap-3 items-start",children:[t.profile_image_url?e.jsx("img",{src:t.profile_image_url,alt:t.staff_name,className:"w-11 h-11 rounded-full object-cover shrink-0"}):e.jsx("div",{className:"w-11 h-11 rounded-full bg-gray-200 shrink-0 flex items-center justify-center text-gray-400 text-sm",children:t.staff_name.slice(0,1)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-gray-900 truncate",children:t.menu_name}),e.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:t.staff_name}),e.jsx("div",{className:"text-xs text-gray-600 mt-1 tabular-nums",children:V(t.starts_at)})]}),e.jsx("span",{className:"sb-badge shrink-0",style:{background:s.bg,color:s.fg},children:s.label})]})}function oe(){const t=v(),[s,n]=d.useState(null),[r,l]=d.useState("upcoming"),[i,m]=d.useState(null);if(d.useEffect(()=>{m(null),T(t).me().then(n).catch(o=>m(o instanceof Error?o.message:String(o)))},[t]),i)return e.jsx("div",{className:"sb-fade-in space-y-5",children:e.jsxs("div",{className:"sb-card text-center",children:[e.jsx("p",{className:"text-red-600 text-sm mb-2",children:"äºç´å±¥æ´ã®åå¾ã«å¤±æãã¾ãã"}),e.jsx("p",{className:"text-gray-500 text-xs mb-4",children:i}),e.jsx("button",{onClick:()=>window.location.reload(),className:"text-sm font-semibold sb-line-green-text underline",children:"åèªã¿è¾¼ã¿"})]})});if(!s)return e.jsxs("div",{className:"flex flex-col items-center py-12 sb-fade-in",children:[e.jsx("div",{className:"sb-spinner"}),e.jsx("p",{className:"text-sm text-gray-500 mt-3",children:"èªã¿è¾¼ã¿ä¸â¦"})]});const c=r==="upcoming"?s.upcoming:s.past;return e.jsxs("div",{className:"space-y-4 sb-fade-in",children:[e.jsxs("div",{className:"grid grid-cols-2 rounded-xl overflow-hidden",style:{background:"#fff",boxShadow:"0 1px 2px rgba(0,0,0,0.04)"},children:[e.jsxs("button",{onClick:()=>l("upcoming"),className:"py-3 text-sm font-semibold transition-colors",style:{background:r==="upcoming"?"#06C755":"#fff",color:r==="upcoming"?"#fff":"#6b7280"},children:["ãããã (",s.upcoming.length,")"]}),e.jsxs("button",{onClick:()=>l("past"),className:"py-3 text-sm font-semibold transition-colors",style:{background:r==="past"?"#06C755":"#fff",color:r==="past"?"#fff":"#6b7280"},children:["éå» (",s.past.length,")"]})]}),c.length===0?e.jsx("div",{className:"sb-card text-center text-sm text-gray-500 py-8",children:r==="upcoming"?"ããããã®äºç´ã¯ããã¾ãã":"éå»ã®äºç´ã¯ããã¾ãã"}):e.jsx("ul",{className:"space-y-2",children:c.map(o=>e.jsx(ce,{booking:o},o.id))}),e.jsx("p",{className:"text-xs text-gray-400 text-center pt-2",children:"夿´ã»ãã£ã³ã»ã«ã¯ãåºã« LINE ã§ç´æ¥ãé£çµ¡ãã ãã"})]})}let _=null;function de(){const t=new URLSearchParams(window.location.search);return{view:t.get("view"),peekMode:t.get("mode")==="peek"}}function xe({ctx:t}
1){const s=de(),[n]=d.useState(s.view),[r,l]=d.useState(s.peekMode),i=n==="history"?"äºç´å±¥æ´":r?"空ãç¶æ³":"ãäºç´";return e.jsx(F,{value:t,children:e.jsxs("div",{className:"min-h-screen sb-fade-in",style:{background:"#f5f5f5"},children:[e.jsx("header",{className:"px-4 py-3 text-white text-center font-bold",style:{background:"#06C755",fontSize:"15px"},children:i}),e.jsx("main",{className:"max-w-md mx-auto px-4 py-4 pb-24",children:n==="history"?e.jsx(oe,{}):e.jsx(le,{peekMode:r,exitPeek:()=>l(!1)})})]})})}function fe(t,s){document.body.classList.add("sb-active"),_&&(_.unmount(),_=null),t.innerHTML="",_=q.createRoot(t),_.render(e.jsx(d.StrictMode,{children:e.jsx(xe,{ctx:s})}))}export{fe as mountSalonBooking};
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.