1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1663],{93364:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/yara",function(){return n(18725)}])},4096:function(e,t,n){"use strict";n.d(t,{Gl:function(){return h},Lc:function(){return b},YE:function(){return y},cc:function(){return f},kJ:function(){return _},pX:function(){return v},rK:function(){return g},u:function(){return m}});var r,i,l,s=n(54723),a=n.n(s),o=n(1503),d=n(38396);let c=String(null!==(l=null===(i=a()())||void 0===i?void 0:null===(r=i.publicRuntimeConfig)||void 0===r?void 0:r.CHAT_API_BASE)&&void 0!==l?l:"")||"https://j-n-khesht.p24cloud.ir";function u(){let e=(0,o.getCookie)("token");return"string"==typeof e&&e?{authorization:"Bearer ".concat(e)}:{}}let x="include";async function m(e){try{var t,n,r;let i=await fetch("".concat(c,"/api/khesht/chat/turn"),{method:"POST",credentials:x,headers:{"content-type":"application/json",...u()},body:JSON.stringify({text:e.text,explicit:e.explicit,...e.conversationId?{conversation_id:e.conversationId}:{},context:{city:null!==(n=e.city)&&void 0!==n?n:"ir",terminal_id:null!==(r=e.terminalId)&&void 0!==r?r:"",...(null===(t=e.bookings)||void 0===t?void 0:t.length)?{bookings:e.bookings}:{}}})});if(!i.ok)return null;return await i.json()}catch(e){return null}}async function h(){try{var e,t;let n=await fetch("".concat(c,"/api/khesht/chat/conversations?limit=30"),{headers:u(),credentials:x});if(!n.ok)return[];return null!==(t=null===(e=await n.json())||void 0===e?void 0:e.conversations)&&void 0!==t?t:[]}catch(e){return[]}}async function f(e){try{let t=await fetch("".concat(c,"/api/khesht/chat/conversations/").concat(encodeURIComponent(e)),{headers:u(),credentials:x});if(!t.ok)return null;return await t.json()}catch(e){return null}}function p(e,t){try{(0,d.d)("search").sendEvent({group:"search_metrics",type:e,event:t})}catch(e){}}function v(e){p("conversational_invite",{action:e,entry_point:"homepage",is_conversational:!0,has_token:!!(0,o.getCookie)("token")})}function b(e,t){var n,r;p("search_view",{has_token:!!(0,o.getCookie)("token"),filters:{text:null!==(n=e.search_query)&&void 0!==n?n:""},result_count:null!==(r=e.result_count)&&void 0!==r?r:0,query_id:e.query_id,location:"ir",conversation_id:e.conversation_id,turn_index:e.turn_index,is_conversational:!0,entry_point:t})}function g(e,t,n){var r,i;p("search_click_position",{card_data:{_id:e.id,position:e.position,title:e.title,type:e.type,url:e.url},query_id:t.queryId,result_count:null!==(r=t.resultCount)&&void 0!==r?r:0,filters:{text:null!==(i=t.searchQuery)&&void 0!==i?i:""},conversation_id:t.conversationId,turn_index:t.turnIndex,is_conversational:!0,entry_point:n})}function y(e,t,n){p("conversational_exit",{conversation_id:e,exit_reason:t,entry_point:n})}function _(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{fetch("".concat(c,"/api/khesht/chat/events"),{method:"POST",credentials:x,keepalive:!0,headers:{"content-type":"application/json",...u()},body:JSON.stringify({events:[{group:"yara",action:e,props:t}]})}).catch(()=>void 0)}catch(e){}}},44490:function(e,t,n){"use strict";n.d(t,{Rr:function(){return h}});var r=n(64162),i=n(40079),l=n(54723),s=n.n(l),a=n(69636),o=n(67255),d=n(27952);let c=new Set(["paziresh24.com","www.paziresh24.com"]),u=new Set(["localhost","127.0.0.1","0.0.0.0","local.paziresh24.com"]),x=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"production";return"development"===n&&"true"===String(null!==(t=e.CHAT_MVP_DEV_FAKE_LOGIN)&&void 0!==t?t:"")};RegExp("[?Ø]|(^|\\s)(دارÙ
|دارد|شدÙ
|شدÙâØ§Ù
|شد٠اÙ
|Ù
ÛâÚ©ÙÙ
|Ù
ÛÚ©ÙÙ
|برÙÙ
|برÙ
|Ù
راجع٠کÙÙ
|ÚÛکار|Ú٠کار|Ø¨Ø§ÛØ¯|ÙØ³ØªÙ
|ÙØ§Ø²Ù
دارÙ
)(\\s|$)|Ú٠دکتر|Ú٠پزشک|کداÙ
دکتر|کداÙ
پزشک|ب٠ÚÙ|ÚØ±Ø§ |Ø¢ÛØ§ |کجا |ÚØ·Ùر |ÚÚ¯ÙÙÙ |Ø¹ÙØª |Ø¯ÙØ¨Ø§Ù |Ù
ÛâØ®ÙØ§ÙÙ
|Ù
ÛâØ®ÙØ§Ù
|Ù
ÛØ®ÙاÙ
|Ù
ÛØ®ÙاÙÙ
|Ù
عرÙÛ Ú©Ù|Ù¾ÛØ¯Ø§ Ú©ÙÙ
|سراغ |Ú©Ø³Û Ú©Ù |Ù¾Ø²Ø´Ú©Û Ú©Ù|Ø¯Ú©ØªØ±Û Ú©Ù|ÙØ¨ÙÙ Ù
Ûâ?Ú©Ù|(?=.*(ÙÙØ¨Øª|ÙÙØª))(?=.*(ÙØºÙ|Ú©ÙØ³Ù|جابÙâ?جا|تغÛÛØ±))|ÙØ¸Ø± (ثبت|بذارÙ
|بدÙÙ
|بÙÙÛØ³Ù
)|ثبت ÙØ¸Ø±|ÙØ¸Ø±Ø§Øª بÛÙ
اراÙ|ÙØ¸Ø±Ø§Øª Ù
راجع|Ø±Ø¶Ø§ÛØª بÛÙ
اراÙ");let m=()=>{var e,t;return null!==(t=null===(e=s()())||void 0===e?void 0:e.publicRuntimeConfig)&&void 0!==t?t:{}};function h(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"invite",l=(0,i.useRouter)(),s=(0,o.Z)(e=>{var t;return null===(t=e.customize)||void 0===t?void 0:t.partnerKey}),h=(0,d.e)(e=>e.isLogin),f=(0,d.e)(e=>{var t;return null===(t=e.info)||void 0===t?void 0:t.id}),p=(0,d.e)(e=>e.pending),v=(0,a.cC)("conversational_search"),b=m(),g=String(null!==(e=b.CHAT_MVP_PREVIEW_KEY)&&void 0!==e?e:""),y=!!g&&l.query.chatPreview===g,_="true"===String(null!==(t=b.CHAT_MVP_ENABLED)&&void 0!==t?t:""),j=function(e,t){let n=String(null!=t?t:"").trim();return!!n&&String(null!=e?e:"").split(",").map(e=>
1e.trim()).filter(Boolean).includes(n)}(b.CHAT_MVP_ALLOW_USER_IDS,f),w=x(b);return(0,r.useMemo)(()=>{var e,t;let r=(e={host:window.location.host,partnerKey:s,isLogin:h||w,isAuthPending:p&&!w,featureEnabled:_&&("page"===n||v||y||j)}).featureEnabled?!function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=String(null!=e?e:"").trim().toLowerCase().split(":")[0];return!!n&&!!(c.has(n)||!t&&(u.has(n)||n.endsWith(".localhost"))||!t&&n.endsWith(".p24cloud.ir"))}(e.host,e.isProduction)?"host_not_allowed":String(null!==(t=e.partnerKey)&&void 0!==t?t:"").trim()?"partner_site":e.isAuthPending?"auth_pending":e.isLogin?null:"not_logged_in":"feature_off";return{allowed:null===r,reason:r,isPreview:y}},[s,h,p,_,v,y,j,w,n])}},18725:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return en},default:function(){return er}});var r=n(15436),i=n(39641),l=n.n(i),s=n(93337),a=n(64162),o=n(98899),d=n.n(o),c=n(40079),u=n(44490),x=n(58320),m=n(1503),h=n(27952),f=n(4096);let p={1:"رزر٠شدÙ",2:"ÙÛØ²Ûت شدÙ",3:"ÙØºÙ شدÙ",4:"در Ø§ÙØªØ¸Ø§Ø± پرداخت"},v=e=>{let{bookings:t,loading:n,onCancel:i}=e;return n?(0,r.jsx)("p",{className:"text-xs text-slate-400",children:"در ØØ§Ù Ú¯Ø±ÙØªÙ ÙÙØ¨ØªâÙØ§Û Ø´Ù
اâ¦"}):0===t.length?(0,r.jsx)("p",{className:"rounded-2xl bg-slate-100 px-3 py-2 text-xs leading-6",children:"ÙÙØ¨ØªÙ ÙØ¹Ø§ÙÛ Ù¾ÛØ¯Ø§ ÙکردÙ
. اگر تاز٠ÙÙØ¨Øª Ú¯Ø±ÙØªÙâØ§ÛØ¯Ø ÚÙØ¯ ÙØØ¸Ù Ø¨Ø¹Ø¯ Ø¯ÙØ¨Ø§Ø±Ù Ø¨Ù¾Ø±Ø³ÛØ¯."}):(0,r.jsx)("ul",{className:"flex flex-col gap-2",children:t.map((e,t)=>{var n;return(0,r.jsxs)("li",{className:"flex flex-col gap-1 rounded-xl border border-solid border-slate-200 p-3 text-xs",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsxs)("span",{className:"font-bold",children:[t+1,". ",e.doctor]}),(0,r.jsx)("span",{className:"shrink-0 text-slate-500",children:null!==(n=p[e.status])&&void 0!==n?n:""})]}),e.expertise&&(0,r.jsx)("span",{className:"text-slate-500",children:e.expertise}),(0,r.jsx)("span",{className:"text-slate-600",children:e.bookTime}),e.centerName&&(0,r.jsx)("span",{className:"text-slate-500",children:e.centerName}),(0,r.jsxs)("div",{className:"mt-1 flex gap-3",children:[(0,r.jsx)("a",{href:e.url,className:"text-primary underline",children:"Ø¬Ø²Ø¦ÛØ§Øª ÙÙØ¨Øª"}),i&&3!==e.status&&(0,r.jsx)("button",{type:"button",className:"text-red-600 underline",onClick:()=>i(e),children:"ÙØºÙ اÛÙ ÙÙØ¨Øª"})]})]},e.bookId)})})},b=e=>{let{booking:t,busy:n,onConfirm:i,onDismiss:l}=e;return(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-solid border-red-300 bg-red-50 p-3 text-xs",children:[(0,r.jsx)("p",{className:"font-bold text-red-700",children:"اÛÙ ÙÙØ¨Øª ÙØºÙ Ø´ÙØ¯Ø"}),(0,r.jsxs)("p",{className:"leading-6 text-slate-700",children:[t.doctor,t.expertise?" â ".concat(t.expertise):"",(0,r.jsx)("br",{}),t.bookTime,t.centerName?" â ".concat(t.centerName):""]}),(0,r.jsx)("p",{className:"text-[0.625rem] leading-5 text-slate-500",children:"ÙØºÙ ÙÙØ¨Øª ÙØ§Ø¨Ù بازگشت ÙÛØ³Øª. اگر ÙÛØ²Ûت Ø¢ÙÙØ§ÛÙ Ø¨ÙØ¯Ù ٠زÙ
Ø§ÙØ´ ÙØ±Ø³ÛØ¯ÙØ Ù
Ø¨ÙØº Ø·Û Û± تا Û·Û² ساعت Ú©Ø§Ø±Û Ø¨Ø±Ù
Ûâگردد."}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{type:"button",className:"rounded-xl bg-red-600 px-4 py-2 font-bold text-white disabled:opacity-50",disabled:n,onClick:i,children:n?"در ØØ§Ù ÙØºÙâ¦":"بÙÙØ ÙØºÙ Ú©Ù"}),(0,r.jsx)("button",{type:"button",className:"rounded-xl border border-solid border-slate-300 px-4 py-2",onClick:l,children:"Ù
ÙØµØ±Ù شدÙ
"})]})]})},g=e=>{var t,n;let{provider:i}=e,l=null!==(n=i.centers.find(e=>e.address||e.phones.length))&&void 0!==n?n:i.centers[0];return(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-solid border-slate-200 p-3 text-xs",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("a",{href:i.url,className:"font-bold text-primary underline",children:i.name}),null!==i.satisfaction&&(0,r.jsxs)("span",{className:"text-slate-500",children:["Ø±Ø¶Ø§ÛØª ",i.satisfaction,"Ùª"]})]}),i.expertise&&(0,r.jsx)("span",{className:"text-slate-500",children:i.expertise}),(null==l?void 0:l.address)&&(0,r.jsxs)("span",{className:"leading-6 text-slate-700",children:["آدرس: ",l.city?"".concat(l.city,"Ø "):"",l.address]}),(null==l?void 0:null===(t=l.phones)||void 0===t?void 0:t.length)?(0,r.jsxs)("span",{className:"text-slate-700",children:["تÙÙÙ:"," ",l.phones.map(e=>(0,r.jsx)("a",{href:"tel:".concat(e),className:"ml-2 text-primary underline",dir:"ltr",children:e},e))]}):null,i.insurances.length>0&&(0,r.jsxs)("span",{className:"text-slate-600",children:["بÛÙ
Ù: ",i.insurances.join("Ø ")]}),i.waiting_time&&(0,r.jsxs)("span",{className:"text-slate-500",children:["Ù
عطÙÛ: ",i.waiting_time]}),(0,r.jsx)("div",{className:"mt-1 flex flex-wrap gap-2",children:i.actions.map(e=>(0,r.jsx)("a",{href:e.url,className:"rounded-xl bg-primary px-3 py-2 font-bold text-white",children:e.title},e.url))})]})};var y=n(59393),_=n(21252);let j=["book","book_request","online_visit"];function w(e){return"string"==typeof e?e:"number"==typeof e?String(e):""}async function N(e){let t=(await Promise.all(j.map(async t=>{try{let n=await (0,y.y)({return_type:t,page:1,...e?{university:e}:{}});return(Array.isArray(null==n?void 0:n.data)?n.data:[]).map(e=>(function(e,t){var n,r,i,l,s,a,o,d;let c=w(null==e?void 0:e.book_id);if(!c)return null;let u=w(null==e?void 0:null===(n=e.center)||void 0===n?void 0:n.id);return{bookId:c,kind:t,doctor:[w(null==e?void 0:null===(r=e.doctor_info)||void 0===r?void 0:r.name),w(null==e?void 0:null===(i=e.doctor_info)||void 0===i?void 0:i.family)].filter(
1Boolean).join(" ").trim()||"پزشک",expertise:w(null==e?void 0:null===(l=e.doctor_info)||void 0===l?void 0:l.display_expertise),centerId:u,centerName:w(null==e?void 0:null===(s=e.center)||void 0===s?void 0:s.name),bookTime:w(null==e?void 0:e.book_time_string),timestamp:Number(null!==(o=null==e?void 0:e.from)&&void 0!==o?o:0)||0,status:Number(null!==(d=null==e?void 0:e.book_status)&&void 0!==d?d:0)||0,referenceCode:w(null==e?void 0:e.ref_id),nationalCode:w(null==e?void 0:null===(a=e.patient_info)||void 0===a?void 0:a.national_code),url:u&&c?"/receipt/".concat(u,"/").concat(c):"/patient/appointments"}})(e,t)).filter(e=>!!e)}catch(e){return[]}}))).flat(),n=new Set;return t.filter(e=>!n.has(e.bookId)&&(n.add(e.bookId),!0)).sort((e,t)=>t.timestamp-e.timestamp)}async function k(e){var t,n,r,i;try{let r=await (0,_.f)({center_id:e.centerId,reference_code:e.referenceCode,national_code:e.nationalCode,book_id:e.bookId,isBookRequest:"book_request"===e.kind},!1),i=w(null==r?void 0:null===(t=r.data)||void 0===t?void 0:t.message),l=(null==r?void 0:null===(n=r.data)||void 0===n?void 0:n.status)===1||(null==r?void 0:r.status)===200;return{ok:l,message:i||(l?"ÙÙØ¨Øª ÙØºÙ شد.":"ÙØºÙ ÙÙØ¨Øª Ø§ÙØ¬Ø§Ù
ÙØ´Ø¯.")}}catch(e){return{ok:!1,message:w(null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(r=i.data)||void 0===r?void 0:r.message)||"ÙØºÙ ÙÙØ¨Øª Ø§ÙØ¬Ø§Ù
ÙØ´Ø¯. Ø¯ÙØ¨Ø§Ø±Ù ØªÙØ§Ø´ Ú©ÙÛØ¯."}}}let S="yara",C=["ØØ§ÙÙ
Ø®ÙØ¨ ÙÛØ³ØªØ Ú©Ù
Ú©Ù
Ú©ÙÛØ¯","از پزشک Ù
Ø´Ø®ØµÛ ÙÙØ¨Øª Ù
ÛâØ®ÙØ§ÙÙ
","Ù¾ÛÚ¯ÛØ±Û ÙÙØ¨ØªâÙØ§ÛÙ
"],I="Ø¹ÙØ§Ø¦Ù
âØªØ§Ù Ø±Ø§ ساد٠بÙÙÛØ³Ûد â Ù
ÛâÚ¯ÙÛÙ
ب٠کداÙ
پزشک Ù
راجع٠کÙÛØ¯Ø پزشک٠Ù
ÙØ§Ø³Ø¨ را Ù¾ÛØ¯Ø§ Ù
ÛâÚ©ÙÙ
Ù ÙÙØ¨ØªØ´ را ÙÙ
ÛÙâØ¬Ø§ Ù
ÛâÚ¯ÛØ±Ù
.",E=["ÚÙØ¯ Ø±ÙØ²Ù گردÙÙ
درد Ù
ÛâÚ©ÙØ¯ ٠دستÙ
بÛâØØ³ Ù
ÛâØ´ÙØ¯â¦","از دکتر رضاÛÛØ Ù
تخصص Ù¾ÙØ³ØªØ ÙÙØ¨Øª Ù
ÛâØ®ÙØ§ÙÙ
","ÙÙØ¨ØªâÙØ§Û Ø«Ø¨ØªâØ´Ø¯ÙâØ§Ù
را ÙØ´Ø§ÙÙ
بدÙ","تب Ú©ÙØ¯Ú© Û³ ساÙÙØ Ú٠زÙ
اÙÛ Ø¨Ø§ÛØ¯ Ø¨Ù Ø§ÙØ±ÚØ§ÙØ³ برÙÛÙ
Ø","ÙØ²Ø¯ÛÚ©âØªØ±ÛÙ ÙÙØ¨ØªÙ ارتÙپد در Ø´ÙØ±Ù
Ú©ÙÛ Ø§Ø³ØªØ","Ù
ÛâØ®ÙØ§ÙÙ
ÙÙØ¨Øª ÙØ±Ø¯Ø§ را ÙØºÙ Ú©ÙÙ
"],A="ÙØ³Ø®Ù٠بتا",D="در Ø¯ÙØ±Ù٠آزÙ
Ø§ÛØ´ÛØ Ø§Ø³ØªÙØ§Ø¯Ù از ÛØ§Ø±Ø§ راÛگا٠است",R=["سردردÙ
ÚÙØ¯ Ø±ÙØ² است اداÙ
Ù Ø¯Ø§Ø±Ø¯Ø Ú٠کار Ú©ÙÙ
Ø","ÙØ²Ø¯ÛÚ©âØªØ±ÛÙ ÙÙØ¨Øª Ù
تخصص Ù¾ÙØ³Øª را Ù
ÛâØ®ÙØ§ÙÙ
","تب Ú©ÙØ¯Ú© Û³ ساÙÙØ Ú٠زÙ
اÙÛ Ø¨Ø§ÛØ¯ Ø¨Ù Ø§ÙØ±ÚØ§ÙØ³ برÙÛÙ
Ø","Ú©Ù
ردرد بعد از ÙØ±Ø²Ø´ â Ø§Ø±ØªÙپد ÛØ§ ÙÛØ²ÛÙØªØ±Ø§Ù¾Ø","از دکتر Ù
Ø´Ø®ØµÛ Ù
ÛâØ®ÙØ§ÙÙ
ÙÙØ¨Øª Ø¨Ú¯ÛØ±Ù
","ÙÙØ¨ØªâÙØ§Û Ø«Ø¨ØªâØ´Ø¯ÙâØ§Ù
را ÙØ´Ø§ÙÙ
بدÙ"];function T(e){switch(e){case"timeout":return{text:"پاسخ Ø¨ÛØ´ØªØ± از ØØ¯ Ø·ÙÙ Ú©Ø´ÛØ¯ Ù ÙÛÙ
Ùâکار٠Ù
Ø§ÙØ¯.",retry:!0,search:!0};case"offline":return{text:"ارتباط با ÛØ§Ø±Ø§ Ø¨Ø±ÙØ±Ø§Ø± ÙØ´Ø¯Ø اتصا٠اÛÙØªØ±ÙØªâØªØ§Ù Ø±Ø§ Ø¨Ø±Ø±Ø³Û Ú©ÙÛØ¯.",retry:!0,search:!0};case"busy":return{text:"ÙÙ
ÛÙ ØØ§Ùا Ø®ÛÙÛ Ø´ÙÙØº Ø§Ø³ØªØ ÚÙØ¯ ÙØØ¸ÙâÛ Ø¯Ûگر Ø¯ÙØ¨Ø§Ø±Ù اÙ
ØªØØ§Ù Ú©ÙÛØ¯.",retry:!0,search:!0};default:return{text:"Ø§ÙØ§Ù ÙÙ
ÛâØªÙØ§ÙÙ
Ú¯ÙØªÚ¯Ù Ú©ÙÙ
Ø Ø¹Ø°Ø± Ù
ÛâØ®ÙØ§ÙÙ
.",retry:!1,search:!0}}}function q(e){let t=null==e?void 0:e.suggestions;return Array.isArray(t)?t.map(e=>{var t,n;let r=String(null!==(t=null==e?void 0:e.key)&&void 0!==t?t:""),i=String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:"").trim();return{key:r||i,label:i}}).filter(e=>!!e.label).slice(0,6):[]}let P=[{match:/تغÛÛØ±\s*Ø´ÙØ±|Ø´ÙØ±\s*دÛگر|Ø§ÙØªØ®Ø§Ø¨\s*Ø´ÙØ±/,stem:"Ø´ÙØ±Ù
را Ø¹ÙØ¶ ک٠ب٠"},{match:/تغÛÛØ±\s*ØªØ§Ø±ÛØ®|Ø±ÙØ²\s*دÛگر|زÙ
اÙ\s*دÛگر/,stem:"ÙÙØ¨Øª را Ø¨Ø±Ø§Û "},{match:/بÛÙ
Ù/,stem:"بÛÙ
ÙâÛ Ù
Ù "},{match:/Ø¨ÙØ¯Ø¬Ù|ارزاÙâ?تر/,stem:"ØØ¯Ø§Ú©Ø«Ø± Ø¨ÙØ¯Ø¬ÙâØ§Ù
"}];var L=n(36554);function O(e){let t=String(null!=e?e:"").trim();return t.includes("/dr/")?t.replace("/dr/","/booking/"):null}let M=e=>{let{card:t}=e,n=[];return(void 0!==t.satisfaction&&t.rates_count&&n.push("".concat(t.satisfaction,"Ùª Ø±Ø¶Ø§ÛØª از ").concat(t.rates_count.toLocaleStr
1ing("fa-IR")," ÙØ¸Ø±")),t.waiting_time&&n.push("زÙ
Ø§Ù Ø§ÙØªØ¸Ø§Ø±: ".concat(t.waiting_time)),t.online_visit&&n.push("ÙÛØ²Ûت Ø¢ÙÙØ§Û٠دارد"),n.length)?(0,r.jsxs)("div",{"data-testid":"yara-card-why",className:"mx-4 mb-4 flex flex-col gap-1.5 rounded-[0.6875rem] border border-solid border-[#eff1f4] bg-[#fafbfc] px-3.5 py-3",children:[(0,r.jsx)("span",{className:"text-[0.6875rem] font-bold text-[#344054]",children:"ÚØ±Ø§ ÛØ§Ø±Ø§ Ø§ÛØ´Ø§Ù را Ù¾ÛØ´ÙÙØ§Ø¯ Ù
ÛâÚ©ÙØ¯"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-[#475467]",children:n.map(e=>(0,r.jsx)("span",{children:e},e))})]}):null},z=e=>{let{children:t}=e;return(0,r.jsx)("div",{className:"overflow-hidden rounded-[0.875rem] border border-solid border-[#e6e8ec] bg-white [&>*+*]:border-0 [&>*+*]:border-t [&>*+*]:border-solid [&>*+*]:border-[#eff1f4]",children:t})};var J=e=>{let{card:t,onClick:n,onBook:i}=e,l=(0,a.useMemo)(()=>{let e=[];return t.waiting_time&&e.push({title:"زÙ
Ø§Ù Ø§ÙØªØ¸Ø§Ø±: ".concat(t.waiting_time),icon:"clock-icon",type:"info"}),t.online_visit_price&&e.push({title:"ÙÛØ²Ûت Ø¢ÙÙØ§ÛÙ: ".concat(t.online_visit_price.toLocaleString("fa-IR")," تÙÙ
اÙ"),type:"info"}),t.online_visit&&e.push({title:"ÙÛØ²Ûت Ø¢ÙÙØ§ÛÙ",type:"success"}),e},[t]),s=(0,a.useMemo)(()=>{let e=(e,t)=>()=>{null==i||i(t),window.location.href=e},n=[],r=function(e,t){let n=O(e),r=String(null!=t?t:"").trim();return n&&r?"".concat(n,"?centerId=").concat(encodeURIComponent(r)):null}(t.url,t.in_person_center_id);r&&n.push({text:"ÙÙØ¨Øª ØØ¶ÙرÛ",description:"",outline:!0,action:e(r,"in_person")});let l=t.online_visit?function(e){let t=O(e);return t?"".concat(t,"?centerId=").concat("5532","&skipTimeSelectStep=true"):null}(t.url):null;return l&&n.push({text:"ÙÛØ²Ûت Ø¢ÙÙØ§ÛÙ",description:"",outline:!1,action:e(l,"online_visit")}),n.length||n.push({text:"Ù
Ø´Ø§ÙØ¯Ù پرÙÙØ§ÛÙ Ù ÙÙØ¨ØªâدÙÛ",description:"",outline:!1,action:e(t.url,"profile")}),n},[t,i]);return t.title?(0,r.jsxs)("div",{"data-testid":"yara-result-card",className:"w-full",onClick:n,children:[(0,r.jsx)(L.Z,{type:"center"===t.type?"center":"doctor",className:"!rounded-none !border-0 !shadow-none",baseInfo:{displayName:t.title,expertise:t.expertise,avatar:t.image,url:t.url,isVerify:!1===t.is_bulk,...void 0!==t.satisfaction&&t.rates_count?{rate:{satisfaction:t.satisfaction,count:t.rates_count}}:{}},details:{...t.address?{address:{text:t.address}}:{},...l.length?{badges:l}:{}},actions:s}),(0,r.jsx)(M,{card:t})]}):null};let K=()=>(0,r.jsxs)("svg",{"aria-hidden":"true",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",className:"shrink-0",children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,r.jsx)("path",{d:"M20 20l-3.5-3.5"})]});var B=e=>{let{activeId:t,refreshKey:n,statusDot:i,onPick:l,onNewChat:s}=e,[o,d]=(0,a.useState)(null),[c,u]=(0,a.useState)("");(0,a.useEffect)(()=>{let e=!0;return(0,f.Gl)().then(t=>{e&&d(t)}),()=>{e=!1}},[n]);let x=(0,a.useMemo)(()=>{let e=c.trim();return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),n=new Date(t);n.setHours(0,0,0,0);let r=n.getTime(),i=e=>{var t;let n=new Date(String(null!==(t=null==e?void 0:e.last_message_at)&&void 0!==t?t:"")).getTime();return Number.isFinite(n)?n>=r?"اÙ
Ø±ÙØ²":n>=r-864e5?"Ø¯ÛØ±Ùز":n>=r-6048e5?"Û· Ø±ÙØ² گذشتÙ":"ÙØ¯ÛÙ
ÛâØªØ±":"ÙØ¯ÛÙ
ÛâØªØ±"},l=["اÙ
Ø±ÙØ²","Ø¯ÛØ±Ùز","Û· Ø±ÙØ² گذشتÙ","ÙØ¯ÛÙ
ÛâØªØ±"],s=[];for(let t of null!=e?e:[]){let e=i(t),n=s.find(t=>t.label===e);n||(n={label:e,items:[]},s.push(n)),n.items.push(t)}return s.sort((e,t)=>l.indexOf(e.label)-l.indexOf(t.label))}((null!=o?o:[]).filter(t=>{var n;return!e||String(null!==(n=t.title)&&void 0!==n?n:"").includes(e)}))},[o,c]);return(0,r.jsxs)("aside",{"data-testid":"yara-sidebar",className:"flex h-full min-h-0 flex-col overflow-hidden border-0 border-e border-solid border-[#e6e8ec] bg-white",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 p-4",children:[(0,r.jsxs)("button",{type:"button",onClick:s,className:"flex h-[2.625rem] w-full items-center justify-center gap-2 rounded-[0.625rem] border border-solid border-primary bg-white text-sm font-bold text-primary transition-colors hover:bg-primary/5",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"text-lg leading-none",children:"+"}),"Ú¯ÙØªâÙÚ¯ÙÛ Ø¬Ø¯ÛØ¯"]}),(0,r.jsxs)("div",{className:"flex h-[2.375rem] items-center gap-2 rounded-[0.5625rem] bg-[#f2f3f5] px-3 text-[#98a2b3]",children:[(0,r.jsx)(K,{}),(0,r.jsx)("input",{className:"min-w-0 flex-1 bg-transparent text-xs text-[#101828] outline-none placeholder:text-[#98a2b3]",placeholder:"جستâÙØ¬Ù در Ú¯ÙØªâÙÚ¯ÙÙØ§","aria-label":"جستâÙØ¬Ù در Ú¯ÙØªâÙÚ¯ÙÙØ§",value:c,onChange:e=>u(e.target.value)})]})]}),(0,r.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-4",children:[null===o&&(0,r.jsx)("p",{className:"px-3 text-xs text-[#98a2b3]",children:"در ØØ§Ù بارگذارÛâ¦"}),null!==o&&0===x.length&&(0,r.jsx)("p",{className:"px-3 text-xs leading-6 text-[#667085]",children:c.trim()?"Ú¯ÙØªâÙÚ¯ÙÛÛ Ø¨Ø§ اÛ٠عÙÙØ§Ù Ù¾ÛØ¯Ø§ ÙØ´Ø¯.":"ÙÙÙØ² Ú¯ÙØªâÙÚ¯ÙÛ Ø°Ø®ÛØ±ÙâØ´Ø¯ÙâØ§Û ÙØ¯Ø§Ø±Ûد."}),x.map(e=>(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"px-[0.625rem] pb-1.5 pt-3.5 text-[0.6875rem] font-bold text-[#98a2b3]",children:e.label}),e.items.map(e=>{let n=e.conversation_id===t;return(0,r.jsxs)("button",{type:"button","data-testid":"yara-conversation","aria-current":n?"true":void 0,onClick:()=>l(e.conversation_id),className:"mb-0.5 w-full rounded-[0.5625rem] px-3 py-2.5 text-right transition-colors ".concat(n?"bg-primary/10 shadow-[inset_0_0_0_1px_#d6e0ff]":"hover:bg-[#f7f8fa]"),children:[(0,r.jsx)("span",{className:"block truncate text-xs font-medium text-[#101828]",children:e.title||"بدÙ٠عÙÙØ§Ù"}),(0,r.jsxs)("span",{className:"mt-0.5 block truncate text-[0.6875rem] text-[#98a2b3]",children:[e.turn_count," Ù¾ÛØ§Ù
\xb7 ",new Date(e.last_message_at).toLocaleDateString("fa-IR")]})]},e.conversation_id)})]},e.label))]}),(0,r.jsx)("div",{className:"flex items-center gap-2 border-0 border-t border-solid border-[#e6e8ec] px-4 py-3 text-xs text-[#667085]",children:i})]})};let F=()=>(0,r.jsxs)("svg",{"aria-hidden":"true",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"5"}),(0,r.jsx)("polyline",{points:"5 12 12 5 19 12"})]});var V=e=>{let{busy:t,hasThread:n,draft:i,onSend:l}=e,[s,o]=(0,a.useState)(""),[d,c]=(0,a.useState)(!1),u=(0,a.useRef)(null),[x,m]=(0,a.useState)(0);(0,a.useEffect)(()=>
1{if(n||s)return;let e=setInterval(()=>m(e=>(e+1)%E.length),3500);return()=>clearInterval(e)},[n,s]),(0,a.useEffect)(()=>{if(!(null==i?void 0:i.text))return;o(i.text);let e=u.current;e&&(e.focus(),requestAnimationFrame(()=>e.setSelectionRange(e.value.length,e.value.length)))},[null==i?void 0:i.seq,null==i?void 0:i.text]),(0,a.useEffect)(()=>{let e=u.current;e&&(e.style.height="auto",e.style.height="".concat(Math.min(e.scrollHeight,160),"px"))},[s]);let h=()=>{let e=s.trim();e&&!t&&(o(""),c(!1),l(e))},f=!!s.trim()&&!t,p=n?"Ù¾Ø§Ø³Ø®âØªØ§Ù Ø±Ø§ بÙÙÛØ³Ûد ÛØ§ Ø³Ø¤Ø§Ù Ø¨Ø¹Ø¯Û Ø±Ø§ Ø¨Ù¾Ø±Ø³ÛØ¯â¦":E[x],v=d&&!s.trim()&&!n;return(0,r.jsx)("div",{className:"border-0 border-t border-solid border-[#e6e8ec] bg-white px-4 pb-3 pt-4",children:(0,r.jsxs)("div",{className:"relative mx-auto w-full max-w-[47.5rem]",children:[v&&(0,r.jsxs)("div",{"data-testid":"yara-suggest-sheet",className:"absolute bottom-[calc(100%+0.625rem)] z-20 w-full overflow-hidden rounded-[0.875rem] border border-solid border-[#e6e8ec] bg-white shadow-[0_0.75rem_2rem_rgba(16,24,40,.12)]",children:[(0,r.jsx)("div",{className:"px-3.5 pb-1.5 pt-2.5 text-[0.6875rem] font-bold text-[#98a2b3]",children:"ÙÙ
ÙÙÙâÙØ§ÛÛ Ú©Ù Ù
ÛâØªÙØ§ÙÛØ¯ Ø¨Ù¾Ø±Ø³ÛØ¯"}),R.map(e=>(0,r.jsx)("button",{type:"button","data-testid":"yara-suggest-item",onMouseDown:t=>{t.preventDefault(),c(!1),l(e)},className:"flex w-full items-center gap-2.5 border-0 border-t border-solid border-[#f2f3f5] px-3.5 py-2.5 text-right text-xs text-[#344054] transition-colors hover:bg-[#f7f8fa]",children:(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e})},e))]}),(0,r.jsxs)("form",{className:"flex items-end gap-2 rounded-[0.875rem] border border-solid border-[#d0d5dd] bg-white px-3 py-2 transition-colors focus-within:border-primary",onSubmit:e=>{e.preventDefault(),h()},children:[(0,r.jsx)("button",{type:"submit","aria-label":"ارساÙ",title:"ارساÙ",disabled:!f,className:"grid h-10 w-10 shrink-0 place-items-center rounded-[0.625rem] transition-colors ".concat(f?"bg-primary text-white hover:bg-[#2a4fd6]":"bg-[#f2f3f5] text-[#98a2b3]"),children:(0,r.jsx)(F,{})}),(0,r.jsx)("textarea",{ref:u,rows:2,className:"max-h-40 min-h-[3.5rem] min-w-0 flex-1 resize-none bg-transparent py-2 text-sm leading-7 text-[#101828] outline-none transition-[height] placeholder:text-[#98a2b3]",placeholder:p,"aria-label":"Ù¾ÛØ§Ù
Ø´Ù
ا Ø¨Ù ÛØ§Ø±Ø§",value:s,maxLength:600,disabled:t,onChange:e=>o(e.target.value),onFocus:()=>c(!0),onBlur:()=>setTimeout(()=>c(!1),120),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),h())}})]}),(0,r.jsxs)("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-x-4 gap-y-1 text-[0.6875rem] leading-5 text-[#98a2b3]",children:[(0,r.jsx)("span",{children:"ÛØ§Ø±Ø§ ØªØ´Ø®ÛØµ Ù¾Ø²Ø´Ú©Û ÙÙ
ÛâØ¯ÙØ¯Ø تصÙ
ÛÙ
ÙÙØ§ÛÛ Ø¨Ø§ پزشک Ø´Ù
است"}),(0,r.jsx)("span",{children:"ÙØ³Ø®Ù٠بتا â ÙØ¹Ùا٠راÛگا٠\xb7 Shift + Enter Ø¨Ø±Ø§Û Ø®Ø· Ø¬Ø¯ÛØ¯"})]})]})})};let H="yara:thread",W=e=>{let{size:t="sm"}=e;return(0,r.jsx)("span",{className:"grid shrink-0 place-items-center rounded-full border border-solid border-[#e6e8ec] bg-white ".concat("lg"===t?"h-14 w-14":"mt-0.5 h-8 w-8"),children:(0,r.jsx)(x.Z,{width:"lg"===t?30:18,type:"compact"})})},Y={idle:"bg-slate-300",ok:"bg-green-500",failed:"bg-amber-500"},U={idle:"ÛØ§Ø±Ø§ Ø¢Ù
ادÙ٠پاسخâÚ¯ÙÛÛ Ø§Ø³Øª",ok:"ÛØ§Ø±Ø§ Ø¢Ù
ادÙ٠پاسخâÚ¯ÙÛÛ Ø§Ø³Øª",failed:"ارتباط Ø¨Ø±ÙØ±Ø§Ø± ÙØ´Ø¯"},G=e=>{let{children:t}=e;return(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)("span",{className:"rounded-full bg-[#e9ecf1] px-3 py-1 text-[0.6875rem] text-[#667085]",children:t})})},X=e=>{let{children:t}=e;return(0,r.jsxs)("div",{className:"flex flex-row-reverse justify-end gap-3",children:[(0,r.jsx)(W,{}),(0,r.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:t})]})},Z="h-[2.125rem] rounded-full border border-solid border-[#e6e8ec] bg-white px-3.5 text-xs text-[#344054] transition-colors hover:border-primary hover:text-primary";var Q=()=>{var e;let[t,n]=(0,a.useState)([]),[i,l]=(0,a.useState)(!1),[s,o]=(0,a.useState)("idle"),[d,u]=(0,a.useState)(!1),[x,p]=(0,a.useState)(0),[y,_]=(0,a.useState)(-1),[j,w]=(0,a.useState)({}),[E,R]=(0,a.useState)(),[L,O]=(0,a.useState)(0),[,M]=(0,a.useState)(0),K=(0,a.useRef)(""),F=(0,c.useRouter)(),Q=(0,a.useRef)(null),$=(0,a.useRef)(null),[ee,et]=(0,a.useState)("100dvh");(0,a.useEffect)(()=>{let e=$.current;if(!e)return;let t=()=>{let t=Math.max(0,Math.round(e.getBoundingClientRect().top+window.scrollY));et("calc(100dvh - ".concat(t,"px)"))};t(),window.addEventListener("resize",t);let n="undefined"!=typeof ResizeObserver?new ResizeObserver(t):null;return n&&e.parentElement&&n.observe(e.parentElement),()=>{window.removeEventListener("resize",t),null==n||n.disconnect()}},[]);let en=(0,a.useRef)(!1),[er,ei]=(0,a.useState)([]),[el,es]=(0,a.useState)(!1),[ea,eo]=(0,a.useState)(!1),[ed,ec]=(0,a.useState)(null),[eu,ex]=(0,a.useState)(!1),[em,eh]=(0,a.useState)(""),ef=(0,a.useRef)([]),ep=(0,a.useMemo)(()=>{var e;return String(null!==(e=(0,m.getCookie)("terminal_id"))&&void 0!==e?e:"")},[]),ev=(0,h.e)(e=>{var t;return null===(t=e.info)||void 0===t?void 0:t.name}),eb=(0,a.useMemo)(()=>{try{var e;let t=JSON.parse(String(null!==(e=(0,m.getCookie)("new-city"))&&void 0!==e?e:""));return(null==t?void 0:t.en_slug)||"ir"}catch(e){return"ir"}},[]),eg=(0,a.useRef)(null);(0,a.useEffect)(()=>{var e,t;null===(t=eg.current)||void 0===t||null===(e=t.scrollIntoView)||void 0===e||e.call(t,{block:"end",behavior:"smooth"})},[t.length,i]);let ey=(0,a.useCallback)(async()=>
1{if(ef.current.length>0)return ef.current;es(!0);let e=await N();return ef.current=e,ei(e),es(!1),e},[]),e_=(0,a.useCallback)(async e=>{let t=function(e,t){if("cancel_booking"===e.kind){let n=function(e,t){var n,r;if(!e)return null;let i=e.book_id&&t.find(t=>t.bookId===e.book_id);if(i)return i;let l=Number(null!==(r=null!==(n=e.idx)&&void 0!==n?n:e.index)&&void 0!==r?r:NaN);return Number.isInteger(l)&&l>=1&&l<=t.length?t[l-1]:null}(e.params,t);return n?{kind:"confirm_cancel",booking:n}:{kind:"show_list"}}return e.requires_confirmation?{kind:"refuse",reason:"no_confirmation_ui"}:{kind:"show_list"}}(e,await ey());"refuse"!==t.kind&&(eo(!0),"confirm_cancel"===t.kind&&ec(t.booking))},[ey]),ej=(0,a.useCallback)(async e=>{var r,i,s,a,d,c,u,x,m;l(!0),O(Date.now()),eh("");let h=!1,v=Date.now(),b=null!==(i=await function(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e4,r=arguments.length>2?arguments[2]:void 0;return Promise.race([e,new Promise(e=>{t=setTimeout(()=>{null==r||r(),e(null)},n)})]).finally(()=>clearTimeout(t))}((0,f.u)({text:e,explicit:!0,conversationId:K.current||void 0,terminalId:ep,city:eb,...ef.current.length?{bookings:ef.current.slice(0,10).map(e=>({ref:e.bookId,doctor:e.doctor,date:e.bookTime,type:"online_visit"===e.kind?"ÙÛØ²Ûت Ø¢ÙÙØ§ÛÙ":"book_request"===e.kind?"Ø¯Ø±Ø®ÙØ§Ø³Øª ÙÙØ¨Øª":"ØØ¶ÙرÛ",center:e.centerName}))}:{}}),void 0,()=>{h=!0}))&&void 0!==i?i:null;l(!1);let g=(null==b?void 0:null===(r=b.emergency)||void 0===r?void 0:r.trim())||void 0,y=null==b?void 0:b.fallback_reason;if(!(b&&"chat"===b.mode&&((null===(a=b.message)||void 0===a?void 0:a.trim())||(null===(d=b.clarifying_question)||void 0===d?void 0:d.trim())||(null===(c=b.emergency)||void 0===c?void 0:c.trim())||b.provider||b.guide||(null===(u=b.results)||void 0===u?void 0:u.length)||b.client_action))){o("failed");let r=(x={timedOut:h,reached:null!==b,fallbackReason:y}).timedOut?"timeout":x.reached?"rate_limited"===String(null!==(m=x.fallbackReason)&&void 0!==m?m:"")?"busy":"unavailable":"offline";(0,f.YE)(K.current,"turn_failed",S),(0,f.kJ)("turn_failed",{failure_kind:r,fallback_reason:String(null!=y?y:""),duration_ms:Date.now()-v,conversation_id:K.current,turn_number:t.length+1}),n(t=>{let n=[...t],i=n[n.length-1];return i&&!i.assistant?n[n.length-1]={...i,failed:!0,failureKind:r,emergency:g}:n.push({user:e,failed:!0,failureKind:r,emergency:g}),n});return}let _=!K.current;K.current=b.conversation_id,o("ok"),(0,f.Lc)(b,S),n(t=>{let n=[...t],r=n[n.length-1];return r&&!r.assistant?n[n.length-1]={...r,assistant:b,failed:!1}:n.push({user:e,assistant:b}),n}),_&&p(e=>e+1),(0,f.kJ)("turn_answered",{conversation_id:b.conversation_id,turn_index:b.turn_index,result_count:null!==(s=b.result_count)&&void 0!==s?s:0,has_emergency:!!b.emergency,is_clarifying:!!(b.clarifying_question&&!b.message),duration_ms:Date.now()-v}),b.client_action&&e_(b.client_action)},[ep,eb,e_]),ew=(0,a.useCallback)(e=>{let t=String(null!=e?e:"").trim();t&&!i&&(u(!1),n(e=>[...e,{user:t,at:Date.now()}]),ej(t))},[ej,i]),eN=(0,a.useCallback)(async()=>{if(!ed)return;ex(!0);let e=await k(ed);ex(!1),ec(null),eh(e.message),e.ok&&(ef.current=[],ey())},[ed,ey]),ek=(0,a.useCallback)(()=>{K.current="",n([]),eo(!1),ec(null),eh(""),o("idle"),u(!1),function(){try{window.sessionStorage.removeItem(H)}catch(e){}}(),F.push({pathname:"/yara"},void 0,{shallow:!0})},[F]),eS=(0,a.useCallback)(async e=>{let t=await (0,f.cc)(e);if(!t)return;K.current=e,F.push({pathname:"/yara",query:{c:e}},void 0,{shallow:!0}),u(!1),eo(!1),eh("");let r=[];for(let e of t.messages){var i,l;if("user"===e.role){r.push({user:e.text});continue}if(!r.length)continue;let t=r[r.length-1],n=!(i=e.payload)||"object"!=typeof i||Array.isArray(i)?null:i.message||i.clarifying_question||i.emergency||i.guide||i.provider||Array.isArray(i.results)&&i.results.length?{mode:"chat",conversation_id:"",query_id:"",turn_index:0,...i,client_action:void 0}:null;n?t.assistant=n:t.archivedAnswer=String(null!=(l=e.text)?l:"").split("\n").filter(e=>!/^\s*\[(?:گاÙ
Ù? بعد|راÙÙÙ
ا|Ø§ÙØ¯Ø§Ù
در Ú¯ÙØªÚ¯Ù)/.test(e)).map(e=>e.replace(/\s*\((\/[^\s)]*)\)\s*$/u,"")).join("\n").trim()}n(r)},[]),eC=(0,a.useCallback)((e,t)=>{var n,r,i;null===(i=navigator)||void 0===i||null===(r=i.clipboard)||void 0===r||null===(n=r.writeText)||void 0===n||n.call(r,t),_(e),setTimeout(()=>_(-1),1600)},[]);(0,a.useEffect)(()=>{var e;if(en.current)return;en.current=!0;let t=String(null!==(e=F.query.c)&&void 0!==e?e:""),r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now();try{var t;let n=window.sessionStorage.getItem(H);if(!n)return null;let r=JSON.parse(n);if(!Array.isArray(null==r?void 0:r.turns)||0===r.turns.length||"number"!=typeof r.savedAt||e-r.savedAt>54e5)return null;return{conversationId:String(null!==(t=r.conversationId)&&void 0!==t?t:""),turns:r.turns,scrollTop:Number(r.scrollTop)||0,savedAt:r.savedAt}}catch(e){return null}}();if(r&&(!t||r.conversationId===t)&&r){K.current=r.conversationId,n(r.turns),o("ok"),r.turns.some(e=>{var t,n;return(null===(n=e.assistant)||void 0===n?void 0:null===(t=n.client_action)||void 0===t?void 0:t.kind)==="fetch_my_bookings"})&&ey(),requestAnimationFrame(()=>{Q.current&&(Q.current.scrollTop=r.scrollTop)});return}t&&eS(t)},[F.query.c,eS,ey]),(0,a.useEffect)(()=>
1{if(!i)return;let e=setInterval(()=>M(e=>e+1),1e3);return()=>clearInterval(e)},[i]),(0,a.useEffect)(()=>{var e,n;!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();try{if(!e.turns.length){window.sessionStorage.removeItem(H);return}window.sessionStorage.setItem(H,JSON.stringify({...e,turns:e.turns.slice(-40),savedAt:t}))}catch(e){}}({conversationId:K.current,turns:t,scrollTop:null!==(n=null===(e=Q.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0})},[t]);let eI=(0,a.useCallback)((e,t,n)=>{var r,i,l,s;w(n=>({...n,[e]:t})),(0,f.kJ)("answer_rated",{rating:t,conversation_id:K.current,turn_index:null!==(l=null===(r=n.assistant)||void 0===r?void 0:r.turn_index)&&void 0!==l?l:e,result_count:null!==(s=null===(i=n.assistant)||void 0===i?void 0:i.result_count)&&void 0!==s?s:0})},[]),eE=t.findIndex(e=>e.assistant),eA=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{"data-testid":"yara-status-dot","data-status":s,className:"inline-block h-1.5 w-1.5 shrink-0 rounded-full ".concat(Y[s])}),U[s]]}),eD=(0,r.jsx)(B,{activeId:K.current,refreshKey:x,statusDot:eA,onPick:eS,onNewChat:ek});return(0,r.jsx)("div",{ref:$,dir:"rtl",className:"flex min-h-0 w-full flex-1 flex-col bg-[#f2f3f5] text-[#101828]",children:(0,r.jsxs)("div",{className:"grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] lg:grid-cols-[18rem_1fr]",style:{height:ee},children:[(0,r.jsx)("div",{className:"hidden min-h-0 lg:block",children:eD}),d&&(0,r.jsxs)("div",{className:"fixed inset-0 z-40 lg:hidden",children:[(0,r.jsx)("div",{role:"presentation",className:"absolute inset-0 bg-black/30",onClick:()=>u(!1)}),(0,r.jsx)("div",{className:"absolute inset-y-0 right-0 w-[18rem] max-w-[85vw] shadow-xl",children:eD})]}),(0,r.jsxs)("main",{className:"flex min-h-0 flex-col overflow-hidden",children:[(0,r.jsx)("div",{ref:Q,className:"min-h-0 flex-1 overflow-y-auto py-7","aria-live":"polite",children:(0,r.jsxs)("div",{className:"mx-auto flex w-full max-w-[47.5rem] flex-col gap-7 px-4",children:[(0,r.jsx)("button",{type:"button","data-testid":"yara-rail-toggle",className:"self-start rounded-full border border-solid border-[#e6e8ec] bg-white px-3.5 py-1.5 text-xs text-[#475467] lg:hidden",onClick:()=>u(!0),children:"Ú¯ÙØªâÙÚ¯ÙÙØ§Û Ù
Ù"}),0===t.length&&(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3.5 pb-2 pt-14 text-center",children:[(0,r.jsx)(W,{size:"lg"}),(0,r.jsx)("h2",{className:"text-2xl font-bold",children:"ÚØ·Ùر Ù
ÛâØªÙØ§ÙÙ
Ø¨Ø±Ø§Û Ø³ÙØ§Ù
تÛâØªØ§Ù Ø¨Ù Ø´Ù
ا Ú©Ù
Ú© Ú©ÙÙ
Ø"}),(0,r.jsx)("p",{className:"max-w-md text-sm leading-7 text-[#667085]",children:function(e){let t=String(null!=e?e:"").trim().split(/\s+/)[0];return!t||t.length>30?I:"".concat(t," Ø¹Ø²ÛØ²Ø ").concat(I)}(ev)}),(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-solid border-[#e6e8ec] bg-white px-3.5 py-1.5 text-[0.6875rem] text-[#475467]",children:[(0,r.jsx)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 font-bold text-primary",children:A}),D]}),(0,r.jsx)("div",{className:"mt-2 flex flex-wrap justify-center gap-2",children:C.map(e=>(0,r.jsx)("button",{type:"button",className:Z,onClick:()=>ew(e),children:e},e))})]}),t.length>0&&(0,r.jsx)(G,{children:"".concat(A," â ").concat(D)}),t.map((e,t)=>{var n,l,s,a,o,d,c,u,x,m,h,p,v,b,_;return(0,r.jsxs)("div",{className:"flex flex-col gap-7",children:[(0,r.jsx)("div",{className:"flex justify-start",children:(0,r.jsx)("p",{className:"max-w-[78%] whitespace-pre-line rounded-2xl rounded-br-[0.25rem] border border-solid border-[#d6e0ff] bg-[#eef2ff] px-4 py-3 text-sm leading-7 text-[#1d2939]",children:e.user})}),(e.assistant||e.archivedAnswer||e.failed||e.emergency)&&(0,r.jsxs)(X,{children:[((null===(n=e.assistant)||void 0===n?void 0:n.emergency)||e.emergency)&&(0,r.jsx)("p",{role:"alert",className:"rounded-2xl border border-solid border-red-300 bg-red-50 px-4 py-3 text-sm font-bold leading-7 text-red-700",children:(null===(l=e.assistant)||void 0===l?void 0:l.emergency)||e.emergency}),((null===(s=e.assistant)||void 0===s?void 0:s.message)||(null===(a=e.assistant)||void 0===a?void 0:a.clarifying_question)||e.archivedAnswer)&&(0,r.jsx)("p",{className:"whitespace-pre-line rounded-2xl rounded-bl-[0.25rem] border border-solid border-[#e6e8ec] bg-white px-4 py-3.5 text-sm leading-7 text-[#1d2939]",children:(null===(o=e.assistant)||void 0===o?void 0:o.message)||(null===(d=e.assistant)||void 0===d?void 0:d.clarifying_question)||e.archivedAnswer}),(null===(c=e.assistant)||void 0===c?void 0:c.provider)&&(0,r.jsx)(g,{provider:e.assistant.provider}),(null===(u=e.assistant)||void 0===u?void 0:u.guide)&&(0,r.jsx)("a",{href:e.assistant.guide.url,className:"self-start rounded-[0.5625rem] bg-primary px-5 py-2.5 text-xs font-bold text-white",onClick:()=>{var t,n;return(0,f.YE)(K.current,"guide_".concat(null===(n=e.assistant)||void 0===n?void 0:null===(t=n.guide)||void 0===t?void 0:t.topic),S)},children:e.assistant.guide.cta}),!!(null===(m=e.assistant)||void 0===m?void 0:null===(x=m.results)||void 0===x?void 0:x.length)&&(0,r.jsx)(z,{children:e.assistant.results.slice(0,3).map(t=>(0,r.jsx)(J,{card:t,onBook:e=>(0,f.kJ)("booking_start",{route:e,conversation_id:K.current,position:t.position}),onClick:()=>{var n,r,i,l,s,a;(0,f.kJ)("card_click",{conversation_id:K.current,turn_index:null!==(a=null===(n=e.assistant)||void 0===n?void 0:n.turn_index)&&void 0!==a?a:0,position:t.position,card_type:t.type,online_visit:!!t.online_visit}),(0,f.rK)(t,{queryId:null===(r=e.assistant)||void 0===r?void 0:r.query_id,turnIndex:null===(i=e.assistant)||void 0===i?void 0:i.turn_index,resultCount:null===(l=e.assistant)||void 0===l?void 0:l.result_count,searchQuery:null===(s=e.assistant)||void 0===s?void 0:s.search_query,conversationId:K.current},S)}},t.id))}),(null===(h=e.assistant)||void 0===h?void 0:h.disclaimer)&&t===eE&&(0,r.jsx)("p",{className:"text-[0.6875rem] leading-5 text-[#98a2b3]",children:e.assistant.disclaimer}),q(e.assistant).length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:q(e.assistant).map(e=>(0,r.jsx)("button",{type:"button","data-testid":"yara-suggestion",className:Z,onClick:()=>{let t=function(e){let t="string"==typeof(null==e?void 0:e.prefill)?e.prefill.replace(/\s+/g," ").replace(/^ +/,""):"";if(t.trim())return{mode:"prefill",text:t};let n=P.find(t=>t.match.test(e.label));return n?{mode:"prefill",text:n.stem}:{mode:"send",text:e.label}}(e);(0,f.kJ)("suggestion_tap",{mode:t.mode,key:e.key.slice(0,60)}),"prefill"===t.mode?R({text:t.text,seq:Date.now()}):ew(t.text)},children:e.label},e.key))}),e.assistant&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 text-[0.6875rem] text-[#98a2b3]",children:[(0,r.jsx)("button",{type:"button",className:"rounded-md px-2 py-1 text-[#667085] transition-colors hover:bg-[#eceef2] hover:text-[#101828]",onClick:()=>{var n,r;return eC(t,String((null===(n=e.assistant)||void 0===n?void 0:n.message)||(null===(r=e.assistant)||void 0===r?void 0:r.clarifying_question)||""))},children:y===t?"Ú©Ù¾Û Ø´Ø¯":"Ú©Ù¾Û"}),(0,r.jsx)("button",{type:"button",className:"rounded-md px-2 py-1 text-[#667085] transition-colors hover:bg-[#eceef2] hover:text-[#101828] disabled:opacity-40",disabled:i,onClick:()=>ew(e.user),children:"پاسخ دÛگر"}),(0,r.jsx)("button",{type:"button","aria-label":"اÛ٠پاسخ Ú©Ù
Ú© کرد","aria-pressed":1===j[t],"data-testid":"yara-rate-up",className:"rounded-md px-2 py-1 transition-colors hover:bg-[#eceef2] ".concat(1===j[t]?"text-primary":"text-[#667085] hover:text-[#101828]"),onClick:()=>eI(t,1,e),children:"\uD83D\uDC4D"}),(0,r.jsx)("button",{type:"button","aria-label":"اÛ٠پاسخ Ú©Ù
Ú© Ùکرد","aria-pressed":-1===j[t],"data-testid":"yara-rate-down",className:"rounded-md px-2 py-1 transition-colors hover:bg-[#eceef2] ".concat(-1===j[t]?"text-[#e5343f]":"text-[#667085] hover:text-[#101828]"),onClick:()=>eI(t,-1,e),children:"\uD83D\uDC4E"}),e.at&&(0,r.jsx)("span",{className:"px-2",children:new Date(e.at).toLocaleTimeString("fa-IR",{hour:"2-digit",minute:"2-digit"})})]}),e.failed&&(0,r.jsxs)("div",{"data-testid":"yara-failure","data-kind":null!==(p=e.failureKind)&&void 0!==p?p:"unavailable",className:"flex flex-col items-start gap-2.5 rounded-2xl rounded-bl-[0.25rem] border border-solid border-amber-200 bg-amber-50 px-4 py-3.5",children:[(0,r.jsx)("p",{className:"text-sm leading-7 text-[#475467]",children:T(null!==(v=e.failureKind)&&void 0!==v?v:"unavailable").text}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[T(null!==(b=e.failureKind)&&void 0!==b?b:"unavailable").retry&&(0,r.jsx)("button",{type:"button","data-testid":"yara-retry",disabled:i,className:"rounded-[0.5625rem] bg-primary px-4 py-2 text-xs font-bold text-white disabled:opacity-40",onClick:()=>{var t;(0,f.kJ)("failure_retry",{failure_kind:null!==(t=e.failureKind)&&void 0!==t?t:""}),ew(e.user)},children:"Ø¯ÙØ¨Ø§Ø±Ù ØªÙØ§Ø´ Ú©Ù"}),(0,r.jsx)("a",{href:(_=e.user,"/s/?text=".concat(encodeURIComponent(String(null!=_?_:"").trim()))),className:"rounded-[0.5625rem] border border-solid border-[#d0d5dd] bg-white px-4 py-2 text-xs font-bold text-[#344054]",onClick:()=>(0,f.YE)(K.current,"failure_to_search",S),children:"ÙÙ
ÛÙ Ù
ت٠را در جستج٠ببÛÙ"})]})]})]})]},t)}),ea&&(0,r.jsx)(v,{bookings:er,loading:el,onCancel:e=>ec(e)}),ed&&(0,r.jsx)(b,{booking:ed,busy:eu,onConfirm:eN,onDismiss:()=>ec(null)}),em&&(0,r.jsx)("p",{className:"rounded-2xl border border-solid border-[#e6e8ec] bg-white px-4 py-3 text-sm leading-7",children:em}),i&&(0,r.jsx)("div",{"data-testid":"yara-busy","aria-label":"در ØØ§Ù بررسÛ",children:(0,r.jsx)(X,{children:(0,r.jsxs)("span",{className:"flex w-fit items-center gap-2.5 rounded-2xl rounded-bl-[0.25rem] border border-solid border-[#e6e8ec] bg-white px-4 py-3",children:[(0,r.jsx)("span",{className:"flex items-center gap-1","aria-hidden":"true",children:[0,150,300].map(e=>(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-[#98a2b3]",style:{animationDelay:"".concat(e,"ms")}},e))}),(0,r.jsx)("span",{"data-testid":"yara-busy-label",className:"text-xs text-[#667085]",children:(e=L?Date.now()-L:0)<2500?"در ØØ§Ù Ø®ÙØ§ÙØ¯Ù Ù¾ÛØ§Ù
Ø´Ù
اâ¦":e<7e3?"در ØØ§Ù Ù¾ÛØ¯Ø§ کرد٠پزشک٠Ù
ÙØ§Ø³Ø¨â¦":"Ú©Ù
Û Ø·ÙÙ Ú©Ø´ÛØ¯Ø ÙÙÙØ² دارÙ
Ø¨Ø±Ø±Ø³Û Ù
ÛâÚ©ÙÙ
â¦"})]})})}),(0,r.jsx)("div",{ref:eg})]})}),(0,r.jsx)(V,{busy:i,hasThread:t.length>0,draft:E,onSend:ew})]})]})})};let $=e=>{let{children:t}=e;return(0,r.jsx)("div",{dir:"rtl",className:"mx-auto flex min-h-screen w-full max-w-2xl flex-col items-center justify-center gap-4 p-6 text-center",children:t})};var ee=()=>{let e=(0,c.useRouter)(),t=(0,u.Rr)("page"),[n,i]=(0,a.useState)(!1);if((0,a.useEffect)(()=>i(!0),[]),!n||"auth_pending"===t.reason){var l;return(0,r.jsx)($,{children:(0,r.jsx)("p",{"data-testid":"yara-loading","data-reason":null!==(l=t.reason)&&void 0!==l?l:"not_mounted",className:"text-sm text-slate-400",children:"در ØØ§Ù Ø¢Ù
ادÙâØ³Ø§Ø²Ûâ¦"})})}if("not_logged_in"===t.reason){let t=e.asPath&&"/"!==e.asPath?e.asPath:"/yara";return(0,r.jsxs)($,{children:[(0,r.jsx)("h1",{className:"text-base font-bold text-slate-800",children:"Ø¨Ø±Ø§Û Ú¯ÙØªÚ¯Ù با ÛØ§Ø±Ø§ ÙØ§Ø±Ø¯ ØØ³Ø§Ø¨âتا٠شÙÛØ¯"}),(0,r.jsx)("p",{className:"max-w-sm text-sm leading-7 text-slate-600",children:"ÛØ§Ø±Ø§ ب٠ÙÙØ¨ØªâÙØ§ Ù Ø§Ø·ÙØ§Ø¹Ø§Øª ØØ³Ø§Ø¨ Ø´Ù
ا ÙÛØ§Ø² دارد تا Ø¨ØªÙØ§Ùد Ú©Ù
Ú©âØªØ§Ù Ú©ÙØ¯Ø ب٠ÙÙ
Û٠دÙÛÙ ÙÙØ· Ø¨Ø±Ø§Û Ú©Ø§Ø±Ø¨Ø±Ø§Ù ÙØ§Ø±Ø¯Ø´Ø¯Ù در دسترس است."}),(0,r.jsx)("a",{"data-testid":"yara-login-cta",href:"/login?redirect_url=".concat(encodeURIComponent(t)),className:"rounded-xl bg-primary px-5 py-3 text-sm font-bold text-white",children:"ÙØ±Ùد Ø¨Ù ØØ³Ø§Ø¨ کاربرÛ"}),(0,r.jsx)(d(),{href:"/",prefetch:!1,className:"text-xs text-slate-500 underline",children:"بازگشت Ø¨Ù ØµÙØÙâÛ Ø§ØµÙÛ"})]})}return t.allowed?(0,r.jsx)(Q,{}):(0,r.jsxs)($,{children:[(0,r.jsx)("h1",{"data-testid":"yara-unavailable",className:"text-base font-bold text-slate-800",children:"ÛØ§Ø±Ø§ ÙÙÙØ² Ø¨Ø±Ø§Û ØØ³Ø§Ø¨ Ø´Ù
ا ÙØ¹Ø§Ù ÙØ´Ø¯Ù است."}),(0,r.jsx)("p",{className:"max-w-sm text-sm leading-7 text-slate-600",children:"بÙâØªØ¯Ø±ÛØ¬ در دسترس Ú©Ø§Ø±Ø¨Ø±Ø§Ù Ø¨ÛØ´ØªØ±Û ÙØ±Ø§Ø± Ù
ÛâÚ¯ÛØ±Ø¯. تا آ٠زÙ
ا٠Ù
ÛâØªÙØ§ÙÛØ¯ از جستجÙÛ Ù
عÙ
ÙÙÛ Ø§Ø³ØªÙØ§Ø¯Ù Ú©ÙÛØ¯."}),(0,r.jsx)(d(),{href:"/",prefetch:!1,className:"rounded-xl bg-primary px-5 py-3 text-sm font-bold text-white",children:"بازگشت Ø¨Ù ØµÙØÙâÛ Ø§ØµÙÛ"})]})};let et=()=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l(),{children:[(0,r.jsx)("title",{children:"ÛØ§Ø±Ø§ | ÙÙ
Ø±Ø§Ù Ø³ÙØ§Ù
ت Ø´Ù
ا | Ù¾Ø°ÛØ±Ø´Û²Û´"}),(0,r.jsx)("meta",{name:"robots",content:"noindex,nofollow"})]}),(0,r.jsx)(ee,{})]});
1et.getLayout=function(e){return(0,r.jsx)(s.i,{showFooter:!1,shouldShowPromoteApp:!1,children:e})};var en=!0,er=et}},function(e){e.O(0,[9351,1258,7991,9492,9791,6251,7326,6842,6221,3093,3015,5954,5755,1199,4671,6886,6733,2361,3540,1582,2447,4629,265,396,2888,170,179],function(){return e(e.s=93364)}),_N_E=e.O()}]); 2//# sourceMappingURL=yara-c2d13336504d9fe5.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.