import{g as e,y as t,q as r,o as n,n as a,k as i,j as o,R as u,r as s,z as l,e as c,p as d,f as p,A as h,v as f,B as g,t as _,C as m,D,s as b,F as v,l as y,h as w,E,a as C,_ as A,H as F,G as k,i as x,c as S,I}from"./4.DsIPCrft.chunk.js";import{k as T}from"./5.C_rgEAoe.chunk.js";import{a as B,g as z,c as P,b as O,h as R,d as M,t as $}from"./6.CoSZoCaB.chunk.js";var j="__test_storage_support__",q=function(e){void 0===e&&(e="local");try{var t="session"===e?window.sessionStorage:window.localStorage;return t.setItem(j,"@@test"),"@@test"!==t.getItem(j)?!1:(t.removeItem(j),!0)}catch(r){return!1}},N=function(){var e=Object.create(null);return{getItem:function(t){var r=e[t];return"string"==typeof r?r:null},setItem:function(t,r){e[t]=r},removeItem:function(t){delete e[t]},clear:function(){e=Object.create(null)}}}();const U=e(e=>(t,r)=>{if(0!==t)return;if("function"!=typeof e)return r(0,()=>{}),void r(2);let n,a=!1;r(0,e=>{a||(a=2===e,a&&"function"==typeof n&&n())}),a||(n=e(e=>{a||r(1,e)},e=>{a||void 0===e||(a=!0,r(2,e))},()=>{a||(a=!0,r(2))}))});var L;L="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")();var Z,V,H=("function"==typeof(V=L.Symbol)?V.observable?Z=V.observable:(Z=V("observable"),V.observable=Z):Z="@@observable",Z);const W=t(Object.freeze(Object.defineProperty({__proto__:null,default:H},Symbol.toStringTag,{value:"Module"}))).default;const Y=e(e=>(t,r)=>{if(0!==t)return;let n;r(0,e=>{2===e&&n&&(n.unsubscribe?n.unsubscribe():n())}),e=e[W]?e[W]():e,n=e.subscribe({next:e=>r(1,e),error:e=>r(2,e),complete:()=>r(2)})});const G=e((function(){let e=[];return(t,r)=>{if(0===t){const t=r;e.push(t),t(0,r=>{if(2===r){const r=e.indexOf(t);r>-1&&e.splice(r,1)}})}else{const n=e.slice(0);for(let a,i=0,o=n.length;i-1&&a(t,r)}}})),J={},K=e=>t=>(r,n)=>{if(0!==r)return;let a,i,o=!1,u=J;t(0,(t,r)=>{if(0===t)return a=r,e(0,(e,t)=>0===e?(i=t,void i(1)):1===e?(u=void 0,i(2),a(2),void(o&&n(2))):void(2===e&&(i=null,t&&(u=t,a(2),o&&n(e,t))))),o=!0,n(0,(e,t)=>{u===J&&(2===e&&i&&i(2),a(e,t))}),void(u!==J&&n(2,u));2===t&&i(2),n(t,r)})},Q=q()?window.localStorage:N,X={setItem:(e,t)=>new Promise(r=>r(Q.setItem(e,t))),getItem:e=>new Promise(t=>t(Q.getItem(e))),removeItem:e=>new Promise(t=>t(Q.removeItem(e)))};function ee(e,t){return[].concat(...t.map(e))}function te(e){return"object"==typeof e&&null!==e&&!r(e)}function re(e,t){return T(t).reduce((r,n)=>(r[n]=e(t[n]),r),{})}function ne(e){let t=e.trim();if(0===t.length)return"";if(1===t.length)return t.toLowerCase();if(/^[a-z\d]+$/.test(t))return t;return t!==t.toLowerCase()&&(t=function(e){let t=e,r=!1,n=!1,a=!1;for(let i=0;it.toUpperCase()),t}function ae(e){return r(e)?e:[e]}function ie(e,t){for(let r=0;r=0;r--)if(e(t[r]))return t[r]}function ue(e,t,r){for(let n=t;n>=0;n--)if(e(r[n]))return n;return-1}function se(e,t){return ue(e,t.length-1,t)}function le(){return Math.random().toString(36).substring(2)}function ce(e){const t=le();return n(t,e)?ce(e):t}function de(e,t){const r="string"==typeof e?e.split("."):e;let n=0,a=t;for(;a&&n(t[r[e]]=r,t),{})}function ge(e){return e.length>0?e[e.length-1]:void 0}function _e(e,t){return T(t).reduce((r,n)=>(Object.defineProperty(r,e(n),{value:t[n],enumerable:!0}),r),{})}function me(e,t){return T(t).reduce((r,n)=>(r[n]=e(t[n],n),r),{})}function De(e){return T(e).map(t=>e[t])}function be(e,t){const n="function"==typeof e?e:t=>de(e,t);return(r(t)?[...t]:De(t)).sort((e,t)=>n(e)-n(t))}function ve(e,t){return T(t).reduce((r,n)=>(e(t[n],n)||(r[n]=t[n]),r),{})}function ye(e,t){return ve((t,r)=>-1!==e.indexOf(r),t)}function we(e,t){return e.reduce((e,r)=>(e[r]=t[r],e),{})}function Ee(e,t){return T(t).reduce((r,n)=>(e(t[n])&&(r[n]=t[n]),r),{})}function Ce(e,t){return e.reduce((e,r)=>(n(r,t)&&(e[r]=t[r]),e),{})}function Ae(e,t){return t.filter(t=>!e(t))}function Fe(e,t){if(t.length<=e)return t;const r=t.split(" "),n=[];let a=0;for(const i of r){if(a+i.length>e)break;a+=i.length+1,n.push(i)}return n.join(" ")+"..."}function ke(e,t,r){const n=ue(t=>!e(t),t,r);return n===t?[]:r.slice(n+1,t+1)}function xe(e,t){return e===t?0:e{const n=e(t);return-1===r.indexOf(n)&&(r.push(n),!0)})}const Be=/(?:[^:]+:\/\/)?([^/\s]+)/;function ze(e){const t=e.match(Be);return t&&t[1]}const Pe=(e,t)=>B(t)[e],Oe=/^(?:https?:)?\/\/[^/]+\/([^?#]+)/,Re=e=>{const t=e.match(Oe);return"/"+(t&&t[1]||"")},Me=/^((http(s)?:)?\/\/)/,$e=e=>e.replace(Me,""),je=/^((http(s)?:)?\/\/)/,qe=e=>{const t=e.match(je);return t?t[2]:null},Ne=(e,t)=>{if(0===Object.keys(t).length)return e;const r=z(e),n=Re(e),a=P(e)?B(e):{},i=O({...a,...t});return e.indexOf("#")>-1?""+r+n+"?"+i+"#"+e.split("#")[1]:""+r+n+"?"+i},Ue=(e,t)=>{if(-1===e.indexOf("?"))return e;const r=B(e);if(he(r))return e;if(Object.keys(r).every(e=>!t.includes(e)))return e;t.forEach(e=>delete r[e]);const[n]=e.split("?"),a=Ne(n,r);return e.indexOf("#")>-1?a+"#"+e.split("#")[1]:a},Le=e=>"https://"+$e(e);function Ze(e,t){return t=t||{},new Promise((function(r,n){var a=new XMLHttpRequest,i=[],o=[],u={},s=function(){return{ok:2==(a.status/100|0),statusText:a.statusText,status:a.status,url:a.responseURL,text:function(){return Promise.resolve(a.responseText)},json:function(){return Promise.resolve(a.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([a.response]))},clone:s,headers:{keys:function(){return i},entries:function(){return o},get:function(e){return u[e.toLowerCase()]},has:function(e){return e.toLowerCase()in u}}}};for(var l in a.open(t.method||"get",e,!0),a.onload=function(){a.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){i.push(t=t.toLowerCase()),o.push([t,r]),u[t]=u[t]?u[t]+","+r:r})),r(s())},a.onerror=n,a.withCredentials="include"==t.credentials,t.headers)a.setRequestHeader(l,t.headers[l]);a.send(t.body||null)}))}const Ve="accept_greeting",He="cancel_greeting",We="check_goals",Ye="deactivate_chat",Ge="delete_chat_properties",Je="delete_event_properties",Ke="delete_thread_properties",Qe="get_chat",Xe="get_customer",et="get_form",tt="get_predicted_agent",rt="get_url_info",nt="list_chats",at="list_group_statuses",it="list_threads",ot="login",ut="mark_events_as_seen",st="resume_chat",lt="send_event",ct="send_rich_message_postback",dt="send_sneak_peek",pt="set_customer_session_fields",ht="start_chat",ft="update_chat_properties",gt="update_customer",_t="update_customer_page",mt="update_event_properties",Dt="update_thread_properties",bt="upload_file";function vt(){const e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}const yt=(e,t)=>{const r=function(r){const n=Object.create(r);n.action=(t,n)=>{const a={type:e,payload:t};n&&(a.meta=n),r.dispatch(a)};for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;oe,r},wt=(e,t)=>{const r="REQUEST_"+e,n=yt(e,t),i=function(e){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u{const{promise:u,resolve:s,reject:c}=vt();e.dispatch({type:r,payload:{...t,meta:i,resolve:s,reject:c}}),l=u,l.then(()=>{n(e,...o)},a)},t(s,...o),void 0===l)throw new Error("You forgot to call `action` handler in "+r+" creator.");return l};return i.toString=()=>r,{actionMethod:n,requestActionMethod:i}},Et=(e,t)=>{if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("bindActionMethods expects a plain object with actionMethods as values.");return re(e=>((e,t)=>function(){for(var r=arguments.length,n=new Array(r),a=0;a(t[void 0]&&console.warn(["Reducer contains an 'undefined' action type.","Have you misspelled a constant?"].join("\n")),function(r,a){return void 0===r&&(r=e),n(a.type,t)?t[a.type](r,a.payload):r}),At=(e,t)=>{if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("bindSelectors expects a plain object with selectors as values.");return re(e=>((e,t)=>function(){for(var r=arguments.length,n=new Array(r),a=0;at.reduce((e,t)=>t(e,r),e)},kt="customer",xt="chat_deactivated",St="customer_disconnected",It="customer_side_storage_updated",Tt="groups_status_updated",Bt="incoming_chat",zt="incoming_event",Pt="incoming_typing_indicator",Ot="queue_position_updated",Rt="thread_properties_updated",Mt="user_added_to_chat",$t=Object.freeze(Object.defineProperty({__proto__:null,CHAT_DEACTIVATED:"chat_deactivated",CHAT_PROPERTIES_DELETED:"chat_properties_deleted",CHAT_PROPERTIES_UPDATED:"chat_properties_updated",CHAT_TRANSFERRED:"chat_transferred",CUSTOMER_DISCONNECTED:"customer_disconnected",CUSTOMER_SIDE_STORAGE_UPDATED:"customer_side_storage_updated",CUSTOMER_UPDATED:"customer_updated",EVENTS_MARKED_AS_SEEN:"events_marked_as_seen",EVENT_PROPERTIES_DELETED:"event_properties_deleted",EVENT_PROPERTIES_UPDATED:"event_properties_updated",EVENT_UPDATED:"event_updated",GREETING_ACCEPTED:"greeting_accepted",GREETING_CANCELED:"greeting_canceled",GROUPS_STATUS_UPDATED:"groups_status_updated",INCOMING_CHAT:"incoming_chat",INCOMING_EVENT:"incoming_event",INCOMING_GREETING:"incoming_greeting",INCOMING_MULTICAST:"incoming_multicast",INCOMING_RICH_MESSAGE_POSTBACK:"incoming_rich_message_postback",INCOMING_TYPING_INDICATOR:"incoming_typing_indicator",QUEUE_POSITION_UPDATED:"queue_position_updated",THREAD_PROPERTIES_DELETED:"thread_properties_deleted",THREAD_PROPERTIES_UPDATED:"thread_properties_updated",USER_ADDED_TO_CHAT:"user_added_to_chat",USER_REMOVED_FROM_CHAT:"user_removed_from_chat"},Symbol.toStringTag,{value:"Module"})),jt="file",qt="filled_form",Nt="message",Ut="system_message",Lt="custom",Zt=Object.freeze({success:!0}),Vt=(e,t)=>{const r={id:t.id,authorId:t.author_id,createdAt:t.created_at,threadId:e,properties:t.properties||{}};return void 0!==t.custom_id&&(r.customId=t.custom_id),r},Ht=(e,t)=>{let r,n,a,i;t.height>t.width?(r="height",n="width",a=t.height,i=t.width):(r="width",n="height",a=t.width,i=t.height);const o=e/a;return{[r]:Math.ceil(Math.min(a,e)),[n]:Math.ceil(Math.min(o*i,i))}},Wt=(e,t)=>void 0!==t.width&&void 0!==t.height?((e,t)=>({...Vt(e,t),type:"file",contentType:t.content_type,url:t.url,name:t.name,width:t.width,height:t.height,thumbnails:{default:{url:t.thumbnail_url,...Ht(300,t)},high:{url:t.thumbnail2x_url,...Ht(600,t)}},...t.alternative_text&&{alternativeText:t.alternative_text}}))(e,t):{...Vt(e,t),type:"file",contentType:t.content_type,url:t.url,name:t.name},Yt=e=>{const t={};if("string"==typeof e.title&&(t.title=e.title),"string"==typeof e.subtitle&&(t.subtitle=e.subtitle),e.image){const{image:r}=e;t.image={url:r.url,name:r.name,...r.alternative_text&&{alternativeText:r.alternative_text}}}return e.buttons&&(t.buttons=e.buttons.map(e=>{switch(e.type){case"message":case"copy":case"phone":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default"};case"cancel":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,role:e.role||"default"};case"url":{const t={type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default"};return e.target&&(t.target=e.target),t}case"webview":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default"};default:return{text:e.text,postbackId:e.postback_id,userIds:e.user_ids,role:e.role||"default"}}})),t},Gt=(e,t)=>{switch(t.type){case"file":return Wt(e,t);case"form":return((e,t)=>({...Vt(e,t),authorId:"system",type:"form",formId:t.form_id,fields:t.fields}))(e,t);case"filled_form":return((e,t)=>({...Vt(e,t),type:"filled_form",formId:t.form_id,fields:t.fields.map(e=>{switch(e.type){case"group_chooser":{if(!e.answer)return e;const{group_id:t,...r}=e.answer;return{...e,answer:{...r,groupId:t}}}default:return e}})}))(e,t);case"message":return((e,t)=>({...Vt(e,t),type:"message",text:t.text}))(e,t);case"rich_message":return((e,t)=>{switch(t.template_id){case"cards":case"quick_replies":case"sticker":return{...Vt(e,t),type:"rich_message",template:t.template_id,elements:t.elements.map(Yt)};default:return null}})(e,t);case"system_message":return((e,t)=>{const r={...Vt(e,{...t,author_id:"system"}),type:"system_message",text:t.text,systemMessageType:t.system_message_type};return t.text_vars&&(r.textVars=t.text_vars),r})(e,t);case"custom":return((e,t)=>({...Vt(e,t),type:"custom",...t.content&&{content:t.content}}))(e,t);default:return null}},Jt=e=>({id:e.id,addon:e.addon||null,uniqueId:e.unique_id,displayedFirstTime:e.displayed_first_time,isExitIntent:e.is_exit_intent,accepted:e.accepted||!1,subtype:e.subtype||"greeting",event:Gt(null,e.event),agent:{id:e.agent.id,name:e.agent.name,avatar:e.agent.avatar,jobTitle:e.agent.job_title,isBot:e.agent.is_bot||!1}}),Kt=function(e){return void 0===e&&(e={}),e.group_ids?{groupIds:e.group_ids}:{}},Qt=e=>re(e=>e.events_seen_up_to?e.events_seen_up_to:null,fe("id",e)),Xt=(e,t)=>{const r=t.properties||{};return{id:t.id,chatId:e,active:t.active,access:Kt(t.access),createdAt:t.created_at,userIds:t.user_ids,events:t.events.map(e=>Gt(t.id,e)).filter(Boolean),properties:r,previousThreadId:t.previous_thread_id||null,nextThreadId:t.next_thread_id||null,queue:t.queue?or(t.queue):null}},er=e=>({id:e.id,access:Kt(e.access),users:e.users.map(ur),properties:e.properties||{},eventsSeenUpToMap:Qt(e.users)}),tr=e=>{const t=Ce(["avatar","email","name"],e);return e.session_fields&&(t.sessionFields=e.session_fields.reduce((e,t)=>{const[r]=Object.keys(t);return e[r]=t[r],e},{})),t},rr=e=>{const t=tr(e);return{id:e.id,type:"customer",...t,sessionFields:t.sessionFields||{}}},nr=e=>{const{statistics:t}=e;return{...rr(e),statistics:{chatsCount:t.chats_count,threadsCount:t.threads_count,visitsCount:t.visits_count,pageViewsCount:t.page_views_count,greetingsShownCount:t.greetings_shown_count,greetingsAcceptedCount:t.greetings_accepted_count}}},ar=e=>{const{agent:t,queue:r}=e;return{agent:{id:t.id,type:"agent",name:t.name,avatar:t.avatar,jobTitle:t.job_title,isBot:t.is_bot},queue:r}},ir=e=>({position:e.position,waitTime:e.wait_time}),or=e=>({...ir(e),queuedAt:e.queued_at}),ur=e=>{return"customer"===e.type?{...rr(r=e),present:r.present}:{id:(t=e).id,type:"agent",name:t.name,avatar:t.avatar,jobTitle:t.job_title,present:t.present};var t,r},sr=e=>"offline"===e?"offline":"online",lr=e=>({chatId:e.chat_id,properties:e.properties}),cr=e=>{const t={chatId:e.chat_id,threadId:e.thread_id,transferredTo:{...e.transferred_to.agent_ids&&{agentIds:e.transferred_to.agent_ids},...e.transferred_to.group_ids&&{groupIds:e.transferred_to.group_ids}},queue:e.queue?or(e.queue):null};return"manual"===e.reason?{...t,reason:e.reason,requesterId:e.requester_id}:{...t,reason:e.reason}},dr=e=>({id:e.id,...tr(e)}),pr=e=>({chatId:e.chat_id,threadId:e.thread_id,eventId:e.event_id,properties:e.properties}),hr=e=>({chatId:e.chat_id,threadId:e.thread_id,eventId:e.event_id,properties:e.properties}),fr=e=>{const t=e.thread_id;return{chatId:e.chat_id,threadId:t,event:Gt(t,e.event)}},gr=e=>({chatId:e.chat_id,userId:e.user_id,seenUpTo:e.seen_up_to}),_r=e=>({uniqueId:e.unique_id}),mr=e=>{const{chat:t}=e;return{chat:{...er(t),thread:Xt(t.id,t.thread)}}},Dr=e=>({chatId:e.chat_id,event:Gt(e.thread_id,e.event)}),br=e=>Jt(e),vr=e=>({userId:e.user_id,chatId:e.chat_id,threadId:e.thread_id,eventId:e.event_id,postback:e.postback}),yr=e=>{const{chat_id:t,typing_indicator:r}=e;return{chatId:t,typingIndicator:{authorId:r.author_id,isTyping:r.is_typing}}},wr=e=>({chatId:e.chat_id,threadId:e.thread_id,queue:ir(e.queue)}),Er=e=>({chatId:e.chat_id,threadId:e.thread_id,properties:e.properties}),Cr=e=>({chatId:e.chat_id,threadId:e.thread_id,properties:e.properties}),Ar=e=>({chatId:e.chat_id,user:ur(e.user),present:e.user.present}),Fr=e=>({chatId:e.chat_id,userId:e.user_id}),kr=e=>e.map(e=>{switch(e.type){case"group_chooser":return{...e,options:e.options.map(e=>{let{group_id:t,...r}=e;return{...r,groupId:t}})};case"rating":{const{comment_label:t,...r}=e;return{...r,commentLabel:t}}default:return e}}),xr=e=>{const t=e.map((e,t)=>({...e,id:String(t)}));return kr(t)},Sr=e=>{const t=!("id"in e.fields[0]);return{id:e.id,fields:t?xr(e.fields):kr(e.fields)}},Ir=e=>e.enabled?{...e,form:Sr(e.form)}:e,Tr=e=>{const t={url:e.url};return e.title&&(t.title=e.title),e.description&&(t.description=e.description),e.image_url&&(t.imageUrl="https://"+$e(e.image_url),e.image_width&&e.image_height&&(t.imageWidth=e.image_width,t.imageHeight=e.image_height)),t},Br=e=>{let{online_groups_ids:t,customer_groups:r}=e;if(!t)return"offline";return pe(r.monitoring.id,t)?"online":"offline"},zr=e=>{const t=e.chats_summary.map(e=>{let{id:t,active:r,access:n,last_thread_created_at:a,last_thread_id:i,last_event_per_type:o,properties:u={},users:s}=e;const l={id:t,active:r,access:Kt(n),properties:u,users:s.map(ur),lastThreadId:i||null,lastThreadCreatedAt:a||null,eventsSeenUpToMap:Qt(s)};if(!o)return l;l.lastEventsPerType=re(e=>Gt(e.thread_id,e.event),o);const c=o,d=ge(Object.keys(c).map(e=>c[e]).sort((e,t)=>e.thread_id===t.thread_id?xe(e.event.created_at,t.event.created_at):xe(e.thread_created_at,t.thread_created_at)));return d&&l.lastEventsPerType&&(l.lastEvent=l.lastEventsPerType[d.event.type]),l});return{chatsSummary:be(e=>{var t;let{lastEvent:r,order:n}=e;return-1*(null!=(t=void 0!==r?r.timestamp:n)?t:0)},t),totalChats:e.total_chats,users:Te(e=>e.id,ee(e=>e.users,t)),previousPageId:e.previous_page_id||null,nextPageId:e.next_page_id||null}},Pr=e=>e.groups_status,Or=(e,t)=>({threads:t.threads.map(t=>Xt(e.payload.chat_id,t)),previousPageId:t.previous_page_id||null,nextPageId:t.next_page_id||null}),Rr=e=>{const{__priv_dynamic_config:t,chats:r,greeting:n}=e;return{dynamicConfig:t,customer:nr(e.customer),availability:Br(t),chats:r.map(t=>({id:t.chat_id,active:"has_active_thread"in t?t.has_active_thread:e.has_active_thread,hasUnreadEvents:t.has_unread_events})),...n&&{greeting:Jt(n)}}},Mr=e=>{switch(e.action){case"chat_deactivated":return{action:e.action,payload:{chatId:e.payload.chat_id}};case"chat_properties_deleted":return{action:e.action,payload:(t=e.payload,{chatId:t.chat_id,properties:t.properties})};case"chat_properties_updated":return{action:e.action,payload:lr(e.payload)};case"chat_transferred":return{action:e.action,payload:cr(e.payload)};case"customer_side_storage_updated":case"customer_disconnected":return{action:e.action,payload:e.payload};case"customer_updated":return{action:e.action,payload:dr(e.payload)};case"event_properties_deleted":return{action:e.action,payload:pr(e.payload)};case"event_properties_updated":return{action:e.action,payload:hr(e.payload)};case"event_updated":return{action:e.action,payload:fr(e.payload)};case"events_marked_as_seen":return{action:e.action,payload:gr(e.payload)};case"greeting_accepted":case"greeting_canceled":return{action:e.action,payload:_r(e.payload)};case"groups_status_updated":return{action:e.action,payload:e.payload};case"incoming_chat":return{action:e.action,payload:mr(e.payload)};case"incoming_event":return{action:e.action,payload:Dr(e.payload)};case"incoming_greeting":return{action:e.action,payload:br(e.payload)};case"incoming_multicast":return{action:e.action,payload:e.payload};case"incoming_rich_message_postback":return{action:e.action,payload:vr(e.payload)};case"incoming_typing_indicator":return{action:e.action,payload:yr(e.payload)};case"queue_position_updated":return{action:e.action,payload:wr(e.payload)};case"thread_properties_deleted":return{action:e.action,payload:Er(e.payload)};case"thread_properties_updated":return{action:e.action,payload:Cr(e.payload)};case"user_added_to_chat":return{action:e.action,payload:Ar(e.payload)};case"user_removed_from_chat":return{action:e.action,payload:Fr(e.payload)}}var t},$r=e=>{let{request:t,response:r}=e;switch(r.action){case"accept_greeting":case"cancel_greeting":case"delete_chat_properties":case"delete_event_properties":case"delete_thread_properties":return{action:r.action,payload:Zt};case"get_chat":return{action:r.action,payload:(n=r.payload,{...er(n),thread:n.thread?Xt(n.id,n.thread):null})};case"get_customer":return{action:r.action,payload:nr(r.payload)};case"get_form":return{action:r.action,payload:Ir(r.payload)};case"get_predicted_agent":return{action:r.action,payload:ar(r.payload)};case"get_url_info":return{action:r.action,payload:Tr(r.payload)};case"list_chats":return{action:r.action,payload:zr(r.payload)};case"list_group_statuses":return{action:r.action,payload:Pr(r.payload)};case"list_threads":return{action:r.action,payload:Or(t,r.payload)};case"login":return{action:r.action,payload:Rr(r.payload)};case"mark_events_as_seen":case"send_sneak_peek":case"set_customer_session_fields":case"send_rich_message_postback":case"update_chat_properties":case"update_customer":case"update_customer_page":case"update_event_properties":case"update_thread_properties":return{action:r.action,payload:Zt}}var n},jr=e=>({code:e.type.toUpperCase(),message:e.message});var qr,Nr,Ur,Lr,Zr,Vr,Hr,Wr,Yr,Gr;function Jr(){return Gr?Yr:(Gr=1,Yr=function(e){var t={};t.src_Any=(Nr?qr:(Nr=1,qr=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/)).source,t.src_Cc=(Lr?Ur:(Lr=1,Ur=/[\0-\x1F\x7F-\x9F]/)).source,t.src_Z=(Vr?Zr:(Vr=1,Zr=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/)).source,t.src_P=(Wr?Hr:(Wr=1,Hr=/[!-#%-\*,-/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E49\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/)).source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");return t.src_pseudo_letter="(?:(?![><|]|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|[><|]|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|[><|]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,3}[a-zA-Z0-9%/]|\\.(?!"+t.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|[><|]|\\(|"+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t})}function Kr(e){var t=Array.prototype.slice.call(arguments,1);return t.forEach((function(t){t&&Object.keys(t).forEach((function(r){e[r]=t[r]}))})),e}function Qr(e){return Object.prototype.toString.call(e)}function Xr(e){return"[object Function]"===Qr(e)}function en(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var tn={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};var rn={"http:":{validate:function(e,t,r){var n=e.slice(t);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,r){var n=e.slice(t);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?t>=3&&":"===e[t-3]||t>=3&&"/"===e[t-3]?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,r){var n=e.slice(t);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}},nn="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function an(e){var t=e.re=Jr()(e.__opts__),r=e.__tlds__.slice();function n(e){return e.replace("%TLDS%",t.src_tlds)}e.onCompile(),e.__tlds_replaced__||r.push("a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"),r.push(t.src_xn),t.src_tlds=r.join("|"),t.email_fuzzy=RegExp(n(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(n(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(n(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(n(t.tpl_host_fuzzy_test),"i");var a=[];function i(e,t){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}e.__compiled__={},Object.keys(e.__schemas__).forEach((function(t){var r=e.__schemas__[t];if(null!==r){var n={validate:null,link:null};if(e.__compiled__[t]=n,"[object Object]"===Qr(r))return!function(e){return"[object RegExp]"===Qr(e)}(r.validate)?Xr(r.validate)?n.validate=r.validate:i(t,r):n.validate=function(e){return function(t,r){var n=t.slice(r);return e.test(n)?n.match(e)[0].length:0}}(r.validate),void(Xr(r.normalize)?n.normalize=r.normalize:r.normalize?i(t,r):n.normalize=function(e,t){t.normalize(e)});!function(e){return"[object String]"===Qr(e)}(r)?i(t,r):a.push(t)}})),a.forEach((function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)})),e.__compiled__[""]={validate:null,normalize:function(e,t){t.normalize(e)}};var o=Object.keys(e.__compiled__).filter((function(t){return t.length>0&&e.__compiled__[t]})).map(en).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),function(e){e.__index__=-1,e.__text_cache__=""}(e)}function on(e,t){var r=e.__index__,n=e.__last_index__,a=e.__text_cache__.slice(r,n);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=n+t,this.raw=a,this.text=a,this.url=a}function un(e,t){var r=new on(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function sn(e,t){if(!(this instanceof sn))return new sn(e,t);var r;t||(r=e,Object.keys(r||{}).reduce((function(e,t){return e||tn.hasOwnProperty(t)}),!1)&&(t=e,e={})),this.__opts__=Kr({},tn,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Kr({},rn,e),this.__compiled__={},this.__tlds__=nn,this.__tlds_replaced__=!1,this.re={},an(this)}sn.prototype.add=function(e,t){return this.__schemas__[e]=t,an(this),this},sn.prototype.set=function(e){return this.__opts__=Kr(this.__opts__,e),this},sn.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,r,n,a,i,o,u,s;if(this.re.schema_test.test(e))for((u=this.re.schema_search).lastIndex=0;null!==(t=u.exec(e));)if(a=this.testSchemaAt(e,t[2],u.lastIndex)){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+a;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(s=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||s=0&&null!==(n=e.match(this.re.email_fuzzy))&&(i=n.index+n[1].length,o=n.index+n[0].length,(this.__index__<0||ithis.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=o)),this.__index__>=0},sn.prototype.pretest=function(e){return this.re.pretest.test(e)},sn.prototype.testSchemaAt=function(e,t,r){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,r,this):0},sn.prototype.match=function(e){var t=0,r=[];this.__index__>=0&&this.__text_cache__===e&&(r.push(un(this,t)),t=this.__last_index__);for(var n=t?e.slice(t):e;this.test(n);)r.push(un(this,t)),n=n.slice(this.__last_index__),t+=this.__last_index__;return r.length?r:null},sn.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter((function(e,t,r){return e!==r[t-1]})).reverse(),an(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,an(this),this)},sn.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},sn.prototype.onCompile=function(){};var ln=sn;const cn=e(ln);var dn={exports:{}},pn=dn.exports=function(){function e(e,t,r){return r&&function(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n={exports:{}};function a(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}n.exports={defaults:{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1},getDefaults:a,changeDefaults:function(e){n.exports.defaults=e}};var i=/[&<>"']/,o=/[&<>"']/g,u=/[<>"']|&(?!#?\w+;)/,s=/[<>"']|&(?!#?\w+;)/g,l={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(e){return l[e]},d=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function p(e){return e.replace(d,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var h=/(^|[^\[])\^/g,f=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,_={},m=/^[^:]+:\/*[^/]*$/,D=/^([^:]+:)[\s\S]*$/,b=/^([^:]+:\/*[^/]*)[\s\S]*$/;function v(e,t){_[" "+e]||(m.test(e)?_[" "+e]=e+"/":_[" "+e]=y(e,"/",!0));var r=-1===(e=_[" "+e]).indexOf(":");return"//"===t.substring(0,2)?r?t:e.replace(D,"$1")+t:"/"===t.charAt(0)?r?t:e.replace(b,"$1")+t:e+t}function y(e,t,r){var n=e.length;if(0===n)return"";for(var a=0;a=0&&"\\"===r[a];)n=!n;return n?"|":" |"})).split(/ \|/),n=0;if(r.length>t)r.splice(t);else for(;r.length1;)1&t&&(r+=e),t>>=1,e+=e;return r+e},z=n.exports.defaults,P=S,O=x,R=w,M=I;function $(e,t,r){var n=t.href,a=t.title?R(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:r,href:n,title:a,text:i}:{type:"image",raw:r,href:n,title:a,text:R(i)}}var j=function(){function e(e){this.options=e||z}var t=e.prototype;return t.space=function(e){var t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e){var t=this.rules.block.code.exec(e);if(t){var r=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:P(r,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var r=t[0],n=function(e,t){var r=e.match(/^(\s+)(?:```)/);if(null===r)return t;var n=r[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=n.length?e.slice(n.length):e})).join("\n")}(r,t[3]||"");return{type:"code",raw:r,lang:t[2]?t[2].trim():t[2],text:n}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t){var r=t[2].trim();if(/#$/.test(r)){var n=P(r,"#");this.options.pedantic?r=n.trim():n&&!/ $/.test(n)||(r=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r}}},t.nptable=function(e){var t=this.rules.block.nptable.exec(e);if(t){var r={type:"table",header:O(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[],raw:t[0]};if(r.header.length===r.align.length){var n,a=r.align.length;for(n=0;n ?/gm,"");return{type:"blockquote",raw:t[0],text:r}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){var r,n,a,i,o,u,s,l,c,d=t[0],p=t[2],h=p.length>1,f={type:"list",raw:d,ordered:h,start:h?+p.slice(0,-1):"",loose:!1,items:[]},g=t[0].match(this.rules.block.item),_=!1,m=g.length;a=this.rules.block.listItemStart.exec(g[0]);for(var D=0;Da[1].length:i[1].length>=a[0].length||i[1].length>3){g.splice(D,2,g[D]+(!this.options.pedantic&&i[1].length/i.test(n[0])&&(t=!1),!r&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?r=!0:r&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(r=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:t,inRawBlock:r,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):R(n[0]):n[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var r=t[2].trim();if(!this.options.pedantic&&/^$/.test(r))return;var n=P(r.slice(0,-1),"\\");if((r.length-n.length)%2==0)return}else{var a=M(t[2],"()");if(a>-1){var i=(0===t[0].indexOf("!")?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,i).trim(),t[3]=""}}var o=t[2],u="";if(this.options.pedantic){var s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);s&&(o=s[1],u=s[3])}else u=t[3]?t[3].slice(1,-1):"";return o=o.trim(),/^$/.test(r)?o.slice(1):o.slice(1,-1)),$(t,{href:o?o.replace(this.rules.inline._escapes,"$1"):o,title:u?u.replace(this.rules.inline._escapes,"$1"):u},t[0])}},t.reflink=function(e,t){var r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){var n=(r[2]||r[1]).replace(/\s+/g," ");if(!(n=t[n.toLowerCase()])||!n.href){var a=r[0].charAt(0);return{type:"text",raw:a,text:a}}return $(r,n,r[0])}},t.emStrong=function(e,t,r){void 0===r&&(r="");var n=this.rules.inline.emStrong.lDelim.exec(e);if(n&&(!n[3]||!r.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var a=n[1]||n[2]||"";if(!a||a&&(""===r||this.rules.inline.punctuation.exec(r))){var i,o,u=n[0].length-1,s=u,l=0,c="*"===n[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+u);null!=(n=c.exec(t));)if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6])if(o=i.length,n[3]||n[4])s+=o;else if(!((n[5]||n[6])&&u%3)||(u+o)%3){if(!((s-=o)>0))return o=Math.min(o,o+s+l),Math.min(u,o)%2?{type:"em",raw:e.slice(0,u+n.index+o+1),text:e.slice(1,u+n.index+o)}:{type:"strong",raw:e.slice(0,u+n.index+o+1),text:e.slice(2,u+n.index+o-1)}}else l+=o}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var r=t[2].replace(/\n/g," "),n=/[^ ]/.test(r),a=/^ /.test(r)&&/ $/.test(r);return n&&a&&(r=r.substring(1,r.length-1)),r=R(r,!0),{type:"codespan",raw:t[0],text:r}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2]}},t.autolink=function(e,t){var r,n,a=this.rules.inline.autolink.exec(e);if(a)return n="@"===a[2]?"mailto:"+(r=R(this.options.mangle?t(a[1]):a[1])):r=R(a[1]),{type:"link",raw:a[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}},t.url=function(e,t){var r;if(r=this.rules.inline.url.exec(e)){var n,a;if("@"===r[2])a="mailto:"+(n=R(this.options.mangle?t(r[0]):r[0]));else{var i;do{i=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])[0]}while(i!==r[0]);n=R(r[0]),a="www."===r[1]?"http://"+n:n}return{type:"link",raw:r[0],text:n,href:a,tokens:[{type:"text",raw:n,text:n}]}}},t.inlineText=function(e,t,r){var n,a=this.rules.inline.text.exec(e);if(a)return n=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(a[0]):R(a[0]):a[0]:R(this.options.smartypants?r(a[0]):a[0]),{type:"text",raw:a[0],text:n}},e}(),q=F,N=C,U=k,L={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:q,table:q,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};L.def=N(L.def).replace("label",L._label).replace("title",L._title).getRegex(),L.bullet=/(?:[*+-]|\d{1,9}[.)])/,L.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,L.item=N(L.item,"gm").replace(/bull/g,L.bullet).getRegex(),L.listItemStart=N(/^( *)(bull) */).replace("bull",L.bullet).getRegex(),L.list=N(L.list).replace(/bull/g,L.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+L.def.source+")").getRegex(),L._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",L._comment=/|$)/,L.html=N(L.html,"i").replace("comment",L._comment).replace("tag",L._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),L.paragraph=N(L._paragraph).replace("hr",L.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",L._tag).getRegex(),L.blockquote=N(L.blockquote).replace("paragraph",L.paragraph).getRegex(),L.normal=U({},L),L.gfm=U({},L.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),L.gfm.nptable=N(L.gfm.nptable).replace("hr",L.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",L._tag).getRegex(),L.gfm.table=N(L.gfm.table).replace("hr",L.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",L._tag).getRegex(),L.pedantic=U({},L.normal,{html:N("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",L._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:q,paragraph:N(L.normal._paragraph).replace("hr",L.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",L.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:q,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/\_\_[^_*]*?\*[^_*]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/\*\*[^_*]*?\_[^_*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:q,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~"};Z.punctuation=N(Z.punctuation).replace(/punctuation/g,Z._punctuation).getRegex(),Z.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,Z.escapedEmSt=/\\\*|\\_/g,Z._comment=N(L._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),Z.emStrong.lDelim=N(Z.emStrong.lDelim).replace(/punct/g,Z._punctuation).getRegex(),Z.emStrong.rDelimAst=N(Z.emStrong.rDelimAst,"g").replace(/punct/g,Z._punctuation).getRegex(),Z.emStrong.rDelimUnd=N(Z.emStrong.rDelimUnd,"g").replace(/punct/g,Z._punctuation).getRegex(),Z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Z._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,Z.autolink=N(Z.autolink).replace("scheme",Z._scheme).replace("email",Z._email).getRegex(),Z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Z.tag=N(Z.tag).replace("comment",Z._comment).replace("attribute",Z._attribute).getRegex(),Z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Z._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Z.link=N(Z.link).replace("label",Z._label).replace("href",Z._href).replace("title",Z._title).getRegex(),Z.reflink=N(Z.reflink).replace("label",Z._label).getRegex(),Z.reflinkSearch=N(Z.reflinkSearch,"g").replace("reflink",Z.reflink).replace("nolink",Z.nolink).getRegex(),Z.normal=U({},Z),Z.pedantic=U({},Z.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:N(/^!?\[(label)\]\((.*?)\)/).replace("label",Z._label).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z._label).getRegex()}),Z.gfm=U({},Z.normal,{escape:N(Z.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(r="x"+r.toString(16)),n+="&#"+r+";";return n}var X=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||W,this.options.tokenizer=this.options.tokenizer||new H,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:Y.normal,inline:G.normal};this.options.pedantic?(t.block=Y.pedantic,t.inline=G.pedantic):this.options.gfm&&(t.block=Y.gfm,this.options.breaks?t.inline=G.breaks:t.inline=G.gfm),this.tokenizer.rules=t}t.lex=function(e,r){return new t(r).lex(e)},t.lexInline=function(e,r){return new t(r).inlineTokens(e)};var r=t.prototype;return r.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},r.blockTokens=function(e,t,r){var n,a,i,o,u,s,l=this;for(void 0===t&&(t=[]),void 0===r&&(r=!0),this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((function(r){return!!(n=r.call(l,e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)}))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),n.type&&t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),(o=t[t.length-1])&&"paragraph"===o.type?(o.raw+="\n"+n.raw,o.text+="\n"+n.text):t.push(n);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.nptable(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),n.tokens=this.blockTokens(n.text,[],r),t.push(n);else if(n=this.tokenizer.list(e)){for(e=e.substring(n.raw.length),i=n.items.length,a=0;a=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(u=e.substring(0,t+1))}(),r&&(n=this.tokenizer.paragraph(u)))o=t[t.length-1],s&&"paragraph"===o.type?(o.raw+="\n"+n.raw,o.text+="\n"+n.text):t.push(n),s=u.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),(o=t[t.length-1])&&"text"===o.type?(o.raw+="\n"+n.raw,o.text+="\n"+n.text):t.push(n);else if(e){var c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}return t},r.inline=function(e){var t,r,n,a,i,o,u=e.length;for(t=0;t0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(d));)p.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(d=d.slice(0,s.index)+"["+J("a",s[0].length-2)+"]"+d.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(d));)d=d.slice(0,s.index)+"["+J("a",s[0].length-2)+"]"+d.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.escapedEmSt.exec(d));)d=d.slice(0,s.index)+"++"+d.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(l||(c=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((function(r){return!!(a=r.call(u,e,t))&&(e=e.substring(a.raw.length),t.push(a),!0)}))))if(a=this.tokenizer.escape(e))e=e.substring(a.raw.length),t.push(a);else if(a=this.tokenizer.tag(e,r,n))e=e.substring(a.raw.length),r=a.inLink,n=a.inRawBlock,(i=t[t.length-1])&&"text"===a.type&&"text"===i.type?(i.raw+=a.raw,i.text+=a.text):t.push(a);else if(a=this.tokenizer.link(e))e=e.substring(a.raw.length),"link"===a.type&&(a.tokens=this.inlineTokens(a.text,[],!0,n)),t.push(a);else if(a=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(a.raw.length),i=t[t.length-1],"link"===a.type?(a.tokens=this.inlineTokens(a.text,[],!0,n),t.push(a)):i&&"text"===a.type&&"text"===i.type?(i.raw+=a.raw,i.text+=a.text):t.push(a);else if(a=this.tokenizer.emStrong(e,d,c))e=e.substring(a.raw.length),a.tokens=this.inlineTokens(a.text,[],r,n),t.push(a);else if(a=this.tokenizer.codespan(e))e=e.substring(a.raw.length),t.push(a);else if(a=this.tokenizer.br(e))e=e.substring(a.raw.length),t.push(a);else if(a=this.tokenizer.del(e))e=e.substring(a.raw.length),a.tokens=this.inlineTokens(a.text,[],r,n),t.push(a);else if(a=this.tokenizer.autolink(e,Q))e=e.substring(a.raw.length),t.push(a);else if(r||!(a=this.tokenizer.url(e,Q))){if(o=e,this.options.extensions&&this.options.extensions.startInline&&function(){var t=1/0,r=e.slice(1),n=void 0;u.options.extensions.startInline.forEach((function(e){"number"==typeof(n=e.call(this,r))&&n>=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}(),a=this.tokenizer.inlineText(o,n,K))e=e.substring(a.raw.length),"_"!==a.raw.slice(-1)&&(c=a.raw.slice(-1)),l=!0,(i=t[t.length-1])&&"text"===i.type?(i.raw+=a.raw,i.text+=a.text):t.push(a);else if(e){var h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}throw new Error(h)}}else e=e.substring(a.raw.length),t.push(a);return t},e(t,0,[{key:"rules",get:function(){return{block:Y,inline:G}}}]),t}(),ee=n.exports.defaults,te=A,re=w,ne=function(){function e(e){this.options=e||ee}var t=e.prototype;return t.code=function(e,t,r){var n=(t||"").match(/\S*/)[0];if(this.options.highlight){var a=this.options.highlight(e,n);null!=a&&a!==e&&(r=!0,e=a)}return e=e.replace(/\n$/,"")+"\n",n?'
'+(r?e:re(e,!0))+"
\n":"
"+(r?e:re(e,!0))+"
\n"},t.blockquote=function(e){return"
\n"+e+"
\n"},t.html=function(e){return e},t.heading=function(e,t,r,n){return this.options.headerIds?"'+e+"\n":""+e+"\n"},t.hr=function(){return this.options.xhtml?"
\n":"
\n"},t.list=function(e,t,r){var n=t?"ol":"ul";return"<"+n+(t&&1!==r?' start="'+r+'"':"")+">\n"+e+"\n"},t.listitem=function(e){return"
  • "+e+"
  • \n"},t.checkbox=function(e){return" "},t.paragraph=function(e){return"

    "+e+"

    \n"},t.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},t.tablerow=function(e){return"\n"+e+"\n"},t.tablecell=function(e,t){var r=t.header?"th":"td";return(t.align?"<"+r+' align="'+t.align+'">':"<"+r+">")+e+"\n"},t.strong=function(e){return""+e+""},t.em=function(e){return""+e+""},t.codespan=function(e){return""+e+""},t.br=function(){return this.options.xhtml?"
    ":"
    "},t.del=function(e){return""+e+""},t.link=function(e,t,r){if(null===(e=te(this.options.sanitize,this.options.baseUrl,e)))return r;var n='"},t.image=function(e,t,r){if(null===(e=te(this.options.sanitize,this.options.baseUrl,e)))return r;var n=''+r+'":">"},t.text=function(e){return e},e}(),ae=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,r){return""+r},t.image=function(e,t,r){return""+r},t.br=function(){return""},e}(),ie=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var r=e,n=0;if(this.seen.hasOwnProperty(r)){n=this.seen[e];do{r=e+"-"+ ++n}while(this.seen.hasOwnProperty(r))}return t||(this.seen[e]=n,this.seen[r]=0),r},t.slug=function(e,t){void 0===t&&(t={});var r=this.serialize(e);return this.getNextSafeSlug(r,t.dryrun)},e}(),oe=ne,ue=ae,se=ie,le=n.exports.defaults,ce=E,de=X,pe=function(){function e(e){this.options=e||le,this.options.renderer=this.options.renderer||new oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ue,this.slugger=new se}e.parse=function(t,r){return new e(r).parse(t)},e.parseInline=function(t,r){return new e(r).parseInline(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var r,n,a,i,o,u,s,l,c,d,p,h,f,g,_,m,D,b,v,y="",w=e.length;for(r=0;r0&&"text"===_.tokens[0].type?(_.tokens[0].text=b+" "+_.tokens[0].text,_.tokens[0].tokens&&_.tokens[0].tokens.length>0&&"text"===_.tokens[0].tokens[0].type&&(_.tokens[0].tokens[0].text=b+" "+_.tokens[0].tokens[0].text)):_.tokens.unshift({type:"text",text:b}):g+=b),g+=this.parse(_.tokens,f),c+=this.renderer.listitem(g,D,m);y+=this.renderer.list(c,p,h);continue;case"html":y+=this.renderer.html(d.text);continue;case"paragraph":y+=this.renderer.paragraph(this.parseInline(d.tokens));continue;case"text":for(c=d.tokens?this.parseInline(d.tokens):d.text;r+1An error occurred:

    "+be(s.message+"",!0)+"
    ";throw s}}return Ee.options=Ee.setOptions=function(e){return me(Ee.defaults,e),ye(Ee.defaults),Ee},Ee.getDefaults=ve,Ee.defaults=we,Ee.use=function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;nAn error occurred:

    "+be(n.message+"",!0)+"
    ";throw n}},Ee.Parser=pe,Ee.parser=pe.parse,Ee.Renderer=fe,Ee.TextRenderer=ge,Ee.Lexer=de,Ee.lexer=de.lex,Ee.Tokenizer=he,Ee.Slugger=_e,Ee.parse=Ee,Ee}();const hn=e(pn),fn=new cn,{map:gn}=Array.prototype,_n=["A","UL","OL","LI","STRONG","EM","BR","DEL","CODE","PRE"],mn=new pn.Renderer;mn.link=function(e,t,r){const n=fn.match(r);return n&&n.length>1?r:'
    '+r+""};const Dn=new pn.Renderer;Object.assign(Dn,mn),Dn.list=function(e,t,r){let n=r;return e.replace(bn,()=>t?n+++". ":"- ")},Dn.listitem=function(e){return""+bn+e};const bn="%list-item%",vn=e=>e.replace(/\n+$/,"");function yn(e,t,r){if(function(e,t){let r=e.parentNode;for(;r;){if(r.nodeName===t)return!0;r=r.parentNode}return!1}(e,"A"))return e.textContent;if(null===e.textContent)return null;const n=fn.match(e.textContent);if(!n||0===n.length)return e.textContent;const[a]=Array.from(n).reduce((t,a,i)=>{let[u,s]=t;return u.push(e.textContent.slice(s,a.index),o.createElement(null!=r?r:"a",{href:a.url,target:"_blank",rel:"nofollow noopener"},a.text)),i===n.length-1&&u.push(e.textContent.slice(a.lastIndex)),[u,a.lastIndex]},[[],0]);return o.createElement(o.Fragment,{key:t},...a)}function wn(e){const t=hn(e,{renderer:Dn}),r=new DOMParser,{body:n}=r.parseFromString(t,"text/html");return n?vn(n.textContent||""):""}const En=e=>{var t,r;let{template:n,root:a,preserveLists:i,limit:u,linkComponent:s=null}=e;const l=null!=(t=null==a?void 0:a.props)?t:{},c=null!=(r=null==a?void 0:a.component)?r:o.Fragment,d=o.useMemo(()=>{try{const e=new DOMParser,t=vn(hn(n,i?{renderer:Dn}:{renderer:mn})),{body:r}=e.parseFromString(t,"text/html");return r?function(e,t,r){let n=0,a=!1;const i=e=>gn.call(e,(e,u)=>{if("#text"===e.nodeName)return r?a?null:e.textContent&&e.textContent.length+n{let{id:t,serverId:r=null,active:n=!0,participants:a=[],properties:i}=e;if("string"!=typeof t)throw new Error("Chat ID has to be a string.");if(null!==r&&t!==r)throw new Error('If serverId is given ("'+r+'") it should match id ("'+t+'").');return{id:t,serverId:r,active:n,participants:a,properties:i}},Fn=e=>{let{id:t,type:r,author:n,timestamp:a,own:i,serverId:o=null,thread:u=null,serverTimestamp:s=null,delivered:l=!0,seen:c=!1,failed:d=!1,properties:p={}}=e;if("string"!=typeof t)throw new Error("Event ID has to be a string.");if("string"!=typeof r)throw new Error("Event has to have string `type` property.");if(null!==o&&t!==o)throw new Error('If serverId is given ("'+o+'") it should match id ("'+t+'").');return{id:t,serverId:o,type:r,thread:u,author:n,own:i,timestamp:a,serverTimestamp:s,delivered:l,seen:c,failed:d,properties:p}},kn=e=>{let{id:t,serverId:r=t,type:n=null,name:a=null,email:i=null,avatar:o=null,properties:u={}}=e;if("string"!=typeof t)throw new Error("User ID has to be a string.");return{id:t,serverId:r,type:n,name:a,email:i,avatar:o,properties:u}};function xn(e,t){return e===t}function Sn(e,t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,a=0;a1&&void 0!==arguments[1]?arguments[1]:xn,r=null,n=null;return function(){return Sn(t,r,arguments)||(n=e.apply(null,arguments)),r=arguments,n}}function Tn(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var r=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return t}var Bn=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:{},a=void 0,i=void 0;"function"==typeof r?(console.warn('[re-reselect] Deprecation warning: "selectorCreator" argument is discouraged and will be removed in the upcoming major release. Please use "options.selectorCreator" instead.'),a=new n,i=r):(a=r.cacheObject||new n,i=r.selectorCreator||Bn);var o=function(){var r=e.apply(void 0,arguments);if("string"==typeof r||"number"==typeof r){var n=a.get(r);return void 0===n&&(n=i.apply(void 0,t),a.set(r,n)),n.apply(void 0,arguments)}};return o.getMatchingSelector=function(){var t=e.apply(void 0,arguments);return a.get(t)},o.removeMatchingSelector=function(){var t=e.apply(void 0,arguments);a.remove(t)},o.clearCache=function(){a.clear()},o.resultFunc=t[t.length-1],o}}const On=(e,t)=>t,Rn=(e,t)=>de(t.replace(/\//gi,"."),e.views),Mn=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.views.current,jn=e=>e.session.connectionState,qn=e=>e.entities.chats.byIds,Nn=(e,t)=>qn(e)[t],Un=(e,t,r)=>Nn(e,t).events.byIds[r],Ln=(e,t,r)=>Un(e,t,Nn(e,t).events.serverIdsMapping[r]),Zn=(e,t,r)=>!!Un(e,t,r),Vn=(e,t)=>Nn(e,t).events.byIds,Hn=Pn([(e,t)=>Nn(e,t).events.orderedIds,Vn],(e,t)=>e.map(e=>t[e]))(On),Wn=Pn([Nn,Hn],(e,t)=>({...e,events:t}))(On),Yn=(e,t)=>!!Nn(e,t),Gn=e=>re(t=>{let{id:r}=t;return Wn(e,r)},qn(e)),Jn=e=>e.entities.users.byIds,Kn=e=>Jn(e)[(e=>e.session.id)(e)],Qn=(e,t)=>Jn(e)[t],Xn=(e,t)=>!!Qn(e,t),ea=(e,t)=>{var r;return null==(r=e.views)?void 0:r.Chat[t].timeline},ta=e=>Kn(e).id,ra=Pn([Hn,ta],(e,t)=>oe(e=>{let{delivered:r,author:n}=e;return r&&n===t},e))(On),na=Pn([Hn,ta],(e,t)=>oe(e=>{let{seen:r,author:n}=e;return r&&n===t},e))(On),aa={boosters:!0,form:!0,system_message:!0},ia=Bn([Hn,e=>Kn(e).id],(e,t)=>se(e=>{const r=e.author===t&&"message"===e.type,n=!!e.properties&&"file"===e.properties.serverType,a=!0===e.seen&&!aa[e.type]&&Boolean(e.serverId);return r&&!n||a},e)),oa=(e,t)=>e.author!==t&&!e.seen&&!aa[e.type],ua=(e,t)=>{const r=ia(e,t),n=Kn(e).id;return Hn(e,t).slice(r+1).filter(e=>oa(e,n))},sa=(e,t)=>ge(ua(e,t)),la=Pn([(e,t)=>Nn(e,t).participants,Jn],(e,t)=>e.map(e=>t[e]))(On);function ca(e,t){if(void 0===t)return e.application;const r=t;return e.application[r]}const da=Object.freeze(Object.defineProperty({__proto__:null,getApplicationState:ca,getChat:Wn,getChatByServerId:(e,t)=>Wn(e,e.entities.chats.serverIdsMapping[t]),getChatList:e=>{var t;return null==(t=e.views)?void 0:t.ChatList},getChats:Gn,getConnectionState:jn,getCurrentView:$n,getDefaultView:Mn,getEvent:Un,getEventByServerId:Ln,getEvents:Hn,getIndexedEvents:Vn,getLastDeliveredEvent:ra,getLastEvent:(e,t)=>ge(Hn(e,t)),getLastSeenAgentEvent:(e,t)=>{const r=ia(e,t);if(-1===r)return null;const n=Kn(e).id;return ie(e=>oa(e,n),Hn(e,t).slice(r+1))},getLastSeenEvent:na,getLastUnseenEvent:sa,getParticipants:la,getSessionUser:Kn,getSessionUserId:ta,getTimeline:ea,getUnseenCount:(e,t)=>ua(e,t).length,getUser:Qn,getUserByServerId:(e,t)=>Qn(e,e.entities.users.serverIdsMapping[t]),getUsers:Jn,getView:Rn,hasChat:Yn,hasEvent:Zn,hasEventByServerId:(e,t,r)=>!!Ln(e,t,r),hasUser:Xn,localize:(e,t,r,n)=>{let a=e.localization[t];const i=e.application.language;if(void 0===a)return"";if("object"==typeof a&&i){const e=new Intl.PluralRules(i);if(void 0===n)return a[e.select(1)];a=a[e.select(n)]}return r?Object.keys(r).reduce((e,t)=>e.replace(new RegExp("%"+t+"%","g"),r[t]),a):a}},Symbol.toStringTag,{value:"Module"})),pa=["delivered","failed","properties","seen","serverTimestamp","thread"],ha=(e,t)=>e.forEach(e=>{if(n(e,t))throw new Error("Updating `"+e+"` property is not possible.")}),fa=yt("ADD_VIEW",(function(e,t,r){let{action:n,getState:a}=e;if(void 0===r&&(r={}),Rn(a(),t))throw new Error('There is already the "'+t+'" view. It has to be unique.');return n({name:t,data:r}),Rn(a(),t)})),ga=yt("SET_CURRENT_VIEW",(e,t)=>{let{action:r,getState:n}=e;if(!Rn(n(),t)){const e=Mn(n());if(!e)throw new Error('Given view "'+t+"\" doesn't exist.");return r({name:e}),$n(n())}return r({name:t}),$n(n())}),_a=yt("UPDATE_VIEW",(e,t,r)=>{let{action:n,getState:a}=e;if(!Rn(a(),t))throw new Error('There is no "'+t+'" view. You should add it first.');return n({name:t,data:r}),Rn(a(),t)}),ma=yt("SET_DEFAULT_VIEW",(e,t,r)=>{let{action:n,getState:a}=e;return n({name:r,path:t}),Rn(a(),t+"/"+r)}),Da=yt("ADD_CHAT",(e,t)=>{let{action:r,getState:n}=e;const{events:a=[],...i}=t;if(i.id&&Yn(n(),i.id))throw new Error('There is already a chat with "'+i.id+'" ID. It has to be unique.');const o=ie(e=>!Xn(n(),e),a.map(e=>e.author).concat(i.participants||[]));if(o)throw new Error('Given user ("'+o+"\") doesn't exist. You should add it first.");const u=i.id||ce(Gn(n()));return r({id:u,chat:An({...i,id:u}),events:a.map(Fn)}),Wn(n(),u)}),ba=yt("ADD_EVENT",(e,t,r)=>{let{action:n,getState:a}=e;const{id:i,serverId:o}=r,u=a();if(i&&o&&i!==o)throw new Error('Specified ID ("'+i+'") differs from specified serverId ("'+o+'"). You either should use only ID or both should be the same.');if(!Yn(u,t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(Zn(u,t,i))throw new Error('There is already an event with "'+i+'" ID in this chat ("'+t+'"). It has to be unique.');if(!Xn(u,r.author))throw new Error('Specified author ("'+r.author+"\") doesn't exist. You should add it first.");return n({id:i,chat:t,event:Fn({timestamp:Date.now(),...r,own:r.author===ta(u)})}),Un(a(),t,i)}),va=yt("REMOVE_EVENT",(e,t,r)=>{let{action:n,getState:a}=e;const i=a();if(!Yn(i,t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!Zn(i,t,r))throw new Error('There is no event with "'+r+'" ID in this chat ("'+t+'").');n({id:r,chat:t})}),ya=yt("ADD_HISTORY_EVENTS",(e,t,r)=>{let{action:n,getState:a}=e;const i=a();if(!Yn(i,t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');r.forEach(e=>{if(Zn(i,t,e.id))throw new Error('There is already an event with "'+e.id+'" ID in this chat ("'+t+'"). It has to be unique.');if(!Xn(i,e.author))throw new Error('Specified author ("'+e.author+"\") doesn't exist. You should add it first.")});const o=ta(i);n({chat:t,events:r.map(e=>Fn({...e,serverId:e.id,own:e.author===o}))})}),wa=yt("ADD_PARTICIPANT",(e,t,r)=>{let{action:n,getState:a}=e;if(!Yn(a(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!Xn(a(),r))throw new Error('Given user ("'+r+"\") doesn't exist. You should add it first.");return n({chat:t,user:r}),la(a(),t)}),Ea=yt("ADD_USER",(e,t)=>{let{action:r,getState:n}=e;const{id:a}=t;if(Xn(n(),a))throw new Error('There is already a user with "'+a+'" ID. It has to be unique.');return r({id:a,user:kn(t)}),Qn(n(),a)}),Ca=yt("FLUSH_CHAT",(e,t)=>{let{action:r,getState:n}=e;if(!Yn(n(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');return r({id:t}),Wn(n(),t)}),Aa=yt("RECALCULATE_TIMELINE",(e,t)=>{let{action:r,getState:n}=e;if(!Yn(n(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');return r({id:t}),ea(n(),t)}),Fa=yt("REMOVE_PARTICIPANT",(e,t,r)=>{let{action:n,getState:a}=e;if(!Yn(a(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!Xn(a(),r))throw new Error('Given user ("'+r+"\") doesn't exist. You should add it first.");return n({chat:t,user:r}),la(a(),t)}),ka=yt("SEND_EVENT",(e,t,r,n)=>{let{action:a,getState:i}=e;if(!Yn(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(Zn(i(),t,r.id))throw new Error('There is already an event with "'+r.id+'" ID in this chat ("'+t+'"). It has to be unique.');const o=r.id||ce(Vn(i(),t));return a({id:o,chat:t,event:Fn({...r,author:Kn(i()).id,own:!0,id:o,timestamp:Date.now(),delivered:!1})},n),Un(i(),t,o)}),xa=yt("SET_APPLICATION_STATE",(e,t)=>{let{action:r,getApplicationState:n}=e;if(!t||he(t))throw new Error("Given data object is empty.");return r(t),n()}),Sa=yt("UPDATE_FEATURE",(e,t,r)=>{let{action:n,getApplicationState:a}=e;if(!r||!t||he(r))throw new Error("Given data object is empty.");return n({feature:t,data:r}),a()}),Ia=yt("SET_CONNECTION_STATE",(e,t)=>{let{action:r,getState:n}=e;return r({connectionState:t}),jn(n())}),Ta=yt("SET_CHAT_SERVER_ID",(e,t,r)=>{let{action:n,getState:a}=e;if(!Yn(a(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(null!==Wn(a(),t).serverId)throw new Error('Chat with "'+t+'" ID has already serverId.');return n({id:t,serverId:r}),Wn(a(),t)}),Ba=yt("SET_EVENT_DATA",(e,t,r,n)=>{let{action:a,getState:i}=e;if(!Yn(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!Zn(i(),t,r))throw new Error('There is no "'+r+'" event in "'+t+'" chat. You should add it first.');return ha(["id","type","own"],n),a({chat:t,id:r,data:{...Ce(pa.concat("author","serverId","timestamp"),n),own:n.author===ta(i())}}),Un(i(),t,r)}),za=yt("SET_EVENT_SERVER_ID",(e,t,r,n)=>{let{action:a,getState:i}=e;if(!Yn(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!Zn(i(),t,r))throw new Error('There is no "'+r+'" event in "'+t+'" chat. You should add it first.');if(null!==Un(i(),t,r).serverId)throw new Error('Event with "'+r+'" ID has already serverId.');return a({chat:t,id:r,serverId:n}),Un(i(),t,r)}),Pa=yt("SET_LOCALIZATION",(e,t)=>{let{action:r}=e;r(t)}),Oa=yt("SET_USER_SERVER_ID",(e,t,r)=>{let{action:n,getState:a}=e;if(!Xn(a(),t))throw new Error('There is no "'+t+'" user. You should add it first.');if(null!==Qn(a(),t).serverId)throw new Error('User with "'+t+'" ID has already serverId.');return n({id:t,serverId:r}),Qn(a(),t)}),{actionMethod:Ra,requestActionMethod:Ma}=wt("SET_USER_PROPERTIES",(e,t,r)=>{let{action:n,getState:a}=e;if(!Xn(a(),t))throw new Error('There is no user with "'+t+'" ID. You should add it first.');return n({id:t,properties:r}),Qn(a(),t)}),{actionMethod:$a,requestActionMethod:ja}=wt("UPDATE_CHAT",(e,t,r,n)=>{let{action:a,getState:i}=e;if(!Yn(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');return ha(["id","participants","events"],r),a({id:t,data:Ce(["active","properties"],r)},n),Wn(i(),t)}),{actionMethod:qa,requestActionMethod:Na}=wt("UPDATE_EVENT",(e,t,r,n)=>{let{action:a,getState:i}=e;if(!Yn(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!Zn(i(),t,r))throw new Error('There is no "'+r+'" event in "'+t+'" chat. You should add it first.');return ha(["id","type","author","own","timestamp"],n),a({chat:t,id:r,data:Ce(pa,n)}),Un(i(),t,r)}),{actionMethod:Ua,requestActionMethod:La}=wt("UPDATE_USER",(e,t,r)=>{let{action:n,getState:a}=e;if(!Xn(a(),t))throw new Error('There is no user with "'+t+'" ID. You should add it first.');return ha(["id","type"],r),n({id:t,data:Ce(["name","email","avatar","properties"],r)}),Qn(a(),t)}),Za=Object.freeze(Object.defineProperty({__proto__:null,addChat:Da,addEvent:ba,addHistoryEvents:ya,addParticipant:wa,addUser:Ea,addView:fa,flushChat:Ca,recalculateTimeline:Aa,removeEvent:va,removeParticipant:Fa,requestSetUserProperties:Ma,requestUpdateChat:ja,requestUpdateEvent:Na,requestUpdateUser:La,sendEvent:ka,setApplicationState:xa,setChatServerId:Ta,setConnectionState:Ia,setCurrentView:ga,setDefaultView:ma,setEventData:Ba,setEventServerId:za,setLocalization:Pa,setUserProperties:Ra,setUserServerId:Oa,updateChat:$a,updateEvent:qa,updateFeature:Sa,updateUser:Ua,updateView:_a},Symbol.toStringTag,{value:"Module"}));function Va(){}function Ha(){}Ha.resetWarningCache=Va;!function(){function e(e,t,r,n,a,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Ha,resetWarningCache:Va};r.PropTypes=r}();var Wa=u.createContext(null);var Ya=function(e){e()},Ga={notify:function(){}};function Ja(){var e=Ya,t=null,r=null;return{clear:function(){t=null,r=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],r=t;r;)e.push(r),r=r.next;return e},subscribe:function(e){var n=!0,a=r={callback:e,next:null,prev:r};return a.prev?a.prev.next=a:t=a,function(){n&&null!==t&&(n=!1,a.next?a.next.prev=a.prev:r=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}var Ka=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=Ga,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=Ja())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=Ga)},e}(),Qa="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o.useLayoutEffect:o.useEffect;function Xa(){return(Xa=Object.assign||function(e){for(var t=1;t=0||(a[r]=e[r]);return a}var ti={exports:{}},ri={}; /** @license React v16.7.0 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ Object.defineProperty(ri,"__esModule",{value:!0});var ni="function"==typeof Symbol&&Symbol.for,ai=ni?Symbol.for("react.element"):60103,ii=ni?Symbol.for("react.portal"):60106,oi=ni?Symbol.for("react.fragment"):60107,ui=ni?Symbol.for("react.strict_mode"):60108,si=ni?Symbol.for("react.profiler"):60114,li=ni?Symbol.for("react.provider"):60109,ci=ni?Symbol.for("react.context"):60110,di=ni?Symbol.for("react.async_mode"):60111,pi=ni?Symbol.for("react.concurrent_mode"):60111,hi=ni?Symbol.for("react.forward_ref"):60112,fi=ni?Symbol.for("react.suspense"):60113,gi=ni?Symbol.for("react.memo"):60115,_i=ni?Symbol.for("react.lazy"):60116;function mi(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case ai:switch(e=e.type){case di:case pi:case oi:case si:case ui:case fi:return e;default:switch(e=e&&e.$$typeof){case ci:case hi:case li:return e;default:return t}}case _i:case gi:case ii:return t}}}function Di(e){return mi(e)===pi}ri.typeOf=mi,ri.AsyncMode=di,ri.ConcurrentMode=pi,ri.ContextConsumer=ci,ri.ContextProvider=li,ri.Element=ai,ri.ForwardRef=hi,ri.Fragment=oi,ri.Lazy=_i,ri.Memo=gi,ri.Portal=ii,ri.Profiler=si,ri.StrictMode=ui,ri.Suspense=fi,ri.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===oi||e===pi||e===si||e===ui||e===fi||"object"==typeof e&&null!==e&&(e.$$typeof===_i||e.$$typeof===gi||e.$$typeof===li||e.$$typeof===ci||e.$$typeof===hi)},ri.isAsyncMode=function(e){return Di(e)||mi(e)===di},ri.isConcurrentMode=Di,ri.isContextConsumer=function(e){return mi(e)===ci},ri.isContextProvider=function(e){return mi(e)===li},ri.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===ai},ri.isForwardRef=function(e){return mi(e)===hi},ri.isFragment=function(e){return mi(e)===oi},ri.isLazy=function(e){return mi(e)===_i},ri.isMemo=function(e){return mi(e)===gi},ri.isPortal=function(e){return mi(e)===ii},ri.isProfiler=function(e){return mi(e)===si},ri.isStrictMode=function(e){return mi(e)===ui},ri.isSuspense=function(e){return mi(e)===fi},ti.exports=ri;var bi=ti.exports,vi={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},yi={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},wi={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Ei={};function Ci(e){return bi.isMemo(e)?wi:Ei[e.$$typeof]||vi}Ei[bi.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Ei[bi.Memo]=wi;var Ai=Object.defineProperty,Fi=Object.getOwnPropertyNames,ki=Object.getOwnPropertySymbols,xi=Object.getOwnPropertyDescriptor,Si=Object.getPrototypeOf,Ii=Object.prototype;const Ti=e((function e(t,r,n){if("string"!=typeof r){if(Ii){var a=Si(r);a&&a!==Ii&&e(t,a,n)}var i=Fi(r);ki&&(i=i.concat(ki(r)));for(var o=Ci(t),u=Ci(r),s=0;s=0;n--){var a=t[n](e);if(a)return a}return function(t,n){throw new Error("Invalid value of type "+typeof e+" for "+r+" argument when connecting component "+n.wrappedComponentName+".")}}function Co(e,t){return e===t}function Ao(e){var t={},r=t.connectHOC,n=void 0===r?lo:r,a=t.mapStateToPropsFactories,i=void 0===a?mo:a,o=t.mapDispatchToPropsFactories,u=void 0===o?_o:o,s=t.mergePropsFactories,l=void 0===s?bo:s,c=t.selectorFactory,d=void 0===c?wo:c;return function(e,t,r,a){void 0===a&&(a={});var o=a,s=o.pure,c=void 0===s||s,p=o.areStatesEqual,h=void 0===p?Co:p,f=o.areOwnPropsEqual,g=void 0===f?po:f,_=o.areStatePropsEqual,m=void 0===_?po:_,D=o.areMergedPropsEqual,b=void 0===D?po:D,v=ei(o,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),y=Eo(e,i,"mapStateToProps"),w=Eo(t,u,"mapDispatchToProps"),E=Eo(r,l,"mergeProps");return n(d,Xa({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:y,initMapDispatchToProps:w,initMergeProps:E,pure:c,areStatesEqual:h,areOwnPropsEqual:g,areStatePropsEqual:m,areMergedPropsEqual:b},v))}}const Fo=Ao();var ko;ko=s.unstable_batchedUpdates,Ya=ko;const xo={},So=()=>xo;function Io(e,t){return void 0===t&&(t={}),Fo(e,So,void 0,{areStatesEqual:e=>e.getState()===e.getPreviousState(),...t})}const To=o.createContext(void 0),Bo=Io(e=>({localize:e.localize,localization:e.getState().localization}))(e=>{let{localize:t,children:r}=e;return o.createElement(To.Provider,{value:(e,r)=>t(e,r)},r)}),zo=e=>{if("string"==typeof e.children){const{children:t,...r}=e;return o.createElement(To.Consumer,null,e=>e(t,r))}return o.createElement(To.Consumer,e)},Po="connected",Oo="disconnected",Ro="fakely_connected",Mo="reconnecting",$o="scheduled_reconnecting",jo="liveChatChatId",qo="openAIChatId",No="email_prompt",Uo="message_draft",Lo=100,Zo=20,Vo=255,Ho="Invalid `chat.id`",Wo="Move chat to mobile",Yo={labs:"https://mobile-chat.labs.livechat.com/chat-widget-moment/",staging:"https://mobile-chat.staging.livechat.com/chat-widget-moment/",production:"https://mobile-chat.livechat.com/chat-widget-moment/"},Go=1500,Jo="feaf6c0e-9f43-48ff-9ad0-8e24e0350932",Ko=100,Qo=/^\s+$/,Xo=/^(?:\s+|[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?)*/;function eu(e){let t=null,r=0;for(;t=Xo.exec(e);){const n=t[0];if(e=e.slice(n.length),Qo.test(n)||r++,r>3)return!1}return!e}const tu=["xS94WbAZR","pJw7AxJZg"],ru=["DfltarqcrRoA5ZoZ","UsDoxZQESkzF0qds"];function nu(e){return tu.includes(e)}function au(e){return ru.includes(e)}const iu=3,ou=10,uu="not_ready",su="ready",lu="bootstrapped",cu=["failed","cancelled","expired"],du="openai_bot",pu="https://cdn.files-text.com/api/ow/img/integrations/openai/orb.gif";function hu(){return(hu=Object.assign||function(e){for(var t=1;t=0&&a<1?(u=i,s=o):a>=1&&a<2?(u=o,s=i):a>=2&&a<3?(s=i,l=o):a>=3&&a<4?(s=o,l=i):a>=4&&a<5?(u=o,l=i):a>=5&&a<6&&(u=i,l=o);var c=r-i/2;return n(u+c,s+c,l+c)}var Au={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var Fu=/^#[a-fA-F0-9]{6}$/,ku=/^#[a-fA-F0-9]{8}$/,xu=/^#[a-fA-F0-9]{3}$/,Su=/^#[a-fA-F0-9]{4}$/,Iu=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,Tu=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i,Bu=/^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,zu=/^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;function Pu(e){if("string"!=typeof e)throw new yu(3);var t=function(e){if("string"!=typeof e)return e;var t=e.toLowerCase();return Au[t]?"#"+Au[t]:e}(e);if(t.match(Fu))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(ku)){var r=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:r}}if(t.match(xu))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(Su)){var n=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:n}}var a=Iu.exec(t);if(a)return{red:parseInt(""+a[1],10),green:parseInt(""+a[2],10),blue:parseInt(""+a[3],10)};var i=Tu.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10),alpha:parseFloat(""+i[4])};var o=Bu.exec(t);if(o){var u="rgb("+Cu(parseInt(""+o[1],10),parseInt(""+o[2],10)/100,parseInt(""+o[3],10)/100)+")",s=Iu.exec(u);if(!s)throw new yu(4,t,u);return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10)}}var l=zu.exec(t);if(l){var c="rgb("+Cu(parseInt(""+l[1],10),parseInt(""+l[2],10)/100,parseInt(""+l[3],10)/100)+")",d=Iu.exec(c);if(!d)throw new yu(4,t,c);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+l[4])}}throw new yu(5)}function Ou(e){return function(e){var t,r=e.red/255,n=e.green/255,a=e.blue/255,i=Math.max(r,n,a),o=Math.min(r,n,a),u=(i+o)/2;if(i===o)return void 0!==e.alpha?{hue:0,saturation:0,lightness:u,alpha:e.alpha}:{hue:0,saturation:0,lightness:u};var s=i-o,l=u>.5?s/(2-i-o):s/(i+o);switch(i){case r:t=(n-a)/s+(n=1?Nu(e,t,r):"rgba("+e+","+t+","+r+","+n+")";if("object"==typeof e&&void 0===t&&void 0===r&&void 0===n)return e.alpha>=1?Nu(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new yu(7)}function Lu(e){if("object"!=typeof e)throw new yu(8);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&"number"==typeof e.alpha}(e))return Uu(e);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return Nu(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&"number"==typeof e.alpha}(e))return function(e,t,r,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n)return n>=1?qu(e,t,r):"rgba("+Cu(e,t,r)+","+n+")";if("object"==typeof e&&void 0===t&&void 0===r&&void 0===n)return e.alpha>=1?qu(e.hue,e.saturation,e.lightness):"rgba("+Cu(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new yu(2)}(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return function(e,t,r){if("number"==typeof e&&"number"==typeof t&&"number"==typeof r)return qu(e,t,r);if("object"==typeof e&&void 0===t&&void 0===r)return qu(e.hue,e.saturation,e.lightness);throw new yu(1)}(e);throw new yu(8)}function Zu(e){return function e(t,r,n){return function(){var a=n.concat(Array.prototype.slice.call(arguments));return a.length>=r?t.apply(this,a):e(t,r,a)}}(e,e.length,[])}function Vu(e,t){if("transparent"===t)return t;var r=Ou(t);return Lu(hu({},r,{hue:r.hue+parseFloat(e)}))}var Hu=Zu(Vu);function Wu(e,t,r){return Math.max(e,Math.min(t,r))}function Yu(e,t){if("transparent"===t)return t;var r=Ou(t);return Lu(hu({},r,{lightness:Wu(0,1,r.lightness-parseFloat(e))}))}var Gu=Zu(Yu);function Ju(e,t){if("transparent"===t)return t;var r=Ou(t);return Lu(hu({},r,{saturation:Wu(0,1,r.saturation-parseFloat(e))}))}var Ku=Zu(Ju);function Qu(e){if("transparent"===e)return 0;var t=Pu(e),r=Object.keys(t).map((function(e){var r=t[e]/255;return r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)})),n=r[0],a=r[1],i=r[2];return parseFloat((.2126*n+.7152*a+.0722*i).toFixed(3))}function Xu(e,t){var r=Qu(e),n=Qu(t);return parseFloat((r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)).toFixed(2))}function es(e,t){if("transparent"===t)return t;var r=Ou(t);return Lu(hu({},r,{lightness:Wu(0,1,r.lightness+parseFloat(e))}))}var ts=Zu(es);function rs(e,t,r){if("transparent"===t)return r;if("transparent"===r)return t;var n=Pu(t),a=hu({},n,{alpha:"number"==typeof n.alpha?n.alpha:1}),i=Pu(r),o=hu({},i,{alpha:"number"==typeof i.alpha?i.alpha:1}),u=a.alpha-o.alpha,s=2*parseFloat(e)-1,l=((s*u==-1?s:s+u)/(1+s*u)+1)/2,c=1-l;return Uu({red:Math.floor(a.red*l+o.red*c),green:Math.floor(a.green*l+o.green*c),blue:Math.floor(a.blue*l+o.blue*c),alpha:a.alpha+(o.alpha-a.alpha)*(parseFloat(e)/1)})}var ns=Zu(rs);function as(e,t){return"transparent"===t?t:ns(parseFloat(e),"rgb(0, 0, 0)",t)}var is=Zu(as);function os(e,t){return"transparent"===t?t:ns(parseFloat(e),"rgb(255, 255, 255)",t)}var us=Zu(os);function ss(e,t){if("transparent"===t)return t;var r=Pu(t);return Uu(hu({},r,{alpha:Wu(0,1,(100*("number"==typeof r.alpha?r.alpha:1)-100*parseFloat(e))/100)}))}var ls=Zu(ss);function cs(e){return void 0===e&&(e=-1),function(t){return function(r,n){if(0===r){var a,i=!1,o=e,u=function(e,t){a(e,t)};!function e(){t(0,(function(t,r){return 0===t?(a=r,i?void u(1):(i=!0,void n(0,u))):2===t&&r&&0!==o?(o--,void e()):void n(t,r)}))}()}}}}function ds(){const e=G();return[e,()=>{const t=new Error("Destroyed.");t.code="DESTROYED",e(2,t)}]}const ps=le();let hs=0;const fs=e=>{const t=document.createElement("a");if(t.href=e,t.origin)return"null"===t.origin?"*":t.origin;const r=t.protocol.length>4?t.protocol:window.location.protocol;let n;return n=t.host.length?"80"===t.port||"443"===t.port?t.hostname:t.host:window.location.host,r+"//"+n};function gs(e,t){let{frame:r,targetOrigin:n=fs(r.src),handshakeRetry:a={}}=e;void 0===t&&(t={});const[i,o]=l(t),[u,s]=ds(),x=hs++,S=r.contentWindow,I=c(),T=(e,t)=>A(ps,x,e,t),B=e=>{S.postMessage(e,n)},z=d(h(),p(e=>e.owner===ps&&e.instance===x),K(u),f),P=g(I,z,T,B),O=d(D(z,B,T(k,o),null),m(a.interval||500),cs(a.count||5),_(1),b(e=>v in e?d(D(z,B,T(F)),w(()=>e.data)):y(()=>e)),K(u),f),R=E(P,I.emit,B,i);return d(O,b(()=>z),C(R)),{api:P,destroy:s,handshake$:O}}function _s(){return new Promise(e=>{const t=()=>{document.body?e(document.body):setTimeout(t,100)};t()})}function ms(e){const{parentNode:t}=e;t&&t.removeChild(e)}const Ds=(e,t)=>{const r=document.createElement("iframe");return e.appendChild(r),r.src=t,r};function bs(e,t){let{onConnected:r,...n}=e;const a=!n.frame,i=(e=>{if(e.frame)return e.frame;const{container:t,url:r}=e;return Ds(t,r)})(n),[o,u]=ds();let s;const l=()=>{a&&ms(i),s?s.destroy():u()};return d(S(i,"load"),b(()=>U((e,r)=>{let a=function(e,t){const{api:r,destroy:n,handshake$:a}=gs(e,t);return{destroy:n,promise:d(a,w(e=>(r.data=e,r.destroy=n,r)),x)}}({...n,frame:i},t);return a.promise.then(e,r),s=a,a.destroy})),cs(),K(o),C(e=>{e.destroy=l,e.frame=i,r(e)})),{destroy:l,frame:i}}function vs(){return(vs=Object.assign?Object.assign.bind():function(e){for(var t=1;tr)throw new Error(e+" can not be empty and can only be "+r+" characters long.")},As=function(e){if("string"!=typeof(e=Es(e)))throw new Error("`text` must be a string or a number.");e=e.trim(),Cs("`text`",e,1024)},Fs=function(e,t){return new Error('Attribute with key "'+e+'" is invalid. '+t)},ks=a,xs=Object.freeze({sendMessage:function(e){var t=e.text,r=e.postback;if(As(t),void 0!==r){if("string"!=typeof r)throw new Error("`postback` must be a string.");Cs("`postback`",r,1024)}},sendSystemMessage:function(e){var t=e.text,r=e.recipients;if(As(t),void 0!==r&&-1===ws.indexOf(r))throw new Error("`recipients` can only be one of: "+ws+".")},setAttributes:function(e){if(!e||"object"!=typeof e)throw new Error("`attributes` must be a plain object (with shape such as `{ key: 'value' }`).");var t=Object.keys(e);if(t.length>99)throw new Error("The maximum number of attributes is 99.");t.forEach((function(t){var r=Es(e[t]);if(t=Es(t),!/^[\w-]{1,128}$/.test(t))throw Fs(t,"Key must be between 1-128 characters long and can only contain alpha-numeric, underscore and dash characters.");if("string"!=typeof r)throw Fs(t,"Value must be a string or a number.");Cs("Value",r,1024)}))},setExternalLink:function(e){if("string"==typeof e){if(!/^https:\/\//.test(e))throw new Error("`externalLink` has to be a HTTPS URL.")}else if(null!==e)throw new Error("`externalLink` has to be a string or null.")},setIsFragile:function(e){if("boolean"!=typeof e)throw new Error("`setIsFragile` argument value can not be empty and must be a boolean.")},getIdentityTransferToken:function(){},updateCustomerData:function(e){if(!e)throw new Error("`updateUserData` arguments values can not be empty.");if(e.email&&"string"!=typeof e.email)throw new Error("`updateUserData` argument `email` has to be a string.");if(e.name&&"string"!=typeof e.name)throw new Error("`updateUserData` argument `name` has to be a string.")},close:ks,setTitle:function(e){if("string"!=typeof e)throw new Error("`setTitle` argument value has to be a string.");Cs("`title`",e,1024)}}),Ss=function(e){var t=z(e);if(!/chatbot\.com$/.test(t))return e;var r=M($(P(e)));if(!r.p)return e;try{var n=JSON.parse(atob(r.p));return n.url?decodeURIComponent(n.url):e}catch(a){return e}};function Is(e,t){var r,n=Ss(e.url),a=I((function(e){return"function"==typeof e}),t),i=a[0],o=a[1],u=me((function(e,t){return function(){return xs[t].apply(xs,arguments),e.apply(void 0,arguments)}}),i),s=bs(vs({},e,{targetOrigin:"*"}),vs({},o,u,{supportedMethods:Object.keys(u)})),l=s.destroy,c=s.frame;return c.sandbox=ys,{destroy:l,frame:c,title:(r=n,Pe("moment-title",r)||ze(r))}}const Ts=()=>{const e=B(window.location.search);return parseInt((()=>{const e=String(window.location).match(/licen(?:s|c)e\/g?(\d+)/);return e?e[1]:null})()||e.license_id,10)},Bs=e=>{const t=parseInt(e,10);return t>-1?t:null},zs=e=>"group"in e?Bs(e.group):"groups"in e?Bs(e.groups):null,Ps=()=>"1"===Pe("unique_groups",window.location.search)||"1"===Pe("unique_group",window.location.search),Os=e=>{const{name:t}=e.getSessionUser();return t||e.localize("client")},Rs=e=>{const t=el("liveChatChatId",e);if(!t)throw new Error("Current chat agent is undefined");if(!t.name)throw new Error("Current chat agent name is undefined");return t.name},Ms=function(e,t,r){void 0===r&&(r={});const{name:n=Os(e),agent:a=Rs(e)}=r;return t.replace(/%name%/g,n).replace(/%agent%/g,a)},$s=e=>Qu(e)>.7,js=e=>Qu(e)<=.179,qs=e=>{var t;return Boolean(null==(t=e.properties.license.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.messaging_in_queue_enabled)},Ns=e=>{var t;return Boolean(null==(t=e.properties.group.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.homescreen_enabled)},Us=e=>"https://"+e+"."+("api"===e?"livechatinc":"livechat")+".com",Ls=()=>{const e=document.createElement("video"),t=document.createElement("canvas");return navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia?navigator.mediaDevices.getDisplayMedia({video:{cursor:"always",displaySurface:"browser"},audio:!1}).then(t=>(e.srcObject=t,e.play())).then(()=>new Promise(e=>{setTimeout(e,150)})).then(()=>{t.width=e.videoWidth,t.height=e.videoHeight;t.getContext("2d").drawImage(e,0,0,e.videoWidth,e.videoHeight);const r=((e,t)=>{const[r,n]=e.split(","),a=r.match(/:(.*?);/)[1],i=atob(n);let o=i.length;const u=new Uint8Array(o);for(;o--;)u[o]=i.charCodeAt(o);return new File([u],t,{type:a})})(t.toDataURL("image/png"),"screenshot.png");return e.srcObject.getTracks().forEach(e=>e.stop()),r}):Promise.reject(new Error("Screen sharing is not supported"))},Zs=e=>js(e)?Ku(.1,ts(.1,e)):Ku(.2,Gu(.15,e));function Vs(e,t,r){if(e.startsWith(r))return e;const n=[e,t],a=JSON.stringify(n),i=btoa(a),o=new URL("/v1.0/t/link",r);return o.searchParams.set("d",i),o.toString()}function Hs(e){return"https://cdn.livechat-files.com/api/file/lc/main/default/logo/sz2tt7jpJ6VJwBo.png"===Le(e)}const Ws=(e,t)=>{const{organizationId:r,page:n}=e.getApplicationState();return"@@"+t+":"+r+":"+new URL(n.url).hostname},Ys=e=>{const{x:t,y:r,width:n,height:a}=e.target.getBoundingClientRect();return{x:t,y:r,width:n,height:a}},Gs=(e,t)=>{const{name:r,email:n}=re(e=>"string"==typeof e?Ie(e):e,we(["email","name"],e));return r===t("client")?{email:n}:{email:n,name:r}},Js=e=>!!e&&(e=>{const t=qe(e);return!t||"https:"===t||!1})(Ss(e)),Ks=e=>{var t;return{id:e.id,name:null!=(t=e.title)?t:"",text:e.description,icon:e.icon,action:{label:e.action.label,type:"button",value:e.action.url},properties:{}}},Qs=(e,t)=>{var r,n,a;const i=e.getApplicationState("config").features.logo.path,o=tl("boosters",e),u=null==(r=o.items)?void 0:r.find(e=>au(e.id)),s=null==(n=o.items)?void 0:n.find(e=>nu(e.id)),l=null==(a=o.items)?void 0:a.find(e=>"links"===e.id),c={header:{text:"",logo:i},limits:[],apps:[],features:{livechat_integration:{name:"",enabled:!0,properties:{}}},forms:[]};l&&(c.features.links={enabled:!0,name:"",properties:{links:l.links}}),u&&c.apps.push({...Ks(u),trademarkLink:"https://www.knowledgebase.com/?utm_source=chat_window&utm_medium=referral&utm_campaign=home_screen",trademarkLinkAnchor:"Powered by KnowledgeBase"}),s&&(c.apps.push(Ks(s)),e.on("send_helpdesk_form",r=>{t(r).then(t=>e.emit("send_helpdesk_form_success",t)).catch(t=>e.emit("send_helpdesk_form_error",t))}),e.addView("HelpdeskTicketForm",{isLoading:!0,hasFetchingError:!1})),e.addView("Homescreen",c)},Xs=e=>{const{currentChat:t}=e.getApplicationState();if(!t)throw new Error("Current chat is not set");return t},el=(e,t)=>{const r=t.getChat(e).properties.currentAgent;return r?Tc(t,r):null},tl=(e,t)=>t.getApplicationState("config").features[e],rl=e=>tl("continuousChat",e).enabled,nl=e=>tl("chatHistory",e).enabled,al=e=>!!e.getView("Chat").liveChatChatId.hasDividers,il=e=>Sl(e)&&!rl(e),ol=(e,t,r)=>{let{authorPredicate:n,lastSeenPredicate:a}=t;const i=r.getEvents(e),o=ke(e=>n(e)||!e.seen,se(a,i),i);return Ae(n,o)},ul=(e,t,r)=>{const n=r.getSessionUserId();return ol(e,{authorPredicate:e=>e.author!==n,lastSeenPredicate:e=>(e.serverTimestamp||e.timestamp)<=t},r)},sl=(e,t,r)=>{const n=r.getSessionUserId();return ol(e,{authorPredicate:e=>e.author===n,lastSeenPredicate:e=>e.timestamp<=t},r)},ll=(e,t,r)=>{const n=e.getEvent(t,r);if("message_draft"===n.type&&null===n.serverId){const r=oe(e=>"message_draft"===e.type,e.getEvents(t));return n.id===(null==r?void 0:r.id)?e.localize("not_sent_yet"):null}if(!n.own)return null;if(n.failed)return"Message not sent";if(n.seen){const n=e.getLastSeenEvent(t);return n&&r===n.id?e.localize("message_read"):null}const a=e.getLastDeliveredEvent(t);return a&&r===a.id?e.localize("message_delivered"):null},cl=e=>{const t=e.getApplicationState("config");return!0===e.getApplicationState("mobile")?t.mobileMinimizedType:t.minimizedType},dl=e=>{const{config:t}=e.getApplicationState();return!0===e.getApplicationState("mobile")?t.mobileScreenPosition:t.screenPosition},pl=(e,t)=>nl(e)&&e.getChat(t).properties.hasMoreHistory,hl=(e,t)=>{const{fakeAgentMessageId:r}=e.getChat(t).properties;return r?e.getEvent(t,r):null},fl=(e,t)=>!!hl(e,t),gl=e=>{const{embedded:t,actingAsDirectLink:r,isInCustomContainer:n}=e.getApplicationState();return!!t&&!r&&!n},_l=(e,t)=>{const{active:r,properties:{queued:n}}=t.getChat("liveChatChatId");if(r||n)return!1;const{availability:a,readyState:i}=t.getApplicationState();return"online"===a&&("not_ready"===i||(!gc(t,"maximized")||he(t.getEvents(e))))},ml=(e,t)=>{if(nl(t))return!1;const{availability:r,embedded:n,actingAsDirectLink:a,isInCustomContainer:i,defaultWidget:o}=t.getApplicationState(),u=t.getChat(e);return"livechat"===o&&n&&!a&&!i&&!u.active&&!u.properties.ended&&"offline"===r&&!Sl(t)},Dl=e=>"connected"===e.getConnectionState(),bl=e=>"disconnected"===e.getConnectionState(),vl=e=>"reconnecting"===e.getConnectionState()||bl(e),yl=(e,t)=>{if(t<0)return null;const r=e[t];return r.own&&"message"===r.type?null:"system_message"===r.type||"rich_message_postback"===r.type?yl(e,t-1):r.properties.quickReplies?r:null},wl=(e,t)=>{const r=t.getEvents(e),n=yl(r,r.length-1);return n&&(n.properties.invitation||t.getChat(e).active)?n:null},El=(e,t)=>{const{availability:r}=t.getApplicationState(),{active:n,properties:{queued:a,ended:i}}=t.getChat(e);if(a)return t.localize("embedded_waiting_for_operator");const o=el(e,t);return n&&o?t.localize("embedded_chat_with",{operator:o.name}):i?t.localize("embedded_chat_ended"):"online"===r?t.localize("embedded_chat_now"):Sl(t)||rl(t)?t.localize("embedded_leave_message"):t.localize("agents_not_available")},Cl=(e,t)=>{const r=e.getChat(t),n=rl(e);if(e.getApplicationState().limitReached)return null;if(Nl(e)&&!Ul(e))return null;if(r.active){var a;const r=Gl(e),n=e.getChat(t).properties.currentAgent;return null!=r&&null!=(a=r.properties)&&a.useFixedAnswers&&(null==r?void 0:r.author)===n?null:"text"}return lc(e,t)||Il(e)?null:!r.properties.ended||n&&!xl(e)?n||"offline"!==e.getApplicationState().availability?fl(e,"liveChatChatId")?xl(e)&&tl("preChatAfterGreeting",e).enabled?n&&"offline"===e.getApplicationState().availability?null:"requestPrechat":null!=(i=el(t,e))&&i.properties.isBot||Tl(e)?"startChat":"text":n?xl(e)?"offline"===e.getApplicationState().availability?null:"requestPrechat":"text":n&&r.properties.ended?"text":null:null:"startChatAgain";var i},Al=(e,t)=>!!t.getChat(e).properties.starting,Fl=e=>e.getApplicationState("config").theme.name,kl=(e,t)=>oe(e=>!e.own&&pe(e.type,["message","rich_message","url_preview","emoji"]),e.getEvents(t)),xl=e=>e.getApplicationState().config.features.preChatForm.enabled,Sl=e=>e.getApplicationState().config.features.ticketForm.enabled,Il=function(e,t){void 0===t&&(t=void 0);const r=e.getLastEvent("liveChatChatId");if(!r)return!1;const{type:n,properties:a}=r;return"form"===n&&!a.answered&&"ask_for_email"!==a.formId&&("string"!=typeof t||a.formType===t)},Tl=e=>{const{properties:{groupHasProbableQueue:t}}=e.getChat("liveChatChatId");return!!t},Bl=e=>{const{active:t,properties:{queued:r,ended:n,startChatAgainPending:a,currentAgent:i}}=e.getChat("liveChatChatId"),{availability:o,limitReached:u}=e.getApplicationState(),s=rl(e),l=Sl(e);return!(!u||l&&!s)||"offline"===o&&(!(n&&!a)&&(s?!i&&!r:!t&&!r&&!l))},zl=e=>{const t=Xs(e);return Boolean(el(t,e))&&!("modern"===Fl(e)&&Il(e))&&!((e,t)=>!!t.getChat(e).properties.queued)(t,e)&&!Bl(e)},Pl=e=>{var t;return Boolean(null==(t=e.getView("Homescreen"))||null==(t=t.apps)?void 0:t.find(e=>nu(e.id)))},Ol=e=>{const t=e.getApplicationState().defaultWidget,r=Xs(e);return"openAIChatId"===r?!e.getChat(r).properties.agentIsTyping&&("Chat"===e.getCurrentView()&&oc(e)):"openwidget"!==t&&(!(!Nl(e)||e.getView("Chat/queue"))||!sc(e)&&oc(e))},Rl=e=>{const t=e.getLastEvent("liveChatChatId");return!!t&&("form"===t.type&&"ticket"===t.properties.formType&&t.properties.answered)},Ml=e=>{const{nonProfitLicense:t}=e.getApplicationState("config");return t},$l=e=>{const{actingAsDirectLink:t,isInCustomContainer:r,mobileWrapper:n,embedded:a}=e.getApplicationState();return!t&&!r&&(n||a)},jl=e=>Boolean(e.getApplicationState("invitation").current),ql=e=>{const{lastThread:t,currentAgent:r,queued:n}=e.getChat("liveChatChatId").properties;if(!rl(e)||r||n)return!1;return!!!oe(e=>{let{type:r,thread:n}=e;return"email_prompt"===r&&n===t},e.getEvents("liveChatChatId"))},Nl=e=>e.getChat("liveChatChatId").properties.queued,Ul=e=>{var t;return Boolean(null==(t=tl("queue",e))?void 0:t.writingInQueueEnabled)},Ll=e=>tl("fileSharing",e).enabled,Zl=e=>{const{active:t}=e.getChat("liveChatChatId");return t&&!vl(e)},Vl=e=>!vl(e)&&!e.getApplicationState("disableSendingMessage"),Hl=Bn([e=>Hn(e,"liveChatChatId"),e=>Wn(e,"liveChatChatId").properties.lastThread],(e,t)=>{return ke(e=>e.thread===t,(r=e).length-1,r);var r}),Wl=e=>Hl(e.getState()),Yl=Bn([e=>Hl(e),e=>ta(e)],(e,t)=>oe(e=>"system"!==e.author&&e.author!==t,e)),Gl=e=>Yl(e.getState()),Jl=(e,t)=>{if(e.hasEvent("liveChatChatId",t)){const{properties:r}=e.getEvent("liveChatChatId",t);return r.invitation}return!1},Kl=e=>!e.getApplicationState().mobile&&"bar"===cl(e),Ql=e=>{const t=hl(e,"liveChatChatId");return t&&t.properties.invitation?t:null},Xl=function(e,t){void 0===t&&(t=Ql(e));const{availability:r,invitation:n}=e.getApplicationState();return!("offline"!==r&&!Kl(e))||(!t||Boolean(t&&pe(t.properties.uniqueId,n.hiddenIds)))},ec=function(e,t){void 0===t&&(t=Ql(e));const{invitation:r}=e.getApplicationState();return Boolean(t&&pe(t.properties.uniqueId,r.displayedIds))},tc=e=>{const{visitorCounter:t}=Ec(e);return null==t?void 0:t.isVisible},rc=e=>{const{googleReviews:t}=Ec(e);return null==t?void 0:t.isVisible},nc=e=>{const{contactInvitation:t}=Ec(e);return null==t?void 0:t.isVisible},ac=e=>!Wl(e).some(e=>{let{author:t,own:r}=e;return!r&&"system"!==t}),ic=e=>{const{formType:t,fields:r,answered:n}=e.properties,a=r.filter(e=>e.answer&&e.label);return"ticket"!==t&&n&&he(a)},oc=e=>{const t=Xs(e),r=e.getEvents(t);return he(r)||r.every(e=>"form"===e.type&&ic(e))},uc=e=>{const t=e.getEvents("liveChatChatId");return he(t)||t.every(e=>"form"===e.type&&ic(e)||e.properties.invitation||e.properties.welcomeMessage)},sc=e=>zl(e)||Bl(e)||Nl(e),lc=(e,t)=>e.getEvents(t).some(e=>"message_draft"===e.type&&null===e.serverId),cc=e=>{const{embedded:t,actingAsDirectLink:r}=e.getApplicationState();return!t||r?"direct_link":"code"},dc=Bn([e=>Hl(e)],e=>e.filter(e=>"file"===e.type&&!e.delivered&&!e.properties.canceled)),pc=e=>dc(e.getState()),hc=e=>e.getChat("liveChatChatId").serverId,fc=e=>{const{mobile:t}=e.getApplicationState();return tl(t?"mobileMinimized":"minimized",e).enabled},gc=(e,t)=>e.getApplicationState("visibility").state===t,_c=(e,t)=>{const r=e.getApplicationState("config").properties.license;return Object.keys(r).some(e=>r[e][t])},mc=e=>tl("hideTrademark",e).enabled,Dc=(e,t)=>e.getApplicationState("config").properties.license[t],bc=e=>{const{language:t,isPreview:r}=e.getApplicationState();if("en"!==t||r)return!1;const n=Dc(e,"a9f288b2883da20306d30e179067406f");return Boolean(null==n?void 0:n.transfer_identity_enabled)},vc=e=>{const t=Dc(e,"632cead4b282481a422dd4e1d1567449");return{url:null==t?void 0:t.widget_message_box_moment_url,height:null==t?void 0:t.widget_message_box_moment_height}},yc=e=>{var t;const{url:r}=vc(e);return{disabled:!e.getChat("liveChatChatId").active||!el("liveChatChatId",e),visible:Js(r)&&(null==(t=e.getView("Moment"))||null==(t=t.data)?void 0:t.url)!==r}},wc=e=>e.getChat("liveChatChatId").active?e.getChat("liveChatChatId").properties.lastThread:null,Ec=e=>e.getView("minimized"),Cc=e=>{const{history:t,updatedAt:r}=e.getApplicationState("locationHistory");return r-(new Date).getTime()>18e5?[]:t},Ac=e=>{const{recommendations:t}=Ec(e);return Boolean(null==t?void 0:t.visible)},Fc=e=>e.localize(e.getApplicationState("limitReached")||!rl(e)?"agents_not_available":"agents_not_available_continuous"),kc=e=>{const t=e.getView("Chat/queue"),r=t&&t.numberInQueue,n=t&&t.waitingTime;return(e=>{const t=e.localize("user_in_queue"),{fields:r}=e.getView("Chat/prechat");if(!r||he(r))return t;const n=r.find(e=>{let{meta:t}=e;return t&&"groupSelect"===t});if(!n||!n.options||he(n.options))return t;const a=n.options.find(t=>{let{groupNumber:r}=t;return r===e.getApplicationState("group")});return a&&a.queueTemplate?a.queueTemplate:t})(e).replace(/%number%/g,"**"+r+"**").replace(/%minutes%/g,"**"+Math.floor(n/60)+"**")},xc=e=>{if(e.getApplicationState("isPreview"))return!1;if(!tl("rating",e).enabled)return!1;if(vl(e))return!1;const{active:t,properties:{rate:r}}=e.getChat("liveChatChatId");if(!t||r)return!1;return(e=>{const{properties:{timestamp:t}}=e.getChat("liveChatChatId");if(!t)return 0;const r=Wl(e);if(!r||0===(null==r?void 0:r.length))return 0;const n=oe(e=>"system_message"!==e.type,r);return n?n.timestamp-t:0})(e)/1e3/60>2&&(e=>Wl(e).some(e=>{let{author:t,own:r,properties:n}=e;return!r&&"system"!==t&&!n.invitation&&!n.welcomeMessage}))(e)},Sc=e=>"offline"===e.getApplicationState("availability"),Ic=e=>{if(!tl("homeScreen",e).enabled)return!1;return!("modern"===Fl(e))},Tc=(e,t)=>{const r=e.getUser(t);var n;return"openai_bot"===r.id?{...r,avatar:null!=(n=r.avatar)?n:"https://cdn.files-text.com/api/ow/img/integrations/openai/orb.gif"}:r},Bc=(e,t)=>{const{accepted:r,isExitIntent:n}=t,{mobile:a}=e.getApplicationState();return!r&&n&&!a},zc={};function Pc(e,t){let{query:r={},jsonpParam:n="jsonp",callbackName:a}=void 0===t?{}:t;return new Promise((t,i)=>{_s().then(o=>{const u=document.createElement("script"),s=a||ce(zc);zc[s]=!0;const l="__"+s;window[l]=e=>{delete zc[s],delete window[l],ms(u),t(e)},u.src=e+"?"+O({...r,[n]:l}),u.addEventListener("error",()=>{setTimeout(()=>i(new Error("JSONP request failed.")),100)}),o.appendChild(u)})})}const Oc=/\.([a-z]{1,})$/i,Rc=e=>{let{__priv:t}=e;const r={enabled:!0,x:parseInt(t.group["embedded_chat.eye_grabber.x"])+15,y:parseInt(t.group["embedded_chat.eye_grabber.y"]),src:Le(t.group["embedded_chat.eye_grabber.path"])};if(-1!==r.src.indexOf("/default/eyeCatchers/")){const e=r.src.match(Oc)[1];r.srcset={"1x":r.src,"2x":r.src.replace(new RegExp("\\."+e,"i"),"-2x."+e)}}return r},Mc=(e,t)=>{const r="get_dynamic_configuration"===e?"v3.6":"v3.4";return(e=>{let{licenseId:t,region:r}=e;return"https://api"+(e=>e&&"dal"!==e?"-"+e:"")(r)+(e=>1520===e?".staging":"")(t)+".livechatinc.com"})(t)+"/"+r+"/customer/action/"+e},$c=function(e,t){let{validateDefaultWidget:r=!0}=void 0===t?{}:t;return Pc(Mc("get_dynamic_configuration",e),{query:{license_id:e.licenseId,client_id:null!="c5e4f61e1a6c3b1521b541bc5c5a2ac5"?"c5e4f61e1a6c3b1521b541bc5c5a2ac5":"",url:Ue(e.url,["cw_configurator"]),..."number"==typeof e.groupId&&{group_id:e.groupId},...e.channelType&&{channel_type:e.channelType},...e.skipCodeInstallationTracking&&{test:1},...e.productName&&{origin:e.productName},...e.integrationName&&{implementation_type:e.integrationName}}}).then(t=>{if(t.error)switch(t.error.type){case"misdirected_request":return $c({...e,region:t.error.data.region});default:{const e=new Error(t.error.message);throw e.code=t.error.type.toUpperCase(),e}}if(r&&"livechat"!==t.default_widget){const e=new Error("The 'default_widget' is not 'livechat', but instead: '"+t.default_widget+"'");throw e.code="DEFAULT_WIDGET_NOT_LIVECHAT",e.organizationId=t.organization_id,e.defaultWidget=t.default_widget,e}if(!t.livechat_active){if("direct_link"===e.channelType){const t=O({utm_source:"expired_chat_link",utm_medium:"referral",utm_campaign:"lc_"+e.licenseId});window.location.replace("https://www.livechat.com/expired-chat-link/?"+t)}const t=new Error("License expired");throw t.code="LICENSE_EXPIRED",t}if(!t.livechat.domain_allowed){const e=new Error("Current domain is not added to the allowlist.");throw e.code="DOMAIN_NOT_ALLOWED",e}return n=t,a=e.region,{organizationId:n.organization_id,groupId:n.livechat.group_id,clientLimitExceeded:n.livechat.client_limit_exceeded,configVersion:n.livechat.config_version,localizationVersion:n.livechat.localization_version,onlineGroupIds:n.livechat.online_group_ids||[],region:a||null,language:n.livechat.language};var n,a})},jc=e=>{var t,r;const n="feade1d6c3f17748ae4c8d917a1e1068",a=Boolean(null==(t=e.properties.group[n])?void 0:t.forwardTicketFormToHelpdesk),i="1"===e.__priv.license["helpdesk.inbound_forwarding"],o=null==(r=e.properties.license[n])?void 0:r.hdLicenseID;return"number"==typeof o&&o>-1&&(a||i)},qc=e=>Pc(Mc("get_configuration",e),{callbackName:"lc_static_config",query:{organization_id:e.organizationId,version:e.version,..."number"==typeof e.groupId&&{group_id:e.groupId}}}).then(e=>(e=>{const{buttons:t,allowed_domains:r,prechat_form:n,ticket_form:a,__priv:i,properties:o,...u}=e,s="0"===i.group.tickets_enabled,l=!Boolean(i.disable_native_tickets)&&Boolean(a),c=jc(e),d=s||c||l;return{...u,...n&&{prechatForm:Sr(n)},...d&&a&&{ticketForm:Sr(a)},properties:o,buttons:t.map(e=>"image"===e.type?{id:e.id,type:e.type,onlineValue:Le(e.online_value),offlineValue:Le(e.offline_value)}:{id:e.id,type:e.type,onlineValue:e.online_value,offlineValue:e.offline_value}),...r&&{allowedDomains:r},__unsafeProperties:{...i.s&&{s:!0},group:{chatBoosters:i.group.chat_boosters,disabledMinimized:"1"===i.group["chat_window.disable_minimized"],disabledMinimizedOnMobile:"1"===i.group["chat_window.mobile_disable_minimized"],disabledOnMobile:"1"===i.group["chat_window.hide_on_mobile"],eyeCatcher:"1"===i.group["embedded_chat.display_eye_catcher"]?Rc(e):{enabled:!1},hasAgentAvatarsEnabled:"1"===i.group["chat_window.display_avatar"],hasCustomMobileSettings:"1"===i.group["chat_window.custom_mobile_settings"],hasHiddenTrademark:"1"===i.group["chat_window.hide_trademark"],hasSoundsEnabled:"0"===i.group["chat_window.disable_sounds"],initiallyHidden:"1"===i.group["chat_window.hide_on_init"]||"1"===i.group["chat_window.disable_minimized"],initiallyHiddenOnMobile:"1"===i.group["chat_window.mobile_hide_on_init"]||"1"===i.group["chat_window.mobile_disable_minimized"],hideOnInit:"1"===i.group["chat_window.hide_on_init"],language:i.group.language,linksUnfurlingEnabled:"1"===i.group.links_unfurling,logo:"1"===i.group["chat_window.display_logo"]?{enabled:!0,src:i.group["chat_window.logo_path"]}:{enabled:!1},minimizedType:i.group["chat_window.theme.minimized"],minimizedTypeOnMobile:i.group["chat_window.mobile_minimized_theme"],offlineMessagesEnabled:s,offsetX:parseInt(i.group["chat_window.offset_x"]),offsetXOnMobile:parseInt(i.group["chat_window.mobile_offset_x"]),offsetY:parseInt(i.group["chat_window.offset_y"]),offsetYOnMobile:parseInt(i.group["chat_window.mobile_offset_y"]),prechatFormAfterGreetingEnabled:"1"===i.group.pre_chat_survey_after_greeting,ratingEnabled:"1"===i.group["rate_me.enabled"],screenPosition:i.group["chat_window.screen_position"],screenPositionOnMobile:i.group["chat_window.mobile_screen_position"],transcriptButtonEnabled:"1"===i.group["chat_window.display_transcript_button"],theme:{name:i.group["chat_window.new_theme.name"],variant:i.group["chat_window.new_theme.variant"]||"light",customJson:i.group["chat_window.new_theme.custom_json"],agentbarBackgroundColor:i.group["chat_window.new_theme.agentbar_background_color"],agentbarText:i.group["chat_window.new_theme.agentbar_text"],agentMessageColorBackground:i.group["chat_window.new_theme.agent_message_color_background"],agentMessageColorText:i.group["chat_window.new_theme.agent_message_color_text"],backgroundColor:i.group["chat_window.new_theme.background_color"],ctaColor:i.group["chat_window.new_theme.cta_color"],minimizedColorBackground:i.group["chat_window.new_theme.minimized_color_background"],minimizedColorIcon:i.group["chat_window.new_theme.minimized_color_icon"],minimizedColorText:i.group["chat_window.new_theme.minimized_color_text"],systemMessageColor:i.group["chat_window.new_theme.system_message_color"],titlebarBackgroundColor:i.group["chat_window.new_theme.titlebar_background_color"],titlebarText:i.group["chat_window.new_theme.titlebar_text"],visitorMessageColorBackground:i.group["chat_window.new_theme.visitor_message_color_background"],visitorMessageColorText:i.group["chat_window.new_theme.visitor_message_color_text"]}},license:{creditCardMaskingEnabled:"1"===i.license.mask_credit_cards,nonProfit:"1"===i.license.non_profit,licenseinboundForwardingToHelpdeskEnabled:"1"===i.license["helpdesk.inbound_forwarding"]},helpdeskIntegrationEnabled:c,ticketFormMode:(p=e,jc(p)?"helpdesk":"0"===p.__priv.group.tickets_enabled?"offline_message":"livechat")}};var p})(e)),Nc=e=>Pc(Mc("get_localization",e),{callbackName:"lc_localization",query:{organization_id:e.organizationId,version:e.version,language:e.language,..."number"==typeof e.groupId&&{group_id:e.groupId}}}).then(e=>_e(e=>e.toLowerCase(),e)),Uc=e=>{var t,r;const n="feade1d6c3f17748ae4c8d917a1e1068",a=Boolean(null==(t=e.properties.group[n])?void 0:t.forwardTicketFormToHelpdesk),i=!!e.__unsafeProperties.license&&e.__unsafeProperties.license.licenseinboundForwardingToHelpdeskEnabled,o=null==(r=e.properties.license[n])?void 0:r.hdLicenseID;return"number"==typeof o&&o>-1&&(a||i)?"helpdesk":e.__unsafeProperties.group.offlineMessagesEnabled?"offline_message":"livechat"},Lc=e=>fetch("https://api.helpdesk.com/v1/externalTickets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():Promise.reject()).then(e=>{let{ID:t}=e;return{id:t}}),Zc=()=>{if((e=window.matchMedia)&&/native code/.test(String(e))){return!window.matchMedia("(hover: none)").matches}var e;return!0},Vc=()=>pe(navigator.platform,["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"])&&pe("Version/17",navigator.userAgent),Hc=()=>/mobile/gi.test(navigator.userAgent)&&!("MacIntel"===navigator.platform&&pe("iPad",navigator.userAgent)),Wc=()=>Hc()||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>0,Yc=()=>pe("Chrome",navigator.userAgent),Gc=()=>{const e=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);return e?parseInt(e[2],10):0},Jc=()=>/Firefox/.test(navigator.userAgent),Kc=()=>!Yc()&&/Safari/.test(navigator.userAgent),Qc=q()?window.localStorage:N,Xc=[/sendURLToGuardwareProxy/i,/safari-extension:\/\//],ed=!("true"===Qc.getItem("_livechat_has_visited"));Qc.setItem("_livechat_has_visited","true");const td=(e,t,r,n)=>{const{timeZone:i}=(new Intl.DateTimeFormat).resolvedOptions(),o={type:e+"_"+r,license:(null==n?void 0:n.license)||Ts(),userAgent:navigator.userAgent,mobile:Hc(),timeZone:String(i),logVersion:"2021-03-03",firstTimeVisitor:ed,severity:t,lc_env:"production",...n};if(i){const[e]=i.split("/");e!==i&&(o.timeZoneArea=String(e))}return(e=>{let{type:t,license:r,...n}=e;if(window.location.href.includes("openwidget.com"))return Promise.resolve();const i={licence_id:r.toString(),event_id:t,message:JSON.stringify(n)};return Ze("https://queue.livechatinc.com/logs",{method:"POST",headers:{Accept:"*/*","Content-Type":"application/x-www-form-urlencoded"},body:O(i)}).then(()=>Promise.resolve()).catch(a)})(o)},rd=function(e,t,r,n){void 0===n&&(n="chat_widget");const a={};var i;if(t instanceof Error?(a.errorMessage=t.message,a.stack=t.stack,a.code=t.code):a.errorMessage=JSON.stringify({error:t}),i=a,!Xc.some(e=>e.test(i.errorMessage+" "+i.stack)))return te(r)||(r={meta:JSON.stringify({info:r})}),td(n,"Error",e,{...r,...a})},nd=function(e,t,r){return void 0===r&&(r="chat_widget"),td(r,"Informational",e,t)},ad=e=>td("chat_widget","Notice",e),id=()=>de("webkit.messageHandlers.iosMobileWidget.postMessage",window)?"ios":!!de("androidMobileWidget.postMessage",window)&&"android",od=e=>window.androidMobileWidget.postMessage(JSON.stringify(e)),ud=e=>window.webkit.messageHandlers.iosMobileWidget.postMessage(e),sd=(()=>{const e=id();return"android"===e?od:"ios"===e?ud:null})(),ld=()=>Boolean(id()),cd=e=>{sd&&(sd({messageType:"uiReady"}),e.on("add_event",t=>{let{event:r}=t;if("message"!==r.type)return;const n=e.getUser(r.author).name;sd({messageType:"newMessage",text:r.properties.text,id:r.id,timestamp:r.timestamp,author:{name:n}})}),e.on("mobile_wrapper_minimize_intent",()=>{sd({messageType:"hideChatWindow"})}))};export{ad as $,ie as A,lu as B,re as C,Ts as D,rd as E,ae as F,cd as G,Wc as H,ld as I,Ce as J,ce as K,jo as L,Xl as M,uu as N,tc as O,rc as P,iu as Q,su as R,nc as S,Yc as T,Ko as U,sa as V,Yn as W,qo as X,pe as Y,fc as Z,nd as _,Ws as a,be as a$,zs as a0,Ds as a1,ms as a2,gs as a3,_e as a4,ts as a5,de as a6,En as a7,Io as a8,ne as a9,Ra as aA,La as aB,Ma as aC,Ta as aD,Un as aE,Qn as aF,$n as aG,Mn as aH,Ct as aI,Sa as aJ,fe as aK,kn as aL,De as aM,va as aN,ya as aO,wa as aP,Fa as aQ,za as aR,Ba as aS,Oa as aT,Pa as aU,Cn as aV,_a as aW,Aa as aX,fa as aY,Gn as aZ,Kn as a_,Le as aa,Ms as ab,_s as ac,Ic as ad,Qs as ae,Pl as af,vt as ag,U as ah,te as ai,H as aj,Da as ak,ba as al,Ea as am,Ca as an,ja as ao,Na as ap,ka as aq,xa as ar,Ia as as,jn as at,ga as au,Rn as av,ma as aw,$a as ax,qa as ay,Ua as az,Ec as b,Re as b$,oe as b0,Ft as b1,me as b2,At as b3,da as b4,Et as b5,Za as b6,Ka as b7,Qa as b8,Wa as b9,Sc as bA,ou as bB,Qc as bC,ve as bD,Pe as bE,hu as bF,G as bG,Ee as bH,gu as bI,fu as bJ,Ie as bK,ln as bL,is as bM,Qu as bN,us as bO,ns as bP,zo as bQ,Gc as bR,Jc as bS,Fl as bT,bc as bU,Wo as bV,Ys as bW,Ss as bX,Yo as bY,Us as bZ,Is as b_,Bo as ba,Y as bb,Xu as bc,$s as bd,Gu as be,js as bf,Zs as bg,cn as bh,Ql as bi,ml as bj,Il as bk,hl as bl,Ns as bm,Uc as bn,qs as bo,ec as bp,wc as bq,Vo as br,tl as bs,eu as bt,we as bu,Js as bv,No as bw,lc as bx,Uo as by,xl as bz,gc as c,jt as c$,_c as c0,mc as c1,hc as c2,$l as c3,Zc as c4,Vs as c5,Fe as c6,dl as c7,Ac as c8,el as c9,Pn as cA,Tc as cB,al as cC,wl as cD,Jl as cE,Ml as cF,Ol as cG,Xs as cH,nu as cI,Ae as cJ,Kc as cK,au as cL,il as cM,Vc as cN,Hu as cO,Pu as cP,qe as cQ,ls as cR,Gs as cS,ic as cT,ll as cU,Gl as cV,pu as cW,kt as cX,Lt as cY,Ut as cZ,qt as c_,El as ca,Ll as cb,Zl as cc,Lc as cd,Bn as ce,pc as cf,q as cg,kl as ch,sl as ci,vl as cj,Vl as ck,yc as cl,Ls as cm,vc as cn,Uu as co,Hs as cp,zl as cq,Bl as cr,Nl as cs,Fc as ct,kc as cu,sc as cv,uc as cw,$e as cx,Cl as cy,xc as cz,$c as d,K as d$,Nt as d0,lt as d1,ot as d2,_t as d3,We as d4,St as d5,nt as d6,Bt as d7,xt as d8,$t as d9,Xe as dA,et as dB,tt as dC,rt as dD,at as dE,ut as dF,ct as dG,dt as dH,ft as dI,mt as dJ,Dt as dK,Jo as dL,bl as dM,$o as dN,Ro as dO,Oo as dP,Kl as dQ,gl as dR,fl as dS,Mo as dT,Po as dU,Dl as dV,ul as dW,Al as dX,Ho as dY,Sl as dZ,Rl as d_,Mt as da,Pt as db,zt as dc,Tt as dd,sr as de,It as df,Rt as dg,Ot as dh,Qe as di,Zt as dj,ht as dk,st as dl,jr as dm,$r as dn,Mr as dp,bt as dq,it as dr,pt as ds,gt as dt,Ve as du,He as dv,Ye as dw,Ge as dx,Je as dy,Ke as dz,Ne as e,ee as e0,cc as e1,Zo as e2,ac as e3,Bc as e4,_l as e5,Lo as e6,wn as e7,ql as e8,Go as e9,se as ea,du as eb,cu as ec,Ze as f,Cc as g,qc as h,Hc as i,Nc as j,ze as k,le as l,ca as m,Wn as n,ye as o,rl as p,jl as q,cl as r,X as s,id as t,Ps as u,nl as v,pl as w,Wl as x,ge as y,he as z};